MCPcopy Create free account
hub / github.com/KDE/labplot / handleSettingsChanges

Method handleSettingsChanges

src/frontend/MainWin.cpp:2604–2734  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2602}
2603
2604void MainWin::handleSettingsChanges(QList<Settings::Type> changes) {
2605 WAIT_CURSOR;
2606 const auto group = Settings::group(QStringLiteral("Settings_General"));
2607
2608 // handle general settings
2609 // TODO: handle only those settings that were really changed, similar to how it's done for the nubmer format, etc. further below
2610 if (changes.contains(Settings::Type::General)) {
2611 // title bar
2612 MainWin::TitleBarMode titleBarMode = static_cast<MainWin::TitleBarMode>(group.readEntry("TitleBar", 0));
2613 if (titleBarMode != m_titleBarMode) {
2614 m_titleBarMode = titleBarMode;
2615 updateTitleBar();
2616 }
2617
2618 // window visibility
2619 auto vis = Project::DockVisibility(group.readEntry("DockVisibility", 0));
2620 if (m_project && (vis != m_project->dockVisibility())) {
2621 if (vis == Project::DockVisibility::folderOnly)
2622 m_visibilityFolderAction->setChecked(true);
2623 else if (vis == Project::DockVisibility::folderAndSubfolders)
2624 m_visibilitySubfolderAction->setChecked(true);
2625 else
2626 m_visibilityAllAction->setChecked(true);
2627 m_project->setDockVisibility(vis);
2628 }
2629
2630 // autosave
2631 bool autoSave = group.readEntry("AutoSave", 0);
2632 if (m_autoSaveActive != autoSave) {
2633 m_autoSaveActive = autoSave;
2634 if (autoSave)
2635 m_autoSaveTimer.start();
2636 else
2637 m_autoSaveTimer.stop();
2638 }
2639
2640 int interval = group.readEntry("AutoSaveInterval", 1);
2641 interval *= 60 * 1000;
2642 if (interval != m_autoSaveTimer.interval())
2643 m_autoSaveTimer.setInterval(interval);
2644 }
2645
2646 // update the number format in all visible dock widgets, worksheet elements and spreadsheets, if changed
2647 if (changes.contains(Settings::Type::General_Number_Format)) {
2648 updateLocale(); // set the new default runtime locale
2649
2650 // dock widgets
2651 if (stackedWidget) {
2652 for (int i = 0; i < stackedWidget->count(); ++i) {
2653 auto* widget = stackedWidget->widget(i);
2654 auto* dock = dynamic_cast<BaseDock*>(widget);
2655 if (dock)
2656 dock->updateLocale();
2657 else {
2658 auto* labelWidget = dynamic_cast<LabelWidget*>(widget);
2659 if (labelWidget)
2660 labelWidget->updateLocale();
2661 }

Callers

nothing calls this directly

Calls 13

groupFunction · 0.85
dockVisibilityMethod · 0.80
setIntervalMethod · 0.80
viewCreatedMethod · 0.80
updatePreviewSizeMethod · 0.80
containsMethod · 0.45
setDockVisibilityMethod · 0.45
startMethod · 0.45
countMethod · 0.45
widgetMethod · 0.45
updateLocaleMethod · 0.45
updateUnitsMethod · 0.45

Tested by

no test coverage detected