Skip to content

Commit

Permalink
Merge branch 'bitcoin-core:main' into wsl-install-guide
Browse files Browse the repository at this point in the history
  • Loading branch information
D33r-Gee committed Jan 19, 2024
2 parents 7687e2c + be965bf commit 7ec2203
Show file tree
Hide file tree
Showing 7 changed files with 137 additions and 12 deletions.
1 change: 1 addition & 0 deletions src/Makefile.qt.include
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,7 @@ QML_RES_QML = \
qml/components/ConnectionOptions.qml \
qml/components/ConnectionSettings.qml \
qml/components/DeveloperOptions.qml \
qml/components/ExternalPopup.qml \
qml/components/PeersIndicator.qml \
qml/components/NetworkTrafficGraph.qml \
qml/components/NetworkIndicator.qml \
Expand Down
13 changes: 7 additions & 6 deletions src/qml/bitcoin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,13 @@ int QmlGuiMain(int argc, char* argv[])
SetupEnvironment();
util::ThreadSetInternalName("main");

// must be set before parsing command-line options; otherwise,
// if invalid parameters were passed, QSetting initialization would fail
// and the error will be displayed on terminal
app.setOrganizationName(QAPP_ORG_NAME);
app.setOrganizationDomain(QAPP_ORG_DOMAIN);
app.setApplicationName(QAPP_APP_NAME_DEFAULT);

/// Parse command-line options. We do this after qt in order to show an error if there are problems parsing these.
SetupServerArgs(gArgs);
SetupUIArgs(gArgs);
Expand All @@ -173,12 +180,6 @@ int QmlGuiMain(int argc, char* argv[])
return EXIT_FAILURE;
}

// must be set before OptionsModel is initialized or translations are loaded,
// as it is used to locate QSettings
app.setOrganizationName(QAPP_ORG_NAME);
app.setOrganizationDomain(QAPP_ORG_DOMAIN);
app.setApplicationName(QAPP_APP_NAME_DEFAULT);

/// Determine availability of data directory.
if (!CheckDataDirOption(gArgs)) {
InitError(strprintf(Untranslated("Specified data directory \"%s\" does not exist.\n"), gArgs.GetArg("-datadir", "")));
Expand Down
1 change: 1 addition & 0 deletions src/qml/bitcoin_qml.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
<file>components/ConnectionSettings.qml</file>
<file>components/PeersIndicator.qml</file>
<file>components/DeveloperOptions.qml</file>
<file>components/ExternalPopup.qml</file>
<file>components/NetworkTrafficGraph.qml</file>
<file>components/NetworkIndicator.qml</file>
<file>components/ProxySettings.qml</file>
Expand Down
18 changes: 14 additions & 4 deletions src/qml/components/AboutOptions.qml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ ColumnLayout {
description: "bitcoincore.org"
link: "https://bitcoincore.org"
}
onClicked: loadedItem.clicked()
onClicked: openPopup(loadedItem.link)
}
Separator { Layout.fillWidth: true }
Setting {
Expand All @@ -30,7 +30,7 @@ ColumnLayout {
description: "github.com/bitcoin/bitcoin"
link: "https://github.com/bitcoin/bitcoin"
}
onClicked: loadedItem.clicked()
onClicked: openPopup(loadedItem.link)
}
Separator { Layout.fillWidth: true }
Setting {
Expand All @@ -42,7 +42,7 @@ ColumnLayout {
description: "MIT"
link: "https://opensource.org/licenses/MIT"
}
onClicked: loadedItem.clicked()
onClicked: openPopup(loadedItem.link)
}
Separator { Layout.fillWidth: true }
Setting {
Expand All @@ -57,7 +57,7 @@ ColumnLayout {
iconWidth: 18
iconHeight: 18
}
onClicked: loadedItem.clicked()
onClicked: openPopup(loadedItem.link)
}
Separator { Layout.fillWidth: true }
Setting {
Expand All @@ -72,4 +72,14 @@ ColumnLayout {
aboutSwipe.incrementCurrentIndex()
}
}
ExternalPopup {
id: confirmPopup
anchors.centerIn: Overlay.overlay
width: parent.width
}

function openPopup(link) {
confirmPopup.link = link
confirmPopup.open()
}
}
114 changes: 114 additions & 0 deletions src/qml/components/ExternalPopup.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
// Copyright (c) 2023 The Bitcoin Core developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.

import QtQuick 2.15
import QtQuick.Controls 2.15
import QtQuick.Layouts 1.15
import Qt.labs.settings 1.0
import org.bitcoincore.qt 1.0
import "../controls"

Popup {
id: externalConfirmPopup
property string link: ""
modal: true
padding: 0

background: Rectangle {
color: Theme.color.background
radius: 10
}

ColumnLayout {
anchors.fill: parent
spacing: 0

NavigationBar {
Layout.preferredHeight: 55
middleDetail: Header {
Layout.fillWidth: true
header: qsTr("External Link")
headerBold: true
headerSize: 24
}
}

Separator {
Layout.fillWidth: true
}

ColumnLayout {
id: popupContent
Layout.fillWidth: true
Layout.rightMargin: 20
Layout.leftMargin: 20
Layout.topMargin: 20
Layout.bottomMargin: 20
spacing: 30
Header {
Layout.fillWidth: true
header: qsTr("Do you want to open the following website in your browser?")
headerBold: false
headerSize: 18
description: ("\"" + externalConfirmPopup.link + "\"")
descriptionMargin: 3
}
Loader {
id: layoutLoader
Layout.fillWidth: true
sourceComponent: AppMode.isDesktop ? desktopLayout : mobileLayout
}
}
}

Component {
id: desktopLayout
RowLayout {
Layout.fillWidth: true
spacing: 15
OutlineButton {
text: qsTr("Cancel")
Layout.fillWidth: true
Layout.minimumWidth: 150
onClicked: {
externalConfirmPopup.close()
}
}
ContinueButton {
text: qsTr("Ok")
Layout.fillWidth: true
Layout.minimumWidth: 150
onClicked: {
Qt.openUrlExternally(externalConfirmPopup.link)
externalConfirmPopup.close()
}
}
}
}

Component {
id: mobileLayout
ColumnLayout {
Layout.fillWidth: true
spacing: 15
OutlineButton {
text: qsTr("Cancel")
Layout.fillWidth: true
Layout.minimumWidth: 150
onClicked: {
externalConfirmPopup.close()
}
}
ContinueButton {
text: qsTr("Ok")
Layout.fillWidth: true
Layout.minimumWidth: 150
onClicked: {
Qt.openUrlExternally(externalConfirmPopup.link)
externalConfirmPopup.close()
}
}
}
}
}
1 change: 0 additions & 1 deletion src/qml/controls/ContinueButton.qml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ Button {
background: Rectangle {
id: bg
implicitHeight: 46
implicitWidth: 300
color: Theme.color.orange
radius: 5

Expand Down
1 change: 0 additions & 1 deletion src/qml/controls/OutlineButton.qml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ Button {
background: Rectangle {
id: bg
implicitHeight: 46
implicitWidth: 340
color: Theme.color.background
radius: 5
border {
Expand Down

0 comments on commit 7ec2203

Please sign in to comment.