aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorxiphon <xiphon@protonmail.com>2020-07-28 17:46:52 +0000
committerxiphon <xiphon@protonmail.com>2020-09-22 15:08:18 +0000
commit4208b66baf2b1c403f4388eb4720586ad3406dce (patch)
treea4aa669c42e1227d99858eaf821b975958bf1313
parentc137a6ea36040aee20366933935805eff67ae3f8 (diff)
downloadmonzero-gui-4208b66baf2b1c403f4388eb4720586ad3406dce.tar.gz
monzero-gui-4208b66baf2b1c403f4388eb4720586ad3406dce.tar.xz
monzero-gui-4208b66baf2b1c403f4388eb4720586ad3406dce.zip
WizardModeSelection: optional 'Portable mode' feature support
-rw-r--r--components/CheckBox.qml1
-rw-r--r--src/main/main.cpp6
-rw-r--r--src/qt/macoshelper.h1
-rw-r--r--src/qt/macoshelper.mm15
-rw-r--r--wizard/WizardLanguage.qml4
-rw-r--r--wizard/WizardMenuItem.qml14
-rw-r--r--wizard/WizardModeSelection.qml48
7 files changed, 76 insertions, 13 deletions
diff --git a/components/CheckBox.qml b/components/CheckBox.qml
index 7a1c6179..671807f0 100644
--- a/components/CheckBox.qml
+++ b/components/CheckBox.qml
@@ -109,6 +109,7 @@ Item {
color: MoneroComponents.Style.defaultFontColor
textFormat: Text.RichText
wrapMode: Text.NoWrap
+ visible: text != ""
}
}
diff --git a/src/main/main.cpp b/src/main/main.cpp
index 41b41faa..b0404165 100644
--- a/src/main/main.cpp
+++ b/src/main/main.cpp
@@ -78,6 +78,8 @@
#if defined(Q_OS_WIN)
#include <QOpenGLContext>
+#elif defined(Q_OS_MACOS)
+#include "qt/macoshelper.h"
#endif
#ifdef WITH_SCANNER
@@ -323,6 +325,10 @@ Verify update binary using 'shasum'-compatible (SHA256 algo) output signed by tw
// start listening
QTimer::singleShot(0, ipc, SLOT(bind()));
+#if defined(Q_OS_MACOS)
+ QDir::setCurrent(QDir(MacOSHelper::bundlePath() + QDir::separator() + "..").canonicalPath());
+#endif
+
// screen settings
// Mobile is designed on 128dpi
qreal ref_dpi = 128;
diff --git a/src/qt/macoshelper.h b/src/qt/macoshelper.h
index a6caa79b..e8dabfbe 100644
--- a/src/qt/macoshelper.h
+++ b/src/qt/macoshelper.h
@@ -36,6 +36,7 @@ class MacOSHelper
public:
static bool isCapsLock();
static bool openFolderAndSelectItem(const QUrl &path);
+ static QString bundlePath();
};
#endif //MACOSHELPER_H
diff --git a/src/qt/macoshelper.mm b/src/qt/macoshelper.mm
index a7fb061d..8f7b4b0f 100644
--- a/src/qt/macoshelper.mm
+++ b/src/qt/macoshelper.mm
@@ -55,3 +55,18 @@ bool MacOSHelper::openFolderAndSelectItem(const QUrl &path)
[[NSWorkspace sharedWorkspace] activateFileViewerSelectingURLs:fileURLs];
return true;
}
+
+QString MacOSHelper::bundlePath()
+{
+ NSBundle *main = [NSBundle mainBundle];
+ if (!main)
+ {
+ return {};
+ }
+ NSString *bundlePathString = [main bundlePath];
+ if (!bundlePathString)
+ {
+ return {};
+ }
+ return QString::fromCFString(reinterpret_cast<const CFStringRef>(bundlePathString));
+}
diff --git a/wizard/WizardLanguage.qml b/wizard/WizardLanguage.qml
index 58b5cd21..4aa04ba0 100644
--- a/wizard/WizardLanguage.qml
+++ b/wizard/WizardLanguage.qml
@@ -245,4 +245,8 @@ Rectangle {
Timer {
id: versionTimer
}
+
+ function onPageCompleted() {
+ persistentSettings.setWritable(false);
+ }
}
diff --git a/wizard/WizardMenuItem.qml b/wizard/WizardMenuItem.qml
index febb13f3..a46f56b4 100644
--- a/wizard/WizardMenuItem.qml
+++ b/wizard/WizardMenuItem.qml
@@ -39,6 +39,8 @@ RowLayout {
Layout.fillWidth: true
Layout.bottomMargin: 10
property alias imageIcon: icon.source
+ property bool checkbox: false
+ property alias checked: checkboxItem.checked
property alias headerText: header.text
property alias bodyText: body.text
signal menuClicked();
@@ -48,16 +50,24 @@ RowLayout {
Layout.preferredWidth: 70
Layout.preferredHeight: 70
+ MoneroComponents.CheckBox {
+ id: checkboxItem
+ anchors.horizontalCenter: parent.horizontalCenter
+ anchors.verticalCenter: parent.verticalCenter
+ toggleOnClick: false
+ visible: rowlayout.checkbox
+ }
+
Image {
id: icon
- visible: !isOpenGL || MoneroComponents.Style.blackTheme
+ visible: !rowlayout.checkbox && (!isOpenGL || MoneroComponents.Style.blackTheme)
anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
source: ""
}
DropShadow {
- visible: isOpenGL && !MoneroComponents.Style.blackTheme
+ visible: !rowlayout.checkbox && (isOpenGL && !MoneroComponents.Style.blackTheme)
anchors.fill: icon
horizontalOffset: 3
verticalOffset: 3
diff --git a/wizard/WizardModeSelection.qml b/wizard/WizardModeSelection.qml
index ffae4cbd..0a8b4d90 100644
--- a/wizard/WizardModeSelection.qml
+++ b/wizard/WizardModeSelection.qml
@@ -40,6 +40,18 @@ Rectangle {
property alias pageHeight: pageRoot.height
property string viewName: "wizardModeSelection1"
+ property bool portable: persistentSettings.portable
+
+ function applyWalletMode(mode, wizardState) {
+ if (!persistentSettings.setPortable(portable)) {
+ appWindow.showStatusMessage(qsTr("Failed to configure portable mode"), 3);
+ return;
+ }
+
+ appWindow.changeWalletMode(mode);
+ wizardController.wizardStackView.backTransition = false;
+ wizardController.wizardState = wizardState;
+ }
ColumnLayout {
id: pageRoot
@@ -78,9 +90,7 @@ Rectangle {
onMenuClicked: {
if(appWindow.persistentSettings.nettype == 0){
- appWindow.changeWalletMode(0);
- wizardController.wizardStackView.backTransition = false;
- wizardController.wizardState = 'wizardModeRemoteNodeWarning';
+ applyWalletMode(0, 'wizardModeRemoteNodeWarning');
}
}
}
@@ -108,9 +118,7 @@ Rectangle {
onMenuClicked: {
if(appWindow.persistentSettings.nettype == 0){
- appWindow.changeWalletMode(1);
- wizardController.wizardStackView.backTransition = false;
- wizardController.wizardState = 'wizardModeBootstrap';
+ applyWalletMode(1, 'wizardModeBootstrap');
}
}
}
@@ -130,12 +138,26 @@ Rectangle {
imageIcon: "qrc:///images/local-node-full.png"
onMenuClicked: {
- wizardController.wizardStackView.backTransition = false;
- appWindow.changeWalletMode(2);
- wizardController.wizardState = 'wizardHome';
+ applyWalletMode(2, 'wizardHome');
}
}
+ WizardHeader {
+ Layout.topMargin: 20
+ title: qsTr("Optional features") + translationManager.emptyString
+ subtitle: qsTr("Select enhanced functionality you would like to enable.") + translationManager.emptyString
+ }
+
+ WizardMenuItem {
+ Layout.topMargin: 20
+ headerText: qsTr("Portable mode") + translationManager.emptyString
+ bodyText: qsTr("Create portable wallets and use them on any PC. Enable if you installed Monero on a USB stick, an external drive, or any other portable storage medium.") + translationManager.emptyString
+ checkbox: true
+ checked: wizardModeSelection1.portable
+
+ onMenuClicked: wizardModeSelection1.portable = !wizardModeSelection1.portable
+ }
+
WizardNav {
Layout.topMargin: 5
btnPrevText: qsTr("Back to menu") + translationManager.emptyString
@@ -144,8 +166,12 @@ Rectangle {
autoTransition: false
onPrevClicked: {
- wizardController.wizardStackView.backTransition = !wizardController.wizardStackView.backTransition;
- wizardController.wizardState = wizardController.wizardStackView.backTransition ? 'wizardLanguage' : 'wizardHome';
+ if (wizardController.wizardStackView.backTransition) {
+ applyWalletMode(persistentSettings.walletMode, 'wizardHome');
+ } else {
+ wizardController.wizardStackView.backTransition = true;
+ wizardController.wizardState = 'wizardLanguage';
+ }
}
}
}