diff options
author | Ken Moore <ken@ixsystems.com> | 2017-07-21 13:53:41 -0400 |
---|---|---|
committer | Ken Moore <ken@ixsystems.com> | 2017-07-21 13:53:41 -0400 |
commit | d1835fcde28cb50933953d1b6dd99a180c93c138 (patch) | |
tree | 6f22083988c760622800d9f766d0bd546c457854 /src-qt5/core/lumina-theme-engine/src/lthemeengine | |
parent | Add a new "XDGMime" class/files which can be used for non-graphical mimetype ... (diff) | |
parent | Merge remote-tracking branch 'origin/master' (diff) | |
download | lumina-d1835fcde28cb50933953d1b6dd99a180c93c138.tar.gz lumina-d1835fcde28cb50933953d1b6dd99a180c93c138.tar.bz2 lumina-d1835fcde28cb50933953d1b6dd99a180c93c138.zip |
Merge branch 'master' of github.com:trueos/lumina
Diffstat (limited to 'src-qt5/core/lumina-theme-engine/src/lthemeengine')
23 files changed, 789 insertions, 1779 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 b9175d6e..95f2c9b7 100644 --- a/src-qt5/core/lumina-theme-engine/src/lthemeengine/appearancepage.cpp +++ b/src-qt5/core/lumina-theme-engine/src/lthemeengine/appearancepage.cpp @@ -1,31 +1,3 @@ -/* - * Copyright (c) 2014-2017, Ilya Kotov <forkotov02@hotmail.ru> - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - #include <QStyleFactory> #include <QMdiSubWindow> #include <QSettings> @@ -40,379 +12,273 @@ #include "ui_appearancepage.h" #include "ui_previewform.h" -AppearancePage::AppearancePage(QWidget *parent) : - TabPage(parent), - m_ui(new Ui::AppearancePage) -{ - m_ui->setupUi(this); - QStringList keys = QStyleFactory::keys(); - keys.removeAll("lthemeengine-style"); //hide lthemeengine proxy style - m_ui->styleComboBox->addItems(keys); - - connect(m_ui->paletteComboBox, SIGNAL(activated(int)), SLOT(updatePalette())); - connect(m_ui->customPaletteButton, SIGNAL(clicked()), SLOT(updatePalette())); - connect(m_ui->defaultPaletteButton, SIGNAL(clicked()), SLOT(updatePalette())); - - m_previewWidget = new QWidget(this); - m_previewUi = new Ui::PreviewForm(); - m_previewUi->setupUi(m_previewWidget); - QMdiSubWindow *w = m_ui->mdiArea->addSubWindow(m_previewWidget, Qt::CustomizeWindowHint - | Qt::WindowMinMaxButtonsHint - | Qt::WindowTitleHint); - w->move(10, 10); - - QMenu *menu = new QMenu(this); - menu->addAction(QIcon::fromTheme("list-add"), tr("Create"), this, SLOT(createColorScheme())); - m_changeColorSchemeAction = menu->addAction(tr("Edit"), this, SLOT(changeColorScheme())); - menu->addAction(tr("Create a Copy"), this, SLOT(copyColorScheme())); - m_renameColorSchemeAction = menu->addAction(tr("Rename"), this, SLOT(renameColorScheme())); - menu->addSeparator(); - m_removeColorSchemeAction = menu->addAction(tr("Remove"), this, SLOT(removeColorScheme())); - m_ui->colorSchemeButton->setMenu(menu); - - m_changeColorSchemeAction->setIcon(QIcon::fromTheme("accessories-text-editor")); - m_removeColorSchemeAction->setIcon(QIcon::fromTheme("list-remove")); - connect(menu, SIGNAL(aboutToShow()), SLOT(updateActions())); - - readSettings(); +AppearancePage::AppearancePage(QWidget *parent) : TabPage(parent), m_ui(new Ui::AppearancePage){ + m_ui->setupUi(this); + QStringList keys = QStyleFactory::keys(); + keys.removeAll("lthemeengine-style"); //hide lthemeengine proxy style + m_ui->styleComboBox->addItems(keys); + connect(m_ui->paletteComboBox, SIGNAL(activated(int)), SLOT(updatePalette())); + connect(m_ui->customPaletteButton, SIGNAL(clicked()), SLOT(updatePalette())); + connect(m_ui->defaultPaletteButton, SIGNAL(clicked()), SLOT(updatePalette())); + m_previewWidget = new QWidget(this); + m_previewUi = new Ui::PreviewForm(); + m_previewUi->setupUi(m_previewWidget); + QMdiSubWindow *w = m_ui->mdiArea->addSubWindow(m_previewWidget, Qt::CustomizeWindowHint | Qt::WindowMinMaxButtonsHint | Qt::WindowTitleHint); + w->move(10, 10); + + QMenu *menu = new QMenu(this); + menu->addAction(QIcon::fromTheme("list-add"), tr("Create"), this, SLOT(createColorScheme())); + m_changeColorSchemeAction = menu->addAction(tr("Edit"), this, SLOT(changeColorScheme())); + menu->addAction(tr("Create a Copy"), this, SLOT(copyColorScheme())); + m_renameColorSchemeAction = menu->addAction(tr("Rename"), this, SLOT(renameColorScheme())); + menu->addSeparator(); + m_removeColorSchemeAction = menu->addAction(tr("Remove"), this, SLOT(removeColorScheme())); + m_ui->colorSchemeButton->setMenu(menu); + m_changeColorSchemeAction->setIcon(QIcon::fromTheme("accessories-text-editor")); + m_removeColorSchemeAction->setIcon(QIcon::fromTheme("list-remove")); + connect(menu, SIGNAL(aboutToShow()), SLOT(updateActions())); + + readSettings(); } -AppearancePage::~AppearancePage() -{ - if(m_selectedStyle) - delete m_selectedStyle; +AppearancePage::~AppearancePage(){ + if(m_selectedStyle) + delete m_selectedStyle; delete m_ui; delete m_previewUi; } -void AppearancePage::writeSettings() -{ - QSettings settings(lthemeengine::configFile(), QSettings::IniFormat); - settings.beginGroup("Appearance"); - settings.setValue("style", m_ui->styleComboBox->currentText()); - settings.setValue("custom_palette", m_ui->customPaletteButton->isChecked()); - settings.setValue("color_scheme_path", m_ui->colorSchemeComboBox->currentData().toString()); - settings.endGroup(); +void AppearancePage::writeSettings(){ + QSettings settings(lthemeengine::configFile(), QSettings::IniFormat); + settings.beginGroup("Appearance"); + settings.setValue("style", m_ui->styleComboBox->currentText()); + settings.setValue("custom_palette", m_ui->customPaletteButton->isChecked()); + settings.setValue("color_scheme_path", m_ui->colorSchemeComboBox->currentData().toString()); + settings.endGroup(); } -void AppearancePage::on_styleComboBox_activated(const QString &text) -{ - QStyle *style = QStyleFactory::create(text); - if(!style) - return; +void AppearancePage::on_styleComboBox_activated(const QString &text){ + QStyle *style = QStyleFactory::create(text); + if(!style) + return; setStyle(m_previewWidget, style); - if(m_selectedStyle) - delete m_selectedStyle; - m_selectedStyle = style; - - updatePalette(); + delete m_selectedStyle; + m_selectedStyle = style; + updatePalette(); } -void AppearancePage::on_colorSchemeComboBox_activated(int) -{ - m_customPalette = loadColorScheme(m_ui->colorSchemeComboBox->currentData().toString()); - updatePalette(); +void AppearancePage::on_colorSchemeComboBox_activated(int){ + m_customPalette = loadColorScheme(m_ui->colorSchemeComboBox->currentData().toString()); + updatePalette(); } -void AppearancePage::createColorScheme() -{ - QString name = QInputDialog::getText(this, tr("Enter Color Scheme Name"), tr("File name:")); - if(name.isEmpty()) - return; - +void AppearancePage::createColorScheme(){ + QString name = QInputDialog::getText(this, tr("Enter Color Scheme Name"), tr("File name:")); + if(name.isEmpty()) + return; if(!name.endsWith(".conf", Qt::CaseInsensitive)) - name.append(".conf"); - - if(m_ui->colorSchemeComboBox->findText(name.section('.',0,0)) != -1) - { - QMessageBox::warning(this, tr("Error"), tr("The color scheme \"%1\" already exists") - .arg(name.section('.',0,0))); + name.append(".conf"); + if(m_ui->colorSchemeComboBox->findText(name.section('.',0,0)) != -1){ + QMessageBox::warning(this, tr("Error"), tr("The color scheme \"%1\" already exists").arg(name.section('.',0,0))); return; - } - + } QString schemePath = lthemeengine::userColorSchemePath() + "/" + name; - createColorScheme(schemePath, palette()); m_ui->colorSchemeComboBox->addItem(name.section('.',0,0), schemePath); } -void AppearancePage::changeColorScheme() -{ - if(m_ui->colorSchemeComboBox->currentIndex() < 0) - return; - - if(!QFileInfo(m_ui->colorSchemeComboBox->currentData().toString()).isWritable()) - { - QMessageBox::information(this, tr("Warning"), tr("The color scheme \"%1\" is read only") - .arg(m_ui->colorSchemeComboBox->currentText())); - return; +void AppearancePage::changeColorScheme(){ + if(m_ui->colorSchemeComboBox->currentIndex() < 0) + return; + if(!QFileInfo(m_ui->colorSchemeComboBox->currentData().toString()).isWritable()){ + QMessageBox::information(this, tr("Warning"), tr("The color scheme \"%1\" is read only").arg(m_ui->colorSchemeComboBox->currentText())); + return; } - PaletteEditDialog d(m_customPalette, m_selectedStyle, this); connect(&d, SIGNAL(paletteChanged(QPalette)), SLOT(setPreviewPalette(QPalette))); - if(d.exec() == QDialog::Accepted) - { - m_customPalette = d.selectedPalette(); - createColorScheme(m_ui->colorSchemeComboBox->currentData().toString(), m_customPalette); + if(d.exec() == QDialog::Accepted){ + m_customPalette = d.selectedPalette(); + createColorScheme(m_ui->colorSchemeComboBox->currentData().toString(), m_customPalette); } updatePalette(); } -void AppearancePage::removeColorScheme() -{ - int index = m_ui->colorSchemeComboBox->currentIndex(); - if(index < 0 || m_ui->colorSchemeComboBox->count() <= 1) - return; - - if(!QFileInfo(m_ui->colorSchemeComboBox->currentData().toString()).isWritable()) - { - QMessageBox::information(this, tr("Warning"), tr("The color scheme \"%1\" is read only") - .arg(m_ui->colorSchemeComboBox->currentText())); - return; +void AppearancePage::removeColorScheme(){ + int index = m_ui->colorSchemeComboBox->currentIndex(); + if(index < 0 || m_ui->colorSchemeComboBox->count() <= 1) + return; + if(!QFileInfo(m_ui->colorSchemeComboBox->currentData().toString()).isWritable()){ + QMessageBox::information(this, tr("Warning"), tr("The color scheme \"%1\" is read only").arg(m_ui->colorSchemeComboBox->currentText())); + return; } - - int button = QMessageBox::question(this, tr("Confirm Remove"), - tr("Are you sure you want to remove color scheme \"%1\"?") - .arg(m_ui->colorSchemeComboBox->currentText()), - QMessageBox::Yes | QMessageBox::No); + int button = QMessageBox::question(this, tr("Confirm Remove"),tr("Are you sure you want to remove color scheme \"%1\"?").arg(m_ui->colorSchemeComboBox->currentText()), QMessageBox::Yes | QMessageBox::No); if(button != QMessageBox::Yes) - return; - - if(QFile::remove(m_ui->colorSchemeComboBox->currentData().toString())) - { + return; + if(QFile::remove(m_ui->colorSchemeComboBox->currentData().toString())){ m_ui->colorSchemeComboBox->removeItem(index); on_colorSchemeComboBox_activated(0); - } + } } -void AppearancePage::copyColorScheme() -{ - if(m_ui->colorSchemeComboBox->currentIndex() < 0) - return; - - QString name = QInputDialog::getText(this, tr("Enter Color Scheme Name"), tr("File name:"), - QLineEdit::Normal, - tr("%1 (copy)").arg(m_ui->colorSchemeComboBox->currentText())); +void AppearancePage::copyColorScheme(){ + if(m_ui->colorSchemeComboBox->currentIndex() < 0) + return; + QString name = QInputDialog::getText(this, tr("Enter Color Scheme Name"), tr("File name:"),QLineEdit::Normal, tr("%1 (copy)").arg(m_ui->colorSchemeComboBox->currentText())); if(name.isEmpty() || name == m_ui->colorSchemeComboBox->currentText()) - return; - - if(!name.endsWith(".conf", Qt::CaseInsensitive)) - name.append(".conf"); - - if(m_ui->colorSchemeComboBox->findText(name.section('.',0,0)) != -1) - { - QMessageBox::warning(this, tr("Error"), tr("The color scheme \"%1\" already exists") - .arg(name.section('.',0,0))); - return; - } - - QString newPath = lthemeengine::userColorSchemePath() + "/" + name; - QFile::copy(m_ui->colorSchemeComboBox->currentData().toString(), newPath); - m_ui->colorSchemeComboBox->addItem(name.section('.',0,0), newPath); + return; + if(!name.endsWith(".conf", Qt::CaseInsensitive))name.append(".conf"); + if(m_ui->colorSchemeComboBox->findText(name.section('.',0,0)) != -1){ + QMessageBox::warning(this, tr("Error"), tr("The color scheme \"%1\" already exists").arg(name.section('.',0,0))); + return; + } + QString newPath = lthemeengine::userColorSchemePath() + "/" + name; + QFile::copy(m_ui->colorSchemeComboBox->currentData().toString(), newPath); + m_ui->colorSchemeComboBox->addItem(name.section('.',0,0), newPath); } -void AppearancePage::renameColorScheme() -{ - int index = m_ui->colorSchemeComboBox->currentIndex(); - +void AppearancePage::renameColorScheme(){ + int index = m_ui->colorSchemeComboBox->currentIndex(); if(index < 0) + return; + if(!QFileInfo(m_ui->colorSchemeComboBox->currentData().toString()).isWritable()){ + QMessageBox::information(this, tr("Warning"), tr("The color scheme \"%1\" is read only").arg(m_ui->colorSchemeComboBox->currentText())); return; - - if(!QFileInfo(m_ui->colorSchemeComboBox->currentData().toString()).isWritable()) - { - QMessageBox::information(this, tr("Warning"), tr("The color scheme \"%1\" is read only") - .arg(m_ui->colorSchemeComboBox->currentText())); - return; - } - - QString name = QInputDialog::getText(this, tr("Enter Color Scheme Name"), tr("File name:"), - QLineEdit::Normal, m_ui->colorSchemeComboBox->currentText()); - if(name.isEmpty() || name == m_ui->colorSchemeComboBox->currentText()) - return; - - if(!name.endsWith(".conf", Qt::CaseInsensitive)) - name.append(".conf"); - - if(m_ui->colorSchemeComboBox->findText(name.section('.',0,0)) != -1) - { - QMessageBox::warning(this, tr("Error"), tr("The color scheme \"%1\" already exists") - .arg(name.section('.',0,0))); + } + QString name = QInputDialog::getText(this, tr("Enter Color Scheme Name"), tr("File name:"), QLineEdit::Normal, m_ui->colorSchemeComboBox->currentText()); + if(name.isEmpty() || name == m_ui->colorSchemeComboBox->currentText()) return; - } - - QString newPath = lthemeengine::userColorSchemePath() + "/" + name; - QFile::rename(m_ui->colorSchemeComboBox->currentData().toString(), newPath); - m_ui->colorSchemeComboBox->setItemText(index, name.section('.',0,0)); - m_ui->colorSchemeComboBox->setItemData(index, newPath); + if(!name.endsWith(".conf", Qt::CaseInsensitive))name.append(".conf"); + if(m_ui->colorSchemeComboBox->findText(name.section('.',0,0)) != -1){ + QMessageBox::warning(this, tr("Error"), tr("The color scheme \"%1\" already exists").arg(name.section('.',0,0))); + return; + } + QString newPath = lthemeengine::userColorSchemePath() + "/" + name; + QFile::rename(m_ui->colorSchemeComboBox->currentData().toString(), newPath); + m_ui->colorSchemeComboBox->setItemText(index, name.section('.',0,0)); + m_ui->colorSchemeComboBox->setItemData(index, newPath); } -void AppearancePage::updatePalette() -{ +void AppearancePage::updatePalette(){ if(!m_selectedStyle) - return; - - setPreviewPalette(m_ui->customPaletteButton->isChecked() ? - m_customPalette : m_selectedStyle->standardPalette()); + return; + setPreviewPalette(m_ui->customPaletteButton->isChecked() ? m_customPalette : m_selectedStyle->standardPalette()); } -void AppearancePage::setPreviewPalette(const QPalette &p) -{ - QPalette previewPalette = palette(); - - QPalette::ColorGroup colorGroup = QPalette::Disabled; - - if(m_ui->paletteComboBox->currentIndex() == 0) - { - colorGroup = QPalette::Active; - } - else if(m_ui->paletteComboBox->currentIndex() == 1) - { - colorGroup = QPalette::Inactive; +void AppearancePage::setPreviewPalette(const QPalette &p){ + QPalette previewPalette = palette(); + QPalette::ColorGroup colorGroup = QPalette::Disabled; + if(m_ui->paletteComboBox->currentIndex() == 0){ + colorGroup = QPalette::Active; } - - for (int i = 0; i < QPalette::NColorRoles; i++) - { - QPalette::ColorRole role = QPalette::ColorRole(i); - previewPalette.setColor(QPalette::Active, role, p.color(colorGroup, role)); - previewPalette.setColor(QPalette::Inactive, role, p.color(colorGroup, role)); - } - - setPalette(m_ui->mdiArea, previewPalette); + else if(m_ui->paletteComboBox->currentIndex() == 1){ + colorGroup = QPalette::Inactive; + } + for (int i = 0; i < QPalette::NColorRoles; i++){ + QPalette::ColorRole role = QPalette::ColorRole(i); + previewPalette.setColor(QPalette::Active, role, p.color(colorGroup, role)); + previewPalette.setColor(QPalette::Inactive, role, p.color(colorGroup, role)); + } + setPalette(m_ui->mdiArea, previewPalette); } -void AppearancePage::updateActions() -{ - if(m_ui->colorSchemeComboBox->count() == 0 || - !QFileInfo(m_ui->colorSchemeComboBox->currentData().toString()).isWritable()) - { - m_changeColorSchemeAction->setVisible(false); - m_renameColorSchemeAction->setVisible(false); - m_removeColorSchemeAction->setVisible(false); - } - else - { - m_changeColorSchemeAction->setVisible(true); - m_renameColorSchemeAction->setVisible(true); - m_removeColorSchemeAction->setVisible(m_ui->colorSchemeComboBox->count() > 1); +void AppearancePage::updateActions(){ + if(m_ui->colorSchemeComboBox->count() == 0 || !QFileInfo(m_ui->colorSchemeComboBox->currentData().toString()).isWritable()){ + m_changeColorSchemeAction->setVisible(false); + m_renameColorSchemeAction->setVisible(false); + m_removeColorSchemeAction->setVisible(false); } + else{ + m_changeColorSchemeAction->setVisible(true); + m_renameColorSchemeAction->setVisible(true); + m_removeColorSchemeAction->setVisible(m_ui->colorSchemeComboBox->count() > 1); + } } -void AppearancePage::readSettings() -{ - QSettings settings(lthemeengine::configFile(), QSettings::IniFormat); - settings.beginGroup("Appearance"); - QString style = settings.value("style", "Fusion").toString(); - m_ui->styleComboBox->setCurrentText(style); - - m_ui->customPaletteButton->setChecked(settings.value("custom_palette", false).toBool()); - QString colorSchemePath = settings.value("color_scheme_path").toString(); - - QDir("/").mkpath(lthemeengine::userColorSchemePath()); - findColorSchemes(lthemeengine::userColorSchemePath()); - findColorSchemes(lthemeengine::sharedColorSchemePath().join(", ")); - - if(m_ui->colorSchemeComboBox->count() == 0) - { - m_customPalette = palette(); //load fallback palette - } - else - { - int index = m_ui->colorSchemeComboBox->findData(colorSchemePath); - if(index >= 0) - m_ui->colorSchemeComboBox->setCurrentIndex(index); - m_customPalette = loadColorScheme(m_ui->colorSchemeComboBox->currentData().toString()); +void AppearancePage::readSettings(){ + QSettings settings(lthemeengine::configFile(), QSettings::IniFormat); + settings.beginGroup("Appearance"); + QString style = settings.value("style", "Fusion").toString(); + m_ui->styleComboBox->setCurrentText(style); + m_ui->customPaletteButton->setChecked(settings.value("custom_palette", false).toBool()); + QString colorSchemePath = settings.value("color_scheme_path").toString(); + QDir("/").mkpath(lthemeengine::userColorSchemePath()); + findColorSchemes(lthemeengine::userColorSchemePath()); + findColorSchemes(lthemeengine::sharedColorSchemePath().join(", ")); + if(m_ui->colorSchemeComboBox->count() == 0){ + m_customPalette = palette(); //load fallback palette } - + else{ + int index = m_ui->colorSchemeComboBox->findData(colorSchemePath); + if(index >= 0) + m_ui->colorSchemeComboBox->setCurrentIndex(index); + m_customPalette = loadColorScheme(m_ui->colorSchemeComboBox->currentData().toString()); + } on_styleComboBox_activated(m_ui->styleComboBox->currentText()); - settings.endGroup(); } -void AppearancePage::setStyle(QWidget *w, QStyle *s) -{ - foreach (QObject *o, w->children()) - { - if(o->isWidgetType()) - { - setStyle(qobject_cast<QWidget *>(o), s); - } +void AppearancePage::setStyle(QWidget *w, QStyle *s){ + foreach (QObject *o, w->children()){ + if(o->isWidgetType()){ + setStyle(qobject_cast<QWidget *>(o), s); } - w->setStyle(s); + } + w->setStyle(s); } -void AppearancePage::setPalette(QWidget *w, QPalette p) -{ - foreach (QObject *o, w->children()) - { - if(o->isWidgetType()) - { - setPalette(qobject_cast<QWidget *>(o), p); - } +void AppearancePage::setPalette(QWidget *w, QPalette p){ + foreach (QObject *o, w->children()){ + if(o->isWidgetType()){ + setPalette(qobject_cast<QWidget *>(o), p); + } } - w->setPalette(p); + w->setPalette(p); } -void AppearancePage::findColorSchemes(const QString &path) -{ - QDir dir(path); - dir.setFilter(QDir::Files); - dir.setNameFilters(QStringList() << "*.conf"); - - foreach (QFileInfo info, dir.entryInfoList()) - { - m_ui->colorSchemeComboBox->addItem(info.baseName(), info.filePath()); +void AppearancePage::findColorSchemes(const QString &path){ + QDir dir(path); + dir.setFilter(QDir::Files); + dir.setNameFilters(QStringList() << "*.conf"); + foreach (QFileInfo info, dir.entryInfoList()){ + m_ui->colorSchemeComboBox->addItem(info.baseName(), info.filePath()); } } -QPalette AppearancePage::loadColorScheme(const QString &filePath) -{ - QPalette customPalette; - QSettings settings(filePath, QSettings::IniFormat); - settings.beginGroup("ColorScheme"); - QStringList activeColors = settings.value("active_colors").toStringList(); - QStringList inactiveColors = settings.value("inactive_colors").toStringList(); - QStringList disabledColors = settings.value("disabled_colors").toStringList(); - settings.endGroup(); - - if(activeColors.count() == QPalette::NColorRoles && - inactiveColors.count() == QPalette::NColorRoles && - disabledColors.count() == QPalette::NColorRoles) - { - for (int i = 0; i < QPalette::NColorRoles; i++) - { - QPalette::ColorRole role = QPalette::ColorRole(i); - customPalette.setColor(QPalette::Active, role, QColor(activeColors.at(i))); - customPalette.setColor(QPalette::Inactive, role, QColor(inactiveColors.at(i))); - customPalette.setColor(QPalette::Disabled, role, QColor(disabledColors.at(i))); - } +QPalette AppearancePage::loadColorScheme(const QString &filePath){ + QPalette customPalette; + QSettings settings(filePath, QSettings::IniFormat); + settings.beginGroup("ColorScheme"); + QStringList activeColors = settings.value("active_colors").toStringList(); + QStringList inactiveColors = settings.value("inactive_colors").toStringList(); + QStringList disabledColors = settings.value("disabled_colors").toStringList(); + settings.endGroup(); + if(activeColors.count() == QPalette::NColorRoles && inactiveColors.count() == QPalette::NColorRoles && disabledColors.count() == QPalette::NColorRoles){ + for (int i = 0; i < QPalette::NColorRoles; i++){ + QPalette::ColorRole role = QPalette::ColorRole(i); + customPalette.setColor(QPalette::Active, role, QColor(activeColors.at(i))); + customPalette.setColor(QPalette::Inactive, role, QColor(inactiveColors.at(i))); + customPalette.setColor(QPalette::Disabled, role, QColor(disabledColors.at(i))); + } } - else - { - customPalette = palette(); //load fallback palette - } - + else{ + customPalette = palette(); //load fallback palette + } return customPalette; } -void AppearancePage::createColorScheme(const QString &name, const QPalette &palette) -{ - QSettings settings(name, QSettings::IniFormat); - settings.beginGroup("ColorScheme"); - - QStringList activeColors, inactiveColors, disabledColors; - for (int i = 0; i < QPalette::NColorRoles; i++) - { - QPalette::ColorRole role = QPalette::ColorRole(i); - activeColors << palette.color(QPalette::Active, role).name(); - inactiveColors << palette.color(QPalette::Inactive, role).name(); - disabledColors << palette.color(QPalette::Disabled, role).name(); +void AppearancePage::createColorScheme(const QString &name, const QPalette &palette){ + QSettings settings(name, QSettings::IniFormat); + settings.beginGroup("ColorScheme"); + QStringList activeColors, inactiveColors, disabledColors; + for (int i = 0; i < QPalette::NColorRoles; i++){ + QPalette::ColorRole role = QPalette::ColorRole(i); + activeColors << palette.color(QPalette::Active, role).name(); + inactiveColors << palette.color(QPalette::Inactive, role).name(); + disabledColors << palette.color(QPalette::Disabled, role).name(); } - - settings.setValue("active_colors",activeColors); - settings.setValue("inactive_colors",inactiveColors); - settings.setValue("disabled_colors",disabledColors); - - settings.endGroup(); - + settings.setValue("active_colors",activeColors); + settings.setValue("inactive_colors",inactiveColors); + settings.setValue("disabled_colors",disabledColors); + settings.endGroup(); } 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 3a7752c7..23bab52f 100644 --- a/src-qt5/core/lumina-theme-engine/src/lthemeengine/appearancepage.h +++ b/src-qt5/core/lumina-theme-engine/src/lthemeengine/appearancepage.h @@ -1,31 +1,3 @@ -/* - * Copyright (c) 2014-2017, Ilya Kotov <forkotov02@hotmail.ru> - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - #ifndef APPEARANCEPAGE_H #define APPEARANCEPAGE_H @@ -39,14 +11,12 @@ class PreviewForm; class QStyle; class QAction; -class AppearancePage : public TabPage -{ +class AppearancePage : public TabPage{ Q_OBJECT public: explicit AppearancePage(QWidget *parent = 0); ~AppearancePage(); - void writeSettings(); private slots: diff --git a/src-qt5/core/lumina-theme-engine/src/lthemeengine/fontconfigdialog.cpp b/src-qt5/core/lumina-theme-engine/src/lthemeengine/fontconfigdialog.cpp index 398a2436..13c92bf0 100644 --- a/src-qt5/core/lumina-theme-engine/src/lthemeengine/fontconfigdialog.cpp +++ b/src-qt5/core/lumina-theme-engine/src/lthemeengine/fontconfigdialog.cpp @@ -1,31 +1,3 @@ -/* - * Copyright (c) 2014-2017, Ilya Kotov <forkotov02@hotmail.ru> - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - #include <QXmlStreamWriter> #include <QFile> #include <QDir> @@ -33,106 +5,80 @@ #include "fontconfigdialog.h" #include "ui_fontconfigdialog.h" -FontConfigDialog::FontConfigDialog(QWidget *parent) : - QDialog(parent), - m_ui(new Ui::FontConfigDialog) -{ - m_ui->setupUi(this); - - m_ui->hintingStyleComboBox->addItem(tr("None"), "hintnone"); - m_ui->hintingStyleComboBox->addItem(tr("Slight"), "hintslight"); - m_ui->hintingStyleComboBox->addItem(tr("Medium"), "hintmedium"); - m_ui->hintingStyleComboBox->addItem(tr("Full"), "hintfull"); - - m_ui->rgbaComboBox->addItem(tr("None"), "none"); - m_ui->rgbaComboBox->addItem("rgb", "rgb"); - m_ui->rgbaComboBox->addItem("bgr", "bgr"); - m_ui->rgbaComboBox->addItem("vrgb", "vrgb"); - m_ui->rgbaComboBox->addItem("vbgr", "vbgr"); - - m_ui->lcdFilterComboBox->addItem("lcdnone"); - m_ui->lcdFilterComboBox->addItem("lcddefault"); - m_ui->lcdFilterComboBox->addItem("lcdlight"); - m_ui->lcdFilterComboBox->addItem("lcdlegacy"); +FontConfigDialog::FontConfigDialog(QWidget *parent) : QDialog(parent), m_ui(new Ui::FontConfigDialog){ + m_ui->setupUi(this); + + m_ui->hintingStyleComboBox->addItem(tr("None"), "hintnone"); + m_ui->hintingStyleComboBox->addItem(tr("Slight"), "hintslight"); + m_ui->hintingStyleComboBox->addItem(tr("Medium"), "hintmedium"); + m_ui->hintingStyleComboBox->addItem(tr("Full"), "hintfull"); + m_ui->rgbaComboBox->addItem(tr("None"), "none"); + m_ui->rgbaComboBox->addItem("rgb", "rgb"); + m_ui->rgbaComboBox->addItem("bgr", "bgr"); + m_ui->rgbaComboBox->addItem("vrgb", "vrgb"); + m_ui->rgbaComboBox->addItem("vbgr", "vbgr"); + m_ui->lcdFilterComboBox->addItem("lcdnone"); + m_ui->lcdFilterComboBox->addItem("lcddefault"); + m_ui->lcdFilterComboBox->addItem("lcdlight"); + m_ui->lcdFilterComboBox->addItem("lcdlegacy"); } -FontConfigDialog::~FontConfigDialog() -{ - delete m_ui; +FontConfigDialog::~FontConfigDialog(){ + delete m_ui; } -void FontConfigDialog::accept() -{ - QDir::home().mkpath(".config/fontconfig/"); - QString path = QDir::homePath() + "/.config/fontconfig/fonts.conf"; - qDebug("FontConfigDialog: fontconfig path: %s", qPrintable(path)); - - - if(QFile::exists(path)) - { - if(QMessageBox::question(this, tr("Font Configuration"), - tr("<i>%1</i> already exists. Do you want to replace it?").arg(path), - QMessageBox::Yes | QMessageBox::No) == QMessageBox::No) - { - QDialog::reject(); - return; - } - - QFile::remove(path + ".back"); - QFile::copy(path, path + ".back"); +void FontConfigDialog::accept(){ + QDir::home().mkpath(".config/fontconfig/"); + QString path = QDir::homePath() + "/.config/fontconfig/fonts.conf"; + qDebug("FontConfigDialog: fontconfig path: %s", qPrintable(path)); + if(QFile::exists(path)){ + if(QMessageBox::question(this, tr("Font Configuration"), tr("<i>%1</i> already exists. Do you want to replace it?").arg(path), QMessageBox::Yes | QMessageBox::No) == QMessageBox::No){ + QDialog::reject(); + return; + } + QFile::remove(path + ".back"); + QFile::copy(path, path + ".back"); } - - QFile file(path); - if(!file.open(QIODevice::WriteOnly)) - { - qWarning("FontConfigDialog: unable to open file: %s", qPrintable(file.errorString())); - return; + QFile file(path); + if(!file.open(QIODevice::WriteOnly)){ + qWarning("FontConfigDialog: unable to open file: %s", qPrintable(file.errorString())); + return; } - - QXmlStreamWriter stream(&file); - stream.setAutoFormatting(true); - - stream.writeStartDocument(); - stream.writeDTD("<!DOCTYPE fontconfig SYSTEM \"fonts.dtd\">"); - stream.writeStartElement("fontconfig"); - + QXmlStreamWriter stream(&file); + stream.setAutoFormatting(true); + stream.writeStartDocument(); + stream.writeDTD("<!DOCTYPE fontconfig SYSTEM \"fonts.dtd\">"); + stream.writeStartElement("fontconfig"); + stream.writeStartElement("match"); + stream.writeAttribute("target", "font"); + writeOption(&stream, "antialias", "bool", m_ui->antialisingCheckBox->isChecked() ? "true" : "false"); + writeOption(&stream, "hinting", "bool", m_ui->hintingCheckBox->isChecked() ? "true" : "false"); + writeOption(&stream, "hintstyle", "const", m_ui->hintingStyleComboBox->currentData().toString()); + writeOption(&stream, "rgba", "const", m_ui->rgbaComboBox->currentData().toString()); + writeOption(&stream, "autohint", "bool", m_ui->autohinterCheckBox->isChecked() ? "true" : "false"); + writeOption(&stream, "lcdfilter", "const", m_ui->lcdFilterComboBox->currentText()); + writeOption(&stream, "dpi", "double", QString::number(m_ui->dpiSpinBox->value())); + stream.writeEndElement(); + if(m_ui->disableBoldAutohintCheckBox->isChecked()){ stream.writeStartElement("match"); stream.writeAttribute("target", "font"); - writeOption(&stream, "antialias", "bool", m_ui->antialisingCheckBox->isChecked() ? "true" : "false"); - writeOption(&stream, "hinting", "bool", m_ui->hintingCheckBox->isChecked() ? "true" : "false"); - writeOption(&stream, "hintstyle", "const", m_ui->hintingStyleComboBox->currentData().toString()); - writeOption(&stream, "rgba", "const", m_ui->rgbaComboBox->currentData().toString()); + stream.writeStartElement("test"); + stream.writeAttribute("name", "weight"); + stream.writeAttribute("compare", "more"); + stream.writeTextElement("const", "medium"); + stream.writeEndElement(); writeOption(&stream, "autohint", "bool", m_ui->autohinterCheckBox->isChecked() ? "true" : "false"); - writeOption(&stream, "lcdfilter", "const", m_ui->lcdFilterComboBox->currentText()); - writeOption(&stream, "dpi", "double", QString::number(m_ui->dpiSpinBox->value())); stream.writeEndElement(); - - if(m_ui->disableBoldAutohintCheckBox->isChecked()) - { - stream.writeStartElement("match"); - stream.writeAttribute("target", "font"); - - stream.writeStartElement("test"); - stream.writeAttribute("name", "weight"); - stream.writeAttribute("compare", "more"); - stream.writeTextElement("const", "medium"); - stream.writeEndElement(); - - writeOption(&stream, "autohint", "bool", m_ui->autohinterCheckBox->isChecked() ? "true" : "false"); - - stream.writeEndElement(); } - stream.writeEndElement(); - stream.writeEndDocument(); - - QDialog::accept(); + stream.writeEndElement(); + stream.writeEndDocument(); + QDialog::accept(); } -void FontConfigDialog::writeOption(QXmlStreamWriter *stream, const QString &name, const QString &type, const QString &value) -{ - stream->writeStartElement("edit"); - stream->writeAttribute("name", name); - stream->writeAttribute("mode", "assign"); - stream->writeTextElement(type, value); - stream->writeEndElement(); +void FontConfigDialog::writeOption(QXmlStreamWriter *stream, const QString &name, const QString &type, const QString &value){ + stream->writeStartElement("edit"); + stream->writeAttribute("name", name); + stream->writeAttribute("mode", "assign"); + stream->writeTextElement(type, value); + stream->writeEndElement(); } diff --git a/src-qt5/core/lumina-theme-engine/src/lthemeengine/fontconfigdialog.h b/src-qt5/core/lumina-theme-engine/src/lthemeengine/fontconfigdialog.h index 5b7e31a5..09991787 100644 --- a/src-qt5/core/lumina-theme-engine/src/lthemeengine/fontconfigdialog.h +++ b/src-qt5/core/lumina-theme-engine/src/lthemeengine/fontconfigdialog.h @@ -1,31 +1,3 @@ -/* - * Copyright (c) 2014-2017, Ilya Kotov <forkotov02@hotmail.ru> - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - #ifndef FONTCONFIGDIALOG_H #define FONTCONFIGDIALOG_H diff --git a/src-qt5/core/lumina-theme-engine/src/lthemeengine/fontspage.cpp b/src-qt5/core/lumina-theme-engine/src/lthemeengine/fontspage.cpp index db48a3cc..8d1ed1ab 100644 --- a/src-qt5/core/lumina-theme-engine/src/lthemeengine/fontspage.cpp +++ b/src-qt5/core/lumina-theme-engine/src/lthemeengine/fontspage.cpp @@ -1,31 +1,3 @@ -/* - * Copyright (c) 2014-2017, Ilya Kotov <forkotov02@hotmail.ru> - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - #include <QSignalMapper> #include <QMessageBox> #include <QSettings> @@ -38,89 +10,70 @@ #include "fontconfigdialog.h" #include "ui_fontspage.h" -FontsPage::FontsPage(QWidget *parent) : - TabPage(parent), - m_ui(new Ui::FontsPage) -{ - m_ui->setupUi(this); - - QSignalMapper *mapper = new QSignalMapper(this); - mapper->setMapping(m_ui->changeGeneralFontButton, m_ui->generalFontLabel); - mapper->setMapping(m_ui->changeFixedWidthFontButton, m_ui->fixedFontLabel); - connect(m_ui->changeGeneralFontButton, SIGNAL(clicked()), mapper, SLOT(map())); - connect(m_ui->changeFixedWidthFontButton, SIGNAL(clicked()), mapper, SLOT(map())); - connect(mapper, SIGNAL(mapped(QWidget*)), SLOT(onFontChangeRequested(QWidget*))); +FontsPage::FontsPage(QWidget *parent) : TabPage(parent), m_ui(new Ui::FontsPage){ + m_ui->setupUi(this); - readSettings(); + QSignalMapper *mapper = new QSignalMapper(this); + mapper->setMapping(m_ui->changeGeneralFontButton, m_ui->generalFontLabel); + mapper->setMapping(m_ui->changeFixedWidthFontButton, m_ui->fixedFontLabel); + connect(m_ui->changeGeneralFontButton, SIGNAL(clicked()), mapper, SLOT(map())); + connect(m_ui->changeFixedWidthFontButton, SIGNAL(clicked()), mapper, SLOT(map())); + connect(mapper, SIGNAL(mapped(QWidget*)), SLOT(onFontChangeRequested(QWidget*))); + readSettings(); - //icons - m_ui->createFontsConfButton->setIcon(QIcon::fromTheme("document-new")); - m_ui->removeFontsConfButton->setIcon(QIcon::fromTheme("edit-delete")); + //icons + m_ui->createFontsConfButton->setIcon(QIcon::fromTheme("document-new")); + m_ui->removeFontsConfButton->setIcon(QIcon::fromTheme("edit-delete")); } -FontsPage::~FontsPage() -{ - delete m_ui; +FontsPage::~FontsPage(){ + delete m_ui; } -void FontsPage::writeSettings() -{ - QSettings settings(lthemeengine::configFile(), QSettings::IniFormat); - settings.beginGroup("Fonts"); - settings.setValue("general", m_ui->generalFontLabel->font()); - settings.setValue("fixed", m_ui->fixedFontLabel->font()); - settings.endGroup(); +void FontsPage::writeSettings(){ + QSettings settings(lthemeengine::configFile(), QSettings::IniFormat); + settings.beginGroup("Fonts"); + settings.setValue("general", m_ui->generalFontLabel->font()); + settings.setValue("fixed", m_ui->fixedFontLabel->font()); + settings.endGroup(); } -void FontsPage::onFontChangeRequested(QWidget *widget) -{ - bool ok = false; - QFont font = QFontDialog::getFont (&ok, widget->font(), this); - if(ok) - { - widget->setFont(font); - qobject_cast<QLabel*>(widget)->setText(font.family () + " " + QString::number(font.pointSize ())); +void FontsPage::onFontChangeRequested(QWidget *widget){ + bool ok = false; + QFont font = QFontDialog::getFont (&ok, widget->font(), this); + if(ok){ + widget->setFont(font); + qobject_cast<QLabel*>(widget)->setText(font.family () + " " + QString::number(font.pointSize ())); } } -void FontsPage::readSettings() -{ - QSettings settings(lthemeengine::configFile(), QSettings::IniFormat); - settings.beginGroup("Fonts"); - loadFont(&settings, m_ui->generalFontLabel, "general"); - loadFont(&settings, m_ui->fixedFontLabel, "fixed"); - settings.endGroup(); +void FontsPage::readSettings(){ + QSettings settings(lthemeengine::configFile(), QSettings::IniFormat); + settings.beginGroup("Fonts"); + loadFont(&settings, m_ui->generalFontLabel, "general"); + loadFont(&settings, m_ui->fixedFontLabel, "fixed"); + settings.endGroup(); } -void FontsPage::loadFont(QSettings *settings, QLabel *label, const QString &key) -{ - QFont font = settings->value(key, QApplication::font()).value<QFont>(); - label->setText(font.family () + " " + QString::number(font.pointSize ())); - label->setFont(font); +void FontsPage::loadFont(QSettings *settings, QLabel *label, const QString &key){ + QFont font = settings->value(key, QApplication::font()).value<QFont>(); + label->setText(font.family () + " " + QString::number(font.pointSize ())); + label->setFont(font); } -void FontsPage::on_createFontsConfButton_clicked() -{ - FontConfigDialog d(this); - d.exec(); +void FontsPage::on_createFontsConfButton_clicked(){ + FontConfigDialog d(this); + d.exec(); } -void FontsPage::on_removeFontsConfButton_clicked() -{ - QString path = QDir::homePath() + "/.config/fontconfig/fonts.conf"; - - - if(QFile::exists(path)) - { - if(QMessageBox::question(this, tr("Remove Font Configuration"), - tr("Are you sure you want to delete <i>%1</i>?").arg(path), - QMessageBox::Yes | QMessageBox::No) == QMessageBox::No) - { - return; - } - - QFile::remove(path + ".back"); - QFile::copy(path, path + ".back"); - QFile::remove(path); +void FontsPage::on_removeFontsConfButton_clicked(){ + QString path = QDir::homePath() + "/.config/fontconfig/fonts.conf"; + if(QFile::exists(path)){ + if(QMessageBox::question(this, tr("Remove Font Configuration"), tr("Are you sure you want to delete <i>%1</i>?").arg(path), QMessageBox::Yes | QMessageBox::No) == QMessageBox::No){ + return; } + QFile::remove(path + ".back"); + QFile::copy(path, path + ".back"); + QFile::remove(path); + } } diff --git a/src-qt5/core/lumina-theme-engine/src/lthemeengine/fontspage.h b/src-qt5/core/lumina-theme-engine/src/lthemeengine/fontspage.h index a9c5f1f6..2b522fee 100644 --- a/src-qt5/core/lumina-theme-engine/src/lthemeengine/fontspage.h +++ b/src-qt5/core/lumina-theme-engine/src/lthemeengine/fontspage.h @@ -1,31 +1,3 @@ -/* - * Copyright (c) 2014-2017, Ilya Kotov <forkotov02@hotmail.ru> - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - #ifndef FONTSPAGE_H #define FONTSPAGE_H diff --git a/src-qt5/core/lumina-theme-engine/src/lthemeengine/iconthemepage.cpp b/src-qt5/core/lumina-theme-engine/src/lthemeengine/iconthemepage.cpp index ca9a3388..cfe002aa 100644 --- a/src-qt5/core/lumina-theme-engine/src/lthemeengine/iconthemepage.cpp +++ b/src-qt5/core/lumina-theme-engine/src/lthemeengine/iconthemepage.cpp @@ -1,31 +1,3 @@ -/* - * Copyright (c) 2014-2017, Ilya Kotov <forkotov02@hotmail.ru> - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - #include <QSettings> #include <QFileInfo> #include <QFileInfoList> @@ -37,178 +9,136 @@ #include "iconthemepage.h" #include "ui_iconthemepage.h" -IconThemePage::IconThemePage(QWidget *parent) : - TabPage(parent), - m_ui(new Ui::IconThemePage) -{ - m_ui->setupUi(this); - loadThemes(); - readSettings(); +IconThemePage::IconThemePage(QWidget *parent) : TabPage(parent), m_ui(new Ui::IconThemePage){ + m_ui->setupUi(this); + loadThemes(); + readSettings(); } -IconThemePage::~IconThemePage() -{ - delete m_ui; +IconThemePage::~IconThemePage(){ + delete m_ui; } -void IconThemePage::writeSettings() -{ - QSettings settings(lthemeengine::configFile(), QSettings::IniFormat); - QTreeWidgetItem *item = m_ui->treeWidget->currentItem(); - if(item) - settings.setValue("Appearance/icon_theme", item->data(3, Qt::UserRole)); +void IconThemePage::writeSettings(){ + QSettings settings(lthemeengine::configFile(), QSettings::IniFormat); + QTreeWidgetItem *item = m_ui->treeWidget->currentItem(); + if(item) + settings.setValue("Appearance/icon_theme", item->data(3, Qt::UserRole)); } -void IconThemePage::readSettings() -{ - QSettings settings(lthemeengine::configFile(), QSettings::IniFormat); - QString name = settings.value("Appearance/icon_theme").toString(); - - if(name.isEmpty()) - return; - - for(int i = 0; i < m_ui->treeWidget->topLevelItemCount(); ++i) - { - QTreeWidgetItem *item = m_ui->treeWidget->topLevelItem(i); - if(item->data(3, Qt::UserRole).toString() == name) - { - m_ui->treeWidget->setCurrentItem(item); - break; +void IconThemePage::readSettings(){ + QSettings settings(lthemeengine::configFile(), QSettings::IniFormat); + QString name = settings.value("Appearance/icon_theme").toString(); + if(name.isEmpty()) + return; + for(int i = 0; i < m_ui->treeWidget->topLevelItemCount(); ++i){ + QTreeWidgetItem *item = m_ui->treeWidget->topLevelItem(i); + if(item->data(3, Qt::UserRole).toString() == name){ + m_ui->treeWidget->setCurrentItem(item); + break; } - } + } } -void IconThemePage::loadThemes() -{ - QFileInfoList themeFileList; - foreach(QString path, lthemeengine::iconPaths()) - { - QDir dir(path); - dir.setFilter(QDir::Dirs | QDir::NoDotDot | QDir::NoDot); - foreach (QFileInfo info, dir.entryInfoList()) - { - QDir themeDir(info.absoluteFilePath()); - themeDir.setFilter(QDir::Files); - themeFileList << themeDir.entryInfoList(QStringList() << "index.theme"); - } +void IconThemePage::loadThemes(){ + QFileInfoList themeFileList; + foreach(QString path, lthemeengine::iconPaths()){ + QDir dir(path); + dir.setFilter(QDir::Dirs | QDir::NoDotDot | QDir::NoDot); + foreach (QFileInfo info, dir.entryInfoList()){ + QDir themeDir(info.absoluteFilePath()); + themeDir.setFilter(QDir::Files); + themeFileList << themeDir.entryInfoList(QStringList() << "index.theme"); + } } - - foreach(QFileInfo info, themeFileList) - { - loadTheme(info.canonicalFilePath()); + foreach(QFileInfo info, themeFileList){ + loadTheme(info.canonicalFilePath()); } } -void IconThemePage::loadTheme(const QString &path) -{ - QSettings config(path, QSettings::IniFormat); - config.setIniCodec("UTF-8"); - - config.beginGroup("Icon Theme"); - QStringList dirs = config.value("Directories").toStringList(); - if(dirs.isEmpty() || config.value("Hidden", false).toBool()) - return; - +void IconThemePage::loadTheme(const QString &path){ + QSettings config(path, QSettings::IniFormat); + config.setIniCodec("UTF-8"); + config.beginGroup("Icon Theme"); + QStringList dirs = config.value("Directories").toStringList(); + if(dirs.isEmpty() || config.value("Hidden", false).toBool()) + return; QString name, comment; QString lang = QLocale::system().name(); - name = config.value(QString("Name[%1]").arg(lang)).toString(); comment = config.value(QString("Comment[%1]").arg(lang)).toString(); - if(lang.contains("_")) - lang = lang.split("_").first(); - - if(name.isEmpty()) + lang = lang.split("_").first(); + if(name.isEmpty()) name = config.value(QString("Name[%1]").arg(lang)).toString(); - - if(comment.isEmpty()) - comment = config.value(QString("Comment[%1]").arg(lang)).toString(); - - if(name.isEmpty()) - name = config.value("Name").toString(); - - if(comment.isEmpty()) - comment = config.value("Comment").toString(); - - config.endGroup(); - - QIcon icon1 = findIcon(path, 24, "document-save"); - QIcon icon2 = findIcon(path, 24, "document-print"); - QIcon icon3 = findIcon(path, 24, "media-playback-stop"); - - QTreeWidgetItem *item = new QTreeWidgetItem(); - item->setIcon(0, icon1); - item->setIcon(1, icon2); - item->setIcon(2, icon3); - item->setText(3, name); - item->setData(3, Qt::UserRole, QFileInfo(path).path().section("/", -1)); - item->setToolTip(3, comment); - item->setSizeHint(0, QSize(24,24)); - m_ui->treeWidget->addTopLevelItem(item); - - m_ui->treeWidget->resizeColumnToContents(0); - m_ui->treeWidget->resizeColumnToContents(1); - m_ui->treeWidget->resizeColumnToContents(2); - m_ui->treeWidget->resizeColumnToContents(3); + if(comment.isEmpty()) + comment = config.value(QString("Comment[%1]").arg(lang)).toString(); + if(name.isEmpty()) + name = config.value("Name").toString(); + if(comment.isEmpty()) + comment = config.value("Comment").toString(); + config.endGroup(); + QIcon icon1 = findIcon(path, 24, "document-save"); + QIcon icon2 = findIcon(path, 24, "document-print"); + QIcon icon3 = findIcon(path, 24, "media-playback-stop"); + QTreeWidgetItem *item = new QTreeWidgetItem(); + item->setIcon(0, icon1); + item->setIcon(1, icon2); + item->setIcon(2, icon3); + item->setText(3, name); + item->setData(3, Qt::UserRole, QFileInfo(path).path().section("/", -1)); + item->setToolTip(3, comment); + item->setSizeHint(0, QSize(24,24)); + m_ui->treeWidget->addTopLevelItem(item); + m_ui->treeWidget->resizeColumnToContents(0); + m_ui->treeWidget->resizeColumnToContents(1); + m_ui->treeWidget->resizeColumnToContents(2); + m_ui->treeWidget->resizeColumnToContents(3); } -QIcon IconThemePage::findIcon(const QString &themePath, int size, const QString &name) -{ - QSettings config(themePath, QSettings::IniFormat); - config.beginGroup("Icon Theme"); - QStringList dirs = config.value("Directories").toStringList(); - QStringList parents = config.value("Inherits").toStringList(); - bool haveInherits = config.contains("Inherits"); - config.endGroup(); - - foreach (QString dir, dirs) - { - config.beginGroup(dir); - if(config.value("Size").toInt() == size) - { - QDir iconDir = QFileInfo(themePath).path() + "/" + dir; - iconDir.setFilter(QDir::Files); - iconDir.setNameFilters(QStringList () << name + ".*"); - if(iconDir.entryInfoList().isEmpty()) - continue; - return QIcon(iconDir.entryInfoList().first().absoluteFilePath()); - } - config.endGroup(); +QIcon IconThemePage::findIcon(const QString &themePath, int size, const QString &name){ + QSettings config(themePath, QSettings::IniFormat); + config.beginGroup("Icon Theme"); + QStringList dirs = config.value("Directories").toStringList(); + QStringList parents = config.value("Inherits").toStringList(); + bool haveInherits = config.contains("Inherits"); + config.endGroup(); + foreach (QString dir, dirs){ + config.beginGroup(dir); + if(config.value("Size").toInt() == size){ + QDir iconDir = QFileInfo(themePath).path() + "/" + dir; + iconDir.setFilter(QDir::Files); + iconDir.setNameFilters(QStringList () << name + ".*"); + if(iconDir.entryInfoList().isEmpty()) + continue; + return QIcon(iconDir.entryInfoList().first().absoluteFilePath()); + } + config.endGroup(); } - - foreach (QString dir, dirs) - { - config.beginGroup(dir); - if(abs(config.value("Size").toInt() - size) < 4) - { - QDir iconDir = QFileInfo(themePath).path() + "/" + dir; - iconDir.setFilter(QDir::Files); - iconDir.setNameFilters(QStringList () << name + ".*"); - if(iconDir.entryInfoList().isEmpty()) - continue; - return QIcon(iconDir.entryInfoList().first().absoluteFilePath()); - } - config.endGroup(); + foreach (QString dir, dirs){ + config.beginGroup(dir); + if(abs(config.value("Size").toInt() - size) < 4){ + QDir iconDir = QFileInfo(themePath).path() + "/" + dir; + iconDir.setFilter(QDir::Files); + iconDir.setNameFilters(QStringList () << name + ".*"); + if(iconDir.entryInfoList().isEmpty()) + continue; + return QIcon(iconDir.entryInfoList().first().absoluteFilePath()); } - - if (!haveInherits) - return QIcon(); - + config.endGroup(); + } + if (!haveInherits) + return QIcon(); parents.append("hicolor"); //add fallback themes parents.append("gnome"); parents.removeDuplicates(); - - foreach (QString parent, parents) - { - QString parentThemePath = QDir(QFileInfo(themePath).path() + "/../" + parent).canonicalPath() + "/index.theme"; - - if(!QFile::exists(parentThemePath) || parentThemePath == themePath) - continue; - + foreach (QString parent, parents){ + QString parentThemePath = QDir(QFileInfo(themePath).path() + "/../" + parent).canonicalPath() + "/index.theme"; + if(!QFile::exists(parentThemePath) || parentThemePath == themePath) + continue; QIcon icon = findIcon(parentThemePath, size, name); if(!icon.isNull()) - return icon; - } - + return icon; + } return QIcon(); } diff --git a/src-qt5/core/lumina-theme-engine/src/lthemeengine/iconthemepage.h b/src-qt5/core/lumina-theme-engine/src/lthemeengine/iconthemepage.h index 0ccd64e0..8a6635ef 100644 --- a/src-qt5/core/lumina-theme-engine/src/lthemeengine/iconthemepage.h +++ b/src-qt5/core/lumina-theme-engine/src/lthemeengine/iconthemepage.h @@ -1,31 +1,3 @@ -/* - * Copyright (c) 2014-2017, Ilya Kotov <forkotov02@hotmail.ru> - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - #ifndef ICONTHEMEPAGE_H #define ICONTHEMEPAGE_H diff --git a/src-qt5/core/lumina-theme-engine/src/lthemeengine/interfacepage.cpp b/src-qt5/core/lumina-theme-engine/src/lthemeengine/interfacepage.cpp index a9f40080..a44e75e4 100644 --- a/src-qt5/core/lumina-theme-engine/src/lthemeengine/interfacepage.cpp +++ b/src-qt5/core/lumina-theme-engine/src/lthemeengine/interfacepage.cpp @@ -1,31 +1,3 @@ -/* - * Copyright (c) 2014-2017, Ilya Kotov <forkotov02@hotmail.ru> - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - #include <QSettings> #include <QApplication> #include <QDialogButtonBox> @@ -33,108 +5,84 @@ #include "interfacepage.h" #include "ui_interfacepage.h" -InterfacePage::InterfacePage(QWidget *parent) : - TabPage(parent), - m_ui(new Ui::InterfacePage) -{ - m_ui->setupUi(this); - - m_ui->buttonLayoutComboBox->addItem("Windows", QDialogButtonBox::WinLayout); - m_ui->buttonLayoutComboBox->addItem("Mac OS X", QDialogButtonBox::MacLayout); - m_ui->buttonLayoutComboBox->addItem("KDE", QDialogButtonBox::KdeLayout); - m_ui->buttonLayoutComboBox->addItem("GNOME", QDialogButtonBox::GnomeLayout); - - m_ui->toolButtonStyleComboBox->addItem(tr("Only display the icon"), Qt::ToolButtonIconOnly); - m_ui->toolButtonStyleComboBox->addItem(tr("Only display the text"), Qt::ToolButtonTextOnly); - m_ui->toolButtonStyleComboBox->addItem(tr("The text appears beside the icon"), Qt::ToolButtonTextBesideIcon); - m_ui->toolButtonStyleComboBox->addItem(tr("The text appears under the icon"), Qt::ToolButtonTextUnderIcon); - m_ui->toolButtonStyleComboBox->addItem(tr("Follow the application style"), Qt::ToolButtonFollowStyle); - - readSettings(); +InterfacePage::InterfacePage(QWidget *parent) : TabPage(parent), m_ui(new Ui::InterfacePage){ + m_ui->setupUi(this); + + m_ui->buttonLayoutComboBox->addItem("Windows", QDialogButtonBox::WinLayout); + m_ui->buttonLayoutComboBox->addItem("Mac OS X", QDialogButtonBox::MacLayout); + m_ui->buttonLayoutComboBox->addItem("KDE", QDialogButtonBox::KdeLayout); + m_ui->buttonLayoutComboBox->addItem("GNOME", QDialogButtonBox::GnomeLayout); + m_ui->toolButtonStyleComboBox->addItem(tr("Only display the icon"), Qt::ToolButtonIconOnly); + m_ui->toolButtonStyleComboBox->addItem(tr("Only display the text"), Qt::ToolButtonTextOnly); + m_ui->toolButtonStyleComboBox->addItem(tr("The text appears beside the icon"), Qt::ToolButtonTextBesideIcon); + m_ui->toolButtonStyleComboBox->addItem(tr("The text appears under the icon"), Qt::ToolButtonTextUnderIcon); + m_ui->toolButtonStyleComboBox->addItem(tr("Follow the application style"), Qt::ToolButtonFollowStyle); + readSettings(); } -InterfacePage::~InterfacePage() -{ - delete m_ui; +InterfacePage::~InterfacePage(){ + delete m_ui; } -void InterfacePage::writeSettings() -{ - QSettings settings(lthemeengine::configFile(), QSettings::IniFormat); - settings.beginGroup("Interface"); - settings.setValue("double_click_interval", m_ui->doubleClickIntervalSpinBox->value()); - settings.setValue("cursor_flash_time", m_ui->cursorFlashTimeSpinBox->value()); - settings.setValue("buttonbox_layout", m_ui->buttonLayoutComboBox->currentData()); - settings.setValue("menus_have_icons", m_ui->menuIconsCheckBox->isChecked()); - settings.setValue("activate_item_on_single_click", m_ui->singleClickCheckBox->checkState()); - settings.setValue("dialog_buttons_have_icons", m_ui->dialogIconsCheckBox->checkState()); - settings.setValue("toolbutton_style", m_ui->toolButtonStyleComboBox->currentData()); - settings.setValue("wheel_scroll_lines", m_ui->wheelScrollLinesSpinBox->value()); - - QStringList effects; - if(m_ui->guiEffectsCheckBox->isChecked()) - effects << "General"; - +void InterfacePage::writeSettings(){ + QSettings settings(lthemeengine::configFile(), QSettings::IniFormat); + settings.beginGroup("Interface"); + settings.setValue("double_click_interval", m_ui->doubleClickIntervalSpinBox->value()); + settings.setValue("cursor_flash_time", m_ui->cursorFlashTimeSpinBox->value()); + settings.setValue("buttonbox_layout", m_ui->buttonLayoutComboBox->currentData()); + settings.setValue("menus_have_icons", m_ui->menuIconsCheckBox->isChecked()); + settings.setValue("activate_item_on_single_click", m_ui->singleClickCheckBox->checkState()); + settings.setValue("dialog_buttons_have_icons", m_ui->dialogIconsCheckBox->checkState()); + settings.setValue("toolbutton_style", m_ui->toolButtonStyleComboBox->currentData()); + settings.setValue("wheel_scroll_lines", m_ui->wheelScrollLinesSpinBox->value()); + QStringList effects; + if(m_ui->guiEffectsCheckBox->isChecked()) + effects << "General"; if(m_ui->menuEffectComboBox->currentIndex() == 1) - effects << "AnimateMenu"; + effects << "AnimateMenu"; else if(m_ui->menuEffectComboBox->currentIndex() == 2) - effects << "FadeMenu"; - - if(m_ui->comboBoxEffectComboBox->currentIndex() == 1) + effects << "FadeMenu"; + if(m_ui->comboBoxEffectComboBox->currentIndex() == 1) effects << "AnimateCombo"; - - if(m_ui->toolTipEffectComboBox->currentIndex() == 1) - effects << "AnimateTooltip"; - else if(m_ui->toolTipEffectComboBox->currentIndex() == 2) - effects << "FadeTooltip"; - - if(m_ui->toolBoxEffectComboBox->currentIndex() == 1) - effects << "AnimateToolBox"; - - settings.setValue("gui_effects", effects); - settings.endGroup(); + if(m_ui->toolTipEffectComboBox->currentIndex() == 1) + effects << "AnimateTooltip"; + else if(m_ui->toolTipEffectComboBox->currentIndex() == 2) + effects << "FadeTooltip"; + if(m_ui->toolBoxEffectComboBox->currentIndex() == 1) + effects << "AnimateToolBox"; + settings.setValue("gui_effects", effects); + settings.endGroup(); } -void InterfacePage::readSettings() -{ - QSettings settings(lthemeengine::configFile(), QSettings::IniFormat); - settings.beginGroup("Interface"); - m_ui->doubleClickIntervalSpinBox->setValue(qApp->doubleClickInterval()); - m_ui->cursorFlashTimeSpinBox->setValue(qApp->cursorFlashTime()); - - m_ui->guiEffectsCheckBox->setChecked(qApp->isEffectEnabled(Qt::UI_General)); - - int layout = settings.value("buttonbox_layout", style()->styleHint(QStyle::SH_DialogButtonLayout)).toInt(); - int index = m_ui->buttonLayoutComboBox->findData(layout); - if(index >= 0) - m_ui->buttonLayoutComboBox->setCurrentIndex(index); - +void InterfacePage::readSettings(){ + QSettings settings(lthemeengine::configFile(), QSettings::IniFormat); + settings.beginGroup("Interface"); + m_ui->doubleClickIntervalSpinBox->setValue(qApp->doubleClickInterval()); + m_ui->cursorFlashTimeSpinBox->setValue(qApp->cursorFlashTime()); + m_ui->guiEffectsCheckBox->setChecked(qApp->isEffectEnabled(Qt::UI_General)); + int layout = settings.value("buttonbox_layout", style()->styleHint(QStyle::SH_DialogButtonLayout)).toInt(); + int index = m_ui->buttonLayoutComboBox->findData(layout); + if(index >= 0) + m_ui->buttonLayoutComboBox->setCurrentIndex(index); if(qApp->isEffectEnabled(Qt::UI_AnimateMenu)) - m_ui->menuEffectComboBox->setCurrentIndex(1); + m_ui->menuEffectComboBox->setCurrentIndex(1); else if(qApp->isEffectEnabled(Qt::UI_FadeMenu)) - m_ui->menuEffectComboBox->setCurrentIndex(2); - + m_ui->menuEffectComboBox->setCurrentIndex(2); if(qApp->isEffectEnabled(Qt::UI_AnimateCombo)) - m_ui->comboBoxEffectComboBox->setCurrentIndex(1); - - if(qApp->isEffectEnabled(Qt::UI_AnimateTooltip)) + m_ui->comboBoxEffectComboBox->setCurrentIndex(1); + if(qApp->isEffectEnabled(Qt::UI_AnimateTooltip)) m_ui->toolTipEffectComboBox->setCurrentIndex(1); - else if(qApp->isEffectEnabled(Qt::UI_FadeTooltip)) + else if(qApp->isEffectEnabled(Qt::UI_FadeTooltip)) m_ui->toolTipEffectComboBox->setCurrentIndex(2); - - if(qApp->isEffectEnabled(Qt::UI_AnimateToolBox)) - m_ui->toolBoxEffectComboBox->setCurrentIndex(1); - - m_ui->singleClickCheckBox->setCheckState((Qt::CheckState)settings.value("activate_item_on_single_click", Qt::PartiallyChecked).toInt()); - m_ui->dialogIconsCheckBox->setCheckState((Qt::CheckState)settings.value("dialog_buttons_have_icons", Qt::PartiallyChecked).toInt()); - m_ui->menuIconsCheckBox->setChecked(!qApp->testAttribute(Qt::AA_DontShowIconsInMenus)); - - int toolbarStyle = settings.value("toolbutton_style", Qt::ToolButtonFollowStyle).toInt(); - index = m_ui->toolButtonStyleComboBox->findData(toolbarStyle); - if(index >= 0) - m_ui->toolButtonStyleComboBox->setCurrentIndex(index); - - m_ui->wheelScrollLinesSpinBox->setValue(settings.value("wheel_scroll_lines", 3).toInt()); - - settings.endGroup(); + if(qApp->isEffectEnabled(Qt::UI_AnimateToolBox)) + m_ui->toolBoxEffectComboBox->setCurrentIndex(1); + m_ui->singleClickCheckBox->setCheckState((Qt::CheckState)settings.value("activate_item_on_single_click", Qt::PartiallyChecked).toInt()); + m_ui->dialogIconsCheckBox->setCheckState((Qt::CheckState)settings.value("dialog_buttons_have_icons", Qt::PartiallyChecked).toInt()); + m_ui->menuIconsCheckBox->setChecked(!qApp->testAttribute(Qt::AA_DontShowIconsInMenus)); + int toolbarStyle = settings.value("toolbutton_style", Qt::ToolButtonFollowStyle).toInt(); + index = m_ui->toolButtonStyleComboBox->findData(toolbarStyle); + if(index >= 0) + m_ui->toolButtonStyleComboBox->setCurrentIndex(index); + m_ui->wheelScrollLinesSpinBox->setValue(settings.value("wheel_scroll_lines", 3).toInt()); + settings.endGroup(); } diff --git a/src-qt5/core/lumina-theme-engine/src/lthemeengine/interfacepage.h b/src-qt5/core/lumina-theme-engine/src/lthemeengine/interfacepage.h index 637b6bf1..7946e599 100644 --- a/src-qt5/core/lumina-theme-engine/src/lthemeengine/interfacepage.h +++ b/src-qt5/core/lumina-theme-engine/src/lthemeengine/interfacepage.h @@ -1,31 +1,3 @@ -/* - * Copyright (c) 2014-2017, Ilya Kotov <forkotov02@hotmail.ru> - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - #ifndef INTERFACEPAGE_H #define INTERFACEPAGE_H diff --git a/src-qt5/core/lumina-theme-engine/src/lthemeengine/lthemeengine.cpp b/src-qt5/core/lumina-theme-engine/src/lthemeengine/lthemeengine.cpp index 65328963..979c8c43 100644 --- a/src-qt5/core/lumina-theme-engine/src/lthemeengine/lthemeengine.cpp +++ b/src-qt5/core/lumina-theme-engine/src/lthemeengine/lthemeengine.cpp @@ -1,31 +1,3 @@ -/* - * Copyright (c) 2014-2017, Ilya Kotov <forkotov02@hotmail.ru> - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - #include <QDir> #include <QLocale> #include "lthemeengine.h" @@ -35,98 +7,83 @@ #endif -QString lthemeengine::configPath() -{ - return QDir::homePath() + "/.config/lthemeengine/"; +QString lthemeengine::configPath(){ + return QDir::homePath() + "/.config/lthemeengine/"; } -QString lthemeengine::configFile() -{ - return configPath() + "lthemeengine.conf"; +QString lthemeengine::configFile(){ + return configPath() + "lthemeengine.conf"; } -QStringList lthemeengine::iconPaths() -{ - QString xdgDataDirs = qgetenv("XDG_DATA_DIRS"); - QString xdgDataHome = qgetenv("XDG_DATA_HOME"); - - QStringList paths; - paths << QDir::homePath() + "/.icons/"; - - if(xdgDataDirs.isEmpty()) - { - paths << "/usr/share/icons"; - paths << "/usr/local/share/icons"; +QStringList lthemeengine::iconPaths(){ + QString xdgDataDirs = qgetenv("XDG_DATA_DIRS"); + QString xdgDataHome = qgetenv("XDG_DATA_HOME"); + QStringList paths; + paths << QDir::homePath() + "/.icons/"; + if(xdgDataDirs.isEmpty()){ + paths << "/usr/share/icons"; + paths << "/usr/local/share/icons"; } - else - { - foreach (QString p, xdgDataDirs.split(":")) - paths << QDir(p + "/icons/").absolutePath(); + else{ + foreach (QString p, xdgDataDirs.split(":")) + paths << QDir(p + "/icons/").absolutePath(); } - - if(xdgDataHome.isEmpty()) - xdgDataHome = QDir::homePath() + "/.local/share"; - + if(xdgDataHome.isEmpty()) + xdgDataHome = QDir::homePath() + "/.local/share"; paths << "/usr/share/pixmaps"; paths << xdgDataHome + "/icons"; paths.removeDuplicates(); - //remove invalid - foreach (QString p, paths) - { - if(!QDir(p).exists()) - paths.removeAll(p); - } - return paths; + foreach (QString p, paths){ + if(!QDir(p).exists()) + paths.removeAll(p); + } + return paths; } -QString lthemeengine::userStyleSheetPath() -{ - return configPath() + "qss/"; +QString lthemeengine::userStyleSheetPath(){ + return configPath() + "qss/"; } -QStringList lthemeengine::sharedStyleSheetPath() - { - QStringList dirs; - dirs << QString(getenv("XDG_CONFIG_HOME")); - dirs << QString(getenv("XDG_CONFIG_DIRS")).split(":"); - for(int i=0; i<dirs.length(); i++){ - dirs[i].append("/lthemeengine/colors/"); +QStringList lthemeengine::sharedStyleSheetPath(){ + QStringList dirs; + dirs << QString(getenv("XDG_CONFIG_HOME")); + dirs << QString(getenv("XDG_CONFIG_DIRS")).split(":"); + for(int i=0; i<dirs.length(); i++){ + dirs[i].append("/lthemeengine/colors/"); } - if(dirs.isEmpty()){ - dirs << LTHEMEENGINE_DATADIR"/lthemeengine/qss/"; //no XDG settings - use the hardcoded path + if(dirs.isEmpty()){ + dirs << LTHEMEENGINE_DATADIR"/lthemeengine/qss/"; //no XDG settings - use the hardcoded path } - return dirs; + return dirs; } - QString lthemeengine::userColorSchemePath(){ - return configPath() + "colors/"; - } +QString lthemeengine::userColorSchemePath(){ + return configPath() + "colors/"; +} -QStringList lthemeengine::sharedColorSchemePath() - { - QStringList dirs; - dirs << QString(getenv("XDG_CONFIG_HOME")); - dirs << QString(getenv("XDG_CONFIG_DIRS")).split(":"); - for(int i=0; i<dirs.length(); i++){ - dirs[i].append("/lthemeengine/colors/"); +QStringList lthemeengine::sharedColorSchemePath(){ + QStringList dirs; + dirs << QString(getenv("XDG_CONFIG_HOME")); + dirs << QString(getenv("XDG_CONFIG_DIRS")).split(":"); + for(int i=0; i<dirs.length(); i++){ + dirs[i].append("/lthemeengine/colors/"); } - if(dirs.isEmpty()){ - dirs << LTHEMEENGINE_DATADIR"/lthemeengine/colors/"; //no XDG settings - use the hardcoded path + if(dirs.isEmpty()){ + dirs << LTHEMEENGINE_DATADIR"/lthemeengine/colors/"; //no XDG settings - use the hardcoded path } - return dirs; - } + return dirs; +} -QString lthemeengine::systemLanguageID() -{ +QString lthemeengine::systemLanguageID(){ #ifdef Q_OS_UNIX - QByteArray v = qgetenv ("LC_ALL"); - if (v.isEmpty()) - v = qgetenv ("LC_MESSAGES"); + QByteArray v = qgetenv ("LC_ALL"); + if (v.isEmpty()) + v = qgetenv ("LC_MESSAGES"); if (v.isEmpty()) - v = qgetenv ("LANG"); - if (!v.isEmpty()) + v = qgetenv ("LANG"); + if (!v.isEmpty()) return QLocale (v).name(); #endif - return QLocale::system().name(); + return QLocale::system().name(); } diff --git a/src-qt5/core/lumina-theme-engine/src/lthemeengine/lthemeengine.h b/src-qt5/core/lumina-theme-engine/src/lthemeengine/lthemeengine.h index 171f720a..93a1d433 100644 --- a/src-qt5/core/lumina-theme-engine/src/lthemeengine/lthemeengine.h +++ b/src-qt5/core/lumina-theme-engine/src/lthemeengine/lthemeengine.h @@ -1,31 +1,3 @@ -/* - * Copyright (c) 2014-2017, Ilya Kotov <forkotov02@hotmail.ru> - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - #ifndef LTHEMEENGINE_H #define LTHEMEENGINE_H diff --git a/src-qt5/core/lumina-theme-engine/src/lthemeengine/main.cpp b/src-qt5/core/lumina-theme-engine/src/lthemeengine/main.cpp index 1961d17d..55d0fc36 100644 --- a/src-qt5/core/lumina-theme-engine/src/lthemeengine/main.cpp +++ b/src-qt5/core/lumina-theme-engine/src/lthemeengine/main.cpp @@ -1,31 +1,3 @@ -/* - * Copyright (c) 2014-2017, Ilya Kotov <forkotov02@hotmail.ru> - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - #include <QApplication> #include <QLibraryInfo> #include <QLocale> @@ -36,49 +8,34 @@ #include <QStyleFactory> #include "mainwindow.h" -int main(int argc, char **argv) -{ - QApplication app(argc, argv); - QTranslator translator; - QString locale = lthemeengine::systemLanguageID(); - translator.load(QString(":/lthemeengine_") + locale); - app.installTranslator(&translator); - - QTranslator qt_translator; - qt_translator.load(QLibraryInfo::location (QLibraryInfo::TranslationsPath) + "/qtbase_" + locale); - app.installTranslator(&qt_translator); - - qDebug("Configuration path: %s", qPrintable(lthemeengine::configPath())); - qDebug("Shared QSS path: %s", qPrintable(lthemeengine::sharedStyleSheetPath().join(", "))); - - //checking environment - QStringList errorMessages; - QProcessEnvironment env = QProcessEnvironment::systemEnvironment(); - - if(env.contains("QT_STYLE_OVERRIDE")) - { - errorMessages << app.translate("main", "Please remove the <b>QT_STYLE_OVERRIDE</b> environment variable"); +int main(int argc, char **argv){ + QApplication app(argc, argv); + QTranslator translator; + QString locale = lthemeengine::systemLanguageID(); + translator.load(QString(":/lthemeengine_") + locale); + app.installTranslator(&translator); + QTranslator qt_translator; + qt_translator.load(QLibraryInfo::location (QLibraryInfo::TranslationsPath) + "/qtbase_" + locale); + app.installTranslator(&qt_translator); + qDebug("Configuration path: %s", qPrintable(lthemeengine::configPath())); + qDebug("Shared QSS path: %s", qPrintable(lthemeengine::sharedStyleSheetPath().join(", "))); + //checking environment + QStringList errorMessages; + QProcessEnvironment env = QProcessEnvironment::systemEnvironment(); + if(env.contains("QT_STYLE_OVERRIDE")){ + errorMessages << app.translate("main", "Please remove the <b>QT_STYLE_OVERRIDE</b> environment variable"); } - - if(env.value("QT_QPA_PLATFORMTHEME") != "lthemeengine") - { - errorMessages << app.translate("main", "The <b>QT_QPA_PLATFORMTHEME</b> environment " - "variable is not set correctly"); + if(env.value("QT_QPA_PLATFORMTHEME") != "lthemeengine"){ + errorMessages << app.translate("main", "The <b>QT_QPA_PLATFORMTHEME</b> environment variable is not set correctly"); } - - if(!QStyleFactory::keys().contains("lthemeengine-style")) - { - errorMessages << app.translate("main", "Unable to find <b>liblthemeengine-style.so</b>"); + if(!QStyleFactory::keys().contains("lthemeengine-style")){ + errorMessages << app.translate("main", "Unable to find <b>liblthemeengine-style.so</b>"); } - - if(!errorMessages.isEmpty()) - { - QMessageBox::critical(0, app.translate("main", "Error"), errorMessages.join("<br><br>")); - return 0; + if(!errorMessages.isEmpty()){ + QMessageBox::critical(0, app.translate("main", "Error"), errorMessages.join("<br><br>")); + return 0; } - - MainWindow w; - w.show(); - - return app.exec(); + MainWindow w; + w.show(); + return app.exec(); } 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 ed658e2e..c93b1052 100644 --- a/src-qt5/core/lumina-theme-engine/src/lthemeengine/mainwindow.cpp +++ b/src-qt5/core/lumina-theme-engine/src/lthemeengine/mainwindow.cpp @@ -1,31 +1,3 @@ -/* - * Copyright (c) 2014-2017, Ilya Kotov <forkotov02@hotmail.ru> - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - #include <QApplication> #include <QSettings> #include "lthemeengine.h" @@ -37,54 +9,41 @@ #include "qsspage.h" #include "ui_mainwindow.h" -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")); +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), tr("Style Sheets")); + m_ui->tabWidget->addTab(new QSSPage(this), tr("Style Sheets")); #endif - - QSettings settings(lthemeengine::configFile(), QSettings::IniFormat); - restoreGeometry(settings.value("SettingsWindow/geometry").toByteArray()); - - setWindowIcon(QIcon::fromTheme("preferences-desktop-theme")); - - m_ui->versionLabel->setText(tr("Version: %1").arg(LTHEMEENGINE_VERSION_STR)); + QSettings settings(lthemeengine::configFile(), QSettings::IniFormat); + restoreGeometry(settings.value("SettingsWindow/geometry").toByteArray()); + setWindowIcon(QIcon::fromTheme("preferences-desktop-theme")); + m_ui->versionLabel->setText(tr("Version: %1").arg(LTHEMEENGINE_VERSION_STR)); } -MainWindow::~MainWindow() -{ - delete m_ui; +MainWindow::~MainWindow(){ + delete m_ui; } -void MainWindow::closeEvent(QCloseEvent *) -{ - QSettings settings(lthemeengine::configFile(), QSettings::IniFormat); - settings.setValue("SettingsWindow/geometry", saveGeometry()); +void MainWindow::closeEvent(QCloseEvent *){ + QSettings settings(lthemeengine::configFile(), QSettings::IniFormat); + 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->tabWidget->count(); ++i) - { - TabPage *p = qobject_cast<TabPage*>(m_ui->tabWidget->widget(i)); - if(p) - p->writeSettings(); +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)); + if(p) + p->writeSettings(); } } - - if(id == QDialogButtonBox::Ok || id == QDialogButtonBox::Cancel) - { - close(); - qApp->quit(); + if(id == QDialogButtonBox::Ok || id == QDialogButtonBox::Cancel){ + close(); + qApp->quit(); } } 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 f532141c..749949a6 100644 --- a/src-qt5/core/lumina-theme-engine/src/lthemeengine/mainwindow.h +++ b/src-qt5/core/lumina-theme-engine/src/lthemeengine/mainwindow.h @@ -1,31 +1,3 @@ -/* - * Copyright (c) 2014-2017, Ilya Kotov <forkotov02@hotmail.ru> - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - #ifndef MAINWINDOW_H #define MAINWINDOW_H diff --git a/src-qt5/core/lumina-theme-engine/src/lthemeengine/paletteeditdialog.cpp b/src-qt5/core/lumina-theme-engine/src/lthemeengine/paletteeditdialog.cpp index 0f8fcf66..8a8e86d0 100644 --- a/src-qt5/core/lumina-theme-engine/src/lthemeengine/paletteeditdialog.cpp +++ b/src-qt5/core/lumina-theme-engine/src/lthemeengine/paletteeditdialog.cpp @@ -1,31 +1,3 @@ -/* - * Copyright (c) 2014-2017, Ilya Kotov <forkotov02@hotmail.ru> - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - #include <QPalette> #include <QColorDialog> #include <QSettings> @@ -33,114 +5,91 @@ #include "paletteeditdialog.h" #include "ui_paletteeditdialog.h" -PaletteEditDialog::PaletteEditDialog(const QPalette &palette, QStyle *currentStyle, QWidget *parent) : - QDialog(parent), - m_ui(new Ui::PaletteEditDialog) -{ - m_currentStyle = currentStyle; - m_ui->setupUi(this); - m_ui->tableWidget->setColumnCount(3); - m_ui->tableWidget->setRowCount(QPalette::NColorRoles); - m_ui->tableWidget->verticalHeader()->setDefaultSectionSize(fontMetrics().lineSpacing() + 10); - m_ui->tableWidget->verticalHeader()->setSectionResizeMode(QHeaderView::Fixed); - m_ui->tableWidget->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch); - - QStringList labels; - labels << tr("Active") << tr("Inactive") << tr("Disabled"); - m_ui->tableWidget->setHorizontalHeaderLabels(labels); - setPalette(palette); - - QSettings settings(lthemeengine::configFile(), QSettings::IniFormat); - restoreGeometry(settings.value("PaletteEditor/geometry").toByteArray()); +PaletteEditDialog::PaletteEditDialog(const QPalette &palette, QStyle *currentStyle, QWidget *parent) : QDialog(parent), m_ui(new Ui::PaletteEditDialog){ + m_currentStyle = currentStyle; + m_ui->setupUi(this); + m_ui->tableWidget->setColumnCount(3); + m_ui->tableWidget->setRowCount(QPalette::NColorRoles); + m_ui->tableWidget->verticalHeader()->setDefaultSectionSize(fontMetrics().lineSpacing() + 10); + m_ui->tableWidget->verticalHeader()->setSectionResizeMode(QHeaderView::Fixed); + m_ui->tableWidget->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch); + QStringList labels; + labels << tr("Active") << tr("Inactive") << tr("Disabled"); + m_ui->tableWidget->setHorizontalHeaderLabels(labels); + setPalette(palette); + QSettings settings(lthemeengine::configFile(), QSettings::IniFormat); + restoreGeometry(settings.value("PaletteEditor/geometry").toByteArray()); } -PaletteEditDialog::~PaletteEditDialog() -{ - delete m_ui; +PaletteEditDialog::~PaletteEditDialog(){ + delete m_ui; } -QPalette PaletteEditDialog::selectedPalette() const -{ - QPalette palette; - for(int i = 0; i < QPalette::NColorRoles; i++) - { - palette.setBrush(QPalette::Active, QPalette::ColorRole(i), m_ui->tableWidget->item(i,0)->backgroundColor()); - palette.setBrush(QPalette::Inactive, QPalette::ColorRole(i), m_ui->tableWidget->item(i,1)->backgroundColor()); - palette.setBrush(QPalette::Disabled, QPalette::ColorRole(i), m_ui->tableWidget->item(i,2)->backgroundColor()); +QPalette PaletteEditDialog::selectedPalette() const{ + QPalette palette; + for(int i = 0; i < QPalette::NColorRoles; i++){ + palette.setBrush(QPalette::Active, QPalette::ColorRole(i), m_ui->tableWidget->item(i,0)->backgroundColor()); + palette.setBrush(QPalette::Inactive, QPalette::ColorRole(i), m_ui->tableWidget->item(i,1)->backgroundColor()); + palette.setBrush(QPalette::Disabled, QPalette::ColorRole(i), m_ui->tableWidget->item(i,2)->backgroundColor()); } - return palette; + return palette; } -void PaletteEditDialog::setPalette(const QPalette &palette) -{ - for(int i = 0; i < QPalette::NColorRoles; i++) - { - if(!m_ui->tableWidget->item(i,0)) - m_ui->tableWidget->setItem(i, 0, new QTableWidgetItem()); - if(!m_ui->tableWidget->item(i,1)) - m_ui->tableWidget->setItem(i, 1, new QTableWidgetItem()); +void PaletteEditDialog::setPalette(const QPalette &palette){ + for(int i = 0; i < QPalette::NColorRoles; i++){ + if(!m_ui->tableWidget->item(i,0)) + m_ui->tableWidget->setItem(i, 0, new QTableWidgetItem()); + if(!m_ui->tableWidget->item(i,1)) + m_ui->tableWidget->setItem(i, 1, new QTableWidgetItem()); if(!m_ui->tableWidget->item(i,2)) - m_ui->tableWidget->setItem(i, 2, new QTableWidgetItem()); - - m_ui->tableWidget->item(i,0)->setBackgroundColor(palette.color(QPalette::Active, QPalette::ColorRole(i))); - m_ui->tableWidget->item(i,1)->setBackgroundColor(palette.color(QPalette::Inactive, QPalette::ColorRole(i))); - m_ui->tableWidget->item(i,2)->setBackgroundColor(palette.color(QPalette::Disabled, QPalette::ColorRole(i))); + m_ui->tableWidget->setItem(i, 2, new QTableWidgetItem()); + m_ui->tableWidget->item(i,0)->setBackgroundColor(palette.color(QPalette::Active, QPalette::ColorRole(i))); + m_ui->tableWidget->item(i,1)->setBackgroundColor(palette.color(QPalette::Inactive, QPalette::ColorRole(i))); + m_ui->tableWidget->item(i,2)->setBackgroundColor(palette.color(QPalette::Disabled, QPalette::ColorRole(i))); } - - QStringList labels; - labels << tr("Window text") << tr("Button background") << tr("Bright") << tr("Less bright") << tr("Dark") << tr("Less dark") - << tr("Normal text") << tr("Bright text") << tr("Button text") << tr("Normal background") << tr("Window") << tr("Shadow") - << tr("Highlight") << tr("Highlighted text") << tr("Link") << tr("Visited link") - << tr("Alternate background") << tr("Default") << tr("Tooltip background") << tr("Tooltip text"); - m_ui->tableWidget->setVerticalHeaderLabels(labels); + QStringList labels; + labels << tr("Window text") << tr("Button background") << tr("Bright") << tr("Less bright") << tr("Dark") << tr("Less dark") << tr("Normal text") << tr("Bright text") << tr("Button text") << tr("Normal background") << tr("Window") << tr("Shadow") << tr("Highlight") << tr("Highlighted text") << tr("Link") << tr("Visited link") << tr("Alternate background") << tr("Default") << tr("Tooltip background") << tr("Tooltip text"); + m_ui->tableWidget->setVerticalHeaderLabels(labels); } -void PaletteEditDialog::hideEvent(QHideEvent *) -{ - QSettings settings(lthemeengine::configFile(), QSettings::IniFormat); - settings.setValue("PaletteEditor/geometry", saveGeometry()); +void PaletteEditDialog::hideEvent(QHideEvent *){ + QSettings settings(lthemeengine::configFile(), QSettings::IniFormat); + settings.setValue("PaletteEditor/geometry", saveGeometry()); } -void PaletteEditDialog::on_tableWidget_itemClicked(QTableWidgetItem *item) -{ - QColor color = QColorDialog::getColor(item->backgroundColor(), this, tr("Select Color")); - if(color.isValid()) - { - item->setBackgroundColor(color); - emit paletteChanged(selectedPalette()); +void PaletteEditDialog::on_tableWidget_itemClicked(QTableWidgetItem *item){ + QColor color = QColorDialog::getColor(item->backgroundColor(), this, tr("Select Color")); + if(color.isValid()){ + item->setBackgroundColor(color); + emit paletteChanged(selectedPalette()); } } -void PaletteEditDialog::on_resetPaletteButton_clicked() -{ - setPalette(m_currentStyle->standardPalette()); - emit paletteChanged(selectedPalette()); +void PaletteEditDialog::on_resetPaletteButton_clicked(){ + setPalette(m_currentStyle->standardPalette()); + emit paletteChanged(selectedPalette()); } -void PaletteEditDialog::on_buildInactiveButton_clicked() -{ - QPalette palette = selectedPalette(); - for(int i = 0; i < QPalette::NColorRoles; i++) - { - palette.setColor(QPalette::Inactive, QPalette::ColorRole(i), - palette.color(QPalette::Active, QPalette::ColorRole(i))); +void PaletteEditDialog::on_buildInactiveButton_clicked(){ + QPalette palette = selectedPalette(); + for(int i = 0; i < QPalette::NColorRoles; i++){ + palette.setColor(QPalette::Inactive, QPalette::ColorRole(i), + palette.color(QPalette::Active, QPalette::ColorRole(i))); } - setPalette(palette); - emit paletteChanged(selectedPalette()); + setPalette(palette); + emit paletteChanged(selectedPalette()); } -void PaletteEditDialog::on_buildDisabledButton_clicked() -{ - QPalette palette = selectedPalette(); - for(int i = 0; i < QPalette::NColorRoles; i++) - { - palette.setColor(QPalette::Disabled, QPalette::ColorRole(i), - palette.color(QPalette::Active, QPalette::ColorRole(i))); +void PaletteEditDialog::on_buildDisabledButton_clicked(){ + QPalette palette = selectedPalette(); + for(int i = 0; i < QPalette::NColorRoles; i++){ + palette.setColor(QPalette::Disabled, QPalette::ColorRole(i), + palette.color(QPalette::Active, QPalette::ColorRole(i))); } - palette.setColor(QPalette::Disabled, QPalette::ButtonText, Qt::darkGray); - palette.setColor(QPalette::Disabled, QPalette::WindowText, Qt::darkGray); - palette.setColor(QPalette::Disabled, QPalette::Text, Qt::darkGray); - palette.setColor(QPalette::Disabled, QPalette::HighlightedText, Qt::darkGray); - setPalette(palette); - emit paletteChanged(selectedPalette()); + palette.setColor(QPalette::Disabled, QPalette::ButtonText, Qt::darkGray); + palette.setColor(QPalette::Disabled, QPalette::WindowText, Qt::darkGray); + palette.setColor(QPalette::Disabled, QPalette::Text, Qt::darkGray); + palette.setColor(QPalette::Disabled, QPalette::HighlightedText, Qt::darkGray); + setPalette(palette); + emit paletteChanged(selectedPalette()); } diff --git a/src-qt5/core/lumina-theme-engine/src/lthemeengine/paletteeditdialog.h b/src-qt5/core/lumina-theme-engine/src/lthemeengine/paletteeditdialog.h index c8691a3c..040692f6 100644 --- a/src-qt5/core/lumina-theme-engine/src/lthemeengine/paletteeditdialog.h +++ b/src-qt5/core/lumina-theme-engine/src/lthemeengine/paletteeditdialog.h @@ -1,31 +1,3 @@ -/* - * Copyright (c) 2014-2017, Ilya Kotov <forkotov02@hotmail.ru> - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - #ifndef PALETTEEDITDIALOG_H #define PALETTEEDITDIALOG_H 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 b92b5619..aa4bb810 100644 --- a/src-qt5/core/lumina-theme-engine/src/lthemeengine/qsseditordialog.cpp +++ b/src-qt5/core/lumina-theme-engine/src/lthemeengine/qsseditordialog.cpp @@ -1,85 +1,45 @@ -/* - * Copyright (c) 2014-2017, Ilya Kotov <forkotov02@hotmail.ru> - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - #include <QFile> #include <QSettings> #include "lthemeengine.h" #include "qsseditordialog.h" #include "ui_qsseditordialog.h" -QSSEditorDialog::QSSEditorDialog(const QString &filePath, QWidget *parent) : - QDialog(parent), - m_ui(new Ui::QSSEditorDialog) -{ - m_ui->setupUi(this); - m_filePath = filePath; - - QFile file(filePath); - file.open(QIODevice::ReadOnly); - m_ui->textEdit->setPlainText(QString::fromUtf8(file.readAll())); - setWindowTitle(tr("%1 - Style Sheet Editor").arg(file.fileName())); - - QSettings settings(lthemeengine::configFile(), QSettings::IniFormat); - restoreGeometry(settings.value("QSSEditor/geometry").toByteArray()); +QSSEditorDialog::QSSEditorDialog(const QString &filePath, QWidget *parent) : QDialog(parent), m_ui(new Ui::QSSEditorDialog){ + m_ui->setupUi(this); + m_filePath = filePath; + QFile file(filePath); + file.open(QIODevice::ReadOnly); + m_ui->textEdit->setPlainText(QString::fromUtf8(file.readAll())); + setWindowTitle(tr("%1 - Style Sheet Editor").arg(file.fileName())); + QSettings settings(lthemeengine::configFile(), QSettings::IniFormat); + restoreGeometry(settings.value("QSSEditor/geometry").toByteArray()); } -QSSEditorDialog::~QSSEditorDialog() -{ - delete m_ui; +QSSEditorDialog::~QSSEditorDialog(){ + delete m_ui; } -void QSSEditorDialog::save() -{ - QFile file(m_filePath); - file.open(QIODevice::WriteOnly); - file.write(m_ui->textEdit->toPlainText().toUtf8()); +void QSSEditorDialog::save(){ + QFile file(m_filePath); + file.open(QIODevice::WriteOnly); + file.write(m_ui->textEdit->toPlainText().toUtf8()); } -void QSSEditorDialog::hideEvent(QHideEvent *) -{ - QSettings settings(lthemeengine::configFile(), QSettings::IniFormat); - settings.setValue("QSSEditor/geometry", saveGeometry()); +void QSSEditorDialog::hideEvent(QHideEvent *){ + QSettings settings(lthemeengine::configFile(), QSettings::IniFormat); + settings.setValue("QSSEditor/geometry", saveGeometry()); } -void QSSEditorDialog::on_buttonBox_clicked(QAbstractButton *button) -{ - QDialogButtonBox::StandardButton id = m_ui->buttonBox->standardButton(button); - if(id == QDialogButtonBox::Ok) - { - save(); - accept(); - } - else if(id == QDialogButtonBox::Save) - { - save(); +void QSSEditorDialog::on_buttonBox_clicked(QAbstractButton *button){ + QDialogButtonBox::StandardButton id = m_ui->buttonBox->standardButton(button); + if(id == QDialogButtonBox::Ok){ + save(); + accept(); } - else - { - reject(); + else if(id == QDialogButtonBox::Save){ + save(); } + else{ + reject(); + } } 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 e2a6c773..ea615e81 100644 --- a/src-qt5/core/lumina-theme-engine/src/lthemeengine/qsseditordialog.h +++ b/src-qt5/core/lumina-theme-engine/src/lthemeengine/qsseditordialog.h @@ -1,31 +1,3 @@ -/* - * Copyright (c) 2014-2017, Ilya Kotov <forkotov02@hotmail.ru> - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - #ifndef QSSEDITORDIALOG_H #define QSSEDITORDIALOG_H 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 10f21f48..c9bfc14a 100644 --- a/src-qt5/core/lumina-theme-engine/src/lthemeengine/qsspage.cpp +++ b/src-qt5/core/lumina-theme-engine/src/lthemeengine/qsspage.cpp @@ -1,31 +1,3 @@ -/* - * Copyright (c) 2014-2017, Ilya Kotov <forkotov02@hotmail.ru> - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - #include <QSettings> #include <QDir> #include <QInputDialog> @@ -40,193 +12,145 @@ #define QSS_FULL_PATH_ROLE (Qt::ItemDataRole(Qt::UserRole)) #define QSS_WRITABLE_ROLE (Qt::ItemDataRole(Qt::UserRole + 1)) -QSSPage::QSSPage(QWidget *parent) : - TabPage(parent), - m_ui(new Ui::QSSPage) -{ - m_ui->setupUi(this); - QDir("/").mkpath(lthemeengine::userStyleSheetPath()); - - m_menu = new QMenu(this); - m_menu->addAction(QIcon::fromTheme("accessories-text-editor"), tr("Edit"), this, SLOT(on_editButton_clicked())); - m_menu->addAction(tr("Rename"), this, SLOT(on_renameButton_clicked())); - m_menu->addSeparator(); - m_menu->addAction(QIcon::fromTheme("edit-delete"), tr("Remove"), this, SLOT(on_removeButton_clicked())); - - readSettings(); - - //icons - m_ui->createButton->setIcon(QIcon::fromTheme("document-new")); - m_ui->editButton->setIcon(QIcon::fromTheme("accessories-text-editor")); - m_ui->removeButton->setIcon(QIcon::fromTheme("edit-delete")); +QSSPage::QSSPage(QWidget *parent) : TabPage(parent), m_ui(new Ui::QSSPage){ + m_ui->setupUi(this); + QDir("/").mkpath(lthemeengine::userStyleSheetPath()); + m_menu = new QMenu(this); + m_menu->addAction(QIcon::fromTheme("accessories-text-editor"), tr("Edit"), this, SLOT(on_editButton_clicked())); + m_menu->addAction(tr("Rename"), this, SLOT(on_renameButton_clicked())); + m_menu->addSeparator(); + m_menu->addAction(QIcon::fromTheme("edit-delete"), tr("Remove"), this, SLOT(on_removeButton_clicked())); + readSettings(); + //icons + m_ui->createButton->setIcon(QIcon::fromTheme("document-new")); + m_ui->editButton->setIcon(QIcon::fromTheme("accessories-text-editor")); + m_ui->removeButton->setIcon(QIcon::fromTheme("edit-delete")); } -QSSPage::~QSSPage() -{ - delete m_ui; +QSSPage::~QSSPage(){ + delete m_ui; } -void QSSPage::writeSettings() -{ - QStringList styleSheets; - QSettings settings(lthemeengine::configFile(), QSettings::IniFormat); - - for(int i = 0; i < m_ui->qssListWidget->count(); ++i) - { - QListWidgetItem *item = m_ui->qssListWidget->item(i); - if(item->checkState() == Qt::Checked) - styleSheets << item->data(QSS_FULL_PATH_ROLE).toString(); +void QSSPage::writeSettings(){ + QStringList styleSheets; + QSettings settings(lthemeengine::configFile(), QSettings::IniFormat); + for(int i = 0; i < m_ui->qssListWidget->count(); ++i){ + QListWidgetItem *item = m_ui->qssListWidget->item(i); + if(item->checkState() == Qt::Checked) + styleSheets << item->data(QSS_FULL_PATH_ROLE).toString(); } - - settings.setValue("Interface/stylesheets", styleSheets); + settings.setValue("Interface/stylesheets", styleSheets); } -void QSSPage::on_qssListWidget_currentItemChanged(QListWidgetItem *current, QListWidgetItem *) -{ - 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()); +void QSSPage::on_qssListWidget_currentItemChanged(QListWidgetItem *current, QListWidgetItem *){ + 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); + else{ + m_ui->editButton->setEnabled(false); + m_ui->removeButton->setEnabled(false); + m_ui->renameButton->setEnabled(false); } } -void QSSPage::on_createButton_clicked() -{ - QString name = QInputDialog::getText(this, tr("Enter Style Sheet Name"), tr("File name:")); - if(name.isEmpty()) - return; - +void QSSPage::on_createButton_clicked(){ + QString name = QInputDialog::getText(this, tr("Enter Style Sheet Name"), tr("File name:")); + if(name.isEmpty()) + return; if(!name.endsWith(".qss", Qt::CaseInsensitive)) - name.append(".qss"); - - QString filePath = lthemeengine::userStyleSheetPath() + name; - - if(QFile::exists(filePath)) - { + name.append(".qss"); + QString filePath = lthemeengine::userStyleSheetPath() + name; + if(QFile::exists(filePath)){ QMessageBox::warning(this, tr("Error"), tr("The file \"%1\" already exists").arg(filePath)); return; - } - - //creating empty file - QFile file(filePath); - file.open(QIODevice::WriteOnly); - file.close(); - - //creating item - QFileInfo info(filePath); - QListWidgetItem *item = new QListWidgetItem(info.fileName(), m_ui->qssListWidget); - item->setToolTip(info.filePath()); - item->setData(QSS_FULL_PATH_ROLE, info.filePath()); - item->setData(QSS_WRITABLE_ROLE, info.isWritable()); - item->setCheckState(Qt::Unchecked); + } + //creating empty file + QFile file(filePath); + file.open(QIODevice::WriteOnly); + file.close(); + //creating item + QFileInfo info(filePath); + QListWidgetItem *item = new QListWidgetItem(info.fileName(), m_ui->qssListWidget); + item->setToolTip(info.filePath()); + item->setData(QSS_FULL_PATH_ROLE, info.filePath()); + item->setData(QSS_WRITABLE_ROLE, info.isWritable()); + item->setCheckState(Qt::Unchecked); } -void QSSPage::on_editButton_clicked() -{ - QListWidgetItem *item = m_ui->qssListWidget->currentItem(); - if(item) - { - QSSEditorDialog dialog(item->data(QSS_FULL_PATH_ROLE).toString(), this); - dialog.exec(); +void QSSPage::on_editButton_clicked(){ + QListWidgetItem *item = m_ui->qssListWidget->currentItem(); + if(item){ + QSSEditorDialog dialog(item->data(QSS_FULL_PATH_ROLE).toString(), this); + dialog.exec(); } } -void QSSPage::on_removeButton_clicked() -{ - QListWidgetItem *item = m_ui->qssListWidget->currentItem(); - 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_removeButton_clicked(){ + QListWidgetItem *item = m_ui->qssListWidget->currentItem(); + 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::readSettings() -{ - //load stylesheets - m_ui->qssListWidget->clear(); - findStyleSheets(lthemeengine::userStyleSheetPath()); - findStyleSheets(lthemeengine::sharedStyleSheetPath().join(", ")); - - QSettings settings(lthemeengine::configFile(), QSettings::IniFormat); - QStringList styleSheets = settings.value("Interface/stylesheets").toStringList(); - 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::readSettings(){ + //load stylesheets + m_ui->qssListWidget->clear(); + findStyleSheets(lthemeengine::userStyleSheetPath()); + findStyleSheets(lthemeengine::sharedStyleSheetPath().join(", ")); + QSettings settings(lthemeengine::configFile(), QSettings::IniFormat); + QStringList styleSheets = settings.value("Interface/stylesheets").toStringList(); + 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(const QString &path) -{ - QDir dir(path); - dir.setFilter(QDir::Files); - dir.setNameFilters(QStringList() << "*.qss"); - - foreach (QFileInfo info, dir.entryInfoList()) - { - QListWidgetItem *item = new QListWidgetItem(info.fileName(), m_ui->qssListWidget); - item->setToolTip(info.filePath()); - item->setData(QSS_FULL_PATH_ROLE, info.filePath()); - item->setData(QSS_WRITABLE_ROLE, info.isWritable()); +void QSSPage::findStyleSheets(const QString &path){ + QDir dir(path); + dir.setFilter(QDir::Files); + dir.setNameFilters(QStringList() << "*.qss"); + foreach (QFileInfo info, dir.entryInfoList()){ + QListWidgetItem *item = new QListWidgetItem(info.fileName(), m_ui->qssListWidget); + item->setToolTip(info.filePath()); + item->setData(QSS_FULL_PATH_ROLE, info.filePath()); + item->setData(QSS_WRITABLE_ROLE, info.isWritable()); } } -void QSSPage::on_renameButton_clicked() -{ - QListWidgetItem *item = m_ui->qssListWidget->currentItem(); - if(!item) - return; - - QString name = QInputDialog::getText(this, tr("Rename Style Sheet"), tr("Style sheet name:"), - QLineEdit::Normal, item->text(), 0); +void QSSPage::on_renameButton_clicked(){ + QListWidgetItem *item = m_ui->qssListWidget->currentItem(); + 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()) - { - QMessageBox::warning(this, tr("Error"), tr("The style sheet \"%1\" already exists").arg(name)); - return; - } - - if(!name.endsWith(".qss", Qt::CaseInsensitive)) - name.append(".qss"); - - QString newPath = lthemeengine::userStyleSheetPath() + name; - - if(!QFile::rename(item->data(QSS_FULL_PATH_ROLE).toString(), newPath)) - { + return; + if(!m_ui->qssListWidget->findItems(name, Qt::MatchExactly).isEmpty()){ + QMessageBox::warning(this, tr("Error"), tr("The style sheet \"%1\" already exists").arg(name)); + return; + } + if(!name.endsWith(".qss", Qt::CaseInsensitive)) name.append(".qss"); + QString newPath = lthemeengine::userStyleSheetPath() + name; + if(!QFile::rename(item->data(QSS_FULL_PATH_ROLE).toString(), newPath)){ QMessageBox::warning(this, tr("Error"), tr("Unable to rename file")); - return; - } - - item->setText(name); - item->setData(QSS_FULL_PATH_ROLE, newPath); - item->setToolTip(newPath); + return; + } + item->setText(name); + item->setData(QSS_FULL_PATH_ROLE, newPath); + item->setToolTip(newPath); } -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)); - } +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)); + } } 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 665f68c0..1fe0ed73 100644 --- a/src-qt5/core/lumina-theme-engine/src/lthemeengine/qsspage.h +++ b/src-qt5/core/lumina-theme-engine/src/lthemeengine/qsspage.h @@ -1,31 +1,3 @@ -/* - * Copyright (c) 2014-2017, Ilya Kotov <forkotov02@hotmail.ru> - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - #ifndef QSSPAGE_H #define QSSPAGE_H diff --git a/src-qt5/core/lumina-theme-engine/src/lthemeengine/tabpage.cpp b/src-qt5/core/lumina-theme-engine/src/lthemeengine/tabpage.cpp index 251ce024..a8f4b959 100644 --- a/src-qt5/core/lumina-theme-engine/src/lthemeengine/tabpage.cpp +++ b/src-qt5/core/lumina-theme-engine/src/lthemeengine/tabpage.cpp @@ -1,33 +1,4 @@ -/* - * Copyright (c) 2014-2017, Ilya Kotov <forkotov02@hotmail.ru> - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - #include "tabpage.h" -TabPage::TabPage(QWidget *parent) : QWidget(parent) -{ +TabPage::TabPage(QWidget *parent) : QWidget(parent){ } diff --git a/src-qt5/core/lumina-theme-engine/src/lthemeengine/tabpage.h b/src-qt5/core/lumina-theme-engine/src/lthemeengine/tabpage.h index ac285054..b4dd57d1 100644 --- a/src-qt5/core/lumina-theme-engine/src/lthemeengine/tabpage.h +++ b/src-qt5/core/lumina-theme-engine/src/lthemeengine/tabpage.h @@ -1,31 +1,3 @@ -/* - * Copyright (c) 2014-2017, Ilya Kotov <forkotov02@hotmail.ru> - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - #ifndef TABPAGE_H #define TABPAGE_H |