Update stake miner GUI
authorCryptoManiac <balthazar@yandex.ru>
Fri, 20 Jun 2014 16:55:12 +0000 (20:55 +0400)
committerCryptoManiac <balthazar@yandex.ru>
Thu, 10 Jul 2014 18:36:23 +0000 (22:36 +0400)
* Remove suspend notification string from status bar;
* Force icon update after unlocking.

Conflicts:

src/main.cpp
src/miner.cpp

src/main.cpp
src/miner.cpp
src/qt/bitcoingui.cpp

index 090dd4b..44444a7 100644 (file)
@@ -2997,9 +2997,6 @@ bool LoadExternalBlockFile(FILE* fileIn)
 extern map<uint256, CAlert> mapAlerts;
 extern CCriticalSection cs_mapAlerts;
 
-extern string strMintMessage;
-extern string strMintWarning;
-
 string GetWarnings(string strFor)
 {
     int nPriority = 0;
@@ -3009,13 +3006,6 @@ string GetWarnings(string strFor)
     if (GetBoolArg("-testsafemode"))
         strRPC = "test";
 
-    // wallet lock warning for minting
-    if (strMintWarning != "")
-    {
-        nPriority = 0;
-        strStatusBar = strMintWarning;
-    }
-
     // Misc warnings like out of disk space and clock is wrong
     if (strMiscWarning != "")
     {
index 9926765..386155b 100644 (file)
@@ -15,9 +15,6 @@ using namespace std;
 // BitcoinMiner
 //
 
-string strMintMessage = "Stake miner suspended due to locked wallet.";
-string strMintWarning;
-
 extern unsigned int nMinerSleep;
 
 int static FormatHashBlocks(void* pbuffer, unsigned int len)
@@ -531,7 +528,6 @@ void StakeMiner(CWallet *pwallet)
 
         while (pwallet->IsLocked())
         {
-            strMintWarning = strMintMessage;
             Sleep(1000);
             if (fShutdown)
                 return;
@@ -544,8 +540,6 @@ void StakeMiner(CWallet *pwallet)
                 return;
         }
 
-        strMintWarning = "";
-
         //
         // Create new block
         //
@@ -559,7 +553,6 @@ void StakeMiner(CWallet *pwallet)
         // Trying to sign a block
         if (pblock->SignBlock(*pwallet))
         {
-            strMintWarning = _("Stake generation: new block found!");
             SetThreadPriority(THREAD_PRIORITY_NORMAL);
             CheckStake(pblock.get(), *pwallet);
             SetThreadPriority(THREAD_PRIORITY_LOWEST);
index c6d4b41..3979b90 100644 (file)
@@ -124,8 +124,8 @@ BitcoinGUI::BitcoinGUI(QWidget *parent):
     // Status bar notification icons
     QFrame *frameBlocks = new QFrame();
     frameBlocks->setContentsMargins(0,0,0,0);
-    frameBlocks->setMinimumWidth(56);
-    frameBlocks->setMaximumWidth(56);
+    frameBlocks->setMinimumWidth(72);
+    frameBlocks->setMaximumWidth(72);
     QHBoxLayout *frameBlocksLayout = new QHBoxLayout(frameBlocks);
     frameBlocksLayout->setContentsMargins(3,0,3,0);
     frameBlocksLayout->setSpacing(3);
@@ -395,6 +395,7 @@ void BitcoinGUI::setWalletModel(WalletModel *walletModel)
 
         setEncryptionStatus(walletModel->getEncryptionStatus());
         connect(walletModel, SIGNAL(encryptionStatusChanged(int)), this, SLOT(setEncryptionStatus(int)));
+        connect(walletModel, SIGNAL(encryptionStatusChanged(int)), this, SLOT(updateMining()));
 
         // Balloon pop-up for new transaction
         connect(walletModel->getTransactionTableModel(), SIGNAL(rowsInserted(QModelIndex,int,int)),
@@ -597,13 +598,22 @@ void BitcoinGUI::updateMining()
     labelMiningIcon->setPixmap(QIcon(":/icons/mining_inactive").pixmap(STATUSBAR_ICONSIZE,STATUSBAR_ICONSIZE));
 
     if (!clientModel->getNumConnections())
+    {
         labelMiningIcon->setToolTip(tr("Wallet is offline"));
+        return;
+    }
 
     if (walletModel->getEncryptionStatus() == WalletModel::Locked)
+    {
         labelMiningIcon->setToolTip(tr("Wallet is locked"));
+        return;
+    }
 
     if (clientModel->inInitialBlockDownload() || clientModel->getNumBlocksOfPeers() > clientModel->getNumBlocks())
+    {
         labelMiningIcon->setToolTip(tr("Blockchain download is in progress"));
+        return;
+    }
 
     uint64 nMinWeight = 0, nMaxWeight = 0, nTotalWeight = 0;
     walletModel->getStakeWeight(nMinWeight, nMaxWeight, nTotalWeight);