Merge branch 'Blackcoin-Lore' of https://github.com/janko33bd/bitcoin.git into Blackcoin-Lore

This commit is contained in:
janko33bd
2018-01-13 23:12:04 +01:00
8 changed files with 30 additions and 41 deletions

View File

@@ -16,10 +16,13 @@
#include "platformstyle.h" #include "platformstyle.h"
#include "rpcconsole.h" #include "rpcconsole.h"
#include "utilitydialog.h" #include "utilitydialog.h"
#include "validation.h"
#include "rpc/server.h"
#ifdef ENABLE_WALLET #ifdef ENABLE_WALLET
#include "walletframe.h" #include "walletframe.h"
#include "walletmodel.h" #include "walletmodel.h"
#include "wallet/wallet.h"
#endif // ENABLE_WALLET #endif // ENABLE_WALLET
#ifdef Q_OS_MAC #ifdef Q_OS_MAC
@@ -222,9 +225,8 @@ BitcoinGUI::BitcoinGUI(const PlatformStyle *platformStyle, const NetworkStyle *n
{ {
QTimer *timerStakingIcon = new QTimer(labelStakingIcon); QTimer *timerStakingIcon = new QTimer(labelStakingIcon);
connect(timerStakingIcon, SIGNAL(timeout()), this, SLOT(updateStakingIcon())); connect(timerStakingIcon, SIGNAL(timeout()), this, SLOT(updateStakingIcon()));
QTimer::singleShot(1000, this, SLOT(updateStakingIcon()));
timerStakingIcon->start(30 * 1000); timerStakingIcon->start(30 * 1000);
updateStakingIcon();
} }
@@ -1090,10 +1092,29 @@ void BitcoinGUI::toggleHidden()
showNormalIfMinimized(true); showNormalIfMinimized(true);
} }
void BitcoinGUI::updateWeight()
{
if(!pwalletMain)
return;
TRY_LOCK(cs_main, lockMain);
if (!lockMain)
return;
TRY_LOCK(pwalletMain->cs_wallet, lockWallet);
if (!lockWallet)
return;
#ifdef ENABLE_WALLET
if (pwalletMain)
nWeight = pwalletMain->GetStakeWeight();
#endif
}
void BitcoinGUI::updateStakingIcon() void BitcoinGUI::updateStakingIcon()
{ {
if (walletFrame) updateWeight();
nWeight = walletFrame->updateWeight();
if (nLastCoinStakeSearchInterval && nWeight) if (nLastCoinStakeSearchInterval && nWeight)
{ {
@@ -1133,6 +1154,8 @@ void BitcoinGUI::updateStakingIcon()
labelStakingIcon->setToolTip(tr("Not staking because wallet is syncing")); labelStakingIcon->setToolTip(tr("Not staking because wallet is syncing"));
else if (!nWeight) else if (!nWeight)
labelStakingIcon->setToolTip(tr("Not staking because you don't have mature coins")); labelStakingIcon->setToolTip(tr("Not staking because you don't have mature coins"));
else if (pwalletMain && pwalletMain->IsLocked())
labelStakingIcon->setToolTip(tr("Not staking because wallet is locked"));
else else
labelStakingIcon->setToolTip(tr("Not staking")); labelStakingIcon->setToolTip(tr("Not staking"));
} }

View File

@@ -226,6 +226,8 @@ private Q_SLOTS:
/** Simply calls showNormalIfMinimized(true) for use in SLOT() macro */ /** Simply calls showNormalIfMinimized(true) for use in SLOT() macro */
void toggleHidden(); void toggleHidden();
void updateWeight();
void updateStakingIcon(); void updateStakingIcon();
/** called by a timer to check if fRequestShutdown has been set **/ /** called by a timer to check if fRequestShutdown has been set **/

View File

@@ -183,14 +183,6 @@ void WalletFrame::lockWallet()
walletView->lockWallet(); walletView->lockWallet();
} }
unsigned long long WalletFrame::updateWeight()
{
WalletView *walletView = currentWalletView();
if (walletView)
return walletView->updateWeight();
return 0;
}
void WalletFrame::usedSendingAddresses() void WalletFrame::usedSendingAddresses()
{ {
WalletView *walletView = currentWalletView(); WalletView *walletView = currentWalletView();

View File

@@ -76,8 +76,6 @@ public Q_SLOTS:
void lockWallet(); void lockWallet();
unsigned long long updateWeight();
/** Show used sending addresses */ /** Show used sending addresses */
void usedSendingAddresses(); void usedSendingAddresses();
/** Show used receiving addresses */ /** Show used receiving addresses */

View File

@@ -696,19 +696,3 @@ bool WalletModel::hdEnabled() const
{ {
return wallet->IsHDEnabled(); return wallet->IsHDEnabled();
} }
unsigned long long WalletModel::updateWeight()
{
if (!wallet)
return 0;
TRY_LOCK(cs_main, lockMain);
if (!lockMain)
return 0;
TRY_LOCK(wallet->cs_wallet, lockWallet);
if (!lockWallet)
return 0;
return wallet->GetStakeWeight();
}

View File

@@ -199,7 +199,6 @@ public:
void loadReceiveRequests(std::vector<std::string>& vReceiveRequests); void loadReceiveRequests(std::vector<std::string>& vReceiveRequests);
bool saveReceiveRequest(const std::string &sAddress, const int64_t nId, const std::string &sRequest); bool saveReceiveRequest(const std::string &sAddress, const int64_t nId, const std::string &sRequest);
unsigned long long updateWeight();
bool hdEnabled() const; bool hdEnabled() const;

View File

@@ -288,13 +288,6 @@ void WalletView::lockWallet()
walletModel->setWalletLocked(true); walletModel->setWalletLocked(true);
} }
unsigned long long WalletView::updateWeight()
{
if(walletModel)
return walletModel->updateWeight();
return 0;
}
void WalletView::usedSendingAddresses() void WalletView::usedSendingAddresses()
{ {
if(!walletModel) if(!walletModel)

View File

@@ -112,8 +112,6 @@ public Q_SLOTS:
/** Show progress dialog e.g. for rescan */ /** Show progress dialog e.g. for rescan */
void showProgress(const QString &title, int nProgress); void showProgress(const QString &title, int nProgress);
unsigned long long updateWeight();
Q_SIGNALS: Q_SIGNALS:
/** Signal that we want to show the main window */ /** Signal that we want to show the main window */
void showNormalIfMinimized(); void showNormalIfMinimized();