1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- #include "dialogchat.h"
- #include "ui_dialogchat.h"
-
- DialogChat::DialogChat(QWidget *parent) : QWidget(parent), ui(new Ui::DialogChat)
- {
- ui->setupUi(this);
- }
-
- DialogChat::~DialogChat()
- {
- delete ui;
- }
-
- NetSoul::User DialogChat::getUser()
- {
- return m_user;
- }
-
- bool DialogChat::match(NetSoul::User usr)
- {
- return usr.login == m_user.login && usr.location == m_user.location;
- }
-
- void DialogChat::closeEvent(QCloseEvent* e)
- {
- e->ignore();
- hide();
- }
-
- void DialogChat::setUser(NetSoul::User user)
- {
- m_user = user;
- setWindowTitle(user.login + "@" + user.location);
- }
-
- void DialogChat::newMessage(NetSoul::Message msg)
- {
- append(msg.from, msg.message);
- }
-
- void DialogChat::setMe(NetSoul::User usr)
- {
- m_me = usr;
- }
-
- void DialogChat::on_lineChat_returnPressed()
- {
- emit sendMessageRequested(m_user, ui->lineChat->text());
- append(m_me, ui->lineChat->text());
- ui->lineChat->clear();
- }
-
- void DialogChat::append(NetSoul::User usr, QString msg)
- {
- ui->textChat->append(usr.login + "@" + usr.location + ": " + msg);
- }
|