Sayonara Player
Loading...
Searching...
No Matches
PlayerPluginBase.h
1/* PlayerPlugin.h */
2
3/* Copyright (C) 2011-2024 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 PLAYERPLUGIN_H
22#define PLAYERPLUGIN_H
23
24#include "Gui/Utils/Widgets/Widget.h"
25#include "Utils/Pimpl.h"
26
27class QAction;
28
35namespace PlayerPlugin
36{
37 class Handler;
38 class Base :
39 public Gui::Widget
40 {
41 friend class Handler;
42
43 Q_OBJECT
44
45 private:
46 PIMPL(Base)
47
48 public:
49 explicit Base(QWidget* parent = nullptr);
50 virtual ~Base() override;
51
52 signals:
59 void sigActionTriggered(bool checked);
60
66
67 void sigOpened();
68
69 private slots:
75 void actionTriggered(bool checked);
76
77 private:
78
82 void setUiInitialized();
83
87 virtual void languageChanged() final override;
88
92 virtual void initUi() = 0;
93
94 protected:
95 virtual void finalizeInitialization();
96
101 virtual bool isUiInitialized() const;
102 virtual void assignUiVariables();
103
104 virtual void retranslate() = 0;
105
106 template<typename T, typename UiClass>
107 void setupParent(T* widget, UiClass** ui)
108 {
109 if(isUiInitialized())
110 {
111 return;
112 }
113
114 *ui = new UiClass();
115 (*ui)->setupUi(widget);
116
117 assignUiVariables();
118 finalizeInitialization();
119 }
120
121 void closeEvent(QCloseEvent* e) override;
122 void showEvent(QShowEvent* e) override;
123
124 public:
125
130 virtual QAction* pluginAction() const final;
131
136 virtual QString name() const = 0;
137
142 virtual QString displayName() const = 0;
143
147 virtual bool hasTitle() const;
148
154 virtual bool hasLoadingBar() const;
155 };
156}
157
158Q_DECLARE_INTERFACE(PlayerPlugin::Base, "com.sayonara-player.playerplugin")
159
160#endif // PLAYERPLUGIN_H
Widget with Settings connection. Also contains triggers for language_changed() and skin_changed() \nT...
Definition Widget.h:39
Definition PlayerPluginBase.h:40
virtual bool hasTitle() const
indicates if title bar is shown or not
void sigActionTriggered(bool checked)
signal is emitted when the plugin action is triggered also emitted for when closeEvent is fired
virtual QAction * pluginAction() const final
needed by the player ui, final
virtual bool hasLoadingBar() const
indicates if the widget has a loading bar. If yes, there will be reserved some extra space at the bot...
virtual bool isUiInitialized() const
Check if ui already was initialized.
virtual QString displayName() const =0
must be overwritten
virtual QString name() const =0
must be overwritten
void sigReload(PlayerPlugin::Base *plugin)
emitted when reloading is requested, after firing this signal the plugin will be painted new....
Definition PlayerPluginHandler.h:35
Interface for PlayerPlugin classes. get_name() and language_changed() must be overwritten.
Definition GUI_Player.h:47