refreshTimer( this ),
//create a QGraphicsScene for the little chip icon
scene( this ),
+ //the settings widget
+ settings(this),
//show errors about the sudo setup only once
showSudoError( true )
{
#endif
helpWindow.setWindowFlags( windowFlags() | Qt::Window );
+ settings.hide();
+
//connect signals and slots
connect(ui->actionHelp, SIGNAL(triggered()), this, SLOT(showHelp()));
connect( ui->actionAbout, SIGNAL(triggered()), this, SLOT(about()) );
connect(ui->sr_box, SIGNAL(clicked()), this, SLOT(setSmartReflex()));
connect(&refreshTimer, SIGNAL(timeout()), this, SLOT(refresh()));
connect(ui->actionOverclocking, SIGNAL(toggled(bool)), this, SLOT(setOverclocking()));
+ connect(ui->actionSettings, SIGNAL(triggered()), this, SLOT(showSettings()));
//disable overclocking button on vanilla kernels
/**
+ * SLOT: displays the settings widget
+ */
+void MainWindow::showSettings()
+{
+ settings.setWindowFlags(Qt::Popup);
+ settings.show();
+}
+
+
+/**
* Returns true when the device is in portrait mode
*/
bool MainWindow::usePortrait()
#include <QStringList>
#include "helpwindow.h"
+#include "settingswidget.h"
namespace Ui {
class MainWindow;
void setOverclocking();
void setSmartReflex();
void showHelp();
+ void showSettings();
private:
//! the QGraphicsScene will contain the large chip icon displayed in the UI
QGraphicsScene scene;
bool showSudoError;
+ SettingsWidget settings;
bool usePortrait();
};
<x>0</x>
<y>0</y>
<width>469</width>
- <height>21</height>
+ <height>23</height>
</rect>
</property>
<widget class="QMenu" name="menuFile">
<addaction name="actionOverclocking"/>
<addaction name="actionHelp"/>
<addaction name="actionAbout"/>
+ <addaction name="actionSettings"/>
</widget>
<addaction name="menuFile"/>
</widget>
<string>Enable overclocking</string>
</property>
</action>
+ <action name="actionSettings">
+ <property name="text">
+ <string>Settings</string>
+ </property>
+ </action>
</widget>
<layoutdefault spacing="6" margin="11"/>
<resources/>
--- /dev/null
+#include "settingswidget.h"
+#include "ui_settingswidget.h"
+
+
+
+
+SettingsWidget::SettingsWidget(QWidget *parent) :
+ QWidget(parent),
+ ui(new Ui::SettingsWidget)
+{
+ ui->setupUi(this);
+ settings = new QSettings("qcpufreq");
+}
+
+SettingsWidget::~SettingsWidget()
+{
+ delete ui;
+ delete settings;
+}
+
+
+void SettingsWidget::reset()
+{
+}
--- /dev/null
+#ifndef SETTINGSWIDGET_H
+#define SETTINGSWIDGET_H
+
+#include <QWidget>
+#include <QSettings>
+
+namespace Ui {
+ class SettingsWidget;
+}
+
+class SettingsWidget : public QWidget
+{
+ Q_OBJECT
+
+public:
+ explicit SettingsWidget(QWidget *parent = 0);
+ ~SettingsWidget();
+
+public slots:
+ void reset();
+
+private:
+ Ui::SettingsWidget *ui;
+ QSettings *settings;
+};
+
+#endif // SETTINGSWIDGET_H
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>SettingsWidget</class>
+ <widget class="QWidget" name="SettingsWidget">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>355</width>
+ <height>130</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>Form</string>
+ </property>
+ <property name="locale">
+ <locale language="English" country="UnitedStates"/>
+ </property>
+ <layout class="QGridLayout" name="gridLayout">
+ <item row="0" column="0">
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
+ <widget class="QCheckBox" name="checkBox_oc">
+ <property name="text">
+ <string>Enable Overclocking</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QCheckBox" name="checkBox_rotate">
+ <property name="text">
+ <string>Enable Auto-rotation</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QCheckBox" name="checkBox_temperature">
+ <property name="text">
+ <string>Display more accurate temperature</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item row="0" column="1">
+ <layout class="QVBoxLayout" name="verticalLayout_2">
+ <item>
+ <widget class="QPushButton" name="btn_save">
+ <property name="text">
+ <string>Save</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer name="verticalSpacer">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <widget class="QPushButton" name="btn_cancel">
+ <property name="text">
+ <string>Cancel</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections>
+ <connection>
+ <sender>btn_cancel</sender>
+ <signal>clicked()</signal>
+ <receiver>SettingsWidget</receiver>
+ <slot>close()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>304</x>
+ <y>106</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>177</x>
+ <y>64</y>
+ </hint>
+ </hints>
+ </connection>
+ </connections>
+</ui>
SOURCES += main.cpp\
mainwindow.cpp \
- helpwindow.cpp
+ helpwindow.cpp \
+ settingswidget.cpp
HEADERS += mainwindow.h \
- helpwindow.h
+ helpwindow.h \
+ settingswidget.h
FORMS += mainwindow.ui \
- helpwindow.ui
+ helpwindow.ui \
+ settingswidget.ui
TRANSLATIONS = de.ts zh.ts