Display proposed frequency in UI before applying
authorDaniel Klaffenbach <danielklaffenbach@gmail.com>
Mon, 27 Dec 2010 11:38:16 +0000 (12:38 +0100)
committerDaniel Klaffenbach <danielklaffenbach@gmail.com>
Mon, 27 Dec 2010 11:38:16 +0000 (12:38 +0100)
src/mainwindow.cpp
src/mainwindow.h

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()
index 93c39c5..c895bf2 100644 (file)
@@ -53,8 +53,8 @@ public slots:
     void setAutoRotation();
     void setSmartReflex();
     void showHelp();
-    //void showLoadPresetDialog();
     void showSettings();
+    void showTemporaryMaxFreq();
 
 
 private: