fix: 修复任务栏应用图标右键失效问题

修复任务栏应用图标右键失效问题

Log:
Task: https://pms.uniontech.com/task-view-140805.html
Influence: 保证任务栏应用右键菜单功能正常
Change-Id: Iedb3e0394567c855f7760dc52a06d8ad1073001e
This commit is contained in:
weizhixiang
2022-05-31 17:20:39 +08:00
parent 602f7c55e1
commit 7cb147fb39
26 changed files with 288 additions and 224 deletions

View File

@ -1,51 +0,0 @@
#include "exportwindowinfo.h"
#include <QtDebug>
ExportWindowInfo::ExportWindowInfo()
: m_xid(0)
, m_flash(false)
{
}
ExportWindowInfo::ExportWindowInfo(uint32_t xid, const QString &title, bool flash)
: m_xid(xid)
, m_title(title)
, m_flash(flash)
{
}
QDebug operator<<(QDebug debug, const ExportWindowInfo &info)
{
debug << QString("ExportWindowInfo(%1, %2, %3)").arg(info.m_xid)
.arg(info.m_title)
.arg(info.m_flash);
return debug;
}
QDBusArgument &operator<<(QDBusArgument &arg, const ExportWindowInfo &info)
{
arg.beginStructure();
arg << info.m_xid << info.m_title << info.m_flash;
arg.endStructure();
return arg;
}
const QDBusArgument &operator>>(const QDBusArgument &arg, ExportWindowInfo &info)
{
arg.beginStructure();
arg >> info.m_xid >> info.m_title >> info.m_flash;
arg.endStructure();
return arg;
}
void registerExportWindowInfoMetaType()
{
qRegisterMetaType<ExportWindowInfo>("ExportWindowInfo");
qDBusRegisterMetaType<ExportWindowInfo>();
}

View File

@ -1,31 +0,0 @@
#ifndef EXPORTWINDOWINFO_H
#define EXPORTWINDOWINFO_H
#include <QRect>
#include <QDBusMetaType>
struct ExportWindowInfo
{
public:
ExportWindowInfo();
ExportWindowInfo(uint32_t xid, const QString &title, bool flash);
friend QDebug operator<<(QDebug debug, const ExportWindowInfo &rect);
friend const QDBusArgument &operator>>(const QDBusArgument &arg, ExportWindowInfo &rect);
friend QDBusArgument &operator<<(QDBusArgument &arg, const ExportWindowInfo &rect);
uint32_t getXid() {return m_xid;}
QString getTitle() {return m_title;}
bool getFlash() {return m_flash;}
private:
uint32_t m_xid;
QString m_title;
bool m_flash;
};
Q_DECLARE_METATYPE(ExportWindowInfo)
void registerExportWindowInfoMetaType();
#endif // EXPORTWINDOWINFO_H

View File

@ -1,18 +0,0 @@
#include "exportwindowinfolist.h"
void sortExprotWindowInfoList(ExportWindowInfoList &list)
{
qSort(list.begin(), list.end(), compareWindowXid);
}
void registerExportWindowInfoListMetaType()
{
qRegisterMetaType<ExportWindowInfoList>("ExportWindowInfoList");
qDBusRegisterMetaType<ExportWindowInfoList>();
}
// 按xid进行排序
bool compareWindowXid(ExportWindowInfo &info1, ExportWindowInfo &info2)
{
return info1.getXid() < info2.getXid();
}

View File

@ -1,18 +0,0 @@
#ifndef EXPORTWINDOWINFOLIST_H
#define EXPORTWINDOWINFOLIST_H
#include "exportwindowinfo.h"
#include <QtCore/QList>
#include <QDBusMetaType>
typedef QList<ExportWindowInfo> ExportWindowInfoList;
bool compareWindowXid(ExportWindowInfo &info1, ExportWindowInfo &info2);
void sortExprotWindowInfoList(ExportWindowInfoList &list);
Q_DECLARE_METATYPE(ExportWindowInfoList)
void registerExportWindowInfoListMetaType();
#endif // EXPORTWINDOWINFOLIST_H

View File

@ -0,0 +1,48 @@
#include "windowinfomap.h"
#include <QDBusMetaType>
void registerWindowInfoMapMetaType()
{
registerWindowInfoMetaType();
qRegisterMetaType<WindowInfoMap>("WindowInfoMap");
qDBusRegisterMetaType<WindowInfoMap>();
}
void registerWindowInfoMetaType()
{
qRegisterMetaType<WindowInfo>("WindowInfo");
qDBusRegisterMetaType<WindowInfo>();
}
QDebug operator<<(QDebug argument, const WindowInfo &info)
{
argument << '(' << info.title << ',' << info.attention << ')';
return argument;
}
QDBusArgument &operator<<(QDBusArgument &argument, const WindowInfo &info)
{
argument.beginStructure();
argument << info.title << info.attention;
argument.endStructure();
return argument;
}
const QDBusArgument &operator>>(const QDBusArgument &argument, WindowInfo &info)
{
argument.beginStructure();
argument >> info.title >> info.attention;
argument.endStructure();
return argument;
}
bool WindowInfo::operator==(const WindowInfo &rhs) const
{
return attention == rhs.attention &&
title == rhs.title;
}

View File

@ -0,0 +1,29 @@
#ifndef WINDOWINFOLIST_H
#define WINDOWINFOLIST_H
#include <QDebug>
#include <QList>
#include <QDBusArgument>
class WindowInfo
{
public:
friend QDebug operator<<(QDebug argument, const WindowInfo &info);
friend QDBusArgument &operator<<(QDBusArgument &argument, const WindowInfo &info);
friend const QDBusArgument &operator>>(const QDBusArgument &argument, WindowInfo &info);
bool operator==(const WindowInfo &rhs) const;
public:
bool attention;
QString title;
};
Q_DECLARE_METATYPE(WindowInfo)
typedef QMap<quint32, WindowInfo> WindowInfoMap;
Q_DECLARE_METATYPE(WindowInfoMap)
void registerWindowInfoMetaType();
void registerWindowInfoMapMetaType();
#endif // WINDOWINFOLIST_H