From f311be96a9b8290266dd1b75db40d78ff221e8b4 Mon Sep 17 00:00:00 2001 From: Adam Ierymenko Date: Thu, 19 Dec 2013 14:59:52 -0800 Subject: More UI cleanup... --- ZeroTierUI/mainwindow.cpp | 30 +++++----- ZeroTierUI/mainwindow.h | 2 +- ZeroTierUI/mainwindow.ui | 138 ++++++++++++++++++++++++++++++++---------- ZeroTierUI/networkwidget.cpp | 23 ++++--- ZeroTierUI/networkwidget.ui | 139 +++++++++++++++++++++++++++++-------------- 5 files changed, 233 insertions(+), 99 deletions(-) (limited to 'ZeroTierUI') diff --git a/ZeroTierUI/mainwindow.cpp b/ZeroTierUI/mainwindow.cpp index afc981c6..fdc70f74 100644 --- a/ZeroTierUI/mainwindow.cpp +++ b/ZeroTierUI/mainwindow.cpp @@ -56,6 +56,10 @@ MainWindow::MainWindow(QWidget *parent) : this->setEnabled(false); // gets enabled when updates are received mainWindow = this; this->cyclesSinceResponseFromService = 0; + + QWidgetList widgets = this->findChildren(); + foreach(QWidget* widget, widgets) + widget->setAttribute(Qt::WA_MacShowFocusRect,false); } MainWindow::~MainWindow() @@ -186,19 +190,17 @@ void MainWindow::customEvent(QEvent *event) } } - if (this->myAddress.size()) { - QString st(this->myAddress); - st += " ("; - st += this->myStatus; - st += ", v"; - st += this->myVersion; - st += ", "; - st += QString::number(this->numPeers); - st += " peers)"; - while (st.size() < 45) - st += QChar::Space; - ui->statusAndAddressButton->setText(st); - } + if (this->myAddress.size()) + ui->addressButton->setText(this->myAddress); + else ui->addressButton->setText("??????????"); + + QString st(this->myStatus); + st += ", v"; + st += this->myVersion; + st += ", "; + st += QString::number(this->numPeers); + st += " direct links to peers"; + ui->statusLabel->setText(st); if (this->myStatus == "ONLINE") { if (!this->isEnabled()) @@ -266,7 +268,7 @@ void MainWindow::on_networkIdLineEdit_textChanged(const QString &text) ui->networkIdLineEdit->setText(newText); } -void MainWindow::on_statusAndAddressButton_clicked() +void MainWindow::on_addressButton_clicked() { QApplication::clipboard()->setText(this->myAddress); } diff --git a/ZeroTierUI/mainwindow.h b/ZeroTierUI/mainwindow.h index 66a0b350..2a9f4de2 100644 --- a/ZeroTierUI/mainwindow.h +++ b/ZeroTierUI/mainwindow.h @@ -46,7 +46,7 @@ private slots: void on_joinNetworkButton_clicked(); void on_actionAbout_triggered(); void on_networkIdLineEdit_textChanged(const QString &text); - void on_statusAndAddressButton_clicked(); + void on_addressButton_clicked(); private: Ui::MainWindow *ui; diff --git a/ZeroTierUI/mainwindow.ui b/ZeroTierUI/mainwindow.ui index 23762fec..c9ca7f8d 100644 --- a/ZeroTierUI/mainwindow.ui +++ b/ZeroTierUI/mainwindow.ui @@ -20,19 +20,19 @@ - 6 + 0 - 6 + 0 - 6 + 0 - 6 + 0 - 6 + 0 @@ -42,7 +42,9 @@ QListWidget#networkListWidget::Item { background-color: rgba(0,0,0,10); -}s + padding: 0; + margin: 0 0.15em 0.15em 0.15em; +} QFrame::NoFrame @@ -59,11 +61,8 @@ QAbstractItemView::NoSelection - - QAbstractItemView::ScrollPerPixel - - 5 + 0 true @@ -72,15 +71,9 @@ - - - 0 - 0 - - - 5 + 0 0 @@ -95,7 +88,7 @@ 0 - + 0 @@ -106,28 +99,36 @@ Courier 12 + 75 + true - - Click to copy your address to clipboard. + + Your 10-digit ZeroTier address; click to copy to clipboard. QPushButton { border: 0; + text-align: left; + padding: 0 5px 0 5px; background-color: transparent; } QPushButton:focus { - background-color: rgba(0,0,0,25); + background-color: rgba(0,0,0,15); } QPushButton:hover { - background-color: rgba(0,0,0,25); + background-color: rgba(0,0,0,15); } - + +QPushButton:pressed { + background-color: rgba(0,0,0,75); +} +s - 0000000000 (OFFLINE, v0.0.0, 0 peers) + ########## true @@ -135,37 +136,105 @@ QPushButton:hover { - + 0 0 + + + 10 + + + + Your network connection status. + + + padding: 0 0.75em 0 0.75em; + + + STATUS, etc. + + + Qt::PlainText + + + + + + + + 0 + 0 + + Courier 12 - - Enter Hexadecimal Network ID + + Enter a hexadecimal network ID to join a network. 16 + + true + - (Numeric ID of Network to Join) + ################ - - Join Network + + + 0 + 0 + + + + + Courier + 16 + 75 + true + + + + Join this network. + + + QPushButton { + padding: 0 0.8em 0 0.8em; + margin: 0; + border: 0; + background: transparent; +} + +QPushButton:focus { + background-color: rgba(0,0,0,25); +} + +QPushButton:hover { + background-color: rgba(0,0,0,25); +} + +QPushButton:pressed { + background-color: rgba(0,0,0,75); +} + - Join + + + + + true @@ -202,6 +271,13 @@ QPushButton:hover { + + + + 12 + + + About diff --git a/ZeroTierUI/networkwidget.cpp b/ZeroTierUI/networkwidget.cpp index d71c6f12..2bbd23f7 100644 --- a/ZeroTierUI/networkwidget.cpp +++ b/ZeroTierUI/networkwidget.cpp @@ -17,10 +17,15 @@ NetworkWidget::NetworkWidget(QWidget *parent,const std::string &nwid) : { ui->setupUi(this); ui->networkIdPushButton->setText(QString(nwid.c_str())); + QFontMetrics fm(ui->ipListWidget->font()); int lineHeight = ui->ipListWidget->spacing() + fm.height(); - ui->ipListWidget->setMinimumHeight(lineHeight * 3); - ui->ipListWidget->setMaximumHeight(lineHeight * 3); + ui->ipListWidget->setMinimumHeight(lineHeight * 4); + ui->ipListWidget->setMaximumHeight(lineHeight * 4); + + QWidgetList widgets = this->findChildren(); + foreach(QWidget* widget, widgets) + widget->setAttribute(Qt::WA_MacShowFocusRect,false); } NetworkWidget::~NetworkWidget() @@ -38,19 +43,23 @@ void NetworkWidget::setStatus(const std::string &status,const std::string &age) void NetworkWidget::setNetworkName(const std::string &name) { - ui->nameLabel->setText(QString(name.c_str())); + if (name == "?") { + ui->nameLabel->setText((QString("( ")+this->networkId().c_str())+" )"); + } else { + ui->nameLabel->setText(QString(name.c_str())); + } } void NetworkWidget::setNetworkType(const std::string &type) { ui->networkTypeLabel->setText(QString(type.c_str())); if (type == "?") - ui->networkTypeLabel->setToolTip("Waiting for configuration..."); + ui->networkTypeLabel->setStatusTip("Waiting for configuration..."); else if (type == "public") - ui->networkTypeLabel->setToolTip("This network can be joined by anyone."); + ui->networkTypeLabel->setStatusTip("This network can be joined by anyone in the world."); else if (type == "private") - ui->networkTypeLabel->setToolTip("This network is private, only authorized peers can join."); - else ui->networkTypeLabel->setToolTip(QString()); + ui->networkTypeLabel->setStatusTip("This network is private; only authorized peers can join."); + else ui->networkTypeLabel->setStatusTip("Unknown network type."); } void NetworkWidget::setNetworkDeviceName(const std::string &dev) diff --git a/ZeroTierUI/networkwidget.ui b/ZeroTierUI/networkwidget.ui index 84c26829..07eb253c 100644 --- a/ZeroTierUI/networkwidget.ui +++ b/ZeroTierUI/networkwidget.ui @@ -22,25 +22,28 @@ NetworkWidget - + - 6 + 0 - 6 + 0 - 6 + 0 - 6 + 0 - 6 + 0 + + 2 + 0 @@ -63,13 +66,13 @@ - 15 + 16 + 75 + true - - background-color: rgba(0,0,0,25); -padding: 0.25em; -margin: 0; + + This network's short name. networkname @@ -133,14 +136,21 @@ margin: 0; + + + 0 + 0 + + + Courier 75 true - - Click to copy network ID to clipboard. + + Hexadecimal network ID; click to copy to clipboard. QPushButton { @@ -152,11 +162,15 @@ margin: 0; } QPushButton:focus { - background-color: rgba(0,0,0,25); + background-color: rgba(0,0,0,15); } QPushButton:hover { - background-color: rgba(0,0,0,25); + background-color: rgba(0,0,0,15); +} + +QPushButton:pressed { + background-color: rgba(0,0,0,75); } @@ -186,6 +200,9 @@ QPushButton:hover { true + + What kind of network? Public or private? + ? @@ -242,6 +259,9 @@ QPushButton:hover { true + + Status of this network. + ? @@ -263,6 +283,9 @@ QPushButton:hover { 8 + + How recently did this network refresh its settings? + (configuration is 0 seconds old) @@ -305,6 +328,9 @@ QPushButton:hover { true + + The name of the network device on your system. + ? @@ -329,10 +355,7 @@ QPushButton:hover { - 3 - - - QLayout::SetNoConstraint + 0 0 @@ -348,11 +371,21 @@ QPushButton:hover { + + + 0 + 0 + + + 12 false + + padding: 0.1em 0 0.1em 0; + IP Address Assignments @@ -363,12 +396,6 @@ QPushButton:hover { - - - 0 - 0 - - 0 @@ -381,16 +408,16 @@ QPushButton:hover { 12 - - Double-click IP to copy to clipboard. + + Double-click an IP to copy it to the clipboard. QListWidget { - background-color: rgba(0,0,0,10); + background-color: rgba(0,0,0,5); } QListWidget:hover { - background-color: rgba(0,0,0,25); + background-color: rgba(0,0,0,15); } @@ -415,19 +442,7 @@ QListWidget:hover { - - - - 0 - 0 - - - - - 100 - 0 - - + 0 @@ -452,22 +467,55 @@ QListWidget:hover { 40 - 20 + 1 + + + 0 + 0 + + - 10 - false + 12 + + Leave this network. + + + QPushButton { + border: 0; + padding: 0.25em; + margin: 0; + text-align: right; + background-color: transparent; +} + +QPushButton:focus { + background-color: rgba(0,0,0,25); +} + +QPushButton:hover { + background-color: rgba(0,0,0,25); +} + +QPushButton:pressed { + background-color: rgba(0,0,0,75); +} + + Leave Network + + true + @@ -480,7 +528,6 @@ QListWidget:hover { ipListWidget - leaveNetworkButton -- cgit v1.2.3