Sayonara Player
src
Gui
Utils
Widgets
WidgetTemplate.h
1
/* WidgetTemplate.h */
2
3
/* Copyright (C) 2011-2020 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 SAYONARAWIDGETTEMPLATE_H
22
#define SAYONARAWIDGETTEMPLATE_H
23
24
#include "Gui/Utils/GuiClass.h"
25
26
#include <QShowEvent>
27
#include <QObject>
28
#include <QVariant>
29
30
class
QWidget;
31
32
#define combo_current_index_changed_int static_cast<void (QComboBox::*) (int)>(&QComboBox::currentIndexChanged)
33
#define combo_activated_int static_cast<void (QComboBox::*) (int)>(&QComboBox::activated)
34
#define spinbox_value_changed_int static_cast<void (QSpinBox::*) (int)>(&QSpinBox::valueChanged)
35
36
namespace
Gui
37
{
38
class
WidgetTemplateParent;
39
44
class
AbstrWidgetTemplate
:
45
public
QObject
46
{
47
Q_OBJECT
48
49
private
:
50
WidgetTemplateParent
* mWtp=
nullptr
;
51
52
public
:
53
AbstrWidgetTemplate
(QObject* parent,
WidgetTemplateParent
* wtp);
54
virtual
~
AbstrWidgetTemplate
()
override
;
55
56
protected
:
57
virtual
void
languageChanged();
58
virtual
void
skinChanged();
59
};
60
61
66
class
WidgetTemplateParent
67
{
68
friend
class
AbstrWidgetTemplate
;
69
70
public
:
71
WidgetTemplateParent
();
72
virtual
~
WidgetTemplateParent
();
73
74
protected
:
75
virtual
void
languageChanged();
76
virtual
void
skinChanged();
77
};
78
79
template
<
typename
T>
84
class
WidgetTemplate
:
85
public
T,
86
protected
WidgetTemplateParent
87
{
88
friend
class
AbstrWidgetTemplate
;
89
90
private
:
91
AbstrWidgetTemplate
* mAwt=
nullptr
;
92
93
public
:
94
template
<
typename
... Args>
95
WidgetTemplate
(Args&&... args) :
96
T(std::forward<Args>(args)...),
97
WidgetTemplateParent
()
98
{
99
mAwt =
new
AbstrWidgetTemplate
(
this
,
this
);
100
}
101
102
virtual
~
WidgetTemplate
() =
default
;
103
104
virtual
void
showEvent(QShowEvent* e)
override
105
{
106
languageChanged();
107
skinChanged();
108
109
T::showEvent(e);
110
}
111
};
112
}
113
114
#endif // SAYONARAWIDGETTEMPLATE_H
Gui::WidgetTemplateParent
The WidgetTemplateParent class.
Definition:
WidgetTemplate.h:67
Gui::WidgetTemplate
Template for Sayonara Widgets. This template is responsible for holding a reference to the settings.
Definition:
WidgetTemplate.h:87
Gui::AbstrWidgetTemplate
The AbstrWidgetTemplate class.
Definition:
WidgetTemplate.h:46
Generated on Wed Jan 6 2021 00:00:00 for Sayonara Player by
1.8.20