refact!: change property IconName to Icons

Signed-off-by: ComixHe <heyuming@deepin.org>
This commit is contained in:
ComixHe 2023-08-29 13:28:25 +08:00 committed by Comix
parent 26a0b67157
commit 64454bd149
5 changed files with 4 additions and 71 deletions

View File

@ -34,33 +34,6 @@
/> />
</property> </property>
<property name="Icons" type="a{sa{ua{sh}}}" access="read">
<annotation
name="org.freedesktop.DBus.Description"
value="The type of this property is
map[action(string)]map[size(uint)]map[format(string)]fd.
Format can be `png`, `svg`, `xpm`, `dci` or `icon`
refering to the png/svg/xpm/dci format of icon files,
as well as the `.icon` file contain the extra icon-data.
NOTE:
1. `action` is an action identifier
which is the id of
additional applications actions key.
When `action` is emtpy,
this method return icon of the main desktop entry.
Check https://specifications.freedesktop.org/desktop-entry-spec/latest/ar01s11.html#extra-actions-identifier
for futher infomation.
2. `.icon` is a text file with some metadata.
Check https://specifications.freedesktop.org/icon-theme-spec/icon-theme-spec-latest.html#file_formats
for futher infomation.
3. Check https://github.com/linuxdeepin/deepin-specifications
for futher infomation of dci icon format."
/>
<annotation name="org.qtproject.QtDBus.QtTypeName" value="IconMap"/>
</property>
<property name="ActionName" type="a{ss}" access="read"> <property name="ActionName" type="a{ss}" access="read">
<annotation <annotation
name="org.freedesktop.DBus.Description" name="org.freedesktop.DBus.Description"
@ -69,7 +42,7 @@
<annotation name="org.qtproject.QtDBus.QtTypeName" value="PropMap"/> <annotation name="org.qtproject.QtDBus.QtTypeName" value="PropMap"/>
</property> </property>
<property name="IconName" type="a{ss}" access="read"> <property name="Icons" type="a{ss}" access="read">
<annotation <annotation
name="org.freedesktop.DBus.Description" name="org.freedesktop.DBus.Description"
value="The type of IconName is a Map, where the key represents the action and the value is the corresponding content." value="The type of IconName is a Map, where the key represents the action and the value is the corresponding content."

View File

@ -248,7 +248,7 @@ PropMap ApplicationService::displayName() const noexcept
return ret; return ret;
} }
PropMap ApplicationService::iconName() const noexcept PropMap ApplicationService::icons() const noexcept
{ {
PropMap ret; PropMap ret;
auto actionList = actions(); auto actionList = actions();
@ -283,19 +283,6 @@ qulonglong ApplicationService::lastLaunchedTime() const noexcept
return m_lastLaunch; return m_lastLaunch;
} }
IconMap ApplicationService::icons() const
{
if (m_Icons) {
return m_Icons->icons();
}
return {};
}
IconMap &ApplicationService::iconsRef()
{
return m_Icons->iconsRef();
}
bool ApplicationService::isAutoStart() const noexcept bool ApplicationService::isAutoStart() const noexcept
{ {
return m_AutoStart; return m_AutoStart;

View File

@ -20,7 +20,6 @@
#include "dbus/instanceservice.h" #include "dbus/instanceservice.h"
#include "global.h" #include "global.h"
#include "desktopentry.h" #include "desktopentry.h"
#include "desktopicons.h"
#include "dbus/jobmanager1service.h" #include "dbus/jobmanager1service.h"
class ApplicationService : public QObject, public QDBusContext class ApplicationService : public QObject, public QDBusContext
@ -45,16 +44,12 @@ public:
Q_PROPERTY(PropMap DisplayName READ displayName) Q_PROPERTY(PropMap DisplayName READ displayName)
[[nodiscard]] PropMap displayName() const noexcept; [[nodiscard]] PropMap displayName() const noexcept;
Q_PROPERTY(PropMap IconName READ iconName) Q_PROPERTY(PropMap Icons READ icons)
[[nodiscard]] PropMap iconName() const noexcept; [[nodiscard]] PropMap icons() const noexcept;
Q_PROPERTY(qulonglong LastLaunchedTime READ lastLaunchedTime) Q_PROPERTY(qulonglong LastLaunchedTime READ lastLaunchedTime)
[[nodiscard]] qulonglong lastLaunchedTime() const noexcept; [[nodiscard]] qulonglong lastLaunchedTime() const noexcept;
Q_PROPERTY(IconMap Icons READ icons)
[[nodiscard]] IconMap icons() const;
IconMap &iconsRef();
Q_PROPERTY(bool AutoStart READ isAutoStart WRITE setAutoStart) Q_PROPERTY(bool AutoStart READ isAutoStart WRITE setAutoStart)
[[nodiscard]] bool isAutoStart() const noexcept; [[nodiscard]] bool isAutoStart() const noexcept;
void setAutoStart(bool autostart) noexcept; void setAutoStart(bool autostart) noexcept;
@ -98,7 +93,6 @@ private:
QString m_launcher{getApplicationLauncherBinary()}; QString m_launcher{getApplicationLauncherBinary()};
DesktopFile m_desktopSource; DesktopFile m_desktopSource;
QSharedPointer<DesktopEntry> m_entry{nullptr}; QSharedPointer<DesktopEntry> m_entry{nullptr};
QSharedPointer<DesktopIcons> m_Icons{nullptr};
QMap<QDBusObjectPath, QSharedPointer<InstanceService>> m_Instances; QMap<QDBusObjectPath, QSharedPointer<InstanceService>> m_Instances;
static QString userNameLookup(uid_t uid); static QString userNameLookup(uid_t uid);
[[nodiscard]] LaunchTask unescapeExec(const QString &str, const QStringList &fields); [[nodiscard]] LaunchTask unescapeExec(const QString &str, const QStringList &fields);

View File

View File

@ -1,21 +0,0 @@
// SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd.
//
// SPDX-License-Identifier: LGPL-3.0-or-later
#ifndef DESKTOPICONS_H
#define DESKTOPICONS_H
#include "global.h"
class DesktopIcons
{
public:
DesktopIcons() = default;
const IconMap &icons() const noexcept { return m_icons; }
IconMap &iconsRef() noexcept { return m_icons; }
private:
IconMap m_icons;
};
#endif