summaryrefslogtreecommitdiff
path: root/ZeroTierUI/mainwindow.cpp
diff options
context:
space:
mode:
authorAdam Ierymenko <adam.ierymenko@gmail.com>2014-01-03 22:14:30 -0800
committerAdam Ierymenko <adam.ierymenko@gmail.com>2014-01-03 22:14:30 -0800
commit67a71868cb5f0bfed14cbaa2100fe03a3998f1c6 (patch)
treeffe2a93b44157e4ded52053dc5a83d784a18801e /ZeroTierUI/mainwindow.cpp
parent029f64495c8b931e38fcdea0dd496820e2610fb1 (diff)
downloadinfinitytier-67a71868cb5f0bfed14cbaa2100fe03a3998f1c6.tar.gz
infinitytier-67a71868cb5f0bfed14cbaa2100fe03a3998f1c6.zip
Install dialog in UI.
Diffstat (limited to 'ZeroTierUI/mainwindow.cpp')
-rw-r--r--ZeroTierUI/mainwindow.cpp27
1 files changed, 17 insertions, 10 deletions
diff --git a/ZeroTierUI/mainwindow.cpp b/ZeroTierUI/mainwindow.cpp
index b4afcbbb..1c62d015 100644
--- a/ZeroTierUI/mainwindow.cpp
+++ b/ZeroTierUI/mainwindow.cpp
@@ -2,6 +2,7 @@
#include "aboutwindow.h"
#include "networkwidget.h"
#include "ui_mainwindow.h"
+#include "installdialog.h"
#include <string>
#include <map>
@@ -54,16 +55,14 @@ static void handleZTMessage(void *arg,unsigned long id,const char *line)
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow),
- nam(new QNetworkAccessManager(this))
+ pollServiceTimerId(0)
{
ui->setupUi(this);
- this->startTimer(1000); // poll service every second
+ this->pollServiceTimerId = this->startTimer(1000);
this->setEnabled(false); // gets enabled when updates are received
mainWindow = this;
this->cyclesSinceResponseFromService = 0;
- QObject::connect(nam,SIGNAL(finished(QNetworkReply*)),this,SLOT(on_networkReply(QNetworkReply*)));
-
if (ui->networkListWidget->verticalScrollBar())
ui->networkListWidget->verticalScrollBar()->setSingleStep(8);
@@ -84,11 +83,15 @@ void MainWindow::timerEvent(QTimerEvent *event)
{
event->accept();
+ if (this->isHidden())
+ return;
+
if (!zeroTierClient) {
std::string authToken;
if (!ZeroTier::Utils::readFile(ZeroTier::Node::LocalClient::authTokenDefaultUserPath().c_str(),authToken)) {
#ifdef __APPLE__
- if (QFile::exists("/Library/Application Support/ZeroTier/One/zerotier-one")) {
+ //if (QFile::exists("/Library/Application Support/ZeroTier/One/zerotier-one")) {
+ if (false) {
// Run the little AppleScript hack that asks for admin credentials and
// then installs the auth token file in the current user's home.
QString authHelperPath(QCoreApplication::applicationDirPath() + "/../Resources/helpers/mac/ZeroTier One (Authenticate).app/Contents/MacOS/applet");
@@ -105,11 +108,18 @@ void MainWindow::timerEvent(QTimerEvent *event)
}
QProcess::execute(authHelperPath,QStringList());
} else {
- // Download the latest version and install it
+ // If the service is not installed, download the installer and run it
+ // for the first time.
this->setEnabled(false);
+ InstallDialog *id = new InstallDialog(this);
+ id->setModal(true);
+ id->show();
+ this->setHidden(true);
+ return;
// Run the little AppleScript hack that asks for admin credentials and
// then installs the auth token file in the current user's home.
+ /*
QString installHelperPath(QCoreApplication::applicationDirPath() + "/../Resources/helpers/mac/ZeroTier One (Install).app/Contents/MacOS/applet");
if (!QFile::exists(installHelperPath)) {
QMessageBox::critical(this,"Unable to Locate Helper","Unable to locate install helper, cannot install service.",QMessageBox::Ok,QMessageBox::NoButton);
@@ -117,6 +127,7 @@ void MainWindow::timerEvent(QTimerEvent *event)
return;
}
QProcess::execute(installHelperPath,QStringList());
+ */
}
#endif
@@ -306,7 +317,3 @@ void MainWindow::on_addressButton_clicked()
{
QApplication::clipboard()->setText(this->myAddress);
}
-
-void MainWindow::on_networkReply(QNetworkReply *reply)
-{
-}