From 384a6723bd072200657f957b05776934988297f6 Mon Sep 17 00:00:00 2001 From: reionwong Date: Fri, 4 Sep 2026 00:24:09 -0400 Subject: [PATCH] refactor(settings): move appearance and wallpaper to the framework --- CMakeLists.txt | 6 +- src/appearance.cpp | 215 --------------------------- src/application.cpp | 6 +- src/background.cpp | 81 ---------- src/background.h | 45 ------ src/cursor/cursorthememodel.cpp | 11 +- src/cursor/cursorthememodel.h | 3 + src/docksettings.cpp | 116 +++++++++++++++ src/{appearance.h => docksettings.h} | 35 +---- src/fonts/fonts.cpp | 9 +- src/fonts/fonts.h | 3 + src/qml/Appearance/Main.qml | 3 +- src/qml/Dock/Main.qml | 28 ++-- src/qml/Fonts/Main.qml | 5 +- src/qml/Wallpaper/DesktopPreview.qml | 6 +- src/qml/Wallpaper/Main.qml | 21 +-- 16 files changed, 168 insertions(+), 425 deletions(-) delete mode 100644 src/appearance.cpp delete mode 100644 src/background.cpp delete mode 100644 src/background.h create mode 100644 src/docksettings.cpp rename src/{appearance.h => docksettings.h} (62%) diff --git a/CMakeLists.txt b/CMakeLists.txt index aa9ca89..2963313 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -27,6 +27,8 @@ find_package(KF6Config) add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../cutefish-framework/applications ${CMAKE_CURRENT_BINARY_DIR}/cutefish-framework-applications-build) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../cutefish-framework/appearance + ${CMAKE_CURRENT_BINARY_DIR}/cutefish-framework-appearance-build) pkg_search_module(FontConfig REQUIRED fontconfig IMPORTED_TARGET) pkg_search_module(ICU REQUIRED icu-i18n) @@ -36,13 +38,12 @@ include_directories(${ICU_INCLUDE_DIRS}) set(SRCS src/application.cpp src/main.cpp - src/appearance.cpp + src/docksettings.cpp src/battery.cpp src/brightness.cpp src/fontsmodel.cpp src/language.cpp src/about.cpp - src/background.cpp src/notifications.cpp src/password.cpp src/batteryhistorymodel.cpp @@ -78,6 +79,7 @@ set_source_files_properties(${DBUS_SOURCES} PROPERTIES SKIP_AUTOGEN ON) add_executable(${PROJECT_NAME} ${DBUS_SOURCES} ${SRCS} ${RESOURCES}) target_link_libraries(${PROJECT_NAME} Cutefish::Applications + Cutefish::Appearance Qt6::Core Qt6::Widgets Qt6::Quick diff --git a/src/appearance.cpp b/src/appearance.cpp deleted file mode 100644 index 9f5053c..0000000 --- a/src/appearance.cpp +++ /dev/null @@ -1,215 +0,0 @@ -/* - * Copyright (C) 2021 CutefishOS Team. - * - * Author: revenmartin - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#include "appearance.h" - -#include -#include - -#include - -Appearance::Appearance(QObject *parent) - : QObject(parent) - , m_interface("com.cutefish.Services", - "/com/cutefish/Services/Appearance", - "com.cutefish.Services.Appearance", - QDBusConnection::sessionBus()) - , m_dockSettings(new QSettings(QSettings::UserScope, "cutefishos", "dock")) - , m_dockIconSize(0) - , m_dockDirection(0) - , m_dockVisibility(0) - , m_fontPointSize(11) -{ - m_dockIconSize = m_dockSettings->value("IconSize").toInt(); - m_dockDirection = m_dockSettings->value("Direction").toInt(); - m_dockVisibility = m_dockSettings->value("Visibility").toInt(); - m_dockRoundedWindow = m_dockSettings->value("RoundedWindow").toBool(); - // Dock only supports the centered style. Migrate old Full style settings. - m_dockSettings->setValue("Style", 0); - - // Init - if (m_interface.isValid()) { - m_fontPointSize = m_interface.property("systemFontPointSize").toInt(); - - connect(&m_interface, SIGNAL(darkModeDimsWallpaerChanged()), this, SIGNAL(dimsWallpaperChanged())); - connect(&m_interface, SIGNAL(blurEnabledChanged()), this, SIGNAL(blurEnabledChanged())); - } -} - -void Appearance::switchDarkMode(bool darkMode) -{ - if (m_interface.isValid()) { - m_interface.call("setDarkMode", darkMode); - } -} - -bool Appearance::dimsWallpaper() const -{ - return m_interface.property("darkModeDimsWallpaer").toBool(); -} - -void Appearance::setDimsWallpaper(bool value) -{ - m_interface.call("setDarkModeDimsWallpaer", value); -} - -bool Appearance::blurEnabled() const -{ - return m_interface.property("blurEnabled").toBool(); -} - -void Appearance::setBlurEnabled(bool value) -{ - m_interface.call("setBlurEnabled", value); -} - -int Appearance::dockIconSize() const -{ - return m_dockIconSize; -} - -void Appearance::setDockIconSize(int dockIconSize) -{ - if (m_dockIconSize != dockIconSize) { - QDBusInterface iface("com.cutefish.Dock", - "/Dock", - "com.cutefish.Dock", - QDBusConnection::sessionBus()); - if (iface.isValid()) { - iface.call("setIconSize", dockIconSize); - } - - m_dockIconSize = dockIconSize; - emit dockIconSizeChanged(); - } -} - -int Appearance::dockDirection() const -{ - return m_dockDirection; -} - -void Appearance::setDockDirection(int dockDirection) -{ - if (m_dockDirection != dockDirection) { - QDBusInterface iface("com.cutefish.Dock", - "/Dock", - "com.cutefish.Dock", - QDBusConnection::sessionBus()); - if (iface.isValid()) { - iface.call("setDirection", dockDirection); - } - - m_dockDirection = dockDirection; - emit dockDirectionChanged(); - } -} - -int Appearance::dockVisibility() const -{ - return m_dockVisibility; -} - -void Appearance::setDockVisibility(int visibility) -{ - if (m_dockVisibility != visibility) { - m_dockVisibility = visibility; - - QDBusInterface iface("com.cutefish.Dock", - "/Dock", - "com.cutefish.Dock", - QDBusConnection::sessionBus()); - if (iface.isValid()) { - iface.call("setVisibility", visibility); - } - - emit dockVisibilityChanged(); - } -} - -int Appearance::dockRoundedWindow() const -{ - return m_dockRoundedWindow; -} - -void Appearance::setDockRoundedWindow(bool enable) -{ - if (m_dockRoundedWindow == enable) - return; - - m_dockRoundedWindow = enable; - m_dockSettings->setValue("RoundedWindow", m_dockRoundedWindow); -} - -void Appearance::setGenericFontFamily(const QString &name) -{ - if (name.isEmpty()) - return; - - QDBusInterface iface("com.cutefish.Services", - "/com/cutefish/Services/Appearance", - "com.cutefish.Services.Appearance", - QDBusConnection::sessionBus(), this); - if (iface.isValid()) { - iface.call("setSystemFont", name); - } -} - -void Appearance::setFixedFontFamily(const QString &name) -{ - if (name.isEmpty()) - return; - - QDBusInterface iface("com.cutefish.Services", - "/com/cutefish/Services/Appearance", - "com.cutefish.Services.Appearance", - QDBusConnection::sessionBus(), this); - if (iface.isValid()) { - iface.call("setSystemFixedFont", name); - } -} - -int Appearance::fontPointSize() const -{ - return m_fontPointSize; -} - -void Appearance::setFontPointSize(int fontPointSize) -{ - m_fontPointSize = fontPointSize; - - QDBusInterface iface("com.cutefish.Services", - "/com/cutefish/Services/Appearance", - "com.cutefish.Services.Appearance", - QDBusConnection::sessionBus(), this); - if (iface.isValid()) { - iface.call("setSystemFontPointSize", m_fontPointSize * 1.0); - } -} - -void Appearance::setAccentColor(int accentColor) -{ - QDBusInterface iface("com.cutefish.Services", - "/com/cutefish/Services/Appearance", - "com.cutefish.Services.Appearance", - QDBusConnection::sessionBus(), this); - if (iface.isValid()) { - iface.call("setAccentColor", accentColor); - } -} diff --git a/src/application.cpp b/src/application.cpp index a79d272..6b6859c 100644 --- a/src/application.cpp +++ b/src/application.cpp @@ -8,12 +8,11 @@ #include "settingsuiadaptor.h" #include "fontsmodel.h" #include "fonts/fonts.h" -#include "appearance.h" +#include "docksettings.h" #include "battery.h" #include "batteryhistorymodel.h" #include "brightness.h" #include "about.h" -#include "background.h" #include "language.h" #include "password.h" #include "powermanager.h" @@ -67,14 +66,13 @@ Application::Application(int &argc, char **argv) // QML registerApplicationsQmlTypes(); const char *uri = "Cutefish.Settings"; - qmlRegisterType(uri, 1, 0, "Appearance"); + qmlRegisterType(uri, 1, 0, "DockSettings"); qmlRegisterType(uri, 1, 0, "FontsModel"); qmlRegisterType(uri, 1, 0, "Brightness"); qmlRegisterType(uri, 1, 0, "Battery"); qmlRegisterType(uri, 1, 0, "BatteryHistoryModel"); qmlRegisterType(uri, 1, 0, "CursorThemeModel"); qmlRegisterType(uri, 1, 0, "About"); - qmlRegisterType(uri, 1, 0, "Background"); qmlRegisterType(uri, 1, 0, "Language"); qmlRegisterType(uri, 1, 0, "Fonts"); qmlRegisterType(uri, 1, 0, "PowerManager"); diff --git a/src/background.cpp b/src/background.cpp deleted file mode 100644 index 9c30260..0000000 --- a/src/background.cpp +++ /dev/null @@ -1,81 +0,0 @@ -#include "background.h" -#include - -static QVariantList getBackgroundPaths() -{ - QVariantList list; - QDirIterator it("/usr/share/backgrounds/cutefishos", QStringList() << "*.jpg" << "*.png", QDir::Files, QDirIterator::Subdirectories); - while (it.hasNext()) { - QString bg = it.next(); - list.append(QVariant(bg)); - } - std::sort(list.begin(), list.end(), [](const QVariant &left, const QVariant &right) { - return left.toString() < right.toString(); - }); - return list; -} - -Background::Background(QObject *parent) - : QObject(parent) - , m_interface("com.cutefish.Services", - "/com/cutefish/Services/Appearance", - "com.cutefish.Services.Appearance", - QDBusConnection::sessionBus(), this) -{ - if (m_interface.isValid()) { - m_currentPath = m_interface.property("wallpaper").toString(); - - QDBusConnection::sessionBus().connect(m_interface.service(), - m_interface.path(), - m_interface.interface(), - "backgroundTypeChanged", this, SIGNAL(backgroundTypeChanged())); - QDBusConnection::sessionBus().connect(m_interface.service(), - m_interface.path(), - m_interface.interface(), - "backgroundColorChanged", this, SIGNAL(backgroundColorChanged())); - } -} - -QVariantList Background::backgrounds() -{ - QFuture future = QtConcurrent::run(&getBackgroundPaths); - QVariantList list = future.result(); - return list; -} - -QString Background::currentBackgroundPath() -{ - return m_currentPath; -} - -void Background::setBackground(QString path) -{ - if (m_currentPath != path && !path.isEmpty()) { - m_currentPath = path; - - if (m_interface.isValid()) { - m_interface.call("setWallpaper", path); - emit backgroundChanged(); - } - } -} - -int Background::backgroundType() -{ - return m_interface.property("backgroundType").toInt(); -} - -void Background::setBackgroundType(int type) -{ - m_interface.call("setBackgroundType", QVariant::fromValue(type)); -} - -QString Background::backgroundColor() -{ - return m_interface.property("backgroundColor").toString(); -} - -void Background::setBackgroundColor(const QString &color) -{ - m_interface.call("setBackgroundColor", QVariant::fromValue(color)); -} diff --git a/src/background.h b/src/background.h deleted file mode 100644 index 0a38d3d..0000000 --- a/src/background.h +++ /dev/null @@ -1,45 +0,0 @@ -#ifndef BACKGROUND_H -#define BACKGROUND_H - -#include -#include -#include -#include -#include -#include -#include - -class Background : public QObject -{ - Q_OBJECT - Q_PROPERTY(QString currentBackgroundPath READ currentBackgroundPath WRITE setBackground NOTIFY backgroundChanged) - Q_PROPERTY(QVariantList backgrounds READ backgrounds NOTIFY stub) - - Q_PROPERTY(int backgroundType READ backgroundType WRITE setBackgroundType NOTIFY backgroundTypeChanged) - Q_PROPERTY(QString backgroundColor READ backgroundColor WRITE setBackgroundColor NOTIFY backgroundColorChanged) - -public: - explicit Background(QObject *parent = nullptr); - - QVariantList backgrounds(); - QString currentBackgroundPath(); - Q_INVOKABLE void setBackground(QString newBackgroundPath); - - int backgroundType(); - void setBackgroundType(int type); - - QString backgroundColor(); - void setBackgroundColor(const QString &color); - -signals: - void backgroundChanged(); - void backgroundColorChanged(); - void backgroundTypeChanged(); - void stub(); - -private: - QDBusInterface m_interface; - QString m_currentPath; -}; - -#endif diff --git a/src/cursor/cursorthememodel.cpp b/src/cursor/cursorthememodel.cpp index 979e352..210ab4b 100644 --- a/src/cursor/cursorthememodel.cpp +++ b/src/cursor/cursorthememodel.cpp @@ -19,9 +19,6 @@ #include "cursorthememodel.h" #include "cursortheme.h" -#include -#include -#include #include #include #include @@ -94,13 +91,7 @@ void CursorThemeModel::setCurrentTheme(const QString &theme) m_currentTheme = theme; emit currentThemeChanged(); - QDBusInterface interface("com.cutefish.Services", - "/com/cutefish/Services/Appearance", - "com.cutefish.Services.Appearance", - QDBusConnection::sessionBus()); - if (interface.isValid()) - interface.asyncCall("setCursorTheme", m_currentTheme); - + m_appearance.setCursorTheme(m_currentTheme); } } diff --git a/src/cursor/cursorthememodel.h b/src/cursor/cursorthememodel.h index 8570906..d9e3dd3 100644 --- a/src/cursor/cursorthememodel.h +++ b/src/cursor/cursorthememodel.h @@ -23,6 +23,8 @@ #include #include +#include + class QDir; class CursorTheme; class CursorThemeModel : public QAbstractListModel @@ -60,6 +62,7 @@ private: void processDir(const QDir &dir); private: + Appearance m_appearance; QList m_list; QString m_defaultTheme; QString m_currentTheme; diff --git a/src/docksettings.cpp b/src/docksettings.cpp new file mode 100644 index 0000000..97a46a9 --- /dev/null +++ b/src/docksettings.cpp @@ -0,0 +1,116 @@ +/* + * Copyright (C) 2021 CutefishOS Team. + * + * Author: revenmartin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "docksettings.h" + +#include +#include + +DockSettings::DockSettings(QObject *parent) + : QObject(parent) + , m_dockSettings(new QSettings(QSettings::UserScope, "cutefishos", "dock")) + , m_dockIconSize(0) + , m_dockDirection(0) + , m_dockVisibility(0) +{ + m_dockIconSize = m_dockSettings->value("IconSize").toInt(); + m_dockDirection = m_dockSettings->value("Direction").toInt(); + m_dockVisibility = m_dockSettings->value("Visibility").toInt(); + m_dockRoundedWindow = m_dockSettings->value("RoundedWindow").toBool(); + // Dock only supports the centered style. Migrate old Full style settings. + m_dockSettings->setValue("Style", 0); +} + +int DockSettings::dockIconSize() const +{ + return m_dockIconSize; +} + +void DockSettings::setDockIconSize(int dockIconSize) +{ + if (m_dockIconSize != dockIconSize) { + QDBusInterface iface("com.cutefish.Dock", + "/Dock", + "com.cutefish.Dock", + QDBusConnection::sessionBus()); + if (iface.isValid()) { + iface.call("setIconSize", dockIconSize); + } + + m_dockIconSize = dockIconSize; + emit dockIconSizeChanged(); + } +} + +int DockSettings::dockDirection() const +{ + return m_dockDirection; +} + +void DockSettings::setDockDirection(int dockDirection) +{ + if (m_dockDirection != dockDirection) { + QDBusInterface iface("com.cutefish.Dock", + "/Dock", + "com.cutefish.Dock", + QDBusConnection::sessionBus()); + if (iface.isValid()) { + iface.call("setDirection", dockDirection); + } + + m_dockDirection = dockDirection; + emit dockDirectionChanged(); + } +} + +int DockSettings::dockVisibility() const +{ + return m_dockVisibility; +} + +void DockSettings::setDockVisibility(int visibility) +{ + if (m_dockVisibility != visibility) { + m_dockVisibility = visibility; + + QDBusInterface iface("com.cutefish.Dock", + "/Dock", + "com.cutefish.Dock", + QDBusConnection::sessionBus()); + if (iface.isValid()) { + iface.call("setVisibility", visibility); + } + + emit dockVisibilityChanged(); + } +} + +int DockSettings::dockRoundedWindow() const +{ + return m_dockRoundedWindow; +} + +void DockSettings::setDockRoundedWindow(bool enable) +{ + if (m_dockRoundedWindow == enable) + return; + + m_dockRoundedWindow = enable; + m_dockSettings->setValue("RoundedWindow", m_dockRoundedWindow); +} diff --git a/src/appearance.h b/src/docksettings.h similarity index 62% rename from src/appearance.h rename to src/docksettings.h index ceceb88..3153dfd 100644 --- a/src/appearance.h +++ b/src/docksettings.h @@ -17,34 +17,22 @@ * along with this program. If not, see . */ -#ifndef APPEARANCE_H -#define APPEARANCE_H +#ifndef DOCKSETTINGS_H +#define DOCKSETTINGS_H #include #include -#include -class Appearance : public QObject +class DockSettings : public QObject { Q_OBJECT Q_PROPERTY(int dockIconSize READ dockIconSize WRITE setDockIconSize NOTIFY dockIconSizeChanged) Q_PROPERTY(int dockDirection READ dockDirection WRITE setDockDirection NOTIFY dockDirectionChanged) Q_PROPERTY(int dockVisibility READ dockVisibility WRITE setDockVisibility NOTIFY dockVisibilityChanged) - Q_PROPERTY(int fontPointSize READ fontPointSize WRITE setFontPointSize NOTIFY fontPointSizeChanged) - Q_PROPERTY(bool dimsWallpaper READ dimsWallpaper WRITE setDimsWallpaper NOTIFY dimsWallpaperChanged) - Q_PROPERTY(bool blurEnabled READ blurEnabled WRITE setBlurEnabled NOTIFY blurEnabledChanged) Q_PROPERTY(bool dockRoundedWindow READ dockRoundedWindow WRITE setDockRoundedWindow NOTIFY dockRoundedWindowChanged) public: - explicit Appearance(QObject *parent = nullptr); - - Q_INVOKABLE void switchDarkMode(bool darkMode); - - bool dimsWallpaper() const; - Q_INVOKABLE void setDimsWallpaper(bool value); - - bool blurEnabled() const; - Q_INVOKABLE void setBlurEnabled(bool value); + explicit DockSettings(QObject *parent = nullptr); int dockIconSize() const; Q_INVOKABLE void setDockIconSize(int dockIconSize); @@ -58,33 +46,20 @@ public: int dockRoundedWindow() const; Q_INVOKABLE void setDockRoundedWindow(bool enable); - Q_INVOKABLE void setGenericFontFamily(const QString &name); - Q_INVOKABLE void setFixedFontFamily(const QString &name); - - int fontPointSize() const; - Q_INVOKABLE void setFontPointSize(int fontPointSize); - - Q_INVOKABLE void setAccentColor(int accentColor); - signals: void dockIconSizeChanged(); void dockDirectionChanged(); void dockVisibilityChanged(); - void fontPointSizeChanged(); - void dimsWallpaperChanged(); - void blurEnabledChanged(); void dockRoundedWindowChanged(); private: - QDBusInterface m_interface; QSettings *m_dockSettings; bool m_dockRoundedWindow; int m_dockIconSize; int m_dockDirection; int m_dockVisibility; - int m_fontPointSize; }; -#endif // APPEARANCE_H +#endif // DOCKSETTINGS_H diff --git a/src/fonts/fonts.cpp b/src/fonts/fonts.cpp index 51ccc98..a4fc850 100644 --- a/src/fonts/fonts.cpp +++ b/src/fonts/fonts.cpp @@ -18,8 +18,6 @@ */ #include "fonts.h" -#include -#include namespace { @@ -117,10 +115,5 @@ void Fonts::save() m_settings.setValue("FontHintStyle", hintingToString(m_hinting)); m_settings.sync(); - QDBusInterface interface("com.cutefish.Services", - "/com/cutefish/Services/Appearance", - "com.cutefish.Services.Appearance", - QDBusConnection::sessionBus()); - if (interface.isValid()) - interface.asyncCall("applyFontSettings"); + m_appearance.applyFontSettings(); } diff --git a/src/fonts/fonts.h b/src/fonts/fonts.h index 795ed67..f3f643f 100644 --- a/src/fonts/fonts.h +++ b/src/fonts/fonts.h @@ -24,6 +24,8 @@ #include #include +#include + class Fonts : public QObject { Q_OBJECT @@ -61,6 +63,7 @@ signals: void hintingCurrentIndexChanged(); private: + Appearance m_appearance; QSettings m_settings; bool m_antiAliasing; QStandardItemModel *m_hintingModel; diff --git a/src/qml/Appearance/Main.qml b/src/qml/Appearance/Main.qml index 2ae233d..990580b 100644 --- a/src/qml/Appearance/Main.qml +++ b/src/qml/Appearance/Main.qml @@ -23,13 +23,14 @@ import QtQuick.Layouts 1.3 import Qt5Compat.GraphicalEffects import Cutefish.Settings 1.0 +import Cutefish.Appearance 1.0 as FrameworkAppearance import FishUI 1.0 as FishUI import "../" ItemPage { headerTitle: qsTr("Appearance") - Appearance { + FrameworkAppearance.Appearance { id: appearance } diff --git a/src/qml/Dock/Main.qml b/src/qml/Dock/Main.qml index 76ceb0e..0c0bd0f 100644 --- a/src/qml/Dock/Main.qml +++ b/src/qml/Dock/Main.qml @@ -27,8 +27,8 @@ import "../" ItemPage { headerTitle: qsTr("Dock") - Appearance { - id: appearance + DockSettings { + id: dockSettings } Scrollable { @@ -53,22 +53,22 @@ ItemPage { IconCheckBox { source: "qrc:/images/dock_left.svg" text: qsTr("Left") - checked: appearance.dockDirection === 0 - onClicked: appearance.setDockDirection(0) + checked: dockSettings.dockDirection === 0 + onClicked: dockSettings.setDockDirection(0) } IconCheckBox { source: "qrc:/images/dock_bottom.svg" text: qsTr("Bottom") - checked: appearance.dockDirection === 1 - onClicked: appearance.setDockDirection(1) + checked: dockSettings.dockDirection === 1 + onClicked: dockSettings.setDockDirection(1) } IconCheckBox { source: "qrc:/images/dock_right.svg" text: qsTr("Right") - checked: appearance.dockDirection === 2 - onClicked: appearance.setDockDirection(2) + checked: dockSettings.dockDirection === 2 + onClicked: dockSettings.setDockDirection(2) } } } @@ -104,11 +104,11 @@ ItemPage { currentIndex: { var index = 0 - if (appearance.dockIconSize <= 40) + if (dockSettings.dockIconSize <= 40) index = 0 - else if (appearance.dockIconSize <= 54) + else if (dockSettings.dockIconSize <= 54) index = 1 - else if (appearance.dockIconSize <= 68) + else if (dockSettings.dockIconSize <= 68) index = 2 else index = 3 @@ -136,7 +136,7 @@ ItemPage { break; } - appearance.setDockIconSize(iconSize) + dockSettings.setDockIconSize(iconSize) } } } @@ -150,8 +150,8 @@ ItemPage { TabBar { Layout.fillWidth: true - currentIndex: appearance.dockVisibility - onCurrentIndexChanged: appearance.setDockVisibility(currentIndex) + currentIndex: dockSettings.dockVisibility + onCurrentIndexChanged: dockSettings.setDockVisibility(currentIndex) TabButton { text: qsTr("Always show") diff --git a/src/qml/Fonts/Main.qml b/src/qml/Fonts/Main.qml index b9b2bb3..a56a8b5 100644 --- a/src/qml/Fonts/Main.qml +++ b/src/qml/Fonts/Main.qml @@ -23,6 +23,7 @@ import QtQuick.Layouts 1.3 import Qt5Compat.GraphicalEffects import Cutefish.Settings 1.0 +import Cutefish.Appearance 1.0 as FrameworkAppearance import FishUI 1.0 as FishUI import "../" @@ -30,7 +31,7 @@ ItemPage { id: control headerTitle: qsTr("Fonts") - Appearance { + FrameworkAppearance.Appearance { id: appearance } @@ -102,7 +103,7 @@ ItemPage { bottomInset: 0 leftPadding: FishUI.Units.largeSpacing rightPadding: FishUI.Units.largeSpacing - onActivated: appearance.setGenericFontFamily(currentText) + onActivated: appearance.setFontFamily(currentText) } Label { diff --git a/src/qml/Wallpaper/DesktopPreview.qml b/src/qml/Wallpaper/DesktopPreview.qml index 813b68f..9fbf8eb 100644 --- a/src/qml/Wallpaper/DesktopPreview.qml +++ b/src/qml/Wallpaper/DesktopPreview.qml @@ -31,7 +31,7 @@ Item { Image { id: image - source: "file://" + background.currentBackgroundPath + source: "file://" + background.path } } @@ -39,7 +39,7 @@ Item { id: colorItem Rectangle { - color: background.backgroundColor + color: background.color } } @@ -48,7 +48,7 @@ Item { anchors.fill: parent sourceComponent: { - if (background.backgroundType === 0) + if (background.type === 0) return wallpaperItem return colorItem diff --git a/src/qml/Wallpaper/Main.qml b/src/qml/Wallpaper/Main.qml index 592e689..9c0f092 100644 --- a/src/qml/Wallpaper/Main.qml +++ b/src/qml/Wallpaper/Main.qml @@ -22,6 +22,7 @@ import QtQuick.Controls 2.12 import QtQuick.Layouts 1.12 import Qt5Compat.GraphicalEffects import Cutefish.Settings 1.0 +import Cutefish.Appearance 1.0 as FrameworkAppearance import FishUI 1.0 as FishUI import "../" @@ -29,7 +30,7 @@ import "../" ItemPage { headerTitle: qsTr("Background") - Background { + FrameworkAppearance.Wallpaper { id: background } @@ -55,11 +56,11 @@ ItemPage { Layout.fillWidth: true onCurrentIndexChanged: { - background.backgroundType = currentIndex + background.type = currentIndex } Component.onCompleted: { - currentIndex = background.backgroundType + currentIndex = background.type } TabButton { @@ -80,7 +81,7 @@ ItemPage { Layout.fillWidth: true implicitHeight: Math.ceil(_view.count / rowCount) * cellHeight + FishUI.Units.largeSpacing - visible: background.backgroundType === 0 + visible: background.type === 0 clip: true model: background.backgrounds @@ -96,7 +97,7 @@ ItemPage { delegate: Item { id: item - property bool isSelected: modelData === background.currentBackgroundPath + property bool isSelected: modelData === background.path width: GridView.view.cellWidth height: GridView.view.cellHeight @@ -178,7 +179,7 @@ ItemPage { hoverEnabled: true onClicked: { - background.setBackground(modelData) + background.path = modelData } onEntered: function() { @@ -206,14 +207,14 @@ ItemPage { } Item { - visible: background.backgroundType === 1 + visible: background.type === 1 height: FishUI.Units.smallSpacing } Loader { Layout.fillWidth: true height: item ? item.height : 0 - visible: background.backgroundType === 1 + visible: background.type === 1 sourceComponent: colorView } } @@ -261,7 +262,7 @@ ItemPage { } delegate: Rectangle { - property bool checked: Qt.colorEqual(background.backgroundColor, bgColor) + property bool checked: Qt.colorEqual(background.color, bgColor) property color currentColor: bgColor width: _colorView.itemSize + FishUI.Units.largeSpacing @@ -280,7 +281,7 @@ ItemPage { id: _mouseArea anchors.fill: parent hoverEnabled: true - onClicked: background.backgroundColor = bgColor + onClicked: background.color = bgColor } Rectangle {