void UBWidgetUniboardAPI::setPenColor(const QString& penColor) { if (UBApplication::boardController->activeScene() != mScene) return; UBSettings* settings = UBSettings::settings(); bool conversionState = false; int index = penColor.toInt(&conversionState) - 1; if (conversionState && index > 0 && index <= 4) { UBApplication::boardController->setPenColorOnDarkBackground(settings->penColors(true).at(index - 1)); UBApplication::boardController->setPenColorOnLightBackground(settings->penColors(false).at(index - 1)); } else { QColor svgColor; svgColor.setNamedColor(penColor); if (svgColor.isValid()) { UBApplication::boardController->setPenColorOnDarkBackground(svgColor); UBApplication::boardController->setPenColorOnLightBackground(svgColor); } } }
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); } }