Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ab4a109
commit ae6ea8f
Showing
14 changed files
with
364 additions
and
103 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,32 @@ | ||
#include "PrivateMessageDialog.hpp" | ||
#include "PrivateMessageDialog.h" | ||
#include "ui_PrivateMessageDialog.h" | ||
|
||
PrivateMessageDialog::PrivateMessageDialog(QWidget *parent) : | ||
QDialog(parent), | ||
ui(new Ui::PrivateMessageDialog) | ||
{ | ||
PrivateMessageDialog::PrivateMessageDialog(QWidget* parent, Client* client, QString chatPartner) : QDialog(parent), | ||
ui(new Ui::PrivateMessageDialog), client(client) { | ||
this->chatPartner = chatPartner; | ||
ui->setupUi(this); | ||
|
||
connect(client, &Client::receivedPrivateMessage, this, &PrivateMessageDialog::onReceivedPrivateMessage); | ||
connect(ui->btnSendMessage, &QPushButton::clicked, this, &PrivateMessageDialog::onSendMessageButtonClicked); | ||
connect(this, &PrivateMessageDialog::sendPrivateMessage, client, &Client::onSendPrivateMessage); | ||
} | ||
|
||
PrivateMessageDialog::~PrivateMessageDialog() | ||
{ | ||
PrivateMessageDialog::~PrivateMessageDialog() { | ||
delete ui; | ||
} | ||
|
||
void PrivateMessageDialog::onReceivedPrivateMessage(QString receiver, QString message, QString sender) { | ||
QString output = receiver + ": " + message; | ||
ui->editRecvMessage->append(output); | ||
} | ||
|
||
void PrivateMessageDialog::onSendMessageButtonClicked() { | ||
QString message = ui->editSendMessage->toPlainText(); | ||
QString receiver = chatPartner; | ||
QString sender = client->getUsername(); | ||
|
||
emit sendPrivateMessage(receiver, message, sender); | ||
ui->editSendMessage->clear(); | ||
QString output = sender + ": " + message; | ||
ui->editRecvMessage->append(output); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.