Sayonara Player
Loading...
Searching...
No Matches
GUI_TrayIcon.h
1/* GUI_TrayIcon.h */
2
3/* Copyright (C) 2011-2024 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 "Components/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;
34class QTimer;
35
37 public Gui::WidgetTemplate<QMenu>
38{
39 Q_OBJECT
41
42 signals:
43 void sigShowClicked();
44 void sigCloseClicked();
45
46 public:
47 TrayIconContextMenu(PlayManager* playManager, NotificationHandler* notificationHandler, GUI_TrayIcon* parent);
48 ~TrayIconContextMenu() override;
49
50 void setForwardEnabled(bool b);
51 void setDisplayNames();
52
53 protected:
54 void languageChanged() override;
55 void skinChanged() override;
56
57 private slots:
58 void playstateChanged(PlayState state);
59 void muteChanged(bool muted);
60
61 void muteClicked();
62 void currentSongClicked();
63};
64
66 public QSystemTrayIcon,
67 public Notificator
68{
69 Q_OBJECT
70 PIMPL(GUI_TrayIcon)
71
72 signals:
73 void sigWheelChanged(int delta);
74 void sigCloseClicked();
75 void sigShowClicked();
76
77 public:
78 GUI_TrayIcon(PlayManager* playManager, NotificationHandler* notificationHandler, QObject* parent = nullptr);
79 ~GUI_TrayIcon() override;
80
81 bool event(QEvent* e) override;
82 [[maybe_unused]] void setForwardEnabled(bool b);
83
84 void notify(const MetaData& md) override;
85 void notify(const QString& title, const QString& message, const QString& imagePath) override;
86
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:68
Template for Sayonara Widgets. This template is responsible for holding a reference to the settings.
Definition WidgetTemplate.h:86
The MetaData class.
Definition MetaData.h:47
Definition NotificationHandler.h:29
Definition Notificator.h:30
Definition PlayManager.h:34
Definition GUI_TrayIcon.h:38