page: welcomepage: animations++

This commit is contained in:
Torrie Fischer
2022-10-10 10:42:23 +02:00
parent afa1ec6a4d
commit 6e0aa7f683
2 changed files with 75 additions and 20 deletions

View File

@@ -14,7 +14,7 @@ import NeoChat.Component 1.0
LoginStep { LoginStep {
id: login id: login
showContinueButton: true showContinueButton: LoginHelper.homeserverReachable
showBackButton: false showBackButton: false
title: i18nc("@title", "Login") title: i18nc("@title", "Login")
@@ -25,7 +25,7 @@ LoginStep {
} }
QQC2.Label { QQC2.Label {
text: "To get started, enter your matrix ID:" text: i18n("To get started, enter your matrix ID:")
} }
Kirigami.FormLayout { Kirigami.FormLayout {
@@ -35,6 +35,8 @@ LoginStep {
onTextChanged: { onTextChanged: {
if(acceptableInput) { if(acceptableInput) {
LoginHelper.matrixId = text LoginHelper.matrixId = text
} else {
LoginHelper.matrixId = ""
} }
} }

View File

@@ -5,7 +5,7 @@ import QtQuick 2.15
import QtQuick.Controls 2.15 as Controls import QtQuick.Controls 2.15 as Controls
import QtQuick.Layouts 1.15 import QtQuick.Layouts 1.15
import org.kde.kirigami 2.15 as Kirigami import org.kde.kirigami 2.19 as Kirigami
import org.kde.neochat 1.0 import org.kde.neochat 1.0
import NeoChat.Component.Login 1.0 import NeoChat.Component.Login 1.0
@@ -49,22 +49,66 @@ Kirigami.ScrollablePage {
ColumnLayout { ColumnLayout {
Item { Item {
Layout.preferredHeight: Kirigami.Units.gridUnit * 10 Layout.preferredHeight: Kirigami.Units.gridUnit * 10
Layout.preferredWidth: Kirigami.Units.gridUnit * 8
Layout.alignment: Qt.AlignHCenter Layout.alignment: Qt.AlignHCenter
Layout.fillWidth: true
id: swapper
states: [
State {
when: !LoginHelper.homeserverReachable
name: "idle"
PropertyChanges {
target: icon
opacity: 1
}
PropertyChanges {
target: avi
opacity: 0
}
},
State {
when: LoginHelper.homeserverReachable
name: "showAvi"
PropertyChanges {
target: icon
opacity: 0
}
PropertyChanges {
target: avi
opacity: 1
}
}
]
transitions: [
Transition {
to: "showAvi"
SequentialAnimation {
NumberAnimation { target: icon; properties: "opacity";}
NumberAnimation { target: avi; properties: "opacity";}
}
},
Transition {
from: "showAvi"
SequentialAnimation {
NumberAnimation { target: avi; properties: "opacity";}
NumberAnimation { target: icon; properties: "opacity";}
}
}
]
Kirigami.Icon {
id: icon
source: "org.kde.neochat"
anchors.fill: parent
implicitWidth: height
}
ColumnLayout { ColumnLayout {
id: avi
opacity: 0
anchors.fill: parent anchors.fill: parent
Kirigami.Icon {
source: "org.kde.neochat"
visible: !welcomePage.showAvatar
Layout.fillHeight: true
Layout.alignment: Qt.AlignHCenter
implicitWidth: height
}
Kirigami.Avatar { Kirigami.Avatar {
visible: welcomePage.showAvatar
source: LoginHelper.loginAvatar source: LoginHelper.loginAvatar
name: LoginHelper.loginName name: LoginHelper.loginName
Layout.fillHeight: true Layout.fillHeight: true
@@ -72,11 +116,11 @@ Kirigami.ScrollablePage {
Layout.alignment: Qt.AlignHCenter Layout.alignment: Qt.AlignHCenter
} }
Controls.Label { Controls.Label {
text: LoginHelper.loginName text: LoginHelper.loginName
font.pointSize: 24 font.pointSize: 24
Layout.alignment: Qt.AlignHCenter Layout.alignment: Qt.AlignHCenter
} }
} }
} }
Controls.Label { Controls.Label {
@@ -95,6 +139,7 @@ Kirigami.ScrollablePage {
headerMessage.text = "" headerMessage.text = ""
} }
} }
RowLayout { RowLayout {
Layout.alignment: Qt.AlignHCenter Layout.alignment: Qt.AlignHCenter
@@ -112,11 +157,19 @@ Kirigami.ScrollablePage {
Controls.Button { Controls.Button {
id: continueButton id: continueButton
enabled: welcomePage.currentStep.acceptable enabled: welcomePage.currentStep.acceptable
visible: welcomePage.currentStep.showContinueButton opacity: welcomePage.currentStep.showContinueButton ? 1 : 0
Behavior on opacity { NumberAnimation {} }
action: welcomePage.currentStep.action action: welcomePage.currentStep.action
} }
} }
Kirigami.LoadingPlaceholder {
opacity: LoginHelper.testing ? 1 : 0
text: i18n("Connecting to your homeserver...")
Behavior on opacity { NumberAnimation {} }
Layout.alignment: Qt.AlignHCenter
}
Connections { Connections {
target: currentStep target: currentStep