Reduce build warnings and enable Qt build

This commit is contained in:
root
2026-04-28 16:50:31 +00:00
parent 34864c5254
commit 43b88c7110
43 changed files with 164 additions and 87 deletions
+6 -6
View File
@@ -122,7 +122,7 @@ if test "x$want_boost" = "xyes"; then
dnl this location ist chosen if boost libraries are installed with the --layout=system option dnl this location ist chosen if boost libraries are installed with the --layout=system option
dnl or if you install boost with RPM dnl or if you install boost with RPM
if test "$ac_boost_path" != ""; then if test "$ac_boost_path" != ""; then
BOOST_CPPFLAGS="-I$ac_boost_path/include" BOOST_CPPFLAGS="-isystem $ac_boost_path/include"
for ac_boost_path_tmp in $libsubdirs; do for ac_boost_path_tmp in $libsubdirs; do
if test -d "$ac_boost_path"/"$ac_boost_path_tmp" ; then if test -d "$ac_boost_path"/"$ac_boost_path_tmp" ; then
BOOST_LDFLAGS="-L$ac_boost_path/$ac_boost_path_tmp" BOOST_LDFLAGS="-L$ac_boost_path/$ac_boost_path_tmp"
@@ -136,7 +136,7 @@ if test "x$want_boost" = "xyes"; then
if ls "$ac_boost_path_tmp/$libsubdir/libboost_"* >/dev/null 2>&1 ; then break; fi if ls "$ac_boost_path_tmp/$libsubdir/libboost_"* >/dev/null 2>&1 ; then break; fi
done done
BOOST_LDFLAGS="-L$ac_boost_path_tmp/$libsubdir" BOOST_LDFLAGS="-L$ac_boost_path_tmp/$libsubdir"
BOOST_CPPFLAGS="-I$ac_boost_path_tmp/include" BOOST_CPPFLAGS="-isystem $ac_boost_path_tmp/include"
break; break;
fi fi
done done
@@ -193,12 +193,12 @@ if test "x$want_boost" = "xyes"; then
_version=$_version_tmp _version=$_version_tmp
fi fi
VERSION_UNDERSCORE=`echo $_version | sed 's/\./_/'` VERSION_UNDERSCORE=`echo $_version | sed 's/\./_/'`
BOOST_CPPFLAGS="-I$ac_boost_path/include/boost-$VERSION_UNDERSCORE" BOOST_CPPFLAGS="-isystem $ac_boost_path/include/boost-$VERSION_UNDERSCORE"
done done
dnl if nothing found search for layout used in Windows distributions dnl if nothing found search for layout used in Windows distributions
if test -z "$BOOST_CPPFLAGS"; then if test -z "$BOOST_CPPFLAGS"; then
if test -d "$ac_boost_path/boost" && test -r "$ac_boost_path/boost"; then if test -d "$ac_boost_path/boost" && test -r "$ac_boost_path/boost"; then
BOOST_CPPFLAGS="-I$ac_boost_path" BOOST_CPPFLAGS="-isystem $ac_boost_path"
fi fi
fi fi
fi fi
@@ -218,7 +218,7 @@ if test "x$want_boost" = "xyes"; then
done done
VERSION_UNDERSCORE=`echo $_version | sed 's/\./_/'` VERSION_UNDERSCORE=`echo $_version | sed 's/\./_/'`
BOOST_CPPFLAGS="-I$best_path/include/boost-$VERSION_UNDERSCORE" BOOST_CPPFLAGS="-isystem $best_path/include/boost-$VERSION_UNDERSCORE"
if test "$ac_boost_lib_path" = ""; then if test "$ac_boost_lib_path" = ""; then
for libsubdir in $libsubdirs ; do for libsubdir in $libsubdirs ; do
if ls "$best_path/$libsubdir/libboost_"* >/dev/null 2>&1 ; then break; fi if ls "$best_path/$libsubdir/libboost_"* >/dev/null 2>&1 ; then break; fi
@@ -238,7 +238,7 @@ if test "x$want_boost" = "xyes"; then
V_CHECK=`expr $stage_version_shorten \>\= $_version` V_CHECK=`expr $stage_version_shorten \>\= $_version`
if test "$V_CHECK" = "1" -a "$ac_boost_lib_path" = "" ; then if test "$V_CHECK" = "1" -a "$ac_boost_lib_path" = "" ; then
AC_MSG_NOTICE(We will use a staged boost library from $BOOST_ROOT) AC_MSG_NOTICE(We will use a staged boost library from $BOOST_ROOT)
BOOST_CPPFLAGS="-I$BOOST_ROOT" BOOST_CPPFLAGS="-isystem $BOOST_ROOT"
BOOST_LDFLAGS="-L$BOOST_ROOT/stage/$libsubdir" BOOST_LDFLAGS="-L$BOOST_ROOT/stage/$libsubdir"
fi fi
fi fi
+1 -1
View File
@@ -62,7 +62,7 @@ if test -z "@allow_host_packages@"; then
export PKGCONFIG_LIBDIR= export PKGCONFIG_LIBDIR=
fi fi
CPPFLAGS="-I$depends_prefix/include/ $CPPFLAGS" CPPFLAGS="-isystem $depends_prefix/include/ $CPPFLAGS"
LDFLAGS="-L$depends_prefix/lib $LDFLAGS" LDFLAGS="-L$depends_prefix/lib $LDFLAGS"
if test -n "@CC@" -a -z "${CC}"; then if test -n "@CC@" -a -z "${CC}"; then
+2 -2
View File
@@ -246,8 +246,8 @@ int CommandLineRPC(int argc, char* argv[])
const UniValue reply = CallRPC(strMethod, params); const UniValue reply = CallRPC(strMethod, params);
// Parse reply // Parse reply
const UniValue& result = find_value(reply, "result"); const UniValue result = find_value(reply, "result");
const UniValue& error = find_value(reply, "error"); const UniValue error = find_value(reply, "error");
if (!error.isNull()) { if (!error.isNull()) {
// Error // Error
+1
View File
@@ -29,6 +29,7 @@ public:
explicit CFeeRate(const CAmount& _nSatoshisPerK) : nSatoshisPerK(_nSatoshisPerK) {} explicit CFeeRate(const CAmount& _nSatoshisPerK) : nSatoshisPerK(_nSatoshisPerK) {}
CFeeRate(const CAmount& nFeePaid, size_t nSize); CFeeRate(const CAmount& nFeePaid, size_t nSize);
CFeeRate(const CFeeRate& other) { nSatoshisPerK = other.nSatoshisPerK; } CFeeRate(const CFeeRate& other) { nSatoshisPerK = other.nSatoshisPerK; }
CFeeRate& operator=(const CFeeRate& other) = default;
CAmount GetFee(size_t size) const; // unit returned is satoshis CAmount GetFee(size_t size) const; // unit returned is satoshis
CAmount GetFeePerK() const { return GetFee(1000); } // satoshis-per-1000-bytes CAmount GetFeePerK() const { return GetFee(1000); } // satoshis-per-1000-bytes
+3 -2
View File
@@ -8,6 +8,7 @@
#include "hash.h" #include "hash.h"
#include "uint256.h" #include "uint256.h"
#include <algorithm>
#include <assert.h> #include <assert.h>
#include <boost/variant/apply_visitor.hpp> #include <boost/variant/apply_visitor.hpp>
#include <boost/variant/static_visitor.hpp> #include <boost/variant/static_visitor.hpp>
@@ -270,7 +271,7 @@ CTxDestination CBitcoinAddress::Get() const
if (!IsValid()) if (!IsValid())
return CNoDestination(); return CNoDestination();
uint160 id; uint160 id;
memcpy(&id, &vchData[0], 20); std::copy(vchData.begin(), vchData.end(), id.begin());
if (vchVersion == Params().Base58Prefix(CChainParams::PUBKEY_ADDRESS)) if (vchVersion == Params().Base58Prefix(CChainParams::PUBKEY_ADDRESS))
return CKeyID(id); return CKeyID(id);
else if (vchVersion == Params().Base58Prefix(CChainParams::SCRIPT_ADDRESS)) else if (vchVersion == Params().Base58Prefix(CChainParams::SCRIPT_ADDRESS))
@@ -284,7 +285,7 @@ bool CBitcoinAddress::GetKeyID(CKeyID& keyID) const
if (!IsValid() || vchVersion != Params().Base58Prefix(CChainParams::PUBKEY_ADDRESS)) if (!IsValid() || vchVersion != Params().Base58Prefix(CChainParams::PUBKEY_ADDRESS))
return false; return false;
uint160 id; uint160 id;
memcpy(&id, &vchData[0], 20); std::copy(vchData.begin(), vchData.end(), id.begin());
keyID = CKeyID(id); keyID = CKeyID(id);
return true; return true;
} }
+4 -2
View File
@@ -10,10 +10,12 @@
#include "pubkey.h" #include "pubkey.h"
#include "script/standard.h" #include "script/standard.h"
#include <algorithm>
bool CScriptCompressor::IsToKeyID(CKeyID& hash) const bool CScriptCompressor::IsToKeyID(CKeyID& hash) const
{ {
if (script.size() == 25 && script[0] == OP_DUP && script[1] == OP_HASH160 && script[2] == 20 && script[23] == OP_EQUALVERIFY && script[24] == OP_CHECKSIG) { if (script.size() == 25 && script[0] == OP_DUP && script[1] == OP_HASH160 && script[2] == 20 && script[23] == OP_EQUALVERIFY && script[24] == OP_CHECKSIG) {
memcpy(&hash, &script[3], 20); std::copy(script.begin() + 3, script.begin() + 23, hash.begin());
return true; return true;
} }
return false; return false;
@@ -22,7 +24,7 @@ bool CScriptCompressor::IsToKeyID(CKeyID& hash) const
bool CScriptCompressor::IsToScriptID(CScriptID& hash) const bool CScriptCompressor::IsToScriptID(CScriptID& hash) const
{ {
if (script.size() == 23 && script[0] == OP_HASH160 && script[1] == 20 && script[22] == OP_EQUAL) { if (script.size() == 23 && script[0] == OP_HASH160 && script[1] == 20 && script[22] == OP_EQUAL) {
memcpy(&hash, &script[2], 20); std::copy(script.begin() + 2, script.begin() + 22, hash.begin());
return true; return true;
} }
return false; return false;
+2 -1
View File
@@ -167,7 +167,8 @@ PBKDF2_SHA256(const uint8_t *passwd, size_t passwdlen, const uint8_t *salt,
} }
/* Clean PShctx, since we never called _Final on it. */ /* Clean PShctx, since we never called _Final on it. */
memset(&PShctx, 0, sizeof(HMAC_SHA256_CTX)); PShctx.ictx.Reset();
PShctx.octx.Reset();
} }
static inline uint32_t static inline uint32_t
+4 -2
View File
@@ -55,8 +55,10 @@ void InitOnce(OnceType* once, void (*initializer)()) {
bool HasAcceleratedCRC32C() { bool HasAcceleratedCRC32C() {
#if (defined(__x86_64__) || defined(__i386__)) && defined(__GNUC__) #if (defined(__x86_64__) || defined(__i386__)) && defined(__GNUC__)
unsigned int eax, ebx, ecx, edx; unsigned int eax = 0, ebx = 0, ecx = 0, edx = 0;
__get_cpuid(1, &eax, &ebx, &ecx, &edx); if (__get_cpuid(1, &eax, &ebx, &ecx, &edx) == 0) {
return false;
}
return (ecx & (1 << 20)) != 0; return (ecx & (1 << 20)) != 0;
#else #else
return false; return false;
+1 -1
View File
@@ -55,7 +55,7 @@ bool ConsumeDecimalNumber(Slice* in, uint64_t* val) {
const int delta = (c - '0'); const int delta = (c - '0');
static const uint64_t kMaxUint64 = ~static_cast<uint64_t>(0); static const uint64_t kMaxUint64 = ~static_cast<uint64_t>(0);
if (v > kMaxUint64/10 || if (v > kMaxUint64/10 ||
(v == kMaxUint64/10 && delta > kMaxUint64%10)) { (v == kMaxUint64/10 && static_cast<uint64_t>(delta) > kMaxUint64%10)) {
// Overflow // Overflow
return false; return false;
} }
+1 -1
View File
@@ -59,7 +59,7 @@ void CLightWorker::ThreadLightZAGRSimplified() {
heightStop heightStop
); );
} catch (NotEnoughMintsException e) { } catch (const NotEnoughMintsException& e) {
LogPrintStr(std::string("ThreadLightZAGRSimplified: ") + e.message + "\n"); LogPrintStr(std::string("ThreadLightZAGRSimplified: ") + e.message + "\n");
rejectWork(genWit, blockHeight, NOT_ENOUGH_MINTS); rejectWork(genWit, blockHeight, NOT_ENOUGH_MINTS);
continue; continue;
+1
View File
@@ -47,6 +47,7 @@ public:
CMasternodePing(); CMasternodePing();
CMasternodePing(CTxIn& newVin); CMasternodePing(CTxIn& newVin);
CMasternodePing(const CMasternodePing& other) = default;
ADD_SERIALIZE_METHODS; ADD_SERIALIZE_METHODS;
+2
View File
@@ -159,6 +159,8 @@ CTransaction::CTransaction(const CMutableTransaction &tx) : nVersion(tx.nVersion
UpdateHash(); UpdateHash();
} }
CTransaction::CTransaction(const CTransaction &tx) : hash(tx.hash), nVersion(tx.nVersion), vin(tx.vin), vout(tx.vout), nLockTime(tx.nLockTime) { }
CTransaction& CTransaction::operator=(const CTransaction &tx) { CTransaction& CTransaction::operator=(const CTransaction &tx) {
*const_cast<int*>(&nVersion) = tx.nVersion; *const_cast<int*>(&nVersion) = tx.nVersion;
*const_cast<std::vector<CTxIn>*>(&vin) = tx.vin; *const_cast<std::vector<CTxIn>*>(&vin) = tx.vin;
+1
View File
@@ -226,6 +226,7 @@ public:
/** Convert a CMutableTransaction into a CTransaction. */ /** Convert a CMutableTransaction into a CTransaction. */
CTransaction(const CMutableTransaction &tx); CTransaction(const CMutableTransaction &tx);
CTransaction(const CTransaction& tx);
CTransaction& operator=(const CTransaction& tx); CTransaction& operator=(const CTransaction& tx);
ADD_SERIALIZE_METHODS; ADD_SERIALIZE_METHODS;
+1 -1
View File
@@ -51,7 +51,7 @@ CMessageHeader::CMessageHeader(const char* pszCommand, unsigned int nMessageSize
{ {
memcpy(pchMessageStart, Params().MessageStart(), MESSAGE_START_SIZE); memcpy(pchMessageStart, Params().MessageStart(), MESSAGE_START_SIZE);
memset(pchCommand, 0, sizeof(pchCommand)); memset(pchCommand, 0, sizeof(pchCommand));
strncpy(pchCommand, pszCommand, COMMAND_SIZE); memcpy(pchCommand, pszCommand, strnlen(pszCommand, COMMAND_SIZE));
nMessageSize = nMessageSizeIn; nMessageSize = nMessageSizeIn;
nChecksum = 0; nChecksum = 0;
} }
+9 -7
View File
@@ -13,6 +13,8 @@
#include "wallet/wallet.h" #include "wallet/wallet.h"
#include "askpassphrasedialog.h" #include "askpassphrasedialog.h"
#include <algorithm>
#include <QDebug> #include <QDebug>
#include <QFont> #include <QFont>
@@ -82,7 +84,7 @@ public:
cachedAddressTable.clear(); cachedAddressTable.clear();
{ {
LOCK(wallet->cs_wallet); LOCK(wallet->cs_wallet);
for (const PAIRTYPE(CTxDestination, CAddressBookData) & item : wallet->mapAddressBook) { for (const auto& item : wallet->mapAddressBook) {
const CBitcoinAddress& address = item.first; const CBitcoinAddress& address = item.first;
bool fMine = IsMine(*wallet, address.Get()); bool fMine = IsMine(*wallet, address.Get());
AddressTableEntry::Type addressType = translateTransactionType( AddressTableEntry::Type addressType = translateTransactionType(
@@ -96,15 +98,15 @@ public:
// qLowerBound() and qUpperBound() require our cachedAddressTable list to be sorted in asc order // qLowerBound() and qUpperBound() require our cachedAddressTable list to be sorted in asc order
// Even though the map is already sorted this re-sorting step is needed because the originating map // Even though the map is already sorted this re-sorting step is needed because the originating map
// is sorted by binary address, not by base58() address. // is sorted by binary address, not by base58() address.
qSort(cachedAddressTable.begin(), cachedAddressTable.end(), AddressTableEntryLessThan()); std::sort(cachedAddressTable.begin(), cachedAddressTable.end(), AddressTableEntryLessThan());
} }
void updateEntry(const QString& address, const QString& label, bool isMine, const QString& purpose, int status) void updateEntry(const QString& address, const QString& label, bool isMine, const QString& purpose, int status)
{ {
// Find address / label in model // Find address / label in model
QList<AddressTableEntry>::iterator lower = qLowerBound( QList<AddressTableEntry>::iterator lower = std::lower_bound(
cachedAddressTable.begin(), cachedAddressTable.end(), address, AddressTableEntryLessThan()); cachedAddressTable.begin(), cachedAddressTable.end(), address, AddressTableEntryLessThan());
QList<AddressTableEntry>::iterator upper = qUpperBound( QList<AddressTableEntry>::iterator upper = std::upper_bound(
cachedAddressTable.begin(), cachedAddressTable.end(), address, AddressTableEntryLessThan()); cachedAddressTable.begin(), cachedAddressTable.end(), address, AddressTableEntryLessThan());
int lowerIndex = (lower - cachedAddressTable.begin()); int lowerIndex = (lower - cachedAddressTable.begin());
int upperIndex = (upper - cachedAddressTable.begin()); int upperIndex = (upper - cachedAddressTable.begin());
@@ -145,9 +147,9 @@ public:
void updateEntry(const QString &pubCoin, const QString &isUsed, int status) void updateEntry(const QString &pubCoin, const QString &isUsed, int status)
{ {
// Find address / label in model // Find address / label in model
QList<AddressTableEntry>::iterator lower = qLowerBound( QList<AddressTableEntry>::iterator lower = std::lower_bound(
cachedAddressTable.begin(), cachedAddressTable.end(), pubCoin, AddressTableEntryLessThan()); cachedAddressTable.begin(), cachedAddressTable.end(), pubCoin, AddressTableEntryLessThan());
QList<AddressTableEntry>::iterator upper = qUpperBound( QList<AddressTableEntry>::iterator upper = std::upper_bound(
cachedAddressTable.begin(), cachedAddressTable.end(), pubCoin, AddressTableEntryLessThan()); cachedAddressTable.begin(), cachedAddressTable.end(), pubCoin, AddressTableEntryLessThan());
int lowerIndex = (lower - cachedAddressTable.begin()); int lowerIndex = (lower - cachedAddressTable.begin());
bool inModel = (lower != upper); bool inModel = (lower != upper);
@@ -317,7 +319,7 @@ QVariant AddressTableModel::headerData(int section, Qt::Orientation orientation,
Qt::ItemFlags AddressTableModel::flags(const QModelIndex& index) const Qt::ItemFlags AddressTableModel::flags(const QModelIndex& index) const
{ {
if (!index.isValid()) if (!index.isValid())
return 0; return Qt::ItemFlags();
AddressTableEntry* rec = static_cast<AddressTableEntry*>(index.internalPointer()); AddressTableEntry* rec = static_cast<AddressTableEntry*>(index.internalPointer());
Qt::ItemFlags retval = Qt::ItemIsSelectable | Qt::ItemIsEnabled; Qt::ItemFlags retval = Qt::ItemIsSelectable | Qt::ItemIsEnabled;
+2 -2
View File
@@ -357,7 +357,7 @@ void BitcoinApplication::createWindow(const NetworkStyle* networkStyle)
void BitcoinApplication::createSplashScreen(const NetworkStyle* networkStyle) void BitcoinApplication::createSplashScreen(const NetworkStyle* networkStyle)
{ {
SplashScreen* splash = new SplashScreen(0, networkStyle); SplashScreen* splash = new SplashScreen(Qt::WindowFlags(), networkStyle);
// We don't hold a direct pointer to the splash screen after creation, so use // We don't hold a direct pointer to the splash screen after creation, so use
// Qt::WA_DeleteOnClose to make sure that the window will be deleted eventually. // Qt::WA_DeleteOnClose to make sure that the window will be deleted eventually.
splash->setAttribute(Qt::WA_DeleteOnClose); splash->setAttribute(Qt::WA_DeleteOnClose);
@@ -502,7 +502,6 @@ int main(int argc, char* argv[])
Q_INIT_RESOURCE(agrarian_locale); Q_INIT_RESOURCE(agrarian_locale);
Q_INIT_RESOURCE(agrarian); Q_INIT_RESOURCE(agrarian);
BitcoinApplication app(argc, argv);
#if QT_VERSION > 0x050100 #if QT_VERSION > 0x050100
// Generate high-dpi pixmaps // Generate high-dpi pixmaps
QApplication::setAttribute(Qt::AA_UseHighDpiPixmaps); QApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
@@ -513,6 +512,7 @@ int main(int argc, char* argv[])
#ifdef Q_OS_MAC #ifdef Q_OS_MAC
QApplication::setAttribute(Qt::AA_DontShowIconsInMenus); QApplication::setAttribute(Qt::AA_DontShowIconsInMenus);
#endif #endif
BitcoinApplication app(argc, argv);
// Register meta types used for QMetaObject::invokeMethod // Register meta types used for QMetaObject::invokeMethod
qRegisterMetaType<bool*>(); qRegisterMetaType<bool*>();
+4 -2
View File
@@ -12,6 +12,8 @@
#include "sync.h" #include "sync.h"
#include "utiltime.h" #include "utiltime.h"
#include <algorithm>
#include <QDebug> #include <QDebug>
#include <QList> #include <QList>
@@ -63,7 +65,7 @@ public:
if (sortColumn >= 0) if (sortColumn >= 0)
// sort cachedBanlist (use stable sort to prevent rows jumping around unneceesarily) // sort cachedBanlist (use stable sort to prevent rows jumping around unneceesarily)
qStableSort(cachedBanlist.begin(), cachedBanlist.end(), BannedNodeLessThan(sortColumn, sortOrder)); std::stable_sort(cachedBanlist.begin(), cachedBanlist.end(), BannedNodeLessThan(sortColumn, sortOrder));
} }
int size() const int size() const
@@ -147,7 +149,7 @@ QVariant BanTableModel::headerData(int section, Qt::Orientation orientation, int
Qt::ItemFlags BanTableModel::flags(const QModelIndex &index) const Qt::ItemFlags BanTableModel::flags(const QModelIndex &index) const
{ {
if(!index.isValid()) if(!index.isValid())
return 0; return Qt::ItemFlags();
Qt::ItemFlags retval = Qt::ItemIsSelectable | Qt::ItemIsEnabled; Qt::ItemFlags retval = Qt::ItemIsSelectable | Qt::ItemIsEnabled;
return retval; return retval;
+5 -1
View File
@@ -98,7 +98,11 @@ public:
const QFontMetrics fm(fontMetrics()); const QFontMetrics fm(fontMetrics());
int h = lineEdit()->minimumSizeHint().height(); int h = lineEdit()->minimumSizeHint().height();
#if QT_VERSION >= QT_VERSION_CHECK(5, 11, 0)
int w = fm.horizontalAdvance(BitcoinUnits::format(BitcoinUnits::AGR, BitcoinUnits::maxMoney(), false, BitcoinUnits::separatorAlways));
#else
int w = fm.width(BitcoinUnits::format(BitcoinUnits::AGR, BitcoinUnits::maxMoney(), false, BitcoinUnits::separatorAlways)); int w = fm.width(BitcoinUnits::format(BitcoinUnits::AGR, BitcoinUnits::maxMoney(), false, BitcoinUnits::separatorAlways));
#endif
w += 2; // cursor blinking space w += 2; // cursor blinking space
QStyleOptionSpinBox opt; QStyleOptionSpinBox opt;
@@ -159,7 +163,7 @@ protected:
StepEnabled stepEnabled() const StepEnabled stepEnabled() const
{ {
StepEnabled rv = 0; StepEnabled rv = StepEnabled();
if (isReadOnly()) // Disable steps when AmountSpinBox is read-only if (isReadOnly()) // Disable steps when AmountSpinBox is read-only
return StepNone; return StepNone;
if (text().isEmpty()) // Allow step-up with empty field if (text().isEmpty()) // Allow step-up with empty field
+4
View File
@@ -1283,7 +1283,11 @@ void BitcoinGUI::updateTorIcon()
bool tor_enabled = clientModel->getTorInfo(ip_port); bool tor_enabled = clientModel->getTorInfo(ip_port);
if (tor_enabled) { if (tor_enabled) {
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
if (labelTorIcon->pixmap(Qt::ReturnByValue).isNull()) {
#else
if (labelTorIcon->pixmap() == 0) { if (labelTorIcon->pixmap() == 0) {
#endif
QString ip_port_q = QString::fromStdString(ip_port); QString ip_port_q = QString::fromStdString(ip_port);
labelTorIcon->setPixmap(QIcon(":/icons/onion").pixmap(STATUSBAR_ICONSIZE, STATUSBAR_ICONSIZE)); labelTorIcon->setPixmap(QIcon(":/icons/onion").pixmap(STATUSBAR_ICONSIZE, STATUSBAR_ICONSIZE));
labelTorIcon->setToolTip(tr("Tor is <b>enabled</b>: %1").arg(ip_port_q)); labelTorIcon->setToolTip(tr("Tor is <b>enabled</b>: %1").arg(ip_port_q));
+7
View File
@@ -52,7 +52,9 @@
#include <QDoubleValidator> #include <QDoubleValidator>
#include <QFileDialog> #include <QFileDialog>
#include <QFont> #include <QFont>
#include <QGuiApplication>
#include <QLineEdit> #include <QLineEdit>
#include <QScreen>
#include <QSettings> #include <QSettings>
#include <QTextDocument> // for Qt::mightBeRichText #include <QTextDocument> // for Qt::mightBeRichText
#include <QThread> #include <QThread>
@@ -787,7 +789,12 @@ void restoreWindowGeometry(const QString& strSetting, const QSize& defaultSize,
QSize size = settings.value(strSetting + "Size", defaultSize).toSize(); QSize size = settings.value(strSetting + "Size", defaultSize).toSize();
if (!pos.x() && !pos.y()) { if (!pos.x() && !pos.y()) {
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
QScreen* screenHandle = QGuiApplication::primaryScreen();
QRect screen = screenHandle ? screenHandle->geometry() : QRect(QPoint(), size);
#else
QRect screen = QApplication::desktop()->screenGeometry(); QRect screen = QApplication::desktop()->screenGeometry();
#endif
pos.setX((screen.width() - size.width()) / 2); pos.setX((screen.width() - size.width()) / 2);
pos.setY((screen.height() - size.height()) / 2); pos.setY((screen.height() - size.height()) / 2);
} }
+4 -4
View File
@@ -219,12 +219,12 @@ QVariant OptionsModel::data(const QModelIndex& index, int role) const
return settings.value("fUseProxy", false); return settings.value("fUseProxy", false);
case ProxyIP: { case ProxyIP: {
// contains IP at index 0 and port at index 1 // contains IP at index 0 and port at index 1
QStringList strlIpPort = settings.value("addrProxy").toString().split(":", QString::SkipEmptyParts); QStringList strlIpPort = settings.value("addrProxy").toString().split(":", Qt::SkipEmptyParts);
return strlIpPort.at(0); return strlIpPort.at(0);
} }
case ProxyPort: { case ProxyPort: {
// contains IP at index 0 and port at index 1 // contains IP at index 0 and port at index 1
QStringList strlIpPort = settings.value("addrProxy").toString().split(":", QString::SkipEmptyParts); QStringList strlIpPort = settings.value("addrProxy").toString().split(":", Qt::SkipEmptyParts);
return strlIpPort.at(1); return strlIpPort.at(1);
} }
@@ -308,7 +308,7 @@ bool OptionsModel::setData(const QModelIndex& index, const QVariant& value, int
break; break;
case ProxyIP: { case ProxyIP: {
// contains current IP at index 0 and current port at index 1 // contains current IP at index 0 and current port at index 1
QStringList strlIpPort = settings.value("addrProxy").toString().split(":", QString::SkipEmptyParts); QStringList strlIpPort = settings.value("addrProxy").toString().split(":", Qt::SkipEmptyParts);
// if that key doesn't exist or has a changed IP // if that key doesn't exist or has a changed IP
if (!settings.contains("addrProxy") || strlIpPort.at(0) != value.toString()) { if (!settings.contains("addrProxy") || strlIpPort.at(0) != value.toString()) {
// construct new value from new IP and current port // construct new value from new IP and current port
@@ -319,7 +319,7 @@ bool OptionsModel::setData(const QModelIndex& index, const QVariant& value, int
} break; } break;
case ProxyPort: { case ProxyPort: {
// contains current IP at index 0 and current port at index 1 // contains current IP at index 0 and current port at index 1
QStringList strlIpPort = settings.value("addrProxy").toString().split(":", QString::SkipEmptyParts); QStringList strlIpPort = settings.value("addrProxy").toString().split(":", Qt::SkipEmptyParts);
// if that key doesn't exist or has a changed port // if that key doesn't exist or has a changed port
if (!settings.contains("addrProxy") || strlIpPort.at(1) != value.toString()) { if (!settings.contains("addrProxy") || strlIpPort.at(1) != value.toString()) {
// construct new value from current IP and new port // construct new value from current IP and new port
+8 -5
View File
@@ -36,6 +36,7 @@
#include <QNetworkReply> #include <QNetworkReply>
#include <QNetworkRequest> #include <QNetworkRequest>
#include <QSslCertificate> #include <QSslCertificate>
#include <QSslConfiguration>
#include <QSslError> #include <QSslError>
#include <QSslSocket> #include <QSslSocket>
#include <QStringList> #include <QStringList>
@@ -129,9 +130,11 @@ void PaymentServer::LoadRootCAs(X509_STORE* _store)
if (certFile != "-system-") { if (certFile != "-system-") {
certList = QSslCertificate::fromPath(certFile); certList = QSslCertificate::fromPath(certFile);
// Use those certificates when fetching payment requests, too: // Use those certificates when fetching payment requests, too:
QSslSocket::setDefaultCaCertificates(certList); QSslConfiguration sslConfiguration = QSslConfiguration::defaultConfiguration();
sslConfiguration.setCaCertificates(certList);
QSslConfiguration::setDefaultConfiguration(sslConfiguration);
} else } else
certList = QSslSocket::systemCaCertificates(); certList = QSslConfiguration::systemCaCertificates();
int nRootCerts = 0; int nRootCerts = 0;
const QDateTime currentTime = QDateTime::currentDateTime(); const QDateTime currentTime = QDateTime::currentDateTime();
@@ -372,7 +375,7 @@ void PaymentServer::handleURIOrFile(const QString& s)
if (uri.hasQueryItem("r")) // payment request URI if (uri.hasQueryItem("r")) // payment request URI
{ {
QByteArray temp; QByteArray temp;
temp.append(uri.queryItemValue("r")); temp.append(uri.queryItemValue("r").toUtf8());
QString decoded = QUrl::fromPercentEncoding(temp); QString decoded = QUrl::fromPercentEncoding(temp);
QUrl fetchUrl(decoded, QUrl::StrictMode); QUrl fetchUrl(decoded, QUrl::StrictMode);
@@ -507,7 +510,7 @@ bool PaymentServer::processPaymentRequest(PaymentRequestPlus& request, SendCoins
QList<std::pair<CScript, CAmount> > sendingTos = request.getPayTo(); QList<std::pair<CScript, CAmount> > sendingTos = request.getPayTo();
QStringList addresses; QStringList addresses;
foreach (const PAIRTYPE(CScript, CAmount) & sendingTo, sendingTos) { for (const auto& sendingTo : sendingTos) {
// Extract and check destination addresses // Extract and check destination addresses
CTxDestination dest; CTxDestination dest;
if (ExtractDestination(sendingTo.first, dest)) { if (ExtractDestination(sendingTo.first, dest)) {
@@ -597,7 +600,7 @@ void PaymentServer::fetchPaymentACK(CWallet* wallet, SendCoinsRecipient recipien
} }
} }
int length = payment.ByteSize(); int length = static_cast<int>(payment.ByteSizeLong());
netRequest.setHeader(QNetworkRequest::ContentLengthHeader, length); netRequest.setHeader(QNetworkRequest::ContentLengthHeader, length);
QByteArray serData(length, '\0'); QByteArray serData(length, '\0');
if (payment.SerializeToArray(serData.data(), length)) { if (payment.SerializeToArray(serData.data(), length)) {
+4 -2
View File
@@ -12,6 +12,8 @@
#include "net.h" #include "net.h"
#include "sync.h" #include "sync.h"
#include <algorithm>
#include <QDebug> #include <QDebug>
#include <QList> #include <QList>
#include <QTimer> #include <QTimer>
@@ -83,7 +85,7 @@ public:
if (sortColumn >= 0) if (sortColumn >= 0)
// sort cacheNodeStats (use stable sort to prevent rows jumping around unneceesarily) // sort cacheNodeStats (use stable sort to prevent rows jumping around unneceesarily)
qStableSort(cachedNodeStats.begin(), cachedNodeStats.end(), NodeLessThan(sortColumn, sortOrder)); std::stable_sort(cachedNodeStats.begin(), cachedNodeStats.end(), NodeLessThan(sortColumn, sortOrder));
// build index map // build index map
mapNodeRows.clear(); mapNodeRows.clear();
@@ -185,7 +187,7 @@ QVariant PeerTableModel::headerData(int section, Qt::Orientation orientation, in
Qt::ItemFlags PeerTableModel::flags(const QModelIndex& index) const Qt::ItemFlags PeerTableModel::flags(const QModelIndex& index) const
{ {
if (!index.isValid()) if (!index.isValid())
return 0; return Qt::ItemFlags();
Qt::ItemFlags retval = Qt::ItemIsSelectable | Qt::ItemIsEnabled; Qt::ItemFlags retval = Qt::ItemIsSelectable | Qt::ItemIsEnabled;
return retval; return retval;
-4
View File
@@ -706,10 +706,6 @@ void PrivacyDialog::setBalance(const CAmount& balance, const CAmount& unconfirme
} }
} }
CAmount matureZerocoinBalance = zerocoinBalance - unconfirmedZerocoinBalance - immatureZerocoinBalance; CAmount matureZerocoinBalance = zerocoinBalance - unconfirmedZerocoinBalance - immatureZerocoinBalance;
CAmount nLockedBalance = 0;
if (walletModel) {
nLockedBalance = walletModel->getLockedBalance();
}
ui->labelzAvailableAmount->setText(QString::number(zerocoinBalance/COIN) + QString(" zAGR ")); ui->labelzAvailableAmount->setText(QString::number(zerocoinBalance/COIN) + QString(" zAGR "));
ui->labelzAvailableAmount_2->setText(QString::number(matureZerocoinBalance/COIN) + QString(" zAGR ")); ui->labelzAvailableAmount_2->setText(QString::number(matureZerocoinBalance/COIN) + QString(" zAGR "));
+1 -2
View File
@@ -255,7 +255,7 @@ void ReceiveCoinsDialog::copyColumnToClipboard(int column)
return; return;
// correct for selection mode ContiguousSelection // correct for selection mode ContiguousSelection
QModelIndex firstIndex = selection.at(0); QModelIndex firstIndex = selection.at(0);
GUIUtil::setClipboard(model->getRecentRequestsTableModel()->data(firstIndex.child(firstIndex.row(), column), Qt::EditRole).toString()); GUIUtil::setClipboard(model->getRecentRequestsTableModel()->data(firstIndex.sibling(firstIndex.row(), column), Qt::EditRole).toString());
} }
// context menu // context menu
@@ -300,4 +300,3 @@ void ReceiveCoinsDialog::receiveAddressUsed()
clear(); clear();
} }
} }
+28 -1
View File
@@ -40,14 +40,26 @@ QRImageWidget::QRImageWidget(QWidget* parent) : QLabel(parent), contextMenu(0)
QImage QRImageWidget::exportImage() QImage QRImageWidget::exportImage()
{ {
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
const QPixmap pixmapValue = pixmap(Qt::ReturnByValue);
if (pixmapValue.isNull())
return QImage();
return pixmapValue.toImage().scaled(EXPORT_IMAGE_SIZE, EXPORT_IMAGE_SIZE);
#else
if (!pixmap()) if (!pixmap())
return QImage(); return QImage();
return pixmap()->toImage().scaled(EXPORT_IMAGE_SIZE, EXPORT_IMAGE_SIZE); return pixmap()->toImage().scaled(EXPORT_IMAGE_SIZE, EXPORT_IMAGE_SIZE);
#endif
} }
void QRImageWidget::mousePressEvent(QMouseEvent* event) void QRImageWidget::mousePressEvent(QMouseEvent* event)
{ {
if (event->button() == Qt::LeftButton && pixmap()) { #if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
const bool hasPixmap = !pixmap(Qt::ReturnByValue).isNull();
#else
const bool hasPixmap = pixmap();
#endif
if (event->button() == Qt::LeftButton && hasPixmap) {
event->accept(); event->accept();
QMimeData* mimeData = new QMimeData; QMimeData* mimeData = new QMimeData;
mimeData->setImageData(exportImage()); mimeData->setImageData(exportImage());
@@ -62,8 +74,13 @@ void QRImageWidget::mousePressEvent(QMouseEvent* event)
void QRImageWidget::saveImage() void QRImageWidget::saveImage()
{ {
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
if (pixmap(Qt::ReturnByValue).isNull())
return;
#else
if (!pixmap()) if (!pixmap())
return; return;
#endif
QString fn = GUIUtil::getSaveFileName(this, tr("Save QR Code"), QString(), tr("PNG Image (*.png)"), NULL); QString fn = GUIUtil::getSaveFileName(this, tr("Save QR Code"), QString(), tr("PNG Image (*.png)"), NULL);
if (!fn.isEmpty()) { if (!fn.isEmpty()) {
exportImage().save(fn); exportImage().save(fn);
@@ -72,15 +89,25 @@ void QRImageWidget::saveImage()
void QRImageWidget::copyImage() void QRImageWidget::copyImage()
{ {
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
if (pixmap(Qt::ReturnByValue).isNull())
return;
#else
if (!pixmap()) if (!pixmap())
return; return;
#endif
QApplication::clipboard()->setImage(exportImage()); QApplication::clipboard()->setImage(exportImage());
} }
void QRImageWidget::contextMenuEvent(QContextMenuEvent* event) void QRImageWidget::contextMenuEvent(QContextMenuEvent* event)
{ {
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
if (pixmap(Qt::ReturnByValue).isNull())
return;
#else
if (!pixmap()) if (!pixmap())
return; return;
#endif
contextMenu->exec(event->globalPos()); contextMenu->exec(event->globalPos());
} }
+2 -1
View File
@@ -11,6 +11,7 @@
#include "optionsmodel.h" #include "optionsmodel.h"
#include "streams.h" #include "streams.h"
#include <algorithm>
RecentRequestsTableModel::RecentRequestsTableModel(CWallet* wallet, WalletModel* parent) : walletModel(parent) RecentRequestsTableModel::RecentRequestsTableModel(CWallet* wallet, WalletModel* parent) : walletModel(parent)
{ {
@@ -198,7 +199,7 @@ void RecentRequestsTableModel::addNewRequest(RecentRequestEntry& recipient)
void RecentRequestsTableModel::sort(int column, Qt::SortOrder order) void RecentRequestsTableModel::sort(int column, Qt::SortOrder order)
{ {
qSort(list.begin(), list.end(), RecentRequestEntryLessThan(column, order)); std::sort(list.begin(), list.end(), RecentRequestEntryLessThan(column, order));
emit dataChanged(index(0, 0, QModelIndex()), index(list.size() - 1, NUMBER_OF_COLUMNS - 1, QModelIndex())); emit dataChanged(index(0, 0, QModelIndex()), index(list.size() - 1, NUMBER_OF_COLUMNS - 1, QModelIndex()));
} }
+16
View File
@@ -20,7 +20,9 @@
#include <QApplication> #include <QApplication>
#include <QCloseEvent> #include <QCloseEvent>
#include <QDesktopWidget> #include <QDesktopWidget>
#include <QGuiApplication>
#include <QPainter> #include <QPainter>
#include <QScreen>
SplashScreen::SplashScreen(Qt::WindowFlags f, const NetworkStyle* networkStyle) : QWidget(0, f), curAlignment(0) SplashScreen::SplashScreen(Qt::WindowFlags f, const NetworkStyle* networkStyle) : QWidget(0, f), curAlignment(0)
{ {
@@ -52,7 +54,11 @@ SplashScreen::SplashScreen(Qt::WindowFlags f, const NetworkStyle* networkStyle)
// check font size and drawing with // check font size and drawing with
pixPaint.setFont(QFont(font, 28 * fontFactor)); pixPaint.setFont(QFont(font, 28 * fontFactor));
QFontMetrics fm = pixPaint.fontMetrics(); QFontMetrics fm = pixPaint.fontMetrics();
#if QT_VERSION >= QT_VERSION_CHECK(5, 11, 0)
int titleTextWidth = fm.horizontalAdvance(titleText);
#else
int titleTextWidth = fm.width(titleText); int titleTextWidth = fm.width(titleText);
#endif
if (titleTextWidth > 160) { if (titleTextWidth > 160) {
// strange font rendering, Arial probably not found // strange font rendering, Arial probably not found
fontFactor = 0.75; fontFactor = 0.75;
@@ -79,7 +85,11 @@ SplashScreen::SplashScreen(Qt::WindowFlags f, const NetworkStyle* networkStyle)
boldFont.setWeight(QFont::Bold); boldFont.setWeight(QFont::Bold);
pixPaint.setFont(boldFont); pixPaint.setFont(boldFont);
fm = pixPaint.fontMetrics(); fm = pixPaint.fontMetrics();
#if QT_VERSION >= QT_VERSION_CHECK(5, 11, 0)
int titleAddTextWidth = fm.horizontalAdvance(titleAddText);
#else
int titleAddTextWidth = fm.width(titleAddText); int titleAddTextWidth = fm.width(titleAddText);
#endif
pixPaint.drawText(pixmap.width() - titleAddTextWidth - 10, pixmap.height() - 25, titleAddText); pixPaint.drawText(pixmap.width() - titleAddTextWidth - 10, pixmap.height() - 25, titleAddText);
} }
@@ -92,7 +102,13 @@ SplashScreen::SplashScreen(Qt::WindowFlags f, const NetworkStyle* networkStyle)
QRect r(QPoint(), pixmap.size()); QRect r(QPoint(), pixmap.size());
resize(r.size()); resize(r.size());
setFixedSize(r.size()); setFixedSize(r.size());
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
QScreen* screenHandle = QGuiApplication::primaryScreen();
QRect screen = screenHandle ? screenHandle->geometry() : QRect(QPoint(), r.size());
move(screen.center() - r.center());
#else
move(QApplication::desktop()->screenGeometry().center() - r.center()); move(QApplication::desktop()->screenGeometry().center() - r.center());
#endif
subscribeToCoreSignals(); subscribeToCoreSignals();
} }
+1
View File
@@ -8,6 +8,7 @@
#include <QColor> #include <QColor>
#include <QPainter> #include <QPainter>
#include <QPainterPath>
#include <QTimer> #include <QTimer>
#include <cmath> #include <cmath>
+2 -2
View File
@@ -254,14 +254,14 @@ QString TransactionDesc::toHTML(CWallet* wallet, CWalletTx& wtx, TransactionReco
strHTML += "<b>" + tr("Output index") + ":</b> " + QString::number(rec->getOutputIndex()) + "<br>"; strHTML += "<b>" + tr("Output index") + ":</b> " + QString::number(rec->getOutputIndex()) + "<br>";
// Message from normal agrarian:URI (agrarian:XyZ...?message=example) // Message from normal agrarian:URI (agrarian:XyZ...?message=example)
foreach (const PAIRTYPE(string, string) & r, wtx.vOrderForm) for (const auto& r : wtx.vOrderForm)
if (r.first == "Message") if (r.first == "Message")
strHTML += "<br><b>" + tr("Message") + ":</b><br>" + GUIUtil::HtmlEscape(r.second, true) + "<br>"; strHTML += "<br><b>" + tr("Message") + ":</b><br>" + GUIUtil::HtmlEscape(r.second, true) + "<br>";
// //
// PaymentRequest info: // PaymentRequest info:
// //
foreach (const PAIRTYPE(string, string) & r, wtx.vOrderForm) { for (const auto& r : wtx.vOrderForm) {
if (r.first == "PaymentRequest") { if (r.first == "PaymentRequest") {
PaymentRequestPlus req; PaymentRequestPlus req;
req.parse(QByteArray::fromRawData(r.second.data(), r.second.size())); req.parse(QByteArray::fromRawData(r.second.data(), r.second.size()));
+1 -1
View File
@@ -217,7 +217,7 @@ QList<TransactionRecord> TransactionRecord::decomposeTransaction(const CWallet*
if (fAllToMe > mine) fAllToMe = mine; if (fAllToMe > mine) fAllToMe = mine;
} }
if (fAllFromMeDenom && fAllToMeDenom && nFromMe * nToMe) { if (fAllFromMeDenom && fAllToMeDenom && nFromMe && nToMe) {
parts.append(TransactionRecord(hash, nTime, TransactionRecord::ObfuscationDenominate, "", -nDebit, nCredit)); parts.append(TransactionRecord(hash, nTime, TransactionRecord::ObfuscationDenominate, "", -nDebit, nCredit));
parts.last().involvesWatchAddress = false; // maybe pass to TransactionRecord as constructor argument parts.last().involvesWatchAddress = false; // maybe pass to TransactionRecord as constructor argument
} else if (fAllFromMe && fAllToMe) { } else if (fAllFromMe && fAllToMe) {
+4 -2
View File
@@ -20,6 +20,8 @@
#include "util.h" #include "util.h"
#include "wallet/wallet.h" #include "wallet/wallet.h"
#include <algorithm>
#include <QColor> #include <QColor>
#include <QDateTime> #include <QDateTime>
#include <QDebug> #include <QDebug>
@@ -95,9 +97,9 @@ public:
qDebug() << "TransactionTablePriv::updateWallet : " + QString::fromStdString(hash.ToString()) + " " + QString::number(status); qDebug() << "TransactionTablePriv::updateWallet : " + QString::fromStdString(hash.ToString()) + " " + QString::number(status);
// Find bounds of this transaction in model // Find bounds of this transaction in model
QList<TransactionRecord>::iterator lower = qLowerBound( QList<TransactionRecord>::iterator lower = std::lower_bound(
cachedWallet.begin(), cachedWallet.end(), hash, TxLessThan()); cachedWallet.begin(), cachedWallet.end(), hash, TxLessThan());
QList<TransactionRecord>::iterator upper = qUpperBound( QList<TransactionRecord>::iterator upper = std::upper_bound(
cachedWallet.begin(), cachedWallet.end(), hash, TxLessThan()); cachedWallet.begin(), cachedWallet.end(), hash, TxLessThan());
int lowerIndex = (lower - cachedWallet.begin()); int lowerIndex = (lower - cachedWallet.begin());
int upperIndex = (upper - cachedWallet.begin()); int upperIndex = (upper - cachedWallet.begin());
+10 -9
View File
@@ -33,6 +33,7 @@
#include <QSettings> #include <QSettings>
#include <QSignalMapper> #include <QSignalMapper>
#include <QTableView> #include <QTableView>
#include <QTime>
#include <QUrl> #include <QUrl>
#include <QVBoxLayout> #include <QVBoxLayout>
@@ -230,7 +231,7 @@ void TransactionView::setModel(WalletModel* model)
if (model->getOptionsModel()) { if (model->getOptionsModel()) {
// Add third party transaction URLs to context menu // Add third party transaction URLs to context menu
QStringList listUrls = model->getOptionsModel()->getThirdPartyTxUrls().split("|", QString::SkipEmptyParts); QStringList listUrls = model->getOptionsModel()->getThirdPartyTxUrls().split("|", Qt::SkipEmptyParts);
for (int i = 0; i < listUrls.size(); ++i) { for (int i = 0; i < listUrls.size(); ++i) {
QString host = QUrl(listUrls[i].trimmed(), QUrl::StrictMode).host(); QString host = QUrl(listUrls[i].trimmed(), QUrl::StrictMode).host();
if (!host.isEmpty()) { if (!host.isEmpty()) {
@@ -275,30 +276,30 @@ void TransactionView::chooseDate(int idx)
break; break;
case Today: case Today:
transactionProxyModel->setDateRange( transactionProxyModel->setDateRange(
QDateTime(current), QDateTime(current, QTime(0, 0)),
TransactionFilterProxy::MAX_DATE); TransactionFilterProxy::MAX_DATE);
break; break;
case ThisWeek: { case ThisWeek: {
// Find last Monday // Find last Monday
QDate startOfWeek = current.addDays(-(current.dayOfWeek() - 1)); QDate startOfWeek = current.addDays(-(current.dayOfWeek() - 1));
transactionProxyModel->setDateRange( transactionProxyModel->setDateRange(
QDateTime(startOfWeek), QDateTime(startOfWeek, QTime(0, 0)),
TransactionFilterProxy::MAX_DATE); TransactionFilterProxy::MAX_DATE);
} break; } break;
case ThisMonth: case ThisMonth:
transactionProxyModel->setDateRange( transactionProxyModel->setDateRange(
QDateTime(QDate(current.year(), current.month(), 1)), QDateTime(QDate(current.year(), current.month(), 1), QTime(0, 0)),
TransactionFilterProxy::MAX_DATE); TransactionFilterProxy::MAX_DATE);
break; break;
case LastMonth: case LastMonth:
transactionProxyModel->setDateRange( transactionProxyModel->setDateRange(
QDateTime(QDate(current.year(), current.month() - 1, 1)), QDateTime(QDate(current.year(), current.month() - 1, 1), QTime(0, 0)),
QDateTime(QDate(current.year(), current.month(), 1))); QDateTime(QDate(current.year(), current.month(), 1), QTime(0, 0)));
break; break;
case ThisYear: case ThisYear:
transactionProxyModel->setDateRange( transactionProxyModel->setDateRange(
QDateTime(QDate(current.year(), 1, 1)), QDateTime(QDate(current.year(), 1, 1), QTime(0, 0)),
TransactionFilterProxy::MAX_DATE); TransactionFilterProxy::MAX_DATE);
break; break;
case Range: case Range:
@@ -565,8 +566,8 @@ void TransactionView::dateRangeChanged()
if (!transactionProxyModel) if (!transactionProxyModel)
return; return;
transactionProxyModel->setDateRange( transactionProxyModel->setDateRange(
QDateTime(dateFrom->date()), QDateTime(dateFrom->date(), QTime(0, 0)),
QDateTime(dateTo->date()).addDays(1)); QDateTime(dateTo->date(), QTime(0, 0)).addDays(1));
} }
void TransactionView::focusTransaction(const QModelIndex& idx) void TransactionView::focusTransaction(const QModelIndex& idx)
+1 -1
View File
@@ -44,7 +44,7 @@ class ShutdownWindow : public QWidget
Q_OBJECT Q_OBJECT
public: public:
ShutdownWindow(QWidget* parent = 0, Qt::WindowFlags f = 0); ShutdownWindow(QWidget* parent = 0, Qt::WindowFlags f = Qt::WindowFlags());
static void showShutdownWindow(BitcoinGUI* window); static void showShutdownWindow(BitcoinGUI* window);
protected: protected:
+2 -2
View File
@@ -769,8 +769,8 @@ void WalletModel::listZerocoinMints(std::set<CMintMeta>& setMints, bool fUnusedO
void WalletModel::loadReceiveRequests(std::vector<std::string>& vReceiveRequests) void WalletModel::loadReceiveRequests(std::vector<std::string>& vReceiveRequests)
{ {
LOCK(wallet->cs_wallet); LOCK(wallet->cs_wallet);
for (const PAIRTYPE(CTxDestination, CAddressBookData) & item : wallet->mapAddressBook) for (const auto& item : wallet->mapAddressBook)
for (const PAIRTYPE(std::string, std::string) & item2 : item.second.destdata) for (const auto& item2 : item.second.destdata)
if (item2.first.size() > 2 && item2.first.substr(0, 2) == "rr") // receive request if (item2.first.size() > 2 && item2.first.substr(0, 2) == "rr") // receive request
vReceiveRequests.push_back(item2.second); vReceiveRequests.push_back(item2.second);
} }
+1
View File
@@ -377,6 +377,7 @@ protected:
public: public:
CScript() { } CScript() { }
CScript(const CScript& b) : std::vector<unsigned char>(b.begin(), b.end()) { } CScript(const CScript& b) : std::vector<unsigned char>(b.begin(), b.end()) { }
CScript& operator=(const CScript& b) = default;
CScript(const_iterator pbegin, const_iterator pend) : std::vector<unsigned char>(pbegin, pend) { } CScript(const_iterator pbegin, const_iterator pend) : std::vector<unsigned char>(pbegin, pend) { }
CScript(const unsigned char* pbegin, const unsigned char* pend) : std::vector<unsigned char>(pbegin, pend) { } CScript(const unsigned char* pbegin, const unsigned char* pend) : std::vector<unsigned char>(pbegin, pend) { }
+1 -1
View File
@@ -85,7 +85,7 @@ bool Solver(const CScript& scriptPubKey, txnouttype& typeRet, vector<vector<unsi
// Scan templates // Scan templates
const CScript& script1 = scriptPubKey; const CScript& script1 = scriptPubKey;
for (const PAIRTYPE(txnouttype, CScript)& tplate : mTemplates) for (const auto& tplate : mTemplates)
{ {
const CScript& script2 = tplate.second; const CScript& script2 = tplate.second;
vSolutionsRet.clear(); vSolutionsRet.clear();
+1
View File
@@ -50,6 +50,7 @@ public:
CTxMemPoolEntry(const CTransaction& _tx, const CAmount& _nFee, int64_t _nTime, double _dPriority, unsigned int _nHeight); CTxMemPoolEntry(const CTransaction& _tx, const CAmount& _nFee, int64_t _nTime, double _dPriority, unsigned int _nHeight);
CTxMemPoolEntry(); CTxMemPoolEntry();
CTxMemPoolEntry(const CTxMemPoolEntry& other); CTxMemPoolEntry(const CTxMemPoolEntry& other);
CTxMemPoolEntry& operator=(const CTxMemPoolEntry& other) = default;
const CTransaction& GetTx() const { return this->tx; } const CTransaction& GetTx() const { return this->tx; }
double GetPriority(unsigned int currentHeight) const; double GetPriority(unsigned int currentHeight) const;
+1 -1
View File
@@ -557,7 +557,7 @@ bool TryCreateDirectory(const boost::filesystem::path& p)
{ {
try { try {
return boost::filesystem::create_directory(p); return boost::filesystem::create_directory(p);
} catch (boost::filesystem::filesystem_error) { } catch (const boost::filesystem::filesystem_error&) {
if (!boost::filesystem::exists(p) || !boost::filesystem::is_directory(p)) if (!boost::filesystem::exists(p) || !boost::filesystem::is_directory(p))
throw; throw;
} }
-2
View File
@@ -29,8 +29,6 @@
using namespace std; using namespace std;
void EnsureWalletIsUnlocked(bool fAllowAnonOnly);
std::string static EncodeDumpTime(int64_t nTime) std::string static EncodeDumpTime(int64_t nTime)
{ {
return DateTimeStrFormat("%Y-%m-%dT%H:%M:%SZ", nTime); return DateTimeStrFormat("%Y-%m-%dT%H:%M:%SZ", nTime);
+5 -5
View File
@@ -68,7 +68,7 @@ void WalletTxToJSON(const CWalletTx& wtx, UniValue& entry)
entry.push_back(Pair("walletconflicts", conflicts)); entry.push_back(Pair("walletconflicts", conflicts));
entry.push_back(Pair("time", wtx.GetTxTime())); entry.push_back(Pair("time", wtx.GetTxTime()));
entry.push_back(Pair("timereceived", (int64_t)wtx.nTimeReceived)); entry.push_back(Pair("timereceived", (int64_t)wtx.nTimeReceived));
for (const PAIRTYPE(string, string) & item : wtx.mapValue) for (const auto& item : wtx.mapValue)
entry.push_back(Pair(item.first, item.second)); entry.push_back(Pair(item.first, item.second));
} }
@@ -312,7 +312,7 @@ UniValue getaddressesbyaccount(const UniValue& params, bool fHelp)
// Find all addresses that have the given account // Find all addresses that have the given account
UniValue ret(UniValue::VARR); UniValue ret(UniValue::VARR);
for (const PAIRTYPE(CBitcoinAddress, CAddressBookData) & item : pwalletMain->mapAddressBook) { for (const auto& item : pwalletMain->mapAddressBook) {
const CBitcoinAddress& address = item.first; const CBitcoinAddress& address = item.first;
const string& strName = item.second.name; const string& strName = item.second.name;
if (strName == strAccount) if (strName == strAccount)
@@ -1109,7 +1109,7 @@ UniValue ListReceived(const UniValue& params, bool fByAccounts)
// Reply // Reply
UniValue ret(UniValue::VARR); UniValue ret(UniValue::VARR);
map<string, tallyitem> mapAccountTally; map<string, tallyitem> mapAccountTally;
for (const PAIRTYPE(CBitcoinAddress, CAddressBookData) & item : pwalletMain->mapAddressBook) { for (const auto& item : pwalletMain->mapAddressBook) {
const CBitcoinAddress& address = item.first; const CBitcoinAddress& address = item.first;
const string& strAccount = item.second.name; const string& strAccount = item.second.name;
map<CBitcoinAddress, tallyitem>::iterator it = mapTally.find(address); map<CBitcoinAddress, tallyitem>::iterator it = mapTally.find(address);
@@ -1483,7 +1483,7 @@ UniValue listaccounts(const UniValue& params, bool fHelp)
includeWatchonly = includeWatchonly | ISMINE_WATCH_ONLY; includeWatchonly = includeWatchonly | ISMINE_WATCH_ONLY;
map<string, CAmount> mapAccountBalances; map<string, CAmount> mapAccountBalances;
for (const PAIRTYPE(CTxDestination, CAddressBookData) & entry : pwalletMain->mapAddressBook) { for (const auto& entry : pwalletMain->mapAddressBook) {
if (IsMine(*pwalletMain, entry.first) & includeWatchonly) // This address belongs to me if (IsMine(*pwalletMain, entry.first) & includeWatchonly) // This address belongs to me
mapAccountBalances[entry.second.name] = 0; mapAccountBalances[entry.second.name] = 0;
} }
@@ -1515,7 +1515,7 @@ UniValue listaccounts(const UniValue& params, bool fHelp)
mapAccountBalances[entry.strAccount] += entry.nCreditDebit; mapAccountBalances[entry.strAccount] += entry.nCreditDebit;
UniValue ret(UniValue::VOBJ); UniValue ret(UniValue::VOBJ);
for (const PAIRTYPE(string, CAmount) & accountBalance : mapAccountBalances) { for (const auto& accountBalance : mapAccountBalances) {
ret.push_back(Pair(accountBalance.first, ValueFromAmount(accountBalance.second))); ret.push_back(Pair(accountBalance.first, ValueFromAmount(accountBalance.second)));
} }
return ret; return ret;
+2 -3
View File
@@ -2673,7 +2673,7 @@ bool CWallet::DelAddressBook(const CTxDestination& address)
if (fFileBacked) { if (fFileBacked) {
// Delete destdata tuples associated with address // Delete destdata tuples associated with address
std::string strAddress = CBitcoinAddress(address).ToString(); std::string strAddress = CBitcoinAddress(address).ToString();
for (const PAIRTYPE(string, string) & item : mapAddressBook[address].destdata) { for (const auto& item : mapAddressBook[address].destdata) {
CWalletDB(strWalletFile).EraseDestData(strAddress, item.first); CWalletDB(strWalletFile).EraseDestData(strAddress, item.first);
} }
} }
@@ -2959,7 +2959,7 @@ set<CTxDestination> CWallet::GetAccountAddresses(string strAccount) const
{ {
LOCK(cs_wallet); LOCK(cs_wallet);
set<CTxDestination> result; set<CTxDestination> result;
for (const PAIRTYPE(CTxDestination, CAddressBookData) & item : mapAddressBook) { for (const auto& item : mapAddressBook) {
const CTxDestination& address = item.first; const CTxDestination& address = item.first;
const string& strName = item.second.name; const string& strName = item.second.name;
if (strName == strAccount) if (strName == strAccount)
@@ -5075,4 +5075,3 @@ void CWallet::PrecomputeSpends()
MilliSleep(5000); MilliSleep(5000);
} }
} }
+8 -8
View File
@@ -592,11 +592,11 @@ bool GenerateAccumulatorWitness(CoinWitnessData* coinWitness, AccumulatorMap& ma
return true; return true;
// TODO: I know that could merge all of this exception but maybe it's not really good.. think if we should have a different treatment for each one // TODO: I know that could merge all of this exception but maybe it's not really good.. think if we should have a different treatment for each one
} catch (searchMintHeightException e) { } catch (const searchMintHeightException& e) {
return error("%s: searchMintHeightException: %s", __func__, e.message); return error("%s: searchMintHeightException: %s", __func__, e.message);
} catch (ChecksumInDbNotFoundException e) { } catch (const ChecksumInDbNotFoundException& e) {
return error("%s: ChecksumInDbNotFoundException: %s", __func__, e.message); return error("%s: ChecksumInDbNotFoundException: %s", __func__, e.message);
} catch (GetPubcoinException e) { } catch (const GetPubcoinException& e) {
return error("%s: GetPubcoinException: %s", __func__, e.message); return error("%s: GetPubcoinException: %s", __func__, e.message);
} }
} }
@@ -790,9 +790,9 @@ bool CalculateAccumulatorWitnessFor(
return true; return true;
} catch (ChecksumInDbNotFoundException e) { } catch (const ChecksumInDbNotFoundException& e) {
return error("%s: ChecksumInDbNotFoundException: %s", __func__, e.message); return error("%s: ChecksumInDbNotFoundException: %s", __func__, e.message);
} catch (GetPubcoinException e) { } catch (const GetPubcoinException& e) {
return error("%s: GetPubcoinException: %s", __func__, e.message); return error("%s: GetPubcoinException: %s", __func__, e.message);
} }
} }
@@ -877,11 +877,11 @@ bool GenerateAccumulatorWitness(
return true; return true;
// TODO: I know that could merge all of this exception but maybe it's not really good.. think if we should have a different treatment for each one // TODO: I know that could merge all of this exception but maybe it's not really good.. think if we should have a different treatment for each one
} catch (searchMintHeightException e) { } catch (const searchMintHeightException& e) {
return error("%s: searchMintHeightException: %s", __func__, e.message); return error("%s: searchMintHeightException: %s", __func__, e.message);
} catch (ChecksumInDbNotFoundException e) { } catch (const ChecksumInDbNotFoundException& e) {
return error("%s: ChecksumInDbNotFoundException: %s", __func__, e.message); return error("%s: ChecksumInDbNotFoundException: %s", __func__, e.message);
} catch (GetPubcoinException e) { } catch (const GetPubcoinException& e) {
return error("%s: GetPubcoinException: %s", __func__, e.message); return error("%s: GetPubcoinException: %s", __func__, e.message);
} }
} }