Permalink
Browse files

Block Browser Cleanup

  • Loading branch information...
Tranz5 committed Sep 4, 2014
1 parent e3b09ff commit cf2f423b016eca1b85542049ca10d636a338d8b8
Showing with 48 additions and 97 deletions.
  1. +5 −92 src/qt/blockbrowser.cpp
  2. +0 −1 src/qt/blockbrowser.h
  3. +43 −4 src/qt/forms/blockbrowser.ui
View
@@ -16,28 +16,6 @@ double GetPoWMHashPS(const CBlockIndex* blockindex);
using namespace std;
double getBlockHardness(int64 height)
{
const CBlockIndex* blockindex = getBlockIndex(height);
int64 nShift = (blockindex->nBits >> 24) & 0xff;
double dDiff =
(double)0x0000ffff / (double)(blockindex->nBits & 0x00ffffff);
while (nShift < 29)
{
dDiff *= 256.0;
nShift++;
}
while (nShift > 29)
{
dDiff /= 256.0;
nShift--;
}
return dDiff;
}
const CBlockIndex* getBlockIndex(int64 height)
{
@@ -113,19 +91,6 @@ int64 getBlockNonce(int64 Height)
return pblockindex->nNonce;
}
std::string getBlockDebug(int64 Height)
{
std::string strHash = getBlockHash(Height);
uint256 hash(strHash);
if (mapBlockIndex.count(hash) == 0)
return 0;
CBlock block;
CBlockIndex* pblockindex = mapBlockIndex[hash];
return pblockindex->ToString();
}
int64 blocksInPastHours(int64 hours)
{
int64 wayback = hours * 3600;
@@ -307,77 +272,25 @@ void BlockBrowser::updateExplorer(bool block)
const CBlockIndex* pindex = getBlockIndex(height);
ui->heightLabelBE1->show();
ui->heightLabelBE1->setTextInteractionFlags(Qt::TextSelectableByMouse);
ui->heightLabelBE2->show();
ui->heightLabelBE1->setTextInteractionFlags(Qt::TextSelectableByMouse);
ui->hashLabel->show();
ui->hashLabel->setTextInteractionFlags(Qt::TextSelectableByMouse);
ui->hashBox->show();
ui->hashBox->setTextInteractionFlags(Qt::TextSelectableByMouse);
ui->merkleLabel->show();
ui->merkleLabel->setTextInteractionFlags(Qt::TextSelectableByMouse);
ui->merkleBox->show();
ui->merkleBox->setTextInteractionFlags(Qt::TextSelectableByMouse);
ui->nonceLabel->show();
ui->nonceLabel->setTextInteractionFlags(Qt::TextSelectableByMouse);
ui->nonceBox->show();
ui->nonceBox->setTextInteractionFlags(Qt::TextSelectableByMouse);
ui->bitsLabel->show();
ui->bitsLabel->setTextInteractionFlags(Qt::TextSelectableByMouse);
ui->bitsBox->show();
ui->bitsBox->setTextInteractionFlags(Qt::TextSelectableByMouse);
ui->timeLabel->show();
ui->timeLabel->setTextInteractionFlags(Qt::TextSelectableByMouse);
ui->timeBox->show();
ui->timeBox->setTextInteractionFlags(Qt::TextSelectableByMouse);
ui->hardLabel->show();
ui->hardLabel->setTextInteractionFlags(Qt::TextSelectableByMouse);
ui->hardBox->show();;
ui->hardBox->setTextInteractionFlags(Qt::TextSelectableByMouse);
ui->pawLabel->show();
ui->pawLabel->setTextInteractionFlags(Qt::TextSelectableByMouse);
ui->pawBox->show();
ui->pawBox->setTextInteractionFlags(Qt::TextSelectableByMouse);
ui->heightLabelBE1->setText(QString::number(height));
ui->hashBox->setText(QString::fromUtf8(getBlockHash(height).c_str()));
ui->merkleBox->setText(QString::fromUtf8(getBlockMerkle(height).c_str()));
ui->bitsBox->setText(QString::number(getBlocknBits(height)));
ui->nonceBox->setText(QString::number(getBlockNonce(height)));
ui->timeBox->setText(QString::fromUtf8(DateTimeStrFormat(getBlockTime(height)).c_str()));
ui->hardBox->setText(QString::number(GetDifficulty(pindex), 'f', 6)); // Tranz change name
ui->diffBox->setText(QString::number(GetDifficulty(pindex), 'f', 6));
if (pindex->IsProofOfStake()) {
ui->pawLabel->setText("Block Network Stake Weight");
ui->pawBox->setText(QString::number(GetPoSKernelPS(pindex), 'f', 3) + " "); //Tranz change name
ui->hashRateLabel->setText("Block Network Stake Weight");
ui->hashRateBox->setText(QString::number(GetPoSKernelPS(pindex), 'f', 3) + " ");
}
else {
ui->pawLabel->setText("Block Hash Rate");
ui->pawBox->setText(QString::number(GetPoWMHashPS(pindex), 'f', 3) + " MH/s");
ui->hashRateLabel->setText("Block Hash Rate");
ui->hashRateBox->setText(QString::number(GetPoWMHashPS(pindex), 'f', 3) + " MH/s");
}
}
if(block == false) {
std::string txid = ui->txBox->text().toUtf8().constData();
ui->txID->show();
ui->txID->setTextInteractionFlags(Qt::TextSelectableByMouse);
ui->txLabel->show();
ui->txLabel->setTextInteractionFlags(Qt::TextSelectableByMouse);
ui->valueLabel->show();
ui->valueLabel->setTextInteractionFlags(Qt::TextSelectableByMouse);
ui->valueBox->show();
ui->valueBox->setTextInteractionFlags(Qt::TextSelectableByMouse);
ui->inputLabel->show();
ui->inputLabel->setTextInteractionFlags(Qt::TextSelectableByMouse);
ui->inputBox->show();
ui->inputBox->setTextInteractionFlags(Qt::TextSelectableByMouse);
ui->outputLabel->show();
ui->outputLabel->setTextInteractionFlags(Qt::TextSelectableByMouse);
ui->outputBox->show();
ui->outputBox->setTextInteractionFlags(Qt::TextSelectableByMouse);
ui->feesLabel->show();
ui->feesLabel->setTextInteractionFlags(Qt::TextSelectableByMouse);
ui->feesBox->show();
ui->feesBox->setTextInteractionFlags(Qt::TextSelectableByMouse);
ui->valueBox->setText(QString::number(getTxTotalValue(txid), 'f', 6) + " HBN");
ui->txID->setText(QString::fromUtf8(txid.c_str()));
View
@@ -17,7 +17,6 @@
#include <QSettings>
#include <QSlider>
double getBlockHardness(int64);
double getTxTotalValue(std::string);
double convertCoins(int64);
int64 getBlockTime(int64);
@@ -146,10 +146,13 @@
</widget>
</item>
<item row="10" column="1">
<widget class="QLabel" name="pawBox">
<widget class="QLabel" name="hashRateBox">
<property name="text">
<string>0000 MH/s</string>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
<item row="14" column="0">
@@ -167,17 +170,23 @@
</widget>
</item>
<item row="9" column="1">
<widget class="QLabel" name="hardBox">
<widget class="QLabel" name="diffBox">
<property name="text">
<string>0.00</string>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
<item row="13" column="1">
<widget class="QLabel" name="txID">
<property name="text">
<string>000</string>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
<item row="17" column="1">
@@ -188,17 +197,23 @@
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
<item row="14" column="1">
<widget class="QLabel" name="valueBox">
<property name="text">
<string/>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
<item row="9" column="0">
<widget class="QLabel" name="hardLabel">
<widget class="QLabel" name="diffLabel">
<property name="text">
<string>Block Difficulty:</string>
</property>
@@ -229,6 +244,9 @@
<property name="text">
<string>0</string>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
<item row="1" column="1">
@@ -257,10 +275,13 @@
<property name="text">
<string/>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
<item row="10" column="0">
<widget class="QLabel" name="pawLabel">
<widget class="QLabel" name="hashRateLabel">
<property name="text">
<string>Block Hashrate:</string>
</property>
@@ -271,6 +292,9 @@
<property name="text">
<string>0</string>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
<item row="15" column="0">
@@ -292,6 +316,9 @@
<property name="text">
<string>0</string>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
<item row="5" column="1">
@@ -305,6 +332,9 @@
<property name="text">
<string>0x0</string>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
<item row="16" column="0">
@@ -325,6 +355,9 @@
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
<item row="6" column="0">
@@ -339,6 +372,9 @@
<property name="text">
<string>0</string>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
<item row="8" column="0">
@@ -368,6 +404,9 @@
<property name="text">
<string>0x0</string>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
<item row="12" column="0">

0 comments on commit cf2f423

Please sign in to comment.