aboutsummaryrefslogtreecommitdiff
path: root/src-qt5
diff options
context:
space:
mode:
authorKen Moore <ken@ixsystems.com>2016-12-19 15:09:48 -0500
committerKen Moore <ken@ixsystems.com>2016-12-19 15:09:48 -0500
commitf9ba222506bf456100523250df384251f6d60c07 (patch)
tree5540188c21526d6ee74e9afbff2a448bfc2503c1 /src-qt5
parentCommit another small fix for the mimetype systems. (diff)
downloadlumina-f9ba222506bf456100523250df384251f6d60c07.tar.gz
lumina-f9ba222506bf456100523250df384251f6d60c07.tar.bz2
lumina-f9ba222506bf456100523250df384251f6d60c07.zip
Update the Interface/Panels page quite a bit:
1) Add a new "profiles" button/menu so the user can apply pre-defined profiles for the interface which correspond to other common system interfaces. 2) Add a new "import" button/menu so the user can quickly move settings from one monitor (even if not current attached/used) to another active monitor. This is very useful if the user changes video cards/drivers or monitors and gets a different monitor ID on their next session, but want to re-use their previous monitor settings.
Diffstat (limited to 'src-qt5')
-rw-r--r--src-qt5/core-utils/lumina-config/pages/page_interface_panels.cpp150
-rw-r--r--src-qt5/core-utils/lumina-config/pages/page_interface_panels.h6
-rw-r--r--src-qt5/core-utils/lumina-config/pages/page_interface_panels.ui45
3 files changed, 186 insertions, 15 deletions
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 7d0d3d8c..827061af 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
@@ -20,6 +20,7 @@ page_interface_panels::page_interface_panels(QWidget *parent) : PageWidget(paren
settings = new QSettings("lumina-desktop","desktopsettings");
connect(ui->tool_panels_add, SIGNAL(clicked()), this, SLOT(newPanel()) );
updateIcons();
+ setupProfiles();
}
page_interface_panels::~page_interface_panels(){
@@ -77,27 +78,54 @@ void page_interface_panels::LoadSettings(int screennum){
QApplication::processEvents();
loading = false;
+ setupImports();
}
void page_interface_panels::updateIcons(){
ui->tool_panels_add->setIcon( LXDG::findIcon("list-add","") );
+ ui->tool_profile->setIcon( LXDG::findIcon("view-media-artist","") );
+ ui->tool_import->setIcon( LXDG::findIcon("document-import","") );
}
//=================
// PRIVATE
//=================
-/*XDGDesktop page_interface_panels::getSysApp(bool allowreset){
- AppDialog dlg(this, LXDG::sortDesktopNames( LXDG::systemDesktopFiles() ) );
- dlg.allowReset(allowreset);
- dlg.exec();
- XDGDesktop desk;
- if(dlg.appreset && allowreset){
- desk.filePath = "reset"; //special internal flag
- }else{
- desk = dlg.appselected;
+void page_interface_panels::setupProfiles(){
+ ui->tool_profile->setMenu( new QMenu(this) );
+ QAction *act = ui->tool_profile->menu()->addAction("No Panels");
+ act->setWhatsThis("none");
+ act = ui->tool_profile->menu()->addAction("Windows");
+ act->setWhatsThis("windows");
+ act = ui->tool_profile->menu()->addAction("GNOME2/MATE");
+ act->setWhatsThis("gnome2");
+ act = ui->tool_profile->menu()->addAction("XFCE");
+ act->setWhatsThis("xfce");
+ act = ui->tool_profile->menu()->addAction("Mac OSX");
+ act->setWhatsThis("osx");
+
+ connect(ui->tool_profile->menu(), SIGNAL(triggered(QAction*)), this, SLOT(applyProfile(QAction*)) );
+}
+
+void page_interface_panels::setupImports(){
+ if(ui->tool_import->menu()==0){ ui->tool_import->setMenu( new QMenu(this) ); }
+ else{ ui->tool_import->menu()->clear(); }
+ //Read all the various disk settings currently saved
+ QStringList other = settings->childGroups().filter("panel_");
+ qDebug() << "Found Other Settings:" << other;
+ for(int i=0; i<other.length(); i++){
+ other[i] = other[i].section("_",1,-1).section(".",0,-2);
+ }
+ other.removeDuplicates();
+ QString current = QApplication::screens().at(cscreen)->name();
+ for(int i=0; i<other.length(); i++){
+ if(other[i]==current){ continue; } //don't show the current settings
+ QAction *act = ui->tool_import->menu()->addAction(other[i]);
+ act->setWhatsThis(other[i]);
}
- return desk;
-}*/
+
+ connect(ui->tool_import->menu(), SIGNAL(triggered(QAction*)), this, SLOT(applyImport(QAction*)) );
+ ui->tool_import->setEnabled(!ui->tool_import->menu()->isEmpty());
+}
//=================
// PRIVATE SLOTS
@@ -142,3 +170,103 @@ void page_interface_panels::removePanel(int pan){
if(!changed){ return; } //nothing done
panelValChanged();
}
+
+void page_interface_panels::applyProfile(QAction *act){
+ QString screenID = QApplication::screens().at(cscreen)->name();
+ QString DPrefix = "desktop-"+screenID+"/";
+ QString PPrefix = "panel_"+screenID+"."; //NEED TO APPEND PANEL NUMBER (0+)
+ qDebug() << "Apply Profile:" << act->whatsThis() << "To Monitor:" << screenID;
+ if(act->whatsThis()=="none"){
+ settings->setValue(DPrefix+"panels", 0); //number of panels
+ }else if(act->whatsThis()=="windows"){
+ settings->setValue(DPrefix+"panels", 1); //number of panels
+ //Panel 1 settings (index 0)
+ settings->setValue(PPrefix+"0/customColor", false);
+ settings->setValue(PPrefix+"0/height", qRound(QApplication::screens().at(cscreen)->virtualSize().height()*0.04)); //4% of screen height
+ settings->setValue(PPrefix+"0/hidepanel", false);
+ settings->setValue(PPrefix+"0/lengthPercent", 100);
+ settings->setValue(PPrefix+"0/location", "bottom");
+ settings->setValue(PPrefix+"0/pinLocation", "center");
+ settings->setValue(PPrefix+"0/pluginlist", QStringList() << "systemstart" << "taskmanager" << "spacer" << "systemtray" << "clock");
+ }else if(act->whatsThis()=="gnome2"){
+ settings->setValue(DPrefix+"panels", 2); //number of panels
+ //Panel 1 settings (index 0)
+ settings->setValue(PPrefix+"0/customColor", false);
+ settings->setValue(PPrefix+"0/height", qRound(QApplication::screens().at(cscreen)->virtualSize().height()*0.02)); //2% of screen height
+ settings->setValue(PPrefix+"0/hidepanel", false);
+ settings->setValue(PPrefix+"0/lengthPercent", 100);
+ settings->setValue(PPrefix+"0/location", "top");
+ settings->setValue(PPrefix+"0/pinLocation", "center");
+ settings->setValue(PPrefix+"0/pluginlist", QStringList() << "appmenu" << "desktopbar" << "spacer" << "systemtray" << "clock" << "systemdashboard");
+ //Panel 2 settings (index 1)
+ settings->setValue(PPrefix+"1/customColor", false);
+ settings->setValue(PPrefix+"1/height", qRound(QApplication::screens().at(cscreen)->virtualSize().height()*0.02)); //2% of screen height
+ settings->setValue(PPrefix+"1/hidepanel", false);
+ settings->setValue(PPrefix+"1/lengthPercent", 100);
+ settings->setValue(PPrefix+"1/location", "bottom");
+ settings->setValue(PPrefix+"1/pinLocation", "center");
+ settings->setValue(PPrefix+"1/pluginlist", QStringList() << "homebutton" << "taskmanager-nogroups" << "spacer" << "desktopswitcher");
+}else if(act->whatsThis()=="xfce"){
+ settings->setValue(DPrefix+"panels", 2); //number of panels
+ //Panel 1 settings (index 0)
+ settings->setValue(PPrefix+"0/customColor", false);
+ settings->setValue(PPrefix+"0/height", qRound(QApplication::screens().at(cscreen)->virtualSize().height()*0.02)); //2% of screen height
+ settings->setValue(PPrefix+"0/hidepanel", false);
+ settings->setValue(PPrefix+"0/lengthPercent", 100);
+ settings->setValue(PPrefix+"0/location", "top");
+ settings->setValue(PPrefix+"0/pinLocation", "center");
+ settings->setValue(PPrefix+"0/pluginlist", QStringList() << "appmenu" << "taskmanager-nogroups" << "spacer" << "desktopswitcher" << "clock" << "systemtray" << "systemdashboard");
+ //Panel 2 settings (index 1)
+ settings->setValue(PPrefix+"1/customColor", false);
+ settings->setValue(PPrefix+"1/height", qRound(QApplication::screens().at(cscreen)->virtualSize().height()*0.04)); //4% of screen height
+ settings->setValue(PPrefix+"1/hidepanel", false);
+ settings->setValue(PPrefix+"1/lengthPercent", 20);
+ settings->setValue(PPrefix+"1/location", "bottom");
+ settings->setValue(PPrefix+"1/pinLocation", "center");
+ settings->setValue(PPrefix+"1/pluginlist", QStringList() << "applauncher::lumina-fm.desktop" << "line"<<"spacer" << "desktopbar" << "spacer" << "line" << "applauncher::lumina-search.desktop");
+}else if(act->whatsThis()=="osx"){
+ settings->setValue(DPrefix+"panels", 2); //number of panels
+ //Panel 1 settings (index 0)
+ settings->setValue(PPrefix+"0/customColor", false);
+ settings->setValue(PPrefix+"0/height", qRound(QApplication::screens().at(cscreen)->virtualSize().height()*0.02)); //2% of screen height
+ settings->setValue(PPrefix+"0/hidepanel", false);
+ settings->setValue(PPrefix+"0/lengthPercent", 100);
+ settings->setValue(PPrefix+"0/location", "top");
+ settings->setValue(PPrefix+"0/pinLocation", "center");
+ settings->setValue(PPrefix+"0/pluginlist", QStringList() << "systemdashboard" << "spacer" << "systemtray" << "clock" << "applauncher::lumina-search.desktop");
+ //Panel 2 settings (index 1)
+ settings->setValue(PPrefix+"1/customColor", false);
+ settings->setValue(PPrefix+"1/height", qRound(QApplication::screens().at(cscreen)->virtualSize().height()*0.04)); //4% of screen height
+ settings->setValue(PPrefix+"1/hidepanel", false);
+ settings->setValue(PPrefix+"1/lengthPercent", 80);
+ settings->setValue(PPrefix+"1/location", "bottom");
+ settings->setValue(PPrefix+"1/pinLocation", "center");
+ settings->setValue(PPrefix+"1/pluginlist", QStringList() << "systemstart" << "applauncher::lumina-fm.desktop" << "desktopbar"<<"spacer" << "line"<< "taskmanager");
+
+ }else{
+ qDebug() << " - unknown profile! ("+act->whatsThis()+")";
+ return;
+ }
+ //Now flush the settings to disk and reload the interface
+ settings->sync(); //save to disk right now
+ QTimer::singleShot(1000, this, SLOT(LoadSettings()) );
+}
+
+void page_interface_panels::applyImport(QAction *act){
+ QString cID = QApplication::screens().at(cscreen)->name();
+ QString fromID = act->whatsThis();
+ //QString DPrefix = "desktop-"+screenID+"/";
+ qDebug() << "Import Panels from " << fromID << " to " << cID;
+ //First change the number of panels on the desktop settings
+ settings->setValue("desktop-"+cID+"/panels", settings->value("desktop-"+fromID+"/panels"));
+ //Now move over all the panels associated with the fromID
+ QStringList pans = settings->allKeys().filter("panel_"+fromID);
+ for(int i=0; i<pans.length(); i++){
+ QString newvar = pans[i];
+ newvar.replace(fromID, cID);
+ settings->setValue(newvar, settings->value(pans[i]) );
+ }
+ //Now flush the settings to disk and reload the interface
+ settings->sync(); //save to disk right now
+ QTimer::singleShot(1000, this, SLOT(LoadSettings()) );
+}
diff --git a/src-qt5/core-utils/lumina-config/pages/page_interface_panels.h b/src-qt5/core-utils/lumina-config/pages/page_interface_panels.h
index 2c7eda7a..0008b75f 100644
--- a/src-qt5/core-utils/lumina-config/pages/page_interface_panels.h
+++ b/src-qt5/core-utils/lumina-config/pages/page_interface_panels.h
@@ -36,12 +36,14 @@ private:
LPlugins *PINFO;
QList<PanelWidget*> PANELS;
- //Get an application on the system
- //XDGDesktop getSysApp(bool allowreset = false);
+ void setupProfiles();
+ void setupImports();
private slots:
void panelValChanged();
void newPanel();
void removePanel(int); //connected to a signal from the panel widget
+ void applyProfile(QAction*);
+ void applyImport(QAction*);
};
#endif
diff --git a/src-qt5/core-utils/lumina-config/pages/page_interface_panels.ui b/src-qt5/core-utils/lumina-config/pages/page_interface_panels.ui
index a541a322..d65eb92c 100644
--- a/src-qt5/core-utils/lumina-config/pages/page_interface_panels.ui
+++ b/src-qt5/core-utils/lumina-config/pages/page_interface_panels.ui
@@ -30,8 +30,17 @@
<layout class="QVBoxLayout" name="verticalLayout_5">
<item>
<widget class="QToolButton" name="tool_panels_add">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
<property name="text">
- <string notr="true">add</string>
+ <string notr="true">Panel</string>
+ </property>
+ <property name="toolButtonStyle">
+ <enum>Qt::ToolButtonTextUnderIcon</enum>
</property>
</widget>
</item>
@@ -48,6 +57,38 @@
</property>
</spacer>
</item>
+ <item>
+ <widget class="QToolButton" name="tool_profile">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Profile</string>
+ </property>
+ <property name="popupMode">
+ <enum>QToolButton::InstantPopup</enum>
+ </property>
+ <property name="toolButtonStyle">
+ <enum>Qt::ToolButtonTextUnderIcon</enum>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QToolButton" name="tool_import">
+ <property name="text">
+ <string>Import</string>
+ </property>
+ <property name="popupMode">
+ <enum>QToolButton::InstantPopup</enum>
+ </property>
+ <property name="toolButtonStyle">
+ <enum>Qt::ToolButtonTextUnderIcon</enum>
+ </property>
+ </widget>
+ </item>
</layout>
</item>
<item>
@@ -66,7 +107,7 @@
<rect>
<x>0</x>
<y>0</y>
- <width>353</width>
+ <width>336</width>
<height>298</height>
</rect>
</property>
bgstack15