Skip to content

Commit 7ec2203

Browse files
authored
Merge branch 'bitcoin-core:main' into wsl-install-guide
2 parents 7687e2c + be965bf commit 7ec2203

File tree

7 files changed

+137
-12
lines changed

7 files changed

+137
-12
lines changed

src/Makefile.qt.include

+1
Original file line numberDiff line numberDiff line change
@@ -347,6 +347,7 @@ QML_RES_QML = \
347347
qml/components/ConnectionOptions.qml \
348348
qml/components/ConnectionSettings.qml \
349349
qml/components/DeveloperOptions.qml \
350+
qml/components/ExternalPopup.qml \
350351
qml/components/PeersIndicator.qml \
351352
qml/components/NetworkTrafficGraph.qml \
352353
qml/components/NetworkIndicator.qml \

src/qml/bitcoin.cpp

+7-6
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,13 @@ int QmlGuiMain(int argc, char* argv[])
164164
SetupEnvironment();
165165
util::ThreadSetInternalName("main");
166166

167+
// must be set before parsing command-line options; otherwise,
168+
// if invalid parameters were passed, QSetting initialization would fail
169+
// and the error will be displayed on terminal
170+
app.setOrganizationName(QAPP_ORG_NAME);
171+
app.setOrganizationDomain(QAPP_ORG_DOMAIN);
172+
app.setApplicationName(QAPP_APP_NAME_DEFAULT);
173+
167174
/// Parse command-line options. We do this after qt in order to show an error if there are problems parsing these.
168175
SetupServerArgs(gArgs);
169176
SetupUIArgs(gArgs);
@@ -173,12 +180,6 @@ int QmlGuiMain(int argc, char* argv[])
173180
return EXIT_FAILURE;
174181
}
175182

176-
// must be set before OptionsModel is initialized or translations are loaded,
177-
// as it is used to locate QSettings
178-
app.setOrganizationName(QAPP_ORG_NAME);
179-
app.setOrganizationDomain(QAPP_ORG_DOMAIN);
180-
app.setApplicationName(QAPP_APP_NAME_DEFAULT);
181-
182183
/// Determine availability of data directory.
183184
if (!CheckDataDirOption(gArgs)) {
184185
InitError(strprintf(Untranslated("Specified data directory \"%s\" does not exist.\n"), gArgs.GetArg("-datadir", "")));

src/qml/bitcoin_qml.qrc

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
<file>components/ConnectionSettings.qml</file>
1010
<file>components/PeersIndicator.qml</file>
1111
<file>components/DeveloperOptions.qml</file>
12+
<file>components/ExternalPopup.qml</file>
1213
<file>components/NetworkTrafficGraph.qml</file>
1314
<file>components/NetworkIndicator.qml</file>
1415
<file>components/ProxySettings.qml</file>

src/qml/components/AboutOptions.qml

+14-4
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ ColumnLayout {
1818
description: "bitcoincore.org"
1919
link: "https://bitcoincore.org"
2020
}
21-
onClicked: loadedItem.clicked()
21+
onClicked: openPopup(loadedItem.link)
2222
}
2323
Separator { Layout.fillWidth: true }
2424
Setting {
@@ -30,7 +30,7 @@ ColumnLayout {
3030
description: "github.com/bitcoin/bitcoin"
3131
link: "https://github.com/bitcoin/bitcoin"
3232
}
33-
onClicked: loadedItem.clicked()
33+
onClicked: openPopup(loadedItem.link)
3434
}
3535
Separator { Layout.fillWidth: true }
3636
Setting {
@@ -42,7 +42,7 @@ ColumnLayout {
4242
description: "MIT"
4343
link: "https://opensource.org/licenses/MIT"
4444
}
45-
onClicked: loadedItem.clicked()
45+
onClicked: openPopup(loadedItem.link)
4646
}
4747
Separator { Layout.fillWidth: true }
4848
Setting {
@@ -57,7 +57,7 @@ ColumnLayout {
5757
iconWidth: 18
5858
iconHeight: 18
5959
}
60-
onClicked: loadedItem.clicked()
60+
onClicked: openPopup(loadedItem.link)
6161
}
6262
Separator { Layout.fillWidth: true }
6363
Setting {
@@ -72,4 +72,14 @@ ColumnLayout {
7272
aboutSwipe.incrementCurrentIndex()
7373
}
7474
}
75+
ExternalPopup {
76+
id: confirmPopup
77+
anchors.centerIn: Overlay.overlay
78+
width: parent.width
79+
}
80+
81+
function openPopup(link) {
82+
confirmPopup.link = link
83+
confirmPopup.open()
84+
}
7585
}

src/qml/components/ExternalPopup.qml

+114
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
// Copyright (c) 2023 The Bitcoin Core developers
2+
// Distributed under the MIT software license, see the accompanying
3+
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
4+
5+
import QtQuick 2.15
6+
import QtQuick.Controls 2.15
7+
import QtQuick.Layouts 1.15
8+
import Qt.labs.settings 1.0
9+
import org.bitcoincore.qt 1.0
10+
import "../controls"
11+
12+
Popup {
13+
id: externalConfirmPopup
14+
property string link: ""
15+
modal: true
16+
padding: 0
17+
18+
background: Rectangle {
19+
color: Theme.color.background
20+
radius: 10
21+
}
22+
23+
ColumnLayout {
24+
anchors.fill: parent
25+
spacing: 0
26+
27+
NavigationBar {
28+
Layout.preferredHeight: 55
29+
middleDetail: Header {
30+
Layout.fillWidth: true
31+
header: qsTr("External Link")
32+
headerBold: true
33+
headerSize: 24
34+
}
35+
}
36+
37+
Separator {
38+
Layout.fillWidth: true
39+
}
40+
41+
ColumnLayout {
42+
id: popupContent
43+
Layout.fillWidth: true
44+
Layout.rightMargin: 20
45+
Layout.leftMargin: 20
46+
Layout.topMargin: 20
47+
Layout.bottomMargin: 20
48+
spacing: 30
49+
Header {
50+
Layout.fillWidth: true
51+
header: qsTr("Do you want to open the following website in your browser?")
52+
headerBold: false
53+
headerSize: 18
54+
description: ("\"" + externalConfirmPopup.link + "\"")
55+
descriptionMargin: 3
56+
}
57+
Loader {
58+
id: layoutLoader
59+
Layout.fillWidth: true
60+
sourceComponent: AppMode.isDesktop ? desktopLayout : mobileLayout
61+
}
62+
}
63+
}
64+
65+
Component {
66+
id: desktopLayout
67+
RowLayout {
68+
Layout.fillWidth: true
69+
spacing: 15
70+
OutlineButton {
71+
text: qsTr("Cancel")
72+
Layout.fillWidth: true
73+
Layout.minimumWidth: 150
74+
onClicked: {
75+
externalConfirmPopup.close()
76+
}
77+
}
78+
ContinueButton {
79+
text: qsTr("Ok")
80+
Layout.fillWidth: true
81+
Layout.minimumWidth: 150
82+
onClicked: {
83+
Qt.openUrlExternally(externalConfirmPopup.link)
84+
externalConfirmPopup.close()
85+
}
86+
}
87+
}
88+
}
89+
90+
Component {
91+
id: mobileLayout
92+
ColumnLayout {
93+
Layout.fillWidth: true
94+
spacing: 15
95+
OutlineButton {
96+
text: qsTr("Cancel")
97+
Layout.fillWidth: true
98+
Layout.minimumWidth: 150
99+
onClicked: {
100+
externalConfirmPopup.close()
101+
}
102+
}
103+
ContinueButton {
104+
text: qsTr("Ok")
105+
Layout.fillWidth: true
106+
Layout.minimumWidth: 150
107+
onClicked: {
108+
Qt.openUrlExternally(externalConfirmPopup.link)
109+
externalConfirmPopup.close()
110+
}
111+
}
112+
}
113+
}
114+
}

src/qml/controls/ContinueButton.qml

-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ Button {
1717
background: Rectangle {
1818
id: bg
1919
implicitHeight: 46
20-
implicitWidth: 300
2120
color: Theme.color.orange
2221
radius: 5
2322

src/qml/controls/OutlineButton.qml

-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ Button {
1818
background: Rectangle {
1919
id: bg
2020
implicitHeight: 46
21-
implicitWidth: 340
2221
color: Theme.color.background
2322
radius: 5
2423
border {

0 commit comments

Comments
 (0)