Address more review comments
* Make Validation a singleton instead * Wording changes for error messages * Smart pointers for Ui members * Other minor nitpicks
This commit is contained in:
parent
a85511cd7d
commit
c635c7f40d
17 changed files with 93 additions and 71 deletions
|
@ -22,7 +22,7 @@ class ChatMessage {
|
|||
public:
|
||||
explicit ChatMessage(const Network::ChatEntry& chat, QTime ts = {}) {
|
||||
/// Convert the time to their default locale defined format
|
||||
static QLocale locale;
|
||||
QLocale locale;
|
||||
timestamp = locale.toString(ts.isValid() ? ts : QTime::currentTime(), QLocale::ShortFormat);
|
||||
nickname = QString::fromStdString(chat.nickname);
|
||||
message = QString::fromStdString(chat.message);
|
||||
|
@ -60,12 +60,12 @@ public:
|
|||
}
|
||||
|
||||
private:
|
||||
const QString system_color = "#888888";
|
||||
static constexpr const char system_color[] = "#888888";
|
||||
QString timestamp;
|
||||
QString message;
|
||||
};
|
||||
|
||||
ChatRoom::ChatRoom(QWidget* parent) : QWidget(parent), ui(new Ui::ChatRoom) {
|
||||
ChatRoom::ChatRoom(QWidget* parent) : QWidget(parent), ui(std::make_unique<Ui::ChatRoom>()) {
|
||||
ui->setupUi(this);
|
||||
|
||||
// set the item_model for player_view
|
||||
|
@ -148,7 +148,7 @@ void ChatRoom::OnChatReceive(const Network::ChatEntry& chat) {
|
|||
return member.nickname == chat.nickname;
|
||||
});
|
||||
if (it == members.end()) {
|
||||
LOG_INFO(Network, "Chat message received from unknown player. Ignoring it.");
|
||||
NGLOG_INFO(Network, "Chat message received from unknown player. Ignoring it.");
|
||||
return;
|
||||
}
|
||||
auto player = std::distance(members.begin(), it);
|
||||
|
@ -175,7 +175,7 @@ void ChatRoom::OnSendChat() {
|
|||
return member.nickname == chat.nickname;
|
||||
});
|
||||
if (it == members.end()) {
|
||||
LOG_INFO(Network, "Chat message received from unknown player");
|
||||
NGLOG_INFO(Network, "Cannot find self in the player list when sending a message.");
|
||||
}
|
||||
auto player = std::distance(members.begin(), it);
|
||||
ChatMessage m(chat);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue