-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtrayicon.h
88 lines (52 loc) · 1.53 KB
/
trayicon.h
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
/*
This file is part of Waver
Copyright (C) 2021 Peter Papp
Please visit https://launchpad.net/waver for details
*/
/*
historically this used to use QTrayIcon, but that requires Qt's Widgets
now using more modern Windows toast notifications
see https://github.com/mohabouje/WinToast
*/
#ifndef TRAYICON_H
#define TRAYICON_H
#include <QGuiApplication>
#include <QList>
#include <QObject>
#include <QTimer>
#include <wintoastlib.h>
#include "globals.h"
#include "track.h"
#include "waver.h"
using namespace WinToastLib;
class TrayIcon;
class WinToastHandler : public IWinToastHandler {
public:
WinToastHandler(TrayIcon *trayIcon = nullptr);
void toastActivated() const override;
void toastActivated(int actionIndex) const override;
void toastDismissed(WinToastDismissalReason state) const override;
void toastFailed() const override;
private:
TrayIcon *trayIcon;
};
class TrayIcon : public QObject {
Q_OBJECT
public:
explicit TrayIcon(Waver *waver, QObject *parent);
~TrayIcon();
void sendPause();
void sendPlay();
void sendPlayPause();
private:
Waver *waver;
WinToast winToast;
void showMetadataMessage();
WinToastTemplate toastTemplate;
public slots:
void showToast();
signals:
void pause() const;
void play() const;
};
#endif // TRAYICON_H