X-Git-Url: https://git.novaco.in/?a=blobdiff_plain;f=src%2Fqt%2Fbitcoin.cpp;h=71e2daf9318000cbf605c2fc5c85d60112b9cae3;hb=d652709abaccff37c1e5ea36a8334ad643809d23;hp=5e79f6ec98c674e8e060d8135b7d7773a57aefb5;hpb=3f8cb2c565b24635d2967c9900cf5f2aa8b1d632;p=novacoin.git diff --git a/src/qt/bitcoin.cpp b/src/qt/bitcoin.cpp index 5e79f6e..71e2daf 100644 --- a/src/qt/bitcoin.cpp +++ b/src/qt/bitcoin.cpp @@ -1,5 +1,5 @@ /* - * W.J. van der Laan 20011-2012 + * W.J. van der Laan 2011-2012 */ #include "bitcoingui.h" #include "clientmodel.h" @@ -36,12 +36,19 @@ int MyMessageBox(const std::string& message, const std::string& caption, int sty int ThreadSafeMessageBox(const std::string& message, const std::string& caption, int style, wxWindow* parent, int x, int y) { + bool modal = style & wxMODAL; + + if (modal) + while (!guiref) + sleep(1); + // Message from network thread if(guiref) { QMetaObject::invokeMethod(guiref, "error", Qt::QueuedConnection, Q_ARG(QString, QString::fromStdString(caption)), - Q_ARG(QString, QString::fromStdString(message))); + Q_ARG(QString, QString::fromStdString(message)), + Q_ARG(bool, modal)); } else { @@ -74,7 +81,7 @@ bool ThreadSafeAskFee(int64 nFeeRequired, const std::string& strCaption, wxWindo return payFee; } -void ThreadSafeHandleURL(const std::string& strURL) +void ThreadSafeHandleURI(const std::string& strURI) { if(!guiref) return; @@ -86,8 +93,8 @@ void ThreadSafeHandleURL(const std::string& strURL) { connectionType = Qt::BlockingQueuedConnection; } - QMetaObject::invokeMethod(guiref, "handleURL", connectionType, - Q_ARG(QString, QString::fromStdString(strURL))); + QMetaObject::invokeMethod(guiref, "handleURI", connectionType, + Q_ARG(QString, QString::fromStdString(strURI))); } void CalledSetStatusBar(const std::string& strText, int nField) @@ -126,15 +133,18 @@ std::string _(const char* psz) #ifndef BITCOIN_QT_TEST int main(int argc, char *argv[]) { +#if !defined(MAC_OSX) && !defined(WIN32) +// TODO: implement qtipcserver.cpp for Mac and Windows + // Do this early as we don't want to bother initializing if we are just calling IPC for (int i = 1; i < argc; i++) { if (strlen(argv[i]) > 7 && strncasecmp(argv[i], "bitcoin:", 8) == 0) { - const char *strURL = argv[i]; + const char *strURI = argv[i]; try { - boost::interprocess::message_queue mq(boost::interprocess::open_only, "BitcoinURL"); - if(mq.try_send(strURL, strlen(strURL), 0)) + boost::interprocess::message_queue mq(boost::interprocess::open_only, BITCOINURI_QUEUE_NAME); + if(mq.try_send(strURI, strlen(strURI), 0)) exit(0); else break; @@ -144,6 +154,7 @@ int main(int argc, char *argv[]) } } } +#endif // Internal string conversion is all UTF-8 QTextCodec::setCodecForTr(QTextCodec::codecForName("UTF-8")); @@ -243,23 +254,27 @@ int main(int argc, char *argv[]) window.show(); } - // Place this here as guiref has to be defined if we dont want to lose URLs + // Place this here as guiref has to be defined if we dont want to lose URIs ipcInit(); - // Check for URL in argv + +#if !defined(MAC_OSX) && !defined(WIN32) +// TODO: implement qtipcserver.cpp for Mac and Windows + + // Check for URI in argv for (int i = 1; i < argc; i++) { if (strlen(argv[i]) > 7 && strncasecmp(argv[i], "bitcoin:", 8) == 0) { - const char *strURL = argv[i]; + const char *strURI = argv[i]; try { - boost::interprocess::message_queue mq(boost::interprocess::open_only, "BitcoinURL"); - mq.try_send(strURL, strlen(strURL), 0); + boost::interprocess::message_queue mq(boost::interprocess::open_only, BITCOINURI_QUEUE_NAME); + mq.try_send(strURI, strlen(strURI), 0); } catch (boost::interprocess::interprocess_exception &ex) { } } } - +#endif app.exec(); guiref = 0;