From 6fc4e0d28202a1d7b51ab64ccd4438508440ec6d Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Wed, 2 Nov 2016 11:01:16 -0400 Subject: Add the new Qt5 theme engine setting to lumina-config. --- .../core-utils/lumina-config/pages/page_theme.cpp | 48 ++- .../core-utils/lumina-config/pages/page_theme.h | 3 + .../core-utils/lumina-config/pages/page_theme.ui | 334 ++++++++++++--------- 3 files changed, 236 insertions(+), 149 deletions(-) (limited to 'src-qt5/core-utils/lumina-config/pages') diff --git a/src-qt5/core-utils/lumina-config/pages/page_theme.cpp b/src-qt5/core-utils/lumina-config/pages/page_theme.cpp index 123812a1..0d946e81 100644 --- a/src-qt5/core-utils/lumina-config/pages/page_theme.cpp +++ b/src-qt5/core-utils/lumina-config/pages/page_theme.cpp @@ -14,6 +14,7 @@ //========== page_theme::page_theme(QWidget *parent) : PageWidget(parent), ui(new Ui::page_theme()){ ui->setupUi(this); + findQt5Themes(); loading = false; PINFO = new LPlugins(); //load the info class connect(ui->spin_session_fontsize, SIGNAL(valueChanged(int)), this, SLOT(settingsChanged()) ); @@ -24,7 +25,7 @@ page_theme::page_theme(QWidget *parent) : PageWidget(parent), ui(new Ui::page_th connect(ui->tool_session_newcolor, SIGNAL(clicked()), this, SLOT(sessionEditColor()) ); connect(ui->tool_session_newtheme, SIGNAL(clicked()), this, SLOT(sessionEditTheme()) ); connect(ui->combo_session_cursortheme, SIGNAL(currentIndexChanged(int)), this, SLOT(settingsChanged()) ); - + connect(ui->combo_qt5_theme, SIGNAL(currentIndexChanged(int)), this, SLOT(checkQt5Theme()) ); updateIcons(); } @@ -41,6 +42,11 @@ void page_theme::SaveSettings(){ 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"; + QString qt5theme = ui->combo_qt5_theme->currentData().toString(); + if(qt5theme=="internal_custom"){ qt5theme = ui->line_qt5_custom_theme->text(); } + QSettings sessionsettings("lumina-desktop","sessionsettings"); + sessionsettings.setValue("Qt5_theme_engine", qt5theme); + //qDebug() << "Saving theme options:" << themefile << colorfile << iconset << font << fontsize; LTHEME::setCurrentSettings( themefile, colorfile, iconset, font, fontsize); LTHEME::setCursorTheme(ui->combo_session_cursortheme->currentText()); @@ -103,6 +109,15 @@ ui->combo_session_themefile->clear(); int cur = ui->combo_session_cursortheme->findText( LTHEME::currentCursor() ); if(cur>=0){ ui->combo_session_cursortheme->setCurrentIndex(cur); } + QSettings sessionsettings("lumina-desktop","sessionsettings"); + QString qt5theme = sessionsettings.value("Qt5_theme_engine", "").toString(); + int index = ui->combo_qt5_theme->findData(qt5theme); + if(index <0){ + ui->line_qt5_custom_theme->setText(qt5theme); + index = ui->combo_qt5_theme->findData("internal_custom"); + } + if(index>=0){ ui->combo_qt5_theme->setCurrentIndex(index); } + QApplication::processEvents(); loading = false; } @@ -110,8 +125,34 @@ ui->combo_session_themefile->clear(); void page_theme::updateIcons(){ ui->tool_session_newtheme->setIcon( LXDG::findIcon("preferences-desktop-theme","") ); ui->tool_session_newcolor->setIcon( LXDG::findIcon("preferences-desktop-color","") ); + ui->tabWidget->setTabIcon(0, LXDG::findIcon("user-desktop","desktop") ); + ui->tabWidget->setTabIcon(1, LXDG::findIcon("preferences-system-windows","") ); } +//================= +// PRIVATE +//================= +void page_theme::findQt5Themes(){ + ui->combo_qt5_theme->clear(); + ui->combo_qt5_theme->addItem( tr("None"), ""); + ui->combo_qt5_theme->addItem( tr("Manual Setting"), "internal_custom"); + //Now probe the system and list any themes that are found + QStringList paths = QCoreApplication::libraryPaths(); + qDebug() << "Known Library Paths:" << paths; + QStringList engines; + for(int i=0; icombo_qt5_theme->insertSeparator(2); } + ui->combo_qt5_theme->addItem( engines[i], engines[i] ); + } +} //================= // PRIVATE SLOTS //================= @@ -167,3 +208,8 @@ void page_theme::sessionEditTheme(){ } emit HasPendingChanges(true); } + +void page_theme::checkQt5Theme(){ + ui->line_qt5_custom_theme->setVisible( ui->combo_qt5_theme->currentData().toString()=="internal_custom"); + settingsChanged(); +} diff --git a/src-qt5/core-utils/lumina-config/pages/page_theme.h b/src-qt5/core-utils/lumina-config/pages/page_theme.h index a56fba7b..3257af9b 100644 --- a/src-qt5/core-utils/lumina-config/pages/page_theme.h +++ b/src-qt5/core-utils/lumina-config/pages/page_theme.h @@ -31,6 +31,8 @@ private: LPlugins *PINFO; bool loading; + void findQt5Themes(); + private slots: void settingsChanged(){ //qDebug() << "Setting Changed:" << !loading; @@ -38,5 +40,6 @@ private slots: } void sessionEditColor(); void sessionEditTheme(); + void checkQt5Theme(); }; #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 decd543f..ecc209ed 100644 --- a/src-qt5/core-utils/lumina-config/pages/page_theme.ui +++ b/src-qt5/core-utils/lumina-config/pages/page_theme.ui @@ -6,14 +6,14 @@ 0 0 - 400 + 428 300 Form - + 9 @@ -26,155 +26,193 @@ 9 - - - - Font: + + + + 0 + + + Desktop Theme + + + + + + Font: + + + + + + + false + + + + + + + Font Size: + + + + + + + point + + + + + + + Theme Template: + + + + + + + + + QComboBox::AdjustToContents + + + + + + + Create/Edit a theme template (Advanced) + + + + + + Edit + + + Qt::ToolButtonTextBesideIcon + + + + + + + + + Color Scheme: + + + + + + + + + QComboBox::AdjustToContents + + + + + + + Create/Edit a color scheme + + + + + + Edit + + + Qt::ToolButtonTextBesideIcon + + + + + + + + + Icon Pack: + + + + + + + + + + Mouse Cursors: + + + + + + + + + + 0 + 0 + + + + + + + + + 0 + 0 + + + + + + + + + + true + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + + + Application Themes + + + + + + Qt5 Theme Engine + + + + + + + + + + + + + + + - - - - false - - - - - - - Font Size: - - - - - - - point - - - - - - - Theme Template: - - - - - - - - - QComboBox::AdjustToContents - - - - - - - Create/Edit a theme template (Advanced) - - - - - - Edit - - - Qt::ToolButtonTextBesideIcon - - - - - - - - - Color Scheme: - - - - - - - - - QComboBox::AdjustToContents - - - - - - - Create/Edit a color scheme - - - - - - Edit - - - Qt::ToolButtonTextBesideIcon - - - - - - - - - Icon Pack: - - - - - - - - - - Mouse Cursors: - - - - - - - - - - 0 - 0 - - - - - - - - - 0 - 0 - - - - - - - - - - true - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - -- cgit