|
@@ -2,6 +2,7 @@
|
|
#include "aboutwindow.h"
|
|
#include "aboutwindow.h"
|
|
#include "networkwidget.h"
|
|
#include "networkwidget.h"
|
|
#include "ui_mainwindow.h"
|
|
#include "ui_mainwindow.h"
|
|
|
|
+#include "installdialog.h"
|
|
|
|
|
|
#include <string>
|
|
#include <string>
|
|
#include <map>
|
|
#include <map>
|
|
@@ -54,16 +55,14 @@ static void handleZTMessage(void *arg,unsigned long id,const char *line)
|
|
MainWindow::MainWindow(QWidget *parent) :
|
|
MainWindow::MainWindow(QWidget *parent) :
|
|
QMainWindow(parent),
|
|
QMainWindow(parent),
|
|
ui(new Ui::MainWindow),
|
|
ui(new Ui::MainWindow),
|
|
- nam(new QNetworkAccessManager(this))
|
|
|
|
|
|
+ pollServiceTimerId(0)
|
|
{
|
|
{
|
|
ui->setupUi(this);
|
|
ui->setupUi(this);
|
|
- this->startTimer(1000); // poll service every second
|
|
|
|
|
|
+ this->pollServiceTimerId = this->startTimer(1000);
|
|
this->setEnabled(false); // gets enabled when updates are received
|
|
this->setEnabled(false); // gets enabled when updates are received
|
|
mainWindow = this;
|
|
mainWindow = this;
|
|
this->cyclesSinceResponseFromService = 0;
|
|
this->cyclesSinceResponseFromService = 0;
|
|
|
|
|
|
- QObject::connect(nam,SIGNAL(finished(QNetworkReply*)),this,SLOT(on_networkReply(QNetworkReply*)));
|
|
|
|
-
|
|
|
|
if (ui->networkListWidget->verticalScrollBar())
|
|
if (ui->networkListWidget->verticalScrollBar())
|
|
ui->networkListWidget->verticalScrollBar()->setSingleStep(8);
|
|
ui->networkListWidget->verticalScrollBar()->setSingleStep(8);
|
|
|
|
|
|
@@ -84,11 +83,15 @@ void MainWindow::timerEvent(QTimerEvent *event)
|
|
{
|
|
{
|
|
event->accept();
|
|
event->accept();
|
|
|
|
|
|
|
|
+ if (this->isHidden())
|
|
|
|
+ return;
|
|
|
|
+
|
|
if (!zeroTierClient) {
|
|
if (!zeroTierClient) {
|
|
std::string authToken;
|
|
std::string authToken;
|
|
if (!ZeroTier::Utils::readFile(ZeroTier::Node::LocalClient::authTokenDefaultUserPath().c_str(),authToken)) {
|
|
if (!ZeroTier::Utils::readFile(ZeroTier::Node::LocalClient::authTokenDefaultUserPath().c_str(),authToken)) {
|
|
#ifdef __APPLE__
|
|
#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
|
|
// Run the little AppleScript hack that asks for admin credentials and
|
|
// then installs the auth token file in the current user's home.
|
|
// 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");
|
|
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());
|
|
QProcess::execute(authHelperPath,QStringList());
|
|
} else {
|
|
} 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);
|
|
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
|
|
// Run the little AppleScript hack that asks for admin credentials and
|
|
// then installs the auth token file in the current user's home.
|
|
// 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");
|
|
QString installHelperPath(QCoreApplication::applicationDirPath() + "/../Resources/helpers/mac/ZeroTier One (Install).app/Contents/MacOS/applet");
|
|
if (!QFile::exists(installHelperPath)) {
|
|
if (!QFile::exists(installHelperPath)) {
|
|
QMessageBox::critical(this,"Unable to Locate Helper","Unable to locate install helper, cannot install service.",QMessageBox::Ok,QMessageBox::NoButton);
|
|
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;
|
|
return;
|
|
}
|
|
}
|
|
QProcess::execute(installHelperPath,QStringList());
|
|
QProcess::execute(installHelperPath,QStringList());
|
|
|
|
+ */
|
|
}
|
|
}
|
|
#endif
|
|
#endif
|
|
|
|
|
|
@@ -306,7 +317,3 @@ void MainWindow::on_addressButton_clicked()
|
|
{
|
|
{
|
|
QApplication::clipboard()->setText(this->myAddress);
|
|
QApplication::clipboard()->setText(this->myAddress);
|
|
}
|
|
}
|
|
-
|
|
|
|
-void MainWindow::on_networkReply(QNetworkReply *reply)
|
|
|
|
-{
|
|
|
|
-}
|
|
|