| 154 | } |
| 155 | |
| 156 | void SettingsGeneralPage::loadSettings() { |
| 157 | const auto group = Settings::settingsGeneral(); |
| 158 | |
| 159 | const auto loadOnStart = group.readEntry(QLatin1String("LoadOnStart"), static_cast<int>(MainWin::LoadOnStart::NewProject)); |
| 160 | ui.cbLoadOnStart->setCurrentIndex(ui.cbLoadOnStart->findData(loadOnStart)); |
| 161 | loadOnStartChanged(); |
| 162 | |
| 163 | const auto newProject = group.readEntry(QLatin1String("NewProject"), static_cast<int>(MainWin::NewProject::WithSpreadsheet)); |
| 164 | ui.cbNewProject->setCurrentIndex(ui.cbNewProject->findData(newProject)); |
| 165 | newProjectChanged(); // call it to update notebook related widgets also if the current index above was not changed (true for index=0) |
| 166 | |
| 167 | #ifdef HAVE_CANTOR_LIBS |
| 168 | const auto& backendName = group.readEntry(QLatin1String("LoadOnStartNotebook"), QString()); |
| 169 | int index = ui.cbNewProjectNotebook->findText(backendName); |
| 170 | if (index == -1 && ui.cbNewProjectNotebook->count() > 0) |
| 171 | ui.cbNewProjectNotebook->setCurrentIndex(0); // select the first available backend if not backend was select yet |
| 172 | else |
| 173 | ui.cbNewProjectNotebook->setCurrentIndex(index); |
| 174 | #endif |
| 175 | |
| 176 | ui.cbTitleBar->setCurrentIndex(group.readEntry(QLatin1String("TitleBar"), 0)); |
| 177 | ui.cbDockWindowPositionReopen->setCurrentIndex(ui.cbDockWindowPositionReopen->findData(static_cast<int>(Settings::readDockPosBehavior()))); |
| 178 | |
| 179 | ui.cbUnits->setCurrentIndex(group.readEntry(QLatin1String("Units"), 0)); |
| 180 | ui.chkGUMTerms->setChecked(group.readEntry<bool>(QLatin1String("GUMTerms"), false)); |
| 181 | |
| 182 | // number format |
| 183 | const auto language = group.readEntry(QLatin1String("NumberFormat"), static_cast<int>(QLocale::AnyLanguage)); |
| 184 | ui.cbNumberFormat->setCurrentIndex(ui.cbNumberFormat->findData(language)); |
| 185 | |
| 186 | // number options |
| 187 | QLocale::NumberOptions numberOptions{ |
| 188 | static_cast<QLocale::NumberOptions>(group.readEntry(QLatin1String("NumberOptions"), static_cast<int>(QLocale::DefaultNumberOptions)))}; |
| 189 | if (numberOptions & QLocale::OmitGroupSeparator) |
| 190 | ui.chkOmitGroupSeparator->setChecked(true); |
| 191 | if (numberOptions & QLocale::OmitLeadingZeroInExponent) |
| 192 | ui.chkOmitLeadingZeroInExponent->setChecked(true); |
| 193 | if (numberOptions & QLocale::IncludeTrailingZeroesAfterDot) |
| 194 | ui.chkIncludeTrailingZeroesAfterDot->setChecked(true); |
| 195 | |
| 196 | ui.chkUseHyphen->setChecked(group.readEntry<bool>(QLatin1String("UseHyphen"), false)); |
| 197 | |
| 198 | ui.chkAutoSave->setChecked(group.readEntry<bool>(QLatin1String("AutoSave"), false)); |
| 199 | ui.sbAutoSaveInterval->setValue(group.readEntry(QLatin1String("AutoSaveInterval"), 0)); |
| 200 | ui.chkSaveDockStates->setChecked(group.readEntry<bool>(QLatin1String("SaveDockStates"), false)); |
| 201 | ui.chkSaveCalculations->setChecked(group.readEntry<bool>(QLatin1String("SaveCalculations"), true)); |
| 202 | ui.chkCompatible->setChecked(group.readEntry<bool>(QLatin1String("CompatibleSave"), false)); |
| 203 | ui.chkInfoTrace->setChecked(group.readEntry<bool>(QLatin1String("InfoTrace"), false)); |
| 204 | ui.chkDebugTrace->setChecked(group.readEntry<bool>(QLatin1String("DebugTrace"), false)); |
| 205 | ui.chkPerfTrace->setChecked(group.readEntry<bool>(QLatin1String("PerfTrace"), false)); |
| 206 | |
| 207 | m_changed = false; |
| 208 | } |
| 209 | |
| 210 | void SettingsGeneralPage::retranslateUi() { |
| 211 | ui.cbLoadOnStart->clear(); |