aboutsummaryrefslogtreecommitdiff
path: root/qmidiplayer-desktop/qmpinfowindow.hpp
blob: 7e09b8a3d12c877eafabeed31acd7ac5f08614ff (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#ifndef QMPINFOWINDOW_HPP
#define QMPINFOWINDOW_HPP

#include <QDialog>
#include <QLabel>
#include <QMouseEvent>
#include <QApplication>
#include <QClipboard>
#include <QCloseEvent>
#include <QHideEvent>
#include "../include/qmpcorepublic.hpp"

namespace Ui
{
class qmpInfoWindow;
}

class QClickableLabel : public QLabel
{
    Q_OBJECT
public:
    explicit QClickableLabel(QWidget *parent = nullptr) : QLabel(parent) {}
protected:
    void mousePressEvent(QMouseEvent *e)
    {
        QLabel::mousePressEvent(e);
        if (e->buttons() & Qt::LeftButton)
            QApplication::clipboard()->setText(text());
    }
};

class qmpInfoWindow;
class qmpInfoFunc : public qmpFuncBaseIntf
{
private:
    qmpInfoWindow *p;
public:
    qmpInfoFunc(qmpInfoWindow *par);
    void show();
    void close();
};

class qmpInfoWindow : public QDialog
{
    Q_OBJECT

public:
    explicit qmpInfoWindow(QWidget *parent = nullptr);
    ~qmpInfoWindow();
    void closeEvent(QCloseEvent *e);
    void hideEvent(QHideEvent *e);
public slots:
    void updateInfo();

private:
    Ui::qmpInfoWindow *ui;
    qmpInfoFunc *infof;
};

#endif // QMPINFOWINDOW_HPP