2017-05-22 15:11:07 +08:00
|
|
|
#ifndef APPSNAPSHOT_H
|
|
|
|
#define APPSNAPSHOT_H
|
|
|
|
|
|
|
|
#include <QWidget>
|
2017-05-22 17:17:29 +08:00
|
|
|
#include <QDebug>
|
|
|
|
#include <QTimer>
|
2017-05-24 14:12:50 +08:00
|
|
|
#include <QLabel>
|
|
|
|
|
|
|
|
#include <dimagebutton.h>
|
|
|
|
#include <DWindowManagerHelper>
|
|
|
|
|
|
|
|
DWIDGET_USE_NAMESPACE
|
2017-05-22 15:11:07 +08:00
|
|
|
|
|
|
|
class AppSnapshot : public QWidget
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2017-05-22 17:17:29 +08:00
|
|
|
explicit AppSnapshot(const WId wid, QWidget *parent = 0);
|
|
|
|
|
2017-05-23 15:32:03 +08:00
|
|
|
WId wid() const { return m_wid; }
|
2017-05-24 10:56:43 +08:00
|
|
|
const QImage snapshot() const { return m_snapshot; }
|
2017-05-24 14:12:50 +08:00
|
|
|
const QString title() const { return m_title->text(); }
|
2017-05-23 15:32:03 +08:00
|
|
|
|
2017-05-22 17:54:59 +08:00
|
|
|
signals:
|
|
|
|
void entered(const WId wid) const;
|
|
|
|
void clicked(const WId wid) const;
|
2017-06-09 16:18:15 +08:00
|
|
|
void requestCheckWindow() const;
|
2017-05-22 17:54:59 +08:00
|
|
|
|
2017-05-23 15:32:03 +08:00
|
|
|
public slots:
|
2017-05-24 11:32:14 +08:00
|
|
|
void fetchSnapshot();
|
2017-05-23 15:32:03 +08:00
|
|
|
void closeWindow() const;
|
2017-05-24 14:12:50 +08:00
|
|
|
void compositeChanged() const;
|
2017-05-24 10:56:43 +08:00
|
|
|
void setWindowTitle(const QString &title);
|
2017-05-23 15:32:03 +08:00
|
|
|
|
2017-05-22 17:17:29 +08:00
|
|
|
private:
|
2017-07-04 14:34:38 +08:00
|
|
|
void dragEnterEvent(QDragEnterEvent *e);
|
2017-05-22 17:54:59 +08:00
|
|
|
void enterEvent(QEvent *e);
|
2017-05-24 14:12:50 +08:00
|
|
|
void leaveEvent(QEvent *e);
|
2017-05-22 17:17:29 +08:00
|
|
|
void paintEvent(QPaintEvent *e);
|
2017-05-22 17:54:59 +08:00
|
|
|
void mousePressEvent(QMouseEvent *e);
|
2017-05-22 17:17:29 +08:00
|
|
|
|
|
|
|
private:
|
|
|
|
const WId m_wid;
|
|
|
|
|
|
|
|
QImage m_snapshot;
|
2017-05-24 14:12:50 +08:00
|
|
|
QLabel *m_title;
|
|
|
|
DImageButton *m_closeBtn;
|
|
|
|
|
|
|
|
DWindowManagerHelper *m_wmHelper;
|
2017-05-22 15:11:07 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // APPSNAPSHOT_H
|