diff options
| author | Adam Ierymenko <adam.ierymenko@gmail.com> | 2014-01-17 10:36:58 -0800 |
|---|---|---|
| committer | Adam Ierymenko <adam.ierymenko@gmail.com> | 2014-01-17 10:36:58 -0800 |
| commit | 8be664cca9ca6b95515fb1bda961f5c844af7d0f (patch) | |
| tree | 6ebf94344136d7f6b3d2fe8d178bf7489f2f895b /ZeroTierUI/main.cpp | |
| parent | 866edd41a7328da35136cd93640f4ad2630f98ed (diff) | |
| download | infinitytier-8be664cca9ca6b95515fb1bda961f5c844af7d0f.tar.gz infinitytier-8be664cca9ca6b95515fb1bda961f5c844af7d0f.zip | |
UI cleanup and license dialog.
Diffstat (limited to 'ZeroTierUI/main.cpp')
| -rw-r--r-- | ZeroTierUI/main.cpp | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/ZeroTierUI/main.cpp b/ZeroTierUI/main.cpp index 2c7b41f1..58571c63 100644 --- a/ZeroTierUI/main.cpp +++ b/ZeroTierUI/main.cpp @@ -26,13 +26,44 @@ */ #include "mainwindow.h" +#include "installdialog.h" +#include "licensedialog.h" + #include <QApplication> +#include <QDir> +#include <QString> + +QSettings *settings = (QSettings *)0; int main(int argc, char *argv[]) { QApplication a(argc, argv); + +#ifdef __APPLE__ + // If service isn't installed, download and install it + if (!QFile::exists("/Library/Application Support/ZeroTier/One/zerotier-one")) { + // InstallDialog is an alternative main window. It will re-launch the app + // when done. + InstallDialog id; + id.show(); + return a.exec(); + } +#endif + +#ifdef __APPLE__ + QString zt1AppSupport(QDir::homePath() + "/Library/Application Support/ZeroTier/One"); + QDir::root().mkpath(zt1AppSupport); + settings = new QSettings(zt1AppSupport + "/ui.ini",QSettings::IniFormat); +#else + settings = new QSettings("ZeroTier Networks","ZeroTier One"); +#endif + + if (!settings->value("acceptedLicenseV1",false).toBool()) { + LicenseDialog ld; + ld.exec(); + } + MainWindow w; w.show(); - return a.exec(); } |
