diff options
author | Ken Moore <ken@ixsystems.com> | 2017-11-21 09:01:47 -0500 |
---|---|---|
committer | Ken Moore <ken@ixsystems.com> | 2017-11-21 09:01:47 -0500 |
commit | e2f1670041738256beac9830c16afca20963baad (patch) | |
tree | 927e7b6ecf4b3e66dd786873f97526dd2ac8cf3b /src-qt5/core/lumina-theme-engine | |
parent | Add another layer of defaults to the wallpapers. (diff) | |
download | lumina-e2f1670041738256beac9830c16afca20963baad.tar.gz lumina-e2f1670041738256beac9830c16afca20963baad.tar.bz2 lumina-e2f1670041738256beac9830c16afca20963baad.zip |
Cleanup a little bit of lthemeengine
1. Ensure setting paths are converted to absolute paths before comparisons
2. Get rid of the buttonbox in mainwindow and replace it with a couple toolbuttons with icons (same functionality)
Diffstat (limited to 'src-qt5/core/lumina-theme-engine')
5 files changed, 67 insertions, 17 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 88bde228..98f9c865 100644 --- a/src-qt5/core/lumina-theme-engine/src/lthemeengine/appearancepage.cpp +++ b/src-qt5/core/lumina-theme-engine/src/lthemeengine/appearancepage.cpp @@ -195,6 +195,10 @@ void AppearancePage::readSettings(){ m_ui->styleComboBox->setCurrentText(style); m_ui->customPaletteButton->setChecked(settings.value("custom_palette", false).toBool()); QString colorSchemePath = settings.value("color_scheme_path").toString(); + if(colorSchemePath.contains("..") || colorSchemePath.contains("//") ){ + //Make this an absolute path for comparison later + colorSchemePath = QFileInfo(colorSchemePath).absoluteFilePath(); + } QDir("/").mkpath(lthemeengine::userColorSchemePath()); findColorSchemes( QStringList() << lthemeengine::userColorSchemePath() << lthemeengine::sharedColorSchemePath()); if(m_ui->colorSchemeComboBox->count() == 0){ 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 6db249fe..a82f8cc6 100644 --- a/src-qt5/core/lumina-theme-engine/src/lthemeengine/mainwindow.cpp +++ b/src-qt5/core/lumina-theme-engine/src/lthemeengine/mainwindow.cpp @@ -32,6 +32,8 @@ MainWindow::MainWindow(QWidget *parent) : QWidget(parent), m_ui(new Ui::MainWind bgroup->addButton(m_ui->tool_page_deskstyles, m_ui->stackedWidget->addWidget(new QSSPage(this, true))); bgroup->addButton(m_ui->tool_page_cursors, m_ui->stackedWidget->addWidget(new CursorThemePage(this)) ); connect(bgroup, SIGNAL(buttonClicked(int)), m_ui->stackedWidget, SLOT(setCurrentIndex(int)) ); + connect(m_ui->push_close, SIGNAL(clicked()), this, SLOT(closeWindow()) ); + connect(m_ui->push_apply, SIGNAL(clicked()), this, SLOT(applyWindow()) ); QTimer::singleShot(10, m_ui->tool_page_general, SLOT(toggle())); QSettings settings(lthemeengine::configFile(), QSettings::IniFormat); @@ -39,6 +41,7 @@ MainWindow::MainWindow(QWidget *parent) : QWidget(parent), m_ui(new Ui::MainWind setWindowIcon(QIcon::fromTheme("preferences-desktop-theme")); this->setWindowTitle(tr("Theme Settings")); m_ui->versionLabel->setText(tr("Version: %1").arg(LDesktopUtils::LuminaDesktopVersion())); + //m_ui->buttonBox->set } MainWindow::~MainWindow(){ @@ -50,16 +53,14 @@ void MainWindow::closeEvent(QCloseEvent *){ settings.setValue("SettingsWindow/geometry", saveGeometry()); } -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->stackedWidget->count(); ++i){ - TabPage *p = qobject_cast<TabPage*>(m_ui->stackedWidget->widget(i)); - if(p) { p->writeSettings(); } - } - } - if(id == QDialogButtonBox::Ok || id == QDialogButtonBox::Cancel || id== QDialogButtonBox::Close){ - close(); - qApp->quit(); - } +void MainWindow::closeWindow(){ + close(); + QApplication::quit(); +} + +void MainWindow::applyWindow(){ + 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 56ff1c98..333bc1fd 100644 --- a/src-qt5/core/lumina-theme-engine/src/lthemeengine/mainwindow.h +++ b/src-qt5/core/lumina-theme-engine/src/lthemeengine/mainwindow.h @@ -19,7 +19,8 @@ public: ~MainWindow(); private slots: - void on_buttonBox_clicked(QAbstractButton *button); + void closeWindow(); + void applyWindow(); private: void closeEvent(QCloseEvent *); 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 0dc3245d..c60eb870 100644 --- a/src-qt5/core/lumina-theme-engine/src/lthemeengine/mainwindow.ui +++ b/src-qt5/core/lumina-theme-engine/src/lthemeengine/mainwindow.ui @@ -7,7 +7,7 @@ <x>0</x> <y>0</y> <width>672</width> - <height>723</height> + <height>747</height> </rect> </property> <property name="windowTitle"> @@ -285,15 +285,52 @@ Styles</string> <layout class="QHBoxLayout" name="horizontalLayout"> <item> <widget class="QLabel" name="versionLabel"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Expanding" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> <property name="text"> <string notr="true">...</string> </property> </widget> </item> <item> - <widget class="QDialogButtonBox" name="buttonBox"> - <property name="standardButtons"> - <set>QDialogButtonBox::Apply|QDialogButtonBox::Close</set> + <widget class="QToolButton" name="push_close"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>Close</string> + </property> + <property name="icon"> + <iconset theme="dialog-cancel"/> + </property> + <property name="toolButtonStyle"> + <enum>Qt::ToolButtonTextBesideIcon</enum> + </property> + </widget> + </item> + <item> + <widget class="QToolButton" name="push_apply"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>Apply</string> + </property> + <property name="icon"> + <iconset theme="dialog-ok-apply"/> + </property> + <property name="toolButtonStyle"> + <enum>Qt::ToolButtonTextBesideIcon</enum> </property> </widget> </item> 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 6377016c..3140c553 100644 --- a/src-qt5/core/lumina-theme-engine/src/lthemeengine/qsspage.cpp +++ b/src-qt5/core/lumina-theme-engine/src/lthemeengine/qsspage.cpp @@ -224,7 +224,14 @@ void QSSPage::readSettings(){ QStringList styleSheets; if(desktop_qss){ styleSheets = settings.value("Interface/desktop_stylesheets").toStringList(); } else{ styleSheets = settings.value("Interface/stylesheets").toStringList(); } + for(int i=0; i<styleSheets.length(); i++){ + if(styleSheets[i].contains("..") || styleSheets[i].contains("//") ){ + //Get the absolute path for matching later + styleSheets[i] = QFileInfo(styleSheets[i]).absoluteFilePath(); + } + } //Now load the items into list widgets + //qDebug() << "Found Stylesheets" << styleSheets; if(desktop_qss){ findStyleSheets(QStringList() << lthemeengine::userDesktopStyleSheetPath() << lthemeengine::sharedDesktopStyleSheetPath(), styleSheets); } else{findStyleSheets(QStringList() << lthemeengine::userStyleSheetPath() << lthemeengine::sharedStyleSheetPath(), styleSheets); } |