2023-02-16 13:51:55 +08:00
|
|
|
// Copyright (C) 2011 ~ 2018 Deepin Technology Co., Ltd.
|
|
|
|
// SPDX-FileCopyrightText: 2018 - 2023 UnionTech Software Technology Co., Ltd.
|
2022-09-06 11:36:55 +08:00
|
|
|
//
|
|
|
|
// SPDX-License-Identifier: LGPL-3.0-or-later
|
2017-09-18 14:33:44 +08:00
|
|
|
|
2017-03-28 15:44:13 +08:00
|
|
|
#ifndef PREVIEWCONTAINER_H
|
|
|
|
#define PREVIEWCONTAINER_H
|
|
|
|
|
|
|
|
#include <QWidget>
|
2017-07-31 17:06:10 +08:00
|
|
|
#include <QBoxLayout>
|
|
|
|
#include <QTimer>
|
2017-03-28 15:44:13 +08:00
|
|
|
|
|
|
|
#include "constants.h"
|
2017-07-31 17:06:10 +08:00
|
|
|
#include "appsnapshot.h"
|
|
|
|
#include "floatingpreview.h"
|
2017-03-28 15:44:13 +08:00
|
|
|
|
2017-05-10 10:44:47 +08:00
|
|
|
#include <DWindowManagerHelper>
|
|
|
|
|
|
|
|
DWIDGET_USE_NAMESPACE
|
2023-06-13 15:05:44 +08:00
|
|
|
typedef QList<quint32> WindowList;
|
2017-03-28 15:44:13 +08:00
|
|
|
class PreviewContainer : public QWidget
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
explicit PreviewContainer(QWidget *parent = 0);
|
|
|
|
|
2021-09-14 17:08:36 +08:00
|
|
|
enum TitleDisplayMode {
|
|
|
|
HoverShow = 0,
|
|
|
|
AlwaysShow = 1,
|
|
|
|
AlwaysHide = 2,
|
|
|
|
};
|
|
|
|
|
2017-03-28 16:52:38 +08:00
|
|
|
signals:
|
|
|
|
void requestActivateWindow(const WId wid) const;
|
2017-04-25 20:28:11 +08:00
|
|
|
void requestPreviewWindow(const WId wid) const;
|
2017-07-31 17:06:10 +08:00
|
|
|
void requestCheckWindows() const;
|
2019-04-12 17:17:19 +08:00
|
|
|
void requestCancelPreviewWindow() const;
|
|
|
|
void requestHidePopup() const;
|
2017-03-28 16:52:38 +08:00
|
|
|
|
2017-03-28 15:44:13 +08:00
|
|
|
public:
|
2018-08-13 14:17:45 +08:00
|
|
|
void setWindowInfos(const WindowInfoMap &infos, const WindowList &allowClose);
|
2021-09-14 17:08:36 +08:00
|
|
|
void setTitleDisplayMode(int mode);
|
2017-03-28 15:44:13 +08:00
|
|
|
|
|
|
|
public slots:
|
|
|
|
void updateLayoutDirection(const Dock::Position dockPos);
|
2017-07-31 17:06:10 +08:00
|
|
|
void checkMouseLeave();
|
2017-08-18 13:13:56 +08:00
|
|
|
void prepareHide();
|
2017-07-31 17:06:10 +08:00
|
|
|
|
|
|
|
private:
|
2022-01-13 09:15:56 +08:00
|
|
|
void adjustSize(bool composite);
|
2017-07-31 17:06:10 +08:00
|
|
|
void appendSnapWidget(const WId wid);
|
2017-03-28 15:44:13 +08:00
|
|
|
|
2017-05-04 10:39:03 +08:00
|
|
|
void enterEvent(QEvent *e);
|
2017-07-31 17:06:10 +08:00
|
|
|
void leaveEvent(QEvent *e);
|
|
|
|
void dragEnterEvent(QDragEnterEvent *e);
|
|
|
|
void dragLeaveEvent(QDragLeaveEvent *e);
|
2017-04-25 20:28:11 +08:00
|
|
|
|
2017-05-02 19:33:07 +08:00
|
|
|
private slots:
|
2019-04-12 17:17:19 +08:00
|
|
|
void onSnapshotClicked(const WId wid);
|
2017-07-31 17:06:10 +08:00
|
|
|
void previewEntered(const WId wid);
|
2019-04-23 18:17:07 +08:00
|
|
|
void previewFloating();
|
2021-08-25 21:03:30 +08:00
|
|
|
void onRequestCloseAppSnapshot();
|
2017-05-02 19:33:07 +08:00
|
|
|
|
2017-03-28 15:44:13 +08:00
|
|
|
private:
|
2017-07-31 17:06:10 +08:00
|
|
|
bool m_needActivate;
|
|
|
|
QMap<WId, AppSnapshot *> m_snapshots;
|
2017-05-04 10:39:03 +08:00
|
|
|
|
2017-07-31 17:06:10 +08:00
|
|
|
FloatingPreview *m_floatingPreview;
|
|
|
|
QBoxLayout *m_windowListLayout;
|
2017-05-10 10:44:47 +08:00
|
|
|
|
2017-05-04 10:39:03 +08:00
|
|
|
QTimer *m_mouseLeaveTimer;
|
2017-07-31 17:06:10 +08:00
|
|
|
DWindowManagerHelper *m_wmHelper;
|
2019-04-23 18:17:07 +08:00
|
|
|
QTimer *m_waitForShowPreviewTimer;
|
|
|
|
WId m_currentWId;
|
2021-09-14 17:08:36 +08:00
|
|
|
TitleDisplayMode m_titleMode;
|
2017-03-28 15:44:13 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // PREVIEWCONTAINER_H
|