Changeset View
Changeset View
Standalone View
Standalone View
src/qt/transactionview.cpp
Show All 22 Lines | |||||
#include <QDoubleValidator> | #include <QDoubleValidator> | ||||
#include <QHBoxLayout> | #include <QHBoxLayout> | ||||
#include <QHeaderView> | #include <QHeaderView> | ||||
#include <QLabel> | #include <QLabel> | ||||
#include <QLineEdit> | #include <QLineEdit> | ||||
#include <QMenu> | #include <QMenu> | ||||
#include <QPoint> | #include <QPoint> | ||||
#include <QScrollBar> | #include <QScrollBar> | ||||
#include <QSignalMapper> | |||||
#include <QTableView> | #include <QTableView> | ||||
#include <QTimer> | #include <QTimer> | ||||
#include <QUrl> | #include <QUrl> | ||||
#include <QVBoxLayout> | #include <QVBoxLayout> | ||||
TransactionView::TransactionView(const PlatformStyle *platformStyle, | TransactionView::TransactionView(const PlatformStyle *platformStyle, | ||||
QWidget *parent) | QWidget *parent) | ||||
: QWidget(parent), model(nullptr), transactionProxyModel(nullptr), | : QWidget(parent), model(nullptr), transactionProxyModel(nullptr), | ||||
▲ Show 20 Lines • Show All 134 Lines • ▼ Show 20 Lines | TransactionView::TransactionView(const PlatformStyle *platformStyle, | ||||
contextMenu->addAction(copyTxIDAction); | contextMenu->addAction(copyTxIDAction); | ||||
contextMenu->addAction(copyTxHexAction); | contextMenu->addAction(copyTxHexAction); | ||||
contextMenu->addAction(copyTxPlainText); | contextMenu->addAction(copyTxPlainText); | ||||
contextMenu->addAction(showDetailsAction); | contextMenu->addAction(showDetailsAction); | ||||
contextMenu->addSeparator(); | contextMenu->addSeparator(); | ||||
contextMenu->addAction(abandonAction); | contextMenu->addAction(abandonAction); | ||||
contextMenu->addAction(editLabelAction); | contextMenu->addAction(editLabelAction); | ||||
mapperThirdPartyTxUrls = new QSignalMapper(this); | |||||
// Connect actions | |||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)) | |||||
const auto mappedStringEvent = &QSignalMapper::mappedString; | |||||
#else | |||||
const auto mappedStringEvent = | |||||
static_cast<void (QSignalMapper::*)(const QString &)>( | |||||
&QSignalMapper::mapped); | |||||
#endif | |||||
connect(mapperThirdPartyTxUrls, mappedStringEvent, this, | |||||
&TransactionView::openThirdPartyTxUrl); | |||||
connect(dateWidget, | connect(dateWidget, | ||||
static_cast<void (QComboBox::*)(int)>(&QComboBox::activated), this, | static_cast<void (QComboBox::*)(int)>(&QComboBox::activated), this, | ||||
&TransactionView::chooseDate); | &TransactionView::chooseDate); | ||||
connect(typeWidget, | connect(typeWidget, | ||||
static_cast<void (QComboBox::*)(int)>(&QComboBox::activated), this, | static_cast<void (QComboBox::*)(int)>(&QComboBox::activated), this, | ||||
&TransactionView::chooseType); | &TransactionView::chooseType); | ||||
connect(watchOnlyWidget, | connect(watchOnlyWidget, | ||||
static_cast<void (QComboBox::*)(int)>(&QComboBox::activated), this, | static_cast<void (QComboBox::*)(int)>(&QComboBox::activated), this, | ||||
▲ Show 20 Lines • Show All 73 Lines • ▼ Show 20 Lines | if (_model) { | ||||
transactionView, AMOUNT_MINIMUM_COLUMN_WIDTH, MINIMUM_COLUMN_WIDTH, | transactionView, AMOUNT_MINIMUM_COLUMN_WIDTH, MINIMUM_COLUMN_WIDTH, | ||||
this); | this); | ||||
if (_model->getOptionsModel()) { | if (_model->getOptionsModel()) { | ||||
// Add third party transaction URLs to context menu | // Add third party transaction URLs to context menu | ||||
QStringList listUrls = GUIUtil::splitSkipEmptyParts( | QStringList listUrls = GUIUtil::splitSkipEmptyParts( | ||||
_model->getOptionsModel()->getThirdPartyTxUrls(), "|"); | _model->getOptionsModel()->getThirdPartyTxUrls(), "|"); | ||||
for (int i = 0; i < listUrls.size(); ++i) { | for (int i = 0; i < listUrls.size(); ++i) { | ||||
QString host = | QString url = listUrls[i].trimmed(); | ||||
QUrl(listUrls[i].trimmed(), QUrl::StrictMode).host(); | QString host = QUrl(url, QUrl::StrictMode).host(); | ||||
if (!host.isEmpty()) { | if (!host.isEmpty()) { | ||||
// use host as menu item label | // use host as menu item label | ||||
QAction *thirdPartyTxUrlAction = new QAction(host, this); | QAction *thirdPartyTxUrlAction = new QAction(host, this); | ||||
if (i == 0) { | if (i == 0) { | ||||
contextMenu->addSeparator(); | contextMenu->addSeparator(); | ||||
} | } | ||||
contextMenu->addAction(thirdPartyTxUrlAction); | contextMenu->addAction(thirdPartyTxUrlAction); | ||||
connect(thirdPartyTxUrlAction, &QAction::triggered, | connect(thirdPartyTxUrlAction, &QAction::triggered, | ||||
mapperThirdPartyTxUrls, | [this, url] { openThirdPartyTxUrl(url); }); | ||||
static_cast<void (QSignalMapper::*)()>( | |||||
&QSignalMapper::map)); | |||||
mapperThirdPartyTxUrls->setMapping(thirdPartyTxUrlAction, | |||||
listUrls[i].trimmed()); | |||||
} | } | ||||
} | } | ||||
} | } | ||||
// show/hide column Watch-only | // show/hide column Watch-only | ||||
updateWatchOnlyColumn(_model->wallet().haveWatchOnly()); | updateWatchOnlyColumn(_model->wallet().haveWatchOnly()); | ||||
// Watch-only signal | // Watch-only signal | ||||
▲ Show 20 Lines • Show All 419 Lines • Show Last 20 Lines |