aboutsummaryrefslogtreecommitdiff
path: root/src-qt5/core-utils/lumina-config
diff options
context:
space:
mode:
authorKen Moore <ken@ixsystems.com>2016-11-15 09:19:23 -0500
committerKen Moore <ken@ixsystems.com>2016-11-15 09:19:23 -0500
commitd9ba230fbdae3ac7fa31bbaaf625d4fe258d04ab (patch)
tree0d1ebc0f7227449e712c6b86fb363a6653a042bc /src-qt5/core-utils/lumina-config
parentUpdate the default luminaDesktop.conf files to try and associate the archive ... (diff)
downloadlumina-d9ba230fbdae3ac7fa31bbaaf625d4fe258d04ab.tar.gz
lumina-d9ba230fbdae3ac7fa31bbaaf625d4fe258d04ab.tar.bz2
lumina-d9ba230fbdae3ac7fa31bbaaf625d4fe258d04ab.zip
Add knowledge of the new jsonmenu panel plugin to lumina-config.
Diffstat (limited to 'src-qt5/core-utils/lumina-config')
-rw-r--r--src-qt5/core-utils/lumina-config/LPlugins.cpp9
-rw-r--r--src-qt5/core-utils/lumina-config/PanelWidget.cpp36
2 files changed, 38 insertions, 7 deletions
diff --git a/src-qt5/core-utils/lumina-config/LPlugins.cpp b/src-qt5/core-utils/lumina-config/LPlugins.cpp
index 089a181c..dfd490e6 100644
--- a/src-qt5/core-utils/lumina-config/LPlugins.cpp
+++ b/src-qt5/core-utils/lumina-config/LPlugins.cpp
@@ -173,6 +173,13 @@ void LPlugins::LoadPanelPlugins(){
info.ID = "audioplayer";
info.icon = "media-playback-start";
PANEL.insert(info.ID, info);
+ //JSON Menu Scripts
+ info = LPI(); //clear it
+ info.name = QObject::tr("Menu Script");
+ info.description = QObject::tr("Run an external script to generate a user defined menu");
+ info.ID = "jsonmenu";
+ info.icon = "text-x-script";
+ PANEL.insert(info.ID, info);
}
// DESKTOP PLUGINS
@@ -293,7 +300,7 @@ void LPlugins::LoadMenuPlugins(){
info.ID = "app";
info.icon = "application-x-desktop";
MENU.insert(info.ID, info);
- //Custom Apps
+ //JSON Menu Scripts
info = LPI(); //clear it
info.name = QObject::tr("Menu Script");
info.description = QObject::tr("Run an external script to generate a user defined menu");
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"::::<exec to run>::::<name>::::<icon>
+ 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);
bgstack15