aboutsummaryrefslogtreecommitdiff
path: root/src-qt5/core-utils/lumina-config/PanelWidget.cpp
diff options
context:
space:
mode:
authorKen Moore <moorekou@gmail.com>2016-06-28 09:42:19 -0400
committerKen Moore <moorekou@gmail.com>2016-06-28 09:42:19 -0400
commit79f1863b83d0b3df619eb3e96c01c06dd12cb72f (patch)
treee40dd2abb83e19a90abe8edc49b76f8e174c1ffd /src-qt5/core-utils/lumina-config/PanelWidget.cpp
parentAdd in the last 2 converted pages (session_[locale/options]). Leave the new U... (diff)
downloadlumina-79f1863b83d0b3df619eb3e96c01c06dd12cb72f.tar.gz
lumina-79f1863b83d0b3df619eb3e96c01c06dd12cb72f.tar.bz2
lumina-79f1863b83d0b3df619eb3e96c01c06dd12cb72f.zip
Finish up the switch over to the new UI for lumina-config
Diffstat (limited to 'src-qt5/core-utils/lumina-config/PanelWidget.cpp')
-rw-r--r--src-qt5/core-utils/lumina-config/PanelWidget.cpp44
1 files changed, 36 insertions, 8 deletions
diff --git a/src-qt5/core-utils/lumina-config/PanelWidget.cpp b/src-qt5/core-utils/lumina-config/PanelWidget.cpp
index 49b3d797..10e12cbb 100644
--- a/src-qt5/core-utils/lumina-config/PanelWidget.cpp
+++ b/src-qt5/core-utils/lumina-config/PanelWidget.cpp
@@ -7,13 +7,8 @@
#include "PanelWidget.h"
#include "ui_PanelWidget.h"
-#include "LPlugins.h"
#include "GetPluginDialog.h"
-#include "mainUI.h"
-#include <LuminaXDG.h>
-
-#include <QSettings>
-#include <QStringList>
+#include "AppDialog.h"
PanelWidget::PanelWidget(QWidget *parent, QWidget *Main, LPlugins *Pinfo) : QWidget(parent), ui(new Ui::PanelWidget){
@@ -126,6 +121,39 @@ void PanelWidget::reloadColorSample(){
ui->label_color_sample->setStyleSheet("background: "+ui->label_color_sample->whatsThis());
}
+XDGDesktop PanelWidget::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;
+}
+
+QString PanelWidget::getColorStyle(QString current, bool allowTransparency){
+ QString out;
+ //Convert the current color string into a QColor
+ QStringList col = current.section(")",0,0).section("(",1,1).split(",");
+ if(col.length()!=4){ col.clear(); col << "255" << "255" << "255" << "255"; }
+ QColor ccol = QColor(col[0].toInt(), col[1].toInt(), col[2].toInt(), col[3].toInt()); //RGBA
+ QColor ncol;
+ if(allowTransparency){ ncol= QColorDialog::getColor(ccol, this, tr("Select Color"), QColorDialog::ShowAlphaChannel); }
+ else{ ncol= QColorDialog::getColor(ccol, this, tr("Select Color")); }
+ //Now convert the new color into a usable string and return
+ if(ncol.isValid()){ //if the dialog was not cancelled
+ if(allowTransparency){
+ out = "rgba("+QString::number(ncol.red())+","+QString::number(ncol.green())+","+QString::number(ncol.blue())+","+QString::number(ncol.alpha())+")";
+ }else{
+ out = "rgb("+QString::number(ncol.red())+","+QString::number(ncol.green())+","+QString::number(ncol.blue())+")";
+ }
+ }
+ return out;
+}
+
void PanelWidget::on_tool_rm_clicked(){
emit PanelRemoved(pnum);
}
@@ -140,7 +168,7 @@ void PanelWidget::UseColorChanged(){
}
void PanelWidget::on_tool_selectcolor_clicked(){
- QString color = static_cast<MainUI*>(mainui)->getColorStyle(ui->label_color_sample->whatsThis());
+ QString color = getColorStyle(ui->label_color_sample->whatsThis());
if( color.isEmpty()){ return; }
ui->label_color_sample->setWhatsThis(color);
reloadColorSample();
@@ -155,7 +183,7 @@ void PanelWidget::on_tool_addplugin_clicked(){
QString pan = dlg.plugID; //getNewPanelPlugin();
if(pan == "applauncher"){
//Prompt for the application to add
- XDGDesktop app = static_cast<MainUI*>(mainui)->getSysApp();
+ XDGDesktop app =getSysApp();
if(app.filePath.isEmpty()){ return; } //cancelled
pan.append("::"+app.filePath);
QListWidgetItem *it = new QListWidgetItem( LXDG::findIcon(app.icon,""), app.name);
bgstack15