Skip to content

Commit f2940c4

Browse files
Merge #6168: backport: bitcoin-core#gui18, #121, #257, #263, #281, #335, #362, #828, bitcoin#21912, bitcoin#21942, bitcoin#21988
c7d3161 Merge bitcoin-core/gui#362: Add keyboard shortcuts to context menus (Hennadii Stepanov) 25f87b9 Merge bitcoin-core/gui#121: Early subscribe core signals in transaction table model (Hennadii Stepanov) ed56e28 Merge bitcoin-core/gui#335: test: Use QSignalSpy instead of QEventLoop (Hennadii Stepanov) c52b756 Merge bitcoin-core/gui#281: set shortcuts for console's resize buttons (W. J. van der Laan) b442a59 Merge bitcoin#21988: doc: note that brew installed qt is not supported (W. J. van der Laan) 0e2e315 Merge bitcoin#21942: docs: improve make with parallel jobs description. (MarcoFalke) c2735a8 Merge bitcoin#21912: doc: Remove mention of priority estimation (W. J. van der Laan) 1d56d20 Merge bitcoin-core/gui#257: refactor: Use template function qOverload in signal-slot connections (Hennadii Stepanov) b5fb559 Merge bitcoin-core/gui#18: Add peertablesortproxy module (Hennadii Stepanov) 1cdd9fb refactor: use new QAction style for governance list and masternode list (Konstantin Akimov) 4f89c98 Merge bitcoin-core/gui#263: Revamp context menus (Hennadii Stepanov) c36bb8e fix: use && in governance urls instead & (Konstantin Akimov) 1e585b1 Merge bitcoin-core/gui#828: Rendering an amp characters in the wallet name for QMenu (Hennadii Stepanov) Pull request description: ## Issue being fixed or feature implemented Just regular backports from bitcoin v22, mostly Qt related ## What was done? See commits for a list of backports. This PR also fixes a rendering an url on Governance tab if it has any '&' inside. see screenshots. Original url: `https://example.com/?test=nothing&to=see&&lol` - yes, double '&&' just for test even if url is silly. Failed behaviour: ![image](https://github.com/user-attachments/assets/ac45c192-7d0e-4cd2-97f8-060af8f3911b) Correctly rendered: ![image](https://github.com/user-attachments/assets/5e345197-776a-4bb8-9476-cab4aba3429e) ## How Has This Been Tested? Run unit/functional tests ## Breaking Changes N/A ## Checklist: - [x] I have performed a self-review of my own code - [ ] I have commented my code, particularly in hard-to-understand areas - [ ] I have added or updated relevant unit/integration/functional/e2e tests - [ ] I have made corresponding changes to the documentation - [x] I have assigned this pull request to a milestone ACKs for top commit: PastaPastaPasta: utACK c7d3161 UdjinM6: utACK c7d3161 Tree-SHA512: 67e7e8e0ec1a768d1f13baa48c123e4a415d3f32177a427d8117339a5eacf70864ebf46e9f1165bb8a3bf9c231f7929d33ac6aa19742e06a4e19d2f86dda6dc3
2 parents e4e6d9b + c7d3161 commit f2940c4

33 files changed

+262
-388
lines changed

doc/build-freebsd.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,6 @@ This explicitly enables the GUI and disables legacy wallet support. If `qt5` is
131131
**Important**: Use `gmake` (the non-GNU `make` will exit with an error).
132132

133133
```bash
134-
gmake # use -jX here for parallelism
134+
gmake # use "-j N" for N parallel jobs
135135
gmake check # Run tests if Python 3 is available
136136
```

doc/build-netbsd.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,6 @@ Without wallet:
7979

8080
Build and run the tests:
8181
```bash
82-
gmake # use -jX here for parallelism
82+
gmake # use "-j N" here for N parallel jobs
8383
gmake check
8484
```

doc/build-openbsd.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ To configure with GUI:
8585

8686
Build and run the tests:
8787
```bash
88-
gmake # use -jX here for parallelism
88+
gmake # use "-j N" here for N parallel jobs
8989
gmake check
9090
```
9191

doc/build-osx.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,14 @@ Skip if you don't intend to use the GUI.
138138
brew install qt@5
139139
```
140140

141+
Ensure that the `qt@5` package is installed, not the `qt` package.
142+
If 'qt' is installed, the build process will fail.
143+
if installed, remove the `qt` package with the following command:
144+
145+
``` bash
146+
brew uninstall qt
147+
```
148+
141149
Note: Building with Qt binaries downloaded from the Qt website is not officially supported.
142150
See the notes in [#7714](https://github.com/dashpay/dash/issues/7714).
143151

@@ -276,7 +284,7 @@ After configuration, you are ready to compile.
276284
Run the following in your terminal to compile Dash Core:
277285

278286
``` bash
279-
make -jx # use -jX here for parallelism
287+
make # use "-j N" here for N parallel jobs
280288
make check # Run tests if Python 3 is available
281289
```
282290

doc/build-unix.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ To Build
2222
```sh
2323
./autogen.sh
2424
./configure
25-
make
25+
make # use "-j N" for N parallel jobs
2626
make install # optional
2727
```
2828

doc/files.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ Subdirectory | File(s) | Description
6565
`./` | `governance.dat` | stores data for governance objects
6666
`./` | `mncache.dat` | stores data for masternode list
6767
`./` | `netfulfilled.dat` | stores data about recently made network requests
68-
`./` | `fee_estimates.dat` | Stores statistics used to estimate minimum transaction fees and priorities required for confirmation
68+
`./` | `fee_estimates.dat` | Stores statistics used to estimate minimum transaction fees required for confirmation
6969
`./` | `guisettings.ini.bak` | Backup of former [GUI settings](#gui-settings) after `-resetguisettings` option is used
7070
`./` | `ip_asn.map` | IP addresses to Autonomous System Numbers (ASNs) mapping used for bucketing of the peers; path can be specified with the `-asmap` option
7171
`./` | `mempool.dat` | Dump of the mempool's transactions

src/Makefile.qt.include

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ QT_MOC_CPP = \
6969
qt/moc_optionsmodel.cpp \
7070
qt/moc_overviewpage.cpp \
7171
qt/moc_peertablemodel.cpp \
72+
qt/moc_peertablesortproxy.cpp \
7273
qt/moc_paymentserver.cpp \
7374
qt/moc_psbtoperationsdialog.cpp \
7475
qt/moc_qrdialog.cpp \
@@ -146,6 +147,7 @@ BITCOIN_QT_H = \
146147
qt/overviewpage.h \
147148
qt/paymentserver.h \
148149
qt/peertablemodel.h \
150+
qt/peertablesortproxy.h \
149151
qt/psbtoperationsdialog.h \
150152
qt/qrdialog.h \
151153
qt/qrimagewidget.h \
@@ -227,6 +229,7 @@ BITCOIN_QT_BASE_CPP = \
227229
qt/optionsdialog.cpp \
228230
qt/optionsmodel.cpp \
229231
qt/peertablemodel.cpp \
232+
qt/peertablesortproxy.cpp \
230233
qt/qvalidatedlineedit.cpp \
231234
qt/qvaluecombobox.cpp \
232235
qt/rpcconsole.cpp \

src/qt/addressbookpage.cpp

Lines changed: 11 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -107,32 +107,20 @@ AddressBookPage::AddressBookPage(Mode _mode, Tabs _tab, QWidget* parent) :
107107
break;
108108
}
109109

110-
// Context menu actions
111-
QAction *copyAddressAction = new QAction(tr("&Copy Address"), this);
112-
QAction *copyLabelAction = new QAction(tr("Copy &Label"), this);
113-
QAction *editAction = new QAction(tr("&Edit"), this);
114-
QAction *showAddressQRCodeAction = new QAction(tr("&Show address QR code"), this);
115-
deleteAction = new QAction(ui->deleteAddress->text(), this);
110+
// Build context menu
111+
contextMenu = new QMenu(this);
112+
contextMenu->addAction(tr("&Copy Address"), this, &AddressBookPage::on_copyAddress_clicked);
113+
contextMenu->addAction(tr("Copy &Label"), this, &AddressBookPage::onCopyLabelAction);
114+
contextMenu->addAction(tr("&Edit"), this, &AddressBookPage::onEditAction);
115+
[[maybe_unused]] QAction* qrAction = contextMenu->addAction(tr("Show address &QR code"), this, &AddressBookPage::on_showAddressQRCode_clicked);
116116
#ifndef USE_QRCODE
117-
showAddressQRCodeAction->setEnabled(false);
117+
qrAction->setEnabled(false);
118118
#endif
119119

120-
// Build context menu
121-
contextMenu = new QMenu(this);
122-
contextMenu->addAction(copyAddressAction);
123-
contextMenu->addAction(copyLabelAction);
124-
contextMenu->addAction(editAction);
125-
if(tab == SendingTab)
126-
contextMenu->addAction(deleteAction);
127-
contextMenu->addSeparator();
128-
contextMenu->addAction(showAddressQRCodeAction);
129-
130-
// Connect signals for context menu actions
131-
connect(copyAddressAction, &QAction::triggered, this, &AddressBookPage::on_copyAddress_clicked);
132-
connect(copyLabelAction, &QAction::triggered, this, &AddressBookPage::onCopyLabelAction);
133-
connect(editAction, &QAction::triggered, this, &AddressBookPage::onEditAction);
134-
connect(deleteAction, &QAction::triggered, this, &AddressBookPage::on_deleteAddress_clicked);
135-
connect(showAddressQRCodeAction, &QAction::triggered, this, &AddressBookPage::on_showAddressQRCode_clicked);
120+
if (tab == SendingTab) {
121+
contextMenu->addAction(tr("&Delete"), this, &AddressBookPage::on_deleteAddress_clicked);
122+
}
123+
136124
connect(ui->tableView, &QWidget::customContextMenuRequested, this, &AddressBookPage::contextualMenu);
137125
connect(ui->closeButton, &QPushButton::clicked, this, &QDialog::accept);
138126

@@ -267,13 +255,11 @@ void AddressBookPage::selectionChanged()
267255
// In sending tab, allow deletion of selection
268256
ui->deleteAddress->setEnabled(true);
269257
ui->deleteAddress->setVisible(true);
270-
deleteAction->setEnabled(true);
271258
break;
272259
case ReceivingTab:
273260
// Deleting receiving addresses, however, is not allowed
274261
ui->deleteAddress->setEnabled(false);
275262
ui->deleteAddress->setVisible(false);
276-
deleteAction->setEnabled(false);
277263
break;
278264
}
279265
ui->copyAddress->setEnabled(true);

src/qt/addressbookpage.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ public Q_SLOTS:
5454
QString returnValue;
5555
AddressBookSortFilterProxyModel *proxyModel;
5656
QMenu *contextMenu;
57-
QAction *deleteAction; // to be able to explicitly disable it
5857
QString newAddressToSelect;
5958

6059
private Q_SLOTS:

src/qt/bitcoingui.cpp

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -520,10 +520,9 @@ void BitcoinGUI::createActions()
520520
for (const std::pair<const std::string, bool>& i : m_wallet_controller->listWalletDir()) {
521521
const std::string& path = i.first;
522522
QString name = path.empty() ? QString("["+tr("default wallet")+"]") : QString::fromStdString(path);
523-
// Menu items remove single &. Single & are shown when && is in
524-
// the string, but only the first occurrence. So replace only
525-
// the first & with &&.
526-
name.replace(name.indexOf(QChar('&')), 1, QString("&&"));
523+
// An single ampersand in the menu item's text sets a shortcut for this item.
524+
// Single & are shown when && is in the string. So replace & with &&.
525+
name.replace(QChar('&'), QString("&&"));
527526
QAction* action = m_open_wallet_menu->addAction(name);
528527

529528
if (i.second) {
@@ -747,7 +746,7 @@ void BitcoinGUI::createToolBars()
747746
#ifdef ENABLE_WALLET
748747
m_wallet_selector = new QComboBox(this);
749748
m_wallet_selector->setSizeAdjustPolicy(QComboBox::AdjustToContents);
750-
connect(m_wallet_selector, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this, &BitcoinGUI::setCurrentWalletBySelectorIndex);
749+
connect(m_wallet_selector, qOverload<int>(&QComboBox::currentIndexChanged), this, &BitcoinGUI::setCurrentWalletBySelectorIndex);
751750

752751
QVBoxLayout* walletSelectorLayout = new QVBoxLayout(this);
753752
walletSelectorLayout->addWidget(m_wallet_selector);
@@ -2055,11 +2054,8 @@ void UnitDisplayStatusBarControl::mousePressEvent(QMouseEvent *event)
20552054
void UnitDisplayStatusBarControl::createContextMenu()
20562055
{
20572056
menu = new QMenu(this);
2058-
for (const BitcoinUnits::Unit u : BitcoinUnits::availableUnits())
2059-
{
2060-
QAction *menuAction = new QAction(QString(BitcoinUnits::name(u)), this);
2061-
menuAction->setData(QVariant(u));
2062-
menu->addAction(menuAction);
2057+
for (const BitcoinUnits::Unit u : BitcoinUnits::availableUnits()) {
2058+
menu->addAction(BitcoinUnits::name(u))->setData(QVariant(u));
20632059
}
20642060
connect(menu, &QMenu::triggered, this, &UnitDisplayStatusBarControl::onMenuSelection);
20652061
}

0 commit comments

Comments
 (0)