From e2f1670041738256beac9830c16afca20963baad Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Tue, 21 Nov 2017 09:01:47 -0500 Subject: 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) --- .../src/lthemeengine/appearancepage.cpp | 4 ++ .../src/lthemeengine/mainwindow.cpp | 25 ++++++------ .../src/lthemeengine/mainwindow.h | 3 +- .../src/lthemeengine/mainwindow.ui | 45 ++++++++++++++++++++-- .../src/lthemeengine/qsspage.cpp | 7 ++++ 5 files changed, 67 insertions(+), 17 deletions(-) (limited to 'src-qt5/core/lumina-theme-engine/src/lthemeengine') 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(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(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 @@ 0 0 672 - 723 + 747 @@ -285,15 +285,52 @@ Styles + + + 0 + 0 + + ... - - - QDialogButtonBox::Apply|QDialogButtonBox::Close + + + + 0 + 0 + + + + Close + + + + + + Qt::ToolButtonTextBesideIcon + + + + + + + + 0 + 0 + + + + Apply + + + + + + Qt::ToolButtonTextBesideIcon 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