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 "Utils/Message/MessageReceiverInterface.h"
26 #include "Utils/Pimpl.h"
27 #include "GUI/Utils/GuiClass.h"
28 #include "GUI/Utils/Widgets/Widget.h"
29 
30 #include <QSystemTrayIcon>
31 
32 class GUI_TrayIcon;
33 class GUI_Logger;
34 class MetaData;
35 class PreferenceDialog;
36 
37 class QAction;
38 class QMessageBox;
39 class QTranslator;
40 
41 UI_FWD(GUI_Player)
42 
43 namespace PlayerPlugin
44 {
45  class Handler;
46  class Base;
47 }
48 
49 class GUI_Player :
50  public Gui::MainWindow,
52 {
53  Q_OBJECT
54  PIMPL(GUI_Player)
55  UI_CLASS(GUI_Player)
56 
57 signals:
58  void sig_player_closed();
59 
60 public:
61  explicit GUI_Player(QWidget *parent=nullptr);
62  ~GUI_Player();
63 
64  void register_preference_dialog(QAction* dialog_action);
65  void request_shutdown();
66 
67 private:
68  bool init_translator(const QString& four_letter, const QString& dir);
69  void init_tray_actions();
70  void init_connections();
71  void init_sizes();
72  void init_main_splitter();
73  void init_font_change_fix();
74 
75  void closeEvent(QCloseEvent* e) override;
76  void resizeEvent(QResizeEvent* e) override;
77  void moveEvent(QMoveEvent* 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(const QString& name);
107  void check_library_menu_action();
108  void splitter_painted();
109 
110  void awa_version_finished();
111 
112  void minimize();
113  void minimize_to_tray();
114  void really_close();
115 
116  void tray_icon_activated(QSystemTrayIcon::ActivationReason reason);
117  void current_track_changed(const MetaData& md);
118 
119  /* Plugins */
120  void plugin_added(PlayerPlugin::Base* plugin);
121  void plugin_opened();
122  void plugin_closed();
123  void plugin_action_triggered(bool b);
124 };
125 
126 #endif // GUI_SIMPLEPLAYER_H
Definition: PlayerPluginBase.h:40
Definition: GUI_TrayIcon.h:75
The SayonaraMainWindow class.
Definition: Widget.h:64
Definition: GUI_Player.h:49
PlayState
The PlayState enum.
Definition: PlayState.h:28
The MetaData class.
Definition: MetaData.h:48
Definition: PlayerPluginHandler.h:35
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:43