Sayonara Player
GUI_TrayIcon.h
1/* GUI_TrayIcon.h */
2
3/* Copyright (C) 2011-2020 Michael Lugmair (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 "Interfaces/Notification/NotificationHandler.h"
25#include "Gui/Utils/Widgets/WidgetTemplate.h"
26#include "Utils/Pimpl.h"
27
28#include <QSystemTrayIcon>
29#include <QMenu>
30
31class GUI_TrayIcon;
32class PlayManager;
33class QTimer;
34
36 public Gui::WidgetTemplate<QMenu>
37{
38 Q_OBJECT
40
41 signals:
42 void sigShowClicked();
43 void sigCloseClicked();
44
45 public:
46 TrayIconContextMenu(PlayManager* playManager, GUI_TrayIcon* parent);
47 ~TrayIconContextMenu() override;
48
49 void setForwardEnabled(bool b);
50 void setDisplayNames();
51
52 protected:
53 void languageChanged() override;
54 void skinChanged() override;
55
56 private slots:
57 void playstateChanged(PlayState state);
58 void muteChanged(bool muted);
59
60 void muteClicked();
61 void currentSongClicked();
62};
63
65 public QSystemTrayIcon,
67{
68 Q_OBJECT
69 PIMPL(GUI_TrayIcon)
70
71 signals:
72 void sigWheelChanged(int delta);
73 void sigCloseClicked();
74 void sigShowClicked();
75
76 public:
77 explicit GUI_TrayIcon(PlayManager* playManager, QObject* parent = nullptr);
78 ~GUI_TrayIcon() override;
79
80 bool event(QEvent* e) override;
81 [[maybe_unused]] void setForwardEnabled(bool b);
82
83 void notify(const MetaData& md) override;
84 void notify(const QString& title, const QString& message, const QString& imagePath) override;
85
86 [[nodiscard]] QString name() const override;
87 [[nodiscard]] QString displayName() const override;
88
89 private slots:
90 void playstateChanged(PlayState state);
91 void showTrayIconChanged();
92
93 private: // NOLINT(readability-redundant-access-specifiers)
94 void initContextMenu();
95};
96
97#endif
Definition: GUI_TrayIcon.h:67
void notify(const QString &title, const QString &message, const QString &imagePath) override
show standard notification
QString name() const override
get name of notification interface
void notify(const MetaData &md) override
notify when Metadata has been changed
Template for Sayonara Widgets. This template is responsible for holding a reference to the settings.
Definition: WidgetTemplate.h:87
The MetaData class.
Definition: MetaData.h:47
Definition: NotificationInterface.h:31
Global handler for current playback state (Singleton)
Definition: PlayManager.h:36
Definition: GUI_TrayIcon.h:37