diff options
author | Marius Kintel <marius@kintel.net> | 2013-02-05 05:36:25 (GMT) |
---|---|---|
committer | Marius Kintel <marius@kintel.net> | 2013-02-05 05:36:25 (GMT) |
commit | fa00547507566a646db2baffea114104b1ffd567 (patch) | |
tree | 85d8d3e09c9b4c1f651829042e20b061166ea415 /src/Preferences.cc | |
parent | 03be37d16b585e64de87118053206aaae06e7cf8 (diff) |
First version of automatic updates for Mac
Diffstat (limited to 'src/Preferences.cc')
-rw-r--r-- | src/Preferences.cc | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/src/Preferences.cc b/src/Preferences.cc index ec66094..fe7462a 100644 --- a/src/Preferences.cc +++ b/src/Preferences.cc @@ -29,7 +29,9 @@ #include <QFontDatabase> #include <QKeyEvent> #include <QSettings> +#include <QStatusBar> #include "PolySetCache.h" +#include "AutoUpdater.h" #ifdef ENABLE_CGAL #include "CGALCache.h" #endif @@ -88,6 +90,7 @@ Preferences::Preferences(QWidget *parent) : QMainWindow(parent) QActionGroup *group = new QActionGroup(this); group->addAction(prefsAction3DView); group->addAction(prefsActionEditor); + group->addAction(prefsActionUpdate); group->addAction(prefsActionAdvanced); connect(group, SIGNAL(triggered(QAction*)), this, SLOT(actionTriggered(QAction*))); @@ -155,6 +158,9 @@ Preferences::actionTriggered(QAction *action) else if (action == this->prefsActionEditor) { this->stackedWidget->setCurrentWidget(this->pageEditor); } + else if (action == this->prefsActionUpdate) { + this->stackedWidget->setCurrentWidget(this->pageUpdate); + } else if (action == this->prefsActionAdvanced) { this->stackedWidget->setCurrentWidget(this->pageAdvanced); } @@ -186,6 +192,27 @@ void Preferences::on_fontSize_editTextChanged(const QString &size) emit fontChanged(getValue("editor/fontfamily").toString(), intsize); } +void Preferences::on_updateCheckBox_toggled(bool on) +{ + if (AutoUpdater *updater =AutoUpdater::updater()) { + updater->setAutomaticallyChecksForUpdates(on); + } +} + +void Preferences::on_snapshotCheckBox_toggled(bool on) +{ + if (AutoUpdater *updater =AutoUpdater::updater()) { + updater->setEnableSnapshots(on); + } +} + +void Preferences::on_checkNowButton_clicked() +{ + if (AutoUpdater *updater =AutoUpdater::updater()) { + updater->checkForUpdates(); + } +} + void Preferences::on_openCSGWarningBox_toggled(bool state) { @@ -289,6 +316,12 @@ void Preferences::updateGUI() this->fontSize->setEditText(fontsize); } + if (AutoUpdater *updater = AutoUpdater::updater()) { + this->updateCheckBox->setChecked(updater->automaticallyChecksForUpdates()); + this->snapshotCheckBox->setChecked(updater->enableSnapshots()); + this->lastCheckedLabel->setText(updater->lastUpdateCheckDate()); + } + this->openCSGWarningBox->setChecked(getValue("advanced/opencsg_show_warning").toBool()); this->enableOpenCSGBox->setChecked(getValue("advanced/enable_opencsg_opengl1x").toBool()); this->cgalCacheSizeEdit->setText(getValue("advanced/cgalCacheSize").toString()); |