temp patch for qtui
This commit is contained in:
parent
33c75fd9aa
commit
42c405ad23
9 changed files with 72 additions and 24 deletions
|
@ -13,7 +13,7 @@
|
||||||
#include <boost/iostreams/stream.hpp>
|
#include <boost/iostreams/stream.hpp>
|
||||||
#include <boost/algorithm/string.hpp>
|
#include <boost/algorithm/string.hpp>
|
||||||
#ifdef USE_SSL
|
#ifdef USE_SSL
|
||||||
#include <boost/asio/ssl.hpp>
|
#include <boost/asio/ssl.hpp>
|
||||||
#include <boost/filesystem.hpp>
|
#include <boost/filesystem.hpp>
|
||||||
#include <boost/filesystem/fstream.hpp>
|
#include <boost/filesystem/fstream.hpp>
|
||||||
typedef boost::asio::ssl::stream<boost::asio::ip::tcp::socket> SSLStream;
|
typedef boost::asio::ssl::stream<boost::asio::ip::tcp::socket> SSLStream;
|
||||||
|
@ -46,13 +46,13 @@ Object JSONRPCError(int code, const string& message)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void PrintConsole(const char* format, ...)
|
void PrintConsole(const std::string &format, ...)
|
||||||
{
|
{
|
||||||
char buffer[50000];
|
char buffer[50000];
|
||||||
int limit = sizeof(buffer);
|
int limit = sizeof(buffer);
|
||||||
va_list arg_ptr;
|
va_list arg_ptr;
|
||||||
va_start(arg_ptr, format);
|
va_start(arg_ptr, format);
|
||||||
int ret = _vsnprintf(buffer, limit, format, arg_ptr);
|
int ret = _vsnprintf(buffer, limit, format.c_str(), arg_ptr);
|
||||||
va_end(arg_ptr);
|
va_end(arg_ptr);
|
||||||
if (ret < 0 || ret >= limit)
|
if (ret < 0 || ret >= limit)
|
||||||
{
|
{
|
||||||
|
@ -843,7 +843,7 @@ Value sendmany(const Array& params, bool fHelp)
|
||||||
CScript scriptPubKey;
|
CScript scriptPubKey;
|
||||||
if (!scriptPubKey.SetBitcoinAddress(strAddress))
|
if (!scriptPubKey.SetBitcoinAddress(strAddress))
|
||||||
throw JSONRPCError(-5, string("Invalid bitcoin address:")+strAddress);
|
throw JSONRPCError(-5, string("Invalid bitcoin address:")+strAddress);
|
||||||
int64 nAmount = AmountFromValue(s.value_);
|
int64 nAmount = AmountFromValue(s.value_);
|
||||||
totalAmount += nAmount;
|
totalAmount += nAmount;
|
||||||
|
|
||||||
vecSend.push_back(make_pair(scriptPubKey, nAmount));
|
vecSend.push_back(make_pair(scriptPubKey, nAmount));
|
||||||
|
@ -1161,7 +1161,7 @@ Value listtransactions(const Array& params, bool fHelp)
|
||||||
}
|
}
|
||||||
// ret is now newest to oldest
|
// ret is now newest to oldest
|
||||||
}
|
}
|
||||||
|
|
||||||
// Make sure we return only last nCount items (sends-to-self might give us an extra):
|
// Make sure we return only last nCount items (sends-to-self might give us an extra):
|
||||||
if (ret.size() > nCount)
|
if (ret.size() > nCount)
|
||||||
{
|
{
|
|
@ -98,8 +98,12 @@
|
||||||
#include "uibase.h"
|
#include "uibase.h"
|
||||||
#include "ui.h"
|
#include "ui.h"
|
||||||
#else
|
#else
|
||||||
|
#ifdef QT_GUI
|
||||||
|
#include "qtui.h"
|
||||||
|
#else
|
||||||
#include "noui.h"
|
#include "noui.h"
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef GUI
|
#ifdef GUI
|
||||||
#include "xpm/addressbook16.xpm"
|
#include "xpm/addressbook16.xpm"
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
// file license.txt or http://www.opensource.org/licenses/mit-license.php.
|
// file license.txt or http://www.opensource.org/licenses/mit-license.php.
|
||||||
#include "headers.h"
|
#include "headers.h"
|
||||||
#include "db.h"
|
#include "db.h"
|
||||||
#include "rpc.h"
|
#include "bitcoinrpc.h"
|
||||||
#include "net.h"
|
#include "net.h"
|
||||||
#include "init.h"
|
#include "init.h"
|
||||||
#include "strlcpy.h"
|
#include "strlcpy.h"
|
||||||
|
@ -79,7 +79,7 @@ void HandleSIGTERM(int)
|
||||||
//
|
//
|
||||||
// Start
|
// Start
|
||||||
//
|
//
|
||||||
#ifndef GUI
|
#if !defined(QT_GUI) && !defined(GUI)
|
||||||
int main(int argc, char* argv[])
|
int main(int argc, char* argv[])
|
||||||
{
|
{
|
||||||
bool fRet = false;
|
bool fRet = false;
|
||||||
|
@ -239,10 +239,9 @@ bool AppInit2(int argc, char* argv[])
|
||||||
fServer = GetBoolArg("-server");
|
fServer = GetBoolArg("-server");
|
||||||
|
|
||||||
/* force fServer when running without GUI */
|
/* force fServer when running without GUI */
|
||||||
#ifndef GUI
|
#if !defined(QT_GUI) && !defined(GUI)
|
||||||
fServer = true;
|
fServer = true;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
fPrintToConsole = GetBoolArg("-printtoconsole");
|
fPrintToConsole = GetBoolArg("-printtoconsole");
|
||||||
fPrintToDebugger = GetBoolArg("-printtodebugger");
|
fPrintToDebugger = GetBoolArg("-printtodebugger");
|
||||||
|
|
||||||
|
@ -545,7 +544,7 @@ bool AppInit2(int argc, char* argv[])
|
||||||
SetStartOnSystemStartup(true);
|
SetStartOnSystemStartup(true);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef GUI
|
#if !defined(QT_GUI) && !defined(GUI)
|
||||||
while (1)
|
while (1)
|
||||||
Sleep(5000);
|
Sleep(5000);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
|
|
||||||
#include <deque>
|
#include <deque>
|
||||||
#include <boost/array.hpp>
|
#include <boost/array.hpp>
|
||||||
|
#include <boost/foreach.hpp>
|
||||||
#include <openssl/rand.h>
|
#include <openssl/rand.h>
|
||||||
|
|
||||||
#ifndef __WXMSW__
|
#ifndef __WXMSW__
|
||||||
|
|
48
src/qtui.h
Normal file
48
src/qtui.h
Normal file
|
@ -0,0 +1,48 @@
|
||||||
|
// 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 <string>
|
||||||
|
#include <boost/function/function0.hpp>
|
||||||
|
#include "wallet.h"
|
||||||
|
|
||||||
|
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<void> fn);
|
||||||
|
extern void MainFrameRepaint();
|
||||||
|
extern std::string _(const char* psz);
|
||||||
|
|
||||||
|
#endif
|
10
src/util.cpp
10
src/util.cpp
|
@ -263,8 +263,7 @@ int my_snprintf(char* buffer, size_t limit, const char* format, ...)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
string strprintf(const std::string &format, ...)
|
||||||
string strprintf(const char* format, ...)
|
|
||||||
{
|
{
|
||||||
char buffer[50000];
|
char buffer[50000];
|
||||||
char* p = buffer;
|
char* p = buffer;
|
||||||
|
@ -274,7 +273,7 @@ string strprintf(const char* format, ...)
|
||||||
{
|
{
|
||||||
va_list arg_ptr;
|
va_list arg_ptr;
|
||||||
va_start(arg_ptr, format);
|
va_start(arg_ptr, format);
|
||||||
ret = _vsnprintf(p, limit, format, arg_ptr);
|
ret = _vsnprintf(p, limit, format.c_str(), arg_ptr);
|
||||||
va_end(arg_ptr);
|
va_end(arg_ptr);
|
||||||
if (ret >= 0 && ret < limit)
|
if (ret >= 0 && ret < limit)
|
||||||
break;
|
break;
|
||||||
|
@ -291,14 +290,13 @@ string strprintf(const char* format, ...)
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool error(const std::string &format, ...)
|
||||||
bool error(const char* format, ...)
|
|
||||||
{
|
{
|
||||||
char buffer[50000];
|
char buffer[50000];
|
||||||
int limit = sizeof(buffer);
|
int limit = sizeof(buffer);
|
||||||
va_list arg_ptr;
|
va_list arg_ptr;
|
||||||
va_start(arg_ptr, format);
|
va_start(arg_ptr, format);
|
||||||
int ret = _vsnprintf(buffer, limit, format, arg_ptr);
|
int ret = _vsnprintf(buffer, limit, format.c_str(), arg_ptr);
|
||||||
va_end(arg_ptr);
|
va_end(arg_ptr);
|
||||||
if (ret < 0 || ret >= limit)
|
if (ret < 0 || ret >= limit)
|
||||||
{
|
{
|
||||||
|
|
10
src/util.h
10
src/util.h
|
@ -64,7 +64,7 @@ typedef unsigned long long uint64;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// This is needed because the foreach macro can't get over the comma in pair<t1, t2>
|
// This is needed because the foreach macro can't get over the comma in pair<t1, t2>
|
||||||
#define PAIRTYPE(t1, t2) pair<t1, t2>
|
#define PAIRTYPE(t1, t2) std::pair<t1, t2>
|
||||||
|
|
||||||
// Used to bypass the rule against non-const reference to temporary
|
// Used to bypass the rule against non-const reference to temporary
|
||||||
// where it makes sense with wrappers such as CFlatData or CTxDB
|
// where it makes sense with wrappers such as CFlatData or CTxDB
|
||||||
|
@ -139,8 +139,7 @@ inline int myclosesocket(SOCKET& hSocket)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
#define closesocket(s) myclosesocket(s)
|
#define closesocket(s) myclosesocket(s)
|
||||||
|
#if !defined(QT_GUI) && !defined(GUI)
|
||||||
#ifndef GUI
|
|
||||||
inline const char* _(const char* psz)
|
inline const char* _(const char* psz)
|
||||||
{
|
{
|
||||||
return psz;
|
return psz;
|
||||||
|
@ -155,7 +154,6 @@ inline const char* _(const char* psz)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
extern std::map<std::string, std::string> mapArgs;
|
extern std::map<std::string, std::string> mapArgs;
|
||||||
extern std::map<std::string, std::vector<std::string> > mapMultiArgs;
|
extern std::map<std::string, std::vector<std::string> > mapMultiArgs;
|
||||||
extern bool fDebug;
|
extern bool fDebug;
|
||||||
|
@ -176,8 +174,8 @@ void RandAddSeed();
|
||||||
void RandAddSeedPerfmon();
|
void RandAddSeedPerfmon();
|
||||||
int OutputDebugStringF(const char* pszFormat, ...);
|
int OutputDebugStringF(const char* pszFormat, ...);
|
||||||
int my_snprintf(char* buffer, size_t limit, const char* format, ...);
|
int my_snprintf(char* buffer, size_t limit, const char* format, ...);
|
||||||
std::string strprintf(const char* format, ...);
|
std::string strprintf(const std::string &format, ...);
|
||||||
bool error(const char* format, ...);
|
bool error(const std::string &format, ...);
|
||||||
void LogException(std::exception* pex, const char* pszThread);
|
void LogException(std::exception* pex, const char* pszThread);
|
||||||
void PrintException(std::exception* pex, const char* pszThread);
|
void PrintException(std::exception* pex, const char* pszThread);
|
||||||
void PrintExceptionContinue(std::exception* pex, const char* pszThread);
|
void PrintExceptionContinue(std::exception* pex, const char* pszThread);
|
||||||
|
|
|
@ -91,7 +91,7 @@ bool CWallet::AddToWallet(const CWalletTx& wtxIn)
|
||||||
if (fInsertedNew || fUpdated)
|
if (fInsertedNew || fUpdated)
|
||||||
if (!wtx.WriteToDisk())
|
if (!wtx.WriteToDisk())
|
||||||
return false;
|
return false;
|
||||||
|
#ifndef QT_GUI
|
||||||
// If default receiving address gets used, replace it with a new one
|
// If default receiving address gets used, replace it with a new one
|
||||||
CScript scriptDefaultKey;
|
CScript scriptDefaultKey;
|
||||||
scriptDefaultKey.SetBitcoinAddress(vchDefaultKey);
|
scriptDefaultKey.SetBitcoinAddress(vchDefaultKey);
|
||||||
|
@ -100,7 +100,7 @@ bool CWallet::AddToWallet(const CWalletTx& wtxIn)
|
||||||
if (txout.scriptPubKey == scriptDefaultKey)
|
if (txout.scriptPubKey == scriptDefaultKey)
|
||||||
SetDefaultKey(GetKeyFromKeyPool());
|
SetDefaultKey(GetKeyFromKeyPool());
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
// Notify UI
|
// Notify UI
|
||||||
vWalletUpdated.push_back(hash);
|
vWalletUpdated.push_back(hash);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue