Sayonara Player
GUI_Player.h
1 /* GUI_Simpleplayer.h */
2 
3 /* Copyright (C) 2011-2019 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 sig_player_closed();
57 
58 public:
59  explicit GUI_Player(QWidget *parent=nullptr);
60  ~GUI_Player();
61 
62  void register_preference_dialog(QAction* dialog_action);
63  void request_shutdown();
64 
65 private:
66  void init_tray_actions();
67  void init_connections();
68  void init_sizes();
69  void init_main_splitter();
70  void init_font_change_fix();
71  void check_control_splitter(bool force);
72 
73  void closeEvent(QCloseEvent* e) override;
74  void resizeEvent(QResizeEvent* e) override;
75  void moveEvent(QMoveEvent* e) override;
76  void keyPressEvent(QKeyEvent* e) override;
77  void keyReleaseEvent(QKeyEvent *e) override;
78 
79  void language_changed() override;
80  void skin_changed() override;
81  void show_library_changed();
82  void show_library(bool is_library_visible, bool was_library_visible=false);
83  void fullscreen_changed();
84  void init_controlstyle();
85  void controlstyle_changed();
86 
87  void set_total_time_label(MilliSeconds length_ms);
88  void set_cur_pos_label(int val);
89  void set_cover_location(const MetaData& md);
90  void set_standard_cover();
91 
92  // Methods for other mudules to display info/warning/error
93  Message::Answer error_received(const QString &error, const QString &sender_name=QString()) override;
94  Message::Answer warning_received(const QString &error, const QString &sender_name=QString()) override;
95  Message::Answer info_received(const QString &error, const QString &sender_name=QString()) override;
96  Message::Answer question_received(const QString &info, const QString &sender_name=QString(), Message::QuestionType type=Message::QuestionType::YesNo) override;
97 
98 
99 private slots:
100  void playstate_changed(PlayState state);
101  void play_error(const QString& message);
102 
103  void splitter_main_moved(int pos, int idx);
104  void splitter_controls_moved(int pos, int idx);
105 
106  void current_library_changed();
107  void check_library_menu_action();
108  void splitter_painted();
109 
110  void minimize();
111  void minimize_to_tray();
112  void really_close();
113 
114  void tray_icon_activated(QSystemTrayIcon::ActivationReason reason);
115  void current_track_changed(const MetaData& md);
116 
117  /* Plugins */
118  void plugin_added(PlayerPlugin::Base* plugin);
119  void plugin_action_triggered(bool b);
120 };
121 
122 #endif // GUI_SIMPLEPLAYER_H
GUI_Player
Definition: GUI_Player.h:47
Message::Answer
Answer
The GlobalMessage class.
Definition: Message.h:34
PlayState
PlayState
The PlayState enum.
Definition: PlayState.h:28
PlayerPlugin::Base
Definition: PlayerPluginBase.h:38
PlayerPlugin::Handler
Definition: PlayerPluginHandler.h:33
GUI_Logger
Definition: GUI_Logger.h:54
Gui::MainWindow
The SayonaraMainWindow class.
Definition: Widget.h:63
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:44
MessageReceiverInterface
The GlobalMessageReceiverInterface class implement this class in order to have the possibility to sho...
Definition: MessageReceiverInterface.h:33
GUI_TrayIcon
Definition: GUI_TrayIcon.h:71
Message::QuestionType
QuestionType
The GlobalMessage class.
Definition: Message.h:47