hydrogen
1.2.3
ShotList.h
Go to the documentation of this file.
1
/*
2
* Hydrogen
3
* Copyright(c) 2002-2008 by Alex >Comix< Cominu [comix@users.sourceforge.net]
4
* Copyright(c) 2008-2024 The hydrogen development team [hydrogen-devel@lists.sourceforge.net]
5
*
6
* http://www.hydrogen-music.org
7
*
8
* This program is free software; you can redistribute it and/or modify
9
* it under the terms of the GNU General Public License as published by
10
* the Free Software Foundation; either version 2 of the License, or
11
* (at your option) any later version.
12
*
13
* This program is distributed in the hope that it will be useful,
14
* but WITHOUT ANY WARRANTY, without even the implied warranty of
15
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
* GNU General Public License for more details.
17
*
18
* You should have received a copy of the GNU General Public License
19
* along with this program. If not, see https://www.gnu.org/licenses
20
*
21
*/
22
23
#ifndef __SHOTLIST_H
24
#define __SHOTLIST_H
25
26
#include <QtGui>
27
#include <QtWidgets>
28
#include "
EventListener.h
"
29
48
49
class
ShotList
:
public
QObject,
public
EventListener
{
50
Q_OBJECT
51
53
static
QWidget *
findWidgetInheriting
( QObject *pObject, QString &sName );
54
56
static
QWidget *
findWidget
( QString &sName );
57
59
class
Arg
{
60
QString
m_sArg
;
61
union
{
62
int
m_n
;
63
QWidget *
m_pWidget
;
64
bool
m_b
;
65
};
66
public
:
67
Arg
( QString &sArg ) :
m_sArg
( sArg ) {}
68
69
operator
QGenericArgument() {
70
if
((
m_sArg
==
"true"
)) {
71
m_b
=
true
;
72
return
Q_ARG(
bool
,
m_b
);
73
}
else
if
((
m_sArg
==
"false"
)) {
74
m_b
=
false
;
75
return
Q_ARG(
bool
,
m_b
);
76
}
77
bool
bIsInt =
false
;
78
m_n
=
m_sArg
.toInt( &bIsInt );
79
if
( bIsInt ) {
80
return
Q_ARG(
int
,
m_n
);
81
}
else
if
((
m_pWidget
=
findWidget
(
m_sArg
) )) {
82
return
Q_ARG( QWidget *,
m_pWidget
);
83
}
else
{
84
// Last resort, treat as a QString
85
return
Q_ARG( QString,
m_sArg
);
86
}
87
}
88
};
89
90
private
:
91
QStringList
m_shots
;
92
int
m_nNextShot
;
93
94
void
shoot
( QString s );
95
96
public
:
97
ShotList
( QStringList shots );
98
ShotList
( QString sShotsFilename );
99
~ShotList
();
100
101
void
shoot
();
102
void
nextShotEvent
()
override
;
103
104
public
slots:
105
void
nextShot
(
void
);
106
107
};
108
109
110
#endif
111
112
EventListener.h
EventListener
Definition
EventListener.h:29
ShotList::Arg::m_b
bool m_b
Definition
ShotList.h:64
ShotList::Arg::m_sArg
QString m_sArg
Definition
ShotList.h:60
ShotList::Arg::m_pWidget
QWidget * m_pWidget
Definition
ShotList.h:63
ShotList::Arg::Arg
Arg(QString &sArg)
Definition
ShotList.h:67
ShotList::Arg::m_n
int m_n
Definition
ShotList.h:62
ShotList::nextShotEvent
void nextShotEvent() override
Definition
ShotList.cpp:232
ShotList::~ShotList
~ShotList()
Definition
ShotList.cpp:50
ShotList::m_shots
QStringList m_shots
Definition
ShotList.h:91
ShotList::ShotList
ShotList(QStringList shots)
Definition
ShotList.cpp:44
ShotList::shoot
void shoot()
Definition
ShotList.cpp:225
ShotList::nextShot
void nextShot(void)
Definition
ShotList.cpp:236
ShotList::m_nNextShot
int m_nNextShot
Definition
ShotList.h:92
ShotList::findWidget
static QWidget * findWidget(QString &sName)
Find a widget by name.
Definition
ShotList.cpp:69
ShotList::findWidgetInheriting
static QWidget * findWidgetInheriting(QObject *pObject, QString &sName)
Find a widget which inherits the named class.
Definition
ShotList.cpp:56
src
gui
src
ShotList.h
Generated by
1.13.2