summaryrefslogtreecommitdiffstats
path: root/src/gui/osd.h
blob: c5f83af56b69761dd466ce29ca3c1ccf7a6c5323 (plain)
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
#ifndef OSD_H
#define OSD_H
#include <QObject>
#include <QString>
#if 0 //QT_VERSION >= 0x050000
#	define OSD_VIEWCLASS QQuickView
#	define QML_ITEMTYPE QQuickItem
#else
#	define OSD_VIEWCLASS QDeclarativeView
#	define QML_ITEMTYPE QDeclarativeItem
#endif

// Must use forward declaration, otherwise build fails
// due to double QMetaTypeID<QAction*> definition (wtf).
// Hence I also cannot inherit from OSD_VIEWCLASS...
class OSD_VIEWCLASS;
class QML_ITEMTYPE;

class OSD : public QObject
{
	Q_OBJECT
public:
	OSD(QObject* parent = 0);
	~OSD();

	void setCaller(const QString& text);
	void setTime(const QString& timeText);
	void setMuted(bool muted);

	void move(int x, int y);
	void show();
	void hide();
	int width() const;
	int height() const;
	void setVisible(bool v) { if (v) show(); else hide(); }

private:
	void positionWindow();
public slots:
	void onHangupClicked();
	void onMuteClicked();
	void saveState();

signals:
	void hangupClicked();
	void muteClicked();

private:
	OSD_VIEWCLASS* m_view;
	QML_ITEMTYPE* m_caller;
	QML_ITEMTYPE* m_time;
	QML_ITEMTYPE* m_mute;
};

#endif // OSD_H