1
0
mirror of https://gitlab.com/kelteseth/ScreenPlay.git synced 2024-11-07 03:22:33 +01:00

Add disabling of main Navigation

This commit is contained in:
kelteseth 2018-12-01 18:02:55 +01:00
parent 1d9b3b6497
commit d904d6ca92
5 changed files with 112 additions and 26 deletions

View File

@ -14,6 +14,12 @@ Item {
property string filePath property string filePath
property bool canNext: false property bool canNext: false
Component.onCompleted: {
state = "in"
utility.setNavigationActive(false)
}
//Blocks some MouseArea from create page //Blocks some MouseArea from create page
MouseArea { MouseArea {
anchors.fill: parent anchors.fill: parent
@ -22,7 +28,7 @@ Item {
Connections { Connections {
target: screenPlayCreate target: screenPlayCreate
onCreateWallpaperStateChanged: { onCreateWallpaperStateChanged: {
print(state)
if (state === Create.State.ConvertingPreviewGifError if (state === Create.State.ConvertingPreviewGifError
|| state === Create.State.ConvertingPreviewVideoError || state === Create.State.ConvertingPreviewVideoError
|| state === Create.State.ConvertingPreviewImageError || state === Create.State.ConvertingPreviewImageError
@ -43,10 +49,6 @@ Item {
} }
} }
Component.onCompleted: {
state = "in"
}
RectangularGlow { RectangularGlow {
id: effect id: effect
anchors { anchors {
@ -121,6 +123,14 @@ Item {
color: "gray" color: "gray"
AnimatedImage {
id: imgPreview
asynchronous: true
playing: true
visible: false
anchors.fill: parent
}
BusyIndicator { BusyIndicator {
id: busyIndicator id: busyIndicator
anchors.centerIn: parent anchors.centerIn: parent
@ -148,6 +158,13 @@ Item {
"Generating preview gif...") "Generating preview gif...")
} }
if (state === Create.State.ConvertingPreviewImageFinished) {
imgPreview.source = "file:///"
+ screenPlayCreate.workingDir + "/preview.png"
imgPreview.visible = true
}
if (state === Create.State.ConvertingPreviewGifFinished) { if (state === Create.State.ConvertingPreviewGifFinished) {
imgPreview.source = "file:///" imgPreview.source = "file:///"
+ screenPlayCreate.workingDir + "/preview.gif" + screenPlayCreate.workingDir + "/preview.gif"
@ -157,13 +174,7 @@ Item {
} }
} }
AnimatedImage {
id: imgPreview
asynchronous: true
playing: true
visible: false
anchors.fill: parent
}
} }
} }
@ -222,20 +233,41 @@ Item {
} }
} }
NextButton {
id: btnFinish Row {
id: column1
height: 100
width:childrenRect.width
spacing: 10
anchors { anchors {
horizontalCenter: parent.horizontalCenter horizontalCenter: parent.horizontalCenter
bottom: parent.bottom bottom: parent.bottom
margins: 30
} }
onClicked: {
if (btnFinish.state === "enabled" && canNext) { Button {
screenPlayCreate.createWallpaperProjectFile( id: btnExit
textField.text, textField1.text) text: qsTr("Abort")
Material.background: Material.Gray
Material.foreground: "white"
onClicked: {
screenPlayCreate.abort()
utility.setNavigationActive(true)
utility.setNavigation("Create")
} }
} }
NextButton {
id: btnFinish
onClicked: {
if (btnFinish.state === "enabled" && canNext) {
screenPlayCreate.createWallpaperProjectFile(
textField.text, textField1.text)
}
}
}
} }
Connections { Connections {
target: screenPlayCreate target: screenPlayCreate
onCreateWallpaperStateChanged: { onCreateWallpaperStateChanged: {
@ -244,6 +276,7 @@ Item {
} }
} }
} }
} }
} }
@ -322,6 +355,7 @@ Item {
margins: 10 margins: 10
} }
onClicked: { onClicked: {
utility.setNavigationActive(true)
utility.setNavigation("Create") utility.setNavigation("Create")
} }
} }
@ -359,6 +393,7 @@ Item {
margins: 10 margins: 10
} }
onClicked: { onClicked: {
utility.setNavigationActive(true)
utility.setNavigation("Create") utility.setNavigation("Create")
} }
} }
@ -395,7 +430,11 @@ Item {
Timer { Timer {
id: timerBack id: timerBack
interval: 800 interval: 800
onTriggered: utility.setNavigation("Create") onTriggered:{
screenPlayCreate.abort()
utility.setNavigationActive(true)
utility.setNavigation("Create")
}
} }
} }
} }
@ -591,8 +630,3 @@ Item {
] ]
} }
/*##^## Designer {
D{i:0;autoSize:true;height:767;width:1366}
}
##^##*/

View File

@ -12,6 +12,23 @@ Rectangle {
signal changePage(string name) signal changePage(string name)
property var navArray: [navCreate, navWorkshop, navInstalled, navSettings, navCommunity, navScreen] property var navArray: [navCreate, navWorkshop, navInstalled, navSettings, navCommunity, navScreen]
property bool navActive: true
Connections {
target: utility
onRequestNavigationActive: {
setActive(isActive)
}
}
function setActive(active) {
navActive = active
if (active) {
navigation.state = "enabled"
} else {
navigation.state = "disabled"
}
}
function onPageChanged(name) { function onPageChanged(name) {
@ -21,6 +38,9 @@ Rectangle {
return return
} }
if (!navActive)
return
navigation.changePage(name) navigation.changePage(name)
for (var i = 0; i < navArray.length; i++) { for (var i = 0; i < navArray.length; i++) {
@ -33,6 +53,7 @@ Rectangle {
} }
Row { Row {
id: row
anchors.fill: parent anchors.fill: parent
anchors.left: parent.left anchors.left: parent.left
anchors.leftMargin: 20 anchors.leftMargin: 20
@ -42,6 +63,7 @@ Rectangle {
id: navCreate id: navCreate
state: "inactive" state: "inactive"
name: "Create" name: "Create"
iconSource: "qrc:/assets/icons/icon_plus.svg" iconSource: "qrc:/assets/icons/icon_plus.svg"
onPageClicked: navigation.onPageChanged(name) onPageClicked: navigation.onPageChanged(name)
} }
@ -88,4 +110,27 @@ Rectangle {
NavigationWallpaperConfiguration { NavigationWallpaperConfiguration {
} }
states: [
State {
name: "enabled"
},
State {
name: "disabled"
PropertyChanges {
target: row
opacity: 0.3
}
}
]
transitions: [
Transition {
from: "*"
to: "*"
PropertyAnimation {
target: row
duration: 300
}
}
]
} }

View File

@ -43,7 +43,6 @@ Item {
Item { Item {
id: item2 id: item2
width: 100 width: 100
height: 31 height: 31
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter

View File

@ -11,6 +11,11 @@ void QMLUtilities::setNavigation(QString nav)
emit requestNavigation(nav); emit requestNavigation(nav);
} }
void QMLUtilities::setNavigationActive(bool isActive)
{
emit requestNavigationActive(isActive);
}
void QMLUtilities::setToggleWallpaperConfiguration() void QMLUtilities::setToggleWallpaperConfiguration()
{ {
emit requestToggleWallpaperConfiguration(); emit requestToggleWallpaperConfiguration();

View File

@ -23,10 +23,13 @@ public:
signals: signals:
void requestNavigation(QString nav); void requestNavigation(QString nav);
void requestNavigationActive(bool isActive);
void requestToggleWallpaperConfiguration(); void requestToggleWallpaperConfiguration();
public slots: public slots:
void setNavigation(QString nav); void setNavigation(QString nav);
void setNavigationActive(bool isActive);
void setToggleWallpaperConfiguration(); void setToggleWallpaperConfiguration();
void openFolderInExplorer(QString url); void openFolderInExplorer(QString url);