hydrogen 1.2.6
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-2025 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 <core/config.h>
27
28#include <QtGui>
29#include <QtWidgets>
30#include "EventListener.h"
31
32#ifndef H2CORE_HAVE_QT6
33
52
53class ShotList : public QObject, public EventListener {
54 Q_OBJECT
55
57 static QWidget *findWidgetInheriting( QObject *pObject, const QString &sName );
58
60 static QWidget *findWidget( QString &sName );
61
63 class Arg {
64 QString m_sArg;
65 union {
66 int m_n;
67 QWidget *m_pWidget;
68 bool m_b;
69 };
70 public:
71 Arg( QString &sArg ) : m_sArg( sArg ) {}
72
73 operator QGenericArgument() {
74 if (( m_sArg == "true" )) {
75 m_b = true;
76 return Q_ARG( bool, m_b );
77 } else if (( m_sArg == "false" )) {
78 m_b = false;
79 return Q_ARG( bool, m_b );
80 }
81 bool bIsInt = false;
82 m_n = m_sArg.toInt( &bIsInt );
83 if ( bIsInt ) {
84 return Q_ARG( int, m_n );
85 } else if (( m_pWidget = findWidget( m_sArg ) )) {
86 return Q_ARG( QWidget *, m_pWidget );
87 } else {
88 // Last resort, treat as a QString
89 return Q_ARG( QString, m_sArg );
90 }
91 }
92 };
93
94private:
95 QStringList m_shots;
97
98 void shoot( QString s );
99
100public:
101 ShotList( QStringList shots );
102 ShotList( QString sShotsFilename );
103 ~ShotList();
104
105 void shoot();
106 void nextShotEvent() override;
107
108public slots:
109 void nextShot( void );
110
111};
112
113#else // H2CORE_HAVE_QT6
114class ShotList : public QObject, public EventListener {
115 Q_OBJECT
116public:
117 ShotList( QStringList shots ){};
118 ShotList( QString sShotsFilename ){};
119 ~ShotList(){};
120
121 void shoot() {};
122};
123
124#endif // H2CORE_HAVE_QT6
125
126#endif
127
128
QString m_sArg
Definition ShotList.h:64
QWidget * m_pWidget
Definition ShotList.h:67
Arg(QString &sArg)
Definition ShotList.h:71
Shot List.
Definition ShotList.h:53
void nextShotEvent() override
Definition ShotList.cpp:243
static QWidget * findWidgetInheriting(QObject *pObject, const QString &sName)
Find a widget which inherits the named class.
Definition ShotList.cpp:60
QStringList m_shots
Definition ShotList.h:95
ShotList(QStringList shots)
Definition ShotList.cpp:48
void shoot()
Definition ShotList.cpp:236
void nextShot(void)
Definition ShotList.cpp:247
int m_nNextShot
Definition ShotList.h:96
static QWidget * findWidget(QString &sName)
Find a widget by name.
Definition ShotList.cpp:74