添加图标跟随主题变化
This commit is contained in:
parent
c51e78b505
commit
ea35c8fd75
|
@ -41,6 +41,7 @@ StyleBackground {
|
|||
width: iconGrid.cellWidth
|
||||
height: iconGrid.cellHeight
|
||||
source: modelData
|
||||
cache: false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -61,6 +61,7 @@ Item {
|
|||
height: root.iconHeight
|
||||
width: root.iconWidth
|
||||
source: root.appIcon
|
||||
cache: false
|
||||
}
|
||||
|
||||
StyleText {
|
||||
|
|
|
@ -256,6 +256,7 @@ RowLayout {
|
|||
height: 96
|
||||
width: 96
|
||||
source: icon
|
||||
cache: false
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -20,6 +20,8 @@
|
|||
#include "app-data-manager.h"
|
||||
#include "app-manager.h"
|
||||
#include "commons.h"
|
||||
#include "settings.h"
|
||||
|
||||
#include <QDebug>
|
||||
#include <QAbstractListModel>
|
||||
#include <application-info.h>
|
||||
|
@ -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<DataEntity> 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;
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
#include "app-manager.h"
|
||||
#include "menu-manager.h"
|
||||
#include "app-folder-helper.h"
|
||||
#include "settings.h"
|
||||
|
||||
#include <QObject>
|
||||
#include <QString>
|
||||
|
@ -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);
|
||||
|
|
|
@ -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<DataEntity> data, DataUpdateMode::Mode mode, quint32 index);
|
||||
void reloadPluginData();
|
||||
void onStyleChanged(const GlobalSetting::Key& key);
|
||||
|
||||
private:
|
||||
void resetModel(QVector<DataEntity> &data);
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -52,6 +52,7 @@ public:
|
|||
UnKnowKey = 0,
|
||||
StyleName,
|
||||
ThemeColor,
|
||||
IconThemeName,
|
||||
Transparency,
|
||||
EffectEnabled,
|
||||
SystemFontSize
|
||||
|
|
Loading…
Reference in New Issue