Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 37 additions & 3 deletions billioncoin-qt.pro
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
TEMPLATE = app
TARGET =
TARGET = BillionCoin-Qt
VERSION = 0.6.3
INCLUDEPATH += src src/json src/qt
DEFINES += QT_GUI BOOST_THREAD_USE_LIB BOOST_SPIRIT_THREADSAFE BOOST_THREAD_PROVIDES_GENERIC_SHARED_MUTEX_ON_WIN __NO_SYSTEM_INCLUDES
CONFIG += no_include_pwd
CONFIG += thread
QT += webkit
QT += widgets
QT += webkitwidgets

windows:LIBS += -lshlwapi
LIBS += $$join(BOOST_LIB_PATH,,-L,) $$join(BDB_LIB_PATH,,-L,) $$join(OPENSSL_LIB_PATH,,-L,) $$join(QRENCODE_LIB_PATH,,-L,)
Expand All @@ -26,6 +29,23 @@ OPENSSL_LIB_PATH=C:\deps\openssl-1.0.1e
MINIUPNPC_LIB_PATH=C:\deps\miniupnpc-1.8
MINIUPNPC_INCLUDE_PATH=C:\deps\miniupnpc-1.8

macx {
LIBS += -lboost_system -lboost_filesystem -lboost_program_options -lboost_thread

BOOST_LIB_SUFFIX =-mt
BOOST_THREAD_LIB_SUFFIX =-mt
BOOST_INCLUDE_PATH=/opt/local/include
BOOST_LIB_PATH=/opt/local/lib
BDB_INCLUDE_PATH=/opt/local/include/db48
BDB_LIB_PATH=/opt/local/lib/db48
BDB_LIB_SUFFIX = -4.8
OPENSSL_INCLUDE_PATH=/usr/include/openssl
OPENSSL_LIB_PATH=/usr/lib
MINIUPNPC_LIB_PATH=/opt/local/include/miniupnpc
MINIUPNPC_INCLUDE_PATH=/opt/local/lib
USE_QRCODE=1
}

OBJECTS_DIR = build
MOC_DIR = build
UI_DIR = build
Expand Down Expand Up @@ -301,7 +321,10 @@ QMAKE_EXTRA_COMPILERS += TSQM
# "Other files" to show in Qt Creator
OTHER_FILES += \
contrib/gitian-descriptors/* doc/*.rst doc/*.txt doc/README README.md res/bitcoin-qt.rc \
share/setup.nsi
share/setup.nsi \
src/qt/res/makedmg.sh \
src/qt/res/setdmg.scpt \
src/qt/res/images/dmg_bg.png

# platform specific defaults, if not overridden on command line
isEmpty(BOOST_LIB_SUFFIX) {
Expand Down Expand Up @@ -358,7 +381,7 @@ macx:OBJECTIVE_SOURCES += src/qt/macdockiconhandler.mm
macx:LIBS += -framework Foundation -framework ApplicationServices -framework AppKit
macx:DEFINES += MAC_OSX MSG_NOSIGNAL=0
macx:ICON = src/qt/res/icons/bitcoin.icns
macx:TARGET = "billioncoin-qt"
macx:TARGET = "BillionCoin-Qt"

# Set libraries and includes at end, to use platform-defined defaults if not overridden
INCLUDEPATH += $$BOOST_INCLUDE_PATH $$BDB_INCLUDE_PATH $$OPENSSL_INCLUDE_PATH $$QRENCODE_INCLUDE_PATH
Expand All @@ -377,4 +400,15 @@ contains(RELEASE, 1) {

system($$QMAKE_LRELEASE -silent $$_PRO_FILE_)

mac {
LIBS += -ldb_cxx$$BDB_LIB_SUFFIX

# Bundle OSX dependencies
QMAKE_POST_LINK += macdeployqt "$$OUT_PWD/BillionCoin-Qt.app";
QMAKE_POST_LINK += cp /opt/local/lib/db48/libdb_cxx-4.8.dylib "$$OUT_PWD/BillionCoin-Qt.app/Contents/Frameworks/libdb_cxx-4.8.dylib";
QMAKE_POST_LINK += install_name_tool -change /opt/local/lib/db48/libdb_cxx-4.8.dylib @executable_path/../Frameworks/libdb_cxx-4.8.dylib "$$OUT_PWD/BillionCoin-Qt.app/Contents/MacOS/BillionCoin-Qt";
QMAKE_POST_LINK += install_name_tool -id @executable_path/../Frameworks/libdb_cxx-4.8.dylib "$$OUT_PWD/BillionCoin-Qt.app/Contents/Frameworks/libdb_cxx-4.8.dylib";

# Create DMG file
QMAKE_POST_LINK += $$PWD/src/qt/res/makedmg.sh "$$PWD" "$$OUT_PWD"
}
4 changes: 2 additions & 2 deletions src/bitcoinrpc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2500,7 +2500,7 @@ int ReadHTTPStatus(std::basic_istream<char>& stream, int &proto)
int ReadHTTPHeader(std::basic_istream<char>& stream, map<string, string>& mapHeadersRet)
{
int nLen = 0;
loop
forloop
{
string str;
std::getline(stream, str);
Expand Down Expand Up @@ -3039,7 +3039,7 @@ void ThreadRPCServer3(void* parg)
AcceptedConnection *conn = (AcceptedConnection *) parg;

bool fRun = true;
loop {
forloop {
if (fShutdown || !fRun)
{
conn->close();
Expand Down
2 changes: 1 addition & 1 deletion src/db.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -657,7 +657,7 @@ bool CTxDB::LoadBlockIndexGuts()

// Load mapBlockIndex
unsigned int fFlags = DB_SET_RANGE;
loop
forloop
{
// Read next record
CDataStream ssKey(SER_DISK, CLIENT_VERSION);
Expand Down
4 changes: 4 additions & 0 deletions src/init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,9 @@ void Shutdown(void* parg)
bitdb.Flush(false);
StopNode();
bitdb.Flush(true);
#ifndef MAC_OSX
boost::filesystem::remove(GetPidFile());
#endif
UnregisterWallet(pwalletMain);
delete pwalletMain;
CreateThread(ExitTimeout, NULL);
Expand Down Expand Up @@ -447,7 +449,9 @@ bool AppInit2()
}
if (pid > 0)
{
#ifndef MAC_OSX
CreatePidFile(GetPidFile(), pid);
#endif
return true;
}

Expand Down
6 changes: 3 additions & 3 deletions src/irc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ static bool Send(SOCKET hSocket, const char* pszSend)

bool RecvLineIRC(SOCKET hSocket, string& strLine)
{
loop
forloop
{
bool fRet = RecvLine(hSocket, strLine);
if (fRet)
Expand All @@ -102,7 +102,7 @@ bool RecvLineIRC(SOCKET hSocket, string& strLine)

int RecvUntil(SOCKET hSocket, const char* psz1, const char* psz2=NULL, const char* psz3=NULL, const char* psz4=NULL)
{
loop
forloop
{
string strLine;
strLine.reserve(10000);
Expand Down Expand Up @@ -137,7 +137,7 @@ bool Wait(int nSeconds)
bool RecvCodeLine(SOCKET hSocket, const char* psz1, string& strRet)
{
strRet.clear();
loop
forloop
{
string strLine;
if (!RecvLineIRC(hSocket, strLine))
Expand Down
10 changes: 5 additions & 5 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2035,7 +2035,7 @@ static unsigned int nCurrentBlockFile = 1;
FILE* AppendBlockFile(unsigned int& nFileRet)
{
nFileRet = 0;
loop
forloop
{
FILE* file = OpenBlockFile(nCurrentBlockFile, 0, "ab");
if (!file)
Expand Down Expand Up @@ -2119,7 +2119,7 @@ if (false && block.GetHash() != hashGenesisBlock)
uint256 thash;
char scratchpad[SCRYPT_SCRATCHPAD_SIZE];

loop
forloop
{
scrypt_1024_1_1_256_sp(BEGIN(block.nVersion), BEGIN(thash), scratchpad);
if (thash <= hashTarget)
Expand Down Expand Up @@ -3054,7 +3054,7 @@ bool ProcessMessages(CNode* pfrom)
// (x) data
//

loop
forloop
{
// Don't bother if send buffer is too full to respond anyway
if (pfrom->vSend.size() >= SendBufferSize())
Expand Down Expand Up @@ -3769,14 +3769,14 @@ void static BitcoinMiner(CWallet *pwallet)
//
int64 nStart = GetTime();
uint256 hashTarget = CBigNum().SetCompact(pblock->nBits).getuint256();
loop
forloop
{
unsigned int nHashesDone = 0;
//unsigned int nNonceFound;

uint256 thash;
char scratchpad[SCRYPT_SCRATCHPAD_SIZE];
loop
forloop
{
scrypt_1024_1_1_256_sp(BEGIN(pblock->nVersion), BEGIN(thash), scratchpad);

Expand Down
16 changes: 8 additions & 8 deletions src/net.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ CAddress GetLocalAddress(const CNetAddr *paddrPeer)
bool RecvLine(SOCKET hSocket, string& strLine)
{
strLine = "";
loop
forloop
{
char c;
int nBytes = recv(hSocket, &c, 1, 0);
Expand Down Expand Up @@ -314,7 +314,7 @@ bool GetMyExternalIP2(const CService& addrConnect, const char* pszGet, const cha
{
if (strLine.empty()) // HTTP response is separated from headers by blank line
{
loop
forloop
{
if (!RecvLine(hSocket, strLine))
{
Expand Down Expand Up @@ -667,7 +667,7 @@ void ThreadSocketHandler2(void* parg)
list<CNode*> vNodesDisconnected;
unsigned int nPrevNodeCount = 0;

loop
forloop
{
//
// Disconnect nodes
Expand Down Expand Up @@ -1079,7 +1079,7 @@ void ThreadMapPort2(void* parg)
else
printf("UPnP Port Mapping successful.\n");
int i = 1;
loop {
forloop {
if (fShutdown || !fUseUPnP)
{
r = UPNP_DeletePortMapping(urls.controlURL, data.first.servicetype, port, "TCP", 0);
Expand Down Expand Up @@ -1114,7 +1114,7 @@ void ThreadMapPort2(void* parg)
freeUPNPDevlist(devlist); devlist = 0;
if (r != 0)
FreeUPNPUrls(&urls);
loop {
forloop {
if (fShutdown || !fUseUPnP)
return;
Sleep(2000);
Expand Down Expand Up @@ -1336,7 +1336,7 @@ void ThreadOpenConnections2(void* parg)

// Initiate network connections
int64 nStart = GetTime();
loop
forloop
{
ProcessOneShot();

Expand Down Expand Up @@ -1395,7 +1395,7 @@ void ThreadOpenConnections2(void* parg)
int64 nANow = GetAdjustedTime();

int nTries = 0;
loop
forloop
{
// use an nUnkBias between 10 (no outgoing connections) and 90 (8 outgoing connections)
CAddress addr = addrman.Select(10 + min(nOutbound,8)*10);
Expand Down Expand Up @@ -1485,7 +1485,7 @@ void ThreadOpenAddedConnections2(void* parg)
}
}
}
loop
forloop
{
vector<vector<CService> > vservConnectAddresses = vservAddressesToAdd;
// Attempt to connect to each IP for each addnode entry until at least one is successful per addnode entry
Expand Down
11 changes: 7 additions & 4 deletions src/qt/addressbookpage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,10 +132,13 @@ void AddressBookPage::setModel(AddressTableModel *model)
ui->tableView->sortByColumn(0, Qt::AscendingOrder);

// Set column widths
ui->tableView->horizontalHeader()->resizeSection(
AddressTableModel::Address, 320);
ui->tableView->horizontalHeader()->setResizeMode(
AddressTableModel::Label, QHeaderView::Stretch);
#if QT_VERSION < 0x050000
ui->tableView->horizontalHeader()->setResizeMode(AddressTableModel::Label, QHeaderView::Stretch);
ui->tableView->horizontalHeader()->setResizeMode(AddressTableModel::Address, QHeaderView::ResizeToContents);
#else
ui->tableView->horizontalHeader()->setSectionResizeMode(AddressTableModel::Label, QHeaderView::Stretch);
ui->tableView->horizontalHeader()->setSectionResizeMode(AddressTableModel::Address, QHeaderView::ResizeToContents);
#endif

connect(ui->tableView->selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)),
this, SLOT(selectionChanged()));
Expand Down
3 changes: 3 additions & 0 deletions src/qt/bitcoin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,11 @@ int main(int argc, char *argv[])
#endif

// Internal string conversion is all UTF-8
#if QT_VERSION < 0x050000
// Internal string conversion is all UTF-8
QTextCodec::setCodecForTr(QTextCodec::codecForName("UTF-8"));
QTextCodec::setCodecForCStrings(QTextCodec::codecForTr());
#endif

Q_INIT_RESOURCE(bitcoin);
QApplication app(argc, argv);
Expand Down
8 changes: 6 additions & 2 deletions src/qt/bitcoingui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@
#include <QDragEnterEvent>
#include <QUrl>

#include <QMimeData>

#include <iostream>

BitcoinGUI::BitcoinGUI(QWidget *parent):
Expand Down Expand Up @@ -925,8 +927,10 @@ void BitcoinGUI::encryptWallet(bool status)

void BitcoinGUI::backupWallet()
{
QString saveDir = QDesktopServices::storageLocation(QDesktopServices::DocumentsLocation);
QString filename = QFileDialog::getSaveFileName(this, tr("Backup Wallet"), saveDir, tr("Wallet Data (*.dat)"));
QString filename = GUIUtil::getSaveFileName(this,
tr("Backup Wallet"), QString(),
tr("Wallet Data (*.dat)"), NULL);

if(!filename.isEmpty()) {
if(!walletModel->backupWallet(filename)) {
QMessageBox::warning(this, tr("Backup Failed"), tr("There was an error trying to save the wallet data to the new location."));
Expand Down
1 change: 1 addition & 0 deletions src/qt/chatbox.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#define CHATBOX_H

#include <QDialog>
#include <QWebView>

namespace Ui {
class ChatBox;
Expand Down
20 changes: 19 additions & 1 deletion src/qt/guiutil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
#include <QDoubleValidator>
#include <QFont>
#include <QLineEdit>
#include <QUrl>
#include <QTextDocument> // For Qt::escape
#include <QAbstractItemView>
#include <QApplication>
Expand All @@ -23,6 +22,12 @@
#include <boost/filesystem.hpp>
#include <boost/filesystem/fstream.hpp>

#if QT_VERSION < 0x050000
#include <QUrl>
#else
#include <QUrlQuery>
#endif

#ifdef WIN32
#ifdef _WIN32_WINNT
#undef _WIN32_WINNT
Expand Down Expand Up @@ -89,7 +94,12 @@ bool parseBitcoinURI(const QUrl &uri, SendCoinsRecipient *out)
SendCoinsRecipient rv;
rv.address = uri.path();
rv.amount = 0;
#if QT_VERSION < 0x050000
QList<QPair<QString, QString> > items = uri.queryItems();
#else
QUrlQuery uriQuery(uri);
QList<QPair<QString, QString> > items = uriQuery.queryItems();
#endif
for (QList<QPair<QString, QString> >::iterator i = items.begin(); i != items.end(); i++)
{
bool fShouldReturnFalse = false;
Expand Down Expand Up @@ -142,7 +152,11 @@ bool parseBitcoinURI(QString uri, SendCoinsRecipient *out)

QString HtmlEscape(const QString& str, bool fMultiLine)
{
#if QT_VERSION < 0x050000
QString escaped = Qt::escape(str);
#else
QString escaped = str.toHtmlEscaped();
#endif
if(fMultiLine)
{
escaped = escaped.replace("\n", "<br>\n");
Expand Down Expand Up @@ -177,7 +191,11 @@ QString getSaveFileName(QWidget *parent, const QString &caption,
QString myDir;
if(dir.isEmpty()) // Default to user documents location
{
#if QT_VERSION < 0x050000
myDir = QDesktopServices::storageLocation(QDesktopServices::DocumentsLocation);
#else
myDir = QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation);
#endif
}
else
{
Expand Down
Loading