feat: 玲珑包后缀提供配置功能实现
玲珑包后缀提供配置功能的实现 Log: Influence: 默认隐藏后缀,开启,玲珑应用则显示,否则,隐藏. Task: https://pms.uniontech.com/task-view-152805.html Change-Id: I72e390a8e25396454c451cde28a795e923b28144
This commit is contained in:
parent
7667dbc05a
commit
20a2642e74
@ -241,6 +241,16 @@
|
|||||||
"description": "Launcher display mode.",
|
"description": "Launcher display mode.",
|
||||||
"permissions": "readwrite",
|
"permissions": "readwrite",
|
||||||
"visibility": "private"
|
"visibility": "private"
|
||||||
|
},
|
||||||
|
"MagicaVoxelApp_Hide_SuffixName": {
|
||||||
|
"value": false,
|
||||||
|
"serial": 0,
|
||||||
|
"flags": [],
|
||||||
|
"name": "MagicaVoxelApp_Hide_SuffixName",
|
||||||
|
"name[zh_CN]": "玲珑包后缀提供配置,默认隐藏; 开启, 玲珑应用显示后缀, 关闭, 后缀隐藏",
|
||||||
|
"description": "***",
|
||||||
|
"permissions": "readwrite",
|
||||||
|
"visibility": "private"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -37,6 +37,7 @@ const QString keyAppsUseProxy = "Apps_Use_Proxy";
|
|||||||
const QString keyAppsDisableScaling = "Apps_Disable_Scaling";
|
const QString keyAppsDisableScaling = "Apps_Disable_Scaling";
|
||||||
const QString keyAppsHidden = "Apps_Hidden";
|
const QString keyAppsHidden = "Apps_Hidden";
|
||||||
const QString keyPackageNameSearch = "Search_Package_Name";
|
const QString keyPackageNameSearch = "Search_Package_Name";
|
||||||
|
const QString keySuffixHidden = "MagicaVoxelApp_Hide_SuffixName";
|
||||||
|
|
||||||
// 应用配置
|
// 应用配置
|
||||||
const QString lastoreDataDir = "/var/lib/lastore";
|
const QString lastoreDataDir = "/var/lib/lastore";
|
||||||
|
@ -34,6 +34,7 @@ DBusAdaptorLauncher::DBusAdaptorLauncher(QObject *parent)
|
|||||||
connect(launcher, &Launcher::uninstallSuccess, this, &DBusAdaptorLauncher::UninstallSuccess);
|
connect(launcher, &Launcher::uninstallSuccess, this, &DBusAdaptorLauncher::UninstallSuccess);
|
||||||
connect(launcher, &Launcher::displayModeChanged, this, &DBusAdaptorLauncher::DisplayModeChanged);
|
connect(launcher, &Launcher::displayModeChanged, this, &DBusAdaptorLauncher::DisplayModeChanged);
|
||||||
connect(launcher, &Launcher::fullScreenChanged, this, &DBusAdaptorLauncher::FullScreenChanged);
|
connect(launcher, &Launcher::fullScreenChanged, this, &DBusAdaptorLauncher::FullScreenChanged);
|
||||||
|
connect(launcher, &Launcher::appSuffixChanged, this, &DBusAdaptorLauncher::AppSuffixChanged);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -116,10 +116,11 @@ public:
|
|||||||
|
|
||||||
public: // PROPERTIES
|
public: // PROPERTIES
|
||||||
Q_PROPERTY(int DisplayMode READ displayMode WRITE setDisplayMode NOTIFY DisplayModeChanged)
|
Q_PROPERTY(int DisplayMode READ displayMode WRITE setDisplayMode NOTIFY DisplayModeChanged)
|
||||||
|
Q_PROPERTY(bool Fullscreen READ fullscreen WRITE setFullscreen NOTIFY FullScreenChanged)
|
||||||
|
|
||||||
int displayMode() const;
|
int displayMode() const;
|
||||||
void setDisplayMode(int value);
|
void setDisplayMode(int value);
|
||||||
|
|
||||||
Q_PROPERTY(bool Fullscreen READ fullscreen WRITE setFullscreen NOTIFY FullScreenChanged)
|
|
||||||
bool fullscreen() const;
|
bool fullscreen() const;
|
||||||
void setFullscreen(bool value);
|
void setFullscreen(bool value);
|
||||||
|
|
||||||
@ -135,6 +136,7 @@ public Q_SLOTS: // METHODS
|
|||||||
void RequestUninstall(const QString &id);
|
void RequestUninstall(const QString &id);
|
||||||
void SetDisableScaling(const QString &id, bool value);
|
void SetDisableScaling(const QString &id, bool value);
|
||||||
void SetUseProxy(const QString &id, bool value);
|
void SetUseProxy(const QString &id, bool value);
|
||||||
|
|
||||||
Q_SIGNALS: // SIGNALS
|
Q_SIGNALS: // SIGNALS
|
||||||
void ItemChanged(const QString &status, const LauncherItemInfo &itemInfo, qlonglong categoryID);
|
void ItemChanged(const QString &status, const LauncherItemInfo &itemInfo, qlonglong categoryID);
|
||||||
void NewAppLaunched(const QString &appID);
|
void NewAppLaunched(const QString &appID);
|
||||||
@ -143,6 +145,7 @@ Q_SIGNALS: // SIGNALS
|
|||||||
|
|
||||||
void DisplayModeChanged(int mode);
|
void DisplayModeChanged(int mode);
|
||||||
void FullScreenChanged(bool isFull);
|
void FullScreenChanged(bool isFull);
|
||||||
|
void AppSuffixChanged();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -51,6 +51,7 @@ Launcher::Launcher(QObject *parent)
|
|||||||
: SynModule(parent)
|
: SynModule(parent)
|
||||||
{
|
{
|
||||||
registeModule("launcher");
|
registeModule("launcher");
|
||||||
|
appsHidden = SETTING->getHiddenApps();
|
||||||
initSettings();
|
initSettings();
|
||||||
|
|
||||||
for (auto dir : BaseDir::appDirs()) {
|
for (auto dir : BaseDir::appDirs()) {
|
||||||
@ -443,6 +444,13 @@ void Launcher::handleFSWatcherEvents(QDBusMessage msg)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Launcher::onAppSuffixNameChanged(bool)
|
||||||
|
{
|
||||||
|
initItems();
|
||||||
|
|
||||||
|
Q_EMIT appSuffixChanged();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Launcher::initSettings 初始化启动器配置
|
* @brief Launcher::initSettings 初始化启动器配置
|
||||||
*/
|
*/
|
||||||
@ -453,8 +461,7 @@ void Launcher::initSettings()
|
|||||||
});
|
});
|
||||||
connect(SETTING, &LauncherSettings::fullscreenChanged, this, &Launcher::fullScreenChanged);
|
connect(SETTING, &LauncherSettings::fullscreenChanged, this, &Launcher::fullScreenChanged);
|
||||||
connect(SETTING, &LauncherSettings::hiddenAppsChanged, this, &Launcher::handleAppHiddenChanged);
|
connect(SETTING, &LauncherSettings::hiddenAppsChanged, this, &Launcher::handleAppHiddenChanged);
|
||||||
|
connect(SETTING, &LauncherSettings::appSuffixNameChanged, this, &Launcher::onAppSuffixNameChanged);
|
||||||
appsHidden = SETTING->getHiddenApps();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -695,7 +702,6 @@ Categorytype Launcher::queryCategoryId(const Item *item)
|
|||||||
if (category != Categorytype::CategoryErr)
|
if (category != Categorytype::CategoryErr)
|
||||||
return category;
|
return category;
|
||||||
|
|
||||||
|
|
||||||
return getXCategory(item);
|
return getXCategory(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1131,7 +1137,7 @@ bool Launcher::isDeepinCustomDesktopFile(QString fileName)
|
|||||||
&& fileInfo.baseName().startsWith("deepin-custom-");
|
&& fileInfo.baseName().startsWith("deepin-custom-");
|
||||||
}
|
}
|
||||||
|
|
||||||
Item Launcher:: NewItemWithDesktopInfo(DesktopInfo &info)
|
Item Launcher::NewItemWithDesktopInfo(DesktopInfo &info)
|
||||||
{
|
{
|
||||||
QString enName(info.getKeyFile()->getStr(MainSection, KeyName).c_str());
|
QString enName(info.getKeyFile()->getStr(MainSection, KeyName).c_str());
|
||||||
QString enComment(info.getKeyFile()->getStr(MainSection, KeyComment).c_str());
|
QString enComment(info.getKeyFile()->getStr(MainSection, KeyComment).c_str());
|
||||||
@ -1165,6 +1171,10 @@ Item Launcher:: NewItemWithDesktopInfo(DesktopInfo &info)
|
|||||||
item.info.icon = info.getIcon().c_str();
|
item.info.icon = info.getIcon().c_str();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 玲珑应用添加后缀, 默认隐藏
|
||||||
|
if (SETTING->getMagicaVoxelSuffixHidden() && appFileName.startsWith("/persistent/linglong/entries/share/applications/"))
|
||||||
|
item.info.name = QString("%1(%2)").arg(appName).arg(tr("magicaVoxel"));
|
||||||
|
|
||||||
xDeepinCategory = xDeepinCategory.toLower();
|
xDeepinCategory = xDeepinCategory.toLower();
|
||||||
|
|
||||||
for (auto &keyWord : info.getKeywords()) {
|
for (auto &keyWord : info.getKeywords()) {
|
||||||
|
@ -114,9 +114,11 @@ Q_SIGNALS:
|
|||||||
|
|
||||||
void displayModeChanged(int mode);
|
void displayModeChanged(int mode);
|
||||||
void fullScreenChanged(bool isFull);
|
void fullScreenChanged(bool isFull);
|
||||||
|
void appSuffixChanged();
|
||||||
|
|
||||||
private Q_SLOTS:
|
private Q_SLOTS:
|
||||||
void handleFSWatcherEvents(QDBusMessage msg);
|
void handleFSWatcherEvents(QDBusMessage msg);
|
||||||
|
void onAppSuffixNameChanged(bool hidden);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void initSettings();
|
void initSettings();
|
||||||
@ -144,13 +146,14 @@ private:
|
|||||||
bool removeDesktop(const Item &item);
|
bool removeDesktop(const Item &item);
|
||||||
void notifyUninstallDone(const Item &item, bool result);
|
void notifyUninstallDone(const Item &item, bool result);
|
||||||
|
|
||||||
|
private:
|
||||||
QMap<QString, Item> itemsMap;
|
QMap<QString, Item> itemsMap; // appKey, Item
|
||||||
QMap<QString, QString> desktopPkgMap;
|
QMap<QString, QString> desktopPkgMap;
|
||||||
QMap<QString, Categorytype> pkgCategoryMap;
|
QMap<QString, Categorytype> pkgCategoryMap;
|
||||||
QMap<QString, QString> nameMap;
|
QMap<QString, QString> nameMap;
|
||||||
QMap<QString, int> noPkgItemIds;
|
QMap<QString, int> noPkgItemIds;
|
||||||
QVector<QString> appsHidden;
|
QVector<QString> appsHidden;
|
||||||
|
|
||||||
QStringList appDirs;
|
QStringList appDirs;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -42,6 +42,8 @@ LauncherSettings::LauncherSettings(QObject *parent)
|
|||||||
Q_EMIT fullscreenChanged(m_dconfig->value(key).toBool());
|
Q_EMIT fullscreenChanged(m_dconfig->value(key).toBool());
|
||||||
} else if (key == keyAppsHidden) {
|
} else if (key == keyAppsHidden) {
|
||||||
Q_EMIT hiddenAppsChanged();
|
Q_EMIT hiddenAppsChanged();
|
||||||
|
} else if (key == keySuffixHidden) {
|
||||||
|
Q_EMIT appSuffixNameChanged(m_dconfig->value(key).toBool());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -163,3 +165,18 @@ QVector<QString> LauncherSettings::getHiddenApps()
|
|||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool LauncherSettings::getMagicaVoxelSuffixHidden() const
|
||||||
|
{
|
||||||
|
return m_dconfig ? m_dconfig->value(keySuffixHidden, false).toBool() : false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void LauncherSettings::setMagicaVoxelSuffixHidden(bool state)
|
||||||
|
{
|
||||||
|
if (!m_dconfig) {
|
||||||
|
qInfo() << Q_FUNC_INFO << "set magicaVoxel suffix failed!";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_dconfig->setValue(keySuffixHidden, state);
|
||||||
|
}
|
||||||
|
@ -64,10 +64,14 @@ public:
|
|||||||
|
|
||||||
QVector<QString> getHiddenApps();
|
QVector<QString> getHiddenApps();
|
||||||
|
|
||||||
|
bool getMagicaVoxelSuffixHidden() const;
|
||||||
|
void setMagicaVoxelSuffixHidden(bool hidden);
|
||||||
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
void displayModeChanged(QString mode);
|
void displayModeChanged(QString mode);
|
||||||
void fullscreenChanged(bool isFull);
|
void fullscreenChanged(bool isFull);
|
||||||
void hiddenAppsChanged();
|
void hiddenAppsChanged();
|
||||||
|
void appSuffixNameChanged(bool);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // LAUNCHERSETTINGS_H
|
#endif // LAUNCHERSETTINGS_H
|
||||||
|
@ -53,7 +53,7 @@ QList<QSharedPointer<Application>> scanFiles()
|
|||||||
user = getpwent();
|
user = getpwent();
|
||||||
}
|
}
|
||||||
endpwent();
|
endpwent();
|
||||||
auto linglong = scan("/deepin/linglong/entries/share/applications/");
|
auto linglong = scan("/persistent/linglong/entries/share/applications/");
|
||||||
for (const QFileInfo &info : linglong) {
|
for (const QFileInfo &info : linglong) {
|
||||||
applications << QSharedPointer<Application>(new Application(
|
applications << QSharedPointer<Application>(new Application(
|
||||||
"linglong",
|
"linglong",
|
||||||
|
Loading…
Reference in New Issue
Block a user