fix typo #LINQT-1876
fix chat room menu ui #LINQT-1872 update current chat message list when current chat removed #LINQT-1873 fix : remove unused connect disconnecting a usefull one
This commit is contained in:
parent
a1e2c253bf
commit
4b1cb237bf
3 changed files with 10 additions and 6 deletions
|
|
@ -79,7 +79,6 @@ void EventLogList::setChatCore(QSharedPointer<ChatCore> core) {
|
||||||
if (mChatCore) {
|
if (mChatCore) {
|
||||||
disconnect(mChatCore.get(), &ChatCore::eventListChanged, this, nullptr);
|
disconnect(mChatCore.get(), &ChatCore::eventListChanged, this, nullptr);
|
||||||
disconnect(mChatCore.get(), &ChatCore::eventsInserted, this, nullptr);
|
disconnect(mChatCore.get(), &ChatCore::eventsInserted, this, nullptr);
|
||||||
mModelConnection->disconnect();
|
|
||||||
}
|
}
|
||||||
mChatCore = core;
|
mChatCore = core;
|
||||||
if (mChatCore) {
|
if (mChatCore) {
|
||||||
|
|
@ -97,7 +96,6 @@ void EventLogList::setChatCore(QSharedPointer<ChatCore> core) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
mModelConnection = SafeConnection<ChatCore, ChatModel>::create(mChatCore, mChatCore->getModel());
|
|
||||||
}
|
}
|
||||||
emit eventChanged();
|
emit eventChanged();
|
||||||
lUpdate();
|
lUpdate();
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,7 @@ ListView {
|
||||||
|
|
||||||
property ChatGui currentChatGui
|
property ChatGui currentChatGui
|
||||||
onCurrentIndexChanged: currentChatGui = model.getAt(currentIndex) || null
|
onCurrentIndexChanged: currentChatGui = model.getAt(currentIndex) || null
|
||||||
|
onCurrentChatGuiChanged: chatClicked(currentChatGui)
|
||||||
|
|
||||||
signal resultsReceived()
|
signal resultsReceived()
|
||||||
signal markAllAsRead()
|
signal markAllAsRead()
|
||||||
|
|
@ -44,9 +45,9 @@ ListView {
|
||||||
mainItem.resultsReceived()
|
mainItem.resultsReceived()
|
||||||
}
|
}
|
||||||
onChatRemoved: {
|
onChatRemoved: {
|
||||||
var indexToSelect = mainItem.currentIndex
|
var currentChat = model.getAt(currentIndex)
|
||||||
mainItem.currentIndex = -1
|
mainItem.currentIndex = -1
|
||||||
mainItem.currentIndex = indexToSelect
|
selectChat(currentChat)
|
||||||
}
|
}
|
||||||
onLayoutChanged: {
|
onLayoutChanged: {
|
||||||
selectChat(mainItem.currentChatGui)
|
selectChat(mainItem.currentChatGui)
|
||||||
|
|
@ -57,6 +58,7 @@ ListView {
|
||||||
|
|
||||||
function selectChat(chatGui) {
|
function selectChat(chatGui) {
|
||||||
var index = chatProxy.findChatIndex(chatGui)
|
var index = chatProxy.findChatIndex(chatGui)
|
||||||
|
console.log("current index", mainItem.currentIndex, "new", index)
|
||||||
mainItem.currentIndex = index
|
mainItem.currentIndex = index
|
||||||
// if the chat exists, it may not be displayed
|
// if the chat exists, it may not be displayed
|
||||||
// in list if hide_empty_chatrooms is set. Thus, we need
|
// in list if hide_empty_chatrooms is set. Thus, we need
|
||||||
|
|
@ -366,14 +368,15 @@ ListView {
|
||||||
}
|
}
|
||||||
Rectangle {
|
Rectangle {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
visible: mainItem.currentChatGui && !mainItem.currentChatGui.core.isReadOnly
|
visible: leaveButton.visible
|
||||||
Layout.preferredHeight: Math.min(1, Math.round(1 * DefaultStyle.dp))
|
Layout.preferredHeight: Math.min(1, Math.round(1 * DefaultStyle.dp))
|
||||||
color: DefaultStyle.main2_400
|
color: DefaultStyle.main2_400
|
||||||
}
|
}
|
||||||
IconLabelButton {
|
IconLabelButton {
|
||||||
|
id: leaveButton
|
||||||
//: "leave"
|
//: "leave"
|
||||||
text: qsTr("chat_room_leave")
|
text: qsTr("chat_room_leave")
|
||||||
visible: mainItem.currentChatGui && !mainItem.currentChatGui.core.isReadOnly && mainItem.currentChatGui.core.isGroupChat
|
visible: !modelData.core.isReadOnly && modelData.core.isGroupChat
|
||||||
icon.source: AppIcons.trashCan
|
icon.source: AppIcons.trashCan
|
||||||
spacing: Math.round(10 * DefaultStyle.dp)
|
spacing: Math.round(10 * DefaultStyle.dp)
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
|
@ -393,11 +396,13 @@ ListView {
|
||||||
style: ButtonStyle.hoveredBackground
|
style: ButtonStyle.hoveredBackground
|
||||||
}
|
}
|
||||||
Rectangle {
|
Rectangle {
|
||||||
|
visible: deleteButton.visible
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.preferredHeight: Math.min(1, Math.round(1 * DefaultStyle.dp))
|
Layout.preferredHeight: Math.min(1, Math.round(1 * DefaultStyle.dp))
|
||||||
color: DefaultStyle.main2_400
|
color: DefaultStyle.main2_400
|
||||||
}
|
}
|
||||||
IconLabelButton {
|
IconLabelButton {
|
||||||
|
id: deleteButton
|
||||||
//: "Delete"
|
//: "Delete"
|
||||||
text: qsTr("chat_room_delete")
|
text: qsTr("chat_room_delete")
|
||||||
icon.source: AppIcons.trashCan
|
icon.source: AppIcons.trashCan
|
||||||
|
|
|
||||||
|
|
@ -59,6 +59,7 @@ Item {
|
||||||
Text {
|
Text {
|
||||||
anchors.margins: 25
|
anchors.margins: 25
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
|
anchors.right: parent.right
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
text: titleText
|
text: titleText
|
||||||
font: Typography.h4
|
font: Typography.h4
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue