summaryrefslogtreecommitdiff
path: root/ZeroTierUI/mainwindow.cpp
diff options
context:
space:
mode:
authorAdam Ierymenko <adam.ierymenko@zerotier.com>2014-01-24 23:15:14 -0800
committerAdam Ierymenko <adam.ierymenko@zerotier.com>2014-01-24 23:15:14 -0800
commitb65f7f78951450998bc4a85f60ce1350c2ed2a12 (patch)
treef1a6ec158cadc784b9402575a610d83a506a7eca /ZeroTierUI/mainwindow.cpp
parent434ce96f2cd3da9c7bae278391582526e952b24e (diff)
downloadinfinitytier-b65f7f78951450998bc4a85f60ce1350c2ed2a12.tar.gz
infinitytier-b65f7f78951450998bc4a85f60ce1350c2ed2a12.zip
Qt GUI now builds and runs on Windows. On Windows it can (via its manifest) automatically request admin rights on launch, which plugs it nicely into Windows' admin rights system without requiring file copies and such.
Diffstat (limited to 'ZeroTierUI/mainwindow.cpp')
-rw-r--r--ZeroTierUI/mainwindow.cpp43
1 files changed, 26 insertions, 17 deletions
diff --git a/ZeroTierUI/mainwindow.cpp b/ZeroTierUI/mainwindow.cpp
index 07df1964..3e4e96a0 100644
--- a/ZeroTierUI/mainwindow.cpp
+++ b/ZeroTierUI/mainwindow.cpp
@@ -99,13 +99,19 @@ MainWindow::MainWindow(QWidget *parent) :
ui->setupUi(this);
if (ui->networkListWidget->verticalScrollBar())
ui->networkListWidget->verticalScrollBar()->setSingleStep(8);
+
+#ifdef __APPLE__
QWidgetList widgets = this->findChildren<QWidget*>();
foreach(QWidget *widget, widgets)
widget->setAttribute(Qt::WA_MacShowFocusRect,false);
- ui->noNetworksLabel->setText("Connecting to Service..."); // changed when result is received
+#endif
+
+ ui->noNetworksLabel->setVisible(true);
+ ui->noNetworksLabel->setText("Connecting to Service...");
+ ui->bottomContainerWidget->setVisible(false);
+ ui->networkListWidget->setVisible(false);
this->pollServiceTimerId = this->startTimer(1000);
- this->setEnabled(false); // gets enabled when updates are received
this->cyclesSinceResponseFromService = 0;
}
@@ -173,19 +179,25 @@ void MainWindow::timerEvent(QTimerEvent *event)
#endif
if (!ZeroTier::Utils::readFile(ZeroTier::Node::LocalClient::authTokenDefaultUserPath().c_str(),authToken)) {
- QMessageBox::critical(this,"Cannot Authorize","Unable to authorize this user to administrate ZeroTier One. (Did you enter your password correctly?)",QMessageBox::Ok,QMessageBox::NoButton);
- QApplication::exit(1);
- return;
+ if (!ZeroTier::Utils::readFile(ZeroTier::Node::LocalClient::authTokenDefaultSystemPath().c_str(),authToken)) {
+ QMessageBox::critical(this,"Cannot Authorize","Unable to authorize this user to administrate ZeroTier One. (Did you enter your password correctly?)",QMessageBox::Ok,QMessageBox::NoButton);
+ QApplication::exit(1);
+ return;
+ }
}
}
zeroTierClient = new ZeroTier::Node::LocalClient(authToken.c_str(),0,&handleZTMessage,this);
}
- // TODO: do something more user-friendly here... or maybe try to restart
- // the service?
- if (++this->cyclesSinceResponseFromService == 4)
- QMessageBox::critical(this,"No Response from Service","The ZeroTier One service does not appear to be running.",QMessageBox::Ok,QMessageBox::NoButton);
+ if (++this->cyclesSinceResponseFromService >= 4) {
+ if (this->cyclesSinceResponseFromService == 4)
+ QMessageBox::warning(this,"Service Not Running","Can't Connect to the ZeroTier One service. Is it running?",QMessageBox::Ok);
+ ui->noNetworksLabel->setVisible(true);
+ ui->noNetworksLabel->setText("Connecting to Service...");
+ ui->bottomContainerWidget->setVisible(false);
+ ui->networkListWidget->setVisible(false);
+ }
zeroTierClient->send("info");
zeroTierClient->send("listnetworks");
@@ -281,6 +293,11 @@ void MainWindow::customEvent(QEvent *event)
ui->noNetworksLabel->setVisible(true);
} else ui->noNetworksLabel->setVisible(false);
+ if (!ui->bottomContainerWidget->isVisible())
+ ui->bottomContainerWidget->setVisible(true);
+ if (!ui->networkListWidget->isVisible())
+ ui->networkListWidget->setVisible(true);
+
if (this->myAddress.size())
ui->addressButton->setText(this->myAddress);
else ui->addressButton->setText(" ");
@@ -292,14 +309,6 @@ void MainWindow::customEvent(QEvent *event)
st += QString::number(this->numPeers);
st += " direct links to peers";
ui->statusLabel->setText(st);
-
- if (this->myStatus == "ONLINE") {
- if (!this->isEnabled())
- this->setEnabled(true);
- } else {
- if (this->isEnabled())
- this->setEnabled(false);
- }
}
void MainWindow::on_joinNetworkButton_clicked()