diff options
author | Kitsune Ral <Kitsune-Ral@users.sf.net> | 2019-01-13 11:48:06 +0900 |
---|---|---|
committer | Kitsune Ral <Kitsune-Ral@users.sf.net> | 2019-01-13 17:12:48 +0900 |
commit | a5267dbaa22581e316f440dc7327f2e7431012d5 (patch) | |
tree | dd13d8013dcd479f0610a447887c0d2e524a7ace /lib/connection.h | |
parent | 4824705ea4eddfdb5d3845a64a96a1f5e2c022d0 (diff) | |
download | libquotient-a5267dbaa22581e316f440dc7327f2e7431012d5.tar.gz libquotient-a5267dbaa22581e316f440dc7327f2e7431012d5.zip |
qt_connection_util.h: a new home for connectSingleShot() and newly made connectUntil()
Diffstat (limited to 'lib/connection.h')
-rw-r--r-- | lib/connection.h | 21 |
1 files changed, 1 insertions, 20 deletions
diff --git a/lib/connection.h b/lib/connection.h index ff3e2028..98e8dced 100644 --- a/lib/connection.h +++ b/lib/connection.h @@ -21,6 +21,7 @@ #include "csapi/create_room.h" #include "joinstate.h" #include "events/accountdataevents.h" +#include "qt_connection_util.h" #include <QtCore/QObject> #include <QtCore/QUrl> @@ -49,26 +50,6 @@ namespace QMatrixClient class SendToDeviceJob; class SendMessageJob; - /** Create a single-shot connection that triggers on the signal and - * then self-disconnects - * - * Only supports DirectConnection type. - */ - template <typename SenderT1, typename SignalT, - typename ReceiverT2, typename SlotT> - inline auto connectSingleShot(SenderT1* sender, SignalT signal, - ReceiverT2* receiver, SlotT slot) - { - QMetaObject::Connection connection; - connection = QObject::connect(sender, signal, receiver, slot, - Qt::DirectConnection); - Q_ASSERT(connection); - QObject::connect(sender, signal, receiver, - [connection] { QObject::disconnect(connection); }, - Qt::DirectConnection); - return connection; - } - class Connection; using room_factory_t = std::function<Room*(Connection*, const QString&, |