synthclone 0.3.0
Loading...
Searching...
No Matches
util.h
Go to the documentation of this file.
1/*
2 * libsynthclone - a plugin API for `synthclone`
3 * Copyright (C) 2011 Devin Anderson
4 *
5 * This library is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU Lesser General Public License as published by the
7 * Free Software Foundation; either version 2.1 of the License, or (at your
8 * option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
13 * for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public License
16 * along with this library; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 */
19
20#ifndef __SYNTHCLONE_UTIL_H__
21#define __SYNTHCLONE_UTIL_H__
22
23#include <QtCore/QCoreApplication>
24#include <QWidget>
25
28
42
43#define CONFIRM(condition, message) \
44 if (! (condition)) { \
45 synthclone::_die(__FILE__, Q_FUNC_INFO, __LINE__, message); \
46 }
47
48namespace synthclone {
49
53
54 void
55 _die(const char *path, const char *func, int line, const QString &message);
56
70
71 template<typename T>
72 inline T *
73 getChild(const QObject *object, const QString &name=QString())
74 {
75 T *child = object->findChild<T *>(name);
76 CONFIRM(child,
77 qApp->tr("object has no child with name '%1' and base type "
78 "'%2'").arg(name, T::staticMetaObject.className()));
79 return child;
80 }
81
91
92 QString
94
104
107
117
118 QString
120
130
131 QString
133
147
148 QWidget *
149 loadForm(const QString &path, QWidget *parent=0);
150
151}
152
153#endif
Type
Contains format types supported by sample streams.
Definition samplestream.h:107
Definition component.h:26
QWidget * loadForm(const QString &path, QWidget *parent=0)
Loads the main widget from a QtDesigner form.
T * getChild(const QObject *object, const QString &name=QString())
Finds a child object of an object.
Definition util.h:73
ControlType getMIDIControlType(MIDIData control)
Gets the default MIDI control type.
quint8 MIDIData
Holds a byte of MIDI data.
Definition types.h:59
ControlType
MIDI control types.
Definition types.h:32
QString getMIDINoteString(MIDIData note)
Gets a string representation of a MIDI note.
QString getMIDIControlString(MIDIData control)
Gets a string representation of a MIDI control.
QString getSampleFilenameExtension(SampleStream::Type type)
Gets an appropriate filename extension for a sample type.
#define CONFIRM(condition, message)
Confirms that a given condition is true, regardless of whether or not NDEBUG is set.
Definition util.h:43