1
0
Fork 0
mirror of https://git.jami.net/savoirfairelinux/jami-client-qt.git synced 2025-09-10 12:03:18 +02:00

dialogs: migrate dialogs to native-style

Gitlab: #20
Change-Id: I05358244ad9cae5d335934a2947c18de6d79683e
This commit is contained in:
ababi 2020-09-07 17:44:57 +02:00 committed by Andreas Traczyk
parent 9c0ea510cd
commit 6e43a456fd
22 changed files with 1069 additions and 1748 deletions

View file

@ -138,5 +138,6 @@
<file>src/commoncomponents/SpinnerButton.qml</file>
<file>src/commoncomponents/UsernameLineEdit.qml</file>
<file>src/mainview/components/UserInfoCallPage.qml</file>
<file>src/commoncomponents/BaseDialog.qml</file>
</qresource>
</RCC>

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,28 @@
/*
* Copyright (C) 2020 by Savoir-faire Linux
* Author: Albert Babí <albert.babi@savoirfairelinux.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
import QtQuick 2.15
import QtQuick.Dialogs 1.2
import "../constant"
Dialog {
id: root
visible: false
}

View file

@ -22,9 +22,11 @@ import QtQuick.Layouts 1.14
import QtQuick.Controls.Styles 1.4
import net.jami.Models 1.0
import net.jami.Adapters 1.0
import "../constant"
Dialog {
import "../constant"
import "../commoncomponents"
BaseDialog {
id: root
property int profileType: SettingsAdapter.getCurrentAccount_Profile_Info_Type()
@ -38,156 +40,139 @@ Dialog {
}
}
onOpened: {
signal accepted
function openDialog() {
profileType = SettingsAdapter.getCurrentAccount_Profile_Info_Type()
labelBestId.text = SettingsAdapter.getAccountBestName()
labelAccountHash.text = SettingsAdapter.getCurrentAccount_Profile_Info_Uri()
open()
}
onVisibleChanged: {
if(!visible){
reject()
}
}
header : Rectangle {
width: parent.width
height: 64
color: "transparent"
Text {
anchors.fill: parent
anchors.leftMargin: JamiTheme.preferredMarginSize
anchors.topMargin: JamiTheme.preferredMarginSize
text: qsTr("Account deletion")
font.pointSize: JamiTheme.headerFontSize
wrapMode: Text.Wrap
}
}
visible: false
x: (parent.width - width) / 2
y: (parent.height - height) / 2
title: JamiStrings.deleteAccount
contentItem: Rectangle {
implicitHeight: contentLayout.implicitHeight + 64 + JamiTheme.preferredMarginSize
implicitWidth: 350
id: deleteAccountContentRect
ColumnLayout{
id: contentLayout
anchors.fill: parent
implicitWidth: JamiTheme.preferredDialogWidth
implicitHeight: JamiTheme.preferredDialogHeight
ColumnLayout {
anchors.centerIn: parent
anchors.fill: parent
anchors.margins: JamiTheme.preferredMarginSize
Label {
id: labelDeletion
Layout.fillWidth: true
Layout.preferredHeight: 30
Layout.alignment: Qt.AlignHCenter
Layout.preferredWidth: deleteAccountContentRect.width - JamiTheme.preferredMarginSize * 2
text: JamiStrings.confirmDeleteQuestion
font.pointSize: JamiTheme.textFontSize
font.kerning: true
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
wrapMode: Text.Wrap
text: JamiStrings.confirmDeleteQuestion
}
Label {
id: labelBestId
Layout.topMargin: 5
Layout.fillWidth: true
Layout.preferredHeight: 30
Layout.alignment: Qt.AlignHCenter
Layout.preferredWidth: deleteAccountContentRect.width - JamiTheme.preferredMarginSize * 2
text: SettingsAdapter.getAccountBestName()
font.pointSize: JamiTheme.textFontSize
font.kerning: true
font.bold: true
horizontalAlignment: Text.AlignHCenter
wrapMode: Text.Wrap
text: SettingsAdapter.getAccountBestName()
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
wrapMode: Text.Wrap
}
Label {
id: labelAccountHash
Layout.alignment: Qt.AlignHCenter
Layout.preferredHeight: 30
Layout.preferredWidth: deleteAccountContentRect.width - JamiTheme.preferredMarginSize * 2
text: SettingsAdapter.getCurrentAccount_Profile_Info_Uri()
font.pointSize: JamiTheme.textFontSize
font.kerning: true
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
wrapMode: Text.Wrap
text: SettingsAdapter.getCurrentAccount_Profile_Info_Uri()
}
Label {
id: labelWarning
Layout.topMargin: 5
Layout.preferredHeight: 30
Layout.fillWidth: true
visible: !isSIP
Layout.alignment: Qt.AlignHCenter
Layout.preferredWidth: deleteAccountContentRect.width - JamiTheme.preferredMarginSize * 2
visible: ! isSIP
wrapMode: Text.Wrap
text: JamiStrings.deleteAccountInfos
font.pointSize: JamiTheme.textFontSize
font.kerning: true
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
wrapMode: Text.Wrap
color: "red"
}
RowLayout {
Layout.topMargin: JamiTheme.preferredMarginSize / 2
Layout.bottomMargin: 5
Layout.preferredHeight: 30
spacing: 16
Layout.fillWidth: true
Layout.alignment: Qt.AlignHCenter
Layout.alignment: Qt.AlignCenter
HoverableRadiusButton {
id: btnDeleteAccept
MaterialButton {
id: btnDelete
Layout.fillWidth: true
Layout.maximumWidth: 130
Layout.alignment: Qt.AlignHCenter
Layout.preferredWidth: JamiTheme.preferredFieldWidth / 2 - 8
Layout.preferredHeight: JamiTheme.preferredFieldHeight
radius: height / 2
color: JamiTheme.buttonTintedRed
hoveredColor: JamiTheme.buttonTintedRedHovered
pressedColor: JamiTheme.buttonTintedRedPressed
outlined: true
text: qsTr("Delete")
font.pointSize: JamiTheme.buttonFontSize
font.kerning: true
onClicked: {
AccountAdapter.deleteCurrentAccount()
accept()
accepted()
close()
}
}
HoverableButtonTextItem {
id: btnDeleteCancel
MaterialButton {
id: btnCancel
Layout.leftMargin: 20
Layout.fillWidth: true
Layout.maximumWidth: 130
Layout.alignment: Qt.AlignHCenter
Layout.preferredWidth: JamiTheme.preferredFieldWidth / 2 - 8
Layout.preferredHeight: JamiTheme.preferredFieldHeight
backgroundColor: "red"
onEnterColor: Qt.rgba(150 / 256, 0, 0, 0.7)
onDisabledBackgroundColor: Qt.rgba(
255 / 256,
0, 0, 0.8)
onPressColor: backgroundColor
textColor: "white"
radius: height / 2
color: JamiTheme.buttonTintedBlack
hoveredColor: JamiTheme.buttonTintedBlackHovered
pressedColor: JamiTheme.buttonTintedBlackPressed
outlined: true
text: qsTr("Cancel")
font.pointSize: JamiTheme.buttonFontSize
font.kerning: true
onClicked: {
reject()
close()
}
}
}

View file

@ -18,7 +18,8 @@
import QtQuick 2.14
import QtQuick.Controls 1.4
import net.jami.Models 1.0
import "../constant"
Label {
id: root

View file

@ -18,9 +18,8 @@
*/
import QtQuick 2.14
import QtQuick.Controls 2.14
import net.jami.Models 1.0
import QtGraphicalEffects 1.15
import "../constant"
// HoverableButton contains the following configurable properties:
// 1. Color changes on different button state

View file

@ -26,8 +26,7 @@ import net.jami.Adapters 1.0
import "../constant"
// PasswordDialog for changing password and exporting account
Dialog {
BaseDialog {
id: root
enum PasswordEnteringPurpose {
@ -35,38 +34,13 @@ Dialog {
ExportAccount,
SetPassword
}
readonly property int successCode: 200
signal doneSignal(int code, int currentPurpose)
property string path: ""
property int purpose: PasswordDialog.ChangePassword
header : Rectangle {
id: dialogHeader
width: parent.width
height: 64
color: "transparent"
Text {
anchors.fill: parent
anchors.leftMargin: JamiTheme.preferredMarginSize
anchors.topMargin: JamiTheme.preferredMarginSize
signal doneSignal(bool success, int currentPurpose)
text: {
switch(purpose){
case PasswordDialog.ExportAccount:
return JamiStrings.enterPassword
case PasswordDialog.ChangePassword:
return qsTr("Changing password")
case PasswordDialog.SetPassword:
return qsTr("Set password")
}
}
font.pointSize: JamiTheme.headerFontSize
wrapMode: Text.Wrap
}
}
function openDialog(purposeIn, exportPathIn = ""){
function openDialog(purposeIn, exportPathIn = "") {
purpose = purposeIn
path = exportPathIn
currentPasswordEdit.clear()
@ -74,40 +48,22 @@ Dialog {
confirmPasswordEdit.borderColorMode = InfoLineEdit.NORMAL
passwordEdit.clear()
confirmPasswordEdit.clear()
root.open()
}
function haveDone(code, currentPurpose) {
done(code)
doneSignal(code, currentPurpose)
validatePassword()
open()
}
function validatePassword() {
var acceptablePassword = (passwordEdit.text === confirmPasswordEdit.text)
btnChangePasswordConfirm.enabled = acceptablePassword
if (acceptablePassword) {
passwordEdit.borderColorMode = InfoLineEdit.RIGHT
confirmPasswordEdit.borderColorMode = InfoLineEdit.RIGHT
return
}
passwordEdit.borderColorMode = InfoLineEdit.ERROR
confirmPasswordEdit.borderColorMode = InfoLineEdit.ERROR
}
Timer{
id: timerToOperate
interval: 200
repeat: false
onTriggered: {
if ((purpose === PasswordDialog.ChangePassword) || (purpose === PasswordDialog.SetPassword)) {
savePasswordQML()
} else if(purpose === PasswordDialog.ExportAccount) {
exportAccountQML()
}
switch (purpose) {
case PasswordDialog.ExportAccount:
btnConfirm.enabled = currentPasswordEdit.length > 0
break
case PasswordDialog.SetPassword:
btnConfirm.enabled = passwordEdit.length > 0 &&
passwordEdit.text === confirmPasswordEdit.text
break
default:
btnConfirm.enabled = currentPasswordEdit.length > 0 &&
passwordEdit.text === confirmPasswordEdit.text
}
}
@ -119,13 +75,8 @@ Dialog {
path,
currentPasswordEdit.text)
}
if (success) {
haveDone(successCode, root.purpose)
} else {
btnChangePasswordConfirm.enabled = false
currentPasswordEdit.borderColorMode = InfoLineEdit.ERROR
}
doneSignal(success, purpose)
close()
}
function savePasswordQML() {
@ -136,134 +87,144 @@ Dialog {
passwordEdit.text)
if (success) {
AccountAdapter.setArchiveHasPassword(passwordEdit.text.length !== 0)
haveDone(successCode, passwordDialog.purpose)
} else {
currentPasswordEdit.borderColorMode = InfoLineEdit.ERROR
btnChangePasswordConfirm.enabled = false
}
doneSignal(success, purpose)
close()
}
title: {
switch(purpose){
case PasswordDialog.ExportAccount:
return JamiStrings.enterPassword
case PasswordDialog.ChangePassword:
return JamiStrings.changePassword
case PasswordDialog.SetPassword:
return JamiStrings.setPassword
}
}
visible: false
x: (parent.width - width) / 2
y: (parent.height - height) / 2
Timer {
id: timerToOperate
interval: 200
repeat: false
onTriggered: {
if (purpose === PasswordDialog.ExportAccount) {
exportAccountQML()
} else {
savePasswordQML()
}
}
}
contentItem: Rectangle {
implicitHeight: contentLayout.implicitHeight + dialogHeader.height + JamiTheme.preferredMarginSize
implicitWidth: 350
id: passwordDialogContentRect
implicitWidth: JamiTheme.preferredDialogWidth
implicitHeight: JamiTheme.preferredDialogHeight
ColumnLayout {
id: contentLayout
anchors.centerIn: parent
anchors.fill: parent
anchors.margins: JamiTheme.preferredMarginSize
MaterialLineEdit {
id: currentPasswordEdit
ColumnLayout {
Layout.alignment: Qt.AlignHCenter
Layout.preferredWidth: JamiTheme.preferredFieldWidth
Layout.preferredHeight: visible ? 48 : 0
MaterialLineEdit {
id: currentPasswordEdit
visible: purpose === PasswordDialog.ChangePassword ||
purpose === PasswordDialog.ExportAccount
echoMode: TextInput.Password
placeholderText: JamiStrings.enterCurrentPassword
Layout.maximumHeight: visible ?
48 :
0
Layout.fillWidth: true
visible: purpose === PasswordDialog.ChangePassword || purpose === PasswordDialog.ExportAccount
echoMode: TextInput.Password
horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignVCenter
placeholderText: JamiStrings.enterCurrentPassword
onTextChanged: {
if (purpose === PasswordDialog.ChangePassword) {
validatePassword()
}
if (currentPasswordEdit.text.length == 0) {
btnChangePasswordConfirm.enabled = false
} else {
btnChangePasswordConfirm.enabled = true
}
}
onTextChanged: {
validatePassword()
}
}
MaterialLineEdit {
id: passwordEdit
MaterialLineEdit {
id: passwordEdit
Layout.fillWidth: true
Layout.topMargin: JamiTheme.preferredMarginSize / 2
fieldLayoutHeight: 48
Layout.alignment: Qt.AlignHCenter
Layout.preferredWidth: JamiTheme.preferredFieldWidth
Layout.preferredHeight: visible ? 48 : 0
visible: purpose === PasswordDialog.ChangePassword || purpose === PasswordDialog.SetPassword
echoMode: TextInput.Password
horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignVCenter
visible: purpose === PasswordDialog.ChangePassword ||
purpose === PasswordDialog.SetPassword
echoMode: TextInput.Password
placeholderText: JamiStrings.enterNewPassword
placeholderText: JamiStrings.enterNewPassword
onTextChanged: {
validatePassword()
}
onTextChanged: {
validatePassword()
}
}
MaterialLineEdit {
id: confirmPasswordEdit
MaterialLineEdit {
id: confirmPasswordEdit
Layout.fillWidth: true
Layout.topMargin: JamiTheme.preferredMarginSize / 2
fieldLayoutHeight: 48
layoutFillwidth: true
Layout.alignment: Qt.AlignHCenter
Layout.preferredWidth: JamiTheme.preferredFieldWidth
Layout.preferredHeight: visible ? 48 : 0
visible: purpose === PasswordDialog.ChangePassword || purpose === PasswordDialog.SetPassword
echoMode: TextInput.Password
horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignVCenter
visible: purpose === PasswordDialog.ChangePassword ||
purpose === PasswordDialog.SetPassword
echoMode: TextInput.Password
placeholderText: JamiStrings.confirmNewPassword
placeholderText: JamiStrings.confirmNewPassword
onTextChanged: {
validatePassword()
}
onTextChanged: {
validatePassword()
}
}
RowLayout {
Layout.topMargin: JamiTheme.preferredMarginSize / 2
Layout.alignment: Qt.AlignRight
spacing: 16
Layout.fillWidth: true
Layout.alignment: Qt.AlignCenter
Button {
id: btnChangePasswordConfirm
MaterialButton {
id: btnConfirm
contentItem: Text {
text: JamiStrings.confirm
color: JamiTheme.buttonTintedBlue
font.capitalization: Font.AllUppercase
}
Layout.alignment: Qt.AlignHCenter
Layout.preferredWidth: JamiTheme.preferredFieldWidth / 2 - 8
Layout.preferredHeight: JamiTheme.preferredFieldHeight
background: Rectangle {
color: "transparent"
}
color: enabled? JamiTheme.buttonTintedBlack : JamiTheme.buttonTintedGrey
hoveredColor: JamiTheme.buttonTintedBlackHovered
pressedColor: JamiTheme.buttonTintedBlackPressed
outlined: true
enabled: purpose === PasswordDialog.SetPassword
text: (purpose === PasswordDialog.ExportAccount) ? JamiStrings.exportAccount :
JamiStrings.change
onClicked: {
btnConfirm.enabled = false
timerToOperate.restart()
}
}
MaterialButton {
id: btnCancel
Button {
id: btnChangePasswordCancel
Layout.leftMargin: JamiTheme.preferredMarginSize / 2
Layout.alignment: Qt.AlignHCenter
Layout.preferredWidth: JamiTheme.preferredFieldWidth / 2 - 8
Layout.preferredHeight: JamiTheme.preferredFieldHeight
contentItem: Text {
text: qsTr("CANCEL")
color: JamiTheme.buttonTintedBlue
}
color: JamiTheme.buttonTintedBlack
hoveredColor: JamiTheme.buttonTintedBlackHovered
pressedColor: JamiTheme.buttonTintedBlackPressed
outlined: true
background: Rectangle {
color: "transparent"
}
text: qsTr("Cancel")
onClicked: {
root.reject()
close()
}
}
}

View file

@ -289,18 +289,22 @@ Item {
property string connectFromAnotherDevice: qsTr("Create account from an another device")
// KeyBoardShortcutTable
property string conversations: ("Conversations")
property string conversations: qsTr("Conversations")
// LinkDevicesDialog
property string pinTimerInfos: qsTr("The PIN and the account password should be entered in your device within 10 minutes.")
property string close: qsTr("Close")
property string enterAccountPassword: qsTr("Enter your account password")
property string addDevice: qsTr("Add Device")
// PasswordDialog
property string enterPassword: qsTr("Enter the password")
property string enterCurrentPassword: qsTr("Enter current password")
property string enterNewPassword: qsTr("Enter new password")
property string confirmNewPassword: qsTr("Confirm new password")
property string change: qsTr("Change")
property string confirm: qsTr("Confirm")
property string exportAccount: qsTr("Export")
// PhotoBoothView
property string chooseAvatarImage: qsTr("Choose a picture as avatar")
@ -328,6 +332,9 @@ Item {
// UserProfile
property string qrCode: qsTr("QR code")
// Account QR
property string accountQr: qsTr("Account QR")
// WelcomePage
property string shareInvite: qsTr("This is your Jami username.\nCopy and share it with your friends!")
property string linkFromAnotherDevice: qsTr("Link this device to an existing account")

View file

@ -83,6 +83,7 @@ Item {
property int splitViewHandlePreferredWidth: 4
property int textFontSize: 9
property int tinyFontSize: 7
property int settingsFontSize: 9
property int buttonFontSize: 9
property int headerFontSize: 13
@ -93,6 +94,8 @@ Item {
property int preferredFieldWidth: 256
property int preferredFieldHeight: 32
property int preferredMarginSize: 16
property int preferredDialogWidth: 400
property int preferredDialogHeight: 300
// Jami theme colors
function rgb256(r, g, b) {

View file

@ -34,13 +34,12 @@ Window {
id: mainViewWindow
property int minWidth: settingsViewPreferredWidth
property int minHeight: aboutPopUpDialog.contentHeight
property int minHeight: 400
property int mainViewWindowPreferredWidth: 650
property int mainViewWindowPreferredHeight: 600
property int sidePanelViewStackPreferredWidth: 250
property int mainViewStackPreferredWidth: 250
property int aboutPopUpPreferredWidth: 400
property int settingsViewPreferredWidth: 445
property int onWidthChangedTriggerDistance: 5
@ -461,7 +460,7 @@ Window {
callStackView.showIncomingCallPage(AccountAdapter.currentAccountId,
currentUID)
} else {
callStackView.showOutgoingCallPage()
callStackView.showOutgoingCallPage(callState)
}
}
@ -649,20 +648,10 @@ Window {
AboutPopUp {
id: aboutPopUpDialog
x: Math.round((mainViewWindow.width - width) / 2)
y: Math.round((mainViewWindow.height - height) / 2)
width: aboutPopUpPreferredWidth
height: aboutPopUpDialog.contentHeight
}
WelcomePageQrDialog {
id: qrDialog
x: Math.round((mainViewWindow.width - width) / 2)
y: Math.round((mainViewWindow.height - height) / 2)
width: qrDialog.contentHeight
height: qrDialog.contentHeight
}
RecordBox{
@ -672,11 +661,6 @@ Window {
UserProfile {
id: userProfile
x: Math.round((mainViewWindow.width - width) / 2)
y: Math.round((mainViewWindow.height - height) / 2)
width: Math.max(mainViewWindow.width / 2, aboutPopUpPreferredWidth)
height: userProfile.contentHeight
}
onClosing: {
@ -771,8 +755,5 @@ Window {
KeyBoardShortcutTable {
id: shortcutsTable
x: Math.round((mainViewWindow.width - width) / 2)
y: Math.round((mainViewWindow.height - height) / 2)
}
}

View file

@ -17,23 +17,17 @@
*/
import QtQuick 2.14
import QtQuick.Controls 2.14
import QtQuick.Controls 2.15
import QtQuick.Layouts 1.14
import net.jami.Models 1.0
import net.jami.Adapters 1.0
import "../../commoncomponents"
import "../../constant"
import "../../commoncomponents"
Dialog {
id: aboutPopUp
// When dialog is opened, trigger mainViewWindow overlay which is defined in overlay.model (model : true is necessary).
modal: true
// Content height + margin.
contentHeight: aboutPopUpContentRectColumnLayout.height + 5 * 7
BaseDialog {
id: root
title: qsTr("About")
ProjectCreditsScrollView {
id: projectCreditsScrollView
@ -47,18 +41,22 @@ Dialog {
visible: false
}
Rectangle {
contentItem: Rectangle {
id: aboutPopUpContentRect
anchors.fill: parent
implicitWidth: 400
implicitHeight: 600
ColumnLayout {
id: aboutPopUpContentRectColumnLayout
anchors.centerIn: parent
anchors.fill: parent
Image {
id: aboutPopUPJamiLogoImage
Layout.alignment: Qt.AlignCenter
Layout.topMargin: JamiTheme.preferredMarginSize
Layout.preferredWidth: aboutPopUpContentRect.width
Layout.preferredHeight: 100
@ -74,7 +72,7 @@ Dialog {
Layout.preferredWidth: aboutPopUpContentRect.width
Layout.preferredHeight: textMetricsjamiVersionText.boundingRect.height
font.pointSize: JamiTheme.textFontSize - 2
font.pointSize: JamiTheme.textFontSize
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
@ -97,7 +95,7 @@ Dialog {
Layout.topMargin: 5
wrapMode: Text.WordWrap
font.pointSize: JamiTheme.textFontSize - 2
font.pointSize: JamiTheme.textFontSize
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
@ -120,7 +118,7 @@ Dialog {
Layout.topMargin: 5
wrapMode: Text.WordWrap
font.pointSize: JamiTheme.textFontSize - 2
font.pointSize: JamiTheme.textFontSize
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
@ -135,15 +133,13 @@ Dialog {
Layout.alignment: Qt.AlignCenter
// Strangely, hoveredLink works badly when width grows too large
Layout.preferredWidth: 50
Layout.preferredHeight: textMetricsjamiDeclarationHyperText.boundingRect.height
Layout.topMargin: 5
Layout.bottomMargin: 5
font.pointSize: JamiTheme.textFontSize - 2
font.pointSize: JamiTheme.textFontSize
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
@ -159,7 +155,6 @@ Dialog {
MouseArea {
anchors.fill: parent
// We don't want to eat clicks on the Text.
acceptedButtons: Qt.NoButton
cursorShape: parent.hoveredLink ? Qt.PointingHandCursor : Qt.ArrowCursor
@ -174,7 +169,7 @@ Dialog {
Layout.preferredHeight: textMetricsjamiDeclarationYearText.boundingRect.height
Layout.bottomMargin: 5
font.pointSize: JamiTheme.textFontSize - 2
font.pointSize: JamiTheme.textFontSize
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
@ -192,13 +187,12 @@ Dialog {
id: jamiNoneWarrantyHyperText
Layout.alignment: Qt.AlignCenter
Layout.preferredWidth: Math.min(300,
aboutPopUpContentRect.width)
Layout.preferredWidth: Math.min(300, aboutPopUpContentRect.width)
Layout.preferredHeight: textMetricsjamiNoneWarrantyHyperText.boundingRect.height * 2
Layout.bottomMargin: 10
wrapMode: Text.WordWrap
font.pointSize: JamiTheme.textFontSize - 3
font.pointSize: JamiTheme.tinyFontSize
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
@ -224,8 +218,7 @@ Dialog {
Layout.alignment: Qt.AlignCenter
Layout.preferredWidth: aboutPopUpContentRect.width
Layout.preferredHeight: JamiTheme.preferredFieldHeight
Layout.bottomMargin: 10
Layout.preferredHeight: 32
RowLayout {
id: buttonGroupChangeLogAndCreditsRowLayout
@ -234,12 +227,15 @@ Dialog {
MaterialButton {
id: changeLogButton
Layout.preferredHeight: JamiTheme.preferredFieldHeight
text: JamiStrings.changelog
color: projectCreditsScrollView.visible? JamiTheme.buttonTintedGreyInactive : JamiTheme.buttonTintedGrey
color: projectCreditsScrollView.visible? JamiTheme.buttonTintedGreyInactive :
JamiTheme.buttonTintedGrey
hoveredColor: JamiTheme.buttonTintedGreyHovered
pressedColor: JamiTheme.buttonTintedGreyPressed
Layout.preferredWidth: 100
Layout.alignment: Qt.AlignHCenter
Layout.preferredWidth: JamiTheme.preferredFieldWidth / 2
Layout.preferredHeight: JamiTheme.preferredFieldHeight
onClicked: {
if (changeLogOrCreditsStack.depth > 1) {
@ -250,12 +246,14 @@ Dialog {
MaterialButton {
id: creditsButton
Layout.preferredHeight: JamiTheme.preferredFieldHeight
text: JamiStrings.credits
color: projectCreditsScrollView.visible? JamiTheme.buttonTintedGrey : JamiTheme.buttonTintedGreyInactive
color: projectCreditsScrollView.visible? JamiTheme.buttonTintedGrey :
JamiTheme.buttonTintedGreyInactive
hoveredColor: JamiTheme.buttonTintedGreyHovered
pressedColor: JamiTheme.buttonTintedGreyPressed
Layout.preferredWidth: 100
Layout.alignment: Qt.AlignHCenter
Layout.preferredWidth: JamiTheme.preferredFieldWidth / 2
Layout.preferredHeight: JamiTheme.preferredFieldHeight
onClicked: {
if (changeLogOrCreditsStack.depth == 1) {
@ -271,19 +269,33 @@ Dialog {
id: changeLogOrCreditsStack
Layout.alignment: Qt.AlignCenter
Layout.preferredWidth: aboutPopUpContentRect.width
Layout.preferredHeight: 150
Layout.bottomMargin: 5
Layout.preferredWidth: aboutPopUpContentRect.width - JamiTheme.preferredMarginSize*2
Layout.preferredHeight: aboutPopUpContentRect.height - 460
Layout.margins: JamiTheme.preferredMarginSize
initialItem: changeLogScrollView
clip: true
}
MaterialButton {
id: btnClose
Layout.alignment: Qt.AlignHCenter
Layout.preferredWidth: JamiTheme.preferredFieldWidth / 2
Layout.preferredHeight: JamiTheme.preferredFieldHeight
Layout.bottomMargin: JamiTheme.preferredMarginSize
text: qsTr("Close")
color: enabled? JamiTheme.buttonTintedBlack : JamiTheme.buttonTintedGrey
hoveredColor: JamiTheme.buttonTintedBlackHovered
pressedColor: JamiTheme.buttonTintedBlackPressed
outlined: true
onClicked: {
close()
}
}
}
}
background: Rectangle {
border.width: 0
radius: 10
}
}

View file

@ -1,7 +1,7 @@
/*
* Copyright (C) 2020 by Savoir-faire Linux
* Author: Mingrui Zhang <mingrui.zhang@savoirfairelinux.com>
* Author: Albert Babí <albert.babi@savoirfairelinux.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -16,15 +16,16 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
import QtQuick 2.14
import QtQuick.Controls 2.14
import QtQuick.Layouts 1.14
import net.jami.Models 1.0
import "../../constant"
import "../../commoncomponents"
Dialog {
id: userProfileDialog
BaseDialog {
id: root
property string responsibleConvUid: ""
property string contactPicBase64: ""
@ -33,152 +34,161 @@ Dialog {
property string idText: ""
property int preferredImgSize: 80
modal: true
// Content height + margin.
contentHeight: userProfileDialogLayout.implicitHeight + 60
contentWidth: userProfileDialogLayout.implicitWidth + 60
contentItem: Rectangle {
id: userProfileContentRect
// Fake focus to make sure that text edit lose focus on close.
FocusScope {
id: fakeFocusTextEdit
}
implicitWidth: 480
implicitHeight: 400
contentItem: GridLayout {
GridLayout {
id: userProfileDialogLayout
id: userProfileDialogLayout
columns: 2
rowSpacing: 10
columnSpacing: 10
anchors.centerIn: parent
anchors.fill: parent
anchors.margins: JamiTheme.preferredMarginSize
Image {
id: contactImage
columns: 2
rows: 6
rowSpacing: 16
columnSpacing: 24
Layout.alignment: Qt.AlignRight
Layout.preferredWidth: 130
Image {
id: contactImage
sourceSize.width: preferredImgSize
sourceSize.height: preferredImgSize
Layout.alignment: Qt.AlignRight
Layout.preferredWidth: 130
fillMode: Image.PreserveAspectFit
mipmap: true
}
sourceSize.width: preferredImgSize
sourceSize.height: preferredImgSize
// Visible when user alias is not empty or equals to id.
Text {
id: contactAlias
fillMode: Image.PreserveAspectFit
mipmap: true
}
Layout.alignment: Qt.AlignLeft
// Visible when user alias is not empty or equals to id.
Text {
id: contactAlias
font.pointSize: JamiTheme.titleFontSize
text: textMetricsContactAliasText.elidedText
visible: aliasText ? (aliasText === idText ? false : true) : false
Layout.alignment: Qt.AlignLeft
TextMetrics {
id: textMetricsContactAliasText
font: contactAlias.font
text: aliasText
elideWidth: userProfileDialog.width-160
elide: Qt.ElideMiddle
font.pointSize: JamiTheme.titleFontSize
text: textMetricsContactAliasText.elidedText
visible: aliasText ? (aliasText === idText ? false : true) : false
TextMetrics {
id: textMetricsContactAliasText
font: contactAlias.font
text: aliasText
elideWidth: userProfileContentRect.width-200
elide: Qt.ElideMiddle
}
}
Item {
Layout.columnSpan: 2
height: 8
}
Text {
Layout.alignment: Qt.AlignRight
font.pointSize: JamiTheme.menuFontSize
text: qsTr("Information")
}
Item { Layout.fillWidth: true }
Text {
Layout.alignment: Qt.AlignRight
font.pointSize: JamiTheme.textFontSize
text: JamiStrings.username
visible: registeredNameText ? (registeredNameText === idText ? false : true) : false
color: JamiTheme.faddedFontColor
}
// Visible when user name is not empty or equals to alias.
Text {
id: contactDisplayName
Layout.alignment: Qt.AlignLeft
font.pointSize: JamiTheme.textFontSize
text: textMetricsContactDisplayNameText.elidedText
visible: registeredNameText ? (registeredNameText === idText ? false : true) : false
TextMetrics {
id: textMetricsContactDisplayNameText
font: contactDisplayName.font
text: registeredNameText
elideWidth: userProfileContentRect.width-200
elide: Qt.ElideMiddle
}
}
Text {
Layout.alignment: Qt.AlignRight
font.pointSize: JamiTheme.textFontSize
text: JamiStrings.identifier
color: JamiTheme.faddedFontColor
}
TextEdit {
id: contactId
Layout.alignment: Qt.AlignLeft
selectByMouse: true
readOnly: true
font.pointSize: JamiTheme.textFontSize
text: textMetricsContactIdText.elidedText
TextMetrics {
id: textMetricsContactIdText
font: contactId.font
text: idText
elideWidth: userProfileContentRect.width-200
elide: Qt.ElideMiddle
}
}
Text {
Layout.alignment: Qt.AlignRight
font.pointSize: JamiTheme.textFontSize
text: JamiStrings.qrCode
color: JamiTheme.faddedFontColor
}
Image {
id: contactQrImage
Layout.alignment: Qt.AlignLeft
fillMode: Image.PreserveAspectFit
sourceSize.width: preferredImgSize
sourceSize.height: preferredImgSize
mipmap: true
}
MaterialButton {
id: btnClose
Layout.columnSpan: 2
Layout.alignment: Qt.AlignHCenter
Layout.preferredWidth: JamiTheme.preferredFieldWidth / 2
Layout.preferredHeight: JamiTheme.preferredFieldHeight
color: JamiTheme.buttonTintedBlack
hoveredColor: JamiTheme.buttonTintedBlackHovered
pressedColor: JamiTheme.buttonTintedBlackPressed
outlined: true
text: JamiStrings.close
onClicked: {
close()
}
}
}
Item {
Layout.columnSpan: 2
height: 20
}
Text {
Layout.alignment: Qt.AlignRight
font.pointSize: JamiTheme.menuFontSize
text: qsTr("Informations")
}
Item { Layout.fillWidth: true }
Text {
Layout.alignment: Qt.AlignRight
font.pointSize: JamiTheme.textFontSize
text: qsTr("Username")
visible: registeredNameText ? (registeredNameText === idText ? false : true) : false
color: JamiTheme.faddedFontColor
}
// Visible when user name is not empty or equals to alias.
Text {
id: contactDisplayName
Layout.alignment: Qt.AlignLeft
font.pointSize: JamiTheme.textFontSize
text: textMetricsContactDisplayNameText.elidedText
visible: registeredNameText ? (registeredNameText === idText ? false : true) : false
TextMetrics {
id: textMetricsContactDisplayNameText
font: contactDisplayName.font
text: registeredNameText
elideWidth: userProfileDialog.width-160
elide: Qt.ElideMiddle
}
}
Text {
Layout.alignment: Qt.AlignRight
font.pointSize: JamiTheme.textFontSize
text: JamiStrings.identifier
color: JamiTheme.faddedFontColor
}
TextEdit {
id: contactId
Layout.alignment: Qt.AlignLeft
selectByMouse: true
readOnly: true
font.pointSize: JamiTheme.textFontSize
text: textMetricsContactIdText.elidedText
TextMetrics {
id: textMetricsContactIdText
font: contactId.font
text: idText
elideWidth: userProfileDialog.width-160
elide: Qt.ElideMiddle
}
}
Text {
Layout.alignment: Qt.AlignRight
font.pointSize: JamiTheme.textFontSize
text: JamiStrings.qrCode
color: JamiTheme.faddedFontColor
}
Image {
id: contactQrImage
Layout.alignment: Qt.AlignBottom | Qt.AlignLeft
fillMode: Image.PreserveAspectFit
sourceSize.width: preferredImgSize
sourceSize.height: preferredImgSize
mipmap: true
}
Item { height: 20 }
}
background: Rectangle {
border.width: 0
radius: 10
}
onClosed: {
contactId.deselect()
fakeFocusTextEdit.focus = true
}
onResponsibleConvUidChanged: {

View file

@ -1,3 +1,4 @@
/*
* Copyright (C) 2020 by Savoir-faire Linux
* Author: Mingrui Zhang <mingrui.zhang@savoirfairelinux.com>
@ -26,10 +27,8 @@ import "../../commoncomponents"
Rectangle {
id: welcomeRect
anchors.fill: parent
property int buttonPreferredSize: 30
anchors.fill: parent
Rectangle {
id: welcomeRectComponentsGroup
@ -48,7 +47,7 @@ Rectangle {
Layout.alignment: Qt.AlignCenter
Layout.preferredWidth: welcomeRectComponentsGroup.width
Layout.preferredHeight: 100
Layout.topMargin: 50
Layout.topMargin: 32
Layout.bottomMargin: 10
fillMode: Image.PreserveAspectFit
@ -61,7 +60,7 @@ Rectangle {
Layout.alignment: Qt.AlignCenter
Layout.preferredWidth: welcomeRectComponentsGroup.width
Layout.preferredHeight: 100
Layout.preferredHeight: 80
Layout.bottomMargin: 5
wrapMode: Text.WordWrap
@ -122,6 +121,7 @@ Rectangle {
elide: Qt.ElideMiddle
}
}
HoverableButton {
id: copyRegisterednameButton
Layout.alignment: Qt.AlignCenter
@ -139,14 +139,17 @@ Rectangle {
}
}
Button {
id: btnAbout
anchors.bottom: parent.bottom
anchors.bottomMargin: 10
anchors.horizontalCenter: parent.horizontalCenter
background: Rectangle {
color: "transparent"
}
anchors.bottomMargin: 12
contentItem: Text {
text: qsTr("About Jami")
color: "grey"

View file

@ -17,41 +17,65 @@
*/
import QtQuick 2.14
import QtQuick.Controls 2.14
import QtQuick.Controls 2.15
import QtQuick.Layouts 1.14
import net.jami.Models 1.0
import net.jami.Adapters 1.0
Dialog {
id: userQrImageDialog
import "../../constant"
import "../../commoncomponents"
// When dialog is opened, trigger mainViewWindow overlay which is defined in overlay.model.
// (model : true is necessary)
modal: true
BaseDialog {
id: root
//Content height + margin.
contentHeight: userQrImage.height + 30
title: JamiStrings.accountQr
Image {
id: userQrImage
contentItem: Rectangle {
id: content
anchors.centerIn: parent
implicitWidth: userQrImage.width + JamiTheme.preferredMarginSize * 2
implicitHeight: 352 // Qr + btn + margins
width: 256
height: 256
smooth: false
ColumnLayout {
fillMode: Image.PreserveAspectFit
source: {
if (AccountAdapter.currentAccountId &&
AccountAdapter.currentAccountType === Profile.Type.RING)
return "image://qrImage/account_" + AccountAdapter.currentAccountId
return ""
anchors.centerIn: parent
anchors.fill: parent
Image {
id: userQrImage
Layout.alignment: Qt.AlignCenter
Layout.preferredWidth: 256
Layout.preferredHeight: 256
smooth: false
fillMode: Image.PreserveAspectFit
source: {
if (AccountAdapter.currentAccountId)
return "image://qrImage/account_" + AccountAdapter.currentAccountId
return ""
}
}
MaterialButton {
id: btnClose
Layout.alignment: Qt.AlignHCenter
Layout.preferredWidth: JamiTheme.preferredFieldWidth / 2
Layout.preferredHeight: JamiTheme.preferredFieldHeight
Layout.bottomMargin: JamiTheme.preferredMarginSize
text: JamiStrings.close
color: enabled? JamiTheme.buttonTintedBlack : JamiTheme.buttonTintedGrey
hoveredColor: JamiTheme.buttonTintedBlackHovered
pressedColor: JamiTheme.buttonTintedBlackPressed
outlined: true
onClicked: {
close()
}
}
}
}
background: Rectangle {
border.width: 0
radius: 10
}
}

View file

@ -55,6 +55,7 @@ Rectangle {
linkedDevices.updateAndShowDevicesSlot()
bannedContacts.setVisibility()
advancedSettings.updateAdvancedAccountInfos()
setPasswordButtonText()
}
function passwordClicked() {
@ -85,11 +86,29 @@ Rectangle {
bannedContacts.connectCurrentAccount(false)
}
function setPasswordButtonText() {
var hasPassword = AccountAdapter.hasPassword()
passwdPushButton.toolTipText = hasPassword ?
JamiStrings.changeCurrentPassword :
JamiStrings.setAPassword
passwdPushButton.text = hasPassword ?
JamiStrings.changePassword :
JamiStrings.setPassword
}
MessageBox {
id: msgDialog
onAccepted: {
setPasswordButtonText()
}
}
DeleteAccountDialog {
id: deleteAccountDialog
anchors.centerIn: parent.Center
onAccepted: {
AccountAdapter.setSelectedConvId()
@ -104,10 +123,7 @@ Rectangle {
PasswordDialog {
id: passwordDialog
anchors.centerIn: parent.Center
onDoneSignal: {
var success = (code === successCode)
var title = success ? qsTr("Success") : qsTr("Error")
var iconMode = success ? StandardIcon.Information : StandardIcon.Critical
@ -125,7 +141,7 @@ Rectangle {
break
}
MessageBox.openWithParameters(title,info, iconMode, StandardButton.Ok)
msgDialog.openWithParameters(title,info, iconMode, StandardButton.Ok)
}
}
@ -152,7 +168,7 @@ Rectangle {
var title = isSuccessful ? qsTr("Success") : qsTr("Error")
var iconMode = isSuccessful ? StandardIcon.Information : StandardIcon.Critical
var info = isSuccessful ? JamiStrings.backupSuccessful : JamiStrings.backupFailed
MessageBox.openWithParameters(title,info, iconMode, StandardButton.Ok)
msgDialog.openWithParameters(title,info, iconMode, StandardButton.Ok)
}
}
}

View file

@ -15,56 +15,28 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import QtQuick 2.9
import QtQuick.Controls 2.2
import QtQuick.Controls 1.4
import QtQuick.Controls.Styles 1.4
import QtQuick.Layouts 1.3
import net.jami.Models 1.0
import "../../constant"
import "../../commoncomponents"
Dialog {
BaseDialog {
id: root
modal: true
width: rectangle.width + 24
height: rectangle.height + 24
visible: false
title: qsTr("Shortcuts")
Rectangle {
id: rectangle
contentItem: Rectangle {
id: shortcutsTableContentRect
property int minWidth: 1200
property int minHeight: 500
implicitWidth: minWidth
implicitHeight: minHeight
color: "white"
radius: 30
Rectangle {
width: 500
height: t_metrics_title.tightBoundingRect.height + 15
color: "#e0e0e0"
radius: 8
anchors.top: parent.top
anchors.topMargin: 10
anchors.horizontalCenter: parent.horizontalCenter
Text {
id : titleText
anchors.centerIn: parent
anchors.leftMargin: 10
font.family: "Arial"
font.pointSize: 12
font.bold: true
text: "Shortcuts"
color: "black"
}
TextMetrics {
id: t_metrics_title
font: titleText.font
text: titleText.text
}
}
implicitWidth: 800
implicitHeight: 600
ListModel {
id: keyboardGeneralShortcutsModel
@ -80,27 +52,27 @@ Dialog {
}
ListElement {
Shortcut: "Ctrl+R"
Description: "Requests list"
Description: qsTr("Requests list")
KeyLength: 2
}
ListElement {
Shortcut: "Ctrl+↑"
Description: "Previous conversation"
Description: qsTr("Previous conversation")
KeyLength: 2
}
ListElement {
Shortcut: "Ctrl+↓"
Description: "Next conversation"
Description: qsTr("Next conversation")
KeyLength: 2
}
ListElement {
Shortcut: "Ctrl+F"
Description: "Search bar"
Description: qsTr("Search bar")
KeyLength: 2
}
ListElement {
Shortcut: "F11"
Description: "Fullscreen"
Description: qsTr("Fullscreen")
KeyLength: 1
}
}
@ -108,12 +80,12 @@ Dialog {
id: keyboardConversationShortcutsModel
ListElement {
Shortcut: "Shift+Ctrl+C"
Description: "Start an audio call"
Description: qsTr("Start an audio call")
KeyLength: 3
}
ListElement {
Shortcut: "Shift+Ctrl+X"
Description: "Start a video call"
Description: qsTr("Start a video call")
KeyLength: 3
}
ListElement {
@ -136,27 +108,27 @@ Dialog {
id: keyboardSettingsShortcutsModel
ListElement {
Shortcut: "Ctrl+M"
Description: "Media settings"
Description: qsTr("Media settings")
KeyLength: 2
}
ListElement {
Shortcut: "Ctrl+G"
Description: "General Settings"
Description: qsTr("General settings")
KeyLength: 2
}
ListElement {
Shortcut: "Ctrl+I"
Description: "Account Settings"
Description: qsTr("Account settings")
KeyLength: 2
}
ListElement {
Shortcut: "Ctrl+Shift+N"
Description: "Open account creation wizard"
Description: qsTr("Open account creation wizard")
KeyLength: 3
}
ListElement {
Shortcut: "F10"
Description: "Open window"
Description: qsTr("Open window")
KeyLength: 1
}
}
@ -184,17 +156,19 @@ Dialog {
Rectangle {
id: cellRectWithThreeKeys
implicitWidth: minWidth /2
implicitWidth: minWidth / 2
implicitHeight: 50
anchors.left: parent.left
anchors.leftMargin: 50
anchors.leftMargin: 20
color: "white"
border.color: "white"
Rectangle {
id: containerRectWithThreeKeys
implicitWidth: parent.width - 10
implicitHeight: 50
anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
@ -257,7 +231,7 @@ Dialog {
id: descriptionDelegate
Rectangle {
implicitWidth: minWidth /2
implicitWidth: root.width / 2
implicitHeight: 50
color: "white"
@ -268,7 +242,7 @@ Dialog {
anchors.left: parent.left
anchors.leftMargin: 10
font.family: "Arial"
font.pointSize: 10
font.pointSize: JamiTheme.textFontSize
text: styleData.value
}
}
@ -313,6 +287,7 @@ Dialog {
Loader {
property variant modelData: model
sourceComponent: shortcutDelegateWithThreeKeys
asynchronous: true
}
}
}
@ -333,7 +308,7 @@ Dialog {
height: [t_metrics_general.tightBoundingRect.height + 10, 0][styleData.column % 2]
width: [parent.width, 0][styleData.column % 2]
color: "white"
radius: 10
radius: 4
anchors.top: parent.top
anchors.topMargin: 5
Text {
@ -342,7 +317,7 @@ Dialog {
anchors.left: parent.left
anchors.leftMargin: 10
font.family: "Arial"
font.pointSize: 12
font.pointSize: JamiTheme.headerFontSize
text: styleData.column % 2 ? "" : "General"
color: "black"
}
@ -376,6 +351,7 @@ Dialog {
Loader {
property variant modelData: model
sourceComponent: shortcutDelegateWithThreeKeys
asynchronous: true
}
}
}
@ -396,7 +372,7 @@ Dialog {
height: [t_metrics_conversations.tightBoundingRect.height + 10, 0][styleData.column % 2]
width: [parent.width, 0][styleData.column % 2]
color: "white"
radius: 10
radius: 4
anchors.top: parent.top
anchors.topMargin: 5
Text {
@ -405,7 +381,7 @@ Dialog {
anchors.left: parent.left
anchors.leftMargin: 10
font.family: "Arial"
font.pointSize: 12
font.pointSize: JamiTheme.headerFontSize
text: styleData.column % 2 ? "" : JamiStrings.conversations
color: "black"
}
@ -441,6 +417,7 @@ Dialog {
Loader {
property variant modelData: model
sourceComponent: shortcutDelegateWithThreeKeys
asynchronous: true
}
}
}
@ -461,7 +438,7 @@ Dialog {
height: [t_metrics_calls.tightBoundingRect.height + 10, 0][styleData.column % 2]
width: [parent.width, 0][styleData.column % 2]
color: "white"
radius: 10
radius: 4
anchors.top: parent.top
anchors.topMargin: 5
Text {
@ -504,6 +481,7 @@ Dialog {
Loader {
property variant modelData: model
sourceComponent: shortcutDelegateWithThreeKeys
asynchronous: true
}
}
}
@ -524,7 +502,7 @@ Dialog {
height: [t_metrics_settings.tightBoundingRect.height + 10, 0][styleData.column % 2]
width: [parent.width, 0][styleData.column % 2]
color: "white"
radius: 10
radius: 4
anchors.top: parent.top
anchors.topMargin: 5
Text {
@ -549,19 +527,21 @@ Dialog {
}
}
}
TabBar {
id: tabBar
anchors.horizontalCenter: parent.horizontalCenter
anchors.bottom: parent.bottom
anchors.bottomMargin: 15
width: 240
anchors.bottomMargin: parent.height - 500 // Forced postion below table
width: JamiTheme.preferredFieldWidth * 2
height: JamiTheme.preferredFieldHeight
currentIndex: 0
TabButton {
id: pageOne
width: tabBar.width / 2
height: 30
width: JamiTheme.preferredFieldWidth
text: "1"
down: true
// customize tab button
@ -576,8 +556,9 @@ Dialog {
// customize tab button
background: Rectangle {
id: buttonRectOne
radius: 10
implicitWidth: JamiTheme.preferredFieldWidth
implicitHeight: JamiTheme.preferredFieldHeight
radius: 4
color: pageOne.down ? "#e0e0e0" :"#fdfdfd"
MouseArea {
anchors.fill: parent
@ -591,11 +572,8 @@ Dialog {
}
TabButton {
id: pageTwo
width: tabBar.width / 2
height: 30
text: "2"
width: JamiTheme.preferredFieldWidth
contentItem: Text {
text: pageTwo.text
font: pageTwo.font
@ -607,8 +585,10 @@ Dialog {
background: Rectangle {
id: buttonRectTwo
implicitWidth: JamiTheme.preferredFieldWidth
implicitHeight: JamiTheme.preferredFieldHeight
radius: 10
radius: 4
color: pageTwo.down ? "#e0e0e0" :"#fdfdfd"
MouseArea {
anchors.fill: parent
@ -621,5 +601,27 @@ Dialog {
}
}
}
MaterialButton {
id: btnClose
anchors.bottom: parent.bottom
anchors.bottomMargin: JamiTheme.preferredMarginSize
anchors.horizontalCenter: parent.horizontalCenter
width: JamiTheme.preferredFieldWidth / 2
height: JamiTheme.preferredFieldHeight
color: JamiTheme.buttonTintedBlack
hoveredColor: JamiTheme.buttonTintedBlackHovered
pressedColor: JamiTheme.buttonTintedBlackPressed
outlined: true
text: JamiStrings.close
onClicked: {
close()
}
}
}
}

View file

@ -1,6 +1,7 @@
/*
* Copyright (C) 2020 by Savoir-faire Linux
* Author: Yang Wang <yang.wang@savoirfairelinux.com>
* Author: Albert Babí <albert.babi@savoirfairelinux.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -23,20 +24,21 @@ import QtQuick.Controls.Styles 1.4
import net.jami.Models 1.0
import net.jami.Adapters 1.0
import "../../constant"
import "../../commoncomponents"
Dialog {
BaseDialog {
id: root
function openLinkDeviceDialog() {
infoLabel.text = JamiStrings.pinTimerInfos
passwordEdit.clear()
root.open()
if(AccountAdapter.hasPassword()) {
stackedWidget.currentIndex = 0
} else {
setGeneratingPage()
}
open()
}
function setGeneratingPage() {
@ -67,7 +69,7 @@ Dialog {
}
}
Timer{
Timer {
id: timeOut
repeat: false
@ -78,17 +80,17 @@ Dialog {
}
}
function setExportPage(status, pin){
function setExportPage(status, pin) {
timeOut.stop()
if(status === NameDirectory.ExportOnRingStatus.SUCCESS) {
infoLabel.isSucessState = true
if (status === NameDirectory.ExportOnRingStatus.SUCCESS) {
infoLabel.success = true
yourPinLabel.visible = true
exportedPIN.visible = true
infoLabel.text = JamiStrings.pinTimerInfos
exportedPIN.text = pin
} else {
infoLabel.isSucessState = false
infoLabel.success = false
yourPinLabel.visible = false
exportedPIN.visible = false
@ -110,8 +112,12 @@ Dialog {
stackedWidget.currentIndex = 2
}
signal accepted
property int exportTimeout : 20000
title: JamiStrings.addDevice
Connections {
target: NameDirectory
@ -120,63 +126,31 @@ Dialog {
}
}
visible: false
x: (parent.width - width) / 2
y: (parent.height - height) / 2
header : Rectangle {
width: parent.width
height: 64
color: "transparent"
Text {
anchors.fill: parent
anchors.leftMargin: JamiTheme.preferredMarginSize
anchors.topMargin: JamiTheme.preferredMarginSize
text: JamiStrings.linkAnotherDevice
font.pointSize: JamiTheme.headerFontSize
wrapMode: Text.Wrap
}
}
onClosed: {
if(infoLabel.isSucessState) {
accept()
} else {
reject()
}
}
contentItem: Rectangle {
implicitWidth: 350
implicitHeight: 210
id: linkDeviceContentRect
implicitWidth: JamiTheme.preferredDialogWidth
implicitHeight: JamiTheme.preferredDialogHeight
StackLayout {
id: stackedWidget
anchors.centerIn: parent
anchors.fill: parent
currentIndex: 2
anchors.margins: JamiTheme.preferredMarginSize
// Index = 0
Rectangle {
id: passwordConfirmPage
Layout.fillWidth: true
Layout.fillHeight: true
Layout.alignment: Qt.AlignCenter
Layout.leftMargin: JamiTheme.preferredMarginSize
Layout.rightMargin: JamiTheme.preferredMarginSize
Layout.bottomMargin: JamiTheme.preferredMarginSize
ColumnLayout {
anchors.fill: parent
anchors.centerIn: parent
spacing: 16
Label {
Layout.topMargin: JamiTheme.preferredMarginSize
Layout.fillWidth: true
Layout.alignment: Qt.AlignHCenter
wrapMode: Text.Wrap
text: qsTr("Enter your account password")
text: JamiStrings.enterAccountPassword
font.pointSize: JamiTheme.textFontSize
font.kerning: true
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
@ -185,84 +159,85 @@ Dialog {
MaterialLineEdit {
id: passwordEdit
Layout.alignment: Qt.AlignCenter
Layout.preferredWidth: JamiTheme.preferredFieldWidth
Layout.preferredHeight: 48
Layout.fillWidth: true
Layout.alignment: Qt.AlignHCenter
Layout.maximumWidth: 300
echoMode: TextInput.Password
horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignVCenter
placeholderText: qsTr("Password")
placeholderText: JamiStrings.enterCurrentPassword
borderColorMode: InfoLineEdit.NORMAL
onTextChanged: {
btnConfirm.enabled = text.length > 0
}
}
RowLayout {
Layout.topMargin: JamiTheme.preferredMarginSize
Layout.preferredHeight: 30
Layout.alignment: Qt.AlignCenter
Layout.fillWidth: true
Layout.alignment: Qt.AlignHCenter
spacing: 16
HoverableRadiusButton {
id: btnPasswordOk
MaterialButton {
id: btnConfirm
Layout.preferredWidth: 130
Layout.alignment: Qt.AlignHCenter
Layout.preferredWidth: JamiTheme.preferredFieldWidth / 2 - 8
Layout.preferredHeight: JamiTheme.preferredFieldHeight
radius: height / 2
color: enabled? JamiTheme.buttonTintedBlack : JamiTheme.buttonTintedGrey
hoveredColor: JamiTheme.buttonTintedBlackHovered
pressedColor: JamiTheme.buttonTintedBlackPressed
outlined: true
enabled: false
text: qsTr("Register")
font.pointSize: 10
font.kerning: true
onClicked: {
setGeneratingPage()
}
}
HoverableButtonTextItem {
MaterialButton {
id: btnCancel
Layout.leftMargin: 20
Layout.preferredWidth: 130
Layout.alignment: Qt.AlignHCenter
Layout.preferredWidth: JamiTheme.preferredFieldWidth / 2 - 8
Layout.preferredHeight: JamiTheme.preferredFieldHeight
backgroundColor: "red"
onEnterColor: Qt.rgba(150 / 256, 0, 0, 0.7)
onDisabledBackgroundColor: Qt.rgba(
255 / 256,
0, 0, 0.8)
onPressColor: backgroundColor
textColor: "white"
radius: height / 2
color: JamiTheme.buttonTintedBlack
hoveredColor: JamiTheme.buttonTintedBlackHovered
pressedColor: JamiTheme.buttonTintedBlackPressed
outlined: true
enabled: true
text: qsTr("Cancel")
font.pointSize: 10
font.kerning: true
onClicked: {
reject()
close()
}
}
}
}
}
// Index = 1
Rectangle {
id: exportingPage
Layout.fillWidth: true
Layout.fillHeight: true
ColumnLayout {
anchors.fill: parent
anchors.centerIn: parent
spacing: 16
Label {
Layout.alignment: Qt.AlignLeft
Layout.leftMargin: JamiTheme.preferredMarginSize
wrapMode: Text.Wrap
text: qsTr("Exporting Account")
Layout.alignment: Qt.AlignCenter
text: JamiStrings.backupAccount
font.pointSize: JamiTheme.headerFontSize
font.kerning: true
horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignVCenter
}
@ -270,18 +245,16 @@ Dialog {
Label {
id: exportingSpinner
Layout.alignment: Qt.AlignHCenter
Layout.preferredWidth: parent.width - JamiTheme.preferredMarginSize * 2
Layout.alignment: Qt.AlignCenter
Layout.preferredWidth: 96
Layout.preferredHeight: 96
background: Rectangle {
anchors.fill: parent
AnimatedImage {
id: spinnerMovie
anchors.fill: parent
source: "qrc:/images/jami_eclipse_spinner.gif"
playing: exportingSpinner.visible
paused: false
fillMode: Image.PreserveAspectFit
@ -292,28 +265,27 @@ Dialog {
}
}
// Index = 2
Rectangle {
id: exportedPage
Layout.fillWidth: true
Layout.fillHeight: true
ColumnLayout {
anchors.fill: parent
anchors.centerIn: parent
spacing: 16
RowLayout {
Layout.alignment: Qt.AlignLeft
Layout.preferredWidth: parent.width - JamiTheme.preferredMarginSize * 2
Layout.leftMargin: JamiTheme.preferredMarginSize
Layout.alignment: Qt.AlignCenter
Layout.fillWidth: true
Layout.margins: JamiTheme.preferredMarginSize
spacing: 16
Label {
id: yourPinLabel
Layout.alignment: Qt.AlignLeft
wrapMode: Text.Wrap
text: "Your PIN is:"
Layout.alignment: Qt.AlignHCenter
text: qsTr("Your PIN is:")
font.pointSize: JamiTheme.headerFontSize
font.kerning: true
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
@ -321,12 +293,9 @@ Dialog {
Label {
id: exportedPIN
Layout.leftMargin: JamiTheme.preferredMarginSize / 2
wrapMode: Text.Wrap
text: "PIN"
font.pointSize: JamiTheme.menuFontSize
Layout.alignment: Qt.AlignHCenter
text: qsTr("PIN")
font.pointSize: JamiTheme.headerFontSize
font.kerning: true
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
@ -336,29 +305,27 @@ Dialog {
Label {
id: infoLabel
property bool isSucessState: false
property int borderWidth : isSucessState? 1 : 0
property int borderRadius : isSucessState? 15 : 0
property string backgroundColor : isSucessState? "whitesmoke" : "transparent"
property string borderColor : isSucessState? "lightgray" : "transparent"
color: isSucessState ? "#2b5084" : "black"
padding: isSucessState ? 8 : 0
Layout.alignment: Qt.AlignLeft
Layout.leftMargin: JamiTheme.preferredMarginSize
Layout.preferredWidth: parent.width - JamiTheme.preferredMarginSize * 2
property bool success: false
property int borderWidth : success? 1 : 0
property int borderRadius : success? 15 : 0
property string backgroundColor : success? "whitesmoke" : "transparent"
property string borderColor : success? "lightgray" : "transparent"
color: success ? "#2b5084" : "black"
padding: success ? 8 : 0
wrapMode: Text.Wrap
text: JamiStrings.pinTimerInfos
font.pointSize: 8
text: qsTr("This pin and the account password should be entered in your device within 10 minutes.")
font.pointSize: JamiTheme.textFontSize
font.kerning: true
Layout.maximumWidth: linkDeviceContentRect.width - JamiTheme.preferredMarginSize * 2
Layout.alignment: Qt.AlignCenter
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
background: Rectangle{
id: infoLabelBackground
anchors.fill: parent
border.width: infoLabel.borderWidth
border.color: infoLabel.borderColor
@ -367,29 +334,26 @@ Dialog {
}
}
RowLayout {
Layout.alignment: Qt.AlignRight
Layout.fillWidth: true
MaterialButton {
id: btnCloseExportDialog
Button {
id: btnCloseExportDialog
Layout.alignment: Qt.AlignHCenter
Layout.preferredWidth: JamiTheme.preferredFieldWidth / 2 - 8
Layout.preferredHeight: JamiTheme.preferredFieldHeight
contentItem: Text {
text: JamiStrings.close
color: JamiTheme.buttonTintedBlue
}
background: Rectangle {
color: "transparent"
}
onClicked: {
if(infoLabel.isSucessState) {
accept()
} else {
reject()
}
color: enabled? JamiTheme.buttonTintedBlack : JamiTheme.buttonTintedGrey
hoveredColor: JamiTheme.buttonTintedBlackHovered
pressedColor: JamiTheme.buttonTintedBlackPressed
outlined: true
enabled: true
text: JamiStrings.close
onClicked: {
if (infoLabel.success) {
accepted()
}
close()
}
}
}
@ -397,3 +361,4 @@ Dialog {
}
}
}

View file

@ -79,16 +79,12 @@ ColumnLayout {
LinkDeviceDialog {
id: linkDeviceDialog
anchors.centerIn: parent.Center
onAccepted: updateAndShowDevicesSlot()
}
RevokeDevicePasswordDialog{
id: revokeDevicePasswordDialog
anchors.centerIn: parent.Center
onRevokeDeviceWithPassword: revokeDeviceWithIDAndPassword(idOfDevice, password)
}
@ -160,4 +156,4 @@ ColumnLayout {
onClicked: linkDeviceDialog.openLinkDeviceDialog()
}
}
}

View file

@ -1,6 +1,7 @@
/*
* Copyright (C) 2020 by Savoir-faire Linux
* Author: Yang Wang <yang.wang@savoirfairelinux.com>
* Author: Albert Babí <yang.wang@savoirfairelinux.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -23,14 +24,17 @@ import QtQuick.Controls.Styles 1.4
import net.jami.Models 1.0
import net.jami.Adapters 1.0
import "../../constant"
import "../../commoncomponents"
Dialog {
BaseDialog {
id: root
property string registerdName : ""
function openNameRegistrationDialog(registerNameIn){
signal accepted
function openNameRegistrationDialog(registerNameIn) {
registerdName = registerNameIn
lblRegistrationError.text = qsTr("Something went wrong")
passwordEdit.clear()
@ -39,27 +43,26 @@ Dialog {
} else {
startRegistration()
}
root.open()
open()
}
function startRegistration(){
function startRegistration() {
startSpinner()
timerForStartRegistration.restart()
}
function slotStartNameRegistration(){
function slotStartNameRegistration() {
var password = passwordEdit.text
AccountAdapter.model.registerName(UtilsAdapter.getCurrAccId(), password, registerdName)
}
function startSpinner(){
function startSpinner() {
stackedWidget.currentIndex = 1
spinnerLabel.visible = true
spinnerMovie.playing = true
}
Timer{
Timer {
id: timerForStartRegistration
interval: 100
@ -73,481 +76,200 @@ Dialog {
Connections{
target: NameDirectory
function onNameRegistrationEnded(status, name){
if(status === NameDirectory.RegisterNameStatus.SUCCESS){
accept()
} else {
switch(status){
case NameDirectory.RegisterNameStatus.WRONG_PASSWORD:
lblRegistrationError.text = qsTr("Incorrect password")
break
case NameDirectory.RegisterNameStatus.NETWORK_ERROR:
lblRegistrationError.text = qsTr("Network error")
break
default:
break
}
stackedWidget.currentIndex = 2
function onNameRegistrationEnded(status, name) {
switch(status) {
case NameDirectory.RegisterNameStatus.SUCCESS:
accepted()
close()
return
case NameDirectory.RegisterNameStatus.WRONG_PASSWORD:
lblRegistrationError.text = qsTr("Incorrect password")
break
case NameDirectory.RegisterNameStatus.NETWORK_ERROR:
lblRegistrationError.text = qsTr("Network error")
break
default:
break
}
stackedWidget.currentIndex = 2
}
}
visible: false
anchors.centerIn: parent.Center
x: (parent.width - width) / 2
y: (parent.height - height) / 2
title: JamiStrings.setUsername
onClosed: {
reject()
}
contentItem: Rectangle {
id: nameRegistrationContentRect
contentItem: Rectangle{
implicitWidth: 350
implicitHeight: 208
implicitWidth: JamiTheme.preferredDialogWidth
implicitHeight: JamiTheme.preferredDialogHeight
StackLayout{
color: "transparent"
StackLayout {
id: stackedWidget
anchors.centerIn: parent
anchors.fill: parent
anchors.margins: JamiTheme.preferredMarginSize
currentIndex: 0
Rectangle{
id: passwordConfirmPage
// Index = 0
Rectangle {
Layout.fillWidth: true
Layout.fillHeight: true
Layout.leftMargin: 11
Layout.rightMargin: 11
Layout.topMargin: 11
Layout.bottomMargin: 11
ColumnLayout {
anchors.centerIn: parent
spacing: 16
ColumnLayout{
anchors.fill: parent
spacing: 7
Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter
Item{
Layout.alignment: Qt.AlignHCenter
Layout.fillHeight: true
Layout.maximumHeight: 20
Layout.preferredHeight: 20
Layout.minimumHeight: 20
}
Label{
Layout.preferredWidth: 219
Layout.alignment: Qt.AlignHCenter
wrapMode: Text.Wrap
text: qsTr("Enter your account password")
font.pointSize: 8
Label {
Layout.alignment: Qt.AlignCenter
text: JamiStrings.enterAccountPassword
font.pointSize: JamiTheme.textFontSize
font.kerning: true
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
}
Item{
Layout.alignment: Qt.AlignHCenter
Layout.fillHeight: true
Layout.maximumHeight: 20
Layout.preferredHeight: 20
Layout.minimumHeight: 20
}
InfoLineEdit{
MaterialLineEdit {
id: passwordEdit
Layout.alignment: Qt.AlignHCenter
Layout.minimumWidth: 294
Layout.preferredWidth: 294
Layout.preferredHeight: 30
Layout.minimumHeight: 30
Layout.alignment: Qt.AlignCenter
Layout.preferredWidth: JamiTheme.preferredFieldWidth
Layout.preferredHeight: 48
echoMode: TextInput.Password
placeholderText: qsTr("Password")
onTextChanged: btnRegister.enabled = (text.length > 0)
}
Item{
RowLayout {
spacing: 16
Layout.alignment: Qt.AlignHCenter
Layout.fillHeight: true
Layout.maximumHeight: 20
Layout.preferredHeight: 20
Layout.minimumHeight: 20
}
RowLayout{
spacing: 7
Layout.alignment: Qt.AlignHCenter
Layout.fillWidth: true
Item{
Layout.fillWidth: true
Layout.maximumHeight: 20
Layout.preferredHeight: 20
Layout.minimumHeight: 20
}
HoverableRadiusButton{
MaterialButton {
id: btnRegister
Layout.maximumWidth: 130
Layout.preferredWidth: 130
Layout.minimumWidth: 130
Layout.alignment: Qt.AlignHCenter
Layout.preferredWidth: JamiTheme.preferredFieldWidth / 2 - 8
Layout.preferredHeight: JamiTheme.preferredFieldHeight
Layout.maximumHeight: 30
Layout.preferredHeight: 30
Layout.minimumHeight: 30
radius: height /2
color: enabled? JamiTheme.buttonTintedBlack : JamiTheme.buttonTintedGrey
hoveredColor: JamiTheme.buttonTintedBlackHovered
pressedColor: JamiTheme.buttonTintedBlackPressed
outlined: true
enabled: false
text: qsTr("Register")
font.pointSize: 10
font.kerning: true
onClicked: {
startRegistration()
}
}
Item{
Layout.fillWidth: true
Layout.minimumWidth: 40
Layout.maximumHeight: 20
Layout.preferredHeight: 20
Layout.minimumHeight: 20
}
HoverableButtonTextItem {
MaterialButton {
id: btnCancel
Layout.maximumWidth: 130
Layout.preferredWidth: 130
Layout.minimumWidth: 130
Layout.alignment: Qt.AlignHCenter
Layout.preferredWidth: JamiTheme.preferredFieldWidth / 2 - 8
Layout.preferredHeight: JamiTheme.preferredFieldHeight
Layout.maximumHeight: 30
Layout.preferredHeight: 30
Layout.minimumHeight: 30
backgroundColor: "red"
onEnterColor: Qt.rgba(150 / 256, 0, 0, 0.7)
onDisabledBackgroundColor: Qt.rgba(
255 / 256,
0, 0, 0.8)
onPressColor: backgroundColor
textColor: "white"
radius: height /2
color: JamiTheme.buttonTintedBlack
hoveredColor: JamiTheme.buttonTintedBlackHovered
pressedColor: JamiTheme.buttonTintedBlackPressed
outlined: true
text: qsTr("Cancel")
font.pointSize: 10
font.kerning: true
onClicked: {
reject()
close()
}
}
Item{
Layout.fillWidth: true
Layout.minimumWidth: 40
Layout.maximumHeight: 20
Layout.preferredHeight: 20
Layout.minimumHeight: 20
}
}
Item{
Layout.alignment: Qt.AlignHCenter
Layout.fillHeight: true
Layout.maximumHeight: 20
Layout.preferredHeight: 20
Layout.minimumHeight: 20
}
}
}
Rectangle{
id: registeringPage
// Index = 1
Rectangle {
Layout.fillWidth: true
Layout.fillHeight: true
Layout.leftMargin: 11
Layout.rightMargin: 11
Layout.topMargin: 11
Layout.bottomMargin: 11
ColumnLayout {
anchors.centerIn: parent
spacing: 16
ColumnLayout{
anchors.fill: parent
spacing: 7
Label {
Layout.alignment: Qt.AlignCenter
text: JamiStrings.registeringName
font.pointSize: JamiTheme.textFontSize
font.kerning: true
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
}
Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter
Label {
id: spinnerLabel
Item{
Layout.alignment: Qt.AlignHCenter
Layout.fillHeight: true
Layout.minimumHeight: 40
Layout.preferredWidth: 96
Layout.preferredHeight: 96
Layout.maximumWidth: 20
Layout.preferredWidth: 20
Layout.minimumWidth: 20
}
RowLayout{
Layout.fillWidth: true
spacing: 0
Layout.maximumHeight: 30
Item{
Layout.fillWidth: true
Layout.maximumHeight: 20
Layout.preferredHeight: 20
Layout.minimumHeight: 20
}
Label{
Layout.alignment: Qt.AlignHCenter
Layout.maximumWidth: 0
Layout.preferredWidth: 341
Layout.minimumHeight: 0
Layout.preferredHeight: 30
Layout.maximumHeight: 30
wrapMode: Text.Wrap
text: JamiStrings.registeringName
font.pointSize: 8
font.kerning: true
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
}
Item{
Layout.fillWidth: true
Layout.maximumHeight: 20
Layout.preferredHeight: 20
Layout.minimumHeight: 20
}
}
Item{
Layout.alignment: Qt.AlignHCenter
Layout.fillHeight: true
Layout.maximumWidth: 20
Layout.preferredWidth: 20
Layout.minimumWidth: 20
}
RowLayout{
spacing: 7
Item{
Layout.fillWidth: true
Layout.maximumHeight: 20
Layout.preferredHeight: 20
Layout.minimumHeight: 20
}
Label{
id: spinnerLabel
Layout.alignment: Qt.AlignHCenter
Layout.maximumWidth: 96
Layout.preferredWidth: 96
Layout.minimumWidth: 96
Layout.maximumHeight: 96
Layout.preferredHeight: 96
Layout.minimumHeight: 96
background: Rectangle {
background: Rectangle {
AnimatedImage {
id: spinnerMovie
anchors.fill: parent
AnimatedImage {
id: spinnerMovie
anchors.fill: parent
source: "qrc:/images/jami_eclipse_spinner.gif"
playing: spinnerLabel.visible
paused: false
fillMode: Image.PreserveAspectFit
mipmap: true
}
source: "qrc:/images/jami_eclipse_spinner.gif"
playing: spinnerLabel.visible
paused: false
fillMode: Image.PreserveAspectFit
mipmap: true
}
}
Item{
Layout.fillWidth: true
Layout.maximumHeight: 20
Layout.preferredHeight: 20
Layout.minimumHeight: 20
}
}
Item{
Layout.alignment: Qt.AlignHCenter
Layout.fillHeight: true
Layout.minimumHeight: 40
Layout.maximumWidth: 20
Layout.preferredWidth: 20
Layout.minimumWidth: 20
}
}
}
Rectangle{
id: nameNotRegisteredPage
// Index = 2
Rectangle {
Layout.fillWidth: true
Layout.fillHeight: true
ColumnLayout{
anchors.fill: parent
ColumnLayout {
anchors.centerIn: parent
spacing: 16
Item{
Layout.fillHeight: true
Layout.minimumHeight: 40
Label {
id: lblRegistrationError
Layout.maximumWidth: 20
Layout.preferredWidth: 20
Layout.minimumWidth: 20
Layout.alignment: Qt.AlignCenter
text: qsTr("Something went wrong")
font.pointSize: JamiTheme.textFontSize
font.kerning: true
color: "red"
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
}
RowLayout{
spacing: 7
Layout.fillWidth: true
MaterialButton {
id: btnClose
Item{
Layout.fillWidth: true
Layout.alignment: Qt.AlignHCenter
Layout.preferredWidth: JamiTheme.preferredFieldWidth / 2
Layout.preferredHeight: JamiTheme.preferredFieldHeight
Layout.maximumHeight: 20
Layout.preferredHeight: 20
Layout.minimumHeight: 20
color: JamiTheme.buttonTintedBlack
hoveredColor: JamiTheme.buttonTintedBlackHovered
pressedColor: JamiTheme.buttonTintedBlackPressed
outlined: true
text: JamiStrings.close
onClicked: {
close()
}
Label{
id: lblRegistrationError
Layout.alignment: Qt.AlignHCenter
Layout.maximumWidth: 0
Layout.preferredWidth: 341
Layout.minimumHeight: 0
Layout.preferredHeight: 30
Layout.maximumHeight: 30
wrapMode: Text.Wrap
text: qsTr("Something went wrong")
font.pointSize: 8
font.kerning: true
color: "red"
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
}
Item{
Layout.fillWidth: true
Layout.maximumHeight: 20
Layout.preferredHeight: 20
Layout.minimumHeight: 20
}
}
Item{
Layout.fillHeight: true
Layout.minimumHeight: 40
Layout.maximumWidth: 20
Layout.preferredWidth: 20
Layout.minimumWidth: 20
}
RowLayout{
spacing: 7
Layout.fillWidth: true
Item{
Layout.fillWidth: true
Layout.maximumHeight: 20
Layout.preferredHeight: 20
Layout.minimumHeight: 20
}
HoverableRadiusButton{
id: btnCloseRegisterDialog
Layout.maximumWidth: 130
Layout.preferredWidth: 130
Layout.minimumWidth: 130
Layout.maximumHeight: 30
Layout.preferredHeight: 30
Layout.minimumHeight: 30
radius: height /2
text: JamiStrings.close
font.pointSize: 10
font.kerning: true
onClicked: {
reject()
}
}
Item{
Layout.fillWidth: true
Layout.maximumHeight: 20
Layout.preferredHeight: 20
Layout.minimumHeight: 20
}
}
Item{
Layout.fillHeight: true
Layout.minimumHeight: 40
Layout.maximumWidth: 20
Layout.preferredWidth: 20
Layout.minimumWidth: 20
}
}
}

View file

@ -1,6 +1,7 @@
/*
* Copyright (C) 2020 by Savoir-faire Linux
* Author: Yang Wang <yang.wang@savoirfairelinux.com>
* Author: Albert Babí <albert.babi@savoirfairelinux.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -20,109 +21,115 @@ import QtQuick 2.15
import QtQuick.Controls 2.14
import QtQuick.Layouts 1.14
import QtQuick.Controls.Styles 1.4
import "../../constant"
import "../../commoncomponents"
Dialog {
BaseDialog {
id: root
property string deviceId : ""
signal revokeDeviceWithPassword(string idOfDevice, string password)
function openRevokeDeviceDialog(deviceIdIn){
function openRevokeDeviceDialog(deviceIdIn) {
deviceId = deviceIdIn
passwordEdit.clear()
root.open()
open()
}
header : Rectangle {
width: parent.width
height: 64
color: "transparent"
Text {
anchors.fill: parent
anchors.leftMargin: JamiTheme.preferredMarginSize
anchors.topMargin: JamiTheme.preferredMarginSize
text: JamiStrings.confirmRemovalRequest
wrapMode: Text.Wrap
font.pointSize: JamiTheme.headerFontSize
}
}
visible: false
x: (parent.width - width) / 2
y: (parent.height - height) / 2
onAccepted: {
revokeDeviceWithPassword(deviceId,passwordEdit.text)
}
title: qsTr("Remove device")
contentItem: Rectangle {
implicitWidth: 350
implicitHeight: contentLayout.implicitHeight + 64 + JamiTheme.preferredMarginSize
id: revokeDeviceContentRect
implicitWidth: JamiTheme.preferredDialogWidth
implicitHeight: JamiTheme.preferredDialogHeight
ColumnLayout {
id: contentLayout
anchors.fill: parent
anchors.centerIn: parent
anchors.fill: parent
anchors.margins: JamiTheme.preferredMarginSize
spacing: 16
Label {
id: labelDeletion
Layout.alignment: Qt.AlignHCenter
Layout.preferredWidth: revokeDeviceContentRect.width - JamiTheme.preferredMarginSize * 2
text: qsTr("Enter this account's password to confirm the removal of this device")
font.pointSize: JamiTheme.textFontSize
font.kerning: true
wrapMode: Text.Wrap
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
}
MaterialLineEdit {
id: passwordEdit
Layout.preferredHeight: 48
Layout.fillWidth: true
Layout.alignment: Qt.AlignHCenter
Layout.maximumWidth: 300
Layout.preferredWidth: JamiTheme.preferredFieldWidth
Layout.preferredHeight: visible ? 48 : 0
echoMode: TextInput.Password
horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignVCenter
placeholderText: JamiStrings.enterCurrentPassword
borderColorMode: InfoLineEdit.NORMAL
placeholderText: qsTr("Password")
onTextChanged: {
btnRemove.enabled = text.length > 0
}
}
RowLayout {
Layout.topMargin: JamiTheme.preferredMarginSize / 2
Layout.alignment: Qt.AlignRight
spacing: 16
Layout.alignment: Qt.AlignHCenter
Button {
id: btnChangePasswordConfirm
Layout.fillWidth: true
contentItem: Text {
text: qsTr("CONFIRM")
color: JamiTheme.buttonTintedBlue
}
MaterialButton {
id: btnRemove
background: Rectangle {
color: "transparent"
}
Layout.alignment: Qt.AlignHCenter
Layout.preferredWidth: JamiTheme.preferredFieldWidth / 2 - 8
Layout.preferredHeight: JamiTheme.preferredFieldHeight
color: enabled? JamiTheme.buttonTintedBlack : JamiTheme.buttonTintedGrey
hoveredColor: JamiTheme.buttonTintedBlackHovered
pressedColor: JamiTheme.buttonTintedBlackPressed
outlined: true
enabled: false
text: qsTr("Remove")
onClicked: {
timerToOperate.restart()
revokeDeviceWithPassword(deviceId, passwordEdit.text)
close()
}
}
MaterialButton {
id: btnCancel
Button {
id: btnChangePasswordCancel
Layout.leftMargin: JamiTheme.preferredMarginSize / 2
Layout.alignment: Qt.AlignHCenter
Layout.preferredWidth: JamiTheme.preferredFieldWidth / 2 - 8
Layout.preferredHeight: JamiTheme.preferredFieldHeight
contentItem: Text {
text: qsTr("CANCEL")
color: JamiTheme.buttonTintedBlue
}
color: JamiTheme.buttonTintedBlack
hoveredColor: JamiTheme.buttonTintedBlackHovered
pressedColor: JamiTheme.buttonTintedBlackPressed
outlined: true
enabled: true
background: Rectangle {
color: "transparent"
}
text: qsTr("Cancel")
onClicked: {
root.reject()
close()
}
}
}
}
}
}
}

View file

@ -146,15 +146,11 @@ Rectangle {
PasswordDialog {
id: passwordDialog
anchors.centerIn: parent.Center
visible: false
purpose: PasswordDialog.ExportAccount
onDoneSignal: {
if (currentPurpose === passwordDialog.ExportAccount) {
var success = (code === successCode)
var title = success ? qsTr("Success") : qsTr("Error")
var info = success ? JamiStrings.backupSuccessful : JamiStrings.backupFailed

View file

@ -42,7 +42,7 @@ Rectangle {
connectBtn.spinnerTriggered = false
passwordFromBackupEdit.clear()
errorText = ""
fileImportBtnText = JamiString.archive
fileImportBtnText = JamiStrings.archive
}
function errorOccured(errorMessage) {
@ -63,10 +63,10 @@ Rectangle {
onAccepted: {
filePath = file
if (file.length != 0) {
if (file.length !== "") {
fileImportBtnText = UtilsAdapter.toFileInfoName(file)
} else {
fileImportBtnText = JamiString.archive
fileImportBtnText = JamiStrings.archive
}
}
}