diff --git a/src/core/plugin.cpp b/src/core/plugin.cpp index 8f8a6d9..50a6106 100644 --- a/src/core/plugin.cpp +++ b/src/core/plugin.cpp @@ -16,7 +16,7 @@ void QQuickNemoControlsExtensionPlugin::initializeEngine(QQmlEngine* engine, con QQmlExtensionPlugin::initializeEngine(engine, uri); QQmlContext* context = engine->rootContext(); - context->setContextProperty("size", theme->size); + context->setContextProperty("size", theme->size()); context->setContextProperty("Theme", theme); engine->addImageProvider(QLatin1String("theme"), new NemoImageProvider); diff --git a/src/core/theme.cpp b/src/core/theme.cpp index 6efc686..cad66ab 100644 --- a/src/core/theme.cpp +++ b/src/core/theme.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018-2021 Chupligin Sergey + * Copyright (C) 2018-2025 Chupligin Sergey * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -28,8 +28,9 @@ Theme::Theme(QObject* parent) : QObject(parent) + , m_size(new Sizing) { - size = new Sizing; + m_size = new Sizing; loadDefaultValue(); @@ -37,7 +38,7 @@ Theme::Theme(QObject* parent) m_theme = m_themeValue->value().toString(); connect(m_themeValue, &MDConfItem::valueChanged, this, &Theme::themeValueChanged); - connect(size, &Sizing::dpScaleFactorChanged, this, &Theme::setThemeValues); + connect(m_size, &Sizing::dpScaleFactorChanged, this, &Theme::setThemeValues); if (!m_theme.isEmpty()) { loadTheme(m_theme); @@ -83,126 +84,103 @@ void Theme::setThemeValues() if (theme.value("iconSizeLauncher").toString().toFloat() != 0 && theme.value("iconSizeLauncher").toString().toFloat() != m_iconSizeLauncher) { m_iconSizeLauncher = theme.value("iconSizeLauncher").toString().toFloat(); - emit iconSizeLauncherChanged(); updated = true; } if (theme.value("itemWidthExtraLarge").toString().toFloat() != 0 && floor(theme.value("itemWidthExtraLarge").toString().toFloat()) != m_itemWidthExtraLarge) { - m_itemWidthExtraLarge = floor(theme.value("itemWidthExtraLarge").toString().toFloat() * size->dpScaleFactor()); - emit itemWidthExtraLargeChanged(); + m_itemWidthExtraLarge = floor(theme.value("itemWidthExtraLarge").toString().toFloat() * m_size->dpScaleFactor()); updated = true; } + if (theme.value("itemWidthLarge").toString().toFloat() != 0 && floor(theme.value("itemWidthLarge").toString().toFloat()) != m_itemWidthLarge) { - m_itemWidthLarge = floor(theme.value("itemWidthLarge").toString().toFloat() * size->dpScaleFactor()); - emit itemWidthLargeChanged(); + m_itemWidthLarge = floor(theme.value("itemWidthLarge").toString().toFloat() * m_size->dpScaleFactor()); updated = true; } if (theme.value("itemWidthMedium").toString().toFloat() != 0 && floor(theme.value("itemWidthMedium").toString().toFloat()) != m_itemWidthMedium) { - m_itemWidthMedium = floor(theme.value("itemWidthMedium").toString().toFloat() * size->dpScaleFactor()); - emit itemWidthMediumChanged(); + m_itemWidthMedium = floor(theme.value("itemWidthMedium").toString().toFloat() * m_size->dpScaleFactor()); updated = true; } if (theme.value("itemWidthSmall").toString().toFloat() != 0 && floor(theme.value("itemWidthSmall").toString().toFloat()) != m_itemWidthSmall) { - m_itemWidthSmall = floor(theme.value("itemWidthSmall").toString().toFloat() * size->dpScaleFactor()); - emit itemWidthSmallChanged(); + m_itemWidthSmall = floor(theme.value("itemWidthSmall").toString().toFloat() * m_size->dpScaleFactor()); updated = true; } if (theme.value("itemWidthExtraSmall").toString().toFloat() != 0 && floor(theme.value("itemWidthExtraSmall").toString().toFloat()) != m_itemWidthExtraSmall) { - m_itemWidthExtraSmall = floor(theme.value("itemWidthExtraSmall").toString().toFloat() * size->dpScaleFactor()); - emit itemWidthExtraSmallChanged(); + m_itemWidthExtraSmall = floor(theme.value("itemWidthExtraSmall").toString().toFloat() * m_size->dpScaleFactor()); updated = true; } if (theme.value("itemHeightHuge").toString().toFloat() != 0 && floor(theme.value("itemHeightHuge").toString().toFloat()) != m_itemHeightHuge) { - m_itemHeightHuge = floor(theme.value("itemHeightHuge").toString().toFloat() * size->dpScaleFactor()); - emit itemHeightHugeChanged(); + m_itemHeightHuge = floor(theme.value("itemHeightHuge").toString().toFloat() * m_size->dpScaleFactor()); updated = true; } if (theme.value("itemHeightExtraLarge").toString().toFloat() != 0 && floor(theme.value("itemHeightExtraLarge").toString().toFloat()) != m_itemHeightExtraLarge) { - m_itemHeightExtraLarge = floor(theme.value("itemHeightExtraLarge").toString().toFloat() * size->dpScaleFactor()); - emit itemHeightExtraLargeChanged(); + m_itemHeightExtraLarge = floor(theme.value("itemHeightExtraLarge").toString().toFloat() * m_size->dpScaleFactor()); updated = true; } if (theme.value("itemHeightLarge").toString().toFloat() != 0 && floor(theme.value("itemHeightLarge").toString().toFloat()) != m_itemHeightLarge) { - m_itemHeightLarge = floor(theme.value("itemHeightLarge").toString().toFloat() * size->dpScaleFactor()); - emit itemHeightLargeChanged(); + m_itemHeightLarge = floor(theme.value("itemHeightLarge").toString().toFloat() * m_size->dpScaleFactor()); updated = true; } if (theme.value("itemHeightMedium").toString().toFloat() != 0 && floor(theme.value("itemHeightMedium").toString().toFloat()) != m_itemHeightMedium) { - m_itemHeightMedium = floor(theme.value("itemHeightMedium").toString().toFloat() * size->dpScaleFactor()); - emit itemHeightMediumChanged(); + m_itemHeightMedium = floor(theme.value("itemHeightMedium").toString().toFloat() * m_size->dpScaleFactor()); updated = true; } if (theme.value("itemHeightSmall").toString().toFloat() != 0 && floor(theme.value("itemHeightSmall").toString().toFloat()) != m_itemHeightSmall) { - m_itemHeightSmall = floor(theme.value("itemHeightSmall").toString().toFloat() * size->dpScaleFactor()); - emit itemHeightSmallChanged(); + m_itemHeightSmall = floor(theme.value("itemHeightSmall").toString().toFloat() * m_size->dpScaleFactor()); updated = true; } if (theme.value("itemHeightExtraSmall").toString().toFloat() != 0 && floor(theme.value("itemHeightExtraSmall").toString().toFloat()) != m_itemHeightExtraSmall) { - m_itemHeightExtraSmall = floor(theme.value("itemHeightExtraSmall").toString().toFloat() * size->dpScaleFactor()); - emit itemHeightExtraSmallChanged(); + m_itemHeightExtraSmall = floor(theme.value("itemHeightExtraSmall").toString().toFloat() * m_size->dpScaleFactor()); updated = true; } if (theme.value("itemSpacingHuge").toString().toFloat() != 0 && floor(theme.value("itemSpacingHuge").toString().toFloat()) != m_itemSpacingHuge) { - m_itemSpacingHuge = floor(theme.value("itemSpacingHuge").toString().toFloat() * size->dpScaleFactor()); - emit itemSpacingHugeChanged(); + m_itemSpacingHuge = floor(theme.value("itemSpacingHuge").toString().toFloat() * m_size->dpScaleFactor()); updated = true; } if (theme.value("itemSpacingLarge").toString().toFloat() != 0 && floor(theme.value("itemSpacingLarge").toString().toFloat()) != m_itemSpacingLarge) { - m_itemSpacingLarge = floor(theme.value("itemSpacingLarge").toString().toFloat() * size->dpScaleFactor()); - emit itemSpacingLargeChanged(); + m_itemSpacingLarge = floor(theme.value("itemSpacingLarge").toString().toFloat() * m_size->dpScaleFactor()); updated = true; } if (theme.value("itemSpacingMedium").toString().toFloat() != 0 && floor(theme.value("itemSpacingMedium").toString().toFloat()) != m_itemSpacingMedium) { - m_itemSpacingMedium = floor(theme.value("itemSpacingMedium").toString().toFloat() * size->dpScaleFactor()); - emit itemSpacingMediumChanged(); + m_itemSpacingMedium = floor(theme.value("itemSpacingMedium").toString().toFloat() * m_size->dpScaleFactor()); updated = true; } if (theme.value("itemSpacingSmall").toString().toFloat() != 0 && floor(theme.value("itemSpacingSmall").toString().toFloat()) != m_itemSpacingSmall) { - m_itemSpacingSmall = floor(theme.value("itemSpacingSmall").toString().toFloat() * size->dpScaleFactor()); - emit itemSpacingSmallChanged(); + m_itemSpacingSmall = floor(theme.value("itemSpacingSmall").toString().toFloat() * m_size->dpScaleFactor()); updated = true; } if (theme.value("itemSpacingExtraSmall").toString().toFloat() != 0 && floor(theme.value("itemSpacingExtraSmall").toString().toFloat()) != m_itemSpacingExtraSmall) { - m_itemSpacingExtraSmall = floor(theme.value("itemSpacingExtraSmall").toString().toFloat() * size->dpScaleFactor()); - emit itemSpacingExtraSmallChanged(); + m_itemSpacingExtraSmall = floor(theme.value("itemSpacingExtraSmall").toString().toFloat() * m_size->dpScaleFactor()); updated = true; } if (theme.value("fontSizeExtraLarge").toInt() != 0 && floor(theme.value("fontSizeExtraLarge").toInt()) != m_fontSizeExtraLarge) { - m_fontSizeExtraLarge = floor(theme.value("fontSizeExtraLarge").toInt() * size->dpScaleFactor()); - emit fontSizeExtraLargeChanged(); + m_fontSizeExtraLarge = floor(theme.value("fontSizeExtraLarge").toInt() * m_size->dpScaleFactor()); updated = true; } if (theme.value("fontSizeLarge").toInt() != 0 && floor(theme.value("fontSizeLarge").toInt()) != m_fontSizeLarge) { - m_fontSizeLarge = floor(theme.value("fontSizeLarge").toInt() * size->dpScaleFactor()); - emit fontSizeLargeChanged(); + m_fontSizeLarge = floor(theme.value("fontSizeLarge").toInt() * m_size->dpScaleFactor()); updated = true; } if (theme.value("fontSizeMedium").toInt() != 0 && floor(theme.value("fontSizeMedium").toInt()) != m_fontSizeMedium) { - m_fontSizeMedium = floor(theme.value("fontSizeMedium").toInt() * size->dpScaleFactor()); - emit fontSizeMediumChanged(); + m_fontSizeMedium = floor(theme.value("fontSizeMedium").toInt() * m_size->dpScaleFactor()); updated = true; } if (theme.value("fontSizeSmall").toInt() != 0 && floor(theme.value("fontSizeSmall").toInt()) != m_fontSizeSmall) { - m_fontSizeSmall = floor(theme.value("fontSizeSmall").toInt() * size->dpScaleFactor()); - emit fontSizeSmallChanged(); + m_fontSizeSmall = floor(theme.value("fontSizeSmall").toInt() * m_size->dpScaleFactor()); updated = true; } if (theme.value("fontSizeTiny").toInt() != 0 && floor(theme.value("fontSizeTiny").toInt()) != m_fontSizeTiny) { - m_fontSizeTiny = floor(theme.value("fontSizeTiny").toInt() * size->dpScaleFactor()); - emit fontSizeTinyChanged(); + m_fontSizeTiny = floor(theme.value("fontSizeTiny").toInt() * m_size->dpScaleFactor()); updated = true; } if (theme.value("fontWeightLarge").toInt() != 0 && theme.value("fontWeightLarge").toInt() != m_fontWeightLarge) { - m_fontWeightLarge = theme.value("fontWeightLarge").toInt() * size->dpScaleFactor(); - emit fontWeightLargeChanged(); + m_fontWeightLarge = theme.value("fontWeightLarge").toInt() * m_size->dpScaleFactor(); updated = true; } if (theme.value("fontWeightMedium").toInt() != 0 && theme.value("fontWeightMedium").toInt() != m_fontWeightMedium) { - m_fontWeightMedium = theme.value("fontWeightMedium").toInt() * size->dpScaleFactor(); - emit fontWeightMediumChanged(); + m_fontWeightMedium = theme.value("fontWeightMedium").toInt() * m_size->dpScaleFactor(); updated = true; } @@ -210,47 +188,40 @@ void Theme::setThemeValues() QFile fontFile; fontFile.setFileName(theme.value("fontPath").toString()); if (!themeFile.exists()) { - qCDebug(lcNemoControlsCoreLog) << "Font file " << fontFile.fileName() << " not found"; + qCWarning(lcNemoControlsCoreLog) << "Font file " << fontFile.fileName() << " not found"; } else { m_fontPath = theme.value("fontPath").toString(); - emit fontPathChanged(); updated = true; } } if (theme.value("accentColor").toString() != "" && theme.value("accentColor").toString() != m_accentColor) { m_accentColor = theme.value("accentColor").toString(); - emit accentColorChanged(); updated = true; } if (theme.value("fillColor").toString() != "" && theme.value("fillColor").toString() != m_fillColor) { m_fillColor = theme.value("fillColor").toString(); - emit fillColorChanged(); updated = true; } if (theme.value("fillDarkColor").toString() != "" && theme.value("fillDarkColor").toString() != m_fillDarkColor) { m_fillDarkColor = theme.value("fillDarkColor").toString(); - emit fillDarkColorChanged(); updated = true; } if (theme.value("textColor").toString() != "" && theme.value("textColor").toString() != m_textColor) { m_textColor = theme.value("textColor").toString(); - emit textColorChanged(); updated = true; } if (theme.value("backgroundColor").toString() != "" && theme.value("backgroundColor").toString() != m_backgroundColor) { m_backgroundColor = theme.value("backgroundColor").toString(); - emit backgroundColorChanged(); updated = true; } if (theme.value("backgroundAccentColor").toString() != "" && theme.value("backgroundAccentColor").toString() != m_backgroundAccentColor) { m_backgroundAccentColor = theme.value("backgroundAccentColor").toString(); - emit backgroundAccentColorChanged(); updated = true; } if (updated) { - emit themeUpdate(); + emit themeUpdated(); } } @@ -263,32 +234,32 @@ void Theme::themeValueChanged() void Theme::loadDefaultValue() { // Load defaults - m_itemWidthExtraLarge = floor(450 * size->dpScaleFactor()); - m_itemWidthLarge = floor(320 * size->dpScaleFactor()); - m_itemWidthMedium = floor(240 * size->dpScaleFactor()); - m_itemWidthSmall = floor(120 * size->dpScaleFactor()); - m_itemWidthExtraSmall = floor(72 * size->dpScaleFactor()); - - m_itemHeightHuge = floor(80 * size->dpScaleFactor()); - m_itemHeightExtraLarge = floor(75 * size->dpScaleFactor()); - m_itemHeightLarge = floor(63 * size->dpScaleFactor()); - m_itemHeightMedium = floor(50 * size->dpScaleFactor()); - m_itemHeightSmall = floor(40 * size->dpScaleFactor()); - m_itemHeightExtraSmall = floor(32 * size->dpScaleFactor()); - - m_itemSpacingHuge = floor(48 * size->dpScaleFactor()); - m_itemSpacingLarge = floor(24 * size->dpScaleFactor()); - m_itemSpacingMedium = floor(18 * size->dpScaleFactor()); - m_itemSpacingSmall = floor(14 * size->dpScaleFactor()); - m_itemSpacingExtraSmall = floor(12 * size->dpScaleFactor()); - - m_fontSizeExtraLarge = floor(44 * size->dpScaleFactor()); - m_fontSizeLarge = floor(24 * size->dpScaleFactor()); - m_fontSizeMedium = floor(20 * size->dpScaleFactor()); - m_fontSizeSmall = floor(18 * size->dpScaleFactor()); - m_fontSizeTiny = floor(14 * size->dpScaleFactor()); - m_fontWeightLarge = 63 * size->dpScaleFactor(); - m_fontWeightMedium = 25 * size->dpScaleFactor(); + m_itemWidthExtraLarge = floor(450 * m_size->dpScaleFactor()); + m_itemWidthLarge = floor(320 * m_size->dpScaleFactor()); + m_itemWidthMedium = floor(240 * m_size->dpScaleFactor()); + m_itemWidthSmall = floor(120 * m_size->dpScaleFactor()); + m_itemWidthExtraSmall = floor(72 * m_size->dpScaleFactor()); + + m_itemHeightHuge = floor(80 * m_size->dpScaleFactor()); + m_itemHeightExtraLarge = floor(75 * m_size->dpScaleFactor()); + m_itemHeightLarge = floor(63 * m_size->dpScaleFactor()); + m_itemHeightMedium = floor(50 * m_size->dpScaleFactor()); + m_itemHeightSmall = floor(40 * m_size->dpScaleFactor()); + m_itemHeightExtraSmall = floor(32 * m_size->dpScaleFactor()); + + m_itemSpacingHuge = floor(48 * m_size->dpScaleFactor()); + m_itemSpacingLarge = floor(24 * m_size->dpScaleFactor()); + m_itemSpacingMedium = floor(18 * m_size->dpScaleFactor()); + m_itemSpacingSmall = floor(14 * m_size->dpScaleFactor()); + m_itemSpacingExtraSmall = floor(12 * m_size->dpScaleFactor()); + + m_fontSizeExtraLarge = floor(44 * m_size->dpScaleFactor()); + m_fontSizeLarge = floor(24 * m_size->dpScaleFactor()); + m_fontSizeMedium = floor(20 * m_size->dpScaleFactor()); + m_fontSizeSmall = floor(18 * m_size->dpScaleFactor()); + m_fontSizeTiny = floor(14 * m_size->dpScaleFactor()); + m_fontWeightLarge = 63 * m_size->dpScaleFactor(); + m_fontWeightMedium = 25 * m_size->dpScaleFactor(); m_fontPath = "/usr/share/fonts/google-opensans/OpenSans-Regular.ttf"; m_accentColor = "#0091e5"; @@ -298,16 +269,3 @@ void Theme::loadDefaultValue() m_backgroundColor = "#000000"; m_backgroundAccentColor = "#ffffff"; } - -qreal Theme::itemWidthExtraLarge() const -{ - return m_itemWidthExtraLarge; -} - -void Theme::setItemWidthExtraLarge(qreal newItemWidthExtraLarge) -{ - if (qFuzzyCompare(m_itemWidthExtraLarge, newItemWidthExtraLarge)) - return; - m_itemWidthExtraLarge = newItemWidthExtraLarge; - emit itemWidthExtraLargeChanged(); -} diff --git a/src/core/theme.h b/src/core/theme.h index 61db35e..1cb0125 100644 --- a/src/core/theme.h +++ b/src/core/theme.h @@ -1,3 +1,22 @@ +/* + * Copyright (C) 2018-2025 Chupligin Sergey + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + #ifndef THEME_H #define THEME_H @@ -9,135 +28,94 @@ class Sizing; class Theme : public QObject { Q_OBJECT - Q_PROPERTY(qreal iconSizeLauncher READ iconSizeLauncher NOTIFY iconSizeLauncherChanged) - - Q_PROPERTY(qreal itemWidthExtraLarge READ itemWidthExtraLarge WRITE setItemWidthExtraLarge NOTIFY itemWidthExtraLargeChanged) - Q_PROPERTY(qreal itemWidthLarge READ itemWidthLarge NOTIFY itemWidthLargeChanged) - Q_PROPERTY(qreal itemWidthMedium READ itemWidthMedium NOTIFY itemWidthMediumChanged) - Q_PROPERTY(qreal itemWidthSmall READ itemWidthSmall NOTIFY itemWidthSmallChanged) - Q_PROPERTY(qreal itemWidthExtraSmall READ itemWidthExtraSmall NOTIFY itemWidthExtraSmallChanged) - - Q_PROPERTY(qreal itemHeightHuge READ itemHeightHuge NOTIFY itemHeightHugeChanged) - Q_PROPERTY(qreal itemHeightExtraLarge READ itemHeightExtraLarge NOTIFY itemHeightExtraLargeChanged) - Q_PROPERTY(qreal itemHeightLarge READ itemHeightLarge NOTIFY itemHeightLargeChanged) - Q_PROPERTY(qreal itemHeightMedium READ itemHeightMedium NOTIFY itemHeightMediumChanged) - Q_PROPERTY(qreal itemHeightSmall READ itemHeightSmall NOTIFY itemHeightSmallChanged) - Q_PROPERTY(qreal itemHeightExtraSmall READ itemHeightExtraSmall NOTIFY itemHeightExtraSmallChanged) - - Q_PROPERTY(qreal itemSpacingHuge READ itemSpacingHuge NOTIFY itemSpacingHugeChanged) - Q_PROPERTY(qreal itemSpacingLarge READ itemSpacingLarge NOTIFY itemSpacingLargeChanged) - Q_PROPERTY(qreal itemSpacingMedium READ itemSpacingMedium NOTIFY itemSpacingMediumChanged) - Q_PROPERTY(qreal itemSpacingSmall READ itemSpacingSmall NOTIFY itemSpacingSmallChanged) - Q_PROPERTY(qreal itemSpacingExtraSmall READ itemSpacingExtraSmall NOTIFY itemSpacingExtraSmallChanged) - - Q_PROPERTY(int fontSizeExtraLarge READ fontSizeExtraLarge NOTIFY fontSizeExtraLargeChanged) - Q_PROPERTY(int fontSizeLarge READ fontSizeLarge NOTIFY fontSizeLargeChanged) - Q_PROPERTY(int fontSizeMedium READ fontSizeMedium NOTIFY fontSizeMediumChanged) - Q_PROPERTY(int fontSizeSmall READ fontSizeSmall NOTIFY fontSizeSmallChanged) - Q_PROPERTY(int fontSizeTiny READ fontSizeTiny NOTIFY fontSizeTinyChanged) - Q_PROPERTY(int fontWeightLarge READ fontWeightLarge NOTIFY fontWeightLargeChanged) - Q_PROPERTY(int fontWeightMedium READ fontWeightMedium NOTIFY fontWeightMediumChanged) - - Q_PROPERTY(QString fontPath READ fontPath NOTIFY fontPathChanged) - - Q_PROPERTY(QString accentColor READ accentColor NOTIFY accentColorChanged) - Q_PROPERTY(QString fillColor READ fillColor NOTIFY fillColorChanged) - Q_PROPERTY(QString fillDarkColor READ fillDarkColor NOTIFY fillDarkColorChanged) - Q_PROPERTY(QString textColor READ textColor NOTIFY textColorChanged) - Q_PROPERTY(QString backgroundColor READ backgroundColor NOTIFY backgroundColorChanged) - Q_PROPERTY(QString backgroundAccentColor READ backgroundAccentColor NOTIFY backgroundAccentColorChanged) - Q_PROPERTY(QString themePath READ themePath NOTIFY themeUpdate) + Q_PROPERTY(qreal iconSizeLauncher READ iconSizeLauncher NOTIFY themeUpdated) + + Q_PROPERTY(qreal itemWidthExtraLarge READ itemWidthExtraLarge NOTIFY themeUpdated) + Q_PROPERTY(qreal itemWidthLarge READ itemWidthLarge NOTIFY themeUpdated) + Q_PROPERTY(qreal itemWidthMedium READ itemWidthMedium NOTIFY themeUpdated) + Q_PROPERTY(qreal itemWidthSmall READ itemWidthSmall NOTIFY themeUpdated) + Q_PROPERTY(qreal itemWidthExtraSmall READ itemWidthExtraSmall NOTIFY themeUpdated) + + Q_PROPERTY(qreal itemHeightHuge READ itemHeightHuge NOTIFY themeUpdated) + Q_PROPERTY(qreal itemHeightExtraLarge READ itemHeightExtraLarge NOTIFY themeUpdated) + Q_PROPERTY(qreal itemHeightLarge READ itemHeightLarge NOTIFY themeUpdated) + Q_PROPERTY(qreal itemHeightMedium READ itemHeightMedium NOTIFY themeUpdated) + Q_PROPERTY(qreal itemHeightSmall READ itemHeightSmall NOTIFY themeUpdated) + Q_PROPERTY(qreal itemHeightExtraSmall READ itemHeightExtraSmall NOTIFY themeUpdated) + + Q_PROPERTY(qreal itemSpacingHuge READ itemSpacingHuge NOTIFY themeUpdated) + Q_PROPERTY(qreal itemSpacingLarge READ itemSpacingLarge NOTIFY themeUpdated) + Q_PROPERTY(qreal itemSpacingMedium READ itemSpacingMedium NOTIFY themeUpdated) + Q_PROPERTY(qreal itemSpacingSmall READ itemSpacingSmall NOTIFY themeUpdated) + Q_PROPERTY(qreal itemSpacingExtraSmall READ itemSpacingExtraSmall NOTIFY themeUpdated) + + Q_PROPERTY(int fontSizeExtraLarge READ fontSizeExtraLarge NOTIFY themeUpdated) + Q_PROPERTY(int fontSizeLarge READ fontSizeLarge NOTIFY themeUpdated) + Q_PROPERTY(int fontSizeMedium READ fontSizeMedium NOTIFY themeUpdated) + Q_PROPERTY(int fontSizeSmall READ fontSizeSmall NOTIFY themeUpdated) + Q_PROPERTY(int fontSizeTiny READ fontSizeTiny NOTIFY themeUpdated) + Q_PROPERTY(int fontWeightLarge READ fontWeightLarge NOTIFY themeUpdated) + Q_PROPERTY(int fontWeightMedium READ fontWeightMedium NOTIFY themeUpdated) + + Q_PROPERTY(QString fontPath READ fontPath NOTIFY themeUpdated) + + Q_PROPERTY(QString accentColor READ accentColor NOTIFY themeUpdated) + Q_PROPERTY(QString fillColor READ fillColor NOTIFY themeUpdated) + Q_PROPERTY(QString fillDarkColor READ fillDarkColor NOTIFY themeUpdated) + Q_PROPERTY(QString textColor READ textColor NOTIFY themeUpdated) + Q_PROPERTY(QString backgroundColor READ backgroundColor NOTIFY themeUpdated) + Q_PROPERTY(QString backgroundAccentColor READ backgroundAccentColor NOTIFY themeUpdated) + Q_PROPERTY(QString themePath READ themePath NOTIFY themeUpdated) public: - explicit Theme(QObject* parent = 0); - - Q_INVOKABLE bool loadTheme(QString fileName); - qreal itemWidthLarge() { return m_itemWidthLarge; } - qreal itemWidthMedium() { return m_itemWidthMedium; } - qreal itemWidthSmall() { return m_itemWidthSmall; } - qreal itemWidthExtraSmall() { return m_itemWidthExtraSmall; } - - qreal itemHeightHuge() { return m_itemHeightHuge; } - qreal itemHeightExtraLarge() { return m_itemHeightExtraLarge; } - qreal itemHeightLarge() { return m_itemHeightLarge; } - qreal itemHeightMedium() { return m_itemHeightMedium; } - qreal itemHeightSmall() { return m_itemHeightSmall; } - qreal itemHeightExtraSmall() { return m_itemHeightExtraSmall; } - - qreal itemSpacingHuge() { return m_itemSpacingHuge; } - qreal itemSpacingLarge() { return m_itemSpacingLarge; } - qreal itemSpacingMedium() { return m_itemSpacingMedium; } - qreal itemSpacingSmall() { return m_itemSpacingSmall; } - qreal itemSpacingExtraSmall() { return m_itemSpacingExtraSmall; } - - int fontSizeExtraLarge() { return m_fontSizeExtraLarge; } - int fontSizeLarge() { return m_fontSizeLarge; } - int fontSizeMedium() { return m_fontSizeMedium; } - int fontSizeSmall() { return m_fontSizeSmall; } - int fontSizeTiny() { return m_fontSizeTiny; } - int fontWeightLarge() { return m_fontWeightLarge; } - int fontWeightMedium() { return m_fontWeightMedium; } - - QString fontPath() { return m_fontPath; } - - QString accentColor() { return m_accentColor; } - QString fillColor() { return m_fillColor; } - QString fillDarkColor() { return m_fillDarkColor; } - QString textColor() { return m_textColor; } - QString backgroundColor() { return m_backgroundColor; } - QString backgroundAccentColor() { return m_backgroundAccentColor; } - - qreal iconSizeLauncher() { return m_iconSizeLauncher; } - QString themePath() { return m_theme; } - - Sizing* size; - - qreal itemWidthExtraLarge() const; - void setItemWidthExtraLarge(qreal newItemWidthExtraLarge); + explicit Theme(QObject* parent = nullptr); + Sizing* size() const {return m_size;} + + Q_INVOKABLE bool loadTheme(const QString fileName); + qreal itemWidthLarge() const { return m_itemWidthLarge; } + qreal itemWidthMedium() const { return m_itemWidthMedium; } + qreal itemWidthSmall() const { return m_itemWidthSmall; } + qreal itemWidthExtraSmall() const { return m_itemWidthExtraSmall; } + + qreal itemHeightHuge() const { return m_itemHeightHuge; } + qreal itemHeightExtraLarge() const { return m_itemHeightExtraLarge; } + qreal itemHeightLarge() const { return m_itemHeightLarge; } + qreal itemHeightMedium() const { return m_itemHeightMedium; } + qreal itemHeightSmall() const { return m_itemHeightSmall; } + qreal itemHeightExtraSmall() const { return m_itemHeightExtraSmall; } + + qreal itemSpacingHuge() const { return m_itemSpacingHuge; } + qreal itemSpacingLarge() const { return m_itemSpacingLarge; } + qreal itemSpacingMedium() const { return m_itemSpacingMedium; } + qreal itemSpacingSmall() const { return m_itemSpacingSmall; } + qreal itemSpacingExtraSmall() const { return m_itemSpacingExtraSmall; } + + int fontSizeExtraLarge() const { return m_fontSizeExtraLarge; } + int fontSizeLarge() const { return m_fontSizeLarge; } + int fontSizeMedium() const { return m_fontSizeMedium; } + int fontSizeSmall() const { return m_fontSizeSmall; } + int fontSizeTiny() const { return m_fontSizeTiny; } + int fontWeightLarge() const { return m_fontWeightLarge; } + int fontWeightMedium() const { return m_fontWeightMedium; } + + QString fontPath() const { return m_fontPath; } + + QString accentColor() const { return m_accentColor; } + QString fillColor() const { return m_fillColor; } + QString fillDarkColor() const { return m_fillDarkColor; } + QString textColor() const { return m_textColor; } + QString backgroundColor() const { return m_backgroundColor; } + QString backgroundAccentColor() const { return m_backgroundAccentColor; } + + qreal iconSizeLauncher() const { return m_iconSizeLauncher; } + QString themePath() const { return m_theme; } + + qreal itemWidthExtraLarge() const {return m_itemHeightExtraLarge; } signals: - void themeUpdate(); - - void itemWidthLargeChanged(); - void itemWidthMediumChanged(); - void itemWidthSmallChanged(); - void itemWidthExtraSmallChanged(); - - void itemHeightHugeChanged(); - void itemHeightExtraLargeChanged(); - void itemHeightLargeChanged(); - void itemHeightMediumChanged(); - void itemHeightSmallChanged(); - void itemHeightExtraSmallChanged(); - - void itemSpacingHugeChanged(); - void itemSpacingLargeChanged(); - void itemSpacingMediumChanged(); - void itemSpacingSmallChanged(); - void itemSpacingExtraSmallChanged(); - - void fontSizeExtraLargeChanged(); - void fontSizeLargeChanged(); - void fontSizeMediumChanged(); - void fontSizeSmallChanged(); - void fontSizeTinyChanged(); - void fontWeightLargeChanged(); - void fontWeightMediumChanged(); - void fontPathChanged(); - - void accentColorChanged(); - void fillColorChanged(); - void fillDarkColorChanged(); - void textColorChanged(); - void backgroundColorChanged(); - void backgroundAccentColorChanged(); - - void iconSizeLauncherChanged(); - + void themeUpdated(); void desktopModeChanged(); - void itemWidthExtraLargeChanged(); - private slots: void themeValueChanged(); @@ -185,6 +163,7 @@ private slots: void setThemeValues(); MDConfItem* m_themeValue; + Sizing* m_size; }; #endif // THEME_H