From 06f744d8f3d458bde5d213ac0b9981ff0891153f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=A6=8C=20=EA=A6=AB=EA=A6=B6=20=EA=A6=8F=EA=A7=80?= =?UTF-8?q?=EA=A6=A6=EA=A6=BF=20=EA=A6=A7=20=EA=A6=AE=20=EA=A6=91=20?= =?UTF-8?q?=EA=A6=A9=20=EA=A6=AD=EA=A7=80?= Date: Wed, 25 Sep 2019 09:56:48 +0800 Subject: Simplify the QML logics entrance --- CreateProfile.qml | 2 +- LoginPassword.qml | 2 +- Onboarding.qml | 16 ---------------- controller.cxx | 7 +++---- kelakon.qrc | 1 - larva | 2 +- main.qml | 24 +++++++++++++----------- qrtclient | 2 +- 8 files changed, 20 insertions(+), 36 deletions(-) delete mode 100644 Onboarding.qml diff --git a/CreateProfile.qml b/CreateProfile.qml index 2a22a4b..ac5b4b3 100644 --- a/CreateProfile.qml +++ b/CreateProfile.qml @@ -9,7 +9,7 @@ CreateProfileForm { startUsingKelakon.onClicked: { User.name = userNameLabel.text User.realName = enterFullName.text - onboarding.ticketNew("Kelakon", User.realName + " <" + window.ticketNew("Kelakon", User.realName + " <" + User.emailAddress + ">") } } diff --git a/LoginPassword.qml b/LoginPassword.qml index 2d8bbba..d306914 100644 --- a/LoginPassword.qml +++ b/LoginPassword.qml @@ -10,6 +10,6 @@ LoginPasswordForm { continueButton.onClicked: { User.password = passwordTextField.text - onboarding.logIn(User.name, User.password) + window.logIn(User.name, User.password) } } diff --git a/Onboarding.qml b/Onboarding.qml deleted file mode 100644 index 6b9bcf7..0000000 --- a/Onboarding.qml +++ /dev/null @@ -1,16 +0,0 @@ -import QtQuick 2.12 -import "larva/features" - -OnboardingForm { - signal logIn(string name, string password) - signal ticketNew(string queue, string requestor) - function pushHome() { - pageView.push("Home.qml") - } - - objectName: "onboarding" - logoImage.source: "kelakon-logo.png" - onboardingImage.source: "onboarding-1.png" - registerButton.onClicked: pageView.push("Email.qml") - loginButton.onClicked: pageView.push("Login.qml") -} diff --git a/controller.cxx b/controller.cxx index 8447242..9908fb8 100644 --- a/controller.cxx +++ b/controller.cxx @@ -26,7 +26,6 @@ Controller::Controller(QObject* parent) : QObject{parent} auto engine = static_cast(parent); auto rootObjects = engine->rootObjects(); auto appWindow = rootObjects[0]; - auto onboardingView = appWindow->findChild("onboarding"); using RTClient::User; auto typeId = qmlRegisterSingletonType("KelakonUser", 0, 1, "User" , [](QQmlEngine *engine @@ -39,7 +38,7 @@ Controller::Controller(QObject* parent) : QObject{parent} taskList = new RTClient::TicketList; engine->rootContext()->setContextProperty("taskList", taskList); - connect(onboardingView, SIGNAL(logIn(QString, QString)) + connect(appWindow, SIGNAL(logIn(QString, QString)) , client, SLOT(logIn(QString, QString))); connect(client, SIGNAL(loggedIn(QString)) @@ -56,9 +55,9 @@ Controller::Controller(QObject* parent) : QObject{parent} connect(client, SIGNAL(ticketSearched(rtclient_ticketlist*)) , taskList, SLOT(update(rtclient_ticketlist*))); - connect(taskList, SIGNAL(updated()), onboardingView, SLOT(pushHome())); + connect(taskList, SIGNAL(updated()), appWindow, SLOT(pushHome())); - connect(onboardingView, SIGNAL(ticketNew(QString, QString)) + connect(appWindow, SIGNAL(ticketNew(QString, QString)) , client, SLOT(ticketNew(QString, QString))); thread.start(); diff --git a/kelakon.qrc b/kelakon.qrc index 2ff8636..0d641ee 100644 --- a/kelakon.qrc +++ b/kelakon.qrc @@ -1,7 +1,6 @@ main.qml - Onboarding.qml Login.qml LoginEmail.qml LoginPassword.qml diff --git a/larva b/larva index e5d1cb6..15aa7f7 160000 --- a/larva +++ b/larva @@ -1 +1 @@ -Subproject commit e5d1cb6db260c71e2205c4f65d383628bb518f5e +Subproject commit 15aa7f7118ee297f3492586a591303323c056828 diff --git a/main.qml b/main.qml index eb0f23f..054ea7c 100644 --- a/main.qml +++ b/main.qml @@ -1,24 +1,26 @@ import QtQuick 2.12 import QtQuick.Controls 2.12 -import QtQuick.Controls.Material 2.12 - +import "larva/features" ApplicationWindow { + signal logIn(string name, string password) + signal ticketNew(string queue, string requestor) + function pushHome() { + pageView.push("Home.qml") + } + id: window visible: true width: 360 height: 640 - title: { - text: qsTr("kelakon") - } - StackView { - property alias onboarding: onboarding + OnboardingForm { id: pageView anchors.fill: parent - initialItem: Onboarding { - id: onboarding - onboardingText1.text: qsTr("Get things done today, chill tomorrow.") - } + logoImage.source: "kelakon-logo.png" + onboardingImage.source: "onboarding-1.png" + onboardingText1.text: qsTr("Get things done today, chill tomorrow.") + registerButton.onClicked: pageView.push("Email.qml") + loginButton.onClicked: pageView.push("Login.qml") } } diff --git a/qrtclient b/qrtclient index ddeb4c5..c1d0def 160000 --- a/qrtclient +++ b/qrtclient @@ -1 +1 @@ -Subproject commit ddeb4c5f70dba8644d75a084335b787b642f449e +Subproject commit c1d0defeb364527218d1187b9be87872282428a8 -- cgit v1.2.3