Permalink
Browse files

Add right click on transaction ID goes to blockbrowswer

The block browser needs major work for transaction IDs.
  • Loading branch information...
Tranz5 committed Sep 3, 2014
1 parent b4a4d0e commit d7764348b4e4d0b0d6b1e6aa3f48062747013202
View
@@ -753,9 +753,9 @@ void BitcoinGUI::stakingIconClicked()
void BitcoinGUI::gotoBlockBrowser()
void BitcoinGUI::gotoBlockBrowser(QString transactionId)
{
if (walletStack) walletStack->gotoBlockBrowser();
if (walletStack) walletStack->gotoBlockBrowser(transactionId);
}
void BitcoinGUI::gotoOverviewPage()
View
@@ -155,7 +155,7 @@ public slots:
/** Switch to send coins page */
void gotoSendCoinsPage();
/** Switch to block browser page */
void gotoBlockBrowser();
void gotoBlockBrowser(QString transactionId = "");
/** Show Sign/Verify Message dialog and switch to sign message tab */
void gotoSignMessageTab(QString addr = "");
View
@@ -182,11 +182,13 @@ double getTxTotalValue(std::string txid)
double convertCoins(int64 amount)
{
// Tranz needs to use options model.
return (double)amount / (double)COIN;
}
std::string getOutputs(std::string txid)
{
//Tranz This needs major work.
uint256 hash;
hash.SetHex(txid);
@@ -220,6 +222,7 @@ std::string getOutputs(std::string txid)
std::string getInputs(std::string txid)
{
//Tranz this needs major work.
uint256 hash;
hash.SetHex(txid);
@@ -264,6 +267,7 @@ std::string getInputs(std::string txid)
int64 getInputValue(CTransaction tx, CScript target)
{
//Tranz needs work
for (unsigned int i = 0; i < tx.vin.size(); i++)
{
const CTxOut& txout = tx.vout[i];
@@ -277,6 +281,7 @@ int64 getInputValue(CTransaction tx, CScript target)
double getTxFees(std::string txid)
{
//Tranz needs work.
uint256 hash;
hash.SetHex(txid);
@@ -443,6 +448,12 @@ void BlockBrowser::updateExplorer(bool block)
}
}
void BlockBrowser::setTransactionId(const QString &transactionId)
{
ui->txBox->setText(transactionId);
ui->txBox->setFocus();
updateExplorer(false);
}
void BlockBrowser::txClicked()
{
View
@@ -19,7 +19,7 @@
double getBlockHardness(int64);
double getTxTotalValue(std::string);
double convertCoins(int64_t);
double convertCoins(int64);
double getTxFees(std::string);
int64 getBlockTime(int64);
int64 getBlocknBits(int64);
@@ -48,6 +48,7 @@ class BlockBrowser : public QDialog
explicit BlockBrowser(QWidget *parent = 0);
~BlockBrowser();
void setTransactionId(const QString &transactionId);
void setModel(ClientModel *model);
public slots:
View
@@ -130,6 +130,7 @@ TransactionView::TransactionView(QWidget *parent) :
QAction *copyTxIDAction = new QAction(tr("Copy transaction ID"), this);
QAction *editLabelAction = new QAction(tr("Edit label"), this);
QAction *showDetailsAction = new QAction(tr("Show transaction details"), this);
QAction *showBlockBrowser = new QAction(tr("Show transaction in block browser"), this);
contextMenu = new QMenu();
contextMenu->addAction(copyAddressAction);
@@ -138,6 +139,7 @@ TransactionView::TransactionView(QWidget *parent) :
contextMenu->addAction(copyTxIDAction);
contextMenu->addAction(editLabelAction);
contextMenu->addAction(showDetailsAction);
contextMenu->addAction(showBlockBrowser);
// Connect actions
connect(dateWidget, SIGNAL(activated(int)), this, SLOT(chooseDate(int)));
@@ -154,6 +156,7 @@ TransactionView::TransactionView(QWidget *parent) :
connect(copyTxIDAction, SIGNAL(triggered()), this, SLOT(copyTxID()));
connect(editLabelAction, SIGNAL(triggered()), this, SLOT(editLabel()));
connect(showDetailsAction, SIGNAL(triggered()), this, SLOT(showDetails()));
connect(showBlockBrowser, SIGNAL(triggered()), this, SLOT(showBroswer()));
}
void TransactionView::setModel(WalletModel *model)
@@ -388,6 +391,19 @@ void TransactionView::showDetails()
}
}
void TransactionView::showBroswer()
{
if(!transactionView->selectionModel())
return;
QModelIndexList selection = transactionView->selectionModel()->selectedRows();
QString transactionId;
if(!selection.isEmpty())
transactionId = selection.at(0).data(TransactionTableModel::TxIDRole).toString();
emit blockBrowserSignal(transactionId);
}
QWidget *TransactionView::createDateRangeWidget()
{
dateRangeWidget = new QFrame();
View
@@ -61,6 +61,7 @@ private slots:
void contextualMenu(const QPoint &);
void dateRangeChanged();
void showDetails();
void showBroswer();
void copyAddress();
void editLabel();
void copyLabel();
@@ -69,6 +70,7 @@ private slots:
signals:
void doubleClicked(const QModelIndex&);
void blockBrowserSignal(QString transactionId);
public slots:
void chooseDate(int idx);
View
@@ -125,10 +125,10 @@ void WalletStack::gotoSendCoinsPage()
i.value()->gotoSendCoinsPage();
}
void WalletStack::gotoBlockBrowser()
void WalletStack::gotoBlockBrowser(QString transactionId)
{
WalletView *walletView = (WalletView*)currentWidget();
if (walletView) walletView->gotoBlockBrowser();
if (walletView) walletView->gotoBlockBrowser(transactionId);
}
void WalletStack::gotoSignMessageTab(QString addr)
View
@@ -78,7 +78,7 @@ public slots:
/** Switch to send coins page */
void gotoSendCoinsPage();
/** Switch to block browser page */
void gotoBlockBrowser();
void gotoBlockBrowser(QString transactionId);
/** Show Sign/Verify Message dialog and switch to sign message tab */
void gotoSignMessageTab(QString addr = "");
View
@@ -94,6 +94,7 @@ WalletView::WalletView(QWidget *parent, BitcoinGUI *_gui):
connect(receiveCoinsPage, SIGNAL(signMessage(QString)), this, SLOT(gotoSignMessageTab(QString)));
// Clicking on "Stake For Charity" in the address book sends you to the stake for charity page
connect(addressBookPage, SIGNAL(stakeForCharitySignal(QString)), this, SLOT(charityClicked(QString)));
connect(transactionView, SIGNAL(blockBrowserSignal(QString)), this, SLOT(gotoBlockBrowser(QString)));
gotoOverviewPage();
}
@@ -291,8 +292,11 @@ void WalletView::gotoOverviewPage()
disconnect(gui->exportAction, SIGNAL(triggered()), 0, 0);
}
void WalletView::gotoBlockBrowser()
void WalletView::gotoBlockBrowser(QString transactionId)
{
if(!transactionId.isEmpty())
blockBrowser->setTransactionId(transactionId);
blockBrowser->show();
}
View
@@ -119,7 +119,7 @@ public slots:
/** Switch to send coins page */
void gotoSendCoinsPage();
/** Switch to block browser page */
void gotoBlockBrowser();
void gotoBlockBrowser(QString transactionId = "");
/** Show Sign/Verify Message dialog and switch to sign message tab */
void gotoSignMessageTab(QString addr = "");

0 comments on commit d776434

Please sign in to comment.