mirror of
https://github.com/linuxdeepin/dde-dock.git
synced 2025-05-30 22:01:41 +00:00

1. taskmanager used to identify which entry should map to window in x11 environmrnt, listen to xevent in anohter thread, and handle those event when window create, destory, changed. use some way to identify which entry(desktopfile) should mapped to changed window. in wayland, connected plsamawindow signal(window created destoried. 2. use taskmanager instead of dbus in old dock code log: as title
68 lines
1.2 KiB
C++
68 lines
1.2 KiB
C++
// SPDX-FileCopyrightText: 2018 - 2023 UnionTech Software Technology Co., Ltd.
|
|
//
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
#ifndef APPMENU_H
|
|
#define APPMENU_H
|
|
|
|
#include <QString>
|
|
#include <QJsonObject>
|
|
#include <QVector>
|
|
|
|
#include <memory>
|
|
#include <vector>
|
|
#include <functional>
|
|
|
|
typedef std::function<void(uint32_t)> AppMenuAction;
|
|
|
|
class AppMenu;
|
|
|
|
// 应用菜单选项
|
|
struct AppMenuItem
|
|
{
|
|
AppMenuItem()
|
|
: isActive(true)
|
|
, hint(0)
|
|
{
|
|
}
|
|
|
|
QString id;
|
|
QString text;
|
|
QString isCheckable;
|
|
QString checked;
|
|
QString icon;
|
|
QString iconHover;
|
|
QString iconInactive;
|
|
QString showCheckMark;
|
|
std::shared_ptr<AppMenu> subMenu;
|
|
|
|
bool isActive;
|
|
int hint;
|
|
AppMenuAction action;
|
|
};
|
|
|
|
// 应用菜单类
|
|
class AppMenu
|
|
{
|
|
public:
|
|
AppMenu();
|
|
|
|
void appendItem(AppMenuItem item);
|
|
void setDirtyStatus(bool isDirty);
|
|
void handleAction(uint32_t timestamp, QString itemId);
|
|
|
|
QString getMenuJsonStr();
|
|
|
|
private:
|
|
QString allocateId();
|
|
|
|
private:
|
|
int m_itemCount;
|
|
bool m_dirty;
|
|
bool m_checkableMenu; // json:"checkableMenu"
|
|
bool m_singleCheck; // json:"singleCheck"
|
|
QVector<AppMenuItem> m_items; // json:"items"
|
|
};
|
|
|
|
#endif // APPMENU_H
|