Sayonara Player
GUI_Player.h
1 /* GUI_Simpleplayer.h */
2 
3 /* Copyright (C) 2011-2017 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  bool init_translator(const QString& four_letter, const QString& dir);
67  void init_tray_actions();
68  void init_connections();
69  void init_sizes();
70  void init_main_splitter();
71  void init_font_change_fix();
72 
73  void closeEvent(QCloseEvent* e) override;
74  void resizeEvent(QResizeEvent* e) override;
75  void moveEvent(QMoveEvent* e) override;
76 
77  void language_changed() override;
78  void skin_changed() override;
79  void show_library_changed();
80  void show_library(bool is_library_visible, bool was_library_visible=false);
81  void fullscreen_changed();
82  void init_controlstyle();
83  void controlstyle_changed();
84 
85  void set_total_time_label(MilliSeconds length_ms);
86  void set_cur_pos_label(int val);
87  void set_cover_location(const MetaData& md);
88  void set_standard_cover();
89 
90  // Methods for other mudules to display info/warning/error
91  Message::Answer error_received(const QString &error, const QString &sender_name=QString()) override;
92  Message::Answer warning_received(const QString &error, const QString &sender_name=QString()) override;
93  Message::Answer info_received(const QString &error, const QString &sender_name=QString()) override;
94  Message::Answer question_received(const QString &info, const QString &sender_name=QString(), Message::QuestionType type=Message::QuestionType::YesNo) override;
95 
96 
97 private slots:
98  void playstate_changed(PlayState state);
99  void play_error(const QString& message);
100 
101  void splitter_main_moved(int pos, int idx);
102  void splitter_controls_moved(int pos, int idx);
103 
104  void current_library_changed(const QString& name);
105  void check_library_menu_action();
106  void splitter_painted();
107 
108  void awa_version_finished();
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_opened();
120  void plugin_closed();
121  void plugin_action_triggered(bool b);
122 };
123 
124 #endif // GUI_SIMPLEPLAYER_H
Definition: PlayerPluginBase.h:39
Definition: GUI_TrayIcon.h:71
The SayonaraMainWindow class.
Definition: Widget.h:64
Definition: GUI_Player.h:47
PlayState
The PlayState enum.
Definition: PlayState.h:28
The MetaData class.
Definition: MetaData.h:44
Definition: PlayerPluginHandler.h:34
Definition: GUI_Logger.h:53
The GlobalMessageReceiverInterface class implement this class in order to have the possibility to sho...
Definition: MessageReceiverInterface.h:33
Definition: PreferenceDialog.h:37
Interface for PlayerPlugin classes. get_name() and language_changed() must be overwritten.
Definition: GUI_Player.h:41