mirror of
https://github.com/monero-project/monero-gui
synced 2024-12-20 04:15:53 +01:00
Report when the GUI is connected to a daemon with mismatched version
This will cause various errors confusing to the user, as they stem for the daemon returning replies with missing information, etc.
This commit is contained in:
parent
c9bb2f5718
commit
689f0415e7
@ -28,6 +28,7 @@
|
||||
|
||||
import QtQuick 2.2
|
||||
import QtGraphicalEffects 1.0
|
||||
import moneroComponents.Wallet 1.0
|
||||
import "components"
|
||||
|
||||
Rectangle {
|
||||
@ -356,7 +357,7 @@ Rectangle {
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
anchors.bottom: (daemonProgress.visible)? daemonProgress.top : parent.bottom;
|
||||
connected: false
|
||||
connected: Wallet.ConnectionStatus_Disconnected
|
||||
}
|
||||
|
||||
DaemonProgress {
|
||||
|
@ -27,10 +27,35 @@
|
||||
// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
import QtQuick 2.0
|
||||
import moneroComponents.Wallet 1.0
|
||||
|
||||
Row {
|
||||
id: item
|
||||
property bool connected: false
|
||||
property var connected: Wallet.ConnectionStatus_Disconnected
|
||||
|
||||
function getConnectionStatusImage(status) {
|
||||
if (status == Wallet.ConnectionStatus_Connected)
|
||||
return "../images/statusConnected.png"
|
||||
else
|
||||
return "../images/statusDisconnected.png"
|
||||
}
|
||||
|
||||
function getConnectionStatusColor(status) {
|
||||
if (status == Wallet.ConnectionStatus_Connected)
|
||||
return "#FF6C3B"
|
||||
else
|
||||
return "#AAAAAA"
|
||||
}
|
||||
|
||||
function getConnectionStatusString(status) {
|
||||
if (status == Wallet.ConnectionStatus_Connected)
|
||||
return qsTr("Connected")
|
||||
if (status == Wallet.ConnectionStatus_WrongVersion)
|
||||
return qsTr("Wrong version")
|
||||
if (status == Wallet.ConnectionStatus_Disconnected)
|
||||
return qsTr("Disconnected")
|
||||
return qsTr("Invalid connection status")
|
||||
}
|
||||
|
||||
Item {
|
||||
id: iconItem
|
||||
@ -40,8 +65,7 @@ Row {
|
||||
|
||||
Image {
|
||||
anchors.centerIn: parent
|
||||
source: item.connected ? "../images/statusConnected.png" :
|
||||
"../images/statusDisconnected.png"
|
||||
source: getConnectionStatusImage(item.connected)
|
||||
}
|
||||
}
|
||||
|
||||
@ -62,8 +86,8 @@ Row {
|
||||
anchors.left: parent.left
|
||||
font.family: "Arial"
|
||||
font.pixelSize: 18
|
||||
color: item.connected ? "#FF6C3B" : "#AAAAAA"
|
||||
text: (item.connected ? qsTr("Connected") : qsTr("Disconnected")) + translationManager.emptyString
|
||||
color: getConnectionStatusColor(item.connected)
|
||||
text: getConnectionStatusString(item.connected) + translationManager.emptyString
|
||||
}
|
||||
}
|
||||
}
|
||||
|
7
main.qml
7
main.qml
@ -264,7 +264,7 @@ ApplicationWindow {
|
||||
|
||||
// Daemon fully synced
|
||||
// TODO: implement onDaemonSynced or similar in wallet API and don't start refresh thread before daemon is synced
|
||||
daemonSynced = (currentWallet.connected && dCurrentBlock >= dTargetBlock)
|
||||
daemonSynced = (currentWallet.connected != Wallet.ConnectionStatus_Disconnected && dCurrentBlock >= dTargetBlock)
|
||||
|
||||
|
||||
|
||||
@ -387,7 +387,10 @@ ApplicationWindow {
|
||||
if (transaction.status !== PendingTransaction.Status_Ok) {
|
||||
console.error("Can't create transaction: ", transaction.errorString);
|
||||
informationPopup.title = qsTr("Error") + translationManager.emptyString;
|
||||
informationPopup.text = qsTr("Can't create transaction: ") + transaction.errorString
|
||||
if (currentWallet.connected == Wallet.ConnectionStatus_WrongVersion)
|
||||
informationPopup.text = qsTr("Can't create transaction: Wrong daemon version: ") + transaction.errorString
|
||||
else
|
||||
informationPopup.text = qsTr("Can't create transaction: ") + transaction.errorString
|
||||
informationPopup.icon = StandardIcon.Critical
|
||||
informationPopup.onCloseCallback = null
|
||||
informationPopup.open();
|
||||
|
@ -86,9 +86,9 @@ Wallet::Status Wallet::status() const
|
||||
return static_cast<Status>(m_walletImpl->status());
|
||||
}
|
||||
|
||||
bool Wallet::connected() const
|
||||
Wallet::ConnectionStatus Wallet::connected() const
|
||||
{
|
||||
return m_walletImpl->connected();
|
||||
return static_cast<ConnectionStatus>(m_walletImpl->connected());
|
||||
}
|
||||
|
||||
bool Wallet::synchronized() const
|
||||
|
@ -22,7 +22,7 @@ class Wallet : public QObject
|
||||
Q_PROPERTY(QString seed READ getSeed)
|
||||
Q_PROPERTY(QString seedLanguage READ getSeedLanguage)
|
||||
Q_PROPERTY(Status status READ status)
|
||||
Q_PROPERTY(bool connected READ connected)
|
||||
Q_PROPERTY(ConnectionStatus connected READ connected)
|
||||
Q_PROPERTY(bool synchronized READ synchronized)
|
||||
Q_PROPERTY(QString errorString READ errorString)
|
||||
Q_PROPERTY(QString address READ address)
|
||||
@ -42,6 +42,14 @@ public:
|
||||
|
||||
Q_ENUM(Status)
|
||||
|
||||
enum ConnectionStatus {
|
||||
ConnectionStatus_Connected = Bitmonero::Wallet::ConnectionStatus_Connected,
|
||||
ConnectionStatus_Disconnected = Bitmonero::Wallet::ConnectionStatus_Disconnected,
|
||||
ConnectionStatus_WrongVersion = Bitmonero::Wallet::ConnectionStatus_WrongVersion
|
||||
};
|
||||
|
||||
Q_ENUM(ConnectionStatus)
|
||||
|
||||
//! returns mnemonic seed
|
||||
QString getSeed() const;
|
||||
|
||||
@ -54,8 +62,8 @@ public:
|
||||
//! returns last operation's status
|
||||
Status status() const;
|
||||
|
||||
//! returns true if wallet connected
|
||||
bool connected() const;
|
||||
//! returns whether the wallet is connected, and version status
|
||||
ConnectionStatus connected() const;
|
||||
|
||||
//! returns true if wallet was ever synchronized
|
||||
bool synchronized() const;
|
||||
|
Loading…
Reference in New Issue
Block a user