Blackcoin Lore
This commit is contained in:
@@ -71,6 +71,9 @@ const std::string BitcoinGUI::DEFAULT_UIPLATFORM =
|
||||
|
||||
const QString BitcoinGUI::DEFAULT_WALLET = "~Default";
|
||||
|
||||
extern int64_t nLastCoinStakeSearchInterval;
|
||||
double GetPoSKernelPS();
|
||||
|
||||
BitcoinGUI::BitcoinGUI(const PlatformStyle *platformStyle, const NetworkStyle *networkStyle, QWidget *parent) :
|
||||
QMainWindow(parent),
|
||||
clientModel(0),
|
||||
@@ -79,6 +82,7 @@ BitcoinGUI::BitcoinGUI(const PlatformStyle *platformStyle, const NetworkStyle *n
|
||||
labelEncryptionIcon(0),
|
||||
labelConnectionsIcon(0),
|
||||
labelBlocksIcon(0),
|
||||
labelStakingIcon(0),
|
||||
progressBarLabel(0),
|
||||
progressBar(0),
|
||||
progressDialog(0),
|
||||
@@ -100,6 +104,8 @@ BitcoinGUI::BitcoinGUI(const PlatformStyle *platformStyle, const NetworkStyle *n
|
||||
encryptWalletAction(0),
|
||||
backupWalletAction(0),
|
||||
changePassphraseAction(0),
|
||||
unlockWalletAction(0),
|
||||
lockWalletAction(0),
|
||||
aboutQtAction(0),
|
||||
openRPCConsoleAction(0),
|
||||
openAction(0),
|
||||
@@ -193,6 +199,15 @@ BitcoinGUI::BitcoinGUI(const PlatformStyle *platformStyle, const NetworkStyle *n
|
||||
labelEncryptionIcon = new QLabel();
|
||||
labelConnectionsIcon = new QLabel();
|
||||
labelBlocksIcon = new QLabel();
|
||||
labelStakingIcon = new QLabel();
|
||||
// if (GetBoolArg("-staking", true))
|
||||
// {
|
||||
QTimer *timerStakingIcon = new QTimer(labelStakingIcon);
|
||||
connect(timerStakingIcon, SIGNAL(timeout()), this, SLOT(updateStakingIcon()));
|
||||
timerStakingIcon->start(30 * 1000);
|
||||
updateStakingIcon();
|
||||
// }
|
||||
|
||||
if(enableWallet)
|
||||
{
|
||||
frameBlocksLayout->addStretch();
|
||||
@@ -201,11 +216,14 @@ BitcoinGUI::BitcoinGUI(const PlatformStyle *platformStyle, const NetworkStyle *n
|
||||
frameBlocksLayout->addWidget(labelEncryptionIcon);
|
||||
}
|
||||
frameBlocksLayout->addStretch();
|
||||
frameBlocksLayout->addWidget(labelStakingIcon);
|
||||
frameBlocksLayout->addStretch();
|
||||
frameBlocksLayout->addWidget(labelConnectionsIcon);
|
||||
frameBlocksLayout->addStretch();
|
||||
frameBlocksLayout->addWidget(labelBlocksIcon);
|
||||
frameBlocksLayout->addStretch();
|
||||
|
||||
|
||||
// Progress bar and label for blocks download
|
||||
progressBarLabel = new QLabel();
|
||||
progressBarLabel->setVisible(false);
|
||||
@@ -332,6 +350,10 @@ void BitcoinGUI::createActions()
|
||||
backupWalletAction->setStatusTip(tr("Backup wallet to another location"));
|
||||
changePassphraseAction = new QAction(platformStyle->TextColorIcon(":/icons/key"), tr("&Change Passphrase..."), this);
|
||||
changePassphraseAction->setStatusTip(tr("Change the passphrase used for wallet encryption"));
|
||||
unlockWalletAction = new QAction(platformStyle->TextColorIcon(":/icons/lock_open"), tr("&Unlock Wallet..."), this);
|
||||
unlockWalletAction->setStatusTip(tr("Unlock wallet with passphrase used for wallet encryption"));
|
||||
lockWalletAction = new QAction(platformStyle->TextColorIcon(":/icons/lock_closed"), tr("&Lock Wallet"), this);
|
||||
lockWalletAction->setToolTip(tr("Lock wallet"));
|
||||
signMessageAction = new QAction(platformStyle->TextColorIcon(":/icons/edit"), tr("Sign &message..."), this);
|
||||
signMessageAction->setStatusTip(tr("Sign messages with your Bitcoin addresses to prove you own them"));
|
||||
verifyMessageAction = new QAction(platformStyle->TextColorIcon(":/icons/verify"), tr("&Verify message..."), this);
|
||||
@@ -368,6 +390,8 @@ void BitcoinGUI::createActions()
|
||||
connect(encryptWalletAction, SIGNAL(triggered(bool)), walletFrame, SLOT(encryptWallet(bool)));
|
||||
connect(backupWalletAction, SIGNAL(triggered()), walletFrame, SLOT(backupWallet()));
|
||||
connect(changePassphraseAction, SIGNAL(triggered()), walletFrame, SLOT(changePassphrase()));
|
||||
connect(unlockWalletAction, SIGNAL(triggered()), walletFrame, SLOT(unlockWallet()));
|
||||
connect(lockWalletAction, SIGNAL(triggered()), walletFrame, SLOT(lockWallet()));
|
||||
connect(signMessageAction, SIGNAL(triggered()), this, SLOT(gotoSignMessageTab()));
|
||||
connect(verifyMessageAction, SIGNAL(triggered()), this, SLOT(gotoVerifyMessageTab()));
|
||||
connect(usedSendingAddressesAction, SIGNAL(triggered()), walletFrame, SLOT(usedSendingAddresses()));
|
||||
@@ -410,6 +434,8 @@ void BitcoinGUI::createMenuBar()
|
||||
{
|
||||
settings->addAction(encryptWalletAction);
|
||||
settings->addAction(changePassphraseAction);
|
||||
settings->addAction(unlockWalletAction);
|
||||
settings->addAction(lockWalletAction);
|
||||
settings->addSeparator();
|
||||
}
|
||||
settings->addAction(optionsAction);
|
||||
@@ -517,6 +543,7 @@ void BitcoinGUI::setWalletActionsEnabled(bool enabled)
|
||||
encryptWalletAction->setEnabled(enabled);
|
||||
backupWalletAction->setEnabled(enabled);
|
||||
changePassphraseAction->setEnabled(enabled);
|
||||
unlockWalletAction->setEnabled(enabled);
|
||||
signMessageAction->setEnabled(enabled);
|
||||
verifyMessageAction->setEnabled(enabled);
|
||||
usedSendingAddressesAction->setEnabled(enabled);
|
||||
@@ -956,6 +983,8 @@ void BitcoinGUI::setEncryptionStatus(int status)
|
||||
encryptWalletAction->setChecked(false);
|
||||
changePassphraseAction->setEnabled(false);
|
||||
encryptWalletAction->setEnabled(true);
|
||||
unlockWalletAction->setVisible(false);
|
||||
lockWalletAction->setVisible(false);
|
||||
break;
|
||||
case WalletModel::Unlocked:
|
||||
labelEncryptionIcon->show();
|
||||
@@ -964,6 +993,8 @@ void BitcoinGUI::setEncryptionStatus(int status)
|
||||
encryptWalletAction->setChecked(true);
|
||||
changePassphraseAction->setEnabled(true);
|
||||
encryptWalletAction->setEnabled(false); // TODO: decrypt currently not supported
|
||||
unlockWalletAction->setVisible(false);
|
||||
lockWalletAction->setVisible(true);
|
||||
break;
|
||||
case WalletModel::Locked:
|
||||
labelEncryptionIcon->show();
|
||||
@@ -972,6 +1003,8 @@ void BitcoinGUI::setEncryptionStatus(int status)
|
||||
encryptWalletAction->setChecked(true);
|
||||
changePassphraseAction->setEnabled(true);
|
||||
encryptWalletAction->setEnabled(false); // TODO: decrypt currently not supported
|
||||
unlockWalletAction->setVisible(true);
|
||||
lockWalletAction->setVisible(false);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -1007,6 +1040,54 @@ void BitcoinGUI::toggleHidden()
|
||||
showNormalIfMinimized(true);
|
||||
}
|
||||
|
||||
void BitcoinGUI::updateStakingIcon()
|
||||
{
|
||||
if (walletFrame)
|
||||
nWeight = walletFrame->updateWeight();
|
||||
|
||||
if (nLastCoinStakeSearchInterval && nWeight)
|
||||
{
|
||||
uint64_t nWeight = this->nWeight;
|
||||
uint64_t nNetworkWeight = 1.1429 * GetPoSKernelPS();
|
||||
unsigned nEstimateTime = 1.0455 * 64 * nNetworkWeight / nWeight;
|
||||
|
||||
QString text;
|
||||
if (nEstimateTime < 60)
|
||||
{
|
||||
text = tr("%n second(s)", "", nEstimateTime);
|
||||
}
|
||||
else if (nEstimateTime < 60*60)
|
||||
{
|
||||
text = tr("%n minute(s)", "", nEstimateTime/60);
|
||||
}
|
||||
else if (nEstimateTime < 24*60*60)
|
||||
{
|
||||
text = tr("%n hour(s)", "", nEstimateTime/(60*60));
|
||||
}
|
||||
else
|
||||
{
|
||||
text = tr("%n day(s)", "", nEstimateTime/(60*60*24));
|
||||
}
|
||||
|
||||
nWeight /= COIN;
|
||||
nNetworkWeight /= COIN;
|
||||
labelStakingIcon->setPixmap(platformStyle->SingleColorIcon(":/icons/staking_on").pixmap(STATUSBAR_ICONSIZE,STATUSBAR_ICONSIZE));
|
||||
labelStakingIcon->setToolTip(tr("Staking.<br>Your weight is %1<br>Network weight is %2<br>Expected time to earn reward is %3").arg(nWeight).arg(nNetworkWeight).arg(text));
|
||||
}
|
||||
else
|
||||
{
|
||||
labelStakingIcon->setPixmap(platformStyle->SingleColorIcon(":/icons/staking_off").pixmap(STATUSBAR_ICONSIZE,STATUSBAR_ICONSIZE));
|
||||
if (vNodes.empty())
|
||||
labelStakingIcon->setToolTip(tr("Not staking because wallet is offline"));
|
||||
else if (IsInitialBlockDownload())
|
||||
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
|
||||
labelStakingIcon->setToolTip(tr("Not staking"));
|
||||
}
|
||||
}
|
||||
|
||||
void BitcoinGUI::detectShutdown()
|
||||
{
|
||||
if (ShutdownRequested())
|
||||
|
||||
Reference in New Issue
Block a user