diff --git a/curecoin-qt.pro b/curecoin-qt.pro index 09e4415..36f273a 100644 --- a/curecoin-qt.pro +++ b/curecoin-qt.pro @@ -4,6 +4,12 @@ VERSION = 1.0.0 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 +QT += core gui network + +greaterThan(QT_MAJOR_VERSION, 4) { + QT += widgets printsupport + DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 +} #uncomment the following section to enable building on windows: #windows:LIBS += -lshlwapi diff --git a/src/curecoinrpc.cpp b/src/curecoinrpc.cpp index 56494df..99853c1 100644 --- a/src/curecoinrpc.cpp +++ b/src/curecoinrpc.cpp @@ -389,7 +389,7 @@ int ReadHTTPStatus(std::basic_istream& stream, int &proto) int ReadHTTPHeader(std::basic_istream& stream, map& mapHeadersRet) { int nLen = 0; - loop + while (true) { string str; std::getline(stream, str); @@ -939,7 +939,7 @@ void ThreadRPCServer3(void* parg) AcceptedConnection *conn = (AcceptedConnection *) parg; bool fRun = true; - loop { + while (true) { if (fShutdown || !fRun) { conn->close(); diff --git a/src/db.cpp b/src/db.cpp index e6a52f5..1463600 100644 --- a/src/db.cpp +++ b/src/db.cpp @@ -802,7 +802,7 @@ bool CTxDB::LoadBlockIndexGuts() // Load mapBlockIndex unsigned int fFlags = DB_SET_RANGE; - loop + while (true) { // Read next record CDataStream ssKey(SER_DISK, CLIENT_VERSION); diff --git a/src/irc.cpp b/src/irc.cpp index aa412c8..d89356e 100644 --- a/src/irc.cpp +++ b/src/irc.cpp @@ -77,7 +77,7 @@ static bool Send(SOCKET hSocket, const char* pszSend) bool RecvLineIRC(SOCKET hSocket, string& strLine) { - loop + while (true) { bool fRet = RecvLine(hSocket, strLine); if (fRet) @@ -100,7 +100,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 + while (true) { string strLine; strLine.reserve(10000); @@ -135,7 +135,7 @@ bool Wait(int nSeconds) bool RecvCodeLine(SOCKET hSocket, const char* psz1, string& strRet) { strRet.clear(); - loop + while (true) { string strLine; if (!RecvLineIRC(hSocket, strLine)) diff --git a/src/kernel.cpp b/src/kernel.cpp index d70ed73..f9a2a9f 100644 --- a/src/kernel.cpp +++ b/src/kernel.cpp @@ -24,7 +24,8 @@ static std::map mapStakeModifierCheckpoints = ( 11000, 0x97a10217u ) ( 130000, 0xf3878d42u ) ( 148000, 0x111af91cu ) - ; +; + // Get the last stake modifier and its generation time from a given block static bool GetLastStakeModifier(const CBlockIndex* pindex, uint64& nStakeModifier, int64& nModifierTime) diff --git a/src/main.cpp b/src/main.cpp index 5c29a63..fe1e944 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -2574,7 +2574,7 @@ static unsigned int nCurrentBlockFile = 1; FILE* AppendBlockFile(unsigned int& nFileRet) { nFileRet = 0; - loop + while (true) { FILE* file = OpenBlockFile(nCurrentBlockFile, 0, "ab"); if (!file) @@ -3656,7 +3656,7 @@ bool ProcessMessages(CNode* pfrom) // (x) data // - loop + while (true) { // Don't bother if send buffer is too full to respond anyway if (pfrom->vSend.size() >= SendBufferSize()) @@ -4538,7 +4538,7 @@ void curecoinMiner(CWallet *pwallet, bool fProofOfStake) uint256 hashTarget = CBigNum().SetCompact(pblock->nBits).getuint256(); uint256 hashbuf[2]; uint256& hash = *alignup<16>(hashbuf); - loop + while (true) { unsigned int nHashesDone = 0; unsigned int nNonceFound; diff --git a/src/net.cpp b/src/net.cpp index 3b19ea8..b4800b1 100644 --- a/src/net.cpp +++ b/src/net.cpp @@ -140,7 +140,7 @@ CAddress GetLocalAddress(const CNetAddr *paddrPeer) bool RecvLine(SOCKET hSocket, string& strLine) { strLine = ""; - loop + while (true) { char c; int nBytes = recv(hSocket, &c, 1, 0); @@ -313,7 +313,7 @@ bool GetMyExternalIP2(const CService& addrConnect, const char* pszGet, const cha { if (strLine.empty()) // HTTP response is separated from headers by blank line { - loop + while (true) { if (!RecvLine(hSocket, strLine)) { @@ -665,7 +665,7 @@ void ThreadSocketHandler2(void* parg) list vNodesDisconnected; unsigned int nPrevNodeCount = 0; - loop + while (true) { // // Disconnect nodes @@ -1078,7 +1078,7 @@ void ThreadMapPort2(void* parg) else printf("UPnP Port Mapping successful.\n"); int i = 1; - loop { + while (true) { if (fShutdown || !fUseUPnP) { r = UPNP_DeletePortMapping(urls.controlURL, data.first.servicetype, port.c_str(), "TCP", 0); @@ -1113,7 +1113,7 @@ void ThreadMapPort2(void* parg) freeUPNPDevlist(devlist); devlist = 0; if (r != 0) FreeUPNPUrls(&urls); - loop { + while (true) { if (fShutdown || !fUseUPnP) return; Sleep(2000); @@ -1349,7 +1349,7 @@ void ThreadOpenConnections2(void* parg) // Initiate network connections int64 nStart = GetTime(); - loop + while (true) { ProcessOneShot(); @@ -1408,7 +1408,7 @@ void ThreadOpenConnections2(void* parg) int64 nANow = GetAdjustedTime(); int nTries = 0; - loop + while (true) { // use an nUnkBias between 10 (no outgoing connections) and 90 (8 outgoing connections) CAddress addr = addrman.Select(10 + min(nOutbound,8)*10); @@ -1501,7 +1501,7 @@ void ThreadOpenAddedConnections2(void* parg) } } } - loop + while (true) { vector > vservConnectAddresses = vservAddressesToAdd; // Attempt to connect to each IP for each addnode entry until at least one is successful per addnode entry diff --git a/src/qt/addressbookpage.cpp b/src/qt/addressbookpage.cpp index ee432b1..6d78183 100644 --- a/src/qt/addressbookpage.cpp +++ b/src/qt/addressbookpage.cpp @@ -134,7 +134,7 @@ void AddressBookPage::setModel(AddressTableModel *model) // Set column widths ui->tableView->horizontalHeader()->resizeSection( AddressTableModel::Address, 320); - ui->tableView->horizontalHeader()->setResizeMode( + ui->tableView->horizontalHeader()->setSectionResizeMode( AddressTableModel::Label, QHeaderView::Stretch); connect(ui->tableView->selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)), diff --git a/src/qt/curecoin.cpp b/src/qt/curecoin.cpp index 0244b75..10d3919 100644 --- a/src/qt/curecoin.cpp +++ b/src/qt/curecoin.cpp @@ -115,11 +115,11 @@ int main(int argc, char *argv[]) { // Do this early as we don't want to bother initializing if we are just calling IPC ipcScanRelay(argc, argv); - +#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(curecoin); QApplication app(argc, argv); diff --git a/src/qt/curecoingui.cpp b/src/qt/curecoingui.cpp index 0376fbd..e1a4ba6 100644 --- a/src/qt/curecoingui.cpp +++ b/src/qt/curecoingui.cpp @@ -54,6 +54,7 @@ #include #include #include +#include #include @@ -820,7 +821,7 @@ void curecoinGUI::encryptWallet(bool status) void curecoinGUI::backupWallet() { - QString saveDir = QDesktopServices::storageLocation(QDesktopServices::DocumentsLocation); + QString saveDir = QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation); QString filename = QFileDialog::getSaveFileName(this, tr("Backup Wallet"), saveDir, tr("Wallet Data (*.dat)")); if(!filename.isEmpty()) { if(!walletModel->backupWallet(filename)) { diff --git a/src/qt/guiutil.cpp b/src/qt/guiutil.cpp index 5d1fec5..55a5372 100644 --- a/src/qt/guiutil.cpp +++ b/src/qt/guiutil.cpp @@ -18,6 +18,9 @@ #include #include #include +#if QT_VERSION >= QT_VERSION_CHECK(5,0,0) +#include +#endif #include #include @@ -84,6 +87,7 @@ bool parsecurecoinURI(const QUrl &uri, SendCoinsRecipient *out) rv.address = uri.path(); rv.amount = 0; QList > items = uri.queryItems(); + for (QList >::iterator i = items.begin(); i != items.end(); i++) { bool fShouldReturnFalse = false; @@ -136,7 +140,7 @@ bool parsecurecoinURI(QString uri, SendCoinsRecipient *out) QString HtmlEscape(const QString& str, bool fMultiLine) { - QString escaped = Qt::escape(str); + QString escaped = QString(str.toHtmlEscaped()); if(fMultiLine) { escaped = escaped.replace("\n", "
\n"); @@ -171,7 +175,7 @@ QString getSaveFileName(QWidget *parent, const QString &caption, QString myDir; if(dir.isEmpty()) // Default to user documents location { - myDir = QDesktopServices::storageLocation(QDesktopServices::DocumentsLocation); + myDir = QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation); } else { diff --git a/src/qt/locale/curecoin_ca.qm b/src/qt/locale/curecoin_ca.qm index 3587e7b..3860d93 100644 Binary files a/src/qt/locale/curecoin_ca.qm and b/src/qt/locale/curecoin_ca.qm differ diff --git a/src/qt/locale/curecoin_ca_ES.qm b/src/qt/locale/curecoin_ca_ES.qm index 08af955..44831a0 100644 Binary files a/src/qt/locale/curecoin_ca_ES.qm and b/src/qt/locale/curecoin_ca_ES.qm differ diff --git a/src/qt/locale/curecoin_eo.qm b/src/qt/locale/curecoin_eo.qm index 4443e01..48cf392 100644 Binary files a/src/qt/locale/curecoin_eo.qm and b/src/qt/locale/curecoin_eo.qm differ diff --git a/src/qt/locale/curecoin_la.qm b/src/qt/locale/curecoin_la.qm index ec5172e..ddfc80a 100644 Binary files a/src/qt/locale/curecoin_la.qm and b/src/qt/locale/curecoin_la.qm differ diff --git a/src/qt/qtipcserver.cpp b/src/qt/qtipcserver.cpp index 65646f7..392d015 100644 --- a/src/qt/qtipcserver.cpp +++ b/src/qt/qtipcserver.cpp @@ -98,7 +98,7 @@ static void ipcThread2(void* pArg) size_t nSize = 0; unsigned int nPriority = 0; - loop + while (true) { ptime d = boost::posix_time::microsec_clock::universal_time() + millisec(100); if (mq->timed_receive(&buffer, sizeof(buffer), nSize, nPriority, d)) diff --git a/src/qt/sendcoinsdialog.cpp b/src/qt/sendcoinsdialog.cpp index 168e998..b8e2639 100644 --- a/src/qt/sendcoinsdialog.cpp +++ b/src/qt/sendcoinsdialog.cpp @@ -99,7 +99,7 @@ void SendCoinsDialog::on_sendButton_clicked() QStringList formatted; foreach(const SendCoinsRecipient &rcp, recipients) { - formatted.append(tr("%1 to %2 (%3)").arg(curecoinUnits::formatWithUnit(curecoinUnits::BTC, rcp.amount), Qt::escape(rcp.label), rcp.address)); + formatted.append(tr("%1 to %2 (%3)").arg(curecoinUnits::formatWithUnit(curecoinUnits::BTC, rcp.amount), QString(rcp.label).toHtmlEscaped(), rcp.address)); } fNewRecipientAllowed = false; diff --git a/src/script.cpp b/src/script.cpp index 69e9aee..742fb39 100644 --- a/src/script.cpp +++ b/src/script.cpp @@ -1257,7 +1257,7 @@ bool Solver(const CScript& scriptPubKey, txnouttype& typeRet, vector& v) return; string::size_type i1 = 0; string::size_type i2; - loop + while (true) { i2 = str.find(c, i1); if (i2 == str.npos) @@ -466,7 +466,7 @@ vector ParseHex(const char* psz) { // convert hex dump to vector vector vch; - loop + while (true) { while (isspace(*psz)) psz++; @@ -920,7 +920,7 @@ string DecodeBase32(const string& str) bool WildcardMatch(const char* psz, const char* mask) { - loop + while (true) { switch (*mask) { diff --git a/src/util.h b/src/util.h index f1dcc27..6de6dfb 100644 --- a/src/util.h +++ b/src/util.h @@ -35,7 +35,6 @@ typedef unsigned long long uint64; static const int64 COIN = 1000000; static const int64 CENT = 10000; -#define loop for (;;) #define BEGIN(a) ((char*)&(a)) #define END(a) ((char*)&((&(a))[1])) #define UBEGIN(a) ((unsigned char*)&(a)) diff --git a/src/wallet.cpp b/src/wallet.cpp index c9389bd..82e53c7 100644 --- a/src/wallet.cpp +++ b/src/wallet.cpp @@ -1232,7 +1232,7 @@ bool CWallet::CreateTransaction(const vector >& vecSend, CW CTxDB txdb("r"); { nFeeRet = nTransactionFee; - loop + while (true) { wtxNew.vin.clear(); wtxNew.vout.clear(); @@ -1495,7 +1495,7 @@ bool CWallet::CreateCoinStake(const CKeyStore& keystore, unsigned int nBits, int } int64 nMinFee = 0; - loop + while (true) { // Set output amount if (txNew.vout.size() == 3) diff --git a/src/walletdb.cpp b/src/walletdb.cpp index ee3a0f0..96e8d51 100644 --- a/src/walletdb.cpp +++ b/src/walletdb.cpp @@ -73,7 +73,7 @@ void CWalletDB::ListAccountCreditDebit(const string& strAccount, list