mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-06-28 09:51:31 +02:00
Merge bitcoin-core/gui#430: Improvements to the open up transaction in third-party link action
2ccde2f9329d2685563b09ff0830f0d5916f57d5 qt: hyphenate usage of third-party modifier (Jarol Rodriguez) 8177578b296adb82fb8ab6c64cd76b832ebcc132 qt: ensure seperator when adding third-party transaction links (Jarol Rodriguez) a70a98075a0d258d41c1310553a2337538a1d80c qt: improve text for open third-party tx url action (Jarol Rodriguez) 9980f4aa5eaf3c0f62cf699d6a9c4677a1ea3365 qt, refactor: simplify third-party tx url action through overload (Jarol Rodriguez) Pull request description: [#4092](https://github.com/bitcoin/bitcoin/pull/4092) introduced the ability to open up a transaction in a block explorer. This improves the related code by simplifying the addition and connection of the action through an [overloaded](https://doc.qt.io/archives/qt-5.9/qmenu.html#addAction-5) `addAction` function and prepends action description text to the host, "Show in". The reason to add this text is to make it clear what the action does. It also creates a clearer mental correlation between a user doing the work to add the 3rd-party tx link and this new menu action popping up. This updates the setting text so that "third-party" is hyphenated. It should be hyphenated because it is being used as a modifier of both "URL" and "transaction URLs". Additionally, this fixes #431 by ensuring that the seperator will be added before creating action. Screenshots of visual changes: **Context menu actions** | master | pr | |--------------|--------| | <img width="248" alt="3pt-master" src="https://user-images.githubusercontent.com/23396902/134618354-00278ac6-5094-44ee-8ba7-fe648fdcb7d2.png"> | <img width="248" alt="3pt-pr" src="https://user-images.githubusercontent.com/23396902/134618364-ddb64269-e5ee-40af-a2a6-1922001b6f4e.png"> | **Setting text** (tooltip text containing usage of "third-party" is also properly hyphenated) | master | pr | |--------------|--------| |  |  | ACKs for top commit: stratospher: tested ACK 2ccde2f. promag: Code view ACK 2ccde2f9329d2685563b09ff0830f0d5916f57d5. hebasto: ACK 2ccde2f9329d2685563b09ff0830f0d5916f57d5 Tree-SHA512: 8dfcd539a1d41c8abf3c8208d150d1480d4ef81a008de826299e8bad1dfa6e3c49dc76d041c5946fafcf0b033eebb9b9fbd3d49ba6d8af93dd388c488e92f143
This commit is contained in:
commit
ba1a82e608
@ -739,10 +739,10 @@
|
||||
<item>
|
||||
<widget class="QLabel" name="thirdPartyTxUrlsLabel">
|
||||
<property name="toolTip">
|
||||
<string>Third party URLs (e.g. a block explorer) that appear in the transactions tab as context menu items. %s in the URL is replaced by transaction hash. Multiple URLs are separated by vertical bar |.</string>
|
||||
<string>Third-party URLs (e.g. a block explorer) that appear in the transactions tab as context menu items. %s in the URL is replaced by transaction hash. Multiple URLs are separated by vertical bar |.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Third party transaction URLs</string>
|
||||
<string>&Third-party transaction URLs</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>thirdPartyTxUrls</cstring>
|
||||
@ -752,7 +752,7 @@
|
||||
<item>
|
||||
<widget class="QLineEdit" name="thirdPartyTxUrls">
|
||||
<property name="toolTip">
|
||||
<string>Third party URLs (e.g. a block explorer) that appear in the transactions tab as context menu items. %s in the URL is replaced by transaction hash. Multiple URLs are separated by vertical bar |.</string>
|
||||
<string>Third-party URLs (e.g. a block explorer) that appear in the transactions tab as context menu items. %s in the URL is replaced by transaction hash. Multiple URLs are separated by vertical bar |.</string>
|
||||
</property>
|
||||
<property name="placeholderText">
|
||||
<string notr="true">https://example.com/tx/%s</string>
|
||||
|
@ -222,17 +222,21 @@ void TransactionView::setModel(WalletModel *_model)
|
||||
{
|
||||
// Add third party transaction URLs to context menu
|
||||
QStringList listUrls = GUIUtil::SplitSkipEmptyParts(_model->getOptionsModel()->getThirdPartyTxUrls(), "|");
|
||||
bool actions_created = false;
|
||||
for (int i = 0; i < listUrls.size(); ++i)
|
||||
{
|
||||
QString url = listUrls[i].trimmed();
|
||||
QString host = QUrl(url, QUrl::StrictMode).host();
|
||||
if (!host.isEmpty())
|
||||
{
|
||||
QAction *thirdPartyTxUrlAction = new QAction(host, this); // use host as menu item label
|
||||
if (i == 0)
|
||||
if (!actions_created) {
|
||||
contextMenu->addSeparator();
|
||||
contextMenu->addAction(thirdPartyTxUrlAction);
|
||||
connect(thirdPartyTxUrlAction, &QAction::triggered, [this, url] { openThirdPartyTxUrl(url); });
|
||||
actions_created = true;
|
||||
}
|
||||
/*: Transactions table context menu action to show the
|
||||
selected transaction in a third-party block explorer.
|
||||
%1 is a stand-in argument for the URL of the explorer. */
|
||||
contextMenu->addAction(tr("Show in %1").arg(host), [this, url] { openThirdPartyTxUrl(url); });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user