Apply auto-rotate setting without restarting QCPUFreq
authorDaniel Klaffenbach <danielklaffenbach@gmail.com>
Sun, 7 Nov 2010 13:43:41 +0000 (14:43 +0100)
committerDaniel Klaffenbach <danielklaffenbach@gmail.com>
Sun, 7 Nov 2010 13:43:41 +0000 (14:43 +0100)
src/mainwindow.cpp
src/settings.cpp
src/settings.h

index 022d628..318f471 100644 (file)
@@ -30,6 +30,7 @@
 #define APPNAME "QCPUFreq"
 #define APPVERSION "0.3.99"
 
+
 MainWindow::MainWindow(QWidget *parent) :
     QMainWindow(parent),
     ui(new Ui::MainWindow),
@@ -49,6 +50,10 @@ MainWindow::MainWindow(QWidget *parent) :
 
     ui->setupUi(this);
 
+    //Settings widget
+    settings = new Settings;
+    settings->hide();
+
     init();
     refresh();
 
@@ -67,10 +72,6 @@ MainWindow::MainWindow(QWidget *parent) :
     #endif
     helpWindow.setWindowFlags( windowFlags() | Qt::Window );
 
-    //Settings widget
-    settings = new Settings;
-    settings->hide();
-
     //show errors about the sudo setup only once
     showSudoError = true;
 
@@ -82,6 +83,7 @@ MainWindow::MainWindow(QWidget *parent) :
     connect(ui->sr_box, SIGNAL(clicked()), this, SLOT(setSmartReflex()));
     connect(&refreshTimer, SIGNAL(timeout()), this, SLOT(refresh()));
     connect(ui->actionSettings, SIGNAL(triggered()), this, SLOT(showSettings()));
+    connect(settings, SIGNAL(settingsChanged()), this, SLOT(setAutoRotation()));
 
 }
 
index 3762fd9..23eab34 100644 (file)
@@ -112,6 +112,8 @@ void Settings::reset()
 
 /**
   * Saves the changes and hides the SettingsWidget.
+  *
+  * @emits: settingsChanged()
   */
 void Settings::save()
 {
@@ -127,6 +129,8 @@ void Settings::save()
     settings.sync();
 
     hide();
+
+    emit settingsChanged();
 }
 
 
index 850192d..0ab3179 100644 (file)
@@ -44,6 +44,9 @@ public slots:
     void save();
     void showOverclockingWarning();
 
+signals:
+    void settingsChanged();
+
 private:
     bool advancedTemperature;
     bool autoRotate;