From 2d11d70ef8b8972f131ffe035694e6e12b6254bf Mon Sep 17 00:00:00 2001 From: Nikolay Belokonenko Date: Mon, 19 Jun 2023 05:22:50 +0300 Subject: [PATCH] fix room id bugs --- ChatWModel.cpp | 4 ++-- ChatWView.cpp | 4 ++-- client.cpp | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/ChatWModel.cpp b/ChatWModel.cpp index 1d392ff..721869a 100644 --- a/ChatWModel.cpp +++ b/ChatWModel.cpp @@ -33,9 +33,9 @@ void ChatWModel::addChats(const QVariantList& new_chat_list_) beginInsertRows(QModelIndex(), static_cast(model_chats.size()), static_cast(model_chats.size() + new_chat_list_.size() - 1)); for (auto const& chat_var : new_chat_list_) { - if (const auto msg = chat_var.value(); msg) + if (const auto chat = chat_var.value(); chat) { - model_chats.emplaceBack(msg); + model_chats.emplaceBack(chat); } } endInsertRows(); diff --git a/ChatWView.cpp b/ChatWView.cpp index d6c03a3..c7e4c00 100644 --- a/ChatWView.cpp +++ b/ChatWView.cpp @@ -36,12 +36,12 @@ void ChatWView::onChatAdded(const QVariant& new_msg) const model->addChat(new_msg); } -void ChatWView::onChatsAdded(const QVariantList& msg_list) const +void ChatWView::onChatsAdded(const QVariantList& chat_list) const { const auto model = qobject_cast(this->model()); if (!model) return; - model->addChats(msg_list); + model->addChats(chat_list); } void ChatWView::onCustomContextMenuRequested(const QPoint& pos) diff --git a/client.cpp b/client.cpp index a0844c1..b8b7f80 100644 --- a/client.cpp +++ b/client.cpp @@ -148,7 +148,7 @@ void Client::updateUserPassword(QSharedPointer shp_dto_user_) void Client::enterRoom(quint16 room_number_) { - if (room_number_ != 0) + if (room_number_ == 0) return; QJsonObject user;