2 * W.J. van der Laan 2011
4 #include "bitcoingui.h"
5 #include "clientmodel.h"
11 #include <QApplication>
12 #include <QMessageBox>
15 // Need a global reference for the notifications to find the GUI
18 int MyMessageBox(const std::string& message, const std::string& caption, int style, wxWindow* parent, int x, int y)
20 // Message from main thread
23 guiref->error(QString::fromStdString(caption),
24 QString::fromStdString(message));
28 QMessageBox::critical(0, QString::fromStdString(caption),
29 QString::fromStdString(message),
30 QMessageBox::Ok, QMessageBox::Ok);
35 int ThreadSafeMessageBox(const std::string& message, const std::string& caption, int style, wxWindow* parent, int x, int y)
37 // Message from network thread
40 QMetaObject::invokeMethod(guiref, "error", Qt::QueuedConnection,
41 Q_ARG(QString, QString::fromStdString(caption)),
42 Q_ARG(QString, QString::fromStdString(message)));
46 printf("%s: %s\n", caption.c_str(), message.c_str());
47 fprintf(stderr, "%s: %s\n", caption.c_str(), message.c_str());
52 bool ThreadSafeAskFee(int64 nFeeRequired, const std::string& strCaption, wxWindow* parent)
56 if(nFeeRequired < MIN_TX_FEE || nFeeRequired <= nTransactionFee || fDaemon)
60 /* Call slot on GUI thread.
61 If called from another thread, use a blocking QueuedConnection.
63 Qt::ConnectionType connectionType = Qt::DirectConnection;
64 if(QThread::currentThread() != QCoreApplication::instance()->thread())
66 connectionType = Qt::BlockingQueuedConnection;
69 QMetaObject::invokeMethod(guiref, "askFee", connectionType,
70 Q_ARG(qint64, nFeeRequired),
71 Q_ARG(bool*, &payFee));
76 void CalledSetStatusBar(const std::string& strText, int nField)
78 // Only used for built-in mining, which is disabled, simple ignore
81 void UIThreadCall(boost::function0<void> fn)
83 // Only used for built-in mining, which is disabled, simple ignore
86 void MainFrameRepaint()
91 Translate string to current locale using Qt.
93 std::string _(const char* psz)
95 return QCoreApplication::translate("bitcoin-core", psz).toStdString();
98 int main(int argc, char *argv[])
100 QApplication app(argc, argv);
101 app.setQuitOnLastWindowClosed(false);
105 if(AppInit2(argc, argv))
110 window.setModel(&model);
114 int retval = app.exec();
125 } catch (std::exception& e) {
126 PrintException(&e, "Runaway exception");
128 PrintException(NULL, "Runaway exception");