コード例 #1
0
ファイル: light.cpp プロジェクト: Camelek/qtmoko
void LightSettings::accept()
{
    if ( qApp->focusWidget() )
        qApp->focusWidget()->clearFocus();

    if ( isStatusView ) {
        if ( isFromActiveProfile )
            saveConfig();
        pushSettingStatus();
    } else {
        saveConfig();
        // if the current profile has power management item
        // update the details with the new setting
        QSettings cfg( "Trolltech", "PhoneProfile" );
        cfg.beginGroup( "Profiles" );
        QString activeProfile = cfg.value( "Selected", 1 ).toString();
        cfg.endGroup();
        cfg.beginGroup( "Profile " + activeProfile );
        QString settings = cfg.value( "SettingList" ).toString();
        if ( settings.contains( "light-and-power" ) )
            pushSettingStatus();
    }
    QDialog::accept();
    close();
}
コード例 #2
0
ファイル: appearance.cpp プロジェクト: Artox/qtmoko
void AppearanceSettings::accept()
{
    if (!m_isStatusView) { // normal appearance setting operation
        QPhoneProfileManager profileManager;
        QPhoneProfile activeProfile = profileManager.activeProfile();
        QPhoneProfile::Setting setting = activeProfile.applicationSetting("appearance");
        if (setting != QPhoneProfile::Setting())
            pushSettingStatus();
    } else { // status view from profiles
        // save current status to the profile
        pushSettingStatus();
    }

    applyCurrentSettings();
    QDialog::accept();
}
コード例 #3
0
ファイル: appearance.cpp プロジェクト: Fale/qtmoko
AppearanceSettings::AppearanceSettings(QWidget* parent, Qt::WFlags fl)
    : QDialog(parent, fl),
      m_isStatusView(false)
{
    initUi();
    loadThemes();
    loadColorSchemes();
    loadSavedTheme();

    connect(qApp, SIGNAL(appMessage(QString,QByteArray)),
        this, SLOT(receiveAppMessage(QString,QByteArray)));

    QMenu *menu = QSoftMenuBar::menuFor(this);
    menu->addAction(QIcon(":icon/Note"), tr("Add to current profile"),
                    this, SLOT(pushSettingStatus()));
    menu->addAction(QIcon(":image/homescreen/homescreen"), tr("Homescreen Settings..."),
                    this, SLOT(openHomescreenSettings()));

    setWindowTitle(tr("Appearance"));
}
コード例 #4
0
ファイル: appearance.cpp プロジェクト: muromec/qtopia-ezx
// AppearanceSettings ----------------------------------------------------
AppearanceSettings::AppearanceSettings( QWidget* parent, Qt::WFlags fl )
    : QDialog(parent, fl),
    mIsStatusView(false), mIsFromActiveProfile(false)
{
    setupUi();
    readThemeSettings();
    readColorSchemeSettings();

    // Populate the first combo box (theme).
    populate();

    // Select the theme to populate the other combo boxes.
    // Note that they are not connected yet, so no preview is requested.
    themeSelected(mActiveThemeIndex);

    // Connect the combo boxes.
    connect( mThemeCombo, SIGNAL(currentIndexChanged(int)),
            this, SLOT(themeSelected(int)) );
    connect( mColorCombo, SIGNAL(currentIndexChanged(int)),
            this, SLOT(colorSelected(int)) );
    connect( mBgCombo, SIGNAL(currentIndexChanged(QString)),
            this, SLOT(backgroundSelected(QString)) );
    connect( mLabelCkBox, SIGNAL(toggled(bool)),
            this, SLOT(labelToggled(bool)) );

    connect( qApp, SIGNAL(appMessage(QString,QByteArray)),
        this, SLOT(receive(QString,QByteArray)) );

    // Re-select the theme to request the previews.
    themeSelected(mActiveThemeIndex);

    QSoftMenuBar::menuFor( this )->addAction
        ( QIcon( ":icon/Note" ), tr( "Add to current profile" ), this, SLOT(pushSettingStatus()) );
    QSoftMenuBar::menuFor( this )->addAction
        ( QIcon( ":image/homescreen/homescreen" ), tr( "Homescreen Settings..." ), this, SLOT(openHomescreenSettings()) );
}
コード例 #5
0
ファイル: light.cpp プロジェクト: Camelek/qtmoko
LightSettings::LightSettings( QWidget* parent,  Qt::WFlags fl )
    : QDialog( parent, fl), isStatusView( false )
{
    setWindowTitle(tr("Power Management"));
    QVBoxLayout * baseLayout = new QVBoxLayout( this );
    baseLayout->setMargin( 0 );

    QWidget * container = new QWidget();

    QScrollArea *sView = new QScrollArea;
    sView->setFocusPolicy(Qt::NoFocus);
    sView->setFrameStyle(QFrame::NoFrame);
    sView->setWidget( container );
    sView->setWidgetResizable( true );
    sView->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);

    QVBoxLayout *lightLayout = new QVBoxLayout(container);
    lightLayout->setMargin( 0 );
    b = new LightSettingsContainer();
    QtopiaApplication::setInputMethodHint( b->interval_dim, QtopiaApplication::AlwaysOff );
    QtopiaApplication::setInputMethodHint( b->interval_lightoff, QtopiaApplication::AlwaysOff );
    QtopiaApplication::setInputMethodHint( b->interval_suspend, QtopiaApplication::AlwaysOff );

    lightLayout->addWidget(b);

    baseLayout->addWidget(sView);

    // add context menu to push its status to Profiles
    contextMenu = QSoftMenuBar::menuFor( this );
    QAction* actionCapture = new QAction( QIcon( ":icon/Note" ), tr( "Add to current profile" ), this );
    contextMenu->addAction( actionCapture );
    connect( actionCapture, SIGNAL(triggered()), this, SLOT(pushSettingStatus()) );
    connect( qApp, SIGNAL(appMessage(QString,QByteArray)),
        this, SLOT(receive(QString,QByteArray)) );

    connect( b->interval_dim, SIGNAL(valueChanged(int)), this, SLOT(updateLightOffMinValue(int)) );
    connect( b->interval_dim, SIGNAL(valueChanged(int)), this, SLOT(updateSuspendMinValue(int)) );
    connect( b->interval_lightoff, SIGNAL(valueChanged(int)), this, SLOT(updateSuspendMinValue(int)) );

    b->officon->setPixmap(QPixmap(":image/off").scaled(24, 24, Qt::IgnoreAspectRatio, Qt::SmoothTransformation));
    b->brighticon->setPixmap(QPixmap(":image/Light").scaled(24, 24, Qt::IgnoreAspectRatio, Qt::SmoothTransformation));

    QSettings hwConfig("Trolltech", "Hardware");
    hwConfig.beginGroup("PowerManagement");
    lockMode.canSuspend = hwConfig.value("CanSuspendLock", false).toBool();    
    batteryMode.canSuspend = hwConfig.value("CanSuspend", false).toBool();
    externalMode.canSuspend = hwConfig.value("CanSuspendAC", false).toBool();
    hwConfig.endGroup();

    b->notnetworkedsuspend->hide();

    if (batteryMode.canSuspend || externalMode.canSuspend || lockMode.canSuspend) {
        b->interval_suspend->setEnabled(true);
    } else {
        b->interval_suspend->hide();
        b->label_suspend->hide();
    }

    QSettings config("Trolltech","qpe");
    
    config.beginGroup("LockPower");
    lockMode.intervalDim = config.value( "Interval_Dim", 20 ).toInt();
    lockMode.intervalLightOff = config.value("Interval_LightOff", 30).toInt();
    lockMode.intervalSuspend = config.value("Interval", 60).toInt();
    lockMode.brightness = config.value("Brightness", 255).toInt();
    lockMode.brightness = qMax(1,lockMode.brightness * qpe_sysBrightnessSteps() / 255);
    lockMode.initBrightness = lockMode.brightness;
    lockMode.dim = config.value("Dim", true).toBool();
    lockMode.lightoff = config.value("LightOff", false).toBool();
    lockMode.suspend = config.value("Suspend", true).toBool();
    lockMode.networkedsuspend = config.value("NetworkedSuspend", true).toBool();
    config.endGroup();

    config.beginGroup("BatteryPower");
    batteryMode.intervalDim = config.value( "Interval_Dim", 20 ).toInt();
    batteryMode.intervalLightOff = config.value("Interval_LightOff", 30).toInt();
    batteryMode.intervalSuspend = config.value("Interval", 60).toInt();
    batteryMode.brightness = config.value("Brightness", 255).toInt();
    batteryMode.brightness = qMax(1,batteryMode.brightness * qpe_sysBrightnessSteps() / 255);
    batteryMode.initBrightness = batteryMode.brightness;
    batteryMode.dim = config.value("Dim", true).toBool();
    batteryMode.lightoff = config.value("LightOff", false).toBool();
    batteryMode.suspend = config.value("Suspend", true).toBool();
    batteryMode.networkedsuspend = config.value("NetworkedSuspend", true).toBool();
    config.endGroup();

    config.beginGroup("ExternalPower");
    externalMode.intervalDim = config.value( "Interval_Dim", 20 ).toInt();
    externalMode.intervalLightOff = config.value("Interval_LightOff", 30).toInt();
    externalMode.intervalSuspend = config.value("Interval", 240).toInt();
    externalMode.brightness = config.value("Brightness", 255).toInt();
    externalMode.brightness = qMax(1,externalMode.brightness * qpe_sysBrightnessSteps() / 255);
    externalMode.initBrightness = externalMode.brightness;
    externalMode.dim = config.value("Dim", true).toBool();
    externalMode.lightoff = config.value("LightOff", false).toBool();   //default to leave on
    externalMode.suspend = config.value("Suspend", true).toBool();
    externalMode.networkedsuspend = config.value("NetworkedSuspend",false).toBool();
    config.endGroup();

    //must set min > 0 the screen will become completely black
    int maxbright = qpe_sysBrightnessSteps();
    b->brightness->setMaximum( maxbright );
    b->brightness->setMinimum( 1 );
    b->brightness->setTickInterval( qMax(1,maxbright/16) );
    b->brightness->setSingleStep( qMax(1,maxbright/16) );
    b->brightness->setPageStep( qMax(1,maxbright/16) );

    currentMode = &batteryMode;
    applyMode();

    connect(b->powerSource, SIGNAL(currentIndexChanged(int)),
            this, SLOT(powerTypeChanged(int)));
    if ( powerStatus.wallStatus() == QPowerStatus::Available ) {
        b->powerSource->setCurrentIndex(1);
    }

    connect(b->brightness, SIGNAL(valueChanged(int)), this, SLOT(applyBrightness()));

    QtopiaChannel *channel = new QtopiaChannel("Qtopia/PowerStatus", this);
    connect(channel, SIGNAL(received(QString,QByteArray)),
            this, SLOT(sysMessage(QString,QByteArray)));
}