From b75769f2af8f3245ff1bc628d9b3a5aecd030967 Mon Sep 17 00:00:00 2001 From: Daniel Klaffenbach Date: Sat, 26 Jun 2010 21:08:59 +0200 Subject: [PATCH] Refresh UI every 10 seconds Use a QTimer to refresh the UI regularily. This is necesary to monitor changes in temperature or even CPU frequency. --- src/mainwindow.cpp | 6 ++++++ src/mainwindow.h | 3 +++ 2 files changed, 9 insertions(+) diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 56c4b69..2f7504b 100755 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -47,11 +47,17 @@ MainWindow::MainWindow(QWidget *parent) : scene = new QGraphicsScene(); orientationChanged(); + //create the refresh timer + refreshTimer = new QTimer(); + //refresh UI every 10 seconds + refreshTimer->start( 10000 ); + //connect signals and slots connect( ui->actionAbout, SIGNAL(triggered()), this, SLOT(about()) ); connect( ui->freq_adjust, SIGNAL(valueChanged(int)), this, SLOT(adjustFreq()) ); connect(QApplication::desktop(), SIGNAL(resized(int)), this, SLOT(orientationChanged())); connect( ui->sr_btn, SIGNAL(clicked()), this, SLOT(setSmartReflex()) ); + connect(refreshTimer, SIGNAL(timeout()), this, SLOT(refresh())); } diff --git a/src/mainwindow.h b/src/mainwindow.h index 4b77db0..13eae27 100755 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -21,6 +21,7 @@ #include #include +#include namespace Ui { class MainWindow; @@ -55,6 +56,8 @@ private: int getScalingSteps(); int getSmartReflexState(); QString readSysFile( QString sys_file ); + //! the timer for refreshing the UI + QTimer *refreshTimer; //! the QGraphicsScene will contain the large chip icon displayed in the UI QGraphicsScene *scene; bool usePortrait(); -- 1.7.9.5