mirror of
https://github.com/monero-project/monero-gui.git
synced 2025-02-02 19:16:27 +00:00
Added component WarningBox and added a warning to remote node page
This commit is contained in:
parent
a9fa808dd1
commit
0fed21d6de
4 changed files with 82 additions and 66 deletions
63
components/WarningBox.qml
Normal file
63
components/WarningBox.qml
Normal file
|
@ -0,0 +1,63 @@
|
|||
import QtQuick 2.7
|
||||
import QtQuick.Layouts 1.1
|
||||
import QtQuick.Controls 2.0
|
||||
|
||||
import "." as MoneroComponents
|
||||
|
||||
Rectangle {
|
||||
id: root
|
||||
property alias text: content.text
|
||||
property int fontSize: 15 * scaleRatio
|
||||
|
||||
Layout.fillWidth: true
|
||||
Layout.preferredHeight: warningLayout.height
|
||||
|
||||
color: "#09FFFFFF"
|
||||
radius: 4
|
||||
border.color: MoneroComponents.Style.inputBorderColorInActive
|
||||
border.width: 1
|
||||
|
||||
signal linkActivated;
|
||||
|
||||
RowLayout {
|
||||
id: warningLayout
|
||||
spacing: 0
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
|
||||
Image {
|
||||
Layout.alignment: Qt.AlignVCenter
|
||||
Layout.preferredHeight: 33
|
||||
Layout.preferredWidth: 33
|
||||
Layout.rightMargin: 14
|
||||
Layout.leftMargin: 14
|
||||
Layout.topMargin: 12
|
||||
Layout.bottomMargin: 12
|
||||
source: "../images/warning.png"
|
||||
}
|
||||
|
||||
TextArea {
|
||||
id: content
|
||||
Layout.fillWidth: true
|
||||
color: MoneroComponents.Style.defaultFontColor
|
||||
font.family: MoneroComponents.Style.fontRegular.name
|
||||
font.pixelSize: root.fontSize
|
||||
horizontalAlignment: TextInput.AlignLeft
|
||||
selectByMouse: false
|
||||
textFormat: Text.RichText
|
||||
wrapMode: Text.WordWrap
|
||||
textMargin: 0
|
||||
leftPadding: 0
|
||||
topPadding: 6
|
||||
readOnly: true
|
||||
onLinkActivated: root.linkActivated();
|
||||
|
||||
// @TODO: Legacy. Remove after Qt 5.8.
|
||||
// https://stackoverflow.com/questions/41990013
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
enabled: false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -33,6 +33,7 @@ import moneroComponents.Clipboard 1.0
|
|||
import moneroComponents.PendingTransaction 1.0
|
||||
import moneroComponents.Wallet 1.0
|
||||
import "../components"
|
||||
import "../components" as MoneroComponents
|
||||
import "." 1.0
|
||||
|
||||
|
||||
|
@ -43,6 +44,7 @@ Rectangle {
|
|||
signal sweepUnmixableClicked()
|
||||
|
||||
color: "transparent"
|
||||
property string warningContent: ""
|
||||
property string startLinkText: qsTr("<style type='text/css'>a {text-decoration: none; color: #FF6C3C; font-size: 14px;}</style><font size='2'> (</font><a href='#'>Start daemon</a><font size='2'>)</font>") + translationManager.emptyString
|
||||
property bool showAdvanced: false
|
||||
|
||||
|
@ -122,47 +124,13 @@ Rectangle {
|
|||
|
||||
spacing: 30 * scaleRatio
|
||||
|
||||
RowLayout{
|
||||
visible: warningText.text !== ""
|
||||
RowLayout {
|
||||
visible: root.warningContent !== ""
|
||||
|
||||
Rectangle {
|
||||
id: statusRect
|
||||
Layout.preferredHeight: warningText.height + 40
|
||||
Layout.fillWidth: true
|
||||
|
||||
radius: 2
|
||||
border.color: Style.inputBorderColorInActive
|
||||
border.width: 1
|
||||
color: "transparent"
|
||||
|
||||
GridLayout{
|
||||
Layout.fillWidth: true
|
||||
Layout.preferredHeight: warningText.height + 40
|
||||
|
||||
Image {
|
||||
Layout.alignment: Qt.AlignVCenter
|
||||
Layout.preferredHeight: 33
|
||||
Layout.preferredWidth: 33
|
||||
Layout.leftMargin: 10
|
||||
Layout.topMargin: 10
|
||||
source: "../images/warning.png"
|
||||
}
|
||||
|
||||
Text {
|
||||
id: warningText
|
||||
Layout.topMargin: 12 * scaleRatio
|
||||
Layout.preferredWidth: statusRect.width - 80
|
||||
Layout.leftMargin: 6
|
||||
text: qsTr("This page lets you sign/verify a message (or file contents) with your address.") + translationManager.emptyString
|
||||
wrapMode: Text.Wrap
|
||||
font.family: Style.fontRegular.name
|
||||
font.pixelSize: 14 * scaleRatio
|
||||
color: Style.defaultFontColor
|
||||
textFormat: Text.RichText
|
||||
onLinkActivated: {
|
||||
appWindow.startDaemon(appWindow.persistentSettings.daemonFlags);
|
||||
}
|
||||
}
|
||||
MoneroComponents.WarningBox {
|
||||
text: warningContent
|
||||
onLinkActivated: {
|
||||
appWindow.startDaemon(appWindow.persistentSettings.daemonFlags);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -356,7 +324,7 @@ Rectangle {
|
|||
}
|
||||
|
||||
// There is no warning box displayed
|
||||
if(warningText.text !== ''){
|
||||
if(root.warningContent !== ''){
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -711,7 +679,7 @@ Rectangle {
|
|||
function updateStatus() {
|
||||
pageRoot.enabled = true;
|
||||
if(typeof currentWallet === "undefined") {
|
||||
warningText.text = qsTr("Wallet is not connected to daemon.") + root.startLinkText
|
||||
root.warningContent = qsTr("Wallet is not connected to daemon.") + root.startLinkText
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -723,20 +691,20 @@ Rectangle {
|
|||
|
||||
switch (currentWallet.connected()) {
|
||||
case Wallet.ConnectionStatus_Disconnected:
|
||||
warningText.text = qsTr("Wallet is not connected to daemon.") + root.startLinkText
|
||||
root.warningContent = qsTr("Wallet is not connected to daemon.") + root.startLinkText
|
||||
break
|
||||
case Wallet.ConnectionStatus_WrongVersion:
|
||||
warningText.text = qsTr("Connected daemon is not compatible with GUI. \n" +
|
||||
root.warningContent = qsTr("Connected daemon is not compatible with GUI. \n" +
|
||||
"Please upgrade or connect to another daemon")
|
||||
break
|
||||
default:
|
||||
if(!appWindow.daemonSynced){
|
||||
warningText.text = qsTr("Waiting on daemon synchronization to finish")
|
||||
root.warningContent = qsTr("Waiting on daemon synchronization to finish")
|
||||
} else {
|
||||
// everything OK, enable transfer page
|
||||
// Light wallet is always ready
|
||||
pageRoot.enabled = true;
|
||||
warningText.text = "";
|
||||
root.warningContent = "";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -271,26 +271,10 @@ Rectangle{
|
|||
Layout.topMargin: 20
|
||||
visible: !isMobile && persistentSettings.useRemoteNode
|
||||
|
||||
TextArea {
|
||||
color: MoneroComponents.Style.dimmedFontColor
|
||||
font.family: MoneroComponents.Style.fontRegular.name
|
||||
font.pixelSize: 15 * scaleRatio
|
||||
horizontalAlignment: TextInput.AlignLeft
|
||||
text: qsTr("To find a remote node, type 'Monero remote node' into your favorite search engine. Please ensure the node is run by a trusted third party. For more details, view this tutorial.") + translationManager.emptyString
|
||||
width: parent.width - (remoteNodeIcon.width + remoteNodeIcon.anchors.leftMargin + anchors.leftMargin)
|
||||
activeFocusOnPress: false
|
||||
selectByMouse: false
|
||||
wrapMode: Text.WordWrap
|
||||
textMargin: 0
|
||||
leftPadding: 0
|
||||
topPadding: 0
|
||||
|
||||
// @TODO: Legacy. Remove after Qt 5.8.
|
||||
// https://stackoverflow.com/questions/41990013
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
enabled: false
|
||||
}
|
||||
MoneroComponents.WarningBox {
|
||||
Layout.topMargin: 26 * scaleRatio
|
||||
Layout.bottomMargin: 6 * scaleRatio
|
||||
text: qsTr("To find a remote node, type 'Monero remote node' into your favorite search engine. Please ensure the node is run by a trusted third-party.") + translationManager.emptyString
|
||||
}
|
||||
|
||||
MoneroComponents.RemoteNodeEdit {
|
||||
|
|
1
qml.qrc
1
qml.qrc
|
@ -219,5 +219,6 @@
|
|||
<file>images/settings_navbar_side.png</file>
|
||||
<file>images/settings_navbar_side_active.png</file>
|
||||
<file>images/settings_local.png</file>
|
||||
<file>components/WarningBox.qml</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
|
Loading…
Reference in a new issue