refactor(settings): move appearance and wallpaper to the framework

main
reionwong 2 months ago
parent 4d91953904
commit 384a6723bd

@ -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

@ -1,215 +0,0 @@
/*
* Copyright (C) 2021 CutefishOS Team.
*
* Author: revenmartin <revenmartin@gmail.com>
*
* 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 <http://www.gnu.org/licenses/>.
*/
#include "appearance.h"
#include <QDBusConnection>
#include <QDBusInterface>
#include <QDebug>
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);
}
}

@ -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<Appearance>(uri, 1, 0, "Appearance");
qmlRegisterType<DockSettings>(uri, 1, 0, "DockSettings");
qmlRegisterType<FontsModel>(uri, 1, 0, "FontsModel");
qmlRegisterType<Brightness>(uri, 1, 0, "Brightness");
qmlRegisterType<Battery>(uri, 1, 0, "Battery");
qmlRegisterType<BatteryHistoryModel>(uri, 1, 0, "BatteryHistoryModel");
qmlRegisterType<CursorThemeModel>(uri, 1, 0, "CursorThemeModel");
qmlRegisterType<About>(uri, 1, 0, "About");
qmlRegisterType<Background>(uri, 1, 0, "Background");
qmlRegisterType<Language>(uri, 1, 0, "Language");
qmlRegisterType<Fonts>(uri, 1, 0, "Fonts");
qmlRegisterType<PowerManager>(uri, 1, 0, "PowerManager");

@ -1,81 +0,0 @@
#include "background.h"
#include <QtConcurrent>
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<QVariantList> 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));
}

@ -1,45 +0,0 @@
#ifndef BACKGROUND_H
#define BACKGROUND_H
#include <QObject>
#include <QList>
#include <QVariant>
#include <QDBusInterface>
#include <QDBusConnection>
#include <QDirIterator>
#include <QDir>
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

@ -19,9 +19,6 @@
#include "cursorthememodel.h"
#include "cursortheme.h"
#include <QDBusConnection>
#include <QDBusInterface>
#include <QDBusPendingCall>
#include <QFileInfo>
#include <QDebug>
#include <QDir>
@ -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);
}
}

@ -23,6 +23,8 @@
#include <QAbstractListModel>
#include <QSettings>
#include <appearance.h>
class QDir;
class CursorTheme;
class CursorThemeModel : public QAbstractListModel
@ -60,6 +62,7 @@ private:
void processDir(const QDir &dir);
private:
Appearance m_appearance;
QList<CursorTheme *> m_list;
QString m_defaultTheme;
QString m_currentTheme;

@ -0,0 +1,116 @@
/*
* Copyright (C) 2021 CutefishOS Team.
*
* Author: revenmartin <revenmartin@gmail.com>
*
* 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 <http://www.gnu.org/licenses/>.
*/
#include "docksettings.h"
#include <QDBusConnection>
#include <QDBusInterface>
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);
}

@ -17,34 +17,22 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef APPEARANCE_H
#define APPEARANCE_H
#ifndef DOCKSETTINGS_H
#define DOCKSETTINGS_H
#include <QObject>
#include <QSettings>
#include <QDBusInterface>
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

@ -18,8 +18,6 @@
*/
#include "fonts.h"
#include <QDBusInterface>
#include <QDBusPendingCall>
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();
}

@ -24,6 +24,8 @@
#include <QStandardItemModel>
#include <QSettings>
#include <appearance.h>
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;

@ -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
}

@ -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")

@ -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 {

@ -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

@ -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 {

Loading…
Cancel
Save