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-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; }
|
|
|
|
const QString title() const { return m_title; }
|
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-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 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-05-22 17:54:59 +08:00
|
|
|
void enterEvent(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;
|
|
|
|
|
2017-05-24 10:56:43 +08:00
|
|
|
QString m_title;
|
2017-05-22 17:17:29 +08:00
|
|
|
QImage m_snapshot;
|
2017-05-22 15:11:07 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // APPSNAPSHOT_H
|