From caea68731fac0339e512457d6d2506b3f4e88a06 Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Wed, 5 Oct 2016 08:20:21 -0400 Subject: Convert over the desktop/panel settings to be based on screen ID instead of screen number. It seems like X randomly assigns numbers to screens in some instances - resulting in multi-monitor arrays occasionally getting rotated/scrambled. After the automatic conversion of the settings to the new system (the first time the user logs into the updated version of Lumina), screen settings are tied to that particular monitor now (HDMI-0, DP-1, etc...) --- src-qt5/core-utils/lumina-config/PanelWidget.cpp | 6 +- .../lumina-config/pages/page_interface_desktop.cpp | 6 +- .../lumina-config/pages/page_interface_panels.cpp | 6 +- src-qt5/core/libLumina/LuminaUtils.cpp | 66 ++++++++-------------- src-qt5/core/lumina-desktop/LDesktop.cpp | 6 +- src-qt5/core/lumina-desktop/LDesktopPluginSpace.h | 3 + src-qt5/core/lumina-desktop/LPanel.cpp | 5 +- 7 files changed, 47 insertions(+), 51 deletions(-) (limited to 'src-qt5') diff --git a/src-qt5/core-utils/lumina-config/PanelWidget.cpp b/src-qt5/core-utils/lumina-config/PanelWidget.cpp index 8b38f407..aff7bda3 100644 --- a/src-qt5/core-utils/lumina-config/PanelWidget.cpp +++ b/src-qt5/core-utils/lumina-config/PanelWidget.cpp @@ -42,7 +42,8 @@ PanelWidget::~PanelWidget(){ void PanelWidget::LoadSettings(QSettings *settings, int Dnum, int Pnum){ pnum = Pnum; dnum = Dnum; //save these for later ui->label->setText( QString(tr("Panel %1")).arg(QString::number(Pnum+1) ) ); - QString prefix = "panel"+QString::number(Dnum)+"."+QString::number(Pnum)+"/"; + QString screenID = QApplication::screens().at(Dnum)->name(); + QString prefix = "panel_"+screenID+"."+QString::number(Pnum)+"/"; qDebug() << "Loading Panel Settings:" << prefix; //Now load the settings into the GUI int tmp = ui->combo_align->findData( settings->value(prefix+"pinLocation","center").toString().toLower() ); @@ -78,7 +79,8 @@ void PanelWidget::LoadSettings(QSettings *settings, int Dnum, int Pnum){ } void PanelWidget::SaveSettings(QSettings *settings){//save the current settings - QString prefix = "panel"+QString::number(dnum)+"."+QString::number(pnum)+"/"; + QString screenID = QApplication::screens().at(dnum)->name(); + QString prefix = "panel_"+screenID+"."+QString::number(pnum)+"/"; qDebug() << "Saving panel settings:" << prefix; settings->setValue(prefix+"location", ui->combo_edge->currentData().toString() ); settings->setValue(prefix+"pinLocation", ui->combo_align->currentData().toString() ); diff --git a/src-qt5/core-utils/lumina-config/pages/page_interface_desktop.cpp b/src-qt5/core-utils/lumina-config/pages/page_interface_desktop.cpp index fdcde804..f467db36 100644 --- a/src-qt5/core-utils/lumina-config/pages/page_interface_desktop.cpp +++ b/src-qt5/core-utils/lumina-config/pages/page_interface_desktop.cpp @@ -31,7 +31,8 @@ page_interface_desktop::~page_interface_desktop(){ //================ void page_interface_desktop::SaveSettings(){ QSettings settings("lumina-desktop","desktopsettings"); - QString DPrefix = "desktop-"+QString::number(cscreen)+"/"; + QString screenID = QApplication::screens().at(cscreen)->name(); + QString DPrefix = "desktop-"+screenID+"/"; settings.setValue(DPrefix+"generateDesktopIcons", ui->check_desktop_autolaunchers->isChecked() ); QStringList plugs; @@ -53,7 +54,8 @@ void page_interface_desktop::LoadSettings(int screennum){ emit HasPendingChanges(false); emit ChangePageTitle( tr("Desktop Settings") ); QSettings settings("lumina-desktop","desktopsettings"); - QString DPrefix = "desktop-"+QString::number(cscreen)+"/"; + QString screenID = QApplication::screens().at(cscreen)->name(); + QString DPrefix = "desktop-"+screenID+"/"; ui->check_desktop_autolaunchers->setChecked(settings.value(DPrefix+"generateDesktopIcons",false).toBool() ); QStringList dplugs = settings.value(DPrefix+"pluginlist",QStringList()).toStringList(); diff --git a/src-qt5/core-utils/lumina-config/pages/page_interface_panels.cpp b/src-qt5/core-utils/lumina-config/pages/page_interface_panels.cpp index 0e486bdd..7d0d3d8c 100644 --- a/src-qt5/core-utils/lumina-config/pages/page_interface_panels.cpp +++ b/src-qt5/core-utils/lumina-config/pages/page_interface_panels.cpp @@ -30,7 +30,8 @@ page_interface_panels::~page_interface_panels(){ // PUBLIC SLOTS //================ void page_interface_panels::SaveSettings(){ - QString DPrefix = "desktop-"+QString::number(cscreen)+"/"; + QString screenID = QApplication::screens().at(cscreen)->name(); + QString DPrefix = "desktop-"+screenID+"/"; settings->setValue(DPrefix+"panels", PANELS.length()); for(int i=0; iSaveSettings(settings); @@ -48,7 +49,8 @@ void page_interface_panels::LoadSettings(int screennum){ loading = true; emit HasPendingChanges(false); emit ChangePageTitle( tr("Desktop Settings") ); - QString DPrefix = "desktop-"+QString::number(cscreen)+"/"; + QString screenID = QApplication::screens().at(cscreen)->name(); + QString DPrefix = "desktop-"+screenID+"/"; int panelnumber = settings->value(DPrefix+"panels",-1).toInt(); //First clean any current panels diff --git a/src-qt5/core/libLumina/LuminaUtils.cpp b/src-qt5/core/libLumina/LuminaUtils.cpp index db165cf2..9fc4e6b0 100644 --- a/src-qt5/core/libLumina/LuminaUtils.cpp +++ b/src-qt5/core/libLumina/LuminaUtils.cpp @@ -17,6 +17,7 @@ #include #include #include +#include #include #include @@ -897,50 +898,31 @@ bool LUtils::checkUserFiles(QString lastversion){ if(newversion || newrelease){ LUtils::upgradeFavorites(oldversion); } - //Convert any "userbutton" and "appmenu" panel plugins to the new "systemstart" plugin (0.8.7) - /*if(oldversion <= 8007 && (newversion || newrelease) && nversion < 8008){ - QSettings dset(QSettings::UserScope, "LuminaDE","desktopsettings"); - QStringList plugKeys = dset.allKeys().filter("panel").filter("/pluginlist"); - for(int i=0; i systemstart conversion - plugs = plugs.join(";;;;").replace("userbutton","systemstart").replace("appmenu","systemstart").split(";;;;"); - //Remove any system dashboard plugins - plugs.removeAll("systemdashboard"); - //Now save that back to the file - dset.setValue(plugKeys[i], plugs); - } - //Also remove any "desktopview" desktop plugin and enable the automatic desktop icons instead - plugKeys = dset.allKeys().filter("desktop-").filter("/pluginlist"); - for(int i=0; i screens = QApplication::screens(); + for(int i=0; i=0 && ok && num< screens.length()){ + //This one needs to be converted + DS[i] = "[desktop-"+screens[num]->name()+"]"; + } + }else if(DS[i].startsWith("[panel")){ + bool ok = false; + int num = DS[i].section("panel",-1).section(".",0,0).toInt(&ok); + if(num>=0 && ok && num< screens.length()){ + //This one needs to be converted + QString rest = DS[i].section(".",1,-1); //everything after the desktop number in the current setting + DS[i] = "[panel_"+screens[num]->name()+"."+rest; + } } } - dset.sync(); - //Due to the grid size change for desktop plugins, need to remove any old plugin geometries - if(QFile::exists(QDir::homePath()+"/.lumina/pluginsettings/desktopsettings.conf")){ - QFile::remove(QDir::homePath()+"/.lumina/pluginsettings/desktopsettings.conf"); - } - }*/ - - //Convert to the XDG autostart spec as necessary (Change occured with 0.8.5) - /*if(QFile::exists(QDir::homePath()+"/.lumina/startapps") ){ - QStringList cmds = LUtils::readFile(QDir::homePath()+"/.lumina/startapps"); - for(int i=0; i + #define DEBUG 0 LDesktop::LDesktop(int deskNum, bool setdefault) : QObject(){ - - DPREFIX = "desktop-"+QString::number(deskNum)+"/"; + QString screenID = QApplication::screens().at(deskNum)->name(); + DPREFIX = "desktop-"+screenID+"/"; desktopnumber = deskNum; desktop = QApplication::desktop(); defaultdesktop = setdefault; //(desktop->screenGeometry(desktopnumber).x()==0); diff --git a/src-qt5/core/lumina-desktop/LDesktopPluginSpace.h b/src-qt5/core/lumina-desktop/LDesktopPluginSpace.h index 92226680..44765029 100644 --- a/src-qt5/core/lumina-desktop/LDesktopPluginSpace.h +++ b/src-qt5/core/lumina-desktop/LDesktopPluginSpace.h @@ -183,6 +183,9 @@ private slots: } protected: + void paintEvent(QPaintEvent*){ + //do nothing here - the main plugin area should *always* be invisible + } //Need Drag and Drop functionality (internal movement) void dragEnterEvent(QDragEnterEvent *ev){ if(ev->mimeData()->hasFormat(MIMETYPE) ){ diff --git a/src-qt5/core/lumina-desktop/LPanel.cpp b/src-qt5/core/lumina-desktop/LPanel.cpp index bf063a31..b0abf498 100644 --- a/src-qt5/core/lumina-desktop/LPanel.cpp +++ b/src-qt5/core/lumina-desktop/LPanel.cpp @@ -6,6 +6,8 @@ //=========================================== #include "LPanel.h" #include "LSession.h" +#include + #include "panel-plugins/systemtray/LSysTray.h" #define DEBUG 0 @@ -26,7 +28,8 @@ LPanel::LPanel(QSettings *file, int scr, int num, QWidget *parent) : QWidget(){ screennum = scr; panelnum = num; //save for later screen = LSession::desktop(); - PPREFIX = "panel"+QString::number(screennum)+"."+QString::number(num)+"/"; + QString screenID = QApplication::screens().at(screennum)->name(); + PPREFIX = "panel_"+screenID+"."+QString::number(num)+"/"; defaultpanel = (LSession::handle()->screenGeom(screennum).x()==0 && num==0); horizontal=true; //use this by default initially hidden = false; //use this by default -- cgit