diff --git a/src/qt/metadexdialog.cpp b/src/qt/metadexdialog.cpp index 05a5a3d3c05de..d6d7914e7469e 100755 --- a/src/qt/metadexdialog.cpp +++ b/src/qt/metadexdialog.cpp @@ -5,74 +5,44 @@ #include "metadexdialog.h" #include "ui_metadexdialog.h" -#include "guiutil.h" -#include "optionsmodel.h" -#include "walletmodel.h" -#include "wallet.h" -#include "base58.h" -#include "ui_interface.h" - -#include - -#include "leveldb/db.h" -#include "leveldb/write_batch.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; +#include "omnicore_qtutils.h" -// potentially overzealous using here -using namespace std; -using namespace boost; -using namespace boost::assign; -using namespace leveldb; -// end potentially overzealous using +#include "walletmodel.h" +#include "mastercore.h" +#include "mastercore_errors.h" #include "mastercore_mdex.h" -#include "mastercore_tx.h" -#include "mastercore_sp.h" #include "mastercore_parse_string.h" -#include "mastercore_errors.h" -#include "omnicore_qtutils.h" -#include "omnicore_pending.h" +#include "mastercore_sp.h" #include "omnicore_createpayload.h" +#include "omnicore_pending.h" -#include -#include -#include +#include "amount.h" +#include "sync.h" +#include "uint256.h" -using boost::multiprecision::int128_t; -using boost::multiprecision::cpp_int; -using boost::multiprecision::cpp_dec_float; -using boost::multiprecision::cpp_dec_float_100; +#include +#include +#include +#include +#include +#include + +#include +#include #include +#include +#include #include -#include -#include +#include +#include +#include + +using std::ostringstream; +using std::string; + +using namespace mastercore; MetaDExDialog::MetaDExDialog(QWidget *parent) : QDialog(parent), @@ -80,7 +50,6 @@ MetaDExDialog::MetaDExDialog(QWidget *parent) : model(0) { ui->setupUi(this); - this->model = model; //open global_metadex_market = 3; @@ -128,10 +97,17 @@ MetaDExDialog::MetaDExDialog(QWidget *parent) : } +MetaDExDialog::~MetaDExDialog() +{ + delete ui; +} + void MetaDExDialog::setModel(WalletModel *model) { this->model = model; - connect(model, SIGNAL(balanceChanged(CAmount,CAmount,CAmount,CAmount,CAmount,CAmount)), this, SLOT(OrderRefresh())); + if (NULL != model) { + connect(model, SIGNAL(balanceChanged(CAmount,CAmount,CAmount,CAmount,CAmount,CAmount)), this, SLOT(OrderRefresh())); + } } void MetaDExDialog::OrderRefresh() @@ -314,7 +290,7 @@ void MetaDExDialog::UpdateOffers() bool includesMe = false; md_Set & indexes = (it->second); for (md_Set::iterator it = indexes.begin(); it != indexes.end(); ++it) { // multiple sell offers can exist at the same price, sum them for the UI - CMPMetaDEx obj = *it; + const CMPMetaDEx& obj = *it; if (obj.displayUnitPrice() == "0.00000000") continue; // hide trades that have a lower than 0.00000001 MSC unit price if(IsMyAddress(obj.getAddr())) includesMe = true; unitPriceStr = obj.displayUnitPrice(); @@ -406,7 +382,7 @@ void MetaDExDialog::FullRefresh() ui->buyButton->setText("Buy SP#" + QString::fromStdString(FormatIndivisibleMP(propertyId))); // populate buy and sell addresses - for(map::iterator my_it = mp_tally_map.begin(); my_it != mp_tally_map.end(); ++my_it) { + for (std::map::iterator my_it = mp_tally_map.begin(); my_it != mp_tally_map.end(); ++my_it) { string address = (my_it->first).c_str(); unsigned int id; (my_it->second).init(); diff --git a/src/qt/metadexdialog.h b/src/qt/metadexdialog.h index 1a1642c519fd5..19bae4e148277 100755 --- a/src/qt/metadexdialog.h +++ b/src/qt/metadexdialog.h @@ -5,18 +5,15 @@ #ifndef METADEXDIALOG_H #define METADEXDIALOG_H -#include "walletmodel.h" +#include #include -#include -#include -using boost::multiprecision::cpp_dec_float_100; - -class OptionsModel; +class WalletModel; QT_BEGIN_NAMESPACE -class QUrl; +class QString; +class QWidget; QT_END_NAMESPACE namespace Ui { @@ -29,6 +26,9 @@ class MetaDExDialog : public QDialog Q_OBJECT public: + explicit MetaDExDialog(QWidget *parent = 0); + ~MetaDExDialog(); + void FullRefresh(); void SwitchMarket(); void AddRow(bool useBuyList, bool includesMe, const std::string& price, const std::string& available, const std::string& total); @@ -37,15 +37,9 @@ class MetaDExDialog : public QDialog void UpdateOffers(); void UpdateSellOffers(); void UpdateBuyOffers(); - explicit MetaDExDialog(QWidget *parent = 0); void setModel(WalletModel *model); void recalcTotal(bool useBuyFields); - /** 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). - */ - QWidget *setupTabChain(QWidget *prev); - - public slots: void switchButtonClicked(); void sellAddressComboBoxChanged(int idx);