Actually emit the signal changes
This commit is contained in:
parent
3b93b28967
commit
01e06c8192
4 changed files with 25 additions and 25 deletions
|
@ -105,7 +105,7 @@ void Battery::updateData()
|
|||
nextCharge = chargeFile->readLine().trimmed().toInt();
|
||||
if(nextCharge != charge) {
|
||||
charge = nextCharge;
|
||||
emit chargeChanged();
|
||||
emit chargeChanged(charge);
|
||||
qDebug() << "Battery:" << charge;
|
||||
}
|
||||
chargeFile->close();
|
||||
|
@ -114,7 +114,7 @@ void Battery::updateData()
|
|||
nextChargerConnected = chargerConnectedFile->readLine().trimmed().toInt();
|
||||
if(nextChargerConnected != chargerConnected) {
|
||||
chargerConnected = nextChargerConnected;
|
||||
emit chargerConnectedChanged();
|
||||
emit chargerConnectedChanged(chargerConnected);
|
||||
qDebug() << "Charger is connected:" << chargerConnected;
|
||||
}
|
||||
chargerConnectedFile->close();
|
||||
|
@ -123,7 +123,7 @@ void Battery::updateData()
|
|||
nextState = (QString(stateFile->readLine().trimmed().toLower()));
|
||||
if(nextState != state) {
|
||||
state = nextState;
|
||||
emit stateChanged();
|
||||
emit stateChanged(state);
|
||||
qDebug() << "Charging status:" << state;
|
||||
}
|
||||
stateFile->close();
|
||||
|
@ -135,7 +135,7 @@ void Battery::updateData()
|
|||
// nextChargingEnabled = chargingEnabledFile->readLine().trimmed().toInt() == enableChargingValue;
|
||||
// if(nextChargingEnabled != chargingEnabled) {
|
||||
// chargingEnabled = nextChargingEnabled;
|
||||
// emit chargingEnabledChanged();
|
||||
// emit chargingEnabledChanged(chargingEnabled);
|
||||
// }
|
||||
// chargingEnabledFile->close();
|
||||
// }
|
||||
|
@ -160,7 +160,7 @@ void Battery::setChargingEnabled(bool isEnabled) {
|
|||
if(chargingEnabledFile && chargingEnabledFile->open(QIODevice::WriteOnly)) {
|
||||
if(chargingEnabledFile->write(QString("%1").arg(isEnabled ? enableChargingValue : disableChargingValue).toLatin1())) {
|
||||
chargingEnabled = isEnabled;
|
||||
emit chargingEnabledChanged();
|
||||
emit chargingEnabledChanged(chargingEnabled);
|
||||
|
||||
if(isEnabled) {
|
||||
qInfo() << "Charging resumed";
|
||||
|
|
|
@ -72,10 +72,10 @@ private:
|
|||
bool nextChargingEnabled = chargingEnabled;
|
||||
|
||||
signals:
|
||||
int chargeChanged();
|
||||
QString stateChanged();
|
||||
bool chargingEnabledChanged();
|
||||
bool chargerConnectedChanged();
|
||||
void chargeChanged(int);
|
||||
void stateChanged(QString);
|
||||
void chargingEnabledChanged(bool);
|
||||
void chargerConnectedChanged(bool);
|
||||
};
|
||||
|
||||
#endif // BATTERY_H
|
||||
|
|
|
@ -94,43 +94,43 @@ QString Settings::getHighAlertFile() {
|
|||
|
||||
void Settings::setLowAlert(int newLimit) {
|
||||
lowAlert = newLimit;
|
||||
emit lowAlertChanged();
|
||||
emit lowAlertChanged(lowAlert);
|
||||
qDebug() << "Change" << sLowAlert << newLimit;
|
||||
}
|
||||
|
||||
void Settings::setHighAlert(int newLimit) {
|
||||
highAlert = newLimit;
|
||||
emit highAlertChanged();
|
||||
emit highAlertChanged(highAlert);
|
||||
qDebug() << "Change" << sHighAlert << newLimit;
|
||||
}
|
||||
|
||||
void Settings::setInterval(int newInterval) {
|
||||
interval = newInterval;
|
||||
emit intervalChanged();
|
||||
emit intervalChanged(interval);
|
||||
qDebug() << "Change" << sInterval << newInterval;
|
||||
}
|
||||
|
||||
void Settings::setLowLimit(int newLimit) {
|
||||
lowLimit = newLimit;
|
||||
emit lowLimitChanged();
|
||||
emit lowLimitChanged(lowLimit);
|
||||
qDebug() << "Change" << sLowLimit << newLimit;
|
||||
}
|
||||
|
||||
void Settings::setHighLimit(int newLimit) {
|
||||
highLimit = newLimit;
|
||||
emit highLimitChanged();
|
||||
emit highLimitChanged(highLimit);
|
||||
qDebug() << "Change" << sHighLimit << newLimit;
|
||||
}
|
||||
|
||||
void Settings::setLimitEnabled(bool newEnabled) {
|
||||
limitEnabled = (newEnabled ? 1 : 0);
|
||||
emit limitEnabledChanged();
|
||||
emit limitEnabledChanged(limitEnabled);
|
||||
qDebug() << "Change" << sLimitEnabled << newEnabled;
|
||||
}
|
||||
|
||||
void Settings::setNotificationsEnabled(bool newEnabled) {
|
||||
notificationsEnabled = (newEnabled ? 1 : 0);
|
||||
emit notificationsEnabledChanged();
|
||||
emit notificationsEnabledChanged(notificationsEnabled);
|
||||
qDebug() << "Change" << sNotificationsEnabled << newEnabled;
|
||||
}
|
||||
|
||||
|
|
|
@ -88,15 +88,15 @@ private:
|
|||
void saveInteger(const char *key, int *value);
|
||||
|
||||
signals:
|
||||
int lowAlertChanged();
|
||||
int highAlertChanged();
|
||||
int intervalChanged();
|
||||
bool limitEnabledChanged();
|
||||
bool notificationsEnabledChanged();
|
||||
int lowLimitChanged();
|
||||
int highLimitChanged();
|
||||
QString lowAlertFileChanged();
|
||||
QString highAlertFileChanged();
|
||||
void lowAlertChanged(int);
|
||||
void highAlertChanged(int);
|
||||
void intervalChanged(int);
|
||||
void limitEnabledChanged(bool);
|
||||
void notificationsEnabledChanged(bool);
|
||||
void lowLimitChanged(int);
|
||||
void highLimitChanged(int);
|
||||
void lowAlertFileChanged(QString);
|
||||
void highAlertFileChanged(QString);
|
||||
};
|
||||
|
||||
#endif // SETTINGS_H
|
||||
|
|
Loading…
Reference in a new issue