forked from openscad/openscad
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move software update menu handling to AutoUpdater. This should fix op…
- Loading branch information
Showing
9 changed files
with
104 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,23 @@ | ||
#include "AutoUpdater.h" | ||
#include <QAction> | ||
#include <QMenuBar> | ||
|
||
AutoUpdater *AutoUpdater::updater_instance = NULL; | ||
|
||
void AutoUpdater::init() | ||
{ | ||
#ifdef OPENSCAD_UPDATER | ||
if (!this->updateAction) { | ||
QMenuBar *mb = new QMenuBar(); | ||
this->updateMenu = mb->addMenu("special"); | ||
this->updateAction = new QAction("Check for Update..", this); | ||
// Add to application menu | ||
this->updateAction->setMenuRole(QAction::ApplicationSpecificRole); | ||
this->updateAction->setEnabled(true); | ||
this->connect(this->updateAction, SIGNAL(triggered()), this, SLOT(checkForUpdates())); | ||
|
||
this->updateMenu->addAction(this->updateAction); | ||
|
||
} | ||
#endif | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,34 @@ | ||
#pragma once | ||
|
||
#include <QString> | ||
#include <QObject> | ||
|
||
class AutoUpdater | ||
class AutoUpdater : public QObject | ||
{ | ||
Q_OBJECT; | ||
|
||
public: | ||
AutoUpdater() : updateAction(NULL) {} | ||
virtual ~AutoUpdater() {} | ||
|
||
virtual void checkForUpdates() = 0; | ||
virtual void setAutomaticallyChecksForUpdates(bool on) = 0; | ||
virtual bool automaticallyChecksForUpdates() = 0; | ||
virtual void setEnableSnapshots(bool on) = 0; | ||
virtual bool enableSnapshots() = 0; | ||
virtual QString lastUpdateCheckDate() = 0; | ||
virtual void init(); | ||
|
||
static AutoUpdater *updater() { return updater_instance; } | ||
static void setUpdater(AutoUpdater *updater) { updater_instance = updater; } | ||
|
||
public slots: | ||
virtual void checkForUpdates() = 0; | ||
|
||
|
||
public: | ||
class QAction *updateAction; | ||
class QMenu *updateMenu; | ||
|
||
protected: | ||
static AutoUpdater *updater_instance; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters