// Show/Hide Coins
connect(ui->actionShow_Coins, &QAction::triggered, m_tabShowHideSignalMapper, QOverload<>::of(&QSignalMapper::map));
- m_tabShowHideMapper["Coins"] = new ToggleTab(ui->tabCoins, "Coins", "Coins", ui->actionShow_Coins);
+ m_tabShowHideMapper["Coins"] = new ToggleTab(ui->tabCoins, "Coins", "Coins", ui->actionShow_Coins, this);
m_tabShowHideSignalMapper->setMapping(ui->actionShow_Coins, "Coins");
// Show/Hide Plugins..
auto* pluginAction = new QAction(QString("Show %1").arg(plugin->displayName()), this);
ui->menuView->insertAction(plugin->insertFirst() ? ui->actionPlaceholderBegin : ui->actionPlaceholderEnd, pluginAction);
connect(pluginAction, &QAction::triggered, m_tabShowHideSignalMapper, QOverload<>::of(&QSignalMapper::map));
- m_tabShowHideMapper[plugin->displayName()] = new ToggleTab(plugin->tab(), plugin->displayName(), plugin->displayName(), pluginAction);
+ m_tabShowHideMapper[plugin->displayName()] = new ToggleTab(plugin->tab(), plugin->displayName(), plugin->displayName(), pluginAction, this);
m_tabShowHideSignalMapper->setMapping(pluginAction, plugin->displayName());
}
ui->actionPlaceholderBegin->setVisible(false);
class MainWindow;
}
-struct ToggleTab {
- ToggleTab(QWidget *tab, QString name, QString description, QAction *menuAction) :
- tab(tab), key(std::move(name)), name(std::move(description)), menuAction(menuAction) {}
+class ToggleTab : QObject {
+Q_OBJECT
+
+public:
+ ToggleTab(QWidget *tab, QString name, QString description, QAction *menuAction, QObject *parent = nullptr) :
+ QObject(parent), tab(tab), key(std::move(name)), name(std::move(description)), menuAction(menuAction) {}
QWidget *tab;
QString key;
QString name;
// context menu
ui->addresses->setContextMenuPolicy(Qt::CustomContextMenu);
- m_showTransactionsAction = new QAction("Show transactions");
+ m_showTransactionsAction = new QAction("Show transactions", this);
connect(m_showTransactionsAction, &QAction::triggered, this, &ReceiveWidget::onShowTransactions);
connect(ui->addresses, &QTreeView::customContextMenuRequested, this, &ReceiveWidget::showContextMenu);
connect(ui->addresses, &SubaddressView::copyAddress, this, &ReceiveWidget::copyAddress);
if (payment_id.substr(16).find_first_not_of('0') == std::string::npos)
payment_id = payment_id.substr(0,16);
- auto* t = new TransactionRow();
+ auto* t = new TransactionRow(this);
t->m_paymentId = QString::fromStdString(payment_id);
t->m_coinbase = pd.m_coinbase;
t->m_amount = pd.m_amount;
if (payment_id.substr(16).find_first_not_of('0') == std::string::npos)
payment_id = payment_id.substr(0,16);
- auto* t = new TransactionRow();
+ auto* t = new TransactionRow(this);
t->m_paymentId = QString::fromStdString(payment_id);
t->m_amount = pd.m_amount_out - change;
payment_id = payment_id.substr(0,16);
bool is_failed = pd.m_state == tools::wallet2::unconfirmed_transfer_details::failed;
- auto *t = new TransactionRow();
+ auto *t = new TransactionRow(this);
t->m_paymentId = QString::fromStdString(payment_id);
t->m_amount = pd.m_amount_out - change;
std::string payment_id = epee::string_tools::pod_to_hex(i->first);
if (payment_id.substr(16).find_first_not_of('0') == std::string::npos)
payment_id = payment_id.substr(0,16);
- auto *t = new TransactionRow();
+ auto *t = new TransactionRow(this);
t->m_paymentId = QString::fromStdString(payment_id);
t->m_amount = pd.m_amount;
t->m_balanceDelta = pd.m_amount;
#include "Transfer.h"
#include "Ring.h"
-TransactionRow::TransactionRow()
- : m_direction(TransactionRow::Direction_Out)
+TransactionRow::TransactionRow(QObject *parent)
+ : QObject(parent)
+ , m_direction(TransactionRow::Direction_Out)
, m_pending(false)
, m_failed(false)
, m_coinbase(false)
rings += "\n\n";
}
return rings;
-}
\ No newline at end of file
+}
+
+TransactionRow::~TransactionRow()
+{
+ qDeleteAll(m_transfers);
+ qDeleteAll(m_rings);
+}
Q_OBJECT
public:
+ ~TransactionRow() override;
+
enum Direction {
Direction_In = 0,
Direction_Out = 1,
QString rings_formatted() const;
private:
- explicit TransactionRow();
+ explicit TransactionRow(QObject *parent);
private:
friend class TransactionHistory;
- mutable QList<Transfer*> m_transfers;
- mutable QList<Ring*> m_rings;
+ QList<Transfer*> m_transfers;
+ QList<Ring*> m_rings;
qint64 m_amount; // Amount that was sent (to destinations) or received, excludes tx fee
qint64 m_balanceDelta; // How much the total balance was mutated as a result of this tx (includes tx fee)
quint64 m_blockHeight;
: QWidget(parent)
, ui(new Ui::XMRigWidget)
, m_wallet(wallet)
- , m_XMRig(new XmRig(Config::defaultConfigDir().path()))
+ , m_XMRig(new XmRig(Config::defaultConfigDir().path(), this))
, m_model(new QStandardItemModel(this))
, m_contextMenu(new QMenu(this))
{
connect(ui->line_host, &QLineEdit::textChanged, this, &NetworkProxyWidget::onProxySettingsChanged);
// [Port]
- auto *portValidator = new QRegularExpressionValidator{QRegularExpression("[0-9]{1,4}|[1-5][0-9]{4}|6[0-4][0-9]{3}|65[0-4][0-9]{2}|655[0-2][0-9]|6553[0-5]")};
+ auto *portValidator = new QRegularExpressionValidator{QRegularExpression("[0-9]{1,4}|[1-5][0-9]{4}|6[0-4][0-9]{3}|65[0-4][0-9]{2}|655[0-2][0-9]|6553[0-5]"), this};
ui->line_port->setValidator(portValidator);
ui->line_port->setText(conf()->get(Config::socks5Port).toString());
connect(ui->line_port, &QLineEdit::textChanged, this, &NetworkProxyWidget::onProxySettingsChanged);
{
ui->setupUi(this);
- auto *indexValidator = new QRegularExpressionValidator{QRegularExpression("[0-9]{0,5}")};
+ auto *indexValidator = new QRegularExpressionValidator{QRegularExpression("[0-9]{0,5}"), this};
ui->line_major->setValidator(indexValidator);
connect(ui->line_major, &QLineEdit::textChanged, [this]{