Sayonara Player
GUI_TrayIcon.h
1 /* GUI_TrayIcon.h */
2 
3 /* Copyright (C) 2011-2017 Lucio Carreras gleugner
4  *
5  * This file is part of sayonara player
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11 
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16 
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  */
20 
21 #ifndef GUI_TRAYICON_H
22 #define GUI_TRAYICON_H
23 
24 #include "Helper/Settings/SayonaraClass.h"
25 
26 #include "Interfaces/Notification/NotificationHandler.h"
27 #include "Components/PlayManager/PlayState.h"
28 
29 #include <QSystemTrayIcon>
30 #include <QAction>
31 #include <QTimer>
32 
33 class PlayManager;
34 class MetaData;
38 class GUI_TrayIcon :
39  public QSystemTrayIcon,
40  public NotificationInterface,
41  private SayonaraClass
42 
43 {
44  Q_OBJECT
45 
46 public:
47 
48  explicit GUI_TrayIcon(QObject *parent=nullptr);
49  virtual ~GUI_TrayIcon();
50 
51  bool event ( QEvent * e ) override;
52 
53 
54 /* void set_enable_play(bool);
55  void set_enable_stop(bool);
56  void set_enable_mute(bool);
57  void set_enable_bwd(bool);*/
58 
59  void set_enable_fwd(bool);
60 
61  void notify(const MetaData& md) override;
62  void notify(const QString &title, const QString &message, const QString &image_path) override;
63 
64 
65 public slots:
66 
67  void skin_changed();
68 
69 signals:
70 
75  void sig_wheel_changed(int delta);
76  void sig_hide_clicked();
77  void sig_close_clicked();
78  void sig_show_clicked();
79 
80 
81 private slots:
82  void play_clicked();
83  void stop_clicked();
84  void fwd_clicked();
85  void bwd_clicked();
86  void show_clicked();
87  void close_clicked();
88  void mute_clicked();
89  void cur_song_clicked();
90 
91  void playstate_changed(PlayState state);
92 
93  void mute_changed(bool muted);
94  void _sl_show_tray_icon();
95 
96 
97 protected:
98  virtual void language_changed();
99 
100 private:
101  // some shared actions
102  PlayManager* _play_manager=nullptr;
103 
104  QAction* _show_action=nullptr;
105  QAction* _close_action=nullptr;
106  QAction* _play_action=nullptr;
107  QAction* _stop_action=nullptr;
108  QAction* _mute_action=nullptr;
109  QAction* _fwd_action=nullptr;
110  QAction* _bwd_action=nullptr;
111  QAction* _cur_song_action=nullptr;
112 
113  QMenu* _context_menu=nullptr;
114  QTimer* _timer=nullptr;
115 
116 private:
117  void init_context_menu();
118 };
119 
120 #endif
Definition: NotificationInterface.h:29
void notify(const MetaData &md) override
notify when Metadata has been changed
Definition: GUI_TrayIcon.h:38
The SayonaraClass class provides access to Settings and notifications.
Definition: SayonaraClass.h:29
The MetaData class MetaDataHelper.
Definition: MetaData.h:55
Global handler for current playback state (Singleton)
Definition: PlayManager.h:37
void sig_wheel_changed(int delta)
PlayState
The PlayState enum.
Definition: PlayState.h:30