mirror of
https://git.jami.net/savoirfairelinux/jami-client-qt.git
synced 2025-09-10 12:03:18 +02:00
tips: center tips when only one or two are left
GitLab: #1184 Change-Id: I9791565e371ca1a5693e85417c9b253802e0b2b3
This commit is contained in:
parent
5820052a53
commit
b291728472
3 changed files with 48 additions and 3 deletions
|
@ -157,6 +157,8 @@ FocusScope {
|
|||
imageContainerWidth: 20
|
||||
imageContainerHeight: 20
|
||||
|
||||
radius: 5
|
||||
|
||||
visible: opened
|
||||
circled: true
|
||||
|
||||
|
|
|
@ -31,6 +31,7 @@ JamiFlickable {
|
|||
property color tipsColor: JamiTheme.welcomeBlockColor
|
||||
property color tipsTextColor: JamiTheme.textColor
|
||||
property color iconColor: JamiTheme.tintedBlue
|
||||
property alias visibleTipBoxCount: tipsRepeater.visibleTipBoxCount
|
||||
|
||||
width: JamiTheme.welcomeGridWidth
|
||||
height: getHeight()
|
||||
|
@ -91,6 +92,10 @@ JamiFlickable {
|
|||
hideTipBox = true;
|
||||
}
|
||||
|
||||
onHideTipBoxChanged: {
|
||||
tipsRepeater.updateVisibleTipBoxCount()
|
||||
}
|
||||
|
||||
onOpenedChanged: {
|
||||
if (opened)
|
||||
row.openedTipCount++;
|
||||
|
@ -98,6 +103,27 @@ JamiFlickable {
|
|||
row.openedTipCount--;
|
||||
}
|
||||
}
|
||||
|
||||
property int visibleTipBoxCount: 0
|
||||
|
||||
Component.onCompleted: {
|
||||
updateVisibleTipBoxCount()
|
||||
}
|
||||
|
||||
function updateVisibleTipBoxCount() {
|
||||
var count = 0
|
||||
for (var i = 0; i < tipsRepeater.count; i++) {
|
||||
var item = tipsRepeater.itemAt(i)
|
||||
if (item.type === "backup" || item.type === "customize"){
|
||||
if (item.visible)
|
||||
count ++
|
||||
}
|
||||
else if (!item.hideTipBox) {
|
||||
count++
|
||||
}
|
||||
}
|
||||
visibleTipBoxCount = count
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -221,16 +221,33 @@ ListSelectionView {
|
|||
if (!active) {
|
||||
return 0;
|
||||
} else {
|
||||
if (root.width > root.thresholdSize) {
|
||||
return JamiTheme.welcomeGridWidth;
|
||||
} else {
|
||||
if (item.visibleTipBoxCount <= 2) {
|
||||
if (item.visibleTipBoxCount <= 1)
|
||||
return JamiTheme.tipBoxWidth;
|
||||
return JamiTheme.welcomeShortGridWidth;
|
||||
} else {
|
||||
if (root.width > root.thresholdSize) {
|
||||
return JamiTheme.welcomeGridWidth;
|
||||
} else {
|
||||
return JamiTheme.welcomeShortGridWidth;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
focus: true
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: CurrentAccount
|
||||
onIdChanged: {
|
||||
//Making sure the tips are refreshed when changing user
|
||||
loader_tipsRow.active = false;
|
||||
loader_tipsRow.active = Qt.binding(function () {
|
||||
return viewNode.hasTips && root.height > root.thresholdHeight;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Item {
|
||||
id: bottomRow
|
||||
Layout.preferredWidth: Math.max(300, root.width)
|
||||
|
|
Loading…
Add table
Reference in a new issue