diff --git a/qml/AppControls2/FolderIcon.qml b/qml/AppControls2/FolderIcon.qml index bc5717e..3473e13 100644 --- a/qml/AppControls2/FolderIcon.qml +++ b/qml/AppControls2/FolderIcon.qml @@ -41,6 +41,7 @@ StyleBackground { width: iconGrid.cellWidth height: iconGrid.cellHeight source: modelData + cache: false } } } diff --git a/qml/AppControls2/IconLabel.qml b/qml/AppControls2/IconLabel.qml index 3c6fc7d..9c2b42b 100644 --- a/qml/AppControls2/IconLabel.qml +++ b/qml/AppControls2/IconLabel.qml @@ -61,6 +61,7 @@ Item { height: root.iconHeight width: root.iconWidth source: root.appIcon + cache: false } StyleText { diff --git a/qml/AppUI/FullScreenContent.qml b/qml/AppUI/FullScreenContent.qml index 3edaa72..47ff255 100644 --- a/qml/AppUI/FullScreenContent.qml +++ b/qml/AppUI/FullScreenContent.qml @@ -256,6 +256,7 @@ RowLayout { height: 96 width: 96 source: icon + cache: false } } diff --git a/src/extension/extensions/favorite-extension.cpp b/src/extension/extensions/favorite-extension.cpp index 9a1b5a8..350c978 100644 --- a/src/extension/extensions/favorite-extension.cpp +++ b/src/extension/extensions/favorite-extension.cpp @@ -20,6 +20,8 @@ #include "app-data-manager.h" #include "app-manager.h" #include "commons.h" +#include "settings.h" + #include #include #include @@ -55,6 +57,7 @@ public: Q_INVOKABLE void openMenu(const int &index); public Q_SLOTS: void exchangedAppsOrder(int startIndex, int endIndex); + void onStyleChanged(const GlobalSetting::Key &key); private: QVector m_favoriteAppsData; @@ -72,6 +75,7 @@ FavoriteExtension::FavoriteExtension(QObject *parent) : MenuExtensionIFace(paren updateFavoriteData(); connect(AppDataManager::instance(),&AppDataManager::favoriteAppChanged, this,&FavoriteExtension::updateFavoriteData); + connect(GlobalSetting::instance(), &GlobalSetting::styleChanged, m_favoriteAppsModel, &FavoriteAppsModel::onStyleChanged); } FavoriteExtension::~FavoriteExtension() @@ -181,6 +185,14 @@ void FavoriteAppsModel::exchangedAppsOrder(int startIndex, int endIndex) AppDataManager::instance()->changedFavoriteOrderSignal(startId, endNum); } +void FavoriteAppsModel::onStyleChanged(const GlobalSetting::Key &key) +{ + if (key == GlobalSetting::IconThemeName) { + beginResetModel(); + endResetModel(); + } +} + bool FavoriteMenuProvider::isSupport(const MenuProvider::RequestType &type) { return type == DataType; diff --git a/src/model/app-model.cpp b/src/model/app-model.cpp index 27f127e..1c0e687 100644 --- a/src/model/app-model.cpp +++ b/src/model/app-model.cpp @@ -20,6 +20,7 @@ #include "app-manager.h" #include "menu-manager.h" #include "app-folder-helper.h" +#include "settings.h" #include #include @@ -31,6 +32,7 @@ AppModel::AppModel(QObject *parent) : QAbstractListModel(parent) reloadPluginData(); connect(DataProviderManager::instance(), &DataProviderManager::dataChanged, this, &AppModel::onPluginDataChanged); connect(DataProviderManager::instance(), &DataProviderManager::pluginChanged, this, &AppModel::reloadPluginData); + connect(GlobalSetting::instance(), &GlobalSetting::styleChanged, this, &AppModel::onStyleChanged); } int AppModel::rowCount(const QModelIndex &parent) const @@ -121,6 +123,14 @@ void AppModel::reloadPluginData() resetModel(data); } +void AppModel::onStyleChanged(const GlobalSetting::Key &key) +{ + if (key == GlobalSetting::IconThemeName) { + Q_EMIT beginResetModel(); + Q_EMIT endResetModel(); + } +} + void AppModel::toRenameFolder(QString id) { Q_EMIT renameText(id); diff --git a/src/model/app-model.h b/src/model/app-model.h index 61e63c6..9e8e4b0 100644 --- a/src/model/app-model.h +++ b/src/model/app-model.h @@ -25,6 +25,7 @@ #include "commons.h" #include "data-provider-manager.h" #include "menu-provider.h" +#include "settings.h" namespace UkuiMenu { @@ -53,6 +54,7 @@ public Q_SLOTS: private Q_SLOTS: void onPluginDataChanged(QVector data, DataUpdateMode::Mode mode, quint32 index); void reloadPluginData(); + void onStyleChanged(const GlobalSetting::Key& key); private: void resetModel(QVector &data); diff --git a/src/settings/settings.cpp b/src/settings/settings.cpp index e463651..50aee94 100644 --- a/src/settings/settings.cpp +++ b/src/settings/settings.cpp @@ -31,6 +31,7 @@ #define UKUI_STYLE_NAME_KEY "styleName" #define UKUI_STYLE_THEME_COLOR_KEY "themeColor" #define UKUI_STYLE_SYSTEM_FONT_SIZE "systemFontSize" +#define UKUI_STYLE_ICON_THEME_NAME_KEY "iconThemeName" namespace UkuiMenu { @@ -83,6 +84,9 @@ void GlobalSetting::initStyleSetting() } else if (key == UKUI_STYLE_SYSTEM_FONT_SIZE) { updateData(SystemFontSize, settings->get(key)); Q_EMIT styleChanged(SystemFontSize); + } else if (key == UKUI_STYLE_ICON_THEME_NAME_KEY) { + updateData(IconThemeName, settings->get(key)); + Q_EMIT styleChanged(IconThemeName); } }); } diff --git a/src/settings/settings.h b/src/settings/settings.h index 5bf4cc3..af33fb4 100644 --- a/src/settings/settings.h +++ b/src/settings/settings.h @@ -52,6 +52,7 @@ public: UnKnowKey = 0, StyleName, ThemeColor, + IconThemeName, Transparency, EffectEnabled, SystemFontSize