summaryrefslogtreecommitdiff
path: root/src/util/btconnect.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/util/btconnect.h')
-rw-r--r--src/util/btconnect.h34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/util/btconnect.h b/src/util/btconnect.h
new file mode 100644
index 0000000..76ceab3
--- /dev/null
+++ b/src/util/btconnect.h
@@ -0,0 +1,34 @@
+/*********
+*
+* In the name of the Father, and of the Son, and of the Holy Spirit.
+*
+* This file is part of BibleTime's source code, http://www.bibletime.info/.
+*
+* Copyright 1999-2016 by the BibleTime developers.
+* The BibleTime source code is licensed under the GNU General Public License version 2.0.
+*
+**********/
+
+#ifndef BTCONNECT_H
+#define BTCONNECT_H
+
+#include <QObject>
+#include "btassert.h"
+#include "btwrap.h"
+
+
+#ifndef NDEBUG
+#define BT_CONNECT_WITH(with, ...) \
+ do { \
+ bool const ok = with connect(__VA_ARGS__); \
+ BT_ASSERT(ok); \
+ } while (false)
+#define BT_CONNECT(...) BT_CONNECT_WITH(, BT_WRAP(__VA_ARGS__))
+#define BT_CONNECT_QOBJECT(...) BT_CONNECT_WITH(QObject::,BT_WRAP(__VA_ARGS__))
+#else
+#define BT_CONNECT_WITH(with, ...) with connect(__VA_ARGS__)
+#define BT_CONNECT(...) connect(__VA_ARGS__)
+#define BT_CONNECT_QOBJECT(...) QObject::connect(__VA_ARGS__)
+#endif
+
+#endif /* BTCONNECT_H */