From 47c6215c223ac85eeb31504aa2a56369bdfb3789 Mon Sep 17 00:00:00 2001 From: "Wladimir J. van der Laan" Date: Wed, 22 Jun 2011 20:11:12 +0200 Subject: use #ifdef QT_UI to distinguish Qt UI instead of hardcoded #if 0 --- bitcoin-qt.pro | 3 ++- src/externui.h | 46 ---------------------------------------------- src/headers.h | 6 +++++- src/init.cpp | 12 +++--------- src/qtui.h | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 56 insertions(+), 57 deletions(-) delete mode 100644 src/externui.h create mode 100644 src/qtui.h diff --git a/bitcoin-qt.pro b/bitcoin-qt.pro index 501695bd05..7e918f144f 100644 --- a/bitcoin-qt.pro +++ b/bitcoin-qt.pro @@ -2,6 +2,7 @@ TEMPLATE = app TARGET = DEPENDPATH += . INCLUDEPATH += src src/json src/cryptopp src/qt +DEFINES += QT_GUI # for boost 1.37, add -mt to the boost libraries unix:LIBS += -lssl -lcrypto -lboost_system -lboost_filesystem -lboost_program_options -lboost_thread -ldb_cxx @@ -66,7 +67,7 @@ HEADERS += src/qt/bitcoingui.h \ src/qt/guiconstants.h \ src/qt/optionsmodel.h \ src/qt/monitoreddatamapper.h \ - src/externui.h \ + src/qtui.h \ src/qt/transactiondesc.h \ src/qt/transactiondescdialog.h \ src/qt/bitcoinamountfield.h diff --git a/src/externui.h b/src/externui.h deleted file mode 100644 index 3243164c10..0000000000 --- a/src/externui.h +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright (c) 2010 Satoshi Nakamoto -// Distributed under the MIT/X11 software license, see the accompanying -// file license.txt or http://www.opensource.org/licenses/mit-license.php. -#ifndef BITCOIN_EXTERNUI_H -#define BITCOIN_EXTERNUI_H - -#include - -typedef void wxWindow; -#define wxYES 0x00000002 -#define wxOK 0x00000004 -#define wxNO 0x00000008 -#define wxYES_NO (wxYES|wxNO) -#define wxCANCEL 0x00000010 -#define wxAPPLY 0x00000020 -#define wxCLOSE 0x00000040 -#define wxOK_DEFAULT 0x00000000 -#define wxYES_DEFAULT 0x00000000 -#define wxNO_DEFAULT 0x00000080 -#define wxCANCEL_DEFAULT 0x80000000 -#define wxICON_EXCLAMATION 0x00000100 -#define wxICON_HAND 0x00000200 -#define wxICON_WARNING wxICON_EXCLAMATION -#define wxICON_ERROR wxICON_HAND -#define wxICON_QUESTION 0x00000400 -#define wxICON_INFORMATION 0x00000800 -#define wxICON_STOP wxICON_HAND -#define wxICON_ASTERISK wxICON_INFORMATION -#define wxICON_MASK (0x00000100|0x00000200|0x00000400|0x00000800) -#define wxFORWARD 0x00001000 -#define wxBACKWARD 0x00002000 -#define wxRESET 0x00004000 -#define wxHELP 0x00008000 -#define wxMORE 0x00010000 -#define wxSETUP 0x00020000 - -extern int MyMessageBox(const std::string& message, const std::string& caption="Message", int style=wxOK, wxWindow* parent=NULL, int x=-1, int y=-1); -#define wxMessageBox MyMessageBox -extern int ThreadSafeMessageBox(const std::string& message, const std::string& caption, int style=wxOK, wxWindow* parent=NULL, int x=-1, int y=-1); -extern bool ThreadSafeAskFee(int64 nFeeRequired, const std::string& strCaption, wxWindow* parent); -extern void CalledSetStatusBar(const std::string& strText, int nField); -extern void UIThreadCall(boost::function0 fn); -extern void MainFrameRepaint(); -extern std::string _(const char* psz); - -#endif diff --git a/src/headers.h b/src/headers.h index f682f746ed..38d9566baa 100644 --- a/src/headers.h +++ b/src/headers.h @@ -100,7 +100,11 @@ #include "uibase.h" #include "ui.h" #else -#include "externui.h" +#ifdef QT_GUI +#include "qtui.h" +#else +#include "noui.h" +#endif #endif #ifdef GUI diff --git a/src/init.cpp b/src/init.cpp index f306185317..cbd9fc0219 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -75,8 +75,7 @@ void HandleSIGTERM(int) // // Start // -#if 0 -#ifndef GUI +#if !defined(QT_GUI) && !defined(GUI) int main(int argc, char* argv[]) { bool fRet = false; @@ -88,7 +87,6 @@ int main(int argc, char* argv[]) return 1; } #endif -#endif bool AppInit(int argc, char* argv[]) { @@ -228,10 +226,8 @@ bool AppInit2(int argc, char* argv[]) fServer = GetBoolArg("-server"); /* force fServer when running without GUI */ -#if 0 -#ifndef GUI +#if !defined(QT_GUI) && !defined(GUI) fServer = true; -#endif #endif fPrintToConsole = GetBoolArg("-printtoconsole"); fPrintToDebugger = GetBoolArg("-printtodebugger"); @@ -529,11 +525,9 @@ bool AppInit2(int argc, char* argv[]) SetStartOnSystemStartup(true); #endif -#if 0 -#ifndef GUI +#if !defined(QT_GUI) && !defined(GUI) while (1) Sleep(5000); -#endif #endif return true; diff --git a/src/qtui.h b/src/qtui.h new file mode 100644 index 0000000000..3243164c10 --- /dev/null +++ b/src/qtui.h @@ -0,0 +1,46 @@ +// Copyright (c) 2010 Satoshi Nakamoto +// Distributed under the MIT/X11 software license, see the accompanying +// file license.txt or http://www.opensource.org/licenses/mit-license.php. +#ifndef BITCOIN_EXTERNUI_H +#define BITCOIN_EXTERNUI_H + +#include + +typedef void wxWindow; +#define wxYES 0x00000002 +#define wxOK 0x00000004 +#define wxNO 0x00000008 +#define wxYES_NO (wxYES|wxNO) +#define wxCANCEL 0x00000010 +#define wxAPPLY 0x00000020 +#define wxCLOSE 0x00000040 +#define wxOK_DEFAULT 0x00000000 +#define wxYES_DEFAULT 0x00000000 +#define wxNO_DEFAULT 0x00000080 +#define wxCANCEL_DEFAULT 0x80000000 +#define wxICON_EXCLAMATION 0x00000100 +#define wxICON_HAND 0x00000200 +#define wxICON_WARNING wxICON_EXCLAMATION +#define wxICON_ERROR wxICON_HAND +#define wxICON_QUESTION 0x00000400 +#define wxICON_INFORMATION 0x00000800 +#define wxICON_STOP wxICON_HAND +#define wxICON_ASTERISK wxICON_INFORMATION +#define wxICON_MASK (0x00000100|0x00000200|0x00000400|0x00000800) +#define wxFORWARD 0x00001000 +#define wxBACKWARD 0x00002000 +#define wxRESET 0x00004000 +#define wxHELP 0x00008000 +#define wxMORE 0x00010000 +#define wxSETUP 0x00020000 + +extern int MyMessageBox(const std::string& message, const std::string& caption="Message", int style=wxOK, wxWindow* parent=NULL, int x=-1, int y=-1); +#define wxMessageBox MyMessageBox +extern int ThreadSafeMessageBox(const std::string& message, const std::string& caption, int style=wxOK, wxWindow* parent=NULL, int x=-1, int y=-1); +extern bool ThreadSafeAskFee(int64 nFeeRequired, const std::string& strCaption, wxWindow* parent); +extern void CalledSetStatusBar(const std::string& strText, int nField); +extern void UIThreadCall(boost::function0 fn); +extern void MainFrameRepaint(); +extern std::string _(const char* psz); + +#endif -- cgit v1.2.3