2017-09-18 14:33:44 +08:00
|
|
|
/*
|
2018-02-07 11:52:47 +08:00
|
|
|
* Copyright (C) 2011 ~ 2018 Deepin Technology Co., Ltd.
|
2017-09-18 14:33:44 +08:00
|
|
|
*
|
|
|
|
* Author: sbw <sbw@sbw.so>
|
|
|
|
*
|
|
|
|
* Maintainer: sbw <sbw@sbw.so>
|
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
2017-05-23 14:50:32 +08:00
|
|
|
#ifndef FLOATINGPREVIEW_H
|
|
|
|
#define FLOATINGPREVIEW_H
|
|
|
|
|
|
|
|
#include <QWidget>
|
|
|
|
#include <QPointer>
|
|
|
|
|
2020-06-13 11:39:32 +08:00
|
|
|
#include <DIconButton>
|
2019-08-27 15:03:40 +08:00
|
|
|
#include <DPushButton>
|
2017-05-23 14:50:32 +08:00
|
|
|
|
|
|
|
DWIDGET_USE_NAMESPACE
|
|
|
|
|
|
|
|
class AppSnapshot;
|
|
|
|
class FloatingPreview : public QWidget
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
explicit FloatingPreview(QWidget *parent = 0);
|
|
|
|
|
2017-07-13 11:07:38 +08:00
|
|
|
WId trackedWid() const;
|
2018-08-02 19:54:26 +08:00
|
|
|
AppSnapshot *trackedWindow();
|
2021-09-14 17:08:36 +08:00
|
|
|
void setFloatingTitleVisible(bool bVisible);
|
2017-07-13 11:07:38 +08:00
|
|
|
|
2017-05-23 14:50:32 +08:00
|
|
|
public slots:
|
2019-08-27 15:03:40 +08:00
|
|
|
void trackWindow(AppSnapshot *const snap);
|
2017-05-23 14:50:32 +08:00
|
|
|
|
|
|
|
private:
|
2018-08-02 19:54:26 +08:00
|
|
|
void paintEvent(QPaintEvent *e) override;
|
|
|
|
void mouseReleaseEvent(QMouseEvent *e) override;
|
|
|
|
bool eventFilter(QObject *watched, QEvent *event) override;
|
|
|
|
void hideEvent(QHideEvent *event) override;
|
2017-05-23 14:50:32 +08:00
|
|
|
|
2017-05-23 15:32:03 +08:00
|
|
|
private slots:
|
|
|
|
void onCloseBtnClicked();
|
|
|
|
|
2017-05-23 14:50:32 +08:00
|
|
|
private:
|
|
|
|
QPointer<AppSnapshot> m_tracked;
|
|
|
|
|
2020-06-13 11:39:32 +08:00
|
|
|
DIconButton *m_closeBtn3D;
|
2019-08-27 15:03:40 +08:00
|
|
|
DPushButton *m_titleBtn;
|
2017-05-23 14:50:32 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // FLOATINGPREVIEW_H
|