diff --git a/BasicPanel.qml b/BasicPanel.qml index 481fe8c4..abeb135c 100644 --- a/BasicPanel.qml +++ b/BasicPanel.qml @@ -27,6 +27,7 @@ // THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. import QtQuick 2.0 +import QtGraphicalEffects 1.0 import "components" import "pages" @@ -167,5 +168,12 @@ Rectangle { } } + // indicate disabled state + Desaturate { + anchors.fill: parent + source: parent + desaturation: root.enabled ? 0.0 : 1.0 + } + } diff --git a/LeftPanel.qml b/LeftPanel.qml index 604f2d6e..851db047 100644 --- a/LeftPanel.qml +++ b/LeftPanel.qml @@ -27,6 +27,7 @@ // THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. import QtQuick 2.2 +import QtGraphicalEffects 1.0 import "components" Rectangle { @@ -355,4 +356,12 @@ Rectangle { connected: false } } + // indicate disabled state + Desaturate { + anchors.fill: parent + source: parent + desaturation: panel.enabled ? 0.0 : 1.0 + } + + } diff --git a/MiddlePanel.qml b/MiddlePanel.qml index cb1c74d6..a2cabc1c 100644 --- a/MiddlePanel.qml +++ b/MiddlePanel.qml @@ -27,8 +27,10 @@ // THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. import QtQuick 2.2 +import QtGraphicalEffects 1.0 Rectangle { + id: root color: "#F0EEEE" signal paymentClicked(string address, string paymentId, double amount, int mixinCount, int priority) signal generatePaymentIdInvoked() @@ -116,4 +118,11 @@ Rectangle { height: 1 color: "#DBDBDB" } + + // indicate disabled state + Desaturate { + anchors.fill: parent + source: parent + desaturation: root.enabled ? 0.0 : 1.0 + } } diff --git a/RightPanel.qml b/RightPanel.qml index 932b3916..d27b8b73 100644 --- a/RightPanel.qml +++ b/RightPanel.qml @@ -29,10 +29,13 @@ import QtQuick 2.2 import QtQuick.Controls 1.2 import QtQuick.Controls.Styles 1.2 +import QtGraphicalEffects 1.0 + import "tabs" import "components" Rectangle { + id: root width: 330 color: "#FFFFFF" @@ -145,4 +148,11 @@ Rectangle { width: 1 color: "#DBDBDB" } + + // indicate disabled state + Desaturate { + anchors.fill: parent + source: parent + desaturation: root.enabled ? 0.0 : 1.0 + } } diff --git a/components/PasswordDialog.qml b/components/PasswordDialog.qml index 9c36e13c..cd66d461 100644 --- a/components/PasswordDialog.qml +++ b/components/PasswordDialog.qml @@ -1,5 +1,40 @@ import QtQuick 2.0 +import QtQuick.Controls 1.4 +import QtQuick.Dialogs 1.2 +import QtQuick.Layouts 1.1 +import QtQuick.Controls.Styles 1.4 -Item { +// import "../components" +Dialog { + id: root + readonly property alias password: passwordInput.text + standardButtons: StandardButton.Ok + StandardButton.Cancel + ColumnLayout { + id: column + height: 40 + anchors.fill: parent + + Label { + text: qsTr("Please enter wallet password") + Layout.columnSpan: 2 + Layout.fillWidth: true + font.family: "Arial" + font.pixelSize: 32 + } + + TextField { + id : passwordInput + + echoMode: TextInput.Password + focus: true + Layout.fillWidth: true + font.family: "Arial" + font.pixelSize: 24 + style: TextFieldStyle { + passwordCharacter: "•" + } + } + } } + diff --git a/main.qml b/main.qml index 7320d3af..faeaf123 100644 --- a/main.qml +++ b/main.qml @@ -41,7 +41,8 @@ import "wizard" ApplicationWindow { id: appWindow - objectName: "appWindow" + + property var currentItem property bool whatIsEnable: false property bool ctrlPressed: false @@ -50,6 +51,8 @@ ApplicationWindow { property alias persistentSettings : persistentSettings property var wallet; property var transaction; + property alias password : passwordDialog.password + function altKeyReleased() { ctrlPressed = false; } @@ -98,24 +101,24 @@ ApplicationWindow { } function mousePressed(obj, mouseX, mouseY) { - if(obj.objectName === "appWindow") - obj = rootItem +// if(obj.objectName === "appWindow") +// obj = rootItem - var tmp = rootItem.mapFromItem(obj, mouseX, mouseY) - if(tmp !== undefined) { - mouseX = tmp.x - mouseY = tmp.y - } +// var tmp = rootItem.mapFromItem(obj, mouseX, mouseY) +// if(tmp !== undefined) { +// mouseX = tmp.x +// mouseY = tmp.y +// } - if(currentItem !== undefined) { - var tmp_x = rootItem.mapToItem(currentItem, mouseX, mouseY).x - var tmp_y = rootItem.mapToItem(currentItem, mouseX, mouseY).y +// if(currentItem !== undefined) { +// var tmp_x = rootItem.mapToItem(currentItem, mouseX, mouseY).x +// var tmp_y = rootItem.mapToItem(currentItem, mouseX, mouseY).y - if(!currentItem.containsPoint(tmp_x, tmp_y)) { - currentItem.hide() - currentItem = undefined - } - } +// if(!currentItem.containsPoint(tmp_x, tmp_y)) { +// currentItem.hide() +// currentItem = undefined +// } +// } } function mouseReleased(obj, mouseX, mouseY) { @@ -142,17 +145,18 @@ ApplicationWindow { var wallet_path = walletPath(); console.log("opening wallet at: ", wallet_path); - // TODO: wallet password dialog - wallet = walletManager.openWallet(wallet_path, "", persistentSettings.testnet); - - + wallet = walletManager.openWallet(wallet_path, appWindow.password, + persistentSettings.testnet); if (wallet.status !== Wallet.Status_Ok) { console.error("Error opening wallet with empty password: ", wallet.errorString); - + console.log("closing wallet...") + walletManager.closeWallet(wallet) + console.log("wallet closed") // try to open wallet with password; passwordDialog.open(); return; } + console.log("Wallet opened successfully: ", wallet.errorString); } // subscribing for wallet updates @@ -195,6 +199,8 @@ ApplicationWindow { } + + // called on "transfer" function handlePayment(address, paymentId, amount, mixinCount, priority) { console.log("Creating transaction: ") @@ -213,6 +219,7 @@ ApplicationWindow { informationPopup.title = qsTr("Error") + translationManager.emptyString; informationPopup.text = qsTr("Can't create transaction: ") + transaction.errorString informationPopup.icon = StandardIcon.Critical + informationPopup.onCloseCallback = null informationPopup.open(); // deleting transaction object, we don't want memleaks wallet.disposeTransaction(transaction); @@ -248,13 +255,22 @@ ApplicationWindow { informationPopup.text = qsTr("Money sent successfully") + translationManager.emptyString informationPopup.icon = StandardIcon.Information } - + informationPopup.onCloseCallback = null informationPopup.open() wallet.refresh() wallet.disposeTransaction(transaction) } + // blocks UI if wallet can't be opened or no connection to the daemon + function enableUI(enable) { + middlePanel.enabled = enable; + leftPanel.enabled = enable; + rightPanel.enabled = enable; + basicPanel.enabled = enable; + } + + objectName: "appWindow" visible: true width: rightPanelExpanded ? 1269 : 1269 - 300 height: 800 @@ -262,6 +278,7 @@ ApplicationWindow { flags: Qt.FramelessWindowHint | Qt.WindowSystemMenuHint | Qt.Window | Qt.WindowMinimizeButtonHint onWidthChanged: x -= 0 + Component.onCompleted: { x = (Screen.width - width) / 2 y = (Screen.height - height) / 2 @@ -278,6 +295,7 @@ ApplicationWindow { } } + Settings { id: persistentSettings property string language @@ -296,9 +314,15 @@ ApplicationWindow { // Information dialog MessageDialog { + // dynamically change onclose handler + property var onCloseCallback id: informationPopup - standardButtons: StandardButton.Ok + onAccepted: { + if (onCloseCallback) { + onCloseCallback() + } + } } // Confrirmation aka question dialog @@ -317,6 +341,7 @@ ApplicationWindow { var wallet_path = walletPath(); console.log("opening wallet with password: ", wallet_path); + wallet = walletManager.openWallet(wallet_path, password, persistentSettings.testnet); if (wallet.status !== Wallet.Status_Ok) { console.error("Error opening wallet with password: ", wallet.errorString); @@ -324,9 +349,16 @@ ApplicationWindow { informationPopup.text = qsTr("Couldn't open wallet: ") + wallet.errorString; informationPopup.icon = StandardIcon.Critical informationPopup.open() - + informationPopup.onCloseCallback = appWindow.initialize + walletManager.closeWallet(wallet); } } + onRejected: { + appWindow.enableUI(false) + } + onDiscard: { + appWindow.enableUI(false) + } } Window { @@ -339,7 +371,6 @@ ApplicationWindow { anchors.fill: parent text: qsTr("Initializing Wallet..."); } - } diff --git a/monero-core.pro b/monero-core.pro index 9520cd37..2dde61fe 100644 --- a/monero-core.pro +++ b/monero-core.pro @@ -146,6 +146,8 @@ isEmpty(QMAKE_LRELEASE) { langupd.command = \ $$LANGUPD $$LANGUPD_OPTIONS $$shell_path($$_PRO_FILE) -ts $$_PRO_FILE_PWD/$$TRANSLATIONS + + langrel.depends = langupd langrel.input = TRANSLATIONS langrel.output = $$TRANSLATION_TARGET_DIR/${QMAKE_FILE_BASE}.qm @@ -157,7 +159,12 @@ QMAKE_EXTRA_TARGETS += langupd deploy deploy_win QMAKE_EXTRA_COMPILERS += langrel -PRE_TARGETDEPS += langupd compiler_langrel_make_all + +# temporary: do not update/release translations for "Debug" build, +# as we have an issue with linking +CONFIG(release, debug|release) { + PRE_TARGETDEPS += langupd compiler_langrel_make_all +} RESOURCES += qml.qrc @@ -182,8 +189,8 @@ OTHER_FILES += \ $$TRANSLATIONS DISTFILES += \ - notes.txt \ - components/PasswordDialog.qml + notes.txt + # windows application icon RC_FILE = monero-core.rc