Skip to content

Disable forms when loading #459

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 23, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/qml/components/Separator.qml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import "../controls"

Rectangle {
height: 1
color: Theme.color.neutral5
color: enabled ? Theme.color.neutral5 : Theme.color.neutral4

Behavior on color {
ColorAnimation { duration: 150 }
Expand Down
2 changes: 1 addition & 1 deletion src/qml/controls/CoreText.qml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import QtQuick.Controls 2.15
Text {
property bool bold: false
property bool wrap: true
color: Theme.color.neutral9
color: enabled ? Theme.color.neutral9 : Theme.color.neutral4
font.family: "Inter"
font.styleName: bold ? "Semi Bold" : "Regular"
font.pixelSize: 13
Expand Down
4 changes: 4 additions & 0 deletions src/qml/controls/EllipsisMenuButton.qml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ Button {
State {
name: "HOVER"; when: root.hovered
PropertyChanges { target: ellipsisIcon; color: hoverColor }
},
State {
name: "DISABLED"; when: !root.enabled
PropertyChanges { target: ellipsisIcon; color: Theme.color.neutral4 }
}
]
}
3 changes: 1 addition & 2 deletions src/qml/controls/LabeledCoinControlButton.qml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ Item {
anchors.verticalCenter: parent.verticalCenter
horizontalAlignment: Text.AlignLeft
width: 110
color: Theme.color.neutral9
font.pixelSize: 18
text: qsTr("Inputs")
}
Expand All @@ -30,7 +29,7 @@ Item {
anchors.left: label.right
anchors.verticalCenter: parent.verticalCenter
horizontalAlignment: Text.AlignLeft
color: Theme.color.orangeLight1
color: enabled ? Theme.color.orangeLight1 : Theme.color.neutral2
font.pixelSize: 18
text: {
if (coinCount === 0) {
Expand Down
5 changes: 2 additions & 3 deletions src/qml/controls/LabeledTextInput.qml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ Item {
anchors.verticalCenter: parent.verticalCenter
horizontalAlignment: Text.AlignLeft
width: 110
color: Theme.color.neutral9
font.pixelSize: 18
}

Expand All @@ -40,7 +39,7 @@ Item {
font.styleName: "Regular"
font.pixelSize: 18
color: Theme.color.neutral9
placeholderTextColor: Theme.color.neutral7
placeholderTextColor: enabled ? Theme.color.neutral7 : Theme.color.neutral4
background: Item {}
selectByMouse: true
onTextEdited: root.textEdited()
Expand All @@ -54,7 +53,7 @@ Item {
Icon {
id: icon
source: ""
color: Theme.color.neutral8
color: enabled ? Theme.color.neutral8 : Theme.color.neutral4
size: 30
enabled: source != ""
onClicked: root.iconClicked()
Expand Down
3 changes: 1 addition & 2 deletions src/qml/controls/NavButton.qml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ AbstractButton {
property int textSize: 18
property url iconSource: ""
property Rectangle iconBackground: null
property color iconColor: Theme.color.neutral9
property color iconColor: enabled ? Theme.color.neutral9 : Theme.color.neutral2
hoverEnabled: AppMode.isDesktop
topPadding: text_background.active ? 7 : 14
bottomPadding: text_background.active ? 7 : 14
Expand Down Expand Up @@ -88,7 +88,6 @@ AbstractButton {
anchors.verticalCenter: parent.verticalCenter
bold: true
font.pixelSize: root.textSize
color: Theme.color.neutral9
text: root.text
}
}
Expand Down
14 changes: 7 additions & 7 deletions src/qml/pages/wallet/RequestPayment.qml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ Page {

RowLayout {
id: contentRow

enabled: walletController.initialized

anchors.top: title.bottom
anchors.topMargin: 40
anchors.horizontalCenter: parent.horizontalCenter
Expand All @@ -59,7 +62,6 @@ Page {
anchors.left: parent.left
anchors.verticalCenter: parent.verticalCenter
horizontalAlignment: Text.AlignLeft
color: Theme.color.neutral9
text: "Amount"
font.pixelSize: 18
}
Expand All @@ -73,7 +75,7 @@ Page {
font.styleName: "Regular"
font.pixelSize: 18
color: Theme.color.neutral9
placeholderTextColor: Theme.color.neutral7
placeholderTextColor: enabled ? Theme.color.neutral7 : Theme.color.neutral4
background: Item {}
placeholderText: "0.00000000"
selectByMouse: true
Expand Down Expand Up @@ -104,14 +106,14 @@ Page {
anchors.verticalCenter: parent.verticalCenter
text: bitcoinAmount.unitLabel
font.pixelSize: 18
color: Theme.color.neutral7
color: enabled ? Theme.color.neutral7 : Theme.color.neutral4
}
Icon {
id: flipIcon
anchors.right: parent.right
anchors.verticalCenter: parent.verticalCenter
source: "image://images/flip-vertical"
color: Theme.color.neutral8
color: unitLabel.enabled ? Theme.color.neutral8 : Theme.color.neutral4
size: 30
}
}
Expand Down Expand Up @@ -156,7 +158,6 @@ Page {
width: 110
text: qsTr("Address")
font.pixelSize: 18
color: Theme.color.neutral9
}
CoreText {
id: copyLabel
Expand All @@ -166,7 +167,7 @@ Page {
width: 110
text: qsTr("copy")
font.pixelSize: 18
color: Theme.color.neutral7
color: enabled ? Theme.color.neutral7 : Theme.color.neutral4
}

Rectangle {
Expand All @@ -182,7 +183,6 @@ Page {
anchors.leftMargin: 5
horizontalAlignment: Text.AlignLeft
font.pixelSize: 18
color: Theme.color.neutral9
wrap: true
}
}
Expand Down
12 changes: 6 additions & 6 deletions src/qml/pages/wallet/Send.qml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ PageStack {

spacing: 10

enabled: walletController.initialized

Item {
id: titleRow
Layout.fillWidth: true
Expand All @@ -59,6 +61,7 @@ PageStack {
anchors.verticalCenter: parent.verticalCenter
text: qsTr("Send bitcoin")
font.pixelSize: 21
color: Theme.color.neutral9
bold: true
}
EllipsisMenuButton {
Expand Down Expand Up @@ -106,7 +109,6 @@ PageStack {
anchors.left: parent.left
anchors.verticalCenter: parent.verticalCenter
horizontalAlignment: Text.AlignLeft
color: Theme.color.neutral9
text: qsTr("Amount")
font.pixelSize: 18
}
Expand All @@ -120,7 +122,7 @@ PageStack {
font.styleName: "Regular"
font.pixelSize: 18
color: Theme.color.neutral9
placeholderTextColor: Theme.color.neutral7
placeholderTextColor: enabled ? Theme.color.neutral7 : Theme.color.neutral4
background: Item {}
placeholderText: "0.00000000"
selectByMouse: true
Expand Down Expand Up @@ -152,14 +154,14 @@ PageStack {
anchors.verticalCenter: parent.verticalCenter
text: bitcoinAmount.unitLabel
font.pixelSize: 18
color: Theme.color.neutral7
color: enabled ? Theme.color.neutral7 : Theme.color.neutral4
}
Icon {
id: flipIcon
anchors.right: parent.right
anchors.verticalCenter: parent.verticalCenter
source: "image://images/flip-vertical"
color: Theme.color.neutral8
icon.color: unitLabel.enabled ? Theme.color.neutral8 : Theme.color.neutral4
size: 30
}
}
Expand Down Expand Up @@ -204,7 +206,6 @@ PageStack {
id: feeLabel
anchors.left: parent.left
anchors.top: parent.top
color: Theme.color.neutral9
text: "Fee"
font.pixelSize: 15
}
Expand All @@ -213,7 +214,6 @@ PageStack {
id: feeValue
anchors.right: parent.right
anchors.top: parent.top
color: Theme.color.neutral9
text: qsTr("Default (~2,000 sats)")
font.pixelSize: 15
}
Expand Down
3 changes: 3 additions & 0 deletions src/qml/walletqmlcontroller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,4 +120,7 @@ void WalletQmlController::initialize()
m_selected_wallet = m_wallets.front();
Q_EMIT selectedWalletChanged();
}

m_initialized = true;
Q_EMIT initializedChanged();
}
8 changes: 7 additions & 1 deletion src/qml/walletqmlcontroller.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,22 @@
#define BITCOIN_QML_WALLETQMLCONTROLLER_H

#include <qml/models/walletqmlmodel.h>

#include <interfaces/handler.h>
#include <interfaces/node.h>
#include <interfaces/wallet.h>

#include <memory>

#include <QMutex>
#include <QObject>
#include <QThread>
#include <memory>

class WalletQmlController : public QObject
{
Q_OBJECT
Q_PROPERTY(WalletQmlModel* selectedWallet READ selectedWallet NOTIFY selectedWalletChanged)
Q_PROPERTY(bool initialized READ initialized NOTIFY initializedChanged)

public:
explicit WalletQmlController(interfaces::Node& node, QObject *parent = nullptr);
Expand All @@ -29,16 +32,19 @@ class WalletQmlController : public QObject

WalletQmlModel* selectedWallet() const;
void unloadWallets();
bool initialized() const { return m_initialized; }

Q_SIGNALS:
void selectedWalletChanged();
void initializedChanged();

public Q_SLOTS:
void initialize();

private:
void handleLoadWallet(std::unique_ptr<interfaces::Wallet> wallet);

bool m_initialized{false};
interfaces::Node& m_node;
WalletQmlModel* m_selected_wallet;
QObject* m_worker;
Expand Down
Loading