From 381675ac570d9f8a792fe50c4c7bc6245c66945f Mon Sep 17 00:00:00 2001 From: Michail Vourlakos Date: Tue, 12 May 2020 02:16:08 +0300 Subject: [PATCH] reduce kconfig.sync() calls --improves startup times in some cases because it does not write to disk that often. --- app/layout/abstractlayout.cpp | 2 -- app/layout/centrallayout.cpp | 5 ----- app/layout/storage.cpp | 1 - app/layouts/manager.cpp | 6 ------ app/plasma/extended/theme.cpp | 2 -- app/settings/universalsettings.cpp | 2 -- app/view/indicator/indicator.cpp | 2 -- app/view/settings/primaryconfigview.cpp | 1 - app/view/view.cpp | 1 - 9 files changed, 22 deletions(-) diff --git a/app/layout/abstractlayout.cpp b/app/layout/abstractlayout.cpp index 8d83ebbe5..95ee5e87d 100644 --- a/app/layout/abstractlayout.cpp +++ b/app/layout/abstractlayout.cpp @@ -364,8 +364,6 @@ void AbstractLayout::saveConfig() m_layoutGroup.writeEntry("customTextColor", m_customTextColor); m_layoutGroup.writeEntry("lastUsedActivity", m_lastUsedActivity); m_layoutGroup.writeEntry("preferredForShortcutsTouched", m_preferredForShortcutsTouched); - - m_layoutGroup.sync(); } } diff --git a/app/layout/centrallayout.cpp b/app/layout/centrallayout.cpp index 15154248c..25aa171fe 100644 --- a/app/layout/centrallayout.cpp +++ b/app/layout/centrallayout.cpp @@ -50,9 +50,6 @@ CentralLayout::CentralLayout(QObject *parent, QString layoutFile, QString assign CentralLayout::~CentralLayout() { - if (!m_layoutFile.isEmpty()) { - m_layoutGroup.sync(); - } } void CentralLayout::unloadContainments() @@ -256,8 +253,6 @@ void CentralLayout::saveConfig() m_layoutGroup.writeEntry("disableBordersForMaximizedWindows", m_disableBordersForMaximizedWindows); m_layoutGroup.writeEntry("sharedLayout", m_sharedLayoutName); m_layoutGroup.writeEntry("activities", m_activities); - - m_layoutGroup.sync(); } //! OVERRIDES diff --git a/app/layout/storage.cpp b/app/layout/storage.cpp index 47e3b7b0e..21b5c2d36 100644 --- a/app/layout/storage.cpp +++ b/app/layout/storage.cpp @@ -158,7 +158,6 @@ void Storage::syncToLayoutFile(bool removeLayoutId) KConfigGroup oldContainments = KConfigGroup(filePtr, "Containments"); oldContainments.deleteGroup(); - oldContainments.sync(); qDebug() << " LAYOUT :: " << m_layout->name() << " is syncing its original file."; diff --git a/app/layouts/manager.cpp b/app/layouts/manager.cpp index 53df6b479..86d632695 100644 --- a/app/layouts/manager.cpp +++ b/app/layouts/manager.cpp @@ -307,10 +307,6 @@ void Manager::cleanupOnStartup(QString path) for (const auto &cId : removeContaimentsList) { containmentGroups.group(cId).deleteGroup(); } - - - actionGroups.sync(); - containmentGroups.sync(); } @@ -332,8 +328,6 @@ void Manager::clearUnloadedContainmentsFromLinkedFile(QStringList containmentsId KConfigGroup containment = containments.group(conId); containment.deleteGroup(); } - - containments.sync(); } QString Manager::newLayout(QString layoutName, QString preset) diff --git a/app/plasma/extended/theme.cpp b/app/plasma/extended/theme.cpp index 233b4a88d..aaba93d37 100644 --- a/app/plasma/extended/theme.cpp +++ b/app/plasma/extended/theme.cpp @@ -624,8 +624,6 @@ void Theme::loadConfig() void Theme::saveConfig() { m_themeGroup.writeEntry("outlineWidth", m_outlineWidth); - - m_themeGroup.sync(); } } diff --git a/app/settings/universalsettings.cpp b/app/settings/universalsettings.cpp index f62db2c85..c57330034 100644 --- a/app/settings/universalsettings.cpp +++ b/app/settings/universalsettings.cpp @@ -507,8 +507,6 @@ void UniversalSettings::saveConfig() m_universalGroup.writeEntry("showInfoWindow", m_showInfoWindow); m_universalGroup.writeEntry("memoryUsage", (int)m_memoryUsage); m_universalGroup.writeEntry("mouseSensitivity", (int)m_sensitivity); - - m_universalGroup.sync(); } void UniversalSettings::cleanupSettings() diff --git a/app/view/indicator/indicator.cpp b/app/view/indicator/indicator.cpp index d7fc4ad33..15bdea246 100644 --- a/app/view/indicator/indicator.cpp +++ b/app/view/indicator/indicator.cpp @@ -439,8 +439,6 @@ void Indicator::saveConfig() config.writeEntry("customType", m_customType); config.writeEntry("enabled", m_enabled); config.writeEntry("type", m_type); - - config.sync(); } } diff --git a/app/view/settings/primaryconfigview.cpp b/app/view/settings/primaryconfigview.cpp index 51321c2a9..ca30c71d5 100644 --- a/app/view/settings/primaryconfigview.cpp +++ b/app/view/settings/primaryconfigview.cpp @@ -778,7 +778,6 @@ void PrimaryConfigView::saveConfig() auto config = m_latteView->containment()->config(); int complexity = m_inAdvancedMode ? 1 : 0; config.writeEntry("settingsComplexity", complexity); - config.sync(); } //!END configuration diff --git a/app/view/view.cpp b/app/view/view.cpp index b181d515b..0aee4c5a5 100644 --- a/app/view/view.cpp +++ b/app/view/view.cpp @@ -1548,7 +1548,6 @@ void View::saveConfig() config.writeEntry("byPassWM", byPassWM()); config.writeEntry("isPreferredForShortcuts", isPreferredForShortcuts()); config.writeEntry("viewType", (int)m_type); - config.sync(); } void View::restoreConfig()