Skip to content

Commit

Permalink
Built in explorer added to YACoin-Qt!
Browse files Browse the repository at this point in the history
Added a "mode-less" block chain explorer to YACoin-Qt.  Added some
"missing" close buttons to a few dialogs.  Pretty-ed up the About
dialog,  Made the "selected" text visible!  Blocked the ability to play
around in Qt before the splash screen ends, since it can cause Qt to
crash, in Windows at least!  Centered the text in the splash screen.
One icon and two source files and three Qt form .ui files added..  Not
tested on Mac or linux, but easy enough, see bitcoingui.cpp

This is a first pass as it were to show how easy it is to add this
functionality.  Modify it to show hat you want to see.  Note the
tooltips, shortcuts and other subtle "touches" made to make the Qt
"experience" more SAA CUA compatible.
  • Loading branch information
ya-old-c-coder committed Dec 13, 2014
1 parent 6f23d92 commit 7142482
Show file tree
Hide file tree
Showing 22 changed files with 4,567 additions and 244 deletions.
10 changes: 8 additions & 2 deletions src/json/json_spirit_writer_template.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
// Distributed under the MIT License, see accompanying file LICENSE.txt

// json spirit version 4.03
#include "util.h"

#include "json_spirit_value.h"

Expand Down Expand Up @@ -126,8 +127,13 @@ namespace json_spirit
case int_type: output_int( value ); break;

/// Bitcoin: Added std::fixed and changed precision from 16 to 8
case real_type: os_ << std::showpoint << std::fixed << std::setprecision(8)
<< value.get_real(); break;
// YACoin should be 6!
case real_type: os_ <<
std::showpoint <<
std::fixed <<
//std::setprecision(8) <<
std::setprecision( COINdecimalPower ) <<
value.get_real(); break;

case null_type: os_ << "null"; break;
default: assert( false );
Expand Down
20 changes: 19 additions & 1 deletion src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
#include "net.h"
#include "init.h"
#include "ui_interface.h"
#ifdef QT_GUI
#include "explorer.h"
#endif
#include "kernel.h"
#include "scrypt_mine.h"
#include <boost/algorithm/string/replace.hpp>
Expand Down Expand Up @@ -709,6 +712,11 @@ bool CTxMemPool::accept(CTxDB& txdb, CTransaction &tx, bool fCheckInputs,
printf("CTxMemPool::accept() : accepted %s (poolsz %"PRIszu")\n",
hash.ToString().substr(0,10).c_str(),
mapTx.size());
#ifdef QT_GUI
lastTxHash.storeLasthash( hash );
uiInterface.NotifyBlocksChanged();
#endif

return true;
}

Expand Down Expand Up @@ -1165,6 +1173,9 @@ void static InvalidChainFound(CBlockIndex* pindexNew)
printf("InvalidChainFound: current best=%s height=%d trust=%s date=%s\n",
hashBestChain.ToString().substr(0,20).c_str(), nBestHeight, bnBestChainTrust.ToString().c_str(),
DateTimeStrFormat("%x %H:%M:%S", pindexBest->GetBlockTime()).c_str());
#ifdef QT_GUI
uiInterface.NotifyBlocksChanged();
#endif
}

void CBlock::UpdateTime(const CBlockIndex* pindexPrev)
Expand Down Expand Up @@ -1889,6 +1900,9 @@ bool CBlock::SetBestChain(CTxDB& txdb, CBlockIndex* pindexNew)
printf("SetBestChain: new best=%s height=%d trust=%s date=%s\n",
hashBestChain.ToString().substr(0,20).c_str(), nBestHeight, bnBestChainTrust.ToString().c_str(),
DateTimeStrFormat("%x %H:%M:%S", pindexBest->GetBlockTime()).c_str());
#ifdef QT_GUI
uiInterface.NotifyBlocksChanged();
#endif

// Check the version of the last 100 blocks to see if we need to upgrade:
if (!fIsInitialDownload)
Expand Down Expand Up @@ -2057,8 +2071,9 @@ bool CBlock::AddToBlockIndex(unsigned int nFile, unsigned int nBlockPos)
UpdatedTransaction(hashPrevBestCoinBase);
hashPrevBestCoinBase = vtx[0].GetHash();
}

#ifdef QT_GUI
uiInterface.NotifyBlocksChanged();
#endif
return true;
}

Expand Down Expand Up @@ -2392,6 +2407,9 @@ bool ProcessBlock(CNode* pfrom, CBlock* pblock)
// ppcoin: if responsible for sync-checkpoint send it
if (pfrom && !CSyncCheckpoint::strMasterPrivKey.empty())
Checkpoints::SendSyncCheckpoint(Checkpoints::AutoSelectSyncCheckpoint());
#ifdef QT_GUI
uiInterface.NotifyBlocksChanged();
#endif

return true;
}
Expand Down
44 changes: 33 additions & 11 deletions src/qt/aboutdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,26 @@ AboutDialog::AboutDialog(QWidget *parent) :
ui(new Ui::AboutDialog)
{
ui->setupUi(this);
#ifdef WIN32
const char *pC = __DATE__; //"mmm dd yyyy"

ui->copyrightLabel->setText(
tr("Copyright") +
QString(" &copy; 2009-2012 ") +
tr("The NovaCoin developers,") +
QString(" &copy; <b>%1</b> ").arg( &pC[ 7 ] ) +
tr("The YACoin developers.")
);
#else
// Copyright © 2009-2012 The NovaCoin developers, 2013 The YACoin developers.
ui->copyrightLabel->setText(
tr("Copyright") +
QString(" &copy; 2009-2012 ") +
tr("The NovaCoin developers,") +
QString(" 2013 ") +
tr("The YACoin developers.")
);
#endif
}

void AboutDialog::setModel(ClientModel *model)
Expand All @@ -31,21 +51,24 @@ void AboutDialog::setModel(ClientModel *model)
sBoostVersion = "",
sBoostWin = "";

sOpenSSLVersion = strprintf("&nbsp;&nbsp;&nbsp;&nbsp;"
//"&nbsp;&nbsp;"
"(<b>OpenSSL</b> %s"
sOpenSSLVersion = strprintf(
"<br />"
//"&nbsp;&nbsp;"
"<b>OpenSSL</b> %s"
"",
SSLeay_version(SSLEAY_VERSION)
);
sBdbVersion = strprintf( "&nbsp;&nbsp;&nbsp;&nbsp;"
sBdbVersion = strprintf(
"<br />"
//"&nbsp;&nbsp;"
"<b>BerkeleyDB</b> %d.%d.%d"
"",
"",
nBdbMajor,
nBdbMinor,
nBdbPatch
);
sBoostVersion = strprintf( "&nbsp;&nbsp;&nbsp;&nbsp;"
sBoostVersion = strprintf(
"<br />"
//"&nbsp;&nbsp;"
"<b>Boost</b> %d.%d.%d" // miiill (most, insignificant, least) digits
"",
Expand All @@ -54,20 +77,19 @@ void AboutDialog::setModel(ClientModel *model)
BOOST_VERSION % 100
);
#ifdef BOOST_WINDOWS
sBoostWin = ( "&nbsp;&nbsp;&nbsp;&nbsp;"
sBoostWin = (
"<br />"
//"&nbsp;&nbsp;"
"Windows platform is available to Boost"
);
#endif
ui->versionLabel->setText(
model->formatFullVersion() +
QString::fromStdString(
//"(" +
sOpenSSLVersion +
sBdbVersion +
sBoostVersion +
sBoostWin +
")"
sBoostWin
)
);
}
Expand All @@ -78,7 +100,7 @@ AboutDialog::~AboutDialog()
delete ui;
}

void AboutDialog::on_buttonBox_accepted()
void AboutDialog::on_closeButton_clicked()
{
close();
}
2 changes: 1 addition & 1 deletion src/qt/aboutdialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class AboutDialog : public QDialog
Ui::AboutDialog *ui;

private slots:
void on_buttonBox_accepted();
void on_closeButton_clicked();
};

#endif // ABOUTDIALOG_H
1 change: 1 addition & 0 deletions src/qt/bitcoin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,7 @@ int main(int argc, char *argv[])
window.setClientModel(&clientModel);
window.setWalletModel(&walletModel);

guiref->showTrayIcon();
// If -min option passed, start window minimized.
if(GetBoolArg("-min"))
{
Expand Down
1 change: 1 addition & 0 deletions src/qt/bitcoin.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
<file alias="edit">res/icons/edit.png</file>
<file alias="history">res/icons/history.png</file>
<file alias="overview">res/icons/overview.png</file>
<file alias="explorer">res/icons/blockchainexplorer.png</file>
<file alias="export">res/icons/export.png</file>
<file alias="synced">res/icons/synced.png</file>
<file alias="remove">res/icons/remove.png</file>
Expand Down
Loading

0 comments on commit 7142482

Please sign in to comment.