aboutsummaryrefslogtreecommitdiff
path: root/src-qt5
diff options
context:
space:
mode:
Diffstat (limited to 'src-qt5')
-rw-r--r--src-qt5/core/lumina-theme-engine/desktop_qss/DarkGlass.qss2
-rw-r--r--src-qt5/core/lumina-theme-engine/src/lthemeengine/mainwindow.ui20
-rw-r--r--src-qt5/core/lumina-theme-engine/src/lthemeengine/qsspage.cpp119
-rw-r--r--src-qt5/core/lumina-theme-engine/src/lthemeengine/qsspage.h10
-rw-r--r--src-qt5/core/lumina-theme-engine/src/lthemeengine/qsspage.ui269
5 files changed, 337 insertions, 83 deletions
diff --git a/src-qt5/core/lumina-theme-engine/desktop_qss/DarkGlass.qss b/src-qt5/core/lumina-theme-engine/desktop_qss/DarkGlass.qss
index c99ee179..70db70fc 100644
--- a/src-qt5/core/lumina-theme-engine/desktop_qss/DarkGlass.qss
+++ b/src-qt5/core/lumina-theme-engine/desktop_qss/DarkGlass.qss
@@ -68,7 +68,7 @@ LTBWidget:hover, LTBWidget#WindowVisible:hover, LTBWidget#WindowInvisible:hover,
/* CALENDER WIDGET */
/* (This is a special hack since there is no official support for stylesheets for this widget) */
QCalendarWidget QWidget#qt_calendar_navigationbar{
- background-color: palette(alternate-base);
+ background-color: palette(base);
}
QCalendarWidget QWidget{
background-color: palette(base);
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 f239b7b4..bfaf3eaf 100644
--- a/src-qt5/core/lumina-theme-engine/src/lthemeengine/mainwindow.ui
+++ b/src-qt5/core/lumina-theme-engine/src/lthemeengine/mainwindow.ui
@@ -42,7 +42,8 @@
<string>General</string>
</property>
<property name="icon">
- <iconset theme="preferences-desktop-theme"/>
+ <iconset theme="preferences-desktop-theme">
+ <normaloff>.</normaloff>.</iconset>
</property>
<property name="iconSize">
<size>
@@ -73,7 +74,8 @@
<string>Effects</string>
</property>
<property name="icon">
- <iconset theme="preferences-desktop-display"/>
+ <iconset theme="preferences-desktop-display">
+ <normaloff>.</normaloff>.</iconset>
</property>
<property name="iconSize">
<size>
@@ -104,7 +106,8 @@
<string>Fonts</string>
</property>
<property name="icon">
- <iconset theme="preferences-desktop-font"/>
+ <iconset theme="preferences-desktop-font">
+ <normaloff>.</normaloff>.</iconset>
</property>
<property name="iconSize">
<size>
@@ -135,7 +138,8 @@
<string>Icons</string>
</property>
<property name="icon">
- <iconset theme="preferences-desktop-icons"/>
+ <iconset theme="preferences-desktop-icons">
+ <normaloff>.</normaloff>.</iconset>
</property>
<property name="iconSize">
<size>
@@ -167,7 +171,8 @@
Styles</string>
</property>
<property name="icon">
- <iconset theme="preferences-system-windows"/>
+ <iconset theme="preferences-system-windows">
+ <normaloff>.</normaloff>.</iconset>
</property>
<property name="iconSize">
<size>
@@ -199,7 +204,8 @@ Styles</string>
Styles</string>
</property>
<property name="icon">
- <iconset theme="preferences-desktop"/>
+ <iconset theme="preferences-desktop">
+ <normaloff>.</normaloff>.</iconset>
</property>
<property name="iconSize">
<size>
@@ -236,7 +242,7 @@ Styles</string>
<item>
<widget class="QStackedWidget" name="stackedWidget">
<property name="frameShape">
- <enum>QFrame::StyledPanel</enum>
+ <enum>QFrame::Box</enum>
</property>
<widget class="QWidget" name="page"/>
</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 2e906d9e..ae5350ab 100644
--- a/src-qt5/core/lumina-theme-engine/src/lthemeengine/qsspage.cpp
+++ b/src-qt5/core/lumina-theme-engine/src/lthemeengine/qsspage.cpp
@@ -5,6 +5,7 @@
#include <QFile>
#include <QMenu>
#include <QDebug>
+#include <QTimer>
#include "lthemeengine.h"
#include "qsseditordialog.h"
@@ -37,15 +38,37 @@ QSSPage::~QSSPage(){
void QSSPage::writeSettings(){
QStringList styleSheets;
QSettings settings(lthemeengine::configFile(), QSettings::IniFormat);
- for(int i = 0; i < m_ui->qssListWidget->count(); ++i){
+ for(int i = m_ui->qssListWidget->count()-1; i>=0; i--){
QListWidgetItem *item = m_ui->qssListWidget->item(i);
- if(item->checkState() == Qt::Checked){ styleSheets << item->data(QSS_FULL_PATH_ROLE).toString(); }
+ styleSheets << item->data(QSS_FULL_PATH_ROLE).toString();
+ }
if(desktop_qss){ settings.setValue("Interface/desktop_stylesheets", styleSheets); }
else{ settings.setValue("Interface/stylesheets", styleSheets); }
- }
}
void QSSPage::on_qssListWidget_currentItemChanged(QListWidgetItem *current, QListWidgetItem *){
+ if(current!=0){
+ m_ui->list_disabled->clearSelection(); //clear any current selection on the other widget
+ m_ui->list_disabled->setCurrentRow(-1);
+ }
+ //qDebug() << "Got Current Item Changed";
+ if(current){
+ m_ui->editButton->setEnabled(current->data(QSS_WRITABLE_ROLE).toBool());
+ m_ui->removeButton->setEnabled(current->data(QSS_WRITABLE_ROLE).toBool());
+ m_ui->renameButton->setEnabled(current->data(QSS_WRITABLE_ROLE).toBool());
+ }
+ else{
+ m_ui->editButton->setEnabled(false);
+ m_ui->removeButton->setEnabled(false);
+ m_ui->renameButton->setEnabled(false);
+ }
+}
+
+void QSSPage::on_list_disabled_currentItemChanged(QListWidgetItem *current, QListWidgetItem *){
+ if(current!=0){
+ m_ui->qssListWidget->clearSelection(); //clear any current selection on the other widget
+ m_ui->qssListWidget->setCurrentRow(-1);
+ }
//qDebug() << "Got Current Item Changed";
if(current){
m_ui->editButton->setEnabled(current->data(QSS_WRITABLE_ROLE).toBool());
@@ -86,11 +109,12 @@ void QSSPage::on_createButton_clicked(){
item->setToolTip(info.filePath());
item->setData(QSS_FULL_PATH_ROLE, info.filePath());
item->setData(QSS_WRITABLE_ROLE, info.isWritable());
- item->setCheckState(Qt::Unchecked);
+ m_ui->qssListWidget->setCurrentRow(m_ui->qssListWidget->count()-1);
+ QTimer::singleShot(10, this, SLOT(on_editButton_clicked()) );
}
void QSSPage::on_editButton_clicked(){
- QListWidgetItem *item = m_ui->qssListWidget->currentItem();
+ QListWidgetItem *item = currentSelection();
if(item){
QSSEditorDialog dialog(item->data(QSS_FULL_PATH_ROLE).toString(), this);
dialog.exec();
@@ -98,31 +122,76 @@ void QSSPage::on_editButton_clicked(){
}
void QSSPage::on_removeButton_clicked(){
- QListWidgetItem *item = m_ui->qssListWidget->currentItem();
+ QListWidgetItem *item = currentSelection();
if(!item){ return; }
int button = QMessageBox::question(this, tr("Confirm Remove"),tr("Are you sure you want to remove style sheet \"%1\"?").arg(item->text()), QMessageBox::Yes | QMessageBox::No);
if(button == QMessageBox::Yes){ QFile::remove(item->data(QSS_FULL_PATH_ROLE).toString()); }
delete item;
}
+void QSSPage::on_tool_enable_clicked(){
+ QList<QListWidgetItem*> sel = m_ui->list_disabled->selectedItems();
+ //qDebug() << "Got Selection:" << sel.count();
+ for(int i=0; i<sel.length(); i++){
+ m_ui->qssListWidget->addItem(sel[i]->clone());
+ delete sel[i];
+ //QCoreApplication::processEvents();
+ m_ui->qssListWidget->setCurrentRow(m_ui->qssListWidget->count()-1);
+ }
+
+}
+
+void QSSPage::on_tool_disable_clicked(){
+ QList<QListWidgetItem*> sel = m_ui->qssListWidget->selectedItems();
+ //qDebug() << "Got Selection:" << sel.count();
+ for(int i=0; i<sel.length(); i++){
+ m_ui->list_disabled->addItem(sel[i]->clone());
+ delete sel[i];
+ //QCoreApplication::processEvents();
+ m_ui->list_disabled->setCurrentRow(m_ui->list_disabled->count()-1);
+ }
+}
+
+void QSSPage::on_tool_priority_up_clicked(){
+ QList<QListWidgetItem*> sel = m_ui->qssListWidget->selectedItems();
+ for(int i=0; i<sel.length(); i++){
+ int index = m_ui->qssListWidget->row(sel[i]);
+ //qDebug() << "Move Item Up:" << index;
+ if(index>0){
+ m_ui->qssListWidget->insertItem(index-1, m_ui->qssListWidget->takeItem(index));
+ m_ui->qssListWidget->setCurrentRow(index-1);
+ }
+ }
+}
+
+void QSSPage::on_tool_priority_down_clicked(){
+ QList<QListWidgetItem*> sel = m_ui->qssListWidget->selectedItems();
+ for(int i=0; i<sel.length(); i++){
+ int index = m_ui->qssListWidget->row(sel[i]);
+ //qDebug() << "Move Item Down:" << index;
+ if(index<(m_ui->qssListWidget->count()-1) ){
+ m_ui->qssListWidget->insertItem(index+1, m_ui->qssListWidget->takeItem(index));
+ m_ui->qssListWidget->setCurrentRow(index+1);
+ }
+ }
+}
+
void QSSPage::readSettings(){
//load stylesheets
m_ui->qssListWidget->clear();
- if(desktop_qss){ findStyleSheets(QStringList() << lthemeengine::userDesktopStyleSheetPath() << lthemeengine::sharedDesktopStyleSheetPath()); }
- else{findStyleSheets(QStringList() << lthemeengine::userStyleSheetPath() << lthemeengine::sharedStyleSheetPath()); }
+ m_ui->list_disabled->clear();
+ //Read the currently-enabled settings
QSettings settings(lthemeengine::configFile(), QSettings::IniFormat);
QStringList styleSheets;
if(desktop_qss){ styleSheets = settings.value("Interface/desktop_stylesheets").toStringList(); }
else{ styleSheets = settings.value("Interface/stylesheets").toStringList(); }
+ //Now load the items into list widgets
+ if(desktop_qss){ findStyleSheets(QStringList() << lthemeengine::userDesktopStyleSheetPath() << lthemeengine::sharedDesktopStyleSheetPath(), styleSheets); }
+ else{findStyleSheets(QStringList() << lthemeengine::userStyleSheetPath() << lthemeengine::sharedStyleSheetPath(), styleSheets); }
- for(int i = 0; i < m_ui->qssListWidget->count(); ++i){
- QListWidgetItem *item = m_ui->qssListWidget->item(i);
- if(styleSheets.contains(item->data(QSS_FULL_PATH_ROLE).toString())){ item->setCheckState(Qt::Checked); }
- else { item->setCheckState(Qt::Unchecked); }
- }
}
-void QSSPage::findStyleSheets(QStringList paths){
+void QSSPage::findStyleSheets(QStringList paths, QStringList enabled){
paths.removeDuplicates();
for(int i=0; i<paths.length(); i++){
if(!QFile::exists(paths[i])){ continue; }
@@ -130,20 +199,30 @@ void QSSPage::findStyleSheets(QStringList paths){
dir.setFilter(QDir::Files);
dir.setNameFilters(QStringList() << "*.qss");
foreach (QFileInfo info, dir.entryInfoList()){
- QListWidgetItem *item = new QListWidgetItem(info.fileName(), m_ui->qssListWidget);
+ QListWidgetItem *item = new QListWidgetItem(info.fileName());
item->setToolTip(info.filePath());
item->setData(QSS_FULL_PATH_ROLE, info.filePath());
item->setData(QSS_WRITABLE_ROLE, info.isWritable());
+ if( enabled.contains(info.filePath()) ){ m_ui->qssListWidget->addItem(item); }
+ else{ m_ui->list_disabled->addItem(item); }
}
}
+ //Now ensure the priority of the items in the active list is correct
+ for(int i = 0; i < m_ui->qssListWidget->count(); ++i){
+ QListWidgetItem *item = m_ui->qssListWidget->item(i);
+ int index = enabled.indexOf( item->data(QSS_FULL_PATH_ROLE).toString() );
+ if(index>=0){ m_ui->qssListWidget->insertItem(index, item); }// item->move(m_ui->qssListWidget->count() - 1 - index); }
+ }
+ m_ui->list_disabled->sortItems(Qt::AscendingOrder);
+
}
void QSSPage::on_renameButton_clicked(){
- QListWidgetItem *item = m_ui->qssListWidget->currentItem();
+ QListWidgetItem *item = currentSelection();
if(!item){ return; }
QString name = QInputDialog::getText(this, tr("Rename Style Sheet"), tr("Style sheet name:"), QLineEdit::Normal, item->text(), 0);
if(name.isEmpty()){ return; }
- if(!m_ui->qssListWidget->findItems(name, Qt::MatchExactly).isEmpty()){
+ if(!m_ui->qssListWidget->findItems(name, Qt::MatchExactly).isEmpty() || !m_ui->list_disabled->findItems(name, Qt::MatchExactly).isEmpty()){
QMessageBox::warning(this, tr("Error"), tr("The style sheet \"%1\" already exists").arg(name));
return;
}
@@ -162,3 +241,9 @@ void QSSPage::on_qssListWidget_customContextMenuRequested(const QPoint &pos){
QListWidgetItem *item = m_ui->qssListWidget->currentItem();
if(item && item->data(QSS_WRITABLE_ROLE).toBool()){ m_menu->exec(m_ui->qssListWidget->viewport()->mapToGlobal(pos)); }
}
+
+QListWidgetItem* QSSPage::currentSelection(){
+ QListWidgetItem *item = m_ui->qssListWidget->currentItem();
+ if(item==0){ item = m_ui->list_disabled->currentItem(); }
+ return item;
+}
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 76417ddf..5b0025c5 100644
--- a/src-qt5/core/lumina-theme-engine/src/lthemeengine/qsspage.h
+++ b/src-qt5/core/lumina-theme-engine/src/lthemeengine/qsspage.h
@@ -22,18 +22,26 @@ public:
private slots:
void on_qssListWidget_currentItemChanged(QListWidgetItem *current, QListWidgetItem *);
+ void on_list_disabled_currentItemChanged(QListWidgetItem *current, QListWidgetItem *);
void on_createButton_clicked();
void on_editButton_clicked();
void on_removeButton_clicked();
void on_renameButton_clicked();
void on_qssListWidget_customContextMenuRequested(const QPoint &pos);
+ void on_tool_enable_clicked();
+ void on_tool_disable_clicked();
+ void on_tool_priority_up_clicked();
+ void on_tool_priority_down_clicked();
+
private:
void readSettings();
- void findStyleSheets(QStringList paths);
+ void findStyleSheets(QStringList paths, QStringList enabled);
Ui::QSSPage *m_ui;
QMenu *m_menu;
bool desktop_qss;
+
+ QListWidgetItem* currentSelection();
};
#endif // QSSPAGE_H
diff --git a/src-qt5/core/lumina-theme-engine/src/lthemeengine/qsspage.ui b/src-qt5/core/lumina-theme-engine/src/lthemeengine/qsspage.ui
index 124b4dc6..108bbbf9 100644
--- a/src-qt5/core/lumina-theme-engine/src/lthemeengine/qsspage.ui
+++ b/src-qt5/core/lumina-theme-engine/src/lthemeengine/qsspage.ui
@@ -13,69 +13,224 @@
<property name="windowTitle">
<string notr="true">Style Sheet Editor</string>
</property>
- <layout class="QGridLayout" name="gridLayout">
- <item row="1" column="0">
- <widget class="QPushButton" name="createButton">
- <property name="enabled">
- <bool>true</bool>
- </property>
- <property name="text">
- <string>Create</string>
- </property>
- </widget>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_2">
+ <item>
+ <layout class="QVBoxLayout" name="verticalLayout_2">
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_4">
+ <item>
+ <widget class="QToolButton" name="tool_priority_up">
+ <property name="toolTip">
+ <string>Increase Priority</string>
+ </property>
+ <property name="text">
+ <string notr="true"/>
+ </property>
+ <property name="icon">
+ <iconset theme="arrow-up"/>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QToolButton" name="tool_priority_down">
+ <property name="toolTip">
+ <string>Decrease priority of style</string>
+ </property>
+ <property name="text">
+ <string notr="true"/>
+ </property>
+ <property name="icon">
+ <iconset theme="arrow-down"/>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer name="horizontalSpacer_2">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <widget class="QToolButton" name="tool_disable">
+ <property name="toolTip">
+ <string>Disable Style</string>
+ </property>
+ <property name="text">
+ <string>Disable</string>
+ </property>
+ <property name="icon">
+ <iconset theme="arrow-right"/>
+ </property>
+ <property name="toolButtonStyle">
+ <enum>Qt::ToolButtonTextBesideIcon</enum>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <widget class="QLabel" name="label">
+ <property name="font">
+ <font>
+ <italic>true</italic>
+ </font>
+ </property>
+ <property name="text">
+ <string>Enabled</string>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignCenter</set>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QListWidget" name="qssListWidget">
+ <property name="contextMenuPolicy">
+ <enum>Qt::CustomContextMenu</enum>
+ </property>
+ <property name="alternatingRowColors">
+ <bool>false</bool>
+ </property>
+ <property name="resizeMode">
+ <enum>QListView::Fixed</enum>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <widget class="Line" name="line">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <layout class="QVBoxLayout" name="verticalLayout_3">
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_3">
+ <item>
+ <widget class="QToolButton" name="tool_enable">
+ <property name="text">
+ <string>Enable</string>
+ </property>
+ <property name="icon">
+ <iconset theme="arrow-left"/>
+ </property>
+ <property name="toolButtonStyle">
+ <enum>Qt::ToolButtonTextBesideIcon</enum>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer name="horizontalSpacer_3">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <widget class="QLabel" name="label_2">
+ <property name="font">
+ <font>
+ <italic>true</italic>
+ </font>
+ </property>
+ <property name="text">
+ <string>Available</string>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignCenter</set>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QListWidget" name="list_disabled"/>
+ </item>
+ </layout>
+ </item>
+ </layout>
</item>
- <item row="1" column="3">
- <widget class="QPushButton" name="removeButton">
- <property name="enabled">
- <bool>false</bool>
- </property>
- <property name="text">
- <string>Remove</string>
- </property>
- </widget>
- </item>
- <item row="1" column="5">
- <spacer name="horizontalSpacer">
+ <item>
+ <widget class="Line" name="line_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>189</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- <item row="0" column="0" colspan="6">
- <widget class="QListWidget" name="qssListWidget">
- <property name="contextMenuPolicy">
- <enum>Qt::CustomContextMenu</enum>
- </property>
- <property name="alternatingRowColors">
- <bool>true</bool>
- </property>
</widget>
</item>
- <item row="1" column="1">
- <widget class="QPushButton" name="editButton">
- <property name="enabled">
- <bool>false</bool>
- </property>
- <property name="text">
- <string>Edit</string>
- </property>
- </widget>
- </item>
- <item row="1" column="2">
- <widget class="QPushButton" name="renameButton">
- <property name="enabled">
- <bool>false</bool>
- </property>
- <property name="text">
- <string>Rename</string>
- </property>
- </widget>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <item>
+ <widget class="QPushButton" name="createButton">
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="text">
+ <string>Create</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="editButton">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="text">
+ <string>Edit</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="renameButton">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="text">
+ <string>Rename</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="removeButton">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="text">
+ <string>Remove</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer name="horizontalSpacer">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>189</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
</item>
</layout>
</widget>
bgstack15