资源简介
界面用ui做。。。群聊 私聊 可传文件 按QQ的风格做
代码片段和文件信息
#include
#include
#include
#include “dialog.h“
#include “ui_dialog.h“
Dialog::Dialog(QUdpSocket *udpsocket int portQList*msg_notesUser *userQWidget *parent) :
QDialog(parent)
m_ui(new Ui::Dialog)
{
this->user = user;
dialog_notes_flag = true;
this->msg_notes = msg_notes;
this->udpSocket = udpsocket;
this->port = port;
m_ui->setupUi(this);
}
Dialog::~Dialog()
{
delete user;
delete m_ui;
}
void Dialog::changeEvent(QEvent *e)
{
QDialog::changeEvent(e);
switch (e->type()) {
case QEvent::LanguageChange:
m_ui->retranslateUi(this);
break;
default:
break;
}
}
void Dialog::msg_notes_append(QString &msg)
{
QString ip = this->m_ui->label_7->text();
for (int i=0; i < (*msg_notes).size(); i++)
{
if (ip == (*msg_notes)[i].section(‘*‘ 0 0))
{
(*msg_notes)[i].append(msg);
return ;
}
}
}
void Dialog::on_pushButton_6_clicked()
{
QTime time ;
time = time.currentTime();
QString msg = this->m_ui->textEdit_2->toPlainText();
this->m_ui->textEdit_2->clear();
QString name = user->getUserName();
QByteArray name_tmp;
name_tmp = name.toAscii();
if(msg == ““)
{
return;
}
QString show_msg = QString::fromUtf8(name_tmp.data())+ “ “+time.toString() + “\n“ + msg + “\n“;
this->m_ui->textEdit->append(QString::fromUtf8(name_tmp.data())+ “ “+time.toString() + “\n“ + msg);
msg_notes_append(show_msg);
QString userData = user->getUserName()+“ “+user->getIpAddress() +“ “+ user->getHostAddress()+ “ “ + this->m_ui->label_7->text();
QString flag = “2“;
QString divide = “#“;
QString userMsg = flag+ divide + userData + divide + msg;
QByteArray datagram;
datagram = userMsg.toUtf8();
int length = 0;
if((length=udpSocket->writeDatagram(datagram.data()datagram.size()QHostAddress::QHostAddress(“192.168.1.255“) port))!=userMsg.length())
{
return ;
}
}
void Dialog::delete_item_slot(QList*itemList)
{
QString userMsg = this->m_ui->label_3->text() + “ “ + this->m_ui->label_7->text() + “ “ + this->m_ui->label_5->text();
for (int i=0; i < (*itemList).size(); i++)
{
if (userMsg == (*itemList)[i].text(0))
{
(*itemList).removeAt(i);
return ;
}
}
}
void Dialog::dialog_notes_rejected_slot()
{
dialog_notes_flag = true;
return ;
}
void Dialog::on_pushButton_4_clicked()
{
if (dialog_notes_flag == false)
return ;
int i=0;
QString ip = this->m_ui->label_7->text();
for (; i < (*msg_notes).size(); i++)
{
if (ip == (*msg_notes)[i].section(‘*‘ 0 0))
{
break;
}
}
QString notes = (*msg_notes)[i];
Dialog_notes *dialog_notes = new Dialog_notes;
dialog_notes->m_ui->textEdit->append(notes.section(‘*‘11));
dialog_notes->show()
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 1731881 2010-09-12 22:23 client\client
文件 12006 2010-09-12 22:23 client\ui_dialog_chatroom.h
文件 778 2010-09-12 22:23 client\client.pro
文件 10236 2010-09-12 22:23 client\client.pro.user
文件 293 2010-09-12 22:23 client\describle_msg.txt
文件 254808 2010-09-12 22:23 client\systemset.o
文件 384 2010-09-12 22:23 client\user.cpp
文件 4407 2010-09-12 22:23 client\dialog.cpp
文件 6011 2010-09-12 22:23 client\systemset.ui
文件 1036 2010-09-12 22:23 client\dialog.h
文件 24823 2010-09-12 22:23 client\ui_dialog.h
文件 446344 2010-09-12 22:23 client\dialog.o
文件 35333 2010-09-12 22:23 client\dialog.ui
文件 2589 2010-09-12 22:23 client\dialog_chatroom.cpp
文件 920 2010-09-12 22:23 client\dialog_chatroom.h
文件 323700 2010-09-12 22:23 client\dialog_chatroom.o
文件 8781 2010-09-12 22:23 client\dialog_chatroom.ui
文件 424 2010-09-12 22:23 client\dialog_notes.cpp
文件 433 2010-09-12 22:23 client\dialog_notes.h
文件 238808 2010-09-12 22:23 client\dialog_notes.o
文件 1888 2010-09-12 22:23 client\dialog_notes.ui
文件 321 2010-09-12 22:23 client\user.h
文件 2372 2010-09-12 22:23 client\user.o
文件 65948 2010-09-12 22:23 client\fly.jpg
文件 202 2010-09-12 22:23 client\main.cpp
文件 230224 2010-09-12 22:23 client\main.o
文件 8421 2010-09-12 22:23 client\mainwindow.cpp
文件 3184 2010-09-12 22:23 client\ui_dialog_notes.h
文件 1809 2010-09-12 22:23 client\mainwindow.h
文件 24897 2010-09-12 22:23 client\ui_mainwindow.h
............此处省略22个文件信息
相关资源
- websocket实现单聊和群聊
- 基于Application和session的聊天室
- Spring Boot整合websocket实现群聊,点对点
- QT实现群聊私聊
- QQ聊天室 包括私聊功能
- Wechat微信通讯协议可图片、自动回复
- 课程设计 linux c 聊天程序公聊 私聊
- 局域网聊天室资源百度云链接
- GTK多线程聊天工具
- springboot webscoket 实现群聊,点对点聊
- linux_c_qq语音聊源代码
- 基于组播的局域网聊天程序
- Linuxc聊天室,有日志功能可群聊可私
- socket,多线程实现群聊
- vue项目+hbuilder打包实现app自动检测更
- 无需服务器的局域网群聊工具.
- websocket 通信demo实现实时对话 多人群
- WCF双工通讯聊天传文件(支持任意客
- Iayim查找好友查找群聊
评论
共有 条评论