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 "rpcconsole.h"
#include "utilitydialog.h"
#include "validation.h"
#include "rpc/server.h"
#ifdef ENABLE_WALLET
#include "walletframe.h"
#include "walletmodel.h"
#include "wallet/wallet.h"
#endif // ENABLE_WALLET
#ifdef Q_OS_MAC
@@ -222,9 +225,8 @@ BitcoinGUI::BitcoinGUI(const PlatformStyle *platformStyle, const NetworkStyle *n
{
QTimer *timerStakingIcon = new QTimer(labelStakingIcon);
connect(timerStakingIcon, SIGNAL(timeout()), this, SLOT(updateStakingIcon()));
QTimer::singleShot(1000, this, SLOT(updateStakingIcon()));
timerStakingIcon->start(30 * 1000);
updateStakingIcon();
}
@@ -1090,10 +1092,29 @@ void BitcoinGUI::toggleHidden()
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()
{
if (walletFrame)
nWeight = walletFrame->updateWeight();
updateWeight();
if (nLastCoinStakeSearchInterval && nWeight)
{
@@ -1133,6 +1154,8 @@ void BitcoinGUI::updateStakingIcon()
labelStakingIcon->setToolTip(tr("Not staking because wallet is syncing"));
else if (!nWeight)
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
labelStakingIcon->setToolTip(tr("Not staking"));
}

View File

@@ -225,6 +225,8 @@ private Q_SLOTS:
void showNormalIfMinimized(bool fToggleHidden = false);
/** Simply calls showNormalIfMinimized(true) for use in SLOT() macro */
void toggleHidden();
void updateWeight();
void updateStakingIcon();

View File

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

View File

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

View File

@@ -695,20 +695,4 @@ bool WalletModel::abandonTransaction(uint256 hash) const
bool WalletModel::hdEnabled() const
{
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);
bool saveReceiveRequest(const std::string &sAddress, const int64_t nId, const std::string &sRequest);
unsigned long long updateWeight();
bool hdEnabled() const;

View File

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

View File

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