Connect signals and slots in LoadPreset and MainWindow
[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 showLoadPresetDialog();
57     void showSettings();
58
59
60 private:
61     Ui::MainWindow *ui;
62     int callHelper( QString action, QString param );
63     QString getCPUTemp();
64     int getMaxFreq();
65     int getMinFreq();
66     int getScalingFreq( int step );
67     QString getScalingGovernor();
68     int getScalingStep( int freq );
69     int getScalingSteps();
70     int getSmartReflexState();
71     //! The helper process
72     QProcess helperProcess;
73     //! The help window
74     HelpWindow helpWindow;
75     //! Initializes the application
76     void init();
77     LoadPreset *loadPresetDialog;
78     int minFreq;
79     QString readSysFile( QString sys_file );
80     //! the timer for refreshing the UI
81     QTimer refreshTimer;
82     //! The amount of scaling steps
83     int scalingSteps;
84     //! The available scaling frequencies
85     QStringList scalingFrequencies;
86     //! the QGraphicsScene will contain the large chip icon displayed in the UI
87     QGraphicsScene scene;
88     bool showSudoError;
89     Settings *settings;
90     bool usePortrait();
91 };
92
93 #endif // MAINWINDOW_H