Permalink
Browse files

Load setting on startup and fix wrong slot

  • Loading branch information...
1 parent 128a5f2 commit 9f235d7100f7ac5d7a6e6b75d0ce841c1a92a955 @amoskvin amoskvin committed Oct 6, 2012
Showing with 17 additions and 14 deletions.
  1. +15 −13 razorqt-autosuspend/src/razorautosuspend.cpp
  2. +2 −1 razorqt-autosuspend/src/razorautosuspend.h
@@ -40,10 +40,10 @@ RazorAutosuspendd::RazorAutosuspendd(QObject *parent) :
razorNotification.setUrgencyHint(RazorNotification::UrgencyCritical);
razorNotification.setTimeout(2000);
trayIcon.setStatus(battery.chargeLevel(), battery.onBattery(), battery.properties());
- trayIcon.show();
+ settingsChanged();
connect(&lid, SIGNAL(changed(bool)), this, SLOT(lidChanged(bool)));
- connect(&battery, SIGNAL(somethingChanged()), this, SLOT(somethingChanged()));
- connect(&m_Settings, SIGNAL(settingsChanged()), this, SLOT(somethingChanged()));
+ connect(&battery, SIGNAL(batteryChanged()), this, SLOT(batteryChanged()));
+ connect(&m_Settings, SIGNAL(settingsChanged()), this, SLOT(settingsChanged()));
}
RazorAutosuspendd::~RazorAutosuspendd()
@@ -60,22 +60,13 @@ void RazorAutosuspendd::lidChanged(bool closed)
}
}
-void RazorAutosuspendd::somethingChanged()
+void RazorAutosuspendd::batteryChanged()
{
qDebug() << "onBattery: " << battery.onBattery() <<
"chargeLevel:" << battery.chargeLevel() <<
"powerlow:" << battery.powerLow() <<
"actionTime:" << actionTime;
- if (m_Settings.value(SHOWTRAYICON_KEY, true).toBool())
- {
- trayIcon.show();
- }
- else
- {
- trayIcon.hide();
- }
-
trayIcon.setStatus(battery.chargeLevel(), battery.onBattery(), battery.properties());
if (battery.powerLow() && actionTime.isNull() && powerLowAction() > 0)
@@ -87,6 +78,17 @@ void RazorAutosuspendd::somethingChanged()
}
}
+void RazorAutosuspendd::settingsChanged()
+{
+ if (m_Settings.value(SHOWTRAYICON_KEY, true).toBool())
+ {
+ trayIcon.show();
+ }
+ else
+ {
+ trayIcon.hide();
+ }
+}
void RazorAutosuspendd::timerEvent(QTimerEvent *event)
{
@@ -48,7 +48,8 @@ class RazorAutosuspendd : public QObject
private slots:
void lidChanged(bool closed);
- void somethingChanged();
+ void batteryChanged();
+ void settingsChanged();
private:
void doAction(int action);

0 comments on commit 9f235d7

Please sign in to comment.