void BatteryDbusInterface::updateValues(bool isCharging, int currentCharge)
{
    mIsCharging = isCharging;
    mCharge = currentCharge;

    Q_EMIT stateChanged(mIsCharging);
    Q_EMIT chargeChanged(mCharge);
}
Ejemplo n.º 2
0
BatteryPublisher::BatteryPublisher(QWidget *parent)
:   QDialog(parent), ui(new Ui::BatteryPublisher), chargeTimer(0)
{
    ui->setupUi(this);

    publisher = new QValueSpacePublisher("/power/battery");

    connect(ui->batteryCharge, SIGNAL(valueChanged(int)),
            this, SLOT(chargeChanged(int)));
    connect(ui->charging, SIGNAL(toggled(bool)),
            this, SLOT(chargingToggled(bool)));

    chargeChanged(ui->batteryCharge->value());
}