aboutsummaryrefslogtreecommitdiff
path: root/src-qt5/core-utils/lumina-config/GetPluginDialog.cpp
diff options
context:
space:
mode:
authorKen Moore <moorekou@gmail.com>2016-04-25 13:08:12 -0400
committerKen Moore <moorekou@gmail.com>2016-04-25 13:08:12 -0400
commited5ecf7ea7a482b4649e66ecb35fbc60af680684 (patch)
treeacc0fa17d228259e847f55c678db9fb0a9b50f0c /src-qt5/core-utils/lumina-config/GetPluginDialog.cpp
parentMerge branch 'master' of github.com:pcbsd/lumina (diff)
downloadlumina-ed5ecf7ea7a482b4649e66ecb35fbc60af680684.tar.gz
lumina-ed5ecf7ea7a482b4649e66ecb35fbc60af680684.tar.bz2
lumina-ed5ecf7ea7a482b4649e66ecb35fbc60af680684.zip
Rearrange the Lumina source tree quite a bit:
Now the utilites are arranged by category (core, core-utils, desktop-utils), so all the -utils may be excluded by a package system (or turned into separate packages) as needed.
Diffstat (limited to 'src-qt5/core-utils/lumina-config/GetPluginDialog.cpp')
-rw-r--r--src-qt5/core-utils/lumina-config/GetPluginDialog.cpp77
1 files changed, 77 insertions, 0 deletions
diff --git a/src-qt5/core-utils/lumina-config/GetPluginDialog.cpp b/src-qt5/core-utils/lumina-config/GetPluginDialog.cpp
new file mode 100644
index 00000000..08359e2d
--- /dev/null
+++ b/src-qt5/core-utils/lumina-config/GetPluginDialog.cpp
@@ -0,0 +1,77 @@
+//===========================================
+// Lumina-DE source code
+// Copyright (c) 2015, Ken Moore
+// Available under the 3-clause BSD license
+// See the LICENSE file for full details
+//===========================================
+#include "GetPluginDialog.h"
+#include "ui_GetPluginDialog.h"
+
+#include <LuminaXDG.h>
+
+GetPluginDialog::GetPluginDialog(QWidget *parent) : QDialog(parent), ui(new Ui::GetPluginDialog()){
+ ui->setupUi(this);
+ selected = false; //nothing selected by default
+ //Now center the window on the parent
+ QPoint cen = parent->geometry().center();
+ this->move( cen.x() - (this->width()/2) , cen.y() - (this->height()/2) );
+ //Load the icons
+ ui->push_cancel->setIcon( LXDG::findIcon("dialog-cancel","") );
+ ui->push_accept->setIcon( LXDG::findIcon("dialog-ok","") );
+ this->setWindowIcon( LXDG::findIcon("preferences-plugin") );
+ //Connect the signals/slots
+ connect(ui->combo_list, SIGNAL(currentIndexChanged(int)), this, SLOT(pluginchanged()) );
+ connect(ui->push_cancel, SIGNAL(clicked()), this, SLOT(close()) );
+ connect(ui->push_accept, SIGNAL(clicked()), this, SLOT(accept()) );
+}
+
+GetPluginDialog::~GetPluginDialog(){
+
+}
+
+void GetPluginDialog::LoadPlugins(QString type, LPlugins *DB){
+ //Special data format: <Visible Name>::::<ID>::::<icon>::::<description>
+ QStringList data;
+ if(type.toLower()=="menu"){
+ QStringList plugs = DB->menuPlugins();
+ for(int i=0; i<plugs.length(); i++){
+ LPI dat = DB->menuPluginInfo(plugs[i]);
+ data << dat.name+"::::"+dat.ID+"::::"+dat.icon+"::::"+dat.description;
+ }
+ }else if(type.toLower()=="desktop"){
+ QStringList plugs = DB->desktopPlugins();
+ for(int i=0; i<plugs.length(); i++){
+ LPI dat = DB->desktopPluginInfo(plugs[i]);
+ data << dat.name+"::::"+dat.ID+"::::"+dat.icon+"::::"+dat.description;
+ }
+ }else if(type.toLower()=="panel"){
+ QStringList plugs = DB->panelPlugins();
+ for(int i=0; i<plugs.length(); i++){
+ LPI dat = DB->panelPluginInfo(plugs[i]);
+ data << dat.name+"::::"+dat.ID+"::::"+dat.icon+"::::"+dat.description;
+ }
+ }
+ data.sort(); //this will sort them according to visible name
+ ui->combo_list->clear();
+ for(int i=0; i<data.length(); i++){
+ ui->combo_list->addItem( LXDG::findIcon(data[i].section("::::",2,2),""), data[i].section("::::",0,0) , data[i]);
+ }
+ if(!data.isEmpty()){
+ ui->combo_list->setCurrentIndex(0);
+ }
+}
+
+void GetPluginDialog::pluginchanged(){
+ //Load the description of the currently selected plugin
+ if(ui->combo_list->count() < 1){ ui->label_desc->clear(); }
+ else{
+ ui->label_desc->setText( ui->combo_list->currentData().toString().section("::::",3,50) );
+ }
+ ui->push_accept->setEnabled(ui->combo_list->currentIndex()>=0);
+}
+
+void GetPluginDialog::accept(){
+ plugID = ui->combo_list->currentData().toString().section("::::",1,1);
+ selected = true;
+ this->close();
+} \ No newline at end of file
bgstack15