aboutsummaryrefslogtreecommitdiff
path: root/src-qt5/core-utils
diff options
context:
space:
mode:
Diffstat (limited to 'src-qt5/core-utils')
-rw-r--r--src-qt5/core-utils/lumina-config/globals.h1
-rw-r--r--src-qt5/core-utils/lumina-config/main.cpp4
-rw-r--r--src-qt5/core-utils/lumina-config/pages/getPage.h3
-rw-r--r--src-qt5/core-utils/lumina-config/pages/page_theme.cpp168
-rw-r--r--src-qt5/core-utils/lumina-config/pages/page_theme.h42
-rw-r--r--src-qt5/core-utils/lumina-config/pages/page_theme.ui8
-rw-r--r--src-qt5/core-utils/lumina-config/pages/pages.pri12
7 files changed, 226 insertions, 12 deletions
diff --git a/src-qt5/core-utils/lumina-config/globals.h b/src-qt5/core-utils/lumina-config/globals.h
index f3921976..04c680f4 100644
--- a/src-qt5/core-utils/lumina-config/globals.h
+++ b/src-qt5/core-utils/lumina-config/globals.h
@@ -26,5 +26,6 @@
#include <LuminaUtils.h>
#include <LuminaX11.h>
#include <LuminaOS.h>
+#include <LuminaThemes.h>
#endif
diff --git a/src-qt5/core-utils/lumina-config/main.cpp b/src-qt5/core-utils/lumina-config/main.cpp
index a63e0fbe..20d517b2 100644
--- a/src-qt5/core-utils/lumina-config/main.cpp
+++ b/src-qt5/core-utils/lumina-config/main.cpp
@@ -19,8 +19,8 @@ int main(int argc, char ** argv)
LuminaThemeEngine theme(&a);
- MainUI w;
- //mainWindow w;
+ //MainUI w;
+ mainWindow w;
QObject::connect(&a, SIGNAL(InputsAvailable(QStringList)), &w, SLOT(slotSingleInstance()) );
QObject::connect(&theme, SIGNAL(updateIcons()), &w, SLOT(setupIcons()) );
w.show();
diff --git a/src-qt5/core-utils/lumina-config/pages/getPage.h b/src-qt5/core-utils/lumina-config/pages/getPage.h
index cecc3d87..8d3feb0f 100644
--- a/src-qt5/core-utils/lumina-config/pages/getPage.h
+++ b/src-qt5/core-utils/lumina-config/pages/getPage.h
@@ -27,16 +27,19 @@ static QList<PAGEINFO> KnownPages(){
QList<PAGEINFO> list;
//Reminder: <ID>, <name>, <title>, <icon>, <comment>, <category>, <server subsytem list>, <search tags>
list << PageInfo("wallpaper", QObject::tr("Change Wallpaper"), QObject::tr("Wallpaper Settings"), "preferences-desktop-wallpaper",QObject::tr("Change background image(s)"), "appearance", QStringList(), QStringList() << "background" << "wallpaper" << "color" << "theme");
+ list << PageInfo("theme", QObject::tr("Change Desktop Theme"), QObject::tr("Theme Settings"), "preferences-desktop-color",QObject::tr("Change interface fonts and colors"), "appearance", QStringList(), QStringList() << "background" << "interface" << "color" << "theme" << "plugins");
return list;
}
//Add any sub-pages here
#include "page_main.h"
#include "page_wallpaper.h"
+#include "page_theme.h"
static PageWidget* GetNewPage(QString id, QWidget *parent){
//Find the page that matches this "id"
if(id=="wallpaper"){ return new page_wallpaper(parent); }
+ else if(id=="theme"){ return new page_theme(parent); }
//Return the main control_panel page as the fallback/default
return new page_main(parent);
}
diff --git a/src-qt5/core-utils/lumina-config/pages/page_theme.cpp b/src-qt5/core-utils/lumina-config/pages/page_theme.cpp
new file mode 100644
index 00000000..781e650d
--- /dev/null
+++ b/src-qt5/core-utils/lumina-config/pages/page_theme.cpp
@@ -0,0 +1,168 @@
+//===========================================
+// Lumina-DE source code
+// Copyright (c) 2016, Ken Moore
+// Available under the 3-clause BSD license
+// See the LICENSE file for full details
+//===========================================
+#include "page_theme.h"
+#include "ui_page_theme.h"
+
+#include "../ColorDialog.h"
+#include "../ThemeDialog.h"
+//==========
+// PUBLIC
+//==========
+page_theme::page_theme(QWidget *parent) : PageWidget(parent), ui(new Ui::page_theme()){
+ ui->setupUi(this);
+ loading = false;
+ PINFO = new LPlugins(); //load the info class
+ connect(ui->spin_session_fontsize, SIGNAL(valueChanged(int)), this, SLOT(settingsChanged()) );
+ connect(ui->combo_session_themefile, SIGNAL(currentIndexChanged(int)), this, SLOT(settingsChanged()) );
+ connect(ui->combo_session_colorfile, SIGNAL(currentIndexChanged(int)), this, SLOT(settingsChanged()) );
+ connect(ui->combo_session_icontheme, SIGNAL(currentIndexChanged(int)), this, SLOT(settingsChanged()) );
+ connect(ui->font_session_theme, SIGNAL(currentIndexChanged(int)), this, SLOT(settingsChanged()) );
+ connect(ui->tool_session_newcolor, SIGNAL(clicked()), this, SLOT(sessionEditColor()) );
+ connect(ui->tool_session_newtheme, SIGNAL(clicked()), this, SLOT(sessionEditTheme()) );
+
+ updateIcons();
+}
+
+page_theme::~page_theme(){
+
+}
+
+//================
+// PUBLIC SLOTS
+//================
+void page_theme::SaveSettings(){
+ QString themefile = ui->combo_session_themefile->itemData( ui->combo_session_themefile->currentIndex() ).toString();
+ QString colorfile = ui->combo_session_colorfile->itemData( ui->combo_session_colorfile->currentIndex() ).toString();
+ QString iconset = ui->combo_session_icontheme->currentText();
+ QString font = ui->font_session_theme->currentFont().family();
+ QString fontsize = QString::number(ui->spin_session_fontsize->value())+"pt";
+ //qDebug() << "Saving theme options:" << themefile << colorfile << iconset << font << fontsize;
+ LTHEME::setCurrentSettings( themefile, colorfile, iconset, font, fontsize);
+ LTHEME::setCursorTheme(ui->combo_session_cursortheme->currentText());
+ emit HasPendingChanges(false);
+}
+
+void page_theme::LoadSettings(int){
+ emit HasPendingChanges(false);
+ emit ChangePageTitle( tr("Theme Settings") );
+
+ loading = true;
+ //Load the available settings
+ ui->combo_session_cursortheme->clear();
+ ui->combo_session_cursortheme->addItems( LTHEME::availableSystemCursors() );
+
+ui->combo_session_themefile->clear();
+ ui->combo_session_colorfile->clear();
+ ui->combo_session_icontheme->clear();
+ QStringList current = LTHEME::currentSettings();
+ // - local theme templates
+ QStringList tmp = LTHEME::availableLocalThemes();
+ tmp.sort();
+ for(int i=0; i<tmp.length(); i++){
+ ui->combo_session_themefile->addItem(tmp[i].section("::::",0,0)+" ("+tr("Local")+")", tmp[i].section("::::",1,1));
+ if(tmp[i].section("::::",1,1)==current[0]){ ui->combo_session_themefile->setCurrentIndex(ui->combo_session_themefile->count()-1); }
+ }
+ // - system theme templates
+ tmp = LTHEME::availableSystemThemes();
+ tmp.sort();
+ for(int i=0; i<tmp.length(); i++){
+ ui->combo_session_themefile->addItem(tmp[i].section("::::",0,0)+" ("+tr("System")+")", tmp[i].section("::::",1,1));
+ if(tmp[i].section("::::",1,1)==current[0]){ ui->combo_session_themefile->setCurrentIndex(ui->combo_session_themefile->count()-1); }
+ }
+ // - local color schemes
+ tmp = LTHEME::availableLocalColors();
+ tmp.sort();
+ for(int i=0; i<tmp.length(); i++){
+ ui->combo_session_colorfile->addItem(tmp[i].section("::::",0,0)+" ("+tr("Local")+")", tmp[i].section("::::",1,1));
+ if(tmp[i].section("::::",1,1)==current[1]){ ui->combo_session_colorfile->setCurrentIndex(ui->combo_session_colorfile->count()-1); }
+ }
+ // - system color schemes
+ tmp = LTHEME::availableSystemColors();
+ tmp.sort();
+ for(int i=0; i<tmp.length(); i++){
+ ui->combo_session_colorfile->addItem(tmp[i].section("::::",0,0)+" ("+tr("System")+")", tmp[i].section("::::",1,1));
+ if(tmp[i].section("::::",1,1)==current[1]){ ui->combo_session_colorfile->setCurrentIndex(ui->combo_session_colorfile->count()-1); }
+ }
+ // - icon themes
+ tmp = LTHEME::availableSystemIcons();
+ tmp.sort();
+ for(int i=0; i<tmp.length(); i++){
+ ui->combo_session_icontheme->addItem(tmp[i]);
+ if(tmp[i]==current[2]){ ui->combo_session_icontheme->setCurrentIndex(i); }
+ }
+ // - Font
+ ui->font_session_theme->setCurrentFont( QFont(current[3]) );
+ // - Font Size
+ ui->spin_session_fontsize->setValue( current[4].section("p",0,0).toInt() );
+
+ int cur = ui->combo_session_cursortheme->findText( LTHEME::currentCursor() );
+ if(cur>=0){ ui->combo_session_cursortheme->setCurrentIndex(cur); }
+
+ QApplication::processEvents();
+ loading = false;
+}
+
+void page_theme::updateIcons(){
+ ui->tool_session_newtheme->setIcon( LXDG::findIcon("preferences-desktop-theme","") );
+ ui->tool_session_newcolor->setIcon( LXDG::findIcon("preferences-desktop-color","") );
+}
+
+//=================
+// PRIVATE SLOTS
+//=================
+void page_theme::sessionEditColor(){
+ //Get the current color file
+ QString file = ui->combo_session_colorfile->itemData( ui->combo_session_colorfile->currentIndex() ).toString();
+ //Open the color edit dialog
+ ColorDialog dlg(this, PINFO, file);
+ dlg.exec();
+ //Check whether the file got saved/changed
+ if(dlg.colorname.isEmpty() || dlg.colorpath.isEmpty() ){ return; } //cancelled
+ //Reload the color list and activate the new color
+ // - local color schemes
+ ui->combo_session_colorfile->clear();
+ QStringList tmp = LTHEME::availableLocalColors();
+ tmp.sort();
+ for(int i=0; i<tmp.length(); i++){
+ ui->combo_session_colorfile->addItem(tmp[i].section("::::",0,0)+" ("+tr("Local")+")", tmp[i].section("::::",1,1));
+ if(tmp[i].section("::::",1,1)==dlg.colorpath){ ui->combo_session_colorfile->setCurrentIndex(ui->combo_session_colorfile->count()-1); }
+ }
+ // - system color schemes
+ tmp = LTHEME::availableSystemColors();
+ tmp.sort();
+ for(int i=0; i<tmp.length(); i++){
+ ui->combo_session_colorfile->addItem(tmp[i].section("::::",0,0)+" ("+tr("System")+")", tmp[i].section("::::",1,1));
+ if(tmp[i].section("::::",1,1)==dlg.colorpath){ ui->combo_session_colorfile->setCurrentIndex(ui->combo_session_colorfile->count()-1); }
+ }
+ emit HasPendingChanges(true);
+}
+
+void page_theme::sessionEditTheme(){
+ QString file = ui->combo_session_themefile->itemData( ui->combo_session_themefile->currentIndex() ).toString();
+ //Open the theme editor dialog
+ ThemeDialog dlg(this, PINFO, file);
+ dlg.exec();
+ //Check for file change/save
+ if(dlg.themename.isEmpty() || dlg.themepath.isEmpty()){ return; } //cancelled
+ //Reload the theme list and activate the new theme
+ ui->combo_session_themefile->clear();
+ // - local theme templates
+ QStringList tmp = LTHEME::availableLocalThemes();
+ tmp.sort();
+ for(int i=0; i<tmp.length(); i++){
+ ui->combo_session_themefile->addItem(tmp[i].section("::::",0,0)+" ("+tr("Local")+")", tmp[i].section("::::",1,1));
+ if(tmp[i].section("::::",1,1)==dlg.themepath){ ui->combo_session_themefile->setCurrentIndex(ui->combo_session_themefile->count()-1); }
+ }
+ // - system theme templates
+ tmp = LTHEME::availableSystemThemes();
+ tmp.sort();
+ for(int i=0; i<tmp.length(); i++){
+ ui->combo_session_themefile->addItem(tmp[i].section("::::",0,0)+" ("+tr("System")+")", tmp[i].section("::::",1,1));
+ if(tmp[i].section("::::",1,1)==dlg.themepath){ ui->combo_session_themefile->setCurrentIndex(ui->combo_session_themefile->count()-1); }
+ }
+ emit HasPendingChanges(true);
+}
diff --git a/src-qt5/core-utils/lumina-config/pages/page_theme.h b/src-qt5/core-utils/lumina-config/pages/page_theme.h
new file mode 100644
index 00000000..a56fba7b
--- /dev/null
+++ b/src-qt5/core-utils/lumina-config/pages/page_theme.h
@@ -0,0 +1,42 @@
+//===========================================
+// Lumina Desktop Source Code
+// Copyright (c) 2016, Ken Moore
+// Available under the 3-clause BSD license
+// See the LICENSE file for full details
+//===========================================
+#ifndef _LUMINA_CONFIG_PAGE_THEME_H
+#define _LUMINA_CONFIG_PAGE_THEME_H
+#include "../globals.h"
+#include "PageWidget.h"
+
+#include "../LPlugins.h"
+
+namespace Ui{
+ class page_theme;
+};
+
+class page_theme : public PageWidget{
+ Q_OBJECT
+public:
+ page_theme(QWidget *parent);
+ ~page_theme();
+
+public slots:
+ void SaveSettings();
+ void LoadSettings(int screennum);
+ void updateIcons();
+
+private:
+ Ui::page_theme *ui;
+ LPlugins *PINFO;
+ bool loading;
+
+private slots:
+ void settingsChanged(){
+ //qDebug() << "Setting Changed:" << !loading;
+ if(!loading){ emit HasPendingChanges(true); }
+ }
+ void sessionEditColor();
+ void sessionEditTheme();
+};
+#endif
diff --git a/src-qt5/core-utils/lumina-config/pages/page_theme.ui b/src-qt5/core-utils/lumina-config/pages/page_theme.ui
index 9c5e2064..decd543f 100644
--- a/src-qt5/core-utils/lumina-config/pages/page_theme.ui
+++ b/src-qt5/core-utils/lumina-config/pages/page_theme.ui
@@ -15,16 +15,16 @@
</property>
<layout class="QFormLayout" name="formLayout">
<property name="leftMargin">
- <number>0</number>
+ <number>9</number>
</property>
<property name="topMargin">
- <number>0</number>
+ <number>9</number>
</property>
<property name="rightMargin">
- <number>0</number>
+ <number>9</number>
</property>
<property name="bottomMargin">
- <number>0</number>
+ <number>9</number>
</property>
<item row="0" column="0">
<widget class="QLabel" name="label_12">
diff --git a/src-qt5/core-utils/lumina-config/pages/pages.pri b/src-qt5/core-utils/lumina-config/pages/pages.pri
index c282a02c..7fd3b19c 100644
--- a/src-qt5/core-utils/lumina-config/pages/pages.pri
+++ b/src-qt5/core-utils/lumina-config/pages/pages.pri
@@ -2,7 +2,8 @@
HEADERS += $${PWD}/getPage.h \
$${PWD}/PageWidget.h \
$${PWD}/page_main.h \
- $${PWD}/page_wallpaper.h
+ $${PWD}/page_wallpaper.h \
+ $${PWD}/page_theme.h
# $${PWD}/page_autostart.h \
# $${PWD}/page_defaultapps.h \
# $${PWD}/page_fluxbox_keys.h \
@@ -12,11 +13,11 @@ HEADERS += $${PWD}/getPage.h \
# $${PWD}/page_interface_panels.h \
# $${PWD}/page_session_locale.h \
# $${PWD}/page_session_options.h \
-# $${PWD}/page_theme.h \
SOURCES += $${PWD}/page_main.cpp \
- $${PWD}/page_wallpaper.cpp
+ $${PWD}/page_wallpaper.cpp \
+ $${PWD}/page_theme.cpp
# $${PWD}/page_autostart.cpp \
# $${PWD}/page_defaultapps.cpp \
# $${PWD}/page_fluxbox_keys.cpp \
@@ -26,11 +27,11 @@ SOURCES += $${PWD}/page_main.cpp \
# $${PWD}/page_interface_panels.cpp \
# $${PWD}/page_session_locale.cpp \
# $${PWD}/page_session_options.cpp \
-# $${PWD}/page_theme.cpp \
FORMS += $${PWD}/page_main.ui \
- $${PWD}/page_wallpaper.ui
+ $${PWD}/page_wallpaper.ui \
+ $${PWD}/page_theme.ui
# $${PWD}/page_autostart.ui \
# $${PWD}/page_defaultapps.ui \
# $${PWD}/page_fluxbox_keys.ui \
@@ -40,4 +41,3 @@ FORMS += $${PWD}/page_main.ui \
# $${PWD}/page_interface_panels.ui \
# $${PWD}/page_session_locale.ui \
# $${PWD}/page_session_options.ui \
-# $${PWD}/page_theme.ui \
bgstack15