QTfrontend/ui/page/pageoptions.cpp
changeset 8284 a874d00df4a4
parent 8229 251f38da9935
child 8343 aa4ea3cade3c
child 8346 3443e0de2c9d
--- a/QTfrontend/ui/page/pageoptions.cpp	Sun Dec 09 18:00:01 2012 +0100
+++ b/QTfrontend/ui/page/pageoptions.cpp	Mon Dec 10 03:07:25 2012 +0100
@@ -39,6 +39,13 @@
 #include "igbox.h"
 #include "DataManager.h"
 #include "LibavInteraction.h"
+#include "AutoUpdater.h"
+
+#ifdef __APPLE__
+#ifdef SPARKLE_ENABLED
+#include "SparkleAutoUpdater.h"
+#endif
+#endif
 
 // TODO cleanup
 QLayout * PageOptions::bodyLayoutDefinition()
@@ -231,7 +238,14 @@
     #ifdef SPARKLE_ENABLED
             CBAutoUpdate = new QCheckBox(groupMisc);
             CBAutoUpdate->setText(QCheckBox::tr("Check for updates at startup"));
-            MiscLayout->addWidget(CBAutoUpdate, 7, 0, 1, 3);
+            MiscLayout->addWidget(CBAutoUpdate, 7, 0, 1, 1);
+
+            btnUpdateNow = new QPushButton(groupMisc);
+            connect(btnUpdateNow, SIGNAL(clicked()), this, SLOT(checkForUpdates()));
+            btnUpdateNow->setToolTip(tr("Check for updates"));
+            btnUpdateNow->setText("Check now");
+            btnUpdateNow->setFixedSize(130, 30);
+            MiscLayout->addWidget(btnUpdateNow, 7, 1, 1, 1);
     #endif
     #endif
             page1Layout->addWidget(groupMisc, 2, 0);
@@ -859,6 +873,23 @@
     setDefaultCodecs();
 }
 
+void PageOptions::checkForUpdates()
+{
+    AutoUpdater *updater = NULL;
+
+#ifdef __APPLE__
+#ifdef SPARKLE_ENABLED
+    updater = new SparkleAutoUpdater();
+#endif
+#endif
+
+    if (updater)
+    {
+        updater->checkForUpdatesNow();
+        delete updater;
+    }
+}
+
 bool PageOptions::tryCodecs(const QString & format, const QString & vcodec, const QString & acodec)
 {
     // first we should change format