Fix timer logic once again...
This commit is contained in:
parent
a084c2d811
commit
f582d55809
1 changed files with 11 additions and 0 deletions
|
@ -90,6 +90,14 @@ Battery::Battery(QObject *parent) : QObject(parent)
|
||||||
|
|
||||||
updateData();
|
updateData();
|
||||||
updateTimer->start(5000);
|
updateTimer->start(5000);
|
||||||
|
|
||||||
|
// If updateData() didn't start the timers
|
||||||
|
// aka. "charging" status didn't change
|
||||||
|
// (or if both times are disabled, actually)
|
||||||
|
// manually trigger the timer startup.
|
||||||
|
if(!highNotifyTimer->isActive() && !lowNotifyTimer->isActive()) {
|
||||||
|
resetTimers();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Battery::~Battery() { }
|
Battery::~Battery() { }
|
||||||
|
@ -120,6 +128,9 @@ void Battery::updateData()
|
||||||
state = nextState;
|
state = nextState;
|
||||||
emit stateChanged(state);
|
emit stateChanged(state);
|
||||||
qDebug() << "Charging status:" << state;
|
qDebug() << "Charging status:" << state;
|
||||||
|
|
||||||
|
// Hide/show notification right away
|
||||||
|
resetTimers();
|
||||||
}
|
}
|
||||||
stateFile->close();
|
stateFile->close();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue