diff options
author | Daniel Molkentin <danimo@owncloud.com> | 2014-01-15 14:08:42 +0400 |
---|---|---|
committer | Daniel Molkentin <danimo@owncloud.com> | 2014-01-15 14:09:31 +0400 |
commit | dc9f145a247808cadc55c3141f97560fae8abdc3 (patch) | |
tree | fbc3cd321e1176d03270d4473d70f4ce5dfac305 /src/main.cpp | |
parent | 93239cbdca2d963d4b696c37d38175534f72d6de (diff) |
New Updater for Windows, passive notification on Linux, Sparkle on Mac
Diffstat (limited to 'src/main.cpp')
-rw-r--r-- | src/main.cpp | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/src/main.cpp b/src/main.cpp index 043f800dc..d91597ce9 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -16,9 +16,13 @@ #include "mirall/application.h" #include "mirall/theme.h" #include "mirall/utility.h" +#include "mirall/cocoainitializer.h" +#include "mirall/updater.h" -#include <QMessageBox> #include <QTimer> +#include <QMessageBox> + +using namespace Mirall; void warnSystray() { @@ -27,13 +31,16 @@ void warnSystray() "If you are running XFCE, please follow " "<a href=\"http://docs.xfce.org/xfce/xfce4-panel/systray\">these instructions</a>. " "Otherwise, please install a system tray application such as 'trayer' and try again.") - .arg(Mirall::Theme::instance()->appNameGUI())); + .arg(Theme::instance()->appNameGUI())); } int main(int argc, char **argv) { Q_INIT_RESOURCE(mirall); +#ifdef Q_OS_MAC + Mac::CocoaInitializer cocoaInit; // RIIA +#endif Mirall::Application app(argc, argv); #ifndef Q_OS_WIN signal(SIGPIPE, SIG_IGN); @@ -43,6 +50,19 @@ int main(int argc, char **argv) return 0; } + Updater *updater = Updater::instance(); + switch (updater->updateState()) { + case Updater::UpdateAvailable: + updater->performUpdate(); + return true; + case Updater::UpdateFailed: + updater->showFallbackMessage(); + break; + case Updater::NoUpdate: + default: + break; + } + // if the application is already running, notify it. if( app.isRunning() ) { QStringList args = app.arguments(); @@ -56,7 +76,7 @@ int main(int argc, char **argv) int attempts = 0; forever { if (!QSystemTrayIcon::isSystemTrayAvailable() && qgetenv("DESKTOP_SESSION") != "ubuntu") { - Mirall::Utility::sleep(1); + Utility::sleep(1); attempts++; if (attempts < 30) continue; } else { |