コード例 #1
0
ファイル: batterynotifier.cpp プロジェクト: AOSC-Dev/lipstick
void BatteryNotifier::initBattery()
{
#if QT_VERSION < QT_VERSION_CHECK(5, 2, 0)
    applyChargingState(0, batteryInfo->chargingState(0));
    applyBatteryStatus(0, batteryInfo->batteryStatus(0));
#else
    applyChargingState(batteryInfo->chargingState());
    applyBatteryStatus(batteryInfo->levelStatus());
#endif
}
コード例 #2
0
ファイル: batterynotifier.cpp プロジェクト: Morpog/lipstick
void BatteryNotifier::initBattery()
{
    applyChargingState(0, batteryInfo->chargingState(0));
    applyBatteryStatus(0, batteryInfo->batteryStatus(0));
}
コード例 #3
0
BatteryNotifier::BatteryNotifier(QObject *parent) :
    QObject(parent),
    lowBatteryNotifier(0),
    notificationId(0),
    touchScreenLockActive(false),
    batteryInfo(new QtMobility::QSystemBatteryInfo(this)),
    qmDeviceMode(new MeeGo::QmDeviceMode(this)),
    qmLed(new MeeGo::QmLED(this)),
    chargerType(QtMobility::QSystemBatteryInfo::UnknownCharger)
{
    connect(batteryInfo, SIGNAL(batteryStatusChanged(QSystemBatteryInfo::BatteryStatus)), this, SLOT(applyBatteryStatus(QSystemBatteryInfo::BatteryStatus)));
    connect(batteryInfo, SIGNAL(chargingStateChanged(QSystemBatteryInfo::ChargingState)), this, SLOT(applyChargingState(QSystemBatteryInfo::ChargingState)));
    connect(batteryInfo, SIGNAL(chargerTypeChanged(QSystemBatteryInfo::ChargerType)), this, SLOT(applyChargerType(QSystemBatteryInfo::ChargerType)));
    connect(qmDeviceMode, SIGNAL(devicePSMStateChanged(MeeGo::QmDeviceMode::PSMState)), this, SLOT(applyPSMState(MeeGo::QmDeviceMode::PSMState)));

    // Init battery values delayed...
    initBattery();

    notificationTimer.setInterval(5000);
    notificationTimer.setSingleShot(true);
}
コード例 #4
0
ファイル: batterynotifier.cpp プロジェクト: AOSC-Dev/lipstick
BatteryNotifier::BatteryNotifier(QObject *parent) :
    QObject(parent),
    lowBatteryNotifier(0),
    notificationId(0),
    touchScreenLockActive(false),
    batteryInfo(new QBatteryInfo(this)),
    qmDeviceMode(new MeeGo::QmDeviceMode(this)),
    chargerType(QBatteryInfo::UnknownCharger)
{
#ifndef UNIT_TEST
#if QT_VERSION < QT_VERSION_CHECK(5, 2, 0)
    connect(batteryInfo, SIGNAL(batteryStatusChanged(int,QBatteryInfo::BatteryStatus)), this, SLOT(applyBatteryStatus(int,QBatteryInfo::BatteryStatus)));
    connect(batteryInfo, SIGNAL(chargingStateChanged(int,QBatteryInfo::ChargingState)), this, SLOT(applyChargingState(int,QBatteryInfo::ChargingState)));
#else
    connect(batteryInfo, SIGNAL(levelStatusChanged(QBatteryInfo::LevelStatus)), this, SLOT(applyBatteryStatus(QBatteryInfo::LevelStatus)));
    connect(batteryInfo, SIGNAL(chargingStateChanged(QBatteryInfo::ChargingState)), this, SLOT(applyChargingState(QBatteryInfo::ChargingState)));
#endif
    connect(batteryInfo, SIGNAL(chargerTypeChanged(QBatteryInfo::ChargerType)), this, SLOT(applyChargerType(QBatteryInfo::ChargerType)));
#endif
    connect(qmDeviceMode, SIGNAL(devicePSMStateChanged(MeeGo::QmDeviceMode::PSMState)), this, SLOT(applyPSMState(MeeGo::QmDeviceMode::PSMState)));

    notificationTimer.setInterval(5000);
    notificationTimer.setSingleShot(true);

    QTimer::singleShot(0, this, SLOT(initBattery()));
}