New release: 0.4.4
[qcpufreq] / src / mainwindow.h
1 /*
2  * QCPUFreq - a simple cpufreq GUI
3  * Copyright (C) 2010 Daniel Klaffenbach <danielklaffenbach@gmail.com>
4  *
5  * This program is free software: you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation, either version 3 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
17  */
18
19 #ifndef MAINWINDOW_H
20 #define MAINWINDOW_H
21
22 #include <QMainWindow>
23 #include <QGraphicsScene>
24 #include <QTimer>
25 #include <QProcess>
26 #include <QStringList>
27
28 #include "helpwindow.h"
29 #include "loadpreset.h"
30 #include "settings.h"
31
32 namespace Ui {
33     class MainWindow;
34 }
35
36 class MainWindow : public QMainWindow
37 {
38     Q_OBJECT
39
40 public:
41     explicit MainWindow(QWidget *parent = 0);
42     ~MainWindow();
43
44 public slots:
45     void about();
46     void adjustFreq();
47     void applySettings();
48     void loadPreset(QString presetName);
49     void orientationChanged();
50     void refresh();
51     void save();
52     void setAdvancedTemperature();
53     void setAutoRotation();
54     void setSmartReflex();
55     void showHelp();
56     void showSettings();
57     void showTemporaryMaxFreq();
58
59
60 private:
61     Ui::MainWindow *ui;
62     void calculateMinFreq();
63     int callHelper( QString action, QString param );
64     QString getCPUTemp();
65     int getMaxFreq();
66     int getMinFreq();
67     int getScalingFreq( int step );
68     QString getScalingGovernor();
69     int getScalingStep( int freq );
70     int getScalingSteps();
71     int getSmartReflexState();
72     //! The helper process
73     QProcess helperProcess;
74     //! The help window
75     HelpWindow helpWindow;
76     LoadPreset *loadPresetDialog;
77     int minFreq;
78     QString readSysFile( QString sys_file );
79     //! the timer for refreshing the UI
80     QTimer refreshTimer;
81     //! The amount of scaling steps
82     int scalingSteps;
83     //! The available scaling frequencies
84     QStringList scalingFrequencies;
85     //! the QGraphicsScene will contain the large chip icon displayed in the UI
86     QGraphicsScene scene;
87     bool showSudoError;
88     Settings *settings;
89     bool usePortrait();
90 };
91
92 #endif // MAINWINDOW_H