Skip to content

Commit

Permalink
PortUI-0.0.10 - walletview code
Browse files Browse the repository at this point in the history
  • Loading branch information
zathras-crypto committed Mar 26, 2015
1 parent 22b13cb commit a2b5d39
Show file tree
Hide file tree
Showing 2 changed files with 158 additions and 15 deletions.
132 changes: 121 additions & 11 deletions src/qt/walletview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,19 @@
#include "overviewpage.h"
#include "receivecoinsdialog.h"
#include "sendcoinsdialog.h"
#include "sendmpdialog.h"
#include "lookupspdialog.h"
#include "lookuptxdialog.h"
#include "lookupaddressdialog.h"
//#include "metadexcanceldialog.h"
//#include "metadexdialog.h"
#include "signverifymessagedialog.h"
#include "transactiontablemodel.h"
#include "transactionview.h"
#include "balancesview.h"
#include "walletmodel.h"

//#include "orderhistorydialog.h"
#include "txhistorydialog.h"
#include "ui_interface.h"

#include <QAction>
Expand All @@ -28,6 +36,11 @@
#include <QPushButton>
#include <QVBoxLayout>

#include <QDebug>
#include <QTableView>
#include <QDialog>
#include <QHeaderView>

WalletView::WalletView(QWidget *parent):
QStackedWidget(parent),
clientModel(0),
Expand All @@ -37,6 +50,26 @@ WalletView::WalletView(QWidget *parent):
overviewPage = new OverviewPage();

transactionsPage = new QWidget(this);
balancesPage = new QWidget(this);
// balances page
QVBoxLayout *bvbox = new QVBoxLayout();
QHBoxLayout *bhbox_buttons = new QHBoxLayout();
balancesView = new BalancesView(this);
bvbox->addWidget(balancesView);
QPushButton *bexportButton = new QPushButton(tr("&Export"), this);
bexportButton->setToolTip(tr("Export the data in the current tab to a file"));
#ifndef Q_OS_MAC // Icons on push buttons are very uncommon on Mac
bexportButton->setIcon(QIcon(":/icons/export"));
#endif
bhbox_buttons->addStretch();
bhbox_buttons->addWidget(bexportButton);
bvbox->addLayout(bhbox_buttons);
balancesPage->setLayout(bvbox);

// transactions page
// bitcoin transactions in second tab, MP transactions in first
//bitcoin
bitcoinTXTab = new QWidget(this);
QVBoxLayout *vbox = new QVBoxLayout();
QHBoxLayout *hbox_buttons = new QHBoxLayout();
transactionView = new TransactionView(this);
Expand All @@ -49,15 +82,63 @@ WalletView::WalletView(QWidget *parent):
hbox_buttons->addStretch();
hbox_buttons->addWidget(exportButton);
vbox->addLayout(hbox_buttons);
transactionsPage->setLayout(vbox);

bitcoinTXTab->setLayout(vbox);
mpTXTab = new TXHistoryDialog;
transactionsPage = new QWidget(this);
QVBoxLayout *txvbox = new QVBoxLayout();
txTabHolder = new QTabWidget();
txTabHolder->addTab(mpTXTab,tr("Omni Layer"));
txTabHolder->addTab(bitcoinTXTab,tr("Bitcoin"));
txvbox->addWidget(txTabHolder);
transactionsPage->setLayout(txvbox);
// receive page
receiveCoinsPage = new ReceiveCoinsDialog();
sendCoinsPage = new SendCoinsDialog();

// sending page
sendCoinsPage = new QWidget(this);
QVBoxLayout *svbox = new QVBoxLayout();
sendCoinsTab = new SendCoinsDialog();
sendMPTab = new SendMPDialog();
QTabWidget *tabHolder = new QTabWidget();
tabHolder->addTab(sendMPTab,tr("Omni Layer"));
tabHolder->addTab(sendCoinsTab,tr("Bitcoin"));
svbox->addWidget(tabHolder);
sendCoinsPage->setLayout(svbox);
// exchange page
/* no MetaDEx in this ver
exchangePage = new QWidget(this);
QVBoxLayout *exvbox = new QVBoxLayout();
metaDExTab = new MetaDExDialog();
cancelTab = new MetaDExCancelDialog();
QTabWidget *exTabHolder = new QTabWidget();
orderHistoryTab = new OrderHistoryDialog;
//exTabHolder->addTab(new QWidget(),tr("Trade Bitcoin/Mastercoin")); not yet implemented
exTabHolder->addTab(metaDExTab,tr("Trade Mastercoin/Smart Properties"));
exTabHolder->addTab(orderHistoryTab,tr("Order History"));
exTabHolder->addTab(cancelTab,tr("Cancel Orders"));
exvbox->addWidget(exTabHolder);
exchangePage->setLayout(exvbox);
*/
// toolbox page
toolboxPage = new QWidget(this);
QVBoxLayout *tvbox = new QVBoxLayout();
addressLookupTab = new LookupAddressDialog();
spLookupTab = new LookupSPDialog();
txLookupTab = new LookupTXDialog();
QTabWidget *tTabHolder = new QTabWidget();
tTabHolder->addTab(addressLookupTab,tr("Lookup Address"));
tTabHolder->addTab(spLookupTab,tr("Lookup Property"));
tTabHolder->addTab(txLookupTab,tr("Lookup Transaction"));
tvbox->addWidget(tTabHolder);
toolboxPage->setLayout(tvbox);

// add pages
addWidget(overviewPage);
addWidget(balancesPage);
addWidget(transactionsPage);
addWidget(receiveCoinsPage);
addWidget(sendCoinsPage);
//addWidget(exchangePage);
addWidget(toolboxPage);

// Clicking on a transaction on the overview pre-selects the transaction on the transaction history page
connect(overviewPage, SIGNAL(transactionClicked(QModelIndex)), transactionView, SLOT(focusTransaction(QModelIndex)));
Expand All @@ -82,8 +163,8 @@ void WalletView::setBitcoinGUI(BitcoinGUI *gui)
{
if (gui)
{
// Clicking on a transaction on the overview page simply sends you to transaction history page
connect(overviewPage, SIGNAL(transactionClicked(QModelIndex)), gui, SLOT(gotoHistoryPage()));
// Clicking on a transaction on the overview page simply sends you to the Bitcoin history tab
connect(overviewPage, SIGNAL(transactionClicked(QModelIndex)), gui, SLOT(gotoBitcoinHistoryTab()));

// Receive and report messages
connect(this, SIGNAL(message(QString,QString,unsigned int)), gui, SLOT(message(QString,QString,unsigned int)));
Expand All @@ -101,7 +182,9 @@ void WalletView::setClientModel(ClientModel *clientModel)
this->clientModel = clientModel;

overviewPage->setClientModel(clientModel);
sendCoinsPage->setClientModel(clientModel);
//balancesView->setClientModel(clientModel);
sendMPTab->setClientModel(clientModel);
mpTXTab->setClientModel(clientModel);
}

void WalletView::setWalletModel(WalletModel *walletModel)
Expand All @@ -112,7 +195,13 @@ void WalletView::setWalletModel(WalletModel *walletModel)
transactionView->setModel(walletModel);
overviewPage->setWalletModel(walletModel);
receiveCoinsPage->setModel(walletModel);
sendCoinsPage->setModel(walletModel);
sendCoinsTab->setModel(walletModel);
sendMPTab->setWalletModel(walletModel);
//balancesView->setWalletModel(walletModel);
// metaDExTab->setModel(walletModel);
mpTXTab->setWalletModel(walletModel);
// cancelTab->setModel(walletModel);
// orderHistoryTab->setModel(walletModel);

if (walletModel)
{
Expand Down Expand Up @@ -158,22 +247,43 @@ void WalletView::gotoOverviewPage()
setCurrentWidget(overviewPage);
}

void WalletView::gotoBalancesPage()
{
setCurrentWidget(balancesPage);
}

void WalletView::gotoHistoryPage()
{
setCurrentWidget(transactionsPage);
}

void WalletView::gotoBitcoinHistoryTab()
{
setCurrentWidget(transactionsPage);
txTabHolder->setCurrentIndex(1);
}

void WalletView::gotoReceiveCoinsPage()
{
setCurrentWidget(receiveCoinsPage);
}

void WalletView::gotoExchangePage()
{
setCurrentWidget(exchangePage);
}

void WalletView::gotoToolboxPage()
{
setCurrentWidget(toolboxPage);
}

void WalletView::gotoSendCoinsPage(QString addr)
{
setCurrentWidget(sendCoinsPage);

if (!addr.isEmpty())
sendCoinsPage->setAddress(addr);
sendCoinsTab->setAddress(addr);
}

void WalletView::gotoSignMessageTab(QString addr)
Expand Down Expand Up @@ -202,7 +312,7 @@ void WalletView::gotoVerifyMessageTab(QString addr)

bool WalletView::handlePaymentRequest(const SendCoinsRecipient& recipient)
{
return sendCoinsPage->handlePaymentRequest(recipient);
return sendCoinsTab->handlePaymentRequest(recipient);
}

void WalletView::showOutOfSyncWarning(bool fShow)
Expand Down
41 changes: 37 additions & 4 deletions src/qt/walletview.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,23 @@ class ClientModel;
class OverviewPage;
class ReceiveCoinsDialog;
class SendCoinsDialog;
class SendMPDialog;
class OrderHistoryDialog;
class LookupSPDialog;
class LookupTXDialog;
class LookupAddressDialog;
//class MetaDExDialog;
//class MetaDExCancelDialog;
class SendCoinsRecipient;
class TransactionView;
class TXHistoryDialog;
class BalancesView;
class WalletModel;

QT_BEGIN_NAMESPACE
class QModelIndex;
class QProgressDialog;
class QTabWidget;
QT_END_NAMESPACE

/*
Expand Down Expand Up @@ -58,23 +68,46 @@ class WalletView : public QStackedWidget

OverviewPage *overviewPage;
QWidget *transactionsPage;
ReceiveCoinsDialog *receiveCoinsPage;
SendCoinsDialog *sendCoinsPage;
QWidget *balancesPage;
QWidget *exchangePage;
QWidget *smartPropertyPage;
QWidget *toolboxPage;

ReceiveCoinsDialog *receiveCoinsPage;
// SendCoinsDialog *sendCoinsPage;
QWidget *sendCoinsPage;
SendCoinsDialog *sendCoinsTab;
SendMPDialog *sendMPTab;
LookupSPDialog *spLookupTab;
LookupTXDialog *txLookupTab;
LookupAddressDialog *addressLookupTab;
OrderHistoryDialog *orderHistoryTab;
// MetaDExDialog *metaDExTab;
// MetaDExCancelDialog *cancelTab;
TransactionView *transactionView;

BalancesView *balancesView;
TXHistoryDialog *mpTXTab;
QWidget *bitcoinTXTab;
QProgressDialog *progressDialog;
QTabWidget *txTabHolder;

public slots:
/** Switch to overview (home) page */
void gotoOverviewPage();
/** Switch to balances page */
void gotoBalancesPage();
/** Switch to exchange page */
void gotoExchangePage();
/** Switch to history (transactions) page */
void gotoHistoryPage();
/** Switch to receive coins page */
void gotoReceiveCoinsPage();
/** Switch to send coins page */
void gotoSendCoinsPage(QString addr = "");

/** Switch specifically to bitcoin tx history tab */
void gotoBitcoinHistoryTab();
/** Switch to utility page */
void gotoToolboxPage();
/** Show Sign/Verify Message dialog and switch to sign message tab */
void gotoSignMessageTab(QString addr = "");
/** Show Sign/Verify Message dialog and switch to verify message tab */
Expand Down

0 comments on commit a2b5d39

Please sign in to comment.