forked from openkylin/ukui-menu
添加图标跟随主题变化
This commit is contained in:
parent
c51e78b505
commit
ea35c8fd75
|
@ -41,6 +41,7 @@ StyleBackground {
|
||||||
width: iconGrid.cellWidth
|
width: iconGrid.cellWidth
|
||||||
height: iconGrid.cellHeight
|
height: iconGrid.cellHeight
|
||||||
source: modelData
|
source: modelData
|
||||||
|
cache: false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,6 +61,7 @@ Item {
|
||||||
height: root.iconHeight
|
height: root.iconHeight
|
||||||
width: root.iconWidth
|
width: root.iconWidth
|
||||||
source: root.appIcon
|
source: root.appIcon
|
||||||
|
cache: false
|
||||||
}
|
}
|
||||||
|
|
||||||
StyleText {
|
StyleText {
|
||||||
|
|
|
@ -256,6 +256,7 @@ RowLayout {
|
||||||
height: 96
|
height: 96
|
||||||
width: 96
|
width: 96
|
||||||
source: icon
|
source: icon
|
||||||
|
cache: false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,6 +20,8 @@
|
||||||
#include "app-data-manager.h"
|
#include "app-data-manager.h"
|
||||||
#include "app-manager.h"
|
#include "app-manager.h"
|
||||||
#include "commons.h"
|
#include "commons.h"
|
||||||
|
#include "settings.h"
|
||||||
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QAbstractListModel>
|
#include <QAbstractListModel>
|
||||||
#include <application-info.h>
|
#include <application-info.h>
|
||||||
|
@ -55,6 +57,7 @@ public:
|
||||||
Q_INVOKABLE void openMenu(const int &index);
|
Q_INVOKABLE void openMenu(const int &index);
|
||||||
public Q_SLOTS:
|
public Q_SLOTS:
|
||||||
void exchangedAppsOrder(int startIndex, int endIndex);
|
void exchangedAppsOrder(int startIndex, int endIndex);
|
||||||
|
void onStyleChanged(const GlobalSetting::Key &key);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QVector<DataEntity> m_favoriteAppsData;
|
QVector<DataEntity> m_favoriteAppsData;
|
||||||
|
@ -72,6 +75,7 @@ FavoriteExtension::FavoriteExtension(QObject *parent) : MenuExtensionIFace(paren
|
||||||
|
|
||||||
updateFavoriteData();
|
updateFavoriteData();
|
||||||
connect(AppDataManager::instance(),&AppDataManager::favoriteAppChanged, this,&FavoriteExtension::updateFavoriteData);
|
connect(AppDataManager::instance(),&AppDataManager::favoriteAppChanged, this,&FavoriteExtension::updateFavoriteData);
|
||||||
|
connect(GlobalSetting::instance(), &GlobalSetting::styleChanged, m_favoriteAppsModel, &FavoriteAppsModel::onStyleChanged);
|
||||||
}
|
}
|
||||||
|
|
||||||
FavoriteExtension::~FavoriteExtension()
|
FavoriteExtension::~FavoriteExtension()
|
||||||
|
@ -181,6 +185,14 @@ void FavoriteAppsModel::exchangedAppsOrder(int startIndex, int endIndex)
|
||||||
AppDataManager::instance()->changedFavoriteOrderSignal(startId, endNum);
|
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)
|
bool FavoriteMenuProvider::isSupport(const MenuProvider::RequestType &type)
|
||||||
{
|
{
|
||||||
return type == DataType;
|
return type == DataType;
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
#include "app-manager.h"
|
#include "app-manager.h"
|
||||||
#include "menu-manager.h"
|
#include "menu-manager.h"
|
||||||
#include "app-folder-helper.h"
|
#include "app-folder-helper.h"
|
||||||
|
#include "settings.h"
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
|
@ -31,6 +32,7 @@ AppModel::AppModel(QObject *parent) : QAbstractListModel(parent)
|
||||||
reloadPluginData();
|
reloadPluginData();
|
||||||
connect(DataProviderManager::instance(), &DataProviderManager::dataChanged, this, &AppModel::onPluginDataChanged);
|
connect(DataProviderManager::instance(), &DataProviderManager::dataChanged, this, &AppModel::onPluginDataChanged);
|
||||||
connect(DataProviderManager::instance(), &DataProviderManager::pluginChanged, this, &AppModel::reloadPluginData);
|
connect(DataProviderManager::instance(), &DataProviderManager::pluginChanged, this, &AppModel::reloadPluginData);
|
||||||
|
connect(GlobalSetting::instance(), &GlobalSetting::styleChanged, this, &AppModel::onStyleChanged);
|
||||||
}
|
}
|
||||||
|
|
||||||
int AppModel::rowCount(const QModelIndex &parent) const
|
int AppModel::rowCount(const QModelIndex &parent) const
|
||||||
|
@ -121,6 +123,14 @@ void AppModel::reloadPluginData()
|
||||||
resetModel(data);
|
resetModel(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AppModel::onStyleChanged(const GlobalSetting::Key &key)
|
||||||
|
{
|
||||||
|
if (key == GlobalSetting::IconThemeName) {
|
||||||
|
Q_EMIT beginResetModel();
|
||||||
|
Q_EMIT endResetModel();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void AppModel::toRenameFolder(QString id)
|
void AppModel::toRenameFolder(QString id)
|
||||||
{
|
{
|
||||||
Q_EMIT renameText(id);
|
Q_EMIT renameText(id);
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
#include "commons.h"
|
#include "commons.h"
|
||||||
#include "data-provider-manager.h"
|
#include "data-provider-manager.h"
|
||||||
#include "menu-provider.h"
|
#include "menu-provider.h"
|
||||||
|
#include "settings.h"
|
||||||
|
|
||||||
namespace UkuiMenu {
|
namespace UkuiMenu {
|
||||||
|
|
||||||
|
@ -53,6 +54,7 @@ public Q_SLOTS:
|
||||||
private Q_SLOTS:
|
private Q_SLOTS:
|
||||||
void onPluginDataChanged(QVector<DataEntity> data, DataUpdateMode::Mode mode, quint32 index);
|
void onPluginDataChanged(QVector<DataEntity> data, DataUpdateMode::Mode mode, quint32 index);
|
||||||
void reloadPluginData();
|
void reloadPluginData();
|
||||||
|
void onStyleChanged(const GlobalSetting::Key& key);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void resetModel(QVector<DataEntity> &data);
|
void resetModel(QVector<DataEntity> &data);
|
||||||
|
|
|
@ -31,6 +31,7 @@
|
||||||
#define UKUI_STYLE_NAME_KEY "styleName"
|
#define UKUI_STYLE_NAME_KEY "styleName"
|
||||||
#define UKUI_STYLE_THEME_COLOR_KEY "themeColor"
|
#define UKUI_STYLE_THEME_COLOR_KEY "themeColor"
|
||||||
#define UKUI_STYLE_SYSTEM_FONT_SIZE "systemFontSize"
|
#define UKUI_STYLE_SYSTEM_FONT_SIZE "systemFontSize"
|
||||||
|
#define UKUI_STYLE_ICON_THEME_NAME_KEY "iconThemeName"
|
||||||
|
|
||||||
namespace UkuiMenu {
|
namespace UkuiMenu {
|
||||||
|
|
||||||
|
@ -83,6 +84,9 @@ void GlobalSetting::initStyleSetting()
|
||||||
} else if (key == UKUI_STYLE_SYSTEM_FONT_SIZE) {
|
} else if (key == UKUI_STYLE_SYSTEM_FONT_SIZE) {
|
||||||
updateData(SystemFontSize, settings->get(key));
|
updateData(SystemFontSize, settings->get(key));
|
||||||
Q_EMIT styleChanged(SystemFontSize);
|
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,
|
UnKnowKey = 0,
|
||||||
StyleName,
|
StyleName,
|
||||||
ThemeColor,
|
ThemeColor,
|
||||||
|
IconThemeName,
|
||||||
Transparency,
|
Transparency,
|
||||||
EffectEnabled,
|
EffectEnabled,
|
||||||
SystemFontSize
|
SystemFontSize
|
||||||
|
|
Loading…
Reference in New Issue