aboutsummaryrefslogtreecommitdiff
path: root/src/qt/bitcoin.cpp
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2012-03-24 17:07:29 +0100
committerWladimir J. van der Laan <laanwj@gmail.com>2012-04-04 08:46:12 +0200
commit7e7bcce2d992c6fd53fdc4d9eb40f21c951d5347 (patch)
treebe52dbc136cd0e88a89dfe4487f8ee09d142bfa1 /src/qt/bitcoin.cpp
parent55f69a47002a1fc5bdf4e0c345e61ec955fa664b (diff)
Code deduplication: make function in GUIUtil to get connection type to call object slot in GUI thread
with invokeMethod.
Diffstat (limited to 'src/qt/bitcoin.cpp')
-rw-r--r--src/qt/bitcoin.cpp21
1 files changed, 3 insertions, 18 deletions
diff --git a/src/qt/bitcoin.cpp b/src/qt/bitcoin.cpp
index 738464668f..0f7c96e6a8 100644
--- a/src/qt/bitcoin.cpp
+++ b/src/qt/bitcoin.cpp
@@ -5,6 +5,7 @@
#include "clientmodel.h"
#include "walletmodel.h"
#include "optionsmodel.h"
+#include "guiutil.h"
#include "headers.h"
#include "init.h"
@@ -12,7 +13,6 @@
#include <QApplication>
#include <QMessageBox>
-#include <QThread>
#include <QTextCodec>
#include <QLocale>
#include <QTranslator>
@@ -70,15 +70,7 @@ bool ThreadSafeAskFee(int64 nFeeRequired, const std::string& strCaption, wxWindo
return true;
bool payFee = false;
- // Call slot on GUI thread.
- // If called from another thread, use a blocking QueuedConnection.
- Qt::ConnectionType connectionType = Qt::DirectConnection;
- if(QThread::currentThread() != QCoreApplication::instance()->thread())
- {
- connectionType = Qt::BlockingQueuedConnection;
- }
-
- QMetaObject::invokeMethod(guiref, "askFee", connectionType,
+ QMetaObject::invokeMethod(guiref, "askFee", GUIUtil::blockingGUIThreadConnection(),
Q_ARG(qint64, nFeeRequired),
Q_ARG(bool*, &payFee));
@@ -90,14 +82,7 @@ void ThreadSafeHandleURL(const std::string& strURL)
if(!guiref)
return;
- // Call slot on GUI thread.
- // If called from another thread, use a blocking QueuedConnection.
- Qt::ConnectionType connectionType = Qt::DirectConnection;
- if(QThread::currentThread() != QCoreApplication::instance()->thread())
- {
- connectionType = Qt::BlockingQueuedConnection;
- }
- QMetaObject::invokeMethod(guiref, "handleURL", connectionType,
+ QMetaObject::invokeMethod(guiref, "handleURL", GUIUtil::blockingGUIThreadConnection(),
Q_ARG(QString, QString::fromStdString(strURL)));
}