From 8be664cca9ca6b95515fb1bda961f5c844af7d0f Mon Sep 17 00:00:00 2001 From: Adam Ierymenko Date: Fri, 17 Jan 2014 10:36:58 -0800 Subject: UI cleanup and license dialog. --- ZeroTierUI/main.cpp | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) (limited to 'ZeroTierUI/main.cpp') 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 +#include +#include + +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(); } -- cgit v1.2.3