aboutsummaryrefslogtreecommitdiff
path: root/src-qt5/core-utils/lumina-config
diff options
context:
space:
mode:
Diffstat (limited to 'src-qt5/core-utils/lumina-config')
-rw-r--r--src-qt5/core-utils/lumina-config/pages/getPage.h11
-rw-r--r--src-qt5/core-utils/lumina-config/pages/page_interface_desktop.cpp151
-rw-r--r--src-qt5/core-utils/lumina-config/pages/page_interface_desktop.h42
-rw-r--r--src-qt5/core-utils/lumina-config/pages/page_sample.cpp5
-rw-r--r--src-qt5/core-utils/lumina-config/pages/pages.pri8
5 files changed, 212 insertions, 5 deletions
diff --git a/src-qt5/core-utils/lumina-config/pages/getPage.h b/src-qt5/core-utils/lumina-config/pages/getPage.h
index 6844a8e6..21830a5c 100644
--- a/src-qt5/core-utils/lumina-config/pages/getPage.h
+++ b/src-qt5/core-utils/lumina-config/pages/getPage.h
@@ -29,9 +29,12 @@ static QList<PAGEINFO> KnownPages(){
list << PageInfo("wallpaper", QObject::tr("Change Wallpaper"), QObject::tr("Wallpaper Settings"), "preferences-desktop-wallpaper",QObject::tr("Change background image(s)"), "appearance", QStringList(), QStringList() << "background" << "wallpaper" << "color" << "image");
list << PageInfo("theme", QObject::tr("Change Desktop Theme"), QObject::tr("Theme Settings"), "preferences-desktop-theme",QObject::tr("Change interface fonts and colors"), "appearance", QStringList(), QStringList() << "background" << "interface" << "color" << "theme" << "plugins");
list << PageInfo("autostart", QObject::tr("Startup Services and Applications"), QObject::tr("Startup Settings"), "preferences-system-session-services",QObject::tr("Automatically start applications or services"), "session", QStringList(), QStringList() << "apps" << "autostart" << "services" << "xdg" << "startup" << "session");
- list << PageInfo("defaultapps", QObject::tr("Default Applications for File Type"), QObject::tr("Mimetype Settings"), "preferences-desktop-filetype-association",QObject::tr("Change default applications"), "session", QStringList(), QStringList() << "apps" << "default" << "services" << "xdg" << "session");
+ list << PageInfo("defaultapps", QObject::tr("Default Applications for File Type"), QObject::tr("Mimetype Settings"), "preferences-desktop-default-applications",QObject::tr("Change default applications"), "session", QStringList(), QStringList() << "apps" << "default" << "services" << "xdg" << "session");
list << PageInfo("fluxbox-keys", QObject::tr("Keyboard Shortcuts"), QObject::tr("Keyboard Shortcuts"), "preferences-desktop-keyboard",QObject::tr("Change keyboard shortcuts"), "session", QStringList(), QStringList() << "apps" << "fluxbox" << "keys" << "keyboard" << "session" << "launch");
list << PageInfo("fluxbox-settings", QObject::tr("Window Manager"), QObject::tr("Window Settings"), "preferences-system-windows",QObject::tr("Change window settings and appearances"), "appearance", QStringList(), QStringList() << "window" << "frame" << "border" << "workspace" << "theme" << "fluxbox" << "session");
+ list << PageInfo("interface-desktop", QObject::tr("Desktop Icons and Plugins"), QObject::tr("Desktop Plugins"), "preferences-desktop-icons",QObject::tr("Change what icons or tools are embedded on the desktop"), "interface", QStringList(), QStringList() << "desktop" << "plugins" << "embed" << "icons" << "utilities");
+ list << PageInfo("interface-panel", QObject::tr("Floating Panels and Plugins"), QObject::tr("Panels and Plugins"), "configure-toolbars",QObject::tr("Change any floating panels and what they show"), "interface", QStringList(), QStringList() << "desktop" << "toolbar" << "panel" << "floating" << "plugins");
+ list << PageInfo("interface-menu", QObject::tr("Context Menu and Plugins"), QObject::tr("Menu Plugins"), "preferences-plugin",QObject::tr("Change what options are shown on the desktop context menu"), "interface", QStringList(), QStringList() << "desktop" << "menu" << "plugins" << "shortcuts");
return list;
}
@@ -43,6 +46,9 @@ static QList<PAGEINFO> KnownPages(){
#include "page_defaultapps.h"
#include "page_fluxbox_keys.h"
#include "page_fluxbox_settings.h"
+#include "page_interface_desktop.h"
+//#include "page_interface_panels.h"
+//#include "page_interface_menu.h"
static PageWidget* GetNewPage(QString id, QWidget *parent){
//Find the page that matches this "id"
@@ -52,6 +58,9 @@ static PageWidget* GetNewPage(QString id, QWidget *parent){
else if(id=="defaultapps"){ return new page_defaultapps(parent); }
else if(id=="fluxbox-keys"){ return new page_fluxbox_keys(parent); }
else if(id=="fluxbox-settings"){ return new page_fluxbox_settings(parent); }
+ else if(id=="interface-desktop"){ return new page_interface_desktop(parent); }
+// else if(id=="interface-panel"){ return new page_interface_panels(parent); }
+// else if(id=="interface-menu"){ return new page_interface_menu(parent); }
//Return the main control_panel page as the fallback/default
return new page_main(parent);
}
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
new file mode 100644
index 00000000..bd617464
--- /dev/null
+++ b/src-qt5/core-utils/lumina-config/pages/page_interface_desktop.cpp
@@ -0,0 +1,151 @@
+//===========================================
+// Lumina Desktop Source Code
+// Copyright (c) 2016, Ken Moore
+// Available under the 3-clause BSD license
+// See the LICENSE file for full details
+//===========================================
+#include "page_interface_desktop.h"
+#include "ui_page_interface_desktop.h"
+#include "getPage.h"
+#include "../GetPluginDialog.h"
+#include "../AppDialog.h"
+
+//==========
+// PUBLIC
+//==========
+page_interface_desktop::page_interface_desktop(QWidget *parent) : PageWidget(parent), ui(new Ui::page_interface_desktop()){
+ ui->setupUi(this);
+ PINFO = new LPlugins();
+ connect(ui->tool_desktop_addplugin, SIGNAL(clicked()), this, SLOT(deskplugadded()) );
+ connect(ui->tool_desktop_rmplugin, SIGNAL(clicked()), this, SLOT(deskplugremoved()) );
+ updateIcons();
+}
+
+page_interface_desktop::~page_interface_desktop(){
+ delete PINFO;
+}
+
+//================
+// PUBLIC SLOTS
+//================
+void page_interface_desktop::SaveSettings(){
+ QSettings settings("lumina-desktop","desktopsettings");
+ QString DPrefix = "desktop-"+QString::number(cscreen)+"/";
+
+ QStringList plugs;
+ for(int i=0; i<ui->list_desktop_plugins->count(); i++){
+ plugs << ui->list_desktop_plugins->item(i)->whatsThis();
+ }
+ if(settings.value(DPrefix+"pluginlist",QStringList()).toStringList() != plugs){
+ settings.setValue(DPrefix+"pluginlist", plugs);
+ }
+ //The plugin ID's will be changed to unique ID's by the desktop - reload in a moment
+ emit HasPendingChanges(false);
+ QTimer::singleShot(1000, this, SLOT(LoadSettings()) );
+}
+
+void page_interface_desktop::LoadSettings(int screennum){
+ if(screennum>=0){
+ cscreen = screennum;
+ }
+ emit HasPendingChanges(false);
+ emit ChangePageTitle( tr("Desktop Settings") );
+ QSettings settings("lumina-desktop","desktopsettings");
+ QString DPrefix = "desktop-"+QString::number(cscreen)+"/";
+
+ QStringList dplugs = settings.value(DPrefix+"pluginlist",QStringList()).toStringList();
+ ui->list_desktop_plugins->clear();
+ for(int i=0; i<dplugs.length(); i++){
+ QListWidgetItem* it = new QListWidgetItem();
+ it->setWhatsThis(dplugs[i]); //save the full thing instantly
+ //Now load the rest of the info about the plugin
+ QString num;
+ if(dplugs[i].contains("---")){
+ num = dplugs[i].section("---",1,1).section(".",1,1).simplified(); //Skip the screen number
+ if(num=="1"){ num.clear(); } //don't bother showing the number
+ dplugs[i] = dplugs[i].section("---",0,0);
+ }
+ if(dplugs[i].startsWith("applauncher::")){
+ bool ok = false;
+ XDGDesktop app = LXDG::loadDesktopFile(dplugs[i].section("::",1,50), ok);
+ if(!ok){ continue; } //invalid for some reason
+ //Now fill the item with the necessary info
+ it->setText(app.name);
+ it->setIcon(LXDG::findIcon(app.icon,"") );
+ it->setToolTip(app.comment);
+ }else{
+ //Load the info for this plugin
+ LPI info = PINFO->desktopPluginInfo(dplugs[i]);
+ if( info.ID.isEmpty() ){ continue; } //invalid plugin for some reason
+ it->setText(info.name);
+ it->setToolTip(info.description);
+ it->setIcon( LXDG::findIcon(info.icon,"") );
+ }
+ if(!num.isEmpty()){ it->setText( it->text()+" ("+num+")"); } //append the number
+ ui->list_desktop_plugins->addItem(it);
+ }
+}
+
+void page_interface_desktop::updateIcons(){
+ ui->tool_desktop_addplugin->setIcon( LXDG::findIcon("list-add","") );
+ ui->tool_desktop_rmplugin->setIcon( LXDG::findIcon("list-remove","") );
+}
+
+//=================
+// PRIVATE
+//=================
+XDGDesktop page_interface_desktop::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;
+ }
+ return desk;
+}
+
+//=================
+// PRIVATE SLOTS
+//=================
+void page_interface_desktop::deskplugadded(){
+ GetPluginDialog dlg(this);
+ dlg.LoadPlugins("desktop", PINFO);
+ dlg.exec();
+ if( !dlg.selected ){ return; } //cancelled
+ QString newplug = dlg.plugID;
+ QListWidgetItem *it = new QListWidgetItem();
+ if(newplug=="applauncher"){
+ //Prompt for the application to add
+ XDGDesktop app = getSysApp();
+ if(app.filePath.isEmpty()){ return; } //cancelled
+ newplug.append("::"+app.filePath);
+ //Now fill the item with the necessary info
+ it->setWhatsThis(newplug);
+ it->setText(app.name);
+ it->setIcon(LXDG::findIcon(app.icon,"") );
+ it->setToolTip(app.comment);
+ }else{
+ //Load the info for this plugin
+ LPI info = PINFO->desktopPluginInfo(newplug);
+ if( info.ID.isEmpty() ){ return; } //invalid plugin for some reason (should never happen)
+ it->setWhatsThis(newplug);
+ it->setText(info.name);
+ it->setToolTip(info.description);
+ it->setIcon( LXDG::findIcon(info.icon,"") );
+ }
+ ui->list_desktop_plugins->addItem(it);
+ ui->list_desktop_plugins->scrollToItem(it);
+ settingChanged();
+}
+
+void page_interface_desktop::deskplugremoved(){
+ QList<QListWidgetItem*> sel = ui->list_desktop_plugins->selectedItems();
+ if(sel.isEmpty()){ return; } //nothing to do
+ for(int i=0; i<sel.length(); i++){
+ delete sel[i];
+ }
+ settingChanged();
+}
diff --git a/src-qt5/core-utils/lumina-config/pages/page_interface_desktop.h b/src-qt5/core-utils/lumina-config/pages/page_interface_desktop.h
new file mode 100644
index 00000000..e212182a
--- /dev/null
+++ b/src-qt5/core-utils/lumina-config/pages/page_interface_desktop.h
@@ -0,0 +1,42 @@
+//===========================================
+// Lumina Desktop Source Code
+// Copyright (c) 2016, Ken Moore
+// Available under the 3-clause BSD license
+// See the LICENSE file for full details
+//===========================================
+#ifndef _LUMINA_CONFIG_PAGE_INTERFACE_DESKTOP_H
+#define _LUMINA_CONFIG_PAGE_INTERFACE_DESKTOP_H
+#include "../globals.h"
+#include "PageWidget.h"
+#include "../LPlugins.h"
+
+namespace Ui{
+ class page_interface_desktop;
+};
+
+class page_interface_desktop : public PageWidget{
+ Q_OBJECT
+public:
+ page_interface_desktop(QWidget *parent);
+ ~page_interface_desktop();
+
+ bool needsScreenSelector(){ return true; }
+
+public slots:
+ void SaveSettings();
+ void LoadSettings(int screennum = -1);
+ void updateIcons();
+
+private:
+ Ui::page_interface_desktop *ui;
+ int cscreen; //current monitor/screen number
+ LPlugins *PINFO;
+
+ //Get an application on the system
+ XDGDesktop getSysApp(bool allowreset = false);
+
+private slots:
+ void deskplugadded();
+ void deskplugremoved();
+};
+#endif
diff --git a/src-qt5/core-utils/lumina-config/pages/page_sample.cpp b/src-qt5/core-utils/lumina-config/pages/page_sample.cpp
index 32742873..0256df8d 100644
--- a/src-qt5/core-utils/lumina-config/pages/page_sample.cpp
+++ b/src-qt5/core-utils/lumina-config/pages/page_sample.cpp
@@ -14,6 +14,7 @@
page_sample::page_sample(QWidget *parent) : PageWidget(parent), ui(new Ui::page_sample()){
ui->setupUi(this);
+ updateIcons();
}
page_sample::~page_sample(){
@@ -39,5 +40,9 @@ void page_sample::updateIcons(){
}
//=================
+// PRIVATE
+//=================
+
+//=================
// PRIVATE SLOTS
//=================
diff --git a/src-qt5/core-utils/lumina-config/pages/pages.pri b/src-qt5/core-utils/lumina-config/pages/pages.pri
index 742063c8..8d2f1dec 100644
--- a/src-qt5/core-utils/lumina-config/pages/pages.pri
+++ b/src-qt5/core-utils/lumina-config/pages/pages.pri
@@ -7,8 +7,8 @@ HEADERS += $${PWD}/getPage.h \
$${PWD}/page_autostart.h \
$${PWD}/page_defaultapps.h \
$${PWD}/page_fluxbox_keys.h \
- $${PWD}/page_fluxbox_settings.h
-# $${PWD}/page_interface_desktop.h \
+ $${PWD}/page_fluxbox_settings.h \
+ $${PWD}/page_interface_desktop.h
# $${PWD}/page_interface_menu.h \
# $${PWD}/page_interface_panels.h \
# $${PWD}/page_session_locale.h \
@@ -21,8 +21,8 @@ SOURCES += $${PWD}/page_main.cpp \
$${PWD}/page_autostart.cpp \
$${PWD}/page_defaultapps.cpp \
$${PWD}/page_fluxbox_keys.cpp \
- $${PWD}/page_fluxbox_settings.cpp
-# $${PWD}/page_interface_desktop.cpp \
+ $${PWD}/page_fluxbox_settings.cpp \
+ $${PWD}/page_interface_desktop.cpp
# $${PWD}/page_interface_menu.cpp \
# $${PWD}/page_interface_panels.cpp \
# $${PWD}/page_session_locale.cpp \
bgstack15