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 QAction;
35 class QMessageBox;
36 class QTranslator;
37 
38 UI_FWD(GUI_Player)
39 
40 namespace PlayerPlugin
41 {
42  class Handler;
43  class Base;
44 }
45 
46 class GUI_Player :
47  public Gui::MainWindow,
49 {
50  Q_OBJECT
51  PIMPL(GUI_Player)
52  UI_CLASS(GUI_Player)
53 
54  signals:
55  void sigClosed();
56 
57  public:
58  explicit GUI_Player(QWidget* parent = nullptr);
59  ~GUI_Player() override;
60 
61  void registerPreferenceDialog(QAction* dialog_action);
62  void requestShutdown();
63 
64  private:
65  void initTrayActions();
66  void initConnections();
67  void initLibrary();
68  void initControlSplitter();
69  void initMainSplitter();
70  void initFontChangeFix();
71  void initGeometry();
72 
73  void checkControlSplitter();
74 
75  void fullscreenChanged();
76  void initControls();
77  void controlstyleChanged();
78 
79  void showLibraryChanged();
80  void addCurrentLibrary();
81  void removeCurrentLibrary();
82 
83  private slots:
84  void playstateChanged(PlayState state);
85  void playError(const QString& message);
86 
87  void splitterMainMoved(int pos, int idx);
88  void splitterControlsMoved(int pos, int idx);
89 
90  void currentLibraryChanged();
91 
92  void minimize();
93  void reallyClose();
94 
95  void trayIconActivated(QSystemTrayIcon::ActivationReason reason);
96  void currentTrackChanged(const MetaData& md);
97 
98  /* Plugins */
99  void pluginAdded(PlayerPlugin::Base* plugin);
100  void pluginActionTriggered(bool b);
101 
102  protected:
103  void closeEvent(QCloseEvent* e) override;
104  void resizeEvent(QResizeEvent* e) override;
105  bool event(QEvent* e) override;
106 
107  // Methods for other mudules to display info/warning/error
108  Message::Answer errorReceived(const QString& error, const QString& senderName = QString()) override;
109  Message::Answer warningReceived(const QString& error, const QString& senderName = QString()) override;
110  Message::Answer infoReceived(const QString& error, const QString& senderName = QString()) override;
111  Message::Answer questionReceived(const QString& info, const QString& senderName = QString(),
112  Message::QuestionType type = Message::QuestionType::YesNo) override;
113 
114  void languageChanged() override;
115 };
116 
117 #endif // GUI_SIMPLEPLAYER_H
GUI_Player
Definition: GUI_Player.h:49
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:41
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:75
Message::QuestionType
QuestionType
The GlobalMessage class.
Definition: Message.h:48