Sayonara Player
GUI_Player.h
1 /* GUI_Simpleplayer.h */
2 
3 /* Copyright (C) 2011-2020 Michael Lugmair (Lucio Carreras)
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_SIMPLEPLAYER_H
22 #define GUI_SIMPLEPLAYER_H
23 
24 #include "Components/PlayManager/PlayState.h"
25 #include "Gui/Utils/GuiClass.h"
26 #include "Gui/Utils/Widgets/Widget.h"
27 #include "Utils/Message/MessageReceiverInterface.h"
28 #include "Utils/Pimpl.h"
29 
30 #include <QSystemTrayIcon>
31 
32 class GUI_TrayIcon;
33 class GUI_Logger;
34 class PreferenceDialog;
35 class QAction;
36 class QMessageBox;
37 class QTranslator;
38 
39 UI_FWD(GUI_Player)
40 
41 namespace PlayerPlugin
42 {
43  class Handler;
44  class Base;
45 }
46 
47 class GUI_Player :
48  public Gui::MainWindow,
50 {
51  Q_OBJECT
52  PIMPL(GUI_Player)
53  UI_CLASS(GUI_Player)
54 
55 signals:
56  void sigClosed();
57 
58 public:
59  explicit GUI_Player(QWidget* parent=nullptr);
60  ~GUI_Player() override;
61 
62  void registerPreferenceDialog(QAction* dialog_action);
63  void requestShutdown();
64 
65 private:
66  void initTrayActions();
67  void initConnections();
68  void initLibrary();
69  void initControlSplitter();
70  void initMainSplitter();
71  void initFontChangeFix();
72  void initGeometry();
73 
74  void checkControlSplitter();
75 
76  void fullscreenChanged();
77  void initControls();
78  void controlstyleChanged();
79 
80  void showLibraryChanged();
81  void addCurrentLibrary();
82  void removeCurrentLibrary();
83 
84 
85 private slots:
86  void playstateChanged(PlayState state);
87  void playError(const QString& message);
88 
89  void splitterMainMoved(int pos, int idx);
90  void splitterControlsMoved(int pos, int idx);
91 
92  void currentLibraryChanged();
93 
94  void minimize();
95  void reallyClose();
96 
97  void trayIconActivated(QSystemTrayIcon::ActivationReason reason);
98  void currentTrackChanged(const MetaData& md);
99 
100  /* Plugins */
101  void pluginAdded(PlayerPlugin::Base* plugin);
102  void pluginActionTriggered(bool b);
103 
104 protected:
105  void closeEvent(QCloseEvent* e) override;
106  void resizeEvent(QResizeEvent* e) override;
107  bool event(QEvent* e) override;
108 
109  // Methods for other mudules to display info/warning/error
110  Message::Answer errorReceived(const QString& error, const QString& senderName=QString()) override;
111  Message::Answer warningReceived(const QString& error, const QString& senderName=QString()) override;
112  Message::Answer infoReceived(const QString& error, const QString& senderName=QString()) override;
113  Message::Answer questionReceived(const QString& info, const QString& senderName=QString(), Message::QuestionType type=Message::QuestionType::YesNo) override;
114 
115  void languageChanged() override;
116 };
117 
118 #endif // GUI_SIMPLEPLAYER_H
GUI_Player
Definition: GUI_Player.h:50
Message::Answer
Answer
The GlobalMessage class.
Definition: Message.h:35
PlayState
PlayState
The PlayState enum.
Definition: PlayState.h:29
PlayerPlugin::Base
Definition: PlayerPluginBase.h:40
PlayerPlugin::Handler
Definition: PlayerPluginHandler.h:35
GUI_Logger
Definition: GUI_Logger.h:54
Gui::MainWindow
The SayonaraMainWindow class.
Definition: Widget.h:65
PlayerPlugin
Interface for PlayerPlugin classes. get_name() and language_changed() must be overwritten.
Definition: GUI_Player.h:42
MetaData
The MetaData class.
Definition: MetaData.h:47
MessageReceiverInterface
The GlobalMessageReceiverInterface class implement this class in order to have the possibility to sho...
Definition: MessageReceiverInterface.h:34
GUI_TrayIcon
Definition: GUI_TrayIcon.h:74
Message::QuestionType
QuestionType
The GlobalMessage class.
Definition: Message.h:48