dde-dock/frame/controller/recentapphelper.h
tsic404 9de057e2cc refactor: add taskmanager from dde-application-manager
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
2023-07-18 07:35:19 +00:00

67 lines
1.8 KiB
C++

// Copyright (C) 2022 ~ 2022 Deepin Technology Co., Ltd.
// SPDX-FileCopyrightText: 2018 - 2023 UnionTech Software Technology Co., Ltd.
//
// SPDX-License-Identifier: LGPL-3.0-or-later
#ifndef RECENTAPPHELPER_H
#define RECENTAPPHELPER_H
#include "constants.h"
#include "dbusutil.h"
#include <QObject>
class DockItem;
class AppItem;
class QWidget;
/** 用来管理最近打开区域和APP应用区域交互的类
* @brief The RecentAppManager class
*/
class RecentAppHelper : public QObject
{
Q_OBJECT
public:
explicit RecentAppHelper(QWidget *appWidget, QWidget *recentWidget, QObject *parent = nullptr);
void setDisplayMode(Dock::DisplayMode displayMode);
void resetAppInfo();
void addAppItem(int index, DockItem *appItem);
void removeAppItem(DockItem *dockItem);
bool recentIsVisible() const;
bool dockAppIsVisible() const;
Q_SIGNALS:
void requestUpdate();
void recentVisibleChanged(bool); // 最近区域是否可见发生变化的信号
void dockAppVisibleChanged(bool); // 驻留应用区域是否可见发生变化的信号
protected:
bool eventFilter(QObject *watched, QEvent *event) override;
private:
bool appInRecent(DockItem *item) const;
void addAppAreaItem(int index, DockItem *wdg);
void addRecentAreaItem(int index, DockItem *wdg);
void updateRecentVisible();
void updateDockAppVisible(bool lastVisible);
void removeRecentAreaItem(DockItem *wdg);
void removeAppAreaItem(DockItem *wdg);
int getEntryIndex(DockItem *dockItem, QWidget *widget) const;
QList<AppItem *> appItems(QWidget *widget) const;
private Q_SLOTS:
void onModeChanged(int mode);
private:
QWidget *m_appWidget;
QWidget *m_recentWidget;
Dock::DisplayMode m_displayMode;
};
#endif // RECENTAPPHELPER_H