aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lumina-config/ColorDialog.cpp3
-rw-r--r--lumina-config/GetPluginDialog.cpp76
-rw-r--r--lumina-config/GetPluginDialog.h38
-rw-r--r--lumina-config/GetPluginDialog.ui87
-rw-r--r--lumina-config/ThemeDialog.cpp4
-rw-r--r--lumina-config/lumina-config.pro9
-rw-r--r--lumina-config/mainUI.cpp28
-rw-r--r--lumina-config/mainUI.h9
8 files changed, 242 insertions, 12 deletions
diff --git a/lumina-config/ColorDialog.cpp b/lumina-config/ColorDialog.cpp
index 23a44633..f984cf0d 100644
--- a/lumina-config/ColorDialog.cpp
+++ b/lumina-config/ColorDialog.cpp
@@ -26,6 +26,9 @@ ColorDialog::ColorDialog(QWidget *parent, LPlugins *plugs, QString colorFilePath
}
//Now load the given file
loadColors();
+ //Now center the window on the parent
+ QPoint cen = parent->geometry().center();
+ this->move( cen.x() - (this->width()/2) , cen.y() - (this->height()/2) );
}
void ColorDialog::loadColors(){
diff --git a/lumina-config/GetPluginDialog.cpp b/lumina-config/GetPluginDialog.cpp
new file mode 100644
index 00000000..f0386e82
--- /dev/null
+++ b/lumina-config/GetPluginDialog.cpp
@@ -0,0 +1,76 @@
+//===========================================
+// 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","") );
+ //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
diff --git a/lumina-config/GetPluginDialog.h b/lumina-config/GetPluginDialog.h
new file mode 100644
index 00000000..b728edb3
--- /dev/null
+++ b/lumina-config/GetPluginDialog.h
@@ -0,0 +1,38 @@
+//===========================================
+// Lumina-DE source code
+// Copyright (c) 2015, Ken Moore
+// Available under the 3-clause BSD license
+// See the LICENSE file for full details
+//===========================================
+#ifndef _LUMINA_CONFIG_GET_PLUGIN_DIALOG_H
+#define _LUMINA_CONFIG_GET_PLUGIN_DIALOG_H
+
+#include <QDialog>
+
+#include "LPlugins.h"
+
+namespace Ui{
+ class GetPluginDialog;
+};
+
+class GetPluginDialog : public QDialog{
+ Q_OBJECT
+public:
+ GetPluginDialog(QWidget* parent = 0);
+ ~GetPluginDialog();
+
+ void LoadPlugins(QString type, LPlugins *DB);
+
+ bool selected; //this is set to true if a plugin was selected by the user
+ QString plugID; //this is set to the ID of the selected plugin
+
+private:
+ Ui::GetPluginDialog *ui;
+
+private slots:
+ void pluginchanged();
+ void accept();
+
+};
+
+#endif \ No newline at end of file
diff --git a/lumina-config/GetPluginDialog.ui b/lumina-config/GetPluginDialog.ui
new file mode 100644
index 00000000..8c661d63
--- /dev/null
+++ b/lumina-config/GetPluginDialog.ui
@@ -0,0 +1,87 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>GetPluginDialog</class>
+ <widget class="QDialog" name="GetPluginDialog">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>248</width>
+ <height>178</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>Select Plugin</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
+ <widget class="QLabel" name="label">
+ <property name="font">
+ <font>
+ <weight>75</weight>
+ <bold>true</bold>
+ </font>
+ </property>
+ <property name="text">
+ <string>Select a Plugin:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QComboBox" name="combo_list"/>
+ </item>
+ <item>
+ <widget class="QLabel" name="label_desc">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Expanding">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string notr="true">TextLabel</string>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
+ </property>
+ <property name="wordWrap">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <item>
+ <widget class="QPushButton" name="push_cancel">
+ <property name="text">
+ <string>Cancel</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer name="horizontalSpacer">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <widget class="QPushButton" name="push_accept">
+ <property name="text">
+ <string>Select</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/lumina-config/ThemeDialog.cpp b/lumina-config/ThemeDialog.cpp
index 21413841..de17a3d8 100644
--- a/lumina-config/ThemeDialog.cpp
+++ b/lumina-config/ThemeDialog.cpp
@@ -29,6 +29,10 @@ ThemeDialog::ThemeDialog(QWidget *parent, LPlugins *plugs, QString themeFilePath
loadTheme();
connect(colormenu, SIGNAL(triggered(QAction*)),this, SLOT(menuTriggered(QAction*)) );
connect(ui->text_file, SIGNAL(textChanged()), this, SLOT(themeChanged()) );
+
+ //Now center the window on the parent
+ QPoint cen = parent->geometry().center();
+ this->move( cen.x() - (this->width()/2) , cen.y() - (this->height()/2) );
}
void ThemeDialog::loadTheme(){
diff --git a/lumina-config/lumina-config.pro b/lumina-config/lumina-config.pro
index 2ddce0ed..472b2182 100644
--- a/lumina-config/lumina-config.pro
+++ b/lumina-config/lumina-config.pro
@@ -18,20 +18,23 @@ SOURCES += main.cpp \
mainUI.cpp \
LPlugins.cpp \
ColorDialog.cpp \
- ThemeDialog.cpp
+ ThemeDialog.cpp \
+ GetPluginDialog.cpp
HEADERS += mainUI.h \
LPlugins.h \
KeyCatch.h \
AppDialog.h \
ColorDialog.h \
- ThemeDialog.h
+ ThemeDialog.h \
+ GetPluginDialog.h
FORMS += mainUI.ui \
KeyCatch.ui \
AppDialog.ui \
ColorDialog.ui \
- ThemeDialog.ui
+ ThemeDialog.ui \
+ GetPluginDialog.ui
# RESOURCES+= lumina-config.qrc
diff --git a/lumina-config/mainUI.cpp b/lumina-config/mainUI.cpp
index 2e7b55ac..b8155cbc 100644
--- a/lumina-config/mainUI.cpp
+++ b/lumina-config/mainUI.cpp
@@ -274,7 +274,7 @@ QString MainUI::getColorStyle(QString current){
return out;
}
-QString MainUI::getNewPanelPlugin(){
+/*QString MainUI::getNewPanelPlugin(){
QString out;
//Now let the user select a new panel plugin
QStringList plugs = PINFO->panelPlugins();
@@ -288,13 +288,12 @@ QString MainUI::getNewPanelPlugin(){
out = plugs[ names.indexOf(sel) ];
}
return out;
-}
+}*/
XDGDesktop MainUI::getSysApp(){
AppDialog dlg(this, sysApps);
dlg.exec();
return dlg.appselected;
-
}
//Convert to/from fluxbox key codes
@@ -903,7 +902,11 @@ void MainUI::getpanel2color(){
}
void MainUI::addpanel1plugin(){
- QString pan = getNewPanelPlugin();
+ GetPluginDialog dlg(this);
+ dlg.LoadPlugins("panel", PINFO);
+ dlg.exec();
+ if(!dlg.selected){ return; } //cancelled
+ QString pan = dlg.plugID; //getNewPanelPlugin();
if(pan.isEmpty()){ return; } //nothing selected
//Add the new plugin to the list
LPI info = PINFO->panelPluginInfo(pan);
@@ -917,7 +920,11 @@ void MainUI::addpanel1plugin(){
}
void MainUI::addpanel2plugin(){
- QString pan = getNewPanelPlugin();
+ GetPluginDialog dlg(this);
+ dlg.LoadPlugins("panel", PINFO);
+ dlg.exec();
+ if(!dlg.selected){ return; } //cancelled
+ QString pan = dlg.plugID; //getNewPanelPlugin();
if(pan.isEmpty()){ return; } //nothing selected
//Add the new plugin to the list
LPI info = PINFO->panelPluginInfo(pan);
@@ -979,14 +986,19 @@ void MainUI::dnpanel2plugin(){
// MENU PAGE
//============
void MainUI::addmenuplugin(){
- QStringList names;
+ /*QStringList names;
QStringList plugs = PINFO->menuPlugins();
for(int i=0; i<plugs.length(); i++){ names << PINFO->menuPluginInfo(plugs[i]).name; }
bool ok = false;
QString sel = QInputDialog::getItem(this,tr("New Menu Plugin"),tr("Plugin:"), names,0,false,&ok);
- if(sel.isEmpty() || names.indexOf(sel) < 0 || !ok){ return; }
+ if(sel.isEmpty() || names.indexOf(sel) < 0 || !ok){ return; }*/
+ GetPluginDialog dlg(this);
+ dlg.LoadPlugins("menu", PINFO);
+ dlg.exec();
+ if(!dlg.selected){ return; } //cancelled
+ QString plug = dlg.plugID;
//Now add the item to the list
- LPI info = PINFO->menuPluginInfo( plugs[ names.indexOf(sel) ] );
+ LPI info = PINFO->menuPluginInfo(plug);
QListWidgetItem *it;
if(info.ID=="app"){
//Need to prompt for the exact application to add to the menu
diff --git a/lumina-config/mainUI.h b/lumina-config/mainUI.h
index d3c622be..b3d03664 100644
--- a/lumina-config/mainUI.h
+++ b/lumina-config/mainUI.h
@@ -1,3 +1,9 @@
+//===========================================
+// Lumina-DE source code
+// Copyright (c) 2014, Ken Moore
+// Available under the 3-clause BSD license
+// See the LICENSE file for full details
+//===========================================
#ifndef _LUMINA_CONFIG_MAIN_UI_H
#define _LUMINA_CONFIG_MAIN_UI_H
@@ -29,6 +35,7 @@
#include "AppDialog.h"
#include "ColorDialog.h"
#include "ThemeDialog.h"
+#include "GetPluginDialog.h"
//namespace for using the *.ui file
namespace Ui{
@@ -62,7 +69,7 @@ private:
//Panels Page simplifications
QString getColorStyle(QString current);
- QString getNewPanelPlugin();
+ //QString getNewPanelPlugin();
//Get an application on the system
XDGDesktop getSysApp();
bgstack15