void UBPreferencesController::init()
{
    UBSettings* settings = UBSettings::settings();

    // about tab
    mPreferencesUI->checkSoftwareUpdateAtLaunchCheckBox->setChecked(settings->appEnableAutomaticSoftwareUpdates->get().toBool());

    // display tab
    mPreferencesUI->keyboardPaletteAutoMinimize->setChecked(settings->boardKeyboardPaletteAutoMinimize->get().toBool());
    for(int i=0; i<mPreferencesUI->keyboardPaletteKeyButtonSize->count(); i++)
        if (mPreferencesUI->keyboardPaletteKeyButtonSize->itemText(i) ==
            settings->boardKeyboardPaletteKeyBtnSize->get().toString())
        {
            mPreferencesUI->keyboardPaletteKeyButtonSize->setCurrentIndex(i);
            break;
        }

    mPreferencesUI->useExternalBrowserCheckBox->setChecked(settings->webUseExternalBrowser->get().toBool());
    mPreferencesUI->displayBrowserPageCheckBox->setChecked(settings->webShowPageImmediatelyOnMirroredScreen->get().toBool());
    mPreferencesUI->webHomePage->setText(settings->webHomePage->get().toString());

    mPreferencesUI->proxyUsername->setText(settings->proxyUsername());
    mPreferencesUI->proxyPassword->setText(settings->proxyPassword());

    mPreferencesUI->toolbarAtTopRadioButton->setChecked(settings->appToolBarPositionedAtTop->get().toBool());
    mPreferencesUI->toolbarAtBottomRadioButton->setChecked(!settings->appToolBarPositionedAtTop->get().toBool());
    mPreferencesUI->toolbarDisplayTextCheckBox->setChecked(settings->appToolBarDisplayText->get().toBool());
    mPreferencesUI->verticalChoice->setChecked(settings->appToolBarOrientationVertical->get().toBool());
    mPreferencesUI->horizontalChoice->setChecked(!settings->appToolBarOrientationVertical->get().toBool());

    // pen tab
    mPenProperties->fineSlider->setValue(settings->boardPenFineWidth->get().toDouble() * sSliderRatio);
    mPenProperties->mediumSlider->setValue(settings->boardPenMediumWidth->get().toDouble() * sSliderRatio);
    mPenProperties->strongSlider->setValue(settings->boardPenStrongWidth->get().toDouble() * sSliderRatio);
    mPenProperties->pressureSensitiveCheckBox->setChecked(settings->boardPenPressureSensitive->get().toBool());

    // marker tab
    mMarkerProperties->fineSlider->setValue(settings->boardMarkerFineWidth->get().toDouble() * sSliderRatio);
    mMarkerProperties->mediumSlider->setValue(settings->boardMarkerMediumWidth->get().toDouble() * sSliderRatio);
    mMarkerProperties->strongSlider->setValue(settings->boardMarkerStrongWidth->get().toDouble() * sSliderRatio);
    mMarkerProperties->pressureSensitiveCheckBox->setChecked(settings->boardMarkerPressureSensitive->get().toBool());

    mMarkerProperties->opacitySlider->setValue(settings->boardMarkerAlpha->get().toDouble() * 100);

}
Ejemplo n.º 2
0
void UBPreferencesController::init()
{
    UBSettings* settings = UBSettings::settings();

    // about tab
    mPreferencesUI->checkSoftwareUpdateAtLaunchCheckBox->setChecked(settings->appEnableAutomaticSoftwareUpdates->get().toBool());

    // display tab
    for(int i=0; i<mPreferencesUI->keyboardPaletteKeyButtonSize->count(); i++)
        if (mPreferencesUI->keyboardPaletteKeyButtonSize->itemText(i) == settings->boardKeyboardPaletteKeyBtnSize->get().toString()) {
            mPreferencesUI->keyboardPaletteKeyButtonSize->setCurrentIndex(i);
            break;
        }

    mPreferencesUI->startupTipsCheckBox->setChecked(settings->appStartupHintsEnabled->get().toBool());

    mPreferencesUI->startModeComboBox->setCurrentIndex(settings->appStartMode->get().toInt());

    mPreferencesUI->useExternalBrowserCheckBox->setChecked(settings->webUseExternalBrowser->get().toBool());
    mPreferencesUI->displayBrowserPageCheckBox->setChecked(settings->webShowPageImmediatelyOnMirroredScreen->get().toBool());
    mPreferencesUI->webHomePage->setText(settings->webHomePage->get().toString());

    mPreferencesUI->proxyUsername->setText(settings->proxyUsername());
    mPreferencesUI->proxyPassword->setText(settings->proxyPassword());

    mPreferencesUI->toolbarAtTopRadioButton->setChecked(settings->appToolBarPositionedAtTop->get().toBool());
    mPreferencesUI->toolbarAtBottomRadioButton->setChecked(!settings->appToolBarPositionedAtTop->get().toBool());
    mPreferencesUI->toolbarDisplayTextCheckBox->setChecked(settings->appToolBarDisplayText->get().toBool());
    mPreferencesUI->verticalChoice->setChecked(settings->appToolBarOrientationVertical->get().toBool());
    mPreferencesUI->horizontalChoice->setChecked(!settings->appToolBarOrientationVertical->get().toBool());

    mPreferencesUI->Username_textBox->setText(settings->communityUsername());
    mPreferencesUI->Password_textEdit->setText(settings->communityPassword());
    mPreferencesUI->swapControlAndDisplayScreensCheckBox->setChecked(settings->swapControlAndDisplayScreens->get().toBool());

    // pen tab
    mPenProperties->fineSlider->setValue(settings->boardPenFineWidth->get().toDouble() * sSliderRatio);
    mPenProperties->mediumSlider->setValue(settings->boardPenMediumWidth->get().toDouble() * sSliderRatio);
    mPenProperties->strongSlider->setValue(settings->boardPenStrongWidth->get().toDouble() * sSliderRatio);
    mPenProperties->pressureSensitiveCheckBox->setChecked(settings->boardPenPressureSensitive->get().toBool());

    // marker tab
    mMarkerProperties->fineSlider->setValue(settings->boardMarkerFineWidth->get().toDouble() * sSliderRatio);
    mMarkerProperties->mediumSlider->setValue(settings->boardMarkerMediumWidth->get().toDouble() * sSliderRatio);
    mMarkerProperties->strongSlider->setValue(settings->boardMarkerStrongWidth->get().toDouble() * sSliderRatio);
    mMarkerProperties->pressureSensitiveCheckBox->setChecked(settings->boardMarkerPressureSensitive->get().toBool());

    mMarkerProperties->opacitySlider->setValue(settings->boardMarkerAlpha->get().toDouble() * 100);

    //network
    mPreferencesUI->PSCredentialsPersistenceCheckBox->setChecked(settings->getCommunityDataPersistence());
    persistanceCheckboxUpdate();

    //Issue NC - CFA - 20140520 : clear list, to prevent duplication of the list
    mIsoCodeAndLanguage.clear();
    mIsoCodeAndLanguage.insert(tr("Default"),"NO_VALUE");
    mIsoCodeAndLanguage.insert(tr("Arabic"),"ar");
    mIsoCodeAndLanguage.insert(tr("Basque"),"eu");
    mIsoCodeAndLanguage.insert(tr("Bambara"),"bm");
    mIsoCodeAndLanguage.insert(tr("Bulgarian"),"bg");
    mIsoCodeAndLanguage.insert(tr("Catalan"),"ca");
    mIsoCodeAndLanguage.insert(tr("Corsican"),"co");
    mIsoCodeAndLanguage.insert(tr("Czech"),"cs");
    mIsoCodeAndLanguage.insert(tr("Danish"),"da");
    mIsoCodeAndLanguage.insert(tr("German"),"de");
    mIsoCodeAndLanguage.insert(tr("Greek"),"el");
    mIsoCodeAndLanguage.insert(tr("English"),"en");
    mIsoCodeAndLanguage.insert(tr("English UK"),"en_UK");
    mIsoCodeAndLanguage.insert(tr("Spanish"),"es");
    mIsoCodeAndLanguage.insert(tr("Finnish"),"fi");
    mIsoCodeAndLanguage.insert(tr("French"),"fr");
    mIsoCodeAndLanguage.insert(tr("Swiss French"),"fr_CH");
    mIsoCodeAndLanguage.insert(tr("Hindi"),"hi");
    mIsoCodeAndLanguage.insert(tr("Hungarian"),"hu");
    mIsoCodeAndLanguage.insert(tr("Italian"),"it");
    mIsoCodeAndLanguage.insert(tr("Hebrew"),"iw");
    mIsoCodeAndLanguage.insert(tr("Japanese"),"ja");
    mIsoCodeAndLanguage.insert(tr("Korean"),"ko");
    mIsoCodeAndLanguage.insert(tr("Malagasy"),"mg");
    mIsoCodeAndLanguage.insert(tr("Norwegian"),"nb");
    mIsoCodeAndLanguage.insert(tr("Dutch"),"nl");
    mIsoCodeAndLanguage.insert(tr("Occitan"), "oc");
    mIsoCodeAndLanguage.insert(tr("Polish"),"pl");
    mIsoCodeAndLanguage.insert(tr("Portuguese"),"pt");
    mIsoCodeAndLanguage.insert(tr("Romansh"),"rm");
    mIsoCodeAndLanguage.insert(tr("Romanian"),"ro");
    mIsoCodeAndLanguage.insert(tr("Russian"),"ru");
    mIsoCodeAndLanguage.insert(tr("Slovak"),"sk");
    mIsoCodeAndLanguage.insert(tr("Swedish"),"sv");
    mIsoCodeAndLanguage.insert(tr("Turkish"),"tr");
    mIsoCodeAndLanguage.insert(tr("Chinese"),"zh");
    mIsoCodeAndLanguage.insert(tr("Chinese Simplified"),"zh_CN");
    mIsoCodeAndLanguage.insert(tr("Chinese Traditional"),"zh_TW");
    mIsoCodeAndLanguage.insert(tr("Galician"),"gl");

    QStringList list;
    list << mIsoCodeAndLanguage.keys();
    list.sort();
    //Issue NC - CFA - 20140520 : clear list, to prevent duplication of the list
    QString currentIsoLanguage = UBSettings::settings()->appPreferredLanguage->get().toString();
    mPreferencesUI->languageComboBox->clear();
    mPreferencesUI->languageComboBox->addItems(list);
    if(currentIsoLanguage.length()){
        QString language;
        foreach(QString eachKey, mIsoCodeAndLanguage.keys())
            if(mIsoCodeAndLanguage[eachKey] == currentIsoLanguage){
                language = eachKey;
                break;
            }
        mPreferencesUI->languageComboBox->setCurrentIndex(list.indexOf(language));
    }