This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

Merge branch 'master' of github.com:Razor-qt/razor-qt

  • Loading branch information...
amoskvin committed Apr 12, 2012
2 parents e5f19a8 + 7a9bc35 commit ed5d826b1efdb582420a5c167cf3be6fa4e24b14
@@ -40,7 +40,8 @@ EXPORT_RAZOR_PANEL_PLUGIN_CPP(RazorCpuLoad)
RazorCpuLoad::RazorCpuLoad(const RazorPanelPluginStartInfo* startInfo, QWidget* parent):
RazorPanelPlugin(startInfo, parent),
- m_showText(false)
+ m_showText(false),
+ m_timerID(-1)
{
setObjectName("CpuLoad");
addWidget(&m_stuff);
@@ -54,7 +55,6 @@ RazorCpuLoad::RazorCpuLoad(const RazorPanelPluginStartInfo* startInfo, QWidget*
}
m_font.setPointSizeF(8);
- startTimer(500);
settingsChanged();
}
@@ -136,7 +136,13 @@ void RazorCpuLoad::showConfigureDialog()
void RazorCpuLoad::settingsChanged()
{
+ if (m_timerID != -1)
+ killTimer(m_timerID);
+
m_showText = settings().value("showText", false).toBool();
+ m_updateInterval = settings().value("updateInterval", 1000).toInt();
+
+ m_timerID = startTimer(m_updateInterval);
update();
}
@@ -57,6 +57,8 @@ protected slots:
int m_avg;
bool m_showText;
+ int m_updateInterval;
+ int m_timerID;
QFont m_font;
};
@@ -39,11 +39,15 @@ RazorCpuLoadConfiguration::RazorCpuLoadConfiguration(QSettings &settings, QWidge
setObjectName("CpuLoadConfigurationWindow");
ui->setupUi(this);
- connect(ui->buttons, SIGNAL(clicked(QAbstractButton*)), this, SLOT(dialogButtonsAction(QAbstractButton*)));
+ connect(ui->buttons, SIGNAL(clicked(QAbstractButton*)),
+ this, SLOT(dialogButtonsAction(QAbstractButton*)));
loadSettings();
- connect(ui->showTextCB, SIGNAL(toggled(bool)), this, SLOT(showTextChanged(bool)));
+ connect(ui->showTextCB, SIGNAL(toggled(bool)),
+ this, SLOT(showTextChanged(bool)));
+ connect(ui->updateIntervalSpinBox, SIGNAL(valueChanged(double)),
+ this, SLOT(updateIntervalChanged(double)));
}
RazorCpuLoadConfiguration::~RazorCpuLoadConfiguration()
@@ -54,6 +58,7 @@ RazorCpuLoadConfiguration::~RazorCpuLoadConfiguration()
void RazorCpuLoadConfiguration::loadSettings()
{
ui->showTextCB->setChecked(mSettings.value("showText", false).toBool());
+ ui->updateIntervalSpinBox->setValue(mSettings.value("updateInterval", 1000).toInt() / 1000.0);
// QString menuFile = mSettings.value("menu_file", "").toString();
// if (menuFile.isEmpty())
@@ -70,6 +75,12 @@ void RazorCpuLoadConfiguration::showTextChanged(bool value)
}
+void RazorCpuLoadConfiguration::updateIntervalChanged(double value)
+{
+ mSettings.setValue("updateInterval", value*1000);
+}
+
+
void RazorCpuLoadConfiguration::dialogButtonsAction(QAbstractButton *btn)
{
if (ui->buttons->buttonRole(btn) == QDialogButtonBox::ResetRole)
@@ -60,6 +60,8 @@ private slots:
void loadSettings();
void dialogButtonsAction(QAbstractButton *btn);
void showTextChanged(bool value);
+ void updateIntervalChanged(double value);
+
};
#endif // RAZORCPULOADCONFIGURATION_H
@@ -13,8 +13,8 @@
<property name="windowTitle">
<string>Razor Cpu Load settings</string>
</property>
- <layout class="QVBoxLayout" name="verticalLayout">
- <item>
+ <layout class="QGridLayout" name="gridLayout_2">
+ <item row="0" column="0">
<widget class="QGroupBox" name="generalGB">
<property name="title">
<string>General</string>
@@ -29,17 +29,46 @@
<bool>false</bool>
</property>
<layout class="QGridLayout" name="gridLayout">
- <item row="0" column="0">
+ <item row="0" column="0" colspan="2">
<widget class="QCheckBox" name="showTextCB">
<property name="text">
<string>Show text</string>
</property>
</widget>
</item>
+ <item row="1" column="0">
+ <widget class="QLabel" name="label">
+ <property name="text">
+ <string>Update interval:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1">
+ <widget class="QDoubleSpinBox" name="updateIntervalSpinBox">
+ <property name="suffix">
+ <string>sec</string>
+ </property>
+ <property name="decimals">
+ <number>1</number>
+ </property>
+ <property name="minimum">
+ <double>0.500000000000000</double>
+ </property>
+ <property name="maximum">
+ <double>10000.000000000000000</double>
+ </property>
+ <property name="singleStep">
+ <double>0.500000000000000</double>
+ </property>
+ <property name="value">
+ <double>1.000000000000000</double>
+ </property>
+ </widget>
+ </item>
</layout>
</widget>
</item>
- <item>
+ <item row="1" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
@@ -52,7 +81,7 @@
</property>
</spacer>
</item>
- <item>
+ <item row="2" column="0">
<widget class="QDialogButtonBox" name="buttons">
<property name="orientation">
<enum>Qt::Horizontal</enum>

0 comments on commit ed5d826

Please sign in to comment.