# HG changeset patch # User Drew Gottlieb # Date 1355105245 -3600 # Node ID a874d00df4a43f6b858d94f1b6df4a0a7f3df329 # Parent af97cdbb771381f064b8e9c440060212eed1bde5 GCI2012: Autoupdate Button in Settings diff -r af97cdbb7713 -r a874d00df4a4 QTfrontend/AutoUpdater.h --- a/QTfrontend/AutoUpdater.h Sun Dec 09 18:00:01 2012 +0100 +++ b/QTfrontend/AutoUpdater.h Mon Dec 10 03:07:25 2012 +0100 @@ -11,6 +11,7 @@ virtual ~AutoUpdater(); virtual void checkForUpdates() = 0; + virtual void checkForUpdatesNow() = 0; }; #endif diff -r af97cdbb7713 -r a874d00df4a4 QTfrontend/hwform.cpp --- a/QTfrontend/hwform.cpp Sun Dec 09 18:00:01 2012 +0100 +++ b/QTfrontend/hwform.cpp Mon Dec 10 03:07:25 2012 +0100 @@ -96,6 +96,7 @@ #include "playerslistmodel.h" #include "DataManager.h" +#include "AutoUpdater.h" #ifdef __APPLE__ #include "M3Panel.h" @@ -146,17 +147,24 @@ ui.pageOptions->setConfig(config); #endif + AutoUpdater* updater = NULL; + if (config->isAutoUpdateEnabled()) + { +#ifdef __APPLE__ +#ifdef SPARKLE_ENABLED + updater = new SparkleAutoUpdater(); +#endif +#endif + if (updater) + { + updater->checkForUpdates(); + delete updater; + } + } + #ifdef __APPLE__ panel = new M3Panel; -#ifdef SPARKLE_ENABLED - AutoUpdater* updater; - - updater = new SparkleAutoUpdater(); - if (updater && config->isAutoUpdateEnabled()) - updater->checkForUpdates(); -#endif - QShortcut *hideFrontend = new QShortcut(QKeySequence("Ctrl+M"), this); connect (hideFrontend, SIGNAL(activated()), this, SLOT(showMinimized())); #else diff -r af97cdbb7713 -r a874d00df4a4 QTfrontend/ui/page/pageoptions.cpp --- 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 diff -r af97cdbb7713 -r a874d00df4a4 QTfrontend/ui/page/pageoptions.h --- a/QTfrontend/ui/page/pageoptions.h Sun Dec 09 18:00:01 2012 +0100 +++ b/QTfrontend/ui/page/pageoptions.h Mon Dec 10 03:07:25 2012 +0100 @@ -70,6 +70,7 @@ QCheckBox *CBNameWithDate; #ifdef __APPLE__ QCheckBox *CBAutoUpdate; + QPushButton *BtnUpdateNow; #endif FPSEdit *fpsedit; @@ -131,6 +132,7 @@ QComboBox *comboVideoCodecs; QComboBox *comboAudioCodecs; QPushButton *btnDefaults; + QPushButton *btnUpdateNow; GameUIConfig * config; private slots: @@ -148,6 +150,7 @@ void changeAVFormat(int index); void changeUseGameRes(int state); void changeRecordAudio(int state); + void checkForUpdates(); public slots: void setDefaultOptions();