From 3e1f151f839f243eab13bb5fdc6eea0e927469a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Blin?= <sebastien.blin@savoirfairelinux.com> Date: Tue, 1 Sep 2020 11:09:29 -0400 Subject: [PATCH] rendezvous: add option to create rendez-vous in wizard Change-Id: I766c5bf59b86d1d1b728c0c270f50839aed1d50c --- images/icons/groups-24px.svg | 1 + resources.qrc | 1 + src/accountadapter.cpp | 4 ++++ src/wizardview/WizardView.qml | 14 +++++++++++-- .../components/CreateAccountPage.qml | 18 ++++++++++------- src/wizardview/components/ProfilePage.qml | 6 +++--- src/wizardview/components/WelcomePage.qml | 20 +++++++++++++++++++ 7 files changed, 52 insertions(+), 12 deletions(-) create mode 100644 images/icons/groups-24px.svg diff --git a/images/icons/groups-24px.svg b/images/icons/groups-24px.svg new file mode 100644 index 000000000..b2a48e63e --- /dev/null +++ b/images/icons/groups-24px.svg @@ -0,0 +1 @@ +<svg xmlns="http://www.w3.org/2000/svg" enable-background="new 0 0 24 24" height="24" viewBox="0 0 24 24" width="24"><rect fill="none" height="24" width="24"/><g><path d="M12,12.75c1.63,0,3.07,0.39,4.24,0.9c1.08,0.48,1.76,1.56,1.76,2.73L18,18H6l0-1.61c0-1.18,0.68-2.26,1.76-2.73 C8.93,13.14,10.37,12.75,12,12.75z M4,13c1.1,0,2-0.9,2-2c0-1.1-0.9-2-2-2s-2,0.9-2,2C2,12.1,2.9,13,4,13z M5.13,14.1 C4.76,14.04,4.39,14,4,14c-0.99,0-1.93,0.21-2.78,0.58C0.48,14.9,0,15.62,0,16.43V18l4.5,0v-1.61C4.5,15.56,4.73,14.78,5.13,14.1z M20,13c1.1,0,2-0.9,2-2c0-1.1-0.9-2-2-2s-2,0.9-2,2C18,12.1,18.9,13,20,13z M24,16.43c0-0.81-0.48-1.53-1.22-1.85 C21.93,14.21,20.99,14,20,14c-0.39,0-0.76,0.04-1.13,0.1c0.4,0.68,0.63,1.46,0.63,2.29V18l4.5,0V16.43z M12,6c1.66,0,3,1.34,3,3 c0,1.66-1.34,3-3,3s-3-1.34-3-3C9,7.34,10.34,6,12,6z"/></g></svg> \ No newline at end of file diff --git a/resources.qrc b/resources.qrc index 808ae97ff..5a4127787 100644 --- a/resources.qrc +++ b/resources.qrc @@ -56,6 +56,7 @@ <file>images/icons/play_circle_outline-24px.svg</file> <file>images/icons/ic_pause_white_100px.png</file> <file>images/icons/ic_phone_24px.svg</file> + <file>images/icons/groups-24px.svg</file> <file>images/icons/ic_photo_camera_white_24dp_2x.png</file> <file>images/icons/ic_baseline-search-24px.svg</file> <file>images/icons/ic_send_24px.svg</file> diff --git a/src/accountadapter.cpp b/src/accountadapter.cpp index 23f141b0f..46d9172c1 100644 --- a/src/accountadapter.cpp +++ b/src/accountadapter.cpp @@ -121,6 +121,8 @@ AccountAdapter::createJamiAccount(QString registeredName, } else { LRCInstance::setAvatarForAccount(QPixmap::fromImage(avatarImg), accountId); } + + }); connectFailure(); @@ -129,6 +131,8 @@ AccountAdapter::createJamiAccount(QString registeredName, QMap<QString, QString> additionalAccountConfig; additionalAccountConfig.insert(DRing::Account::ConfProperties::Ringtone::PATH, Utils::GetRingtonePath()); + additionalAccountConfig.insert(DRing::Account::ConfProperties::ISRENDEZVOUS, + settings["isRendezVous"].toString()); LRCInstance::accountModel().createNewAccount(lrc::api::profile::Type::RING, settings["alias"].toString(), diff --git a/src/wizardview/WizardView.qml b/src/wizardview/WizardView.qml index e2fe298c5..d60964462 100644 --- a/src/wizardview/WizardView.qml +++ b/src/wizardview/WizardView.qml @@ -48,7 +48,8 @@ Rectangle { BACKUPKEYSPAGE, IMPORTFROMDEVICEPAGE, CONNECTTOACCOUNTMANAGERPAGE, - PROFILEPAGE + PROFILEPAGE, + CREATERENDEZVOUS } readonly property int layoutSpacing: 12 @@ -56,6 +57,7 @@ Rectangle { property int textFontSize: 9 property int wizardMode: WizardView.CREATE property int addedAccountIndex: -1 + property bool isRdv: false property bool showBackUp: false property bool showProfile: false property bool showBottom: false @@ -84,8 +86,10 @@ Rectangle { if (showProfile) { changePageQML(WizardView.WizardViewPageIndex.PROFILEPAGE) profilePage.readyToSaveDetails() + profilePage.isRdv = isRdv } else if (controlPanelStackView.currentIndex === WizardView.WizardViewPageIndex.PROFILEPAGE) { profilePage.readyToSaveDetails() + profilePage.isRdv = isRdv } else if (showBackUp) { changePageQML(WizardView.WizardViewPageIndex.BACKUPKEYSPAGE) } else { @@ -116,6 +120,7 @@ Rectangle { controlPanelStackView.currentIndex = pageIndex if (pageIndex === WizardView.WizardViewPageIndex.WELCOMEPAGE) { fileToImport = "" + isRdv = false createAccountPage.nameRegistrationUIState = UsernameLineEdit.NameRegistrationState.BLANK } else if (pageIndex === WizardView.WizardViewPageIndex.CREATEACCOUNTPAGE) { createAccountPage.initializeOnShowUp() @@ -131,6 +136,10 @@ Rectangle { } else if (pageIndex === WizardView.WizardViewPageIndex.PROFILEPAGE) { profilePage.initializeOnShowUp() profilePage.showBottom = showBottom + } else if (pageIndex === WizardView.WizardViewPageIndex.CREATERENDEZVOUS) { + isRdv = true + controlPanelStackView.currentIndex = WizardView.WizardViewPageIndex.CREATEACCOUNTPAGE + createAccountPage.initializeOnShowUp(true) } } @@ -189,13 +198,14 @@ Rectangle { onCreateAccount: { inputParaObject = {} + inputParaObject["isRendezVous"] = isRdv inputParaObject["password"] = text_passwordEditAlias AccountAdapter.createJamiAccount( createAccountPage.text_usernameEditAlias, inputParaObject, createAccountPage.boothImgBase64, true) - showBackUp = true + showBackUp = !isRdv showBottom = true changePageQML(WizardView.WizardViewPageIndex.PROFILEPAGE) } diff --git a/src/wizardview/components/CreateAccountPage.qml b/src/wizardview/components/CreateAccountPage.qml index d1cb60184..c3c3323ad 100644 --- a/src/wizardview/components/CreateAccountPage.qml +++ b/src/wizardview/components/CreateAccountPage.qml @@ -31,12 +31,14 @@ Rectangle { property alias text_usernameEditAlias: usernameEdit.text property alias nameRegistrationUIState: usernameEdit.nameRegistrationState + property bool isRendezVous: false property alias text_passwordEditAlias: passwordEdit.text signal createAccount signal leavePage - function initializeOnShowUp() { + function initializeOnShowUp(isRdv) { + isRendezVous = isRdv createAccountStack.currentIndex = 0 clearAllTextFields() passwordSwitch.checked = false @@ -108,7 +110,7 @@ Rectangle { Layout.preferredWidth: usernameEdit.width Label { - text: qsTr("Choose a username") + text: isRendezVous ? qsTr("Choose a name for your rendez-vous") : qsTr("Choose a username for your account") font.pointSize: JamiTheme.textFontSize + 3 } @@ -135,7 +137,7 @@ Rectangle { Layout.preferredWidth: chooseUsernameButton.width Layout.alignment: Qt.AlignHCenter - placeholderText: qsTr("Choose your username") + placeholderText: isRendezVous ? qsTr("Choose a name") : qsTr("Choose your username") } Label { @@ -150,9 +152,9 @@ Rectangle { case UsernameLineEdit.NameRegistrationState.FREE: return "" case UsernameLineEdit.NameRegistrationState.INVALID: - return qsTr("Invalid username") + return isRendezVous ? qsTr("Invalid name") : qsTr("Invalid username") case UsernameLineEdit.NameRegistrationState.TAKEN: - return qsTr("Username already taken") + return isRendezVous ? qsTr("Name already taken") : qsTr("Username already taken") } } font.pointSize: JamiTheme.textFontSize @@ -166,7 +168,8 @@ Rectangle { Layout.preferredWidth: preferredWidth Layout.preferredHeight: preferredHeight - text: qsTr("CHOOSE USERNAME") + fontCapitalization: Font.AllUppercase + text: isRendezVous ? qsTr("Choose name") : qsTr("Choose username") enabled: nameRegistrationUIState === UsernameLineEdit.NameRegistrationState.FREE color: nameRegistrationUIState === UsernameLineEdit.NameRegistrationState.FREE ? JamiTheme.wizardBlueButtons : @@ -292,7 +295,8 @@ Rectangle { && passwordEdit.text.length !== 0) } - text: qsTr("CREATE ACCOUNT") + fontCapitalization: Font.AllUppercase + text: isRendezVous ? qsTr("Create rendez-vous") : qsTr("Create account") enabled: checkEnable() color: checkEnable() ? JamiTheme.wizardBlueButtons : JamiTheme.buttonTintedGreyInactive diff --git a/src/wizardview/components/ProfilePage.qml b/src/wizardview/components/ProfilePage.qml index 557d08242..f85f41478 100644 --- a/src/wizardview/components/ProfilePage.qml +++ b/src/wizardview/components/ProfilePage.qml @@ -48,6 +48,7 @@ Rectangle { property var showBottom: false property alias boothImgBase64: setAvatarWidget.imgBase64 property alias displayName: aliasEdit.text + property bool isRdv: false ColumnLayout { spacing: layoutSpacing @@ -100,7 +101,7 @@ Rectangle { Layout.alignment: Qt.AlignCenter selectByMouse: true - placeholderText: qsTr("Enter your name") + placeholderText: isRdv ? qsTr("Enter the rendez-vous's name") : qsTr("Enter your name") font.pointSize: 9 font.kerning: true @@ -118,8 +119,7 @@ Rectangle { enabled: !spinnerTriggered normalText: qsTr("Save Profile") - spinnerTriggeredtext: qsTr("Generating account…") - + spinnerTriggeredtext: root.isRdv ? qsTr("Generating rendez-vous…") : qsTr("Generating account…") onClicked: saveProfile() } diff --git a/src/wizardview/components/WelcomePage.qml b/src/wizardview/components/WelcomePage.qml index 6434df0e5..3b60e7829 100644 --- a/src/wizardview/components/WelcomePage.qml +++ b/src/wizardview/components/WelcomePage.qml @@ -90,6 +90,26 @@ Rectangle { } } + MaterialButton { + id: newRdvButton + + Layout.alignment: Qt.AlignCenter + Layout.preferredWidth: preferredWidth + Layout.preferredHeight: preferredHeight + + text: qsTr("Create a rendez-vous") + fontCapitalization: Font.AllUppercase + toolTipText: qsTr("Create new rendez-vous") + source: "qrc:/images/icons/groups-24px.svg" + color: JamiTheme.buttonTintedBlue + hoveredColor: JamiTheme.buttonTintedBlueHovered + pressedColor: JamiTheme.buttonTintedBluePressed + + onClicked: { + welcomePageRedirectPage(8) + } + } + MaterialButton { id: fromDeviceButton -- GitLab