From 73e9d69e1ce4f68ab541c63f0a0d756cc44642cc Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Thu, 18 May 2017 15:46:10 -0400 Subject: Add the ability to scan/migrate desktop/panel settings from one monitor ID to another on the first start of the desktop, and enable that migration for single-monitor arrangements. --- src-qt5/core/libLumina/LDesktopUtils.cpp | 17 +++++++++++++++++ src-qt5/core/libLumina/LDesktopUtils.h | 5 +++++ 2 files changed, 22 insertions(+) (limited to 'src-qt5/core/libLumina') diff --git a/src-qt5/core/libLumina/LDesktopUtils.cpp b/src-qt5/core/libLumina/LDesktopUtils.cpp index a46f03d0..d76c68e9 100644 --- a/src-qt5/core/libLumina/LDesktopUtils.cpp +++ b/src-qt5/core/libLumina/LDesktopUtils.cpp @@ -9,6 +9,7 @@ #include #include #include +#include #include "LuminaThemes.h" @@ -526,3 +527,19 @@ int LDesktopUtils::VersionStringToNumber(QString version){ //NOTE: This format allows numbers to be anywhere from 0->999 without conflict return (maj*1000000 + mid*1000 + min); } + +void LDesktopUtils::MigrateDesktopSettings(QSettings *settings, QString fromID, QString toID){ + //desktop-ID + QStringList keys = settings->allKeys(); + QStringList filter = keys.filter("desktop-"+fromID+"/"); + for(int i=0; isetValue("desktop-"+toID+"/"+filter[i].section("/",1,-1), settings->value(filter[i])); + settings->remove(filter[i]); + } + //panel_ID.[number] + filter = keys.filter("panel_"+fromID+"."); + for(int i=0; isetValue("panel_"+toID+"."+ filter[i].section("/",0,0).section(".",-1)+"/"+filter[i].section("/",1,-1), settings->value(filter[i])); + settings->remove(filter[i]); + } +} diff --git a/src-qt5/core/libLumina/LDesktopUtils.h b/src-qt5/core/libLumina/LDesktopUtils.h index dbad8757..b21bc78a 100644 --- a/src-qt5/core/libLumina/LDesktopUtils.h +++ b/src-qt5/core/libLumina/LDesktopUtils.h @@ -12,6 +12,7 @@ #include #include #include +#include //Other classes needed #include @@ -44,6 +45,10 @@ public: static void LoadSystemDefaults(bool skipOS = false); static bool checkUserFiles(QString lastversion); //returns true if something changed static int VersionStringToNumber(QString version); //convert the lumina version string to a number for comparisons + + //Migrating desktop settings from one ID to another + static void MigrateDesktopSettings(QSettings *settings, QString fromID, QString toID); + }; #endif -- cgit