1
0
mirror of https://gitlab.com/kelteseth/ScreenPlay.git synced 2024-09-15 06:52:34 +02: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 bool canNext: false
Component.onCompleted: {
state = "in"
utility.setNavigationActive(false)
}
//Blocks some MouseArea from create page
MouseArea {
anchors.fill: parent
@ -22,7 +28,7 @@ Item {
Connections {
target: screenPlayCreate
onCreateWallpaperStateChanged: {
print(state)
if (state === Create.State.ConvertingPreviewGifError
|| state === Create.State.ConvertingPreviewVideoError
|| state === Create.State.ConvertingPreviewImageError
@ -43,10 +49,6 @@ Item {
}
}
Component.onCompleted: {
state = "in"
}
RectangularGlow {
id: effect
anchors {
@ -121,6 +123,14 @@ Item {
color: "gray"
AnimatedImage {
id: imgPreview
asynchronous: true
playing: true
visible: false
anchors.fill: parent
}
BusyIndicator {
id: busyIndicator
anchors.centerIn: parent
@ -148,6 +158,13 @@ Item {
"Generating preview gif...")
}
if (state === Create.State.ConvertingPreviewImageFinished) {
imgPreview.source = "file:///"
+ screenPlayCreate.workingDir + "/preview.png"
imgPreview.visible = true
}
if (state === Create.State.ConvertingPreviewGifFinished) {
imgPreview.source = "file:///"
+ 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 {
horizontalCenter: parent.horizontalCenter
bottom: parent.bottom
margins: 30
}
onClicked: {
if (btnFinish.state === "enabled" && canNext) {
screenPlayCreate.createWallpaperProjectFile(
textField.text, textField1.text)
Button {
id: btnExit
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 {
target: screenPlayCreate
onCreateWallpaperStateChanged: {
@ -244,6 +276,7 @@ Item {
}
}
}
}
}
@ -322,6 +355,7 @@ Item {
margins: 10
}
onClicked: {
utility.setNavigationActive(true)
utility.setNavigation("Create")
}
}
@ -359,6 +393,7 @@ Item {
margins: 10
}
onClicked: {
utility.setNavigationActive(true)
utility.setNavigation("Create")
}
}
@ -395,7 +430,11 @@ Item {
Timer {
id: timerBack
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)
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) {
@ -21,6 +38,9 @@ Rectangle {
return
}
if (!navActive)
return
navigation.changePage(name)
for (var i = 0; i < navArray.length; i++) {
@ -33,6 +53,7 @@ Rectangle {
}
Row {
id: row
anchors.fill: parent
anchors.left: parent.left
anchors.leftMargin: 20
@ -42,6 +63,7 @@ Rectangle {
id: navCreate
state: "inactive"
name: "Create"
iconSource: "qrc:/assets/icons/icon_plus.svg"
onPageClicked: navigation.onPageChanged(name)
}
@ -88,4 +110,27 @@ Rectangle {
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 {
id: item2
width: 100
height: 31
anchors.verticalCenter: parent.verticalCenter

View File

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

View File

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