diff options
author | Ken Moore <ken@ixsystems.com> | 2017-08-03 12:25:14 -0400 |
---|---|---|
committer | Ken Moore <ken@ixsystems.com> | 2017-08-03 14:04:05 -0400 |
commit | 9787abdd5bc1378c7252ae710dc58ad582b447df (patch) | |
tree | 0552f7e557298527cc2f50a436620de2be7c9966 /src-qt5/core/lumina-theme-engine/src/lthemeengine | |
parent | Cleanup the lumina-theme-engine subproject (diff) | |
download | lumina-9787abdd5bc1378c7252ae710dc58ad582b447df.tar.gz lumina-9787abdd5bc1378c7252ae710dc58ad582b447df.tar.bz2 lumina-9787abdd5bc1378c7252ae710dc58ad582b447df.zip |
Fix up a bit more of the lumina-theme-engine
1. Adjust the build directories for all projects
2. Add lumina-theme-engine to the "core" meta-project
3. flip the names of the "dusk" and "darker" color schemes
4. Add a simple drop-down menu for standard colors when editing a stylesheet
5. Ensure the find colors/qss routines skip duplicate directory entries
Diffstat (limited to 'src-qt5/core/lumina-theme-engine/src/lthemeengine')
8 files changed, 74 insertions, 13 deletions
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 af130ed5..04ca6a0b 100644 --- a/src-qt5/core/lumina-theme-engine/src/lthemeengine/appearancepage.cpp +++ b/src-qt5/core/lumina-theme-engine/src/lthemeengine/appearancepage.cpp @@ -222,7 +222,8 @@ void AppearancePage::setPalette(QWidget *w, QPalette p){ w->setPalette(p); } -void AppearancePage::findColorSchemes(const QStringList &paths){ +void AppearancePage::findColorSchemes(QStringList paths){ + paths.removeDuplicates(); for(int i=0; i<paths.length(); i++){ if( !QFile::exists(paths[i])){ continue; } QDir dir(paths[i]); diff --git a/src-qt5/core/lumina-theme-engine/src/lthemeengine/appearancepage.h b/src-qt5/core/lumina-theme-engine/src/lthemeengine/appearancepage.h index 21eb5a6d..3f0fa427 100644 --- a/src-qt5/core/lumina-theme-engine/src/lthemeengine/appearancepage.h +++ b/src-qt5/core/lumina-theme-engine/src/lthemeengine/appearancepage.h @@ -35,7 +35,7 @@ private: void readSettings(); void setStyle(QWidget *w, QStyle *s); void setPalette(QWidget *w, QPalette p); - void findColorSchemes(const QStringList &paths); + void findColorSchemes(QStringList paths); QPalette loadColorScheme(const QString &filePath); void createColorScheme(const QString &name, const QPalette &palette); Ui::AppearancePage *m_ui; diff --git a/src-qt5/core/lumina-theme-engine/src/lthemeengine/lthemeengine.pro b/src-qt5/core/lumina-theme-engine/src/lthemeengine/lthemeengine.pro index 28c97ef8..721b8888 100644 --- a/src-qt5/core/lumina-theme-engine/src/lthemeengine/lthemeengine.pro +++ b/src-qt5/core/lumina-theme-engine/src/lthemeengine/lthemeengine.pro @@ -2,7 +2,7 @@ include(../../lthemeengine.pri) TEMPLATE = app -QT += widgets +QT *= widgets SOURCES += \ main.cpp \ diff --git a/src-qt5/core/lumina-theme-engine/src/lthemeengine/qsseditordialog.cpp b/src-qt5/core/lumina-theme-engine/src/lthemeengine/qsseditordialog.cpp index 97d4ea1a..ac891a80 100644 --- a/src-qt5/core/lumina-theme-engine/src/lthemeengine/qsseditordialog.cpp +++ b/src-qt5/core/lumina-theme-engine/src/lthemeengine/qsseditordialog.cpp @@ -13,6 +13,30 @@ QSSEditorDialog::QSSEditorDialog(const QString &filePath, QWidget *parent) : QDi setWindowTitle(tr("%1 - Style Sheet Editor").arg(file.fileName())); QSettings settings(lthemeengine::configFile(), QSettings::IniFormat); restoreGeometry(settings.value("QSSEditor/geometry").toByteArray()); + //Generate the list of standard colors for the user to pick + QStringList colors; + colors << tr("base (alternate)")+"::::alternate-base" + << tr("base")+"::::base" + << tr("text (bright)")+"::::bright-text" + << tr("button")+"::::button" + << tr("text (button)")+"::::button-text" + << tr("dark")+"::::dark" + << tr("highlight")+"::::highlight" + << tr("text (highlight)")+"::::highlighted-text" + << tr("light")+"::::light" + << tr("link")+"::::link" + << tr("link (visited)")+"::::link-visited" + << tr("mid")+"::::mid" + << tr("midlight")+"::::midlight" + << tr("shadow")+"::::shadow" + << tr("text")+"::::text" + << tr("window")+"::::window" + << tr("text (window)")+"::::window-text"; + colors.sort(); //sort by translated display name + colorMenu = new QMenu(m_ui->tool_color); + for(int i=0; i<colors.length(); i++){ colorMenu->addAction( colors[i].section("::::",0,0) )->setWhatsThis(colors[i].section("::::",1,1) ); } + m_ui->tool_color->setMenu(colorMenu); + connect(colorMenu, SIGNAL(triggered(QAction*)), this, SLOT(colorPicked(QAction*)) ); } QSSEditorDialog::~QSSEditorDialog(){ @@ -39,3 +63,9 @@ void QSSEditorDialog::on_buttonBox_clicked(QAbstractButton *button){ else if(id == QDialogButtonBox::Save){ save(); } else{ reject(); } } + +void QSSEditorDialog::colorPicked(QAction* act){ + QString id = act->whatsThis(); + if(id.isEmpty()){ return; } + m_ui->textEdit->insertPlainText( QString("palette(%1)").arg(id) ); +} diff --git a/src-qt5/core/lumina-theme-engine/src/lthemeengine/qsseditordialog.h b/src-qt5/core/lumina-theme-engine/src/lthemeengine/qsseditordialog.h index ea615e81..114611fe 100644 --- a/src-qt5/core/lumina-theme-engine/src/lthemeengine/qsseditordialog.h +++ b/src-qt5/core/lumina-theme-engine/src/lthemeengine/qsseditordialog.h @@ -3,6 +3,8 @@ #include <QDialog> #include <QString> +#include <QMenu> +#include <QAction> namespace Ui { class QSSEditorDialog; @@ -20,12 +22,15 @@ public: private slots: void on_buttonBox_clicked(QAbstractButton *button); + void colorPicked(QAction*); private: void save(); void hideEvent(QHideEvent *); Ui::QSSEditorDialog *m_ui; QString m_filePath; + QMenu *colorMenu; + }; #endif // QSSEDITORDIALOG_H diff --git a/src-qt5/core/lumina-theme-engine/src/lthemeengine/qsseditordialog.ui b/src-qt5/core/lumina-theme-engine/src/lthemeengine/qsseditordialog.ui index 7627b4d4..f75a21c6 100644 --- a/src-qt5/core/lumina-theme-engine/src/lthemeengine/qsseditordialog.ui +++ b/src-qt5/core/lumina-theme-engine/src/lthemeengine/qsseditordialog.ui @@ -31,14 +31,38 @@ </widget> </item> <item> - <widget class="QDialogButtonBox" name="buttonBox"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="standardButtons"> - <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok|QDialogButtonBox::Save</set> - </property> - </widget> + <layout class="QHBoxLayout" name="horizontalLayout"> + <item> + <widget class="QToolButton" name="tool_color"> + <property name="text"> + <string>Palette</string> + </property> + <property name="icon"> + <iconset theme="preferences-desktop-color"> + <normaloff>.</normaloff>.</iconset> + </property> + <property name="popupMode"> + <enum>QToolButton::InstantPopup</enum> + </property> + <property name="toolButtonStyle"> + <enum>Qt::ToolButtonTextBesideIcon</enum> + </property> + <property name="autoRaise"> + <bool>true</bool> + </property> + </widget> + </item> + <item> + <widget class="QDialogButtonBox" name="buttonBox"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="standardButtons"> + <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok|QDialogButtonBox::Save</set> + </property> + </widget> + </item> + </layout> </item> </layout> </widget> diff --git a/src-qt5/core/lumina-theme-engine/src/lthemeengine/qsspage.cpp b/src-qt5/core/lumina-theme-engine/src/lthemeengine/qsspage.cpp index 414273be..2cf0f221 100644 --- a/src-qt5/core/lumina-theme-engine/src/lthemeengine/qsspage.cpp +++ b/src-qt5/core/lumina-theme-engine/src/lthemeengine/qsspage.cpp @@ -105,7 +105,8 @@ void QSSPage::readSettings(){ } } -void QSSPage::findStyleSheets(const QStringList &paths){ +void QSSPage::findStyleSheets(QStringList paths){ + paths.removeDuplicates(); for(int i=0; i<paths.length(); i++){ if(!QFile::exists(paths[i])){ continue; } QDir dir(paths[i]); diff --git a/src-qt5/core/lumina-theme-engine/src/lthemeengine/qsspage.h b/src-qt5/core/lumina-theme-engine/src/lthemeengine/qsspage.h index 884f9a93..5e924ad9 100644 --- a/src-qt5/core/lumina-theme-engine/src/lthemeengine/qsspage.h +++ b/src-qt5/core/lumina-theme-engine/src/lthemeengine/qsspage.h @@ -30,7 +30,7 @@ private slots: private: void readSettings(); - void findStyleSheets(const QStringList &paths); + void findStyleSheets(QStringList paths); Ui::QSSPage *m_ui; QMenu *m_menu; }; |