Compare commits

..

19 Commits

Author SHA1 Message Date
Riccardo Spagni
6206e3d4c5 Merge pull request #1502
716366c revert 28fb9fa2be (cryptochangements34)
2018-07-12 17:06:51 +02:00
Riccardo Spagni
496e69b5ce Merge pull request #1496
057b5cd Add support for creating hardware wallet (stoffu)
5029bae get_libwallet_api: checkout v0.12.3.0 (stoffu)
2018-07-12 17:06:31 +02:00
stoffu
057b5cdec7 Add support for creating hardware wallet 2018-07-12 19:58:56 +09:00
luigi1111
f5792cc8fc Merge pull request #1501
f7bbdd3 add explicit mainnet button and move nettypes to advanced options (cryptochangements34)
2018-07-09 15:51:57 -05:00
luigi1111
07499bb96a Merge pull request #1497
ea58857 Fix version string by picking up unannotated tags (stoffu)
2018-07-09 15:50:28 -05:00
luigi1111
dc58f0c2b5 Merge pull request #1490
eb26b37 remove embedded Adobe color profile in denmark.png (erciccione)
2018-07-09 15:47:50 -05:00
luigi1111
eb94aef791 Merge pull request #1472
7b792ee remove non-free SF fonts, add Roboto fonts + license (pazos)
2018-07-09 15:45:31 -05:00
luigi1111
2b443eda93 Merge pull request #1470
29b59d3 don't check local daemon status on settings page, update on onWalletConnectionStatusChanged (pazos)
2018-07-09 13:46:19 -05:00
cryptochangements34
716366c54f revert 28fb9fa2be
Changing the application name caused wallets created prior to v0.12 to "forget" their config
2018-07-09 14:39:21 -04:00
stoffu
ea58857b43 Fix version string by picking up unannotated tags 2018-07-06 09:44:01 +09:00
stoffu
5029baec33 get_libwallet_api: checkout v0.12.3.0 2018-07-06 09:35:09 +09:00
Martín Fdez
7b792ee19f remove non-free SF fonts, add Roboto fonts + license 2018-06-21 18:24:41 +02:00
Martín Fdez
29b59d3901 don't check local daemon status on settings page, update on onWalletConnectionStatusChanged 2018-06-20 22:20:50 +02:00
erciccione
eb26b37b86 remove embedded Adobe color profile in denmark.png 2018-06-18 16:14:10 +03:00
cryptochangements34
f7bbdd3044 add explicit mainnet button and move nettypes to advanced options 2018-06-07 12:23:47 -04:00
luigi1111
d85f3eae7c Merge pull request #1443
377c56d Add libwinscard to link line on Windows
2018-06-05 12:58:42 -05:00
luigi1111
5f46c41598 Merge pull request #1442
5bb24cf Update submodule for v0.12.2.0
2018-06-05 12:57:21 -05:00
iDunk5400
377c56d4a4 Add libwinscard to link line on Windows
This fixes monero-wallet-gui linking error in MSYS2 since PC/SC hw device support was added to Windows builds
2018-06-02 20:21:24 +02:00
dEBRUYNE-1
5bb24cfc92 Update submodule for v0.12.2.0 2018-06-02 19:19:47 +02:00
28 changed files with 544 additions and 23 deletions

View File

@@ -28,6 +28,7 @@
import QtQuick 2.0
import QtQuick.Layouts 1.1
import QtGraphicalEffects 1.0
import "." 1.0
RowLayout {
@@ -40,6 +41,7 @@ RowLayout {
property int fontSize: 14 * scaleRatio
property alias fontColor: label.color
property int textMargin: 8 * scaleRatio
property bool darkDropIndicator: false
signal clicked()
height: 25 * scaleRatio
@@ -74,12 +76,19 @@ RowLayout {
anchors.left: label.right
anchors.leftMargin: textMargin
color: "transparent"
rotation: checkBox.checked ? 180 * scaleRatio : 0
Image {
id: indicatorImage
anchors.centerIn: parent
source: "../images/whiteDropIndicator.png"
rotation: checkBox.checked ? 180 * scaleRatio : 0
visible: !darkDropIndicator
}
ColorOverlay {
anchors.fill: indicatorImage
source: indicatorImage
color: "#FF000000"
visible: darkDropIndicator
}
}

View File

@@ -3,10 +3,10 @@ pragma Singleton
import QtQuick 2.5
QtObject {
property QtObject fontMedium: FontLoader { id: _fontMedium; source: "qrc:/fonts/SFUIDisplay-Medium.otf"; }
property QtObject fontBold: FontLoader { id: _fontBold; source: "qrc:/fonts/SFUIDisplay-Bold.otf"; }
property QtObject fontLight: FontLoader { id: _fontLight; source: "qrc:/fonts/SFUIDisplay-Light.otf"; }
property QtObject fontRegular: FontLoader { id: _fontRegular; source: "qrc:/fonts/SFUIDisplay-Regular.otf"; }
property QtObject fontMedium: FontLoader { id: _fontMedium; source: "qrc:/fonts/Roboto-Medium.ttf"; }
property QtObject fontBold: FontLoader { id: _fontBold; source: "qrc:/fonts/Roboto-Bold.ttf"; }
property QtObject fontLight: FontLoader { id: _fontLight; source: "qrc:/fonts/Roboto-Light.ttf"; }
property QtObject fontRegular: FontLoader { id: _fontRegular; source: "qrc:/fonts/Roboto-Regular.ttf"; }
property string grey: "#404040"

202
fonts/LICENSE.txt Normal file
View File

@@ -0,0 +1,202 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

BIN
fonts/Roboto-Bold.ttf Normal file

Binary file not shown.

BIN
fonts/Roboto-Light.ttf Normal file

Binary file not shown.

BIN
fonts/Roboto-Medium.ttf Normal file

Binary file not shown.

BIN
fonts/Roboto-Regular.ttf Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -17,7 +17,7 @@ if [ ! -d $MONERO_DIR/src ]; then
fi
git submodule update --remote
git -C $MONERO_DIR fetch
git -C $MONERO_DIR checkout v0.12.1.0
git -C $MONERO_DIR checkout v0.12.3.0
# get monero core tag
get_tag

BIN
images/createWalletFromDevice.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.3 KiB

After

Width:  |  Height:  |  Size: 3.6 KiB

View File

@@ -100,7 +100,7 @@ int main(int argc, char *argv[])
MainApp app(argc, argv);
app.setApplicationName("monero-gui");
app.setApplicationName("monero-core");
app.setOrganizationDomain("getmonero.org");
app.setOrganizationName("monero-project");

View File

@@ -331,7 +331,7 @@ ApplicationWindow {
currentDaemonAddress = localDaemonAddress
console.log("initializing with daemon address: ", currentDaemonAddress)
currentWallet.initAsync(currentDaemonAddress, 0, persistentSettings.is_recovering, persistentSettings.restore_height);
currentWallet.initAsync(currentDaemonAddress, 0, persistentSettings.is_recovering, persistentSettings.is_recovering_from_device, persistentSettings.restore_height);
}
function walletPath() {
@@ -358,6 +358,10 @@ ApplicationWindow {
middlePanel.updateStatus();
leftPanel.networkStatus.connected = status
// update local daemon status
if(!isMobile && walletManager.isDaemonLocal(appWindow.persistentSettings.daemon_address))
daemonRunning = status;
// Update fee multiplier dropdown on transfer page
middlePanel.transferView.updatePriorityDropdown();
@@ -1010,6 +1014,7 @@ ApplicationWindow {
property string payment_id
property int restore_height : 0
property bool is_recovering : false
property bool is_recovering_from_device : false
property bool customDecorations : true
property string daemonFlags
property int logLevel: 0

View File

@@ -245,6 +245,7 @@ win32 {
-lssl \
-lcrypto \
-Wl,-Bdynamic \
-lwinscard \
-lws2_32 \
-lwsock32 \
-lIphlpapi \

View File

@@ -51,7 +51,7 @@ Rectangle {
console.log("Settings page loaded");
if(typeof daemonManager != "undefined"){
appWindow.daemonRunning = persistentSettings.useRemoteNode ? false : daemonManager.running(persistentSettings.nettype);
daemonRunning = persistentSettings.useRemoteNode ? false : appWindow.daemonRunning;
}
logLevelDropdown.update()
@@ -353,7 +353,7 @@ Rectangle {
StandardButton {
id: startDaemonButton
small: true
visible: !appWindow.daemonRunning
visible: !daemonRunning
text: qsTr("Start Local Node") + translationManager.emptyString
onClicked: {
// Update bootstrap daemon address
@@ -368,7 +368,7 @@ Rectangle {
StandardButton {
id: stopDaemonButton
small: true
visible: appWindow.daemonRunning
visible: daemonRunning
text: qsTr("Stop Local Node") + translationManager.emptyString
onClicked: {
appWindow.stopDaemon()

10
qml.qrc
View File

@@ -86,9 +86,11 @@
<file>images/prevPage.png</file>
<file>wizard/WizardOptions.qml</file>
<file>images/createWallet.png</file>
<file>images/createWalletFromDevice.png</file>
<file>images/openAccount.png</file>
<file>images/recoverWallet.png</file>
<file>wizard/WizardCreateWallet.qml</file>
<file>wizard/WizardCreateWalletFromDevice.qml</file>
<file>images/greyTriangle.png</file>
<file>images/copyToClipboard.png</file>
<file>wizard/WizardPassword.qml</file>
@@ -176,10 +178,10 @@
<file>images/titlebarLogo.png</file>
<file>images/menuArrow.png</file>
<file>images/menuButtonGradient.png</file>
<file>fonts/SFUIDisplay-Medium.otf</file>
<file>fonts/SFUIDisplay-Regular.otf</file>
<file>fonts/SFUIDisplay-Light.otf</file>
<file>fonts/SFUIDisplay-Bold.otf</file>
<file>fonts/Roboto-Medium.ttf</file>
<file>fonts/Roboto-Regular.ttf</file>
<file>fonts/Roboto-Light.ttf</file>
<file>fonts/Roboto-Bold.ttf</file>
<file>components/Style.qml</file>
<file>components/qmldir</file>
<file>components/InlineButton.qml</file>

View File

@@ -172,12 +172,18 @@ bool Wallet::store(const QString &path)
return m_walletImpl->store(path.toStdString());
}
bool Wallet::init(const QString &daemonAddress, quint64 upperTransactionLimit, bool isRecovering, quint64 restoreHeight)
bool Wallet::init(const QString &daemonAddress, quint64 upperTransactionLimit, bool isRecovering, bool isRecoveringFromDevice, quint64 restoreHeight)
{
qDebug() << "init non async";
if (isRecovering){
qDebug() << "RESTORING";
m_walletImpl->setRecoveringFromSeed(true);
}
if (isRecoveringFromDevice){
qDebug() << "RESTORING FROM DEVICE";
m_walletImpl->setRecoveringFromDevice(true);
}
if (isRecovering || isRecoveringFromDevice) {
m_walletImpl->setRefreshFromBlockHeight(restoreHeight);
}
m_walletImpl->init(daemonAddress.toStdString(), upperTransactionLimit, m_daemonUsername.toStdString(), m_daemonPassword.toStdString());
@@ -191,7 +197,7 @@ void Wallet::setDaemonLogin(const QString &daemonUsername, const QString &daemon
m_daemonPassword = daemonPassword;
}
void Wallet::initAsync(const QString &daemonAddress, quint64 upperTransactionLimit, bool isRecovering, quint64 restoreHeight)
void Wallet::initAsync(const QString &daemonAddress, quint64 upperTransactionLimit, bool isRecovering, bool isRecoveringFromDevice, quint64 restoreHeight)
{
qDebug() << "initAsync: " + daemonAddress;
// Change status to disconnected if connected
@@ -201,7 +207,7 @@ void Wallet::initAsync(const QString &daemonAddress, quint64 upperTransactionLim
}
QFuture<bool> future = QtConcurrent::run(this, &Wallet::init,
daemonAddress, upperTransactionLimit, isRecovering, restoreHeight);
daemonAddress, upperTransactionLimit, isRecovering, isRecoveringFromDevice, restoreHeight);
QFutureWatcher<bool> * watcher = new QFutureWatcher<bool>();
connect(watcher, &QFutureWatcher<bool>::finished,

View File

@@ -111,10 +111,10 @@ public:
Q_INVOKABLE bool store(const QString &path = "");
//! initializes wallet
Q_INVOKABLE bool init(const QString &daemonAddress, quint64 upperTransactionLimit = 0, bool isRecovering = false, quint64 restoreHeight = 0);
Q_INVOKABLE bool init(const QString &daemonAddress, quint64 upperTransactionLimit = 0, bool isRecovering = false, bool isRecoveringFromDevice = false, quint64 restoreHeight = 0);
//! initializes wallet asynchronously
Q_INVOKABLE void initAsync(const QString &daemonAddress, quint64 upperTransactionLimit = 0, bool isRecovering = false, quint64 restoreHeight = 0);
Q_INVOKABLE void initAsync(const QString &daemonAddress, quint64 upperTransactionLimit = 0, bool isRecovering = false, bool isRecoveringFromDevice = false, quint64 restoreHeight = 0);
// Set daemon rpc user/pass
Q_INVOKABLE void setDaemonLogin(const QString &daemonUsername = "", const QString &daemonPassword = "");

View File

@@ -104,6 +104,20 @@ Wallet *WalletManager::createWalletFromKeys(const QString &path, const QString &
return m_currentWallet;
}
Wallet *WalletManager::createWalletFromDevice(const QString &path, const QString &password, NetworkType::Type nettype,
const QString &deviceName, uint64_t restoreHeight, const QString &subaddressLookahead)
{
QMutexLocker locker(&m_mutex);
if (m_currentWallet) {
qDebug() << "Closing open m_currentWallet" << m_currentWallet;
delete m_currentWallet;
m_currentWallet = NULL;
}
Monero::Wallet * w = m_pimpl->createWalletFromDevice(path.toStdString(), password.toStdString(), static_cast<Monero::NetworkType>(nettype),
deviceName.toStdString(), restoreHeight, subaddressLookahead.toStdString());
m_currentWallet = new Wallet(w);
return m_currentWallet;
}
QString WalletManager::closeWallet()
{

View File

@@ -62,6 +62,12 @@ public:
const QString &spendkey = "",
quint64 restoreHeight = 0);
Q_INVOKABLE Wallet * createWalletFromDevice(const QString &path,
const QString &password,
NetworkType::Type nettype,
const QString &deviceName,
uint64_t restoreHeight = 0,
const QString &subaddressLookahead = "");
/*!
* \brief closeWallet - closes current open wallet and frees memory
* \return wallet address

View File

@@ -54,7 +54,7 @@ function get_tag()
VERSIONTAG="$COMMIT"
fi
# save tag name + commit if availible
TAGNAME=$(git describe | sed -e 's/[\t ]*//')
TAGNAME=$(git describe --tags | sed -e 's/[\t ]*//')
if test -z "$TAGNAME"
then
TAGNAME="$VERSIONTAG"

View File

@@ -0,0 +1,123 @@
// Copyright (c) 2014-2018, The Monero Project
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification, are
// permitted provided that the following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice, this list of
// conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright notice, this list
// of conditions and the following disclaimer in the documentation and/or other
// materials provided with the distribution.
//
// 3. Neither the name of the copyright holder nor the names of its contributors may be
// used to endorse or promote products derived from this software without specific
// prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
// THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
import QtQuick 2.2
import moneroComponents.WalletManager 1.0
import moneroComponents.Wallet 1.0
import QtQuick.Layouts 1.1
import QtQuick.Dialogs 1.2
import 'utils.js' as Utils
ColumnLayout {
opacity: 0
visible: false
Behavior on opacity {
NumberAnimation { duration: 100; easing.type: Easing.InQuad }
}
onOpacityChanged: visible = opacity !== 0
function onWizardRestarted() {
// reset account name field
uiItem.accountNameText = defaultAccountName
}
//! function called each time we display this page
function onPageOpened(settingsOblect) {
uiItem.checkNextButton()
uiItem.deviceNameDropdown.update()
}
function onPageClosed(settingsObject) {
settingsObject['account_name'] = uiItem.accountNameText
settingsObject['wallet_path'] = uiItem.walletPath
var restoreHeight = parseInt(uiItem.restoreHeight);
settingsObject['restore_height'] = isNaN(restoreHeight)? 0 : restoreHeight;
settingsObject['subaddress_lookahead'] = uiItem.subaddressLookahead;
settingsObject['deviceName'] = uiItem.deviceName;
var walletFullPath = wizard.createWalletPath(uiItem.walletPath,uiItem.accountNameText);
if (!wizard.walletPathValid(walletFullPath)) {
return false;
}
return createWalletFromDevice(settingsObject)
}
//! function called each time we hide this page
//
function createWalletFromDevice(settingsObject) {
// TODO: create wallet in temporary filename and a) move it to the path specified by user after the final
// page submitted or b) delete it when program closed before reaching final page
// Always delete the wallet object before creating new - we could be stepping back from recovering wallet
if (typeof m_wallet !== 'undefined') {
walletManager.closeWallet()
console.log("deleting wallet")
}
var tmp_wallet_filename = oshelper.temporaryFilename();
console.log("Creating temporary wallet", tmp_wallet_filename)
var nettype = appWindow.persistentSettings.nettype;
var restoreHeight = settingsObject.restore_height;
var subaddressLookahead = settingsObject.subaddress_lookahead;
var deviceName = settingsObject.deviceName;
var wallet = walletManager.createWalletFromDevice(tmp_wallet_filename, "", nettype, deviceName, restoreHeight, subaddressLookahead);
var success = wallet.status === Wallet.Status_Ok;
if (success) {
m_wallet = wallet;
settingsObject['is_recovering_from_device'] = true;
settingsObject['tmp_wallet_filename'] = tmp_wallet_filename
} else {
console.log(wallet.errorString)
walletErrorDialog.text = wallet.errorString;
walletErrorDialog.open();
walletManager.closeWallet();
}
return success;
}
WizardManageWalletUI {
id: uiItem
titleText: qsTr("Create a new wallet from hardware device") + translationManager.emptyString
wordsTextItem.clipboardButtonVisible: false
wordsTextItem.tipTextVisible: false
restoreHeightVisible:true
recoverMode: false
recoverFromDevice: true
}
Component.onCompleted: {
parent.wizardRestarted.connect(onWizardRestarted)
}
}

View File

@@ -54,6 +54,7 @@ ColumnLayout {
"create_wallet" : [welcomePage, optionsPage, createWalletPage, passwordPage, daemonSettingsPage, finishPage ],
"recovery_wallet" : [welcomePage, optionsPage, recoveryWalletPage, passwordPage, daemonSettingsPage, finishPage ],
"create_view_only_wallet" : [ createViewOnlyWalletPage, passwordPage ],
"create_wallet_from_device" : [welcomePage, optionsPage, createWalletFromDevicePage, passwordPage, daemonSettingsPage, finishPage ],
}
property string currentPath: "create_wallet"
@@ -162,6 +163,16 @@ ColumnLayout {
rootItem.state = "wizard";
}
function openCreateWalletFromDevicePage() {
wizardRestarted();
print ("show create wallet from device page");
currentPath = "create_wallet_from_device"
pages = paths[currentPath]
wizard.nextButton.visible = true
// goto next page
switchPage(true);
}
function createWalletPath(folder_path,account_name){
// Remove trailing slash - (default on windows and mac)
@@ -233,6 +244,7 @@ ColumnLayout {
appWindow.persistentSettings.auto_donations_amount = false //settings.auto_donations_amount
appWindow.persistentSettings.restore_height = (isNaN(settings.restore_height))? 0 : settings.restore_height
appWindow.persistentSettings.is_recovering = (settings.is_recovering === undefined)? false : settings.is_recovering
appWindow.persistentSettings.is_recovering_from_device = (settings.is_recovering_from_device === undefined)? false : settings.is_recovering_from_device
}
// reading settings from persistent storage
@@ -263,6 +275,7 @@ ColumnLayout {
onCreateWalletClicked: wizard.openCreateWalletPage()
onRecoveryWalletClicked: wizard.openRecoveryWalletPage()
onOpenWalletClicked: wizard.openOpenWalletPage();
onCreateWalletFromDeviceClicked: wizard.openCreateWalletFromDevicePage()
}
WizardCreateWallet {
@@ -283,6 +296,12 @@ ColumnLayout {
Layout.topMargin: wizardTopMargin
}
WizardCreateWalletFromDevice {
id: createWalletFromDevicePage
Layout.bottomMargin: wizardBottomMargin
Layout.topMargin: wizardTopMargin
}
WizardPassword {
id: passwordPage
Layout.bottomMargin: wizardBottomMargin

View File

@@ -44,6 +44,7 @@ ColumnLayout {
property alias wordsTextItem : memoTextItem
property alias restoreHeight : restoreHeightItem.text
property alias restoreHeightVisible: restoreHeightItem.visible
property alias subaddressLookahead : subaddressLookaheadItem.text
property alias walletName : accountName.text
property alias progressDotsModel : progressDots.model
property alias recoverFromKeysAddress: addressLine.text;
@@ -53,6 +54,10 @@ ColumnLayout {
property bool recoverMode: false
// Recover form seed or keys
property bool recoverFromSeedMode: true
// Recover form hardware device
property bool recoverFromDevice: false
property var deviceName: deviceNameModel.get(deviceNameDropdown.currentIndex).column2
property alias deviceNameDropdown: deviceNameDropdown
property int rowSpacing: 10
function checkFields(){
@@ -215,7 +220,7 @@ ColumnLayout {
// Recover from seed
RowLayout {
id: recoverFromSeed
visible: !recoverMode || ( recoverMode && recoverFromSeedMode)
visible: !recoverFromDevice && (!recoverMode || ( recoverMode && recoverFromSeedMode))
WizardMemoTextInput {
id : memoTextItem
Layout.fillWidth: true
@@ -303,9 +308,56 @@ ColumnLayout {
fontBold: false
}
}
// Subaddress lookahead
RowLayout {
visible: recoverFromDevice
LineEdit {
id: subaddressLookaheadItem
Layout.fillWidth: true
Layout.maximumWidth: 600 * scaleRatio
Layout.minimumWidth: 200 * scaleRatio
placeholderFontBold: true
placeholderFontFamily: "Arial"
placeholderColor: Style.legacy_placeholderFontColor
placeholderText: qsTr("Subaddress lookahead (optional): <major>:<minor>") + translationManager.emptyString
placeholderOpacity: 1.0
borderColor: Qt.rgba(0, 0, 0, 0.15)
backgroundColor: "white"
fontColor: "black"
fontBold: false
}
}
// Device name
ColumnLayout {
visible: recoverFromDevice
Label {
Layout.topMargin: 20 * scaleRatio
fontFamily: "Arial"
fontColor: "#555555"
fontSize: 14 * scaleRatio
text: qsTr("Device name") + translationManager.emptyString
}
ListModel {
id: deviceNameModel
ListElement { column1: qsTr("Ledger") ; column2: "Ledger"; }
// ListElement { column1: qsTr("Trezor") ; column2: "Trezor"; }
}
StandardDropdown {
id: deviceNameDropdown
dataModel: deviceNameModel
Layout.fillWidth: true
Layout.topMargin: 6
colorHeaderBackground: "black"
releasedColor: "#363636"
pressedColor: "#202020"
}
}
// Wallet store location
ColumnLayout {
z: deviceNameDropdown.z - 1
Label {
Layout.fillWidth: true
Layout.topMargin: 20 * scaleRatio

View File

@@ -37,9 +37,10 @@ ColumnLayout {
signal createWalletClicked()
signal recoveryWalletClicked()
signal openWalletClicked()
signal createWalletFromDeviceClicked()
opacity: 0
visible: false
property int buttonSize: (isMobile) ? 80 * scaleRatio : 190 * scaleRatio
property int buttonSize: (isMobile) ? 80 * scaleRatio : 140 * scaleRatio
property int buttonImageSize: (isMobile) ? buttonSize - 10 * scaleRatio : buttonSize - 30 * scaleRatio
function onPageClosed() {
@@ -227,6 +228,51 @@ ColumnLayout {
wrapMode: Text.WordWrap
}
}
GridLayout {
Layout.fillHeight: true
Layout.fillWidth: true
flow: !isMobile ? GridLayout.TopToBottom : GridLayout.LeftToRight
rowSpacing: 20 * scaleRatio
columnSpacing: 10 * scaleRatio
Rectangle {
Layout.preferredHeight: page.buttonSize
Layout.preferredWidth: page.buttonSize
radius: page.buttonSize
color: createWalletFromDeviceArea.containsMouse ? "#DBDBDB" : "#FFFFFF"
Image {
width: page.buttonImageSize
height: page.buttonImageSize
fillMode: Image.PreserveAspectFit
horizontalAlignment: Image.AlignRight
verticalAlignment: Image.AlignTop
anchors.centerIn: parent
source: "qrc:///images/createWalletFromDevice.png"
}
MouseArea {
id: createWalletFromDeviceArea
anchors.fill: parent
hoverEnabled: true
onClicked: {
page.createWalletFromDeviceClicked()
}
}
}
Text {
Layout.preferredWidth: page.buttonSize
font.family: "Arial"
font.pixelSize: 16 * scaleRatio
color: "#4A4949"
horizontalAlignment: Text.AlignHCenter
wrapMode: Text.WordWrap
text: qsTr("Create a new wallet from hardware device") + translationManager.emptyString
}
}
}
ColumnLayout {
@@ -237,9 +283,41 @@ ColumnLayout {
Layout.fillWidth: true
spacing: 38 * scaleRatio
RowLayout {
CheckBox2 {
id: showAdvancedCheckbox
darkDropIndicator: true
text: qsTr("Advanced options") + translationManager.emptyString
fontColor: "#4A4646"
}
}
Rectangle {
width: 100 * scaleRatio
RadioButton {
visible: showAdvancedCheckbox.checked
enabled: !this.checked
id: mainNet
text: qsTr("Mainnet") + translationManager.emptyString
checkedColor: Qt.rgba(0, 0, 0, 0.75)
borderColor: Qt.rgba(0, 0, 0, 0.45)
fontColor: "#4A4646"
fontSize: 16 * scaleRatio
checked: appWindow.persistentSettings.nettype == NetworkType.MAINNET;
onClicked: {
persistentSettings.nettype = NetworkType.MAINNET
testNet.checked = false;
stageNet.checked = false;
console.log("Network type set to MainNet")
}
}
}
Rectangle {
width: 100 * scaleRatio
RadioButton {
visible: showAdvancedCheckbox.checked
enabled: !this.checked
id: testNet
text: qsTr("Testnet") + translationManager.emptyString
checkedColor: Qt.rgba(0, 0, 0, 0.75)
@@ -249,6 +327,7 @@ ColumnLayout {
checked: appWindow.persistentSettings.nettype == NetworkType.TESTNET;
onClicked: {
persistentSettings.nettype = testNet.checked ? NetworkType.TESTNET : NetworkType.MAINNET
mainNet.checked = false;
stageNet.checked = false;
console.log("Network type set to ", persistentSettings.nettype == NetworkType.TESTNET ? "Testnet" : "Mainnet")
}
@@ -258,6 +337,8 @@ ColumnLayout {
Rectangle {
width: 100 * scaleRatio
RadioButton {
visible: showAdvancedCheckbox.checked
enabled: !this.checked
id: stageNet
text: qsTr("Stagenet") + translationManager.emptyString
checkedColor: Qt.rgba(0, 0, 0, 0.75)
@@ -267,6 +348,7 @@ ColumnLayout {
checked: appWindow.persistentSettings.nettype == NetworkType.STAGENET;
onClicked: {
persistentSettings.nettype = stageNet.checked ? NetworkType.STAGENET : NetworkType.MAINNET
mainNet.checked = false;
testNet.checked = false;
console.log("Network type set to ", persistentSettings.nettype == NetworkType.STAGENET ? "Stagenet" : "Mainnet")
}