summaryrefslogtreecommitdiff
path: root/src/Preferences.cc
diff options
context:
space:
mode:
authordon bright <hugh.m.bright@gmail.com>2013-02-24 03:54:53 (GMT)
committerdon bright <hugh.m.bright@gmail.com>2013-02-24 03:54:53 (GMT)
commitca41979ee514f642c506e4f4d81461f19b587bf2 (patch)
treef31feb004d0b724d5240c8a227c7f0c886939a1b /src/Preferences.cc
parenteff16283358217b43b310269a72e0cb47357a8b3 (diff)
parentabc9da96c89b337377ee62ac29ee54e4e7b0a514 (diff)
Merge branch 'master' of github.com:openscad/openscad into issue11_2
Conflicts: RELEASE_NOTES openscad.pro src/mainwin.cc
Diffstat (limited to 'src/Preferences.cc')
-rw-r--r--src/Preferences.cc47
1 files changed, 47 insertions, 0 deletions
diff --git a/src/Preferences.cc b/src/Preferences.cc
index ec66094..7c7aee4 100644
--- a/src/Preferences.cc
+++ b/src/Preferences.cc
@@ -26,10 +26,13 @@
#include "Preferences.h"
+#include <QMessageBox>
#include <QFontDatabase>
#include <QKeyEvent>
#include <QSettings>
+#include <QStatusBar>
#include "PolySetCache.h"
+#include "AutoUpdater.h"
#ifdef ENABLE_CGAL
#include "CGALCache.h"
#endif
@@ -88,6 +91,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 +159,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 +193,40 @@ void Preferences::on_fontSize_editTextChanged(const QString &size)
emit fontChanged(getValue("editor/fontfamily").toString(), intsize);
}
+void unimplemented_msg()
+{
+ QMessageBox mbox;
+ mbox.setText("Sorry, this feature is not implemented on your Operating System");
+ mbox.exec();
+}
+
+void Preferences::on_updateCheckBox_toggled(bool on)
+{
+ if (AutoUpdater *updater =AutoUpdater::updater()) {
+ updater->setAutomaticallyChecksForUpdates(on);
+ } else {
+ unimplemented_msg();
+ }
+}
+
+void Preferences::on_snapshotCheckBox_toggled(bool on)
+{
+ if (AutoUpdater *updater =AutoUpdater::updater()) {
+ updater->setEnableSnapshots(on);
+ } else {
+ unimplemented_msg();
+ }
+}
+
+void Preferences::on_checkNowButton_clicked()
+{
+ if (AutoUpdater *updater =AutoUpdater::updater()) {
+ updater->checkForUpdates();
+ } else {
+ unimplemented_msg();
+ }
+}
+
void
Preferences::on_openCSGWarningBox_toggled(bool state)
{
@@ -289,6 +330,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());
contact: Jan Huwald // Impressum