From bffaeb0637d924ef0c180afa933f519d1731d613 Mon Sep 17 00:00:00 2001 From: dexX7 Date: Sun, 17 May 2015 21:34:48 +0200 Subject: [PATCH] Refine TXHistoryDialog includes - add destructor - remove unused members - remove unused headers - forward declare classes - sort headers - ... --- src/qt/txhistorydialog.cpp | 105 ++++++++++++++++--------------------- src/qt/txhistorydialog.h | 48 +++++------------ 2 files changed, 59 insertions(+), 94 deletions(-) diff --git a/src/qt/txhistorydialog.cpp b/src/qt/txhistorydialog.cpp index 9bd2bcc206811..427dbcc5a8f5c 100644 --- a/src/qt/txhistorydialog.cpp +++ b/src/qt/txhistorydialog.cpp @@ -5,70 +5,56 @@ #include "txhistorydialog.h" #include "ui_txhistorydialog.h" +#include "omnicore_qtutils.h" + #include "clientmodel.h" #include "guiutil.h" -#include "optionsmodel.h" #include "walletmodel.h" + +#include "mastercore.h" +#include "mastercore_rpc.h" +#include "mastercore_sp.h" +#include "mastercore_tx.h" +#include "omnicore_pending.h" + +#include "init.h" +#include "main.h" +#include "primitives/transaction.h" +#include "sync.h" #include "txdb.h" +#include "uint256.h" #include "wallet.h" -#include "base58.h" -#include "ui_interface.h" -#include "walletmodel.h" -#include - -#include "leveldb/db.h" -#include "leveldb/write_batch.h" +#include "json/json_spirit_value.h" +#include "json/json_spirit_writer_template.h" -// potentially overzealous includes here -#include "base58.h" -#include "rpcserver.h" -#include "init.h" -#include "util.h" -#include -#include -#include -#include -#include -#include #include -#include -#include #include -#include -#include -#include "json/json_spirit_utils.h" -#include "json/json_spirit_value.h" -#include "leveldb/db.h" -#include "leveldb/write_batch.h" -// end potentially overzealous includes -using namespace json_spirit; -#include "mastercore.h" -using namespace mastercore; - -// potentially overzealous using here -using namespace std; -using namespace boost; -using namespace boost::assign; -using namespace leveldb; -// end potentially overzealous using - -#include "mastercore_dex.h" -#include "mastercore_tx.h" -#include "mastercore_sp.h" -#include "mastercore_rpc.h" -#include "mastercore_parse_string.h" -#include "omnicore_qtutils.h" +#include +#include +#include +#include +#include +#include +#include #include -#include -#include -#include -#include +#include +#include +#include #include -#include +#include +#include +#include #include +#include +#include +#include + +using std::string; +using namespace json_spirit; +using namespace mastercore; TXHistoryDialog::TXHistoryDialog(QWidget *parent) : QDialog(parent), @@ -77,7 +63,6 @@ TXHistoryDialog::TXHistoryDialog(QWidget *parent) : walletModel(0) { ui->setupUi(this); - this->walletModel = walletModel; // setup ui->txHistoryTable->setColumnCount(7); ui->txHistoryTable->setHorizontalHeaderItem(2, new QTableWidgetItem(" ")); @@ -145,6 +130,11 @@ TXHistoryDialog::TXHistoryDialog(QWidget *parent) : } +TXHistoryDialog::~TXHistoryDialog() +{ + delete ui; +} + void TXHistoryDialog::setClientModel(ClientModel *model) { this->clientModel = model; @@ -209,7 +199,7 @@ int TXHistoryDialog::PopulateHistoryMap() // STO has no inbound transaction, so we need to use an insert methodology here - get STO receipts affecting me string mySTOReceipts = s_stolistdb->getMySTOReceipts(""); std::vector vecReceipts; - boost::split(vecReceipts, mySTOReceipts, boost::is_any_of(","), token_compress_on); + boost::split(vecReceipts, mySTOReceipts, boost::is_any_of(","), boost::token_compress_on); int64_t lastTXBlock = 999999; // set artificially high initially until first wallet tx is processed // iterate through wallet entries backwards std::list acentries; @@ -244,15 +234,15 @@ int TXHistoryDialog::PopulateHistoryMap() uint256 blockHash = 0; if (!GetTransaction(hash, wtx, blockHash, true)) continue; blockHash = pwtx->hashBlock; - if ((0 == blockHash) || (NULL == mapBlockIndex[blockHash])) continue; - CBlockIndex* pBlockIndex = mapBlockIndex[blockHash]; + if ((0 == blockHash) || (NULL == GetBlockIndex(blockHash))) continue; + CBlockIndex* pBlockIndex = GetBlockIndex(blockHash); if (NULL == pBlockIndex) continue; int blockHeight = pBlockIndex->nHeight; // get the height of the transaction // ### START STO INSERTION CHECK ### for(uint32_t i = 0; i svstr; - boost::split(svstr, vecReceipts[i], boost::is_any_of(":"), token_compress_on); + boost::split(svstr, vecReceipts[i], boost::is_any_of(":"), boost::token_compress_on); if(4 == svstr.size()) // make sure expected num items { if((atoi(svstr[1]) < lastTXBlock) && (atoi(svstr[1]) > blockHeight)) @@ -570,11 +560,6 @@ void TXHistoryDialog::showDetails() } } -void TXHistoryDialog::accept() -{ - -} - void TXHistoryDialog::resizeEvent(QResizeEvent* event) { QWidget::resizeEvent(event); diff --git a/src/qt/txhistorydialog.h b/src/qt/txhistorydialog.h index a7c6dca8b3d4e..93aae329e8b40 100644 --- a/src/qt/txhistorydialog.h +++ b/src/qt/txhistorydialog.h @@ -8,19 +8,20 @@ #include "guiutil.h" #include "uint256.h" +#include + #include -#include -#include -#include -#include -#include class ClientModel; -class OptionsModel; class WalletModel; QT_BEGIN_NAMESPACE -class QUrl; +class QMenu; +class QModelIndex; +class QPoint; +class QResizeEvent; +class QString; +class QWidget; QT_END_NAMESPACE namespace Ui { @@ -49,46 +50,25 @@ class TXHistoryDialog : public QDialog Q_OBJECT public: - //void FullRefresh(); explicit TXHistoryDialog(QWidget *parent = 0); + ~TXHistoryDialog(); + void setClientModel(ClientModel *model); void setWalletModel(WalletModel *model); - void accept(); - /** Set up the tab chain manually, as Qt messes up the tab chain by default in some cases (issue https://bugreports.qt-project.org/browse/QTBUG-10907). - */ - QDialog *txDlg; - QWidget *setupTabChain(QWidget *prev); - QTableWidgetItem *iconCell; - QTableWidgetItem *dateCell; - QTableWidgetItem *typeCell; - QTableWidgetItem *amountCell; - QTableWidgetItem *addressCell; - QTableWidgetItem *txidCell; - QTableWidgetItem *sortKeyCell; - QLayout *dlgLayout; - QTextEdit *dlgTextEdit; - QDialogButtonBox *buttonBox; - QPushButton *closeButton; - - GUIUtil::TableViewLastColumnResizingFixer *borrowedColumnResizingFixer; - virtual void resizeEvent(QResizeEvent* event); - - HistoryMap txHistoryMap; std::string shrinkTxType(int txType, bool *fundsMoved); -public slots: - //void switchButtonClicked(); - private: Ui::txHistoryDialog *ui; ClientModel *clientModel; WalletModel *walletModel; + GUIUtil::TableViewLastColumnResizingFixer *borrowedColumnResizingFixer; QMenu *contextMenu; + HistoryMap txHistoryMap; private slots: - void contextualMenu(const QPoint &); + void contextualMenu(const QPoint &point); void showDetails(); void copyAddress(); void copyAmount(); @@ -99,7 +79,7 @@ private slots: void checkSort(int column); signals: - void doubleClicked(const QModelIndex&); + void doubleClicked(const QModelIndex& idx); // Fired when a message should be reported to the user void message(const QString &title, const QString &message, unsigned int style); };