mirror of
https://github.com/dashpay/dash.git
synced 2024-12-25 12:02:48 +01:00
Make testcases build, prevent windows symbol collision
This commit is contained in:
parent
0832c0d166
commit
239c11d0dd
@ -2630,7 +2630,7 @@ void ThreadRPCServer2(void* parg)
|
||||
strWhatAmI.c_str(),
|
||||
GetConfigFile().string().c_str(),
|
||||
EncodeBase58(&rand_pwd[0],&rand_pwd[0]+32).c_str()),
|
||||
_("Error"), MF_OK | MF_MODAL);
|
||||
_("Error"), CClientUIInterface::OK | CClientUIInterface::MODAL);
|
||||
uiInterface.QueueShutdown();
|
||||
return;
|
||||
}
|
||||
@ -2651,7 +2651,7 @@ void ThreadRPCServer2(void* parg)
|
||||
catch(boost::system::system_error &e)
|
||||
{
|
||||
uiInterface.ThreadSafeMessageBox(strprintf(_("An error occured while setting up the RPC port %i for listening: %s"), endpoint.port(), e.what()),
|
||||
_("Error"), MF_OK | MF_MODAL);
|
||||
_("Error"), CClientUIInterface::OK | CClientUIInterface::MODAL);
|
||||
uiInterface.QueueShutdown();
|
||||
return;
|
||||
}
|
||||
|
55
src/init.cpp
55
src/init.cpp
@ -91,41 +91,6 @@ void HandleSIGTERM(int)
|
||||
// Start
|
||||
//
|
||||
#if !defined(QT_GUI)
|
||||
static int noui_ThreadSafeMessageBox(const std::string& message, const std::string& caption, int style)
|
||||
{
|
||||
printf("%s: %s\n", caption.c_str(), message.c_str());
|
||||
fprintf(stderr, "%s: %s\n", caption.c_str(), message.c_str());
|
||||
return 4;
|
||||
}
|
||||
|
||||
static bool noui_ThreadSafeAskFee(int64 nFeeRequired, const std::string& strCaption)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
static void noui_QueueShutdown()
|
||||
{
|
||||
// Without UI, Shutdown can simply be started in a new thread
|
||||
CreateThread(Shutdown, NULL);
|
||||
}
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
bool fRet = false;
|
||||
|
||||
// Connect bitcoind signal handlers
|
||||
uiInterface.ThreadSafeMessageBox.connect(noui_ThreadSafeMessageBox);
|
||||
uiInterface.ThreadSafeAskFee.connect(noui_ThreadSafeAskFee);
|
||||
uiInterface.QueueShutdown.connect(noui_QueueShutdown);
|
||||
|
||||
fRet = AppInit(argc, argv);
|
||||
|
||||
if (fRet && fDaemon)
|
||||
return 0;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
bool AppInit(int argc, char* argv[])
|
||||
{
|
||||
bool fRet = false;
|
||||
@ -181,17 +146,33 @@ bool AppInit(int argc, char* argv[])
|
||||
Shutdown(NULL);
|
||||
return fRet;
|
||||
}
|
||||
|
||||
extern void noui_connect();
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
bool fRet = false;
|
||||
|
||||
// Connect bitcoind signal handlers
|
||||
noui_connect();
|
||||
|
||||
fRet = AppInit(argc, argv);
|
||||
|
||||
if (fRet && fDaemon)
|
||||
return 0;
|
||||
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
bool static InitError(const std::string &str)
|
||||
{
|
||||
uiInterface.ThreadSafeMessageBox(str, _("Bitcoin"), MF_OK|MF_MODAL);
|
||||
uiInterface.ThreadSafeMessageBox(str, _("Bitcoin"), CClientUIInterface::OK | CClientUIInterface::MODAL);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool static InitWarning(const std::string &str)
|
||||
{
|
||||
uiInterface.ThreadSafeMessageBox(str, _("Bitcoin"), MF_OK | MF_ICON_EXCLAMATION | MF_MODAL);
|
||||
uiInterface.ThreadSafeMessageBox(str, _("Bitcoin"), CClientUIInterface::OK | CClientUIInterface::ICON_EXCLAMATION | CClientUIInterface::MODAL);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -10,7 +10,6 @@
|
||||
extern CWallet* pwalletMain;
|
||||
|
||||
void Shutdown(void* parg);
|
||||
bool AppInit(int argc, char* argv[]);
|
||||
bool AppInit2();
|
||||
std::string HelpMessage();
|
||||
|
||||
|
@ -1858,7 +1858,7 @@ bool CheckDiskSpace(uint64 nAdditionalBytes)
|
||||
string strMessage = _("Warning: Disk space is low");
|
||||
strMiscWarning = strMessage;
|
||||
printf("*** %s\n", strMessage.c_str());
|
||||
uiInterface.ThreadSafeMessageBox(strMessage, "Bitcoin", MF_OK | MF_ICON_EXCLAMATION | MF_MODAL);
|
||||
uiInterface.ThreadSafeMessageBox(strMessage, "Bitcoin", CClientUIInterface::OK | CClientUIInterface::ICON_EXCLAMATION | CClientUIInterface::MODAL);
|
||||
uiInterface.QueueShutdown();
|
||||
return false;
|
||||
}
|
||||
|
@ -64,7 +64,8 @@ OBJS= \
|
||||
obj/sync.o \
|
||||
obj/util.o \
|
||||
obj/wallet.o \
|
||||
obj/walletdb.o
|
||||
obj/walletdb.o \
|
||||
obj/noui.o
|
||||
|
||||
all: bitcoind.exe
|
||||
|
||||
|
@ -61,7 +61,8 @@ OBJS= \
|
||||
obj/sync.o \
|
||||
obj/util.o \
|
||||
obj/wallet.o \
|
||||
obj/walletdb.o
|
||||
obj/walletdb.o \
|
||||
obj/noui.o
|
||||
|
||||
|
||||
all: bitcoind.exe
|
||||
|
@ -88,7 +88,8 @@ OBJS= \
|
||||
obj/sync.o \
|
||||
obj/util.o \
|
||||
obj/wallet.o \
|
||||
obj/walletdb.o
|
||||
obj/walletdb.o \
|
||||
obj/noui.o
|
||||
|
||||
ifdef USE_UPNP
|
||||
DEFS += -DUSE_UPNP=$(USE_UPNP)
|
||||
|
@ -108,7 +108,8 @@ OBJS= \
|
||||
obj/sync.o \
|
||||
obj/util.o \
|
||||
obj/wallet.o \
|
||||
obj/walletdb.o
|
||||
obj/walletdb.o \
|
||||
obj/noui.o
|
||||
|
||||
|
||||
all: bitcoind
|
||||
|
35
src/noui.cpp
Normal file
35
src/noui.cpp
Normal file
@ -0,0 +1,35 @@
|
||||
// Copyright (c) 2010 Satoshi Nakamoto
|
||||
// Copyright (c) 2009-2012 The Bitcoin developers
|
||||
// Distributed under the MIT/X11 software license, see the accompanying
|
||||
// file license.txt or http://www.opensource.org/licenses/mit-license.php.
|
||||
#include "ui_interface.h"
|
||||
#include "init.h"
|
||||
#include "bitcoinrpc.h"
|
||||
|
||||
#include <string>
|
||||
|
||||
static int noui_ThreadSafeMessageBox(const std::string& message, const std::string& caption, int style)
|
||||
{
|
||||
printf("%s: %s\n", caption.c_str(), message.c_str());
|
||||
fprintf(stderr, "%s: %s\n", caption.c_str(), message.c_str());
|
||||
return 4;
|
||||
}
|
||||
|
||||
static bool noui_ThreadSafeAskFee(int64 nFeeRequired, const std::string& strCaption)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
static void noui_QueueShutdown()
|
||||
{
|
||||
// Without UI, Shutdown can simply be started in a new thread
|
||||
CreateThread(Shutdown, NULL);
|
||||
}
|
||||
|
||||
void noui_connect()
|
||||
{
|
||||
// Connect bitcoind signal handlers
|
||||
uiInterface.ThreadSafeMessageBox.connect(noui_ThreadSafeMessageBox);
|
||||
uiInterface.ThreadSafeAskFee.connect(noui_ThreadSafeAskFee);
|
||||
uiInterface.QueueShutdown.connect(noui_QueueShutdown);
|
||||
}
|
@ -42,7 +42,7 @@ static void ThreadSafeMessageBox(const std::string& message, const std::string&
|
||||
// Message from network thread
|
||||
if(guiref)
|
||||
{
|
||||
bool modal = (style & MF_MODAL);
|
||||
bool modal = (style & CClientUIInterface::MODAL);
|
||||
// in case of modal message, use blocking connection to wait for user to click OK
|
||||
QMetaObject::invokeMethod(guiref, "error",
|
||||
modal ? GUIUtil::blockingGUIThreadConnection() : Qt::QueuedConnection,
|
||||
|
@ -5,11 +5,15 @@
|
||||
#include "wallet.h"
|
||||
|
||||
CWallet* pwalletMain;
|
||||
CClientUIInterface uiInterface;
|
||||
|
||||
extern bool fPrintToConsole;
|
||||
extern void noui_connect();
|
||||
|
||||
struct TestingSetup {
|
||||
TestingSetup() {
|
||||
fPrintToConsole = true; // don't want to write to debug.log file
|
||||
noui_connect();
|
||||
pwalletMain = new CWallet();
|
||||
RegisterWallet(pwalletMain);
|
||||
}
|
||||
|
@ -13,39 +13,6 @@ class CBasicKeyStore;
|
||||
class CWallet;
|
||||
class uint256;
|
||||
|
||||
/** Flags for CClientUIInterface::ThreadSafeMessageBox */
|
||||
enum MessageBoxFlags
|
||||
{
|
||||
MF_YES = 0x00000002,
|
||||
MF_OK = 0x00000004,
|
||||
MF_NO = 0x00000008,
|
||||
MF_YES_NO = (MF_YES|MF_NO),
|
||||
MF_CANCEL = 0x00000010,
|
||||
MF_APPLY = 0x00000020,
|
||||
MF_CLOSE = 0x00000040,
|
||||
MF_OK_DEFAULT = 0x00000000,
|
||||
MF_YES_DEFAULT = 0x00000000,
|
||||
MF_NO_DEFAULT = 0x00000080,
|
||||
MF_CANCEL_DEFAULT = 0x80000000,
|
||||
MF_ICON_EXCLAMATION = 0x00000100,
|
||||
MF_ICON_HAND = 0x00000200,
|
||||
MF_ICON_WARNING = MF_ICON_EXCLAMATION,
|
||||
MF_ICON_ERROR = MF_ICON_HAND,
|
||||
MF_ICON_QUESTION = 0x00000400,
|
||||
MF_ICON_INFORMATION = 0x00000800,
|
||||
MF_ICON_STOP = MF_ICON_HAND,
|
||||
MF_ICON_ASTERISK = MF_ICON_INFORMATION,
|
||||
MF_ICON_MASK = (0x00000100|0x00000200|0x00000400|0x00000800),
|
||||
MF_FORWARD = 0x00001000,
|
||||
MF_BACKWARD = 0x00002000,
|
||||
MF_RESET = 0x00004000,
|
||||
MF_HELP = 0x00008000,
|
||||
MF_MORE = 0x00010000,
|
||||
MF_SETUP = 0x00020000,
|
||||
// Force blocking, modal message box dialog (not just OS notification)
|
||||
MF_MODAL = 0x00040000
|
||||
};
|
||||
|
||||
/** General change type (added, updated, removed). */
|
||||
enum ChangeType
|
||||
{
|
||||
@ -58,6 +25,39 @@ enum ChangeType
|
||||
class CClientUIInterface
|
||||
{
|
||||
public:
|
||||
/** Flags for CClientUIInterface::ThreadSafeMessageBox */
|
||||
enum MessageBoxFlags
|
||||
{
|
||||
YES = 0x00000002,
|
||||
OK = 0x00000004,
|
||||
NO = 0x00000008,
|
||||
YES_NO = (YES|NO),
|
||||
CANCEL = 0x00000010,
|
||||
APPLY = 0x00000020,
|
||||
CLOSE = 0x00000040,
|
||||
OK_DEFAULT = 0x00000000,
|
||||
YES_DEFAULT = 0x00000000,
|
||||
NO_DEFAULT = 0x00000080,
|
||||
CANCEL_DEFAULT = 0x80000000,
|
||||
ICON_EXCLAMATION = 0x00000100,
|
||||
ICON_HAND = 0x00000200,
|
||||
ICON_WARNING = ICON_EXCLAMATION,
|
||||
ICON_ERROR = ICON_HAND,
|
||||
ICON_QUESTION = 0x00000400,
|
||||
ICON_INFORMATION = 0x00000800,
|
||||
ICON_STOP = ICON_HAND,
|
||||
ICON_ASTERISK = ICON_INFORMATION,
|
||||
ICON_MASK = (0x00000100|0x00000200|0x00000400|0x00000800),
|
||||
FORWARD = 0x00001000,
|
||||
BACKWARD = 0x00002000,
|
||||
RESET = 0x00004000,
|
||||
HELP = 0x00008000,
|
||||
MORE = 0x00010000,
|
||||
SETUP = 0x00020000,
|
||||
// Force blocking, modal message box dialog (not just OS notification)
|
||||
MODAL = 0x00040000
|
||||
};
|
||||
|
||||
/** Show message box. */
|
||||
boost::signals2::signal<void (const std::string& message, const std::string& caption, int style)> ThreadSafeMessageBox;
|
||||
|
||||
|
@ -1000,7 +1000,7 @@ void AddTimeData(const CNetAddr& ip, int64 nTime)
|
||||
string strMessage = _("Warning: Please check that your computer's date and time are correct. If your clock is wrong Bitcoin will not work properly.");
|
||||
strMiscWarning = strMessage;
|
||||
printf("*** %s\n", strMessage.c_str());
|
||||
uiInterface.ThreadSafeMessageBox(strMessage+" ", string("Bitcoin"), MF_OK | MF_ICON_EXCLAMATION);
|
||||
uiInterface.ThreadSafeMessageBox(strMessage+" ", string("Bitcoin"), CClientUIInterface::OK | CClientUIInterface::ICON_EXCLAMATION);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user