void UBWidgetUniboardAPI::setMarkerColor(const QString& penColor) { if (UBApplication::boardController->activeScene() != mScene) return; UBSettings* settings = UBSettings::settings(); bool conversionState = false; int index = penColor.toInt(&conversionState); if (conversionState && index > 0 && index <= 4) { UBApplication::boardController->setMarkerColorOnDarkBackground(settings->markerColors(true).at(index - 1)); UBApplication::boardController->setMarkerColorOnLightBackground(settings->markerColors(false).at(index - 1)); } else { QColor svgColor; svgColor.setNamedColor(penColor); if (svgColor.isValid()) { UBApplication::boardController->setMarkerColorOnDarkBackground(svgColor); UBApplication::boardController->setMarkerColorOnLightBackground(svgColor); } } }
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); }
void UBPreferencesController::defaultSettings() { UBSettings* settings = UBSettings::settings(); if (mPreferencesUI->mainTabWidget->currentWidget() == mPreferencesUI->displayTab) { bool defaultValue = settings->webUseExternalBrowser->reset().toBool(); mPreferencesUI->useExternalBrowserCheckBox->setChecked(defaultValue); defaultValue = settings->webShowPageImmediatelyOnMirroredScreen->reset().toBool(); mPreferencesUI->displayBrowserPageCheckBox->setChecked(defaultValue); mPreferencesUI->webHomePage->setText(settings->webHomePage->reset().toString()); defaultValue = settings->appToolBarPositionedAtTop->reset().toBool(); mPreferencesUI->toolbarAtTopRadioButton->setChecked(defaultValue); mPreferencesUI->toolbarAtBottomRadioButton->setChecked(!defaultValue); defaultValue = settings->appToolBarDisplayText->reset().toBool(); mPreferencesUI->toolbarDisplayTextCheckBox->setChecked(defaultValue); mPreferencesUI->verticalChoice->setChecked(settings->appToolBarOrientationVertical->reset().toBool()); mPreferencesUI->horizontalChoice->setChecked(!settings->appToolBarOrientationVertical->reset().toBool()); } else if (mPreferencesUI->mainTabWidget->currentWidget() == mPreferencesUI->penTab) { mPenProperties->fineSlider->setValue(settings->boardPenFineWidth->reset().toDouble() * sSliderRatio); mPenProperties->mediumSlider->setValue(settings->boardPenMediumWidth->reset().toDouble() * sSliderRatio); mPenProperties->strongSlider->setValue(settings->boardPenStrongWidth->reset().toDouble() * sSliderRatio); mPenProperties->pressureSensitiveCheckBox->setChecked(settings->boardPenPressureSensitive->reset().toBool()); settings->boardPenLightBackgroundSelectedColors->reset(); QList<QColor> lightBackgroundSelectedColors = settings->boardPenLightBackgroundSelectedColors->colors(); settings->boardPenDarkBackgroundSelectedColors->reset(); QList<QColor> darkBackgroundSelectedColors = settings->boardPenDarkBackgroundSelectedColors->colors(); for (int i = 0 ; i < settings->colorPaletteSize ; i++) { mPenProperties->lightBackgroundColorPickers[i]->setSelectedColorIndex(lightBackgroundSelectedColors.indexOf(settings->penColors(false).at(i))); mPenProperties->darkBackgroundColorPickers[i]->setSelectedColorIndex(darkBackgroundSelectedColors.indexOf(settings->penColors(true).at(i))); } } else if (mPreferencesUI->mainTabWidget->currentWidget() == mPreferencesUI->markerTab) { mMarkerProperties->fineSlider->setValue(settings->boardMarkerFineWidth->reset().toDouble() * sSliderRatio); mMarkerProperties->mediumSlider->setValue(settings->boardMarkerMediumWidth->reset().toDouble() * sSliderRatio); mMarkerProperties->strongSlider->setValue(settings->boardMarkerStrongWidth->reset().toDouble() * sSliderRatio); mMarkerProperties->pressureSensitiveCheckBox->setChecked(settings->boardMarkerPressureSensitive->reset().toBool()); mMarkerProperties->opacitySlider->setValue(settings->boardMarkerAlpha->reset().toDouble() * 100); settings->boardMarkerLightBackgroundSelectedColors->reset(); QList<QColor> lightBackgroundSelectedColors = settings->boardMarkerLightBackgroundSelectedColors->colors(); settings->boardMarkerDarkBackgroundSelectedColors->reset(); QList<QColor> darkBackgroundSelectedColors = settings->boardMarkerDarkBackgroundSelectedColors->colors(); for (int i = 0 ; i < settings->colorPaletteSize ; i++) { mMarkerProperties->lightBackgroundColorPickers[i]->setSelectedColorIndex(lightBackgroundSelectedColors.indexOf(settings->markerColors(false).at(i))); mMarkerProperties->darkBackgroundColorPickers[i]->setSelectedColorIndex(darkBackgroundSelectedColors.indexOf(settings->markerColors(true).at(i))); } } else if (mPreferencesUI->mainTabWidget->currentWidget() == mPreferencesUI->aboutTab) { bool defaultValue = settings->appEnableAutomaticSoftwareUpdates->reset().toBool(); mPreferencesUI->checkSoftwareUpdateAtLaunchCheckBox->setChecked(defaultValue); } }
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)); }