-
Notifications
You must be signed in to change notification settings - Fork 8
/
imwidget.cpp
42 lines (33 loc) · 786 Bytes
/
imwidget.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#include "imwidget.h"
ImWidget::ImWidget(QWidget *parent)
: QWidget(parent)
{
ui.setupUi(this);
}
ImWidget::~ImWidget()
{
}
void ImWidget::new_incoming_im(QString from, QString text)
{
if (!text.isEmpty()) {
ui.historyEdit->append(from + QString(": ") + text);
}
ui.textEdit->setFocus();
}
void ImWidget::setHandle(QString newhandle)
{
this->imHandle = newhandle;
}
QString ImWidget::getHandle()
{
return this->imHandle;
}
void ImWidget::on_sendButton_clicked() {
emit new_outgoing_im(this->imHandle, ui.textEdit->toPlainText());
ui.historyEdit->append(QString("<i>you: </i>") + ui.textEdit->toPlainText());
ui.textEdit->clear();
ui.textEdit->setFocus();
}
//void ImWidget::closeEvent(QCloseEvent *event) {
// ui.historyEdit->append(QString("closeEvent"));
//}