From 96238ced36103f1849ddafc3cd80af5ab835714a Mon Sep 17 00:00:00 2001 From: Anders Hafreager Date: Fri, 12 May 2017 16:52:19 +0200 Subject: [PATCH] Add test for non-writable paths and show message if macos app store. --- src/qml/desktop/MainDesktop.qml | 21 +++++++++++++------ src/qml/desktop/MessageOverlay.qml | 29 ++++++++++++++++++++++++++- src/qml/desktop/editor/CodeEditor.qml | 14 +++++++++---- src/src.pro | 4 ++++ 4 files changed, 57 insertions(+), 11 deletions(-) diff --git a/src/qml/desktop/MainDesktop.qml b/src/qml/desktop/MainDesktop.qml index 7685f590..8bbe248c 100644 --- a/src/qml/desktop/MainDesktop.qml +++ b/src/qml/desktop/MainDesktop.qml @@ -159,7 +159,7 @@ Rectangle { onCurrentIndexChanged: { root.viewMode = model[currentIndex].mode - if(root.viewMode === "edit") messageOverlay.visible = false + if(root.viewMode === "edit") messageOverlay.hideClickedAtLeastOnce = true } Connections { @@ -458,13 +458,12 @@ Rectangle { MessageOverlay { id: messageOverlay - property bool shouldBeVisible: simulator.states.idle.active || simulator.states.finished.active || simulator.states.crashed.active || simulator.states.reset.active || simulator.welcomeSimulationRunning - + property bool shouldBeVisible: simulator.states.idle.active || simulator.states.finished.active || simulator.states.crashed.active || simulator.states.reset.active || welcome || cantWrite anchors.fill: parent visible: false errorMessage: simulator.error - welcome: simulator.states.idle.active || simulator.welcomeSimulationRunning + welcome: (simulator.states.idle.active || simulator.welcomeSimulationRunning) && !hideClickedAtLeastOnce finished: simulator.states.finished.active crashed: simulator.states.crashed.active cancelling: simulator.states.reset.active @@ -481,7 +480,6 @@ Rectangle { } onExamplesClicked: modeMenu.currentIndex = 3 - onHideClicked: visible = false onShouldBeVisibleChanged: { if(shouldBeVisible) { visible = true @@ -586,7 +584,7 @@ Rectangle { id: shortcuts Shortcut { sequence: "Return" - onActivated: messageOverlay.visible = false + onActivated: messageOverlay.hideClicked() } EventCatcher { @@ -594,6 +592,17 @@ Rectangle { onTriggered: simulator.togglePause() } + + EventCatcher { + name: "editor.cantwrite" + onTriggered: { + console.log("Mac app store: ", simulator.system.macAppStore) + if(simulator.system.macAppStore) { + messageOverlay.cantWrite = true + } + } + } + EventCatcher { name: "editor.focus" onTriggered: editor.editorWindow.currentEditor.textArea.forceActiveFocus() diff --git a/src/qml/desktop/MessageOverlay.qml b/src/qml/desktop/MessageOverlay.qml index 0e8d61d5..b9a0c9c5 100644 --- a/src/qml/desktop/MessageOverlay.qml +++ b/src/qml/desktop/MessageOverlay.qml @@ -13,10 +13,35 @@ Rectangle { signal newTabClicked() signal hideClicked() + onHideClicked: { + hideClickedAtLeastOnce = true + cantWrite = false + visible = false + } + + Timer { + interval: 1000 + repeat: true + running: true + onTriggered: console.log("Welcome now: ", welcome) + } + + property bool hideClickedAtLeastOnce: false // TODO: state machinery should be used... property bool welcome: true property bool finished: false property bool crashed: false property bool cancelling: false + property bool cantWrite: false // TODO: rename to showCantWrite + property string cantWriteMacOSAppStoreText: + " + +

File access problem:

+

This simulation is in a directory which Atomify cannot write to. Due to limitations
+to file access in the Mac App Store, your simulations must be in the Downloads folder.

" + property string cancellingText: "