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 "GUI/Player/ui_GUI_Player.h"
25 
26 #include "Components/PlayManager/PlayState.h"
27 
28 #include "Utils/Message/GlobalMessageReceiverInterface.h"
29 #include "GUI/Utils/Widgets/Widget.h"
30 
31 #include <QSystemTrayIcon>
32 
33 class GUI_TrayIcon;
34 class MetaData;
35 class PreferenceDialog;
36 class QTranslator;
37 class QMessageBox;
38 class GUI_Logger;
39 
40 namespace PlayerPlugin
41 {
42  class Base;
43  class Handler;
44 }
45 
46 class GUI_Player :
47  public Gui::MainWindow,
49  private Ui::Sayonara
50 {
51  Q_OBJECT
52  PIMPL(GUI_Player)
53 
54 signals:
55  void sig_player_closed();
56 
57 public:
58  explicit GUI_Player(QTranslator* translator, QWidget *parent=nullptr);
59  ~GUI_Player();
60 
61  void register_player_plugin_handler(PlayerPlugin::Handler* pph);
62  void register_preference_dialog(PreferenceDialog* dialog);
63 
64 
65 private:
66  void init_tray_actions ();
67  void init_connections();
68  void init_sizes();
69  void init_splitter();
70 
71  void closeEvent(QCloseEvent* e) override;
72  void resizeEvent(QResizeEvent* e) override;
73  void moveEvent(QMoveEvent* e) override;
74 
75  void language_changed() override;
76  void skin_changed() override;
77  void show_library_changed();
78  void fullscreen_changed();
79 
80  void set_total_time_label(int64_t length_ms);
81  void set_cur_pos_label(int val);
82  void set_cover_location(const MetaData& md);
83  void set_standard_cover();
84 
85  // Methods for other mudules to display info/warning/error
86  GlobalMessage::Answer error_received(const QString &error, const QString &sender_name=QString()) override;
87  GlobalMessage::Answer warning_received(const QString &error, const QString &sender_name=QString()) override;
88  GlobalMessage::Answer info_received(const QString &error, const QString &sender_name=QString()) override;
89  GlobalMessage::Answer question_received(const QString &info, const QString &sender_name=QString(), GlobalMessage::QuestionType type=GlobalMessage::QuestionType::YesNo) override;
90 
91 
92 private slots:
93  void playstate_changed(PlayState state);
94  void play_error(const QString& message);
95 
96  void main_splitter_moved(int pos, int idx);
97 
98  void current_library_changed(const QString& name);
99  void check_library_menu_action();
100 
101  void awa_version_finished();
102 
103  void minimize();
104  void really_close();
105 
106  void tray_icon_activated(QSystemTrayIcon::ActivationReason reason);
107 
108  /* Plugins */
109  void plugin_opened();
110  void plugin_closed();
111  void plugin_action_triggered(bool b);
112 };
113 
114 #endif // GUI_SIMPLEPLAYER_H
Definition: PlayerPlugin.h:40
Definition: GUI_TrayIcon.h:41
The SayonaraMainWindow class.
Definition: Widget.h:64
Definition: GUI_Player.h:46
Definition: ui_GUI_Player.h:206
PlayState
The PlayState enum.
Definition: PlayState.h:28
The MetaData class.
Definition: MetaData.h:48
Definition: PlayerPluginHandler.h:34
Definition: GUI_Logger.h:53
Definition: PreferenceDialog.h:37
Interface for PlayerPlugin classes. get_name() and language_changed() must be overwritten.
Definition: GUI_Player.h:40
The GlobalMessageReceiverInterface class implement this class in order to have the possibility to sho...
Definition: GlobalMessageReceiverInterface.h:33