aboutsummaryrefslogtreecommitdiff
path: root/src/qt/bitcoin.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/qt/bitcoin.cpp')
-rw-r--r--src/qt/bitcoin.cpp33
1 files changed, 12 insertions, 21 deletions
diff --git a/src/qt/bitcoin.cpp b/src/qt/bitcoin.cpp
index e5526a6c09..1b5ef28ba9 100644
--- a/src/qt/bitcoin.cpp
+++ b/src/qt/bitcoin.cpp
@@ -9,12 +9,13 @@
#include "guiconstants.h"
#include "init.h"
#include "ui_interface.h"
-#include "qtipcserver.h"
+#include "paymentserver.h"
#include <QApplication>
#include <QMessageBox>
#include <QTextCodec>
#include <QLocale>
+#include <QTimer>
#include <QTranslator>
#include <QSplashScreen>
#include <QLibraryInfo>
@@ -70,15 +71,6 @@ static bool ThreadSafeAskFee(int64 nFeeRequired)
return payFee;
}
-static void ThreadSafeHandleURI(const std::string& strURI)
-{
- if(!guiref)
- return;
-
- QMetaObject::invokeMethod(guiref, "handleURI", GUIUtil::blockingGUIThreadConnection(),
- Q_ARG(QString, QString::fromStdString(strURI)));
-}
-
static void InitMessage(const std::string &message)
{
if(splashref)
@@ -117,14 +109,6 @@ int main(int argc, char *argv[])
// Command-line options take precedence:
ParseParameters(argc, argv);
- if(GetBoolArg("-testnet")) // Separate message queue name for testnet
- strBitcoinURIQueueName = BITCOINURI_QUEUE_NAME_TESTNET;
- else
- strBitcoinURIQueueName = BITCOINURI_QUEUE_NAME_MAINNET;
-
- // Do this early as we don't want to bother initializing if we are just calling IPC
- ipcScanRelay(argc, argv);
-
// Internal string conversion is all UTF-8
QTextCodec::setCodecForTr(QTextCodec::codecForName("UTF-8"));
QTextCodec::setCodecForCStrings(QTextCodec::codecForTr());
@@ -132,6 +116,12 @@ int main(int argc, char *argv[])
Q_INIT_RESOURCE(bitcoin);
QApplication app(argc, argv);
+ // Do this early as we don't want to bother initializing if we are just calling IPC
+ // ... but do it after creating app, so QCoreApplication::arguments is initialized:
+ if (PaymentServer::ipcSendCommandLine())
+ exit(0);
+ PaymentServer* paymentServer = new PaymentServer(&app);
+
// Install global event filter that makes sure that long tooltips can be word-wrapped
app.installEventFilter(new GUIUtil::ToolTipToRichTextFilter(TOOLTIP_WRAP_THRESHOLD, &app));
@@ -188,7 +178,6 @@ int main(int argc, char *argv[])
// Subscribe to global signals from core
uiInterface.ThreadSafeMessageBox.connect(ThreadSafeMessageBox);
uiInterface.ThreadSafeAskFee.connect(ThreadSafeAskFee);
- uiInterface.ThreadSafeHandleURI.connect(ThreadSafeHandleURI);
uiInterface.InitMessage.connect(InitMessage);
uiInterface.QueueShutdown.connect(QueueShutdown);
uiInterface.Translate.connect(Translate);
@@ -249,8 +238,10 @@ int main(int argc, char *argv[])
window.show();
}
- // Place this here as guiref has to be defined if we don't want to lose URIs
- ipcInit(argc, argv);
+ // Now that initialization/startup is done, process any command-line
+ // bitcoin: URIs
+ QObject::connect(paymentServer, SIGNAL(receivedURI(QString)), &window, SLOT(handleURI(QString)));
+ QTimer::singleShot(100, paymentServer, SLOT(uiReady()));
app.exec();