1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-18 17:40:48 +02:00
vcmi/launcher/lobby/chat_moc.h

70 lines
1.2 KiB
C++
Raw Normal View History

2023-09-03 16:28:22 +02:00
/*
* chat_moc.h, part of VCMI engine
*
* Authors: listed in file AUTHORS in main folder
*
* License: GNU General Public License v2.0 or later
* Full text of license available in license.txt file, in main folder
*
*/
#pragma once
2023-09-03 01:05:48 +02:00
#include <QWidget>
2023-09-03 16:28:22 +02:00
#include <QCompleter>
2023-09-03 01:05:48 +02:00
namespace Ui {
class Chat;
}
class Chat : public QWidget
{
Q_OBJECT
enum ChatId
{
GLOBAL = 0,
ROOM
};
QCompleter namesCompleter;
QString username, session;
ChatId chatId = GLOBAL;
QVector<QTextDocument*> chatDocuments;
private:
void setChatId(ChatId);
2023-09-03 14:47:34 +02:00
void sendMessage();
2023-09-03 01:05:48 +02:00
public:
explicit Chat(QWidget *parent = nullptr);
~Chat();
void setUsername(const QString &);
void setSession(const QString &);
2023-09-03 14:47:34 +02:00
void setChannel(const QString &);
2023-09-03 01:05:48 +02:00
void clearUsers();
void addUser(const QString & user);
2023-09-03 14:47:34 +02:00
void chatMessage(const QString & title, const QString & channel, QString body, bool isSystem = false);
2023-09-03 01:05:48 +02:00
void chatMessage(const QString & title, QString body, bool isSystem = false);
signals:
void messageSent(QString);
2023-09-03 14:47:34 +02:00
void channelSwitch(QString);
2023-09-03 01:05:48 +02:00
public slots:
void sysMessage(QString body);
private slots:
void on_messageEdit_returnPressed();
void on_sendButton_clicked();
void on_chatSwitch_clicked();
private:
Ui::Chat *ui;
};