Display proposed frequency in UI before applying
[qcpufreq] / src / mainwindow.cpp
index 273659c..f89e370 100644 (file)
@@ -82,6 +82,7 @@ MainWindow::MainWindow(QWidget *parent) :
     connect(ui->actionHelp, SIGNAL(triggered()), this, SLOT(showHelp()));
     connect( ui->actionAbout, SIGNAL(triggered()), this, SLOT(about()) );
     connect( ui->freq_adjust, SIGNAL(sliderReleased()), this, SLOT(adjustFreq()) );
+    connect(ui->freq_adjust, SIGNAL(valueChanged(int)), this, SLOT(showTemporaryMaxFreq()));
     connect(QApplication::desktop(), SIGNAL(resized(int)), this, SLOT(orientationChanged()));
     connect(ui->sr_box, SIGNAL(clicked()), this, SLOT(setSmartReflex()));
     connect(&refreshTimer, SIGNAL(timeout()), this, SLOT(refresh()));
@@ -592,6 +593,22 @@ void MainWindow::showSettings()
 
 
 /**
+  * SLOT: This temporarily updates the maximum frequency while using the
+  * maxFreq slider.
+  */
+void MainWindow::showTemporaryMaxFreq()
+{
+    //calulate frequency from slider position
+    int newmax = getScalingFreq( ui->freq_adjust->sliderPosition() ) / 1000;
+    //convert it to a string and display it in the UI
+    QString display;
+    display.setNum( newmax );
+    display.append( " MHz" );
+    ui->freq_max->setText( display );
+}
+
+
+/**
   * Returns true when the device is in portrait mode
   */
 bool MainWindow::usePortrait()