diff options
author | Ken Moore <ken@ixsystems.com> | 2017-09-13 16:05:22 -0400 |
---|---|---|
committer | Ken Moore <ken@ixsystems.com> | 2017-09-13 16:05:22 -0400 |
commit | d1e63d3b0982f5de681c553b706ea0a1a6c7b3ad (patch) | |
tree | f0db1d6c1472ac4254fd991a604f9fdac9a632eb /src-qt5/core/lumina-theme-engine/src | |
parent | Fix up some of the qss theme page (diff) | |
download | lumina-d1e63d3b0982f5de681c553b706ea0a1a6c7b3ad.tar.gz lumina-d1e63d3b0982f5de681c553b706ea0a1a6c7b3ad.tar.bz2 lumina-d1e63d3b0982f5de681c553b706ea0a1a6c7b3ad.zip |
Fix up a bunch more of the lumina-theme-engine functionality - adding in all the desktop style settings and reworking the configuration UI and functionality.
Diffstat (limited to 'src-qt5/core/lumina-theme-engine/src')
6 files changed, 282 insertions, 35 deletions
diff --git a/src-qt5/core/lumina-theme-engine/src/lthemeengine-qtplugin/lthemeengineplatformtheme.cpp b/src-qt5/core/lumina-theme-engine/src/lthemeengine-qtplugin/lthemeengineplatformtheme.cpp index 692223c7..9cb755fb 100644 --- a/src-qt5/core/lumina-theme-engine/src/lthemeengine-qtplugin/lthemeengineplatformtheme.cpp +++ b/src-qt5/core/lumina-theme-engine/src/lthemeengine-qtplugin/lthemeengineplatformtheme.cpp @@ -131,9 +131,9 @@ void lthemeenginePlatformTheme::applySettings(){ else{ qApp->setPalette(qApp->style()->standardPalette()); } } //do not override application style - if(m_prevStyleSheet == qApp->styleSheet()){ qApp->setStyleSheet(m_userStyleSheet); } - else{ qCDebug(llthemeengine) << "custom style sheet is disabled";} - m_prevStyleSheet = m_userStyleSheet; + qApp->setStyleSheet(m_userStyleSheet); + //else{ qCDebug(llthemeengine) << "custom style sheet is disabled";} + //m_prevStyleSheet = m_userStyleSheet; } #endif QGuiApplication::setFont(m_generalFont); //apply font @@ -156,13 +156,13 @@ void lthemeenginePlatformTheme::createFSWatcher(){ watcher->addPath(lthemeengine::configPath()); QTimer *timer = new QTimer(this); timer->setSingleShot(true); - timer->setInterval(3000); + timer->setInterval(500); connect(watcher, SIGNAL(directoryChanged(QString)), timer, SLOT(start())); connect(timer, SIGNAL(timeout()), SLOT(updateSettings())); } void lthemeenginePlatformTheme::updateSettings(){ - qCDebug(llthemeengine) << "updating settings.."; + //qCDebug(llthemeengine) << "updating settings.."; readSettings(); applySettings(); } @@ -212,8 +212,9 @@ void lthemeenginePlatformTheme::readSettings(){ //load style sheets #ifdef QT_WIDGETS_LIB QStringList qssPaths; - if(qApp->applicationName()=="lumina-desktop"){ qssPaths << settings.value("desktop_stylesheets").toStringList(); } + if(qApp->applicationFilePath().section("/",-1).startsWith("lumina-desktop") ){ qssPaths << settings.value("desktop_stylesheets").toStringList(); } qssPaths << settings.value("stylesheets").toStringList(); + //qDebug() << "Loaded Stylesheets:" << qApp->applicationName() << qssPaths; m_userStyleSheet = loadStyleSheets(qssPaths); #endif settings.endGroup(); @@ -226,6 +227,7 @@ bool lthemeenginePlatformTheme::hasWidgets(){ #endif QString lthemeenginePlatformTheme::loadStyleSheets(const QStringList &paths){ + //qDebug() << "Loading Stylesheets:" << paths; QString content; foreach (QString path, paths){ if(!QFile::exists(path)){ continue; } diff --git a/src-qt5/core/lumina-theme-engine/src/lthemeengine/appearancepage.cpp b/src-qt5/core/lumina-theme-engine/src/lthemeengine/appearancepage.cpp index 04ca6a0b..31b44ec2 100644 --- a/src-qt5/core/lumina-theme-engine/src/lthemeengine/appearancepage.cpp +++ b/src-qt5/core/lumina-theme-engine/src/lthemeengine/appearancepage.cpp @@ -6,6 +6,8 @@ #include <QMessageBox> #include <QMenu> #include <QIcon> +#include <QTimer> + #include "lthemeengine.h" #include "appearancepage.h" #include "paletteeditdialog.h" @@ -81,6 +83,8 @@ void AppearancePage::createColorScheme(){ QString schemePath = lthemeengine::userColorSchemePath() + "/" + name; createColorScheme(schemePath, palette()); m_ui->colorSchemeComboBox->addItem(name.section('.',0,0), schemePath); + m_ui->colorSchemeComboBox->setCurrentIndex( m_ui->colorSchemeComboBox->count()-1); + QTimer::singleShot(10, this, SLOT(changeColorScheme()) ); } void AppearancePage::changeColorScheme(){ @@ -125,6 +129,7 @@ void AppearancePage::copyColorScheme(){ QString newPath = lthemeengine::userColorSchemePath() + "/" + name; QFile::copy(m_ui->colorSchemeComboBox->currentData().toString(), newPath); m_ui->colorSchemeComboBox->addItem(name.section('.',0,0), newPath); + m_ui->colorSchemeComboBox->setCurrentIndex( m_ui->colorSchemeComboBox->count()-1); } void AppearancePage::renameColorScheme(){ diff --git a/src-qt5/core/lumina-theme-engine/src/lthemeengine/appearancepage.ui b/src-qt5/core/lumina-theme-engine/src/lthemeengine/appearancepage.ui index cd442930..91b65245 100644 --- a/src-qt5/core/lumina-theme-engine/src/lthemeengine/appearancepage.ui +++ b/src-qt5/core/lumina-theme-engine/src/lthemeengine/appearancepage.ui @@ -161,9 +161,15 @@ <property name="text"> <string>...</string> </property> + <property name="icon"> + <iconset theme="view-more-vertical"/> + </property> <property name="popupMode"> <enum>QToolButton::InstantPopup</enum> </property> + <property name="autoRaise"> + <bool>true</bool> + </property> <property name="arrowType"> <enum>Qt::NoArrow</enum> </property> diff --git a/src-qt5/core/lumina-theme-engine/src/lthemeengine/mainwindow.cpp b/src-qt5/core/lumina-theme-engine/src/lthemeengine/mainwindow.cpp index 91db14ee..d0f1560f 100644 --- a/src-qt5/core/lumina-theme-engine/src/lthemeengine/mainwindow.cpp +++ b/src-qt5/core/lumina-theme-engine/src/lthemeengine/mainwindow.cpp @@ -1,5 +1,8 @@ #include <QApplication> #include <QSettings> +#include <QDebug> +#include <QTimer> + #include "lthemeengine.h" #include "mainwindow.h" #include "appearancepage.h" @@ -11,14 +14,22 @@ MainWindow::MainWindow(QWidget *parent) : QWidget(parent), m_ui(new Ui::MainWindow){ m_ui->setupUi(this); - m_ui->tabWidget->addTab(new AppearancePage(this), tr("Appearance")); - m_ui->tabWidget->addTab(new FontsPage(this), tr("Fonts")); - m_ui->tabWidget->addTab(new IconThemePage(this), tr("Icon Theme")); - m_ui->tabWidget->addTab(new InterfacePage(this), tr("Interface")); -#ifdef USE_WIDGETS - m_ui->tabWidget->addTab(new QSSPage(this, false), tr("Application Theme")); - m_ui->tabWidget->addTab(new QSSPage(this, true), tr("Desktop Theme")); -#endif + bgroup = new QButtonGroup(this); + bgroup->setExclusive(true); + //Clear out any pages in the stacked widget + while(m_ui->stackedWidget->count()>0){ + m_ui->stackedWidget->removeWidget(m_ui->stackedWidget->widget(0)); + } + //Now add all the pages into the widget + bgroup->addButton(m_ui->tool_page_general, m_ui->stackedWidget->addWidget(new AppearancePage(this)) ); + bgroup->addButton(m_ui->tool_page_effects, m_ui->stackedWidget->addWidget(new InterfacePage(this))); + bgroup->addButton(m_ui->tool_page_fonts, m_ui->stackedWidget->addWidget(new FontsPage(this))); + bgroup->addButton(m_ui->tool_page_icons, m_ui->stackedWidget->addWidget(new IconThemePage(this))); + bgroup->addButton(m_ui->tool_page_styles, m_ui->stackedWidget->addWidget(new QSSPage(this, false))); + bgroup->addButton(m_ui->tool_page_deskstyles, m_ui->stackedWidget->addWidget(new QSSPage(this, true))); + connect(bgroup, SIGNAL(buttonClicked(int)), m_ui->stackedWidget, SLOT(setCurrentIndex(int)) ); + + QTimer::singleShot(10, m_ui->tool_page_general, SLOT(toggle())); QSettings settings(lthemeengine::configFile(), QSettings::IniFormat); restoreGeometry(settings.value("SettingsWindow/geometry").toByteArray()); setWindowIcon(QIcon::fromTheme("preferences-desktop-theme")); @@ -37,8 +48,8 @@ void MainWindow::closeEvent(QCloseEvent *){ void MainWindow::on_buttonBox_clicked(QAbstractButton *button){ int id = m_ui->buttonBox->standardButton(button); if(id == QDialogButtonBox::Ok || id == QDialogButtonBox::Apply){ - for(int i = 0; i < m_ui->tabWidget->count(); ++i){ - TabPage *p = qobject_cast<TabPage*>(m_ui->tabWidget->widget(i)); + for(int i = 0; i < m_ui->stackedWidget->count(); ++i){ + TabPage *p = qobject_cast<TabPage*>(m_ui->stackedWidget->widget(i)); if(p) { p->writeSettings(); } } } diff --git a/src-qt5/core/lumina-theme-engine/src/lthemeengine/mainwindow.h b/src-qt5/core/lumina-theme-engine/src/lthemeengine/mainwindow.h index 749949a6..56ff1c98 100644 --- a/src-qt5/core/lumina-theme-engine/src/lthemeengine/mainwindow.h +++ b/src-qt5/core/lumina-theme-engine/src/lthemeengine/mainwindow.h @@ -2,8 +2,9 @@ #define MAINWINDOW_H #include <QWidget> - -class QAbstractButton; +#include <QAbstractButton> +#include <QButtonGroup> +//class QAbstractButton; namespace Ui { class MainWindow; @@ -24,6 +25,7 @@ private: void closeEvent(QCloseEvent *); Ui::MainWindow *m_ui; + QButtonGroup *bgroup; }; #endif // MAINWINDOW_H diff --git a/src-qt5/core/lumina-theme-engine/src/lthemeengine/mainwindow.ui b/src-qt5/core/lumina-theme-engine/src/lthemeengine/mainwindow.ui index 5bdab6d7..f239b7b4 100644 --- a/src-qt5/core/lumina-theme-engine/src/lthemeengine/mainwindow.ui +++ b/src-qt5/core/lumina-theme-engine/src/lthemeengine/mainwindow.ui @@ -6,14 +6,14 @@ <rect> <x>0</x> <y>0</y> - <width>438</width> - <height>374</height> + <width>657</width> + <height>500</height> </rect> </property> <property name="windowTitle"> <string>Qt5 Configuration Tool</string> </property> - <layout class="QGridLayout" name="gridLayout"> + <layout class="QVBoxLayout" name="verticalLayout_2"> <property name="leftMargin"> <number>6</number> </property> @@ -23,22 +23,243 @@ <property name="bottomMargin"> <number>6</number> </property> - <item row="0" column="0" colspan="2"> - <widget class="QTabWidget" name="tabWidget"/> - </item> - <item row="1" column="0"> - <widget class="QLabel" name="versionLabel"> - <property name="text"> - <string notr="true">...</string> + <item> + <layout class="QHBoxLayout" name="horizontalLayout_2"> + <property name="spacing"> + <number>4</number> </property> - </widget> + <item> + <layout class="QVBoxLayout" name="verticalLayout"> + <item> + <widget class="QToolButton" name="tool_page_general"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>General</string> + </property> + <property name="icon"> + <iconset theme="preferences-desktop-theme"/> + </property> + <property name="iconSize"> + <size> + <width>32</width> + <height>32</height> + </size> + </property> + <property name="checkable"> + <bool>true</bool> + </property> + <property name="toolButtonStyle"> + <enum>Qt::ToolButtonTextUnderIcon</enum> + </property> + <property name="autoRaise"> + <bool>true</bool> + </property> + </widget> + </item> + <item> + <widget class="QToolButton" name="tool_page_effects"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>Effects</string> + </property> + <property name="icon"> + <iconset theme="preferences-desktop-display"/> + </property> + <property name="iconSize"> + <size> + <width>32</width> + <height>32</height> + </size> + </property> + <property name="checkable"> + <bool>true</bool> + </property> + <property name="toolButtonStyle"> + <enum>Qt::ToolButtonTextUnderIcon</enum> + </property> + <property name="autoRaise"> + <bool>true</bool> + </property> + </widget> + </item> + <item> + <widget class="QToolButton" name="tool_page_fonts"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>Fonts</string> + </property> + <property name="icon"> + <iconset theme="preferences-desktop-font"/> + </property> + <property name="iconSize"> + <size> + <width>32</width> + <height>32</height> + </size> + </property> + <property name="checkable"> + <bool>true</bool> + </property> + <property name="toolButtonStyle"> + <enum>Qt::ToolButtonTextUnderIcon</enum> + </property> + <property name="autoRaise"> + <bool>true</bool> + </property> + </widget> + </item> + <item> + <widget class="QToolButton" name="tool_page_icons"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>Icons</string> + </property> + <property name="icon"> + <iconset theme="preferences-desktop-icons"/> + </property> + <property name="iconSize"> + <size> + <width>32</width> + <height>32</height> + </size> + </property> + <property name="checkable"> + <bool>true</bool> + </property> + <property name="toolButtonStyle"> + <enum>Qt::ToolButtonTextUnderIcon</enum> + </property> + <property name="autoRaise"> + <bool>true</bool> + </property> + </widget> + </item> + <item> + <widget class="QToolButton" name="tool_page_styles"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>General +Styles</string> + </property> + <property name="icon"> + <iconset theme="preferences-system-windows"/> + </property> + <property name="iconSize"> + <size> + <width>32</width> + <height>32</height> + </size> + </property> + <property name="checkable"> + <bool>true</bool> + </property> + <property name="toolButtonStyle"> + <enum>Qt::ToolButtonTextUnderIcon</enum> + </property> + <property name="autoRaise"> + <bool>true</bool> + </property> + </widget> + </item> + <item> + <widget class="QToolButton" name="tool_page_deskstyles"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>Desktop +Styles</string> + </property> + <property name="icon"> + <iconset theme="preferences-desktop"/> + </property> + <property name="iconSize"> + <size> + <width>32</width> + <height>32</height> + </size> + </property> + <property name="checkable"> + <bool>true</bool> + </property> + <property name="toolButtonStyle"> + <enum>Qt::ToolButtonTextUnderIcon</enum> + </property> + <property name="autoRaise"> + <bool>true</bool> + </property> + </widget> + </item> + <item> + <spacer name="verticalSpacer"> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>40</height> + </size> + </property> + </spacer> + </item> + </layout> + </item> + <item> + <widget class="QStackedWidget" name="stackedWidget"> + <property name="frameShape"> + <enum>QFrame::StyledPanel</enum> + </property> + <widget class="QWidget" name="page"/> + </widget> + </item> + </layout> </item> - <item row="1" column="1"> - <widget class="QDialogButtonBox" name="buttonBox"> - <property name="standardButtons"> - <set>QDialogButtonBox::Apply|QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set> - </property> - </widget> + <item> + <layout class="QHBoxLayout" name="horizontalLayout"> + <item> + <widget class="QLabel" name="versionLabel"> + <property name="text"> + <string notr="true">...</string> + </property> + </widget> + </item> + <item> + <widget class="QDialogButtonBox" name="buttonBox"> + <property name="standardButtons"> + <set>QDialogButtonBox::Apply|QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set> + </property> + </widget> + </item> + </layout> </item> </layout> </widget> |