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