Added getSmartReflexState() method
authorDaniel Klaffenbach <danielklaffenbach@gmail.com>
Tue, 22 Jun 2010 22:01:13 +0000 (00:01 +0200)
committerDaniel Klaffenbach <danielklaffenbach@gmail.com>
Tue, 22 Jun 2010 22:01:13 +0000 (00:01 +0200)
src/mainwindow.cpp
src/mainwindow.h
src/mainwindow.ui

index 5e69f2b..b3350bf 100755 (executable)
@@ -129,11 +129,17 @@ int MainWindow::getScalingFreq(int step)
 }
 
 
+/**
+  * Returns the name of the current CPU frequency scaling governor
+  *
+  * \return    name of governor
+  */
 QString MainWindow::getScalingGovernor()
 {
     return readSysFile( "devices/system/cpu/cpu0/cpufreq/scaling_governor" );
 }
 
+
 /**
   * Returns the amount of available scaling steps.
   */
@@ -158,6 +164,35 @@ int MainWindow::getScalingStep( int freq )
     return 1;
 }
 
+
+/**
+  * Returns the SmartReflex(tm) state
+  *
+  * \return    0|1
+  */
+int MainWindow::getSmartReflexState()
+{
+//SmartReflex is only supprted on Maemo5
+#if defined(Q_WS_MAEMO_5)
+    QString tmp1 = readSysFile( "power/sr_vdd1_autocomp" );
+    QString tmp2 = readSysFile( "power/sr_vdd2_autocomp" );
+
+    if ( tmp1 == "1" && tmp2 == "1" )
+       return 1;
+    else
+       return 0;
+#else
+    return 0;
+#endif
+}
+
+
+/**
+  * Reads any file in /sys/
+  *
+  * \param     sys_file : full path to sys file - omit "/sys/"
+  * \return    content of sys file
+  */
 QString MainWindow::readSysFile(QString sys_file)
 {
     QFile file( "/sys/"+sys_file );
@@ -197,8 +232,17 @@ void MainWindow::refresh()
     //display the current governor
     ui->freq_governor->setText( getScalingGovernor() );
 
-    //display.setNum( getScalingFreq(1) );
-    //ui->freq_max->setText( display );
+    //smart reflex button
+    if ( getSmartReflexState() == 1 ) {
+       ui->sr_btn->setDown( true );
+       ui->sr_btn->setText( tr( "Enabled" ) );
+    } else {
+       ui->sr_btn->setDown( false );
+       ui->sr_btn->setText( tr( "Disabled" ) );
+    }
+
+
+    //display frequency slider
     ui->freq_adjust->setMinimum( 1 );
     ui->freq_adjust->setMaximum( getScalingSteps() );
     ui->freq_adjust->setInvertedAppearance( true );
index 91a0c29..d438ee2 100755 (executable)
@@ -50,6 +50,7 @@ private:
     QString getScalingGovernor();
     int getScalingStep( int freq );
     int getScalingSteps();
+    int getSmartReflexState();
     QString readSysFile( QString sys_file );
     //! the QGraphicsScene will contain the large chip icon displayed in the UI
     QGraphicsScene *scene;
index 65a4fd8..aa85343 100755 (executable)
   <property name="windowTitle">
    <string>QCPUFreq</string>
   </property>
+  <property name="windowIcon">
+   <iconset>
+    <normaloff>data/64x64/qcpufreq.png</normaloff>data/64x64/qcpufreq.png</iconset>
+  </property>
   <property name="locale">
    <locale language="English" country="UnitedStates"/>
   </property>