From 970f8e084def985271f9c22f1221282002c12877 Mon Sep 17 00:00:00 2001 From: tobtoht Date: Sun, 11 Oct 2020 21:45:28 +0200 Subject: [PATCH] History, Coins, Xmr.to: double click row to open info dialog --- src/coinswidget.cpp | 1 + src/historywidget.cpp | 8 ++++++++ src/xmrtowidget.cpp | 17 +++++++++++------ src/xmrtowidget.h | 2 ++ 4 files changed, 22 insertions(+), 6 deletions(-) diff --git a/src/coinswidget.cpp b/src/coinswidget.cpp index 60dfe72..c659d69 100644 --- a/src/coinswidget.cpp +++ b/src/coinswidget.cpp @@ -57,6 +57,7 @@ CoinsWidget::CoinsWidget(QWidget *parent) connect(m_thawAllSelectedAction, &QAction::triggered, this, &CoinsWidget::thawAllSelected); connect(ui->coins, &QTreeView::customContextMenuRequested, this, &CoinsWidget::showContextMenu); + connect(ui->coins, &QTreeView::doubleClicked, this, &CoinsWidget::viewOutput); } void CoinsWidget::setModel(CoinsModel * model, Coins * coins) { diff --git a/src/historywidget.cpp b/src/historywidget.cpp index 48c5334..ca2bb73 100644 --- a/src/historywidget.cpp +++ b/src/historywidget.cpp @@ -35,6 +35,14 @@ HistoryWidget::HistoryWidget(QWidget *parent) } }); connect(ui->search, &QLineEdit::textChanged, this, &HistoryWidget::setSearchFilter); + + connect(ui->history, &QTreeView::doubleClicked, [this](QModelIndex index){ + if (m_model == nullptr) return; + if (!(m_model->flags(index) & Qt::ItemIsEditable)) { + this->showTxDetails(); + } + }); + } void HistoryWidget::setModel(Coins *coins, TransactionHistoryProxyModel *model, TransactionHistory *txHistory) diff --git a/src/xmrtowidget.cpp b/src/xmrtowidget.cpp index b9263b1..6adad5d 100644 --- a/src/xmrtowidget.cpp +++ b/src/xmrtowidget.cpp @@ -34,12 +34,7 @@ XMRToWidget::XMRToWidget(QWidget *parent) : m_showDetailsAction = m_contextMenu->addAction("Details"); m_viewOnXmrToAction = m_contextMenu->addAction("View order on XMR.to"); m_viewOnXmrToAction->setIcon(QIcon(":/assets/images/xmrto.png")); - connect(m_showDetailsAction, &QAction::triggered, [&](){ - QModelIndex index = ui->historyTable->currentIndex(); - XmrToOrder *order = this->tableModel->orders->at(index.row()); - auto * dialog = new XmrToInfoDialog(order, this); - dialog->exec(); - }); + connect(m_showDetailsAction, &QAction::triggered, this, &XMRToWidget::showInfoDialog); connect(m_viewOnXmrToAction, &QAction::triggered, [&](){ QModelIndex index = ui->historyTable->currentIndex(); XmrToOrder *order = this->tableModel->orders->at(index.row()); @@ -67,6 +62,8 @@ XMRToWidget::XMRToWidget(QWidget *parent) : if (m_ctx->isTails || m_ctx->isWhonix) { ui->torCheckBox->setDisabled(true); } + + connect(ui->historyTable, &QTreeView::doubleClicked, this, &XMRToWidget::showInfoDialog); } void XMRToWidget::setHistoryModel(XmrToModel *model) { @@ -184,6 +181,14 @@ void XMRToWidget::onEndTransaction() { ui->btnCreate->setEnabled(true); } +void XMRToWidget::showInfoDialog() { + QModelIndex index = ui->historyTable->currentIndex(); + XmrToOrder *order = this->tableModel->orders->at(index.row()); + auto *dialog = new XmrToInfoDialog(order, this); + dialog->exec(); + dialog->deleteLater(); +} + XMRToWidget::~XMRToWidget() { delete ui; } diff --git a/src/xmrtowidget.h b/src/xmrtowidget.h index 4afe3d1..2989384 100644 --- a/src/xmrtowidget.h +++ b/src/xmrtowidget.h @@ -43,6 +43,8 @@ signals: void viewOrder(const QString &orderId); private: + void showInfoDialog(); + QMap m_tickerWidgets; QMenu *m_contextMenu; QAction *m_viewOnXmrToAction;