|
|
@ -20,9 +20,6 @@ |
|
|
|
#include <QSplashScreen> |
|
|
|
#include <QSplashScreen> |
|
|
|
#include <QLibraryInfo> |
|
|
|
#include <QLibraryInfo> |
|
|
|
|
|
|
|
|
|
|
|
#include <boost/interprocess/ipc/message_queue.hpp> |
|
|
|
|
|
|
|
#include <boost/algorithm/string/predicate.hpp> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#if defined(BITCOIN_NEED_QT_PLUGINS) && !defined(_BITCOIN_QT_PLUGINS_INCLUDED) |
|
|
|
#if defined(BITCOIN_NEED_QT_PLUGINS) && !defined(_BITCOIN_QT_PLUGINS_INCLUDED) |
|
|
|
#define _BITCOIN_QT_PLUGINS_INCLUDED |
|
|
|
#define _BITCOIN_QT_PLUGINS_INCLUDED |
|
|
|
#define __INSURE__ |
|
|
|
#define __INSURE__ |
|
|
@ -116,35 +113,8 @@ static void handleRunawayException(std::exception *e) |
|
|
|
#ifndef BITCOIN_QT_TEST |
|
|
|
#ifndef BITCOIN_QT_TEST |
|
|
|
int main(int argc, char *argv[]) |
|
|
|
int main(int argc, char *argv[]) |
|
|
|
{ |
|
|
|
{ |
|
|
|
// TODO: implement URI support on the Mac.
|
|
|
|
|
|
|
|
#if !defined(MAC_OSX) |
|
|
|
|
|
|
|
// Do this early as we don't want to bother initializing if we are just calling IPC
|
|
|
|
// Do this early as we don't want to bother initializing if we are just calling IPC
|
|
|
|
for (int i = 1; i < argc; i++) |
|
|
|
ipcScanRelay(argc, argv); |
|
|
|
{ |
|
|
|
|
|
|
|
if (boost::algorithm::istarts_with(argv[i], "bitcoin:")) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
const char *strURI = argv[i]; |
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
boost::interprocess::message_queue mq(boost::interprocess::open_only, BITCOINURI_QUEUE_NAME); |
|
|
|
|
|
|
|
if (mq.try_send(strURI, strlen(strURI), 0)) |
|
|
|
|
|
|
|
// if URI could be sent to the message queue exit here
|
|
|
|
|
|
|
|
exit(0); |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
// if URI could not be sent to the message queue do a normal Bitcoin-Qt startup
|
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
catch (boost::interprocess::interprocess_exception &ex) { |
|
|
|
|
|
|
|
// don't log the "file not found" exception, because that's normal for
|
|
|
|
|
|
|
|
// the first start of the first instance
|
|
|
|
|
|
|
|
if (ex.get_error_code() != boost::interprocess::not_found_error) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
printf("main() - boost interprocess exception #%d: %s\n", ex.get_error_code(), ex.what()); |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Internal string conversion is all UTF-8
|
|
|
|
// Internal string conversion is all UTF-8
|
|
|
|
QTextCodec::setCodecForTr(QTextCodec::codecForName("UTF-8")); |
|
|
|
QTextCodec::setCodecForTr(QTextCodec::codecForName("UTF-8")); |
|
|
@ -269,29 +239,10 @@ int main(int argc, char *argv[]) |
|
|
|
{ |
|
|
|
{ |
|
|
|
window.show(); |
|
|
|
window.show(); |
|
|
|
} |
|
|
|
} |
|
|
|
// TODO: implement URI support on the Mac.
|
|
|
|
|
|
|
|
#if !defined(MAC_OSX) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Place this here as guiref has to be defined if we don't want to lose URIs
|
|
|
|
// Place this here as guiref has to be defined if we don't want to lose URIs
|
|
|
|
ipcInit(); |
|
|
|
ipcInit(argc, argv); |
|
|
|
|
|
|
|
|
|
|
|
// Check for URI in argv
|
|
|
|
|
|
|
|
for (int i = 1; i < argc; i++) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if (boost::algorithm::istarts_with(argv[i], "bitcoin:")) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
const char *strURI = argv[i]; |
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
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) { |
|
|
|
|
|
|
|
printf("main() - boost interprocess exception #%d: %s\n", ex.get_error_code(), ex.what()); |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
app.exec(); |
|
|
|
app.exec(); |
|
|
|
|
|
|
|
|
|
|
|
window.hide(); |
|
|
|
window.hide(); |
|
|
|