Solve crash bug with toolbar loader when pop push a chat view, loading AvatarOrColorHash from toolbar

This commit is contained in:
Angela Mazzurco 2017-07-04 17:20:42 +02:00
parent 80cc1b4520
commit 8ebd0f770f
2 changed files with 26 additions and 18 deletions

View File

@ -65,22 +65,8 @@ Item
{
toolBar.state = "CHATVIEW"
gxsInfo= ChatCache.lastMessageCache.getGxsFromChatId(chatView.chatId)
toolBar.gxsSource = gxsInfo.gxs
toolBar.titleText = gxsInfo.name
toolBar.loaderSource = userHash
}
Component
{
id: userHash
AvatarOrColorHash
{
id: colorHash
gxs_id: gxsInfo.gxs
height: toolBar.height - 4
anchors.leftMargin: 2
}
}

View File

@ -56,11 +56,13 @@ ApplicationWindow
function addUriHandler(path, fun) { uriHandlersRegister[path] = fun }
function delUriHandler(path, fun) { delete uriHandlersRegister[path] }
header: ToolBar
{
id: toolBar
property alias titleText: toolBarText.text
property alias loaderSource: imageLoader.sourceComponent
property alias gxsSource: imageLoader.gxsSource
property string defaultLabel: "RetroShare"
property var iconsSize: (coreReady)? height - 10 : 0
@ -88,6 +90,7 @@ ApplicationWindow
{
name: "CHATVIEW"
PropertyChanges { target: toolBarText; mouseA.visible: false }
PropertyChanges { target: toolBar; loaderSource: userHash }
// PropertyChanges { target: toolBar; backBtnVisible: true }
},
State
@ -109,8 +112,12 @@ ApplicationWindow
{
id: imageLoader
anchors.verticalCenter: parent.verticalCenter
height: Math.max(30, toolBar.height - 4)
height: toolBar.height - 4
anchors.left: tolbarLeftPadding.right
asynchronous: true
property string gxsSource;
}
Component
@ -126,6 +133,21 @@ ApplicationWindow
}
}
Component
{
id: userHash
AvatarOrColorHash
{
id: colorHash
gxs_id: imageLoader.gxsSource
height: toolBar.height - 4
anchors.leftMargin: 2
}
}
Label
{
property alias mouseA: mouseA
@ -196,8 +218,7 @@ ApplicationWindow
{
if (currentItem)
{
currentItem.forceActiveFocus()
setStatus (currentItem)
setStatus (currentItem)
}
}
@ -230,6 +251,7 @@ ApplicationWindow
}
}
state: "core_down"
initialItem: BusyOverlay { message: qsTr("Connecting to core...") }