diff options
Diffstat (limited to 'src-qt5/core-utils/lumina-config/pages')
-rw-r--r-- | src-qt5/core-utils/lumina-config/pages/page_interface_menu.cpp | 25 | ||||
-rw-r--r-- | src-qt5/core-utils/lumina-config/pages/page_main.cpp | 10 |
2 files changed, 29 insertions, 6 deletions
diff --git a/src-qt5/core-utils/lumina-config/pages/page_interface_menu.cpp b/src-qt5/core-utils/lumina-config/pages/page_interface_menu.cpp index 742c5728..d211d380 100644 --- a/src-qt5/core-utils/lumina-config/pages/page_interface_menu.cpp +++ b/src-qt5/core-utils/lumina-config/pages/page_interface_menu.cpp @@ -9,7 +9,7 @@ #include "getPage.h" #include "../AppDialog.h" #include "../GetPluginDialog.h" - +#include "../ScriptDialog.h" //========== // PUBLIC //========== @@ -52,7 +52,6 @@ QStringList items = settings.value("menu/itemlist", QStringList() ).toStringList //qDebug() << "Menu Items:" << items; ui->list_menu->clear(); for(int i=0; i<items.length(); i++){ - LPI info = PINFO->menuPluginInfo(items[i]); if(items[i].startsWith("app::::")){ bool ok = false; XDGDesktop desk = LXDG::loadDesktopFile(items[i].section("::::",1,1), ok); @@ -64,7 +63,20 @@ QStringList items = settings.value("menu/itemlist", QStringList() ).toStringList item->setToolTip( desk.comment ); ui->list_menu->addItem(item); continue; //now go to the next item + }else if(items[i].startsWith("jsonmenu::::")){ + LPI info = PINFO->menuPluginInfo( items[i].section("::::",0,0) ); + if(info.ID.isEmpty()){ continue; } //invalid plugin type (no longer available?) + QString exec = items[i].section("::::",1,1); + + QListWidgetItem *item = new QListWidgetItem(); + item->setWhatsThis( items[i] ); + item->setIcon( LXDG::findIcon(items[i].section("::::",3,3),info.icon) ); + item->setText( items[i].section("::::",2,2) +" ("+info.name+")" ); + item->setToolTip( info.description ); + ui->list_menu->addItem(item); + continue; //now go to the next item } + LPI info = PINFO->menuPluginInfo(items[i]); if(info.ID.isEmpty()){ continue; } //invalid plugin //qDebug() << "Add Menu Item:" << info.ID; QListWidgetItem *item = new QListWidgetItem(); @@ -121,6 +133,15 @@ void page_interface_menu::addmenuplugin(){ it = new QListWidgetItem(LXDG::findIcon(desk.icon,""), desk.name ); it->setWhatsThis(info.ID+"::::"+desk.filePath); it->setToolTip( desk.comment ); + }else if(info.ID=="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; } + 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{ it = new QListWidgetItem( LXDG::findIcon(info.icon,""), info.name ); it->setWhatsThis(info.ID); diff --git a/src-qt5/core-utils/lumina-config/pages/page_main.cpp b/src-qt5/core-utils/lumina-config/pages/page_main.cpp index ec03f8a5..976e7c69 100644 --- a/src-qt5/core-utils/lumina-config/pages/page_main.cpp +++ b/src-qt5/core-utils/lumina-config/pages/page_main.cpp @@ -14,6 +14,7 @@ page_main::page_main(QWidget *parent) : PageWidget(parent), ui(new Ui::page_main()){ ui->setupUi(this); ui->treeWidget->setMouseTracking(true); + ui->treeWidget->setSortingEnabled(false); //the QTreeView sort flag always puts them in backwards (reverse-alphabetical) connect(ui->treeWidget, SIGNAL(itemActivated(QTreeWidgetItem*,int)), this, SLOT(itemTriggered(QTreeWidgetItem*)) ); connect(ui->treeWidget, SIGNAL(itemClicked(QTreeWidgetItem*,int)), this, SLOT(itemTriggered(QTreeWidgetItem*)) ); connect(ui->lineEdit, SIGNAL(textChanged(QString)), this, SLOT(searchChanged(QString)) ); @@ -65,10 +66,11 @@ void page_main::UpdateItems(QString search){ else{ ui->treeWidget->addTopLevelItem(it); } } //Now add the categories to the tree widget if they are non-empty - if(interface->childCount()>0){ ui->treeWidget->addTopLevelItem(interface); interface->setExpanded(true); } - if(appearance->childCount()>0){ ui->treeWidget->addTopLevelItem(appearance); appearance->setExpanded(true); } - if(session->childCount()>0){ ui->treeWidget->addTopLevelItem(session); session->setExpanded(true); } - if(user->childCount()>0){ ui->treeWidget->addTopLevelItem(user); user->setExpanded(true); } + if(interface->childCount()>0){ ui->treeWidget->addTopLevelItem(interface); interface->setExpanded(!search.isEmpty()); } + if(appearance->childCount()>0){ ui->treeWidget->addTopLevelItem(appearance); appearance->setExpanded(!search.isEmpty()); } + if(session->childCount()>0){ ui->treeWidget->addTopLevelItem(session); session->setExpanded(!search.isEmpty()); } + if(user->childCount()>0){ ui->treeWidget->addTopLevelItem(user); user->setExpanded(!search.isEmpty()); } + ui->treeWidget->sortItems(0, Qt::AscendingOrder); } //================ |