2023-02-16 13:51:55 +08:00
|
|
|
// 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
|
2022-07-08 09:05:54 +00:00
|
|
|
|
|
|
|
#ifndef RECENTAPPHELPER_H
|
|
|
|
#define RECENTAPPHELPER_H
|
|
|
|
|
|
|
|
#include "constants.h"
|
2022-08-15 18:07:14 +00:00
|
|
|
#include "dbusutil.h"
|
2022-07-08 09:05:54 +00:00
|
|
|
|
|
|
|
#include <QObject>
|
|
|
|
|
|
|
|
class DockItem;
|
2022-08-15 18:07:14 +00:00
|
|
|
class AppItem;
|
2022-07-08 09:05:54 +00:00
|
|
|
class QWidget;
|
|
|
|
|
|
|
|
/** 用来管理最近打开区域和APP应用区域交互的类
|
|
|
|
* @brief The RecentAppManager class
|
|
|
|
*/
|
|
|
|
|
|
|
|
class RecentAppHelper : public QObject
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2023-06-07 14:11:50 +08:00
|
|
|
explicit RecentAppHelper(QWidget *appWidget, QWidget *recentWidget, QObject *parent = nullptr);
|
2022-07-08 09:05:54 +00:00
|
|
|
void setDisplayMode(Dock::DisplayMode displayMode);
|
|
|
|
void resetAppInfo();
|
|
|
|
void addAppItem(int index, DockItem *appItem);
|
2022-08-08 01:25:37 +00:00
|
|
|
void removeAppItem(DockItem *dockItem);
|
2022-07-08 09:05:54 +00:00
|
|
|
bool recentIsVisible() const;
|
2022-08-08 01:25:37 +00:00
|
|
|
bool dockAppIsVisible() const;
|
2022-07-08 09:05:54 +00:00
|
|
|
|
|
|
|
Q_SIGNALS:
|
|
|
|
void requestUpdate();
|
|
|
|
void recentVisibleChanged(bool); // 最近区域是否可见发生变化的信号
|
2022-08-08 01:25:37 +00:00
|
|
|
void dockAppVisibleChanged(bool); // 驻留应用区域是否可见发生变化的信号
|
2022-07-08 09:05:54 +00:00
|
|
|
|
|
|
|
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();
|
2022-08-08 01:25:37 +00:00
|
|
|
void updateDockAppVisible(bool lastVisible);
|
2022-07-08 09:05:54 +00:00
|
|
|
|
|
|
|
void removeRecentAreaItem(DockItem *wdg);
|
|
|
|
void removeAppAreaItem(DockItem *wdg);
|
|
|
|
|
2022-08-15 18:07:14 +00:00
|
|
|
int getEntryIndex(DockItem *dockItem, QWidget *widget) const;
|
2022-07-08 09:05:54 +00:00
|
|
|
|
2022-08-15 18:07:14 +00:00
|
|
|
QList<AppItem *> appItems(QWidget *widget) const;
|
2022-07-08 09:05:54 +00:00
|
|
|
|
|
|
|
private Q_SLOTS:
|
2022-08-15 18:07:14 +00:00
|
|
|
void onModeChanged(int mode);
|
2022-11-18 17:08:32 +08:00
|
|
|
|
2022-07-08 09:05:54 +00:00
|
|
|
private:
|
|
|
|
QWidget *m_appWidget;
|
|
|
|
QWidget *m_recentWidget;
|
2022-08-08 01:25:37 +00:00
|
|
|
Dock::DisplayMode m_displayMode;
|
2022-07-08 09:05:54 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // RECENTAPPHELPER_H
|