diff options
Diffstat (limited to 'src-qt5/core-utils/lumina-config')
-rw-r--r-- | src-qt5/core-utils/lumina-config/pages/page_theme.cpp | 48 | ||||
-rw-r--r-- | src-qt5/core-utils/lumina-config/pages/page_theme.h | 3 | ||||
-rw-r--r-- | src-qt5/core-utils/lumina-config/pages/page_theme.ui | 334 |
3 files changed, 236 insertions, 149 deletions
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,9 +125,35 @@ 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; i<paths.length(); i++){ + if(QFile::exists(paths[i]+"/platformthemes")){ + QDir dir(paths[i]+"/platformthemes"); + QStringList libs = dir.entryList(QStringList("lib*.so*"), QDir::Files, QDir::NoSort) ; + for(int j=0; j<libs.length(); j++){ engines << libs[j].section("lib",1,-1).section(".",0,-2).simplified(); } + } + } + engines.sort(); + for(int i=0; i<engines.length(); i++){ + if(i==0){ ui->combo_qt5_theme->insertSeparator(2); } + ui->combo_qt5_theme->addItem( engines[i], engines[i] ); + } +} +//================= // PRIVATE SLOTS //================= void page_theme::sessionEditColor(){ @@ -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 @@ <rect> <x>0</x> <y>0</y> - <width>400</width> + <width>428</width> <height>300</height> </rect> </property> <property name="windowTitle"> <string>Form</string> </property> - <layout class="QFormLayout" name="formLayout"> + <layout class="QVBoxLayout" name="verticalLayout"> <property name="leftMargin"> <number>9</number> </property> @@ -26,155 +26,193 @@ <property name="bottomMargin"> <number>9</number> </property> - <item row="0" column="0"> - <widget class="QLabel" name="label_12"> - <property name="text"> - <string>Font:</string> + <item> + <widget class="QTabWidget" name="tabWidget"> + <property name="currentIndex"> + <number>0</number> </property> + <widget class="QWidget" name="tab_desktop"> + <attribute name="title"> + <string>Desktop Theme</string> + </attribute> + <layout class="QFormLayout" name="formLayout_2"> + <item row="0" column="0"> + <widget class="QLabel" name="label_12"> + <property name="text"> + <string>Font:</string> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QFontComboBox" name="font_session_theme"> + <property name="editable"> + <bool>false</bool> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="label_14"> + <property name="text"> + <string>Font Size:</string> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="QSpinBox" name="spin_session_fontsize"> + <property name="suffix"> + <string> point</string> + </property> + </widget> + </item> + <item row="2" column="0"> + <widget class="QLabel" name="label_16"> + <property name="text"> + <string>Theme Template:</string> + </property> + </widget> + </item> + <item row="2" column="1"> + <layout class="QHBoxLayout" name="horizontalLayout_12"> + <item> + <widget class="QComboBox" name="combo_session_themefile"> + <property name="sizeAdjustPolicy"> + <enum>QComboBox::AdjustToContents</enum> + </property> + </widget> + </item> + <item> + <widget class="QToolButton" name="tool_session_newtheme"> + <property name="toolTip"> + <string>Create/Edit a theme template (Advanced)</string> + </property> + <property name="statusTip"> + <string/> + </property> + <property name="text"> + <string>Edit</string> + </property> + <property name="toolButtonStyle"> + <enum>Qt::ToolButtonTextBesideIcon</enum> + </property> + </widget> + </item> + </layout> + </item> + <item row="3" column="0"> + <widget class="QLabel" name="label_17"> + <property name="text"> + <string>Color Scheme:</string> + </property> + </widget> + </item> + <item row="3" column="1"> + <layout class="QHBoxLayout" name="horizontalLayout_19"> + <item> + <widget class="QComboBox" name="combo_session_colorfile"> + <property name="sizeAdjustPolicy"> + <enum>QComboBox::AdjustToContents</enum> + </property> + </widget> + </item> + <item> + <widget class="QToolButton" name="tool_session_newcolor"> + <property name="toolTip"> + <string>Create/Edit a color scheme</string> + </property> + <property name="statusTip"> + <string/> + </property> + <property name="text"> + <string>Edit</string> + </property> + <property name="toolButtonStyle"> + <enum>Qt::ToolButtonTextBesideIcon</enum> + </property> + </widget> + </item> + </layout> + </item> + <item row="4" column="0"> + <widget class="QLabel" name="label_18"> + <property name="text"> + <string>Icon Pack:</string> + </property> + </widget> + </item> + <item row="4" column="1"> + <widget class="QComboBox" name="combo_session_icontheme"/> + </item> + <item row="5" column="0"> + <widget class="QLabel" name="label_31"> + <property name="text"> + <string>Mouse Cursors:</string> + </property> + </widget> + </item> + <item row="5" column="1"> + <layout class="QHBoxLayout" name="horizontalLayout_2"> + <item> + <widget class="QComboBox" name="combo_session_cursortheme"> + <property name="sizePolicy"> + <sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="label_cursor_sample"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="toolTip"> + <string notr="true"/> + </property> + <property name="text"> + <string notr="true"/> + </property> + <property name="scaledContents"> + <bool>true</bool> + </property> + <property name="alignment"> + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + </widget> + </item> + </layout> + </item> + </layout> + </widget> + <widget class="QWidget" name="tab_apps"> + <attribute name="title"> + <string>Application Themes</string> + </attribute> + <layout class="QFormLayout" name="formLayout"> + <item row="0" column="0"> + <widget class="QLabel" name="label"> + <property name="text"> + <string>Qt5 Theme Engine</string> + </property> + </widget> + </item> + <item row="0" column="1"> + <layout class="QVBoxLayout" name="verticalLayout_2"> + <item> + <widget class="QComboBox" name="combo_qt5_theme"/> + </item> + <item> + <widget class="QLineEdit" name="line_qt5_custom_theme"/> + </item> + </layout> + </item> + </layout> + </widget> </widget> </item> - <item row="0" column="1"> - <widget class="QFontComboBox" name="font_session_theme"> - <property name="editable"> - <bool>false</bool> - </property> - </widget> - </item> - <item row="1" column="0"> - <widget class="QLabel" name="label_14"> - <property name="text"> - <string>Font Size:</string> - </property> - </widget> - </item> - <item row="1" column="1"> - <widget class="QSpinBox" name="spin_session_fontsize"> - <property name="suffix"> - <string> point</string> - </property> - </widget> - </item> - <item row="2" column="0"> - <widget class="QLabel" name="label_16"> - <property name="text"> - <string>Theme Template:</string> - </property> - </widget> - </item> - <item row="2" column="1"> - <layout class="QHBoxLayout" name="horizontalLayout_12"> - <item> - <widget class="QComboBox" name="combo_session_themefile"> - <property name="sizeAdjustPolicy"> - <enum>QComboBox::AdjustToContents</enum> - </property> - </widget> - </item> - <item> - <widget class="QToolButton" name="tool_session_newtheme"> - <property name="toolTip"> - <string>Create/Edit a theme template (Advanced)</string> - </property> - <property name="statusTip"> - <string/> - </property> - <property name="text"> - <string>Edit</string> - </property> - <property name="toolButtonStyle"> - <enum>Qt::ToolButtonTextBesideIcon</enum> - </property> - </widget> - </item> - </layout> - </item> - <item row="3" column="0"> - <widget class="QLabel" name="label_17"> - <property name="text"> - <string>Color Scheme:</string> - </property> - </widget> - </item> - <item row="3" column="1"> - <layout class="QHBoxLayout" name="horizontalLayout_19"> - <item> - <widget class="QComboBox" name="combo_session_colorfile"> - <property name="sizeAdjustPolicy"> - <enum>QComboBox::AdjustToContents</enum> - </property> - </widget> - </item> - <item> - <widget class="QToolButton" name="tool_session_newcolor"> - <property name="toolTip"> - <string>Create/Edit a color scheme</string> - </property> - <property name="statusTip"> - <string/> - </property> - <property name="text"> - <string>Edit</string> - </property> - <property name="toolButtonStyle"> - <enum>Qt::ToolButtonTextBesideIcon</enum> - </property> - </widget> - </item> - </layout> - </item> - <item row="4" column="0"> - <widget class="QLabel" name="label_18"> - <property name="text"> - <string>Icon Pack:</string> - </property> - </widget> - </item> - <item row="4" column="1"> - <widget class="QComboBox" name="combo_session_icontheme"/> - </item> - <item row="5" column="0"> - <widget class="QLabel" name="label_31"> - <property name="text"> - <string>Mouse Cursors:</string> - </property> - </widget> - </item> - <item row="5" column="1"> - <layout class="QHBoxLayout" name="horizontalLayout_2"> - <item> - <widget class="QComboBox" name="combo_session_cursortheme"> - <property name="sizePolicy"> - <sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - </widget> - </item> - <item> - <widget class="QLabel" name="label_cursor_sample"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="toolTip"> - <string notr="true"/> - </property> - <property name="text"> - <string notr="true"/> - </property> - <property name="scaledContents"> - <bool>true</bool> - </property> - <property name="alignment"> - <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> - </property> - </widget> - </item> - </layout> - </item> </layout> </widget> <resources/> |