2018-01-19 13:42:21 +00:00
|
|
|
// Copyright 2017 Citra Emulator Project
|
|
|
|
// Licensed under GPLv2 or any later version
|
|
|
|
// Refer to the license.txt file included.
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <memory>
|
|
|
|
#include <QDialog>
|
|
|
|
#include <QSortFilterProxyModel>
|
|
|
|
#include <QStandardItemModel>
|
|
|
|
#include <QVariant>
|
|
|
|
#include "network/network.h"
|
2018-04-18 16:29:03 +00:00
|
|
|
|
|
|
|
namespace Ui {
|
|
|
|
class ChatRoom;
|
|
|
|
}
|
2018-01-19 13:42:21 +00:00
|
|
|
|
|
|
|
namespace Core {
|
|
|
|
class AnnounceMultiplayerSession;
|
|
|
|
}
|
|
|
|
|
|
|
|
class ConnectionError;
|
|
|
|
class ComboBoxProxyModel;
|
|
|
|
|
|
|
|
class ChatMessage;
|
|
|
|
|
|
|
|
class ChatRoom : public QWidget {
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
explicit ChatRoom(QWidget* parent);
|
|
|
|
void SetPlayerList(const Network::RoomMember::MemberList& member_list);
|
|
|
|
void Clear();
|
|
|
|
void AppendStatusMessage(const QString& msg);
|
2018-04-18 16:29:03 +00:00
|
|
|
~ChatRoom();
|
2018-01-19 13:42:21 +00:00
|
|
|
|
|
|
|
public slots:
|
|
|
|
void OnRoomUpdate(const Network::RoomInformation& info);
|
|
|
|
void OnChatReceive(const Network::ChatEntry&);
|
|
|
|
void OnSendChat();
|
|
|
|
void OnChatTextChanged();
|
|
|
|
void Disable();
|
|
|
|
void Enable();
|
|
|
|
|
|
|
|
signals:
|
|
|
|
void ChatReceived(const Network::ChatEntry&);
|
|
|
|
|
|
|
|
private:
|
2018-04-09 17:00:56 +00:00
|
|
|
static constexpr u32 max_chat_lines = 1000;
|
2018-01-19 13:42:21 +00:00
|
|
|
void AppendChatMessage(const QString&);
|
|
|
|
bool ValidateMessage(const std::string&);
|
|
|
|
QStandardItemModel* player_list;
|
2018-04-18 05:06:02 +00:00
|
|
|
std::unique_ptr<Ui::ChatRoom> ui;
|
2018-01-19 13:42:21 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
Q_DECLARE_METATYPE(Network::ChatEntry);
|
|
|
|
Q_DECLARE_METATYPE(Network::RoomInformation);
|
|
|
|
Q_DECLARE_METATYPE(Network::RoomMember::State);
|