From 82ebebfb8a5867b400c1df726a478bdcb9d7c005 Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Thu, 22 Sep 2016 16:41:42 -0400 Subject: Large update to how XDGDesktop files are created/used. This impacts almost all tools/utilities within Lumina - please test (passed internal tests so far). This cleans up a lot of the backend XDG compliance class, moving lots of functionality into child functions of the XDGDesktop class and ensuring that they get cleaned up more regularly/properly. This *seems* to make the desktop startup a lot faster, even if the overall memory savings are slight (so far). --- src-qt5/core-utils/lumina-config/PanelWidget.cpp | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) (limited to 'src-qt5/core-utils/lumina-config/PanelWidget.cpp') diff --git a/src-qt5/core-utils/lumina-config/PanelWidget.cpp b/src-qt5/core-utils/lumina-config/PanelWidget.cpp index 7132dcf8..8b38f407 100644 --- a/src-qt5/core-utils/lumina-config/PanelWidget.cpp +++ b/src-qt5/core-utils/lumina-config/PanelWidget.cpp @@ -59,9 +59,8 @@ void PanelWidget::LoadSettings(QSettings *settings, int Dnum, int Pnum){ for(int i=0; isetWhatsThis(plugs[i]); //make sure to preserve the entire plugin ID (is the unique version) ui->list_plugins->addItem(it); @@ -121,17 +120,15 @@ void PanelWidget::reloadColorSample(){ ui->label_color_sample->setStyleSheet("background: "+ui->label_color_sample->whatsThis()); } -XDGDesktop PanelWidget::getSysApp(bool allowreset){ - AppDialog dlg(this, LXDG::sortDesktopNames( LXDG::systemDesktopFiles() ) ); +QString PanelWidget::getSysApp(bool allowreset){ + AppDialog dlg(this); dlg.allowReset(allowreset); dlg.exec(); - XDGDesktop desk; if(dlg.appreset && allowreset){ - desk.filePath = "reset"; //special internal flag + return "reset"; }else{ - desk = dlg.appselected; + return dlg.appselected; } - return desk; } QString PanelWidget::getColorStyle(QString current, bool allowTransparency){ @@ -183,10 +180,11 @@ void PanelWidget::on_tool_addplugin_clicked(){ QString pan = dlg.plugID; //getNewPanelPlugin(); if(pan == "applauncher"){ //Prompt for the application to add - XDGDesktop app =getSysApp(); - if(app.filePath.isEmpty()){ return; } //cancelled - pan.append("::"+app.filePath); - QListWidgetItem *it = new QListWidgetItem( LXDG::findIcon(app.icon,""), app.name); + QString app =getSysApp(); + if(app.isEmpty()){ return; } //cancelled + pan.append("::"+app); + XDGDesktop desk(app); + QListWidgetItem *it = new QListWidgetItem( LXDG::findIcon(desk.icon,""), desk.name); it->setWhatsThis(pan); ui->list_plugins->addItem(it); ui->list_plugins->setCurrentItem(it); -- cgit 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 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src-qt5/core-utils/lumina-config/PanelWidget.cpp') 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() ); -- cgit From d9ba230fbdae3ac7fa31bbaaf625d4fe258d04ab Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Tue, 15 Nov 2016 09:19:23 -0500 Subject: Add knowledge of the new jsonmenu panel plugin to lumina-config. --- src-qt5/core-utils/lumina-config/PanelWidget.cpp | 36 ++++++++++++++++++++---- 1 file changed, 30 insertions(+), 6 deletions(-) (limited to 'src-qt5/core-utils/lumina-config/PanelWidget.cpp') diff --git a/src-qt5/core-utils/lumina-config/PanelWidget.cpp b/src-qt5/core-utils/lumina-config/PanelWidget.cpp index aff7bda3..d5d3d9bd 100644 --- a/src-qt5/core-utils/lumina-config/PanelWidget.cpp +++ b/src-qt5/core-utils/lumina-config/PanelWidget.cpp @@ -9,7 +9,7 @@ #include "GetPluginDialog.h" #include "AppDialog.h" - +#include "ScriptDialog.h" PanelWidget::PanelWidget(QWidget *parent, QWidget *Main, LPlugins *Pinfo) : QWidget(parent), ui(new Ui::PanelWidget){ ui->setupUi(this); @@ -66,6 +66,18 @@ void PanelWidget::LoadSettings(QSettings *settings, int Dnum, int Pnum){ it->setWhatsThis(plugs[i]); //make sure to preserve the entire plugin ID (is the unique version) ui->list_plugins->addItem(it); } + + }else if(pid.startsWith("jsonmenu")){ + LPI info = PINFO->panelPluginInfo( plugs[i].section("::::",0,0) ); + if(info.ID.isEmpty()){ continue; } //invalid plugin type (no longer available?) + QString exec = plugs[i].section("::::",1,1); + QListWidgetItem *item = new QListWidgetItem(); + item->setWhatsThis( plugs[i] ); + item->setIcon( LXDG::findIcon(plugs[i].section("::::",3,3),info.icon) ); + item->setText( plugs[i].section("::::",2,2) +" ("+info.name+")" ); + item->setToolTip( info.description ); + ui->list_plugins->addItem(item); + }else{ LPI info = PINFO->panelPluginInfo(pid); if(!info.ID.isEmpty()){ @@ -180,23 +192,35 @@ void PanelWidget::on_tool_addplugin_clicked(){ dlg.exec(); if(!dlg.selected){ return; } //cancelled QString pan = dlg.plugID; //getNewPanelPlugin(); + QListWidgetItem *it = 0; if(pan == "applauncher"){ //Prompt for the application to add QString app =getSysApp(); if(app.isEmpty()){ return; } //cancelled pan.append("::"+app); XDGDesktop desk(app); - QListWidgetItem *it = new QListWidgetItem( LXDG::findIcon(desk.icon,""), desk.name); + it = new QListWidgetItem( LXDG::findIcon(desk.icon,""), desk.name); it->setWhatsThis(pan); - ui->list_plugins->addItem(it); - ui->list_plugins->setCurrentItem(it); - ui->list_plugins->scrollToItem(it); + + }else if(pan=="jsonmenu"){ + //Need to prompt for the script file, name, and icon to use + //new ID format: "jsonmenu":::::::::::: + ScriptDialog SD(this); + SD.exec(); + if(!SD.isValid()){ return; } + LPI info = PINFO->panelPluginInfo(pan); + it = new QListWidgetItem( LXDG::findIcon(SD.icon(),"text-x-script"), SD.name()+" ("+info.ID+")" ); + it->setWhatsThis(info.ID+"::::"+SD.command()+"::::"+SD.name()+"::::"+SD.icon()); + it->setToolTip( info.description ); }else{ if(pan.isEmpty()){ return; } //nothing selected //Add the new plugin to the list LPI info = PINFO->panelPluginInfo(pan); - QListWidgetItem *it = new QListWidgetItem( LXDG::findIcon(info.icon,""), info.name); + it = new QListWidgetItem( LXDG::findIcon(info.icon,""), info.name); it->setWhatsThis(info.ID); + } + //Now add the new item to the list + if(it!=0){ ui->list_plugins->addItem(it); ui->list_plugins->setCurrentItem(it); ui->list_plugins->scrollToItem(it); -- cgit