settingsview: fix alignments and homogeneize items
Change-Id: I8ea60715a14b481da5c4d4d0078dc8de7df28eec
diff --git a/src/mainview/components/AccountComboBox.qml b/src/mainview/components/AccountComboBox.qml
index 0fd3fa8..3580951 100644
--- a/src/mainview/components/AccountComboBox.qml
+++ b/src/mainview/components/AccountComboBox.qml
@@ -31,8 +31,6 @@
signal newAccountButtonClicked
signal settingBtnClicked
- currentIndex: 0
-
function backToWelcomePage() {
needToBackToWelcomePage()
}
@@ -42,6 +40,19 @@
accountListModel.reset()
}
+ Connections {
+ target: accountListModel
+
+ function onModelReset() {
+ userImageRoot.source = "data:image/png;base64," + accountListModel.data(
+ accountListModel.index(0, 0), 259)
+ currentAccountPresenseCycle.accountStatus =
+ accountListModel.data(accountListModel.index(0, 0), 261)
+ textMetricsUserAliasRoot.text = accountListModel.data(accountListModel.index(0,0), 257)
+ textMetricsUsernameRoot.text = accountListModel.data(accountListModel.index(0,0), 258)
+ }
+ }
+
Image {
id: userImageRoot
@@ -55,14 +66,8 @@
fillMode: Image.PreserveAspectFit
// Base 64 format
- source: {
- if (currentIndex !== -1)
- return "data:image/png;base64," + accountListModel.data(
- accountListModel.index(
- accountComboBox.currentIndex, 0), 259)
- else
- return source
- }
+ source: "data:image/png;base64," + accountListModel.data(
+ accountListModel.index(0, 0), 259)
mipmap: true
AccountPresenceCycle {
@@ -73,16 +78,7 @@
anchors.bottom: userImageRoot.bottom
anchors.bottomMargin: -2
- // Visible when account is registered.
- visible: {
- if (currentIndex !== -1)
- return accountListModel.data(
- accountListModel.index(
- accountComboBox.currentIndex, 0), 261)
- === Account.Status.REGISTERED
- else
- return visible
- }
+ accountStatus: accountListModel.data(accountListModel.index(0, 0), 261)
}
}
@@ -133,14 +129,7 @@
- arrowDropDown.width - qrCodeGenerateButton.width - 55
// Role::Alias
- text: {
- if (currentIndex !== -1)
- return accountListModel.data(accountListModel.index(
- accountComboBox.currentIndex,
- 0), 257)
- else
- return text
- }
+ text: accountListModel.data(accountListModel.index(0,0), 257)
}
TextMetrics {
@@ -154,14 +143,7 @@
// Role::Username
- text: {
- if (currentIndex !== -1)
- return accountListModel.data(accountListModel.index(
- accountComboBox.currentIndex,
- 0), 258)
- else
- return text
- }
+ text: accountListModel.data(accountListModel.index(0,0), 258)
}
HoverableButton {
diff --git a/src/mainview/components/AccountComboBoxPopup.qml b/src/mainview/components/AccountComboBoxPopup.qml
index 813cb8e..f10b4f5 100644
--- a/src/mainview/components/AccountComboBoxPopup.qml
+++ b/src/mainview/components/AccountComboBoxPopup.qml
@@ -89,12 +89,7 @@
anchors.bottom: userImage.bottom
anchors.bottomMargin: -2
- // Visible when account is registered.
- visible: {
- return accountListModel.data(
- accountListModel.index(index, 0), 261)
- === Account.Status.REGISTERED
- }
+ accountStatus: Status
}
}
diff --git a/src/mainview/components/AccountPresenceCycle.qml b/src/mainview/components/AccountPresenceCycle.qml
index 9eb4458..7883677 100644
--- a/src/mainview/components/AccountPresenceCycle.qml
+++ b/src/mainview/components/AccountPresenceCycle.qml
@@ -23,6 +23,8 @@
Rectangle {
id: root
+ property int accountStatus: 5
+
width: 12
height: 12
@@ -35,7 +37,13 @@
height: 10
radius: 30
- color: JamiTheme.presenceGreen
+ color: {
+ if (accountStatus === Account.Status.REGISTERED)
+ return JamiTheme.presenceGreen
+ else if (accountStatus === Account.Status.TRYING)
+ return JamiTheme.unPresenceOrange
+ return JamiTheme.notificationRed
+ }
}
radius: 30
diff --git a/src/mainview/components/SidePanel.qml b/src/mainview/components/SidePanel.qml
index 350244e..01d13b5 100644
--- a/src/mainview/components/SidePanel.qml
+++ b/src/mainview/components/SidePanel.qml
@@ -77,30 +77,9 @@
sidePanelTabBar.invitationTabDown = false
}
- function needToChangeToAccount(accountId, index) {
- if (index !== -1) {
- accountComboBox.currentIndex = index
- ClientWrapper.accountAdaptor.accountChanged(index)
- accountChangedUIReset()
- }
- }
+ function refreshAccountComboBox(index) {
+ ClientWrapper.accountAdaptor.accountChanged(index)
- function refreshAccountComboBox(index = -1) {
-
-
- /*
- * To make sure that the ui is refreshed for accountComboBox.
- * Note: when index in -1, it means to maintain the
- * current account selection.
- */
- var currentIndex = accountComboBox.currentIndex
- if (accountComboBox.currentIndex === index)
- accountComboBox.currentIndex = -1
- accountComboBox.currentIndex = index
- if (index !== -1)
- ClientWrapper.accountAdaptor.accountChanged(index)
- else
- accountComboBox.currentIndex = currentIndex
accountComboBox.update()
accountChangedUIReset()
accountComboBox.resetAccountListModel()