资源简介
1.进去server文件夹,在终端输入"./server"启动服务器程序
2.进入client文件夹,在终端输入"./client"启动客户端程序,在连接服务器窗口可不必输入端口号。(由于能力有限,未对ip地址的输入格式作限制,希望你们能够通过使用正则表达式来完善本程序)
声明:本人精力有限,暂做到这,肯定还不完善,希望大家一起更正
代码片段和文件信息
/****************************************************************************
** Form implementation generated from reading ui file ‘chatform.ui‘
**
** Created by: The User Interface Compiler ($Id: qt/main.cpp 3.3.8 edited Jan 11 14:47 $)
**
** WARNING! All changes made in this file will be lost!
****************************************************************************/
#include “chatform.h“
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#define REMOTE_PORT 6789
#define LOCAL_PORT 9875
typedef struct user
{
char id[15];
char ip[16];
}Friend;
Friend friends[4];
int num=-1;
/*
* Constructs a chatForm as a child of ‘parent‘ with the
* name ‘name‘ and widget flags set to ‘f‘.
*
* The dialog will by default be modeless unless you set ‘modal‘ to
* TRUE to construct a modal dialog.
*/
chatForm::chatForm( Socket &sQWidget* parent const char* name bool modal WFlags fl )
: QDialog( parent name modal fl )sock(s)
{
if ( !name )
setName( “chatForm“ );
tlable = new QLabel( this “tlable“ );
tlable->setGeometry( QRect( 20 230 60 31 ) );
sendBtn = new QPushButton( this “sendBtn“ );
sendBtn->setGeometry( QRect( 230 371 60 30 ) );
closeBtn = new QPushButton( this “closeBtn“ );
closeBtn->setGeometry( QRect( 330 370 61 31 ) );
chatTxt = new QTextEdit( this “chatTxt“ );
chatTxt->setGeometry( QRect( 10 10 391 210 ) );
chatTxt->setVScrollBarMode( QTextEdit::AlwaysOn );
chatTxt->setHScrollBarMode( QTextEdit::AlwaysOff );
editTxt = new QTextEdit( this “editTxt“ );
editTxt->setGeometry( QRect( 10 270 391 90 ) );
editTxt->setHScrollBarMode( QTextEdit::AlwaysOff );
userlist = new QComboBox( FALSE this “userlist“ );
userlist->setGeometry( QRect( 80 230 131 31 ) );
languageChange();
resize( QSize(418 402).expandedTo(minimumSizeHint()) );
clearWState( WState_Polished );
isChat=false;
isToQuit=false;
isQuited=false;
// signals and slots connections
//connect( closeBtn SIGNAL( clicked() ) this SLOT( close() ) );
connect( closeBtn SIGNAL( clicked() ) this SLOT( ToClose() ) );
connect( closeBtn SIGNAL( clicked() ) chatTxt SLOT( clear() ) );
connect( this SIGNAL( IsQuit() ) this SLOT( close() ) );
connect( sendBtn SIGNAL( clicked() ) this SLOT( ChatTo()));
connect(thisSIGNAL(toGetUserList())thisSLOT(GetUserList()));
connect(thisSIGNAL(toChat())thisSLOT(Chat()));
connect( sendBtn SIGNAL( clicked() ) editTxt SLOT( clear() ) );
connect( sendBtn SIGNAL( clicked() ) editTxt SLOT( setFocus() ) );
}
/*
* Destroys the object and frees any allocated resources
*/
chatForm::~chatForm()
{
// no need to delete child widgets Qt does it all for us
}
/*
* Sets the strings of the
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 6161 2009-03-22 11:38 chatApp\client\chatform.cpp
文件 6230 2009-03-22 11:34 chatApp\client\chatform.cpp~
文件 1626 2009-03-18 20:57 chatApp\client\chatform.h
文件 1604 2009-03-18 16:47 chatApp\client\chatform.h~
文件 154392 2009-03-22 11:35 chatApp\client\chatform.o
文件 645262 2009-03-22 11:35 chatApp\client\client
文件 382 2009-03-17 21:02 chatApp\client\client.pro
文件 24352 2009-03-17 21:36 chatApp\client\index.html
文件 4566 2009-03-22 08:46 chatApp\client\li
文件 4582 2009-03-13 15:58 chatApp\client\li
文件 1441 2009-03-13 15:58 chatApp\client\li
文件 1456 2009-03-13 15:58 chatApp\client\li
文件 150256 2009-03-22 08:49 chatApp\client\li
文件 5079 2009-03-13 15:58 chatApp\client\li
文件 4721 2009-03-22 08:58 chatApp\client\loginForm.cpp
文件 4718 2009-03-22 08:57 chatApp\client\loginForm.cpp~
文件 1572 2009-03-22 08:47 chatApp\client\loginForm.h
文件 1571 2009-03-17 17:52 chatApp\client\loginForm.h~
文件 151796 2009-03-22 09:45 chatApp\client\loginForm.o
文件 4660 2009-03-13 15:58 chatApp\client\loginForm.ui
文件 269 2009-03-13 15:58 chatApp\client\main.cpp
文件 352 2009-03-13 15:58 chatApp\client\main.cpp~
文件 80672 2009-03-22 08:49 chatApp\client\main.o
文件 4477 2009-03-17 21:02 chatApp\client\Makefile
文件 4234 2009-03-18 21:00 chatApp\client\moc_chatform.cpp
文件 189272 2009-03-18 21:00 chatApp\client\moc_chatform.o
文件 4556 2009-03-13 15:58 chatApp\client\moc_li
文件 189504 2009-03-22 08:49 chatApp\client\moc_li
文件 4592 2009-03-22 08:49 chatApp\client\moc_loginForm.cpp
文件 189492 2009-03-22 08:49 chatApp\client\moc_loginForm.o
............此处省略22个文件信息
- 上一篇:S3C2410芯片LED历程
- 下一篇:CListCtrl的使用
相关资源
- arm-linux-gnueabi-4.5.1.tar.bz2_linux平台
- Ubuntu64位的交叉编译工具arm-linux-gcc-
- Linux系统下安装gstreamer环境
- 一个linux下C实现的线程池源码
- 嵌入式路由器
- LINUX下完整的人脸识别算法保证可以用
- elasticsearch-6.4.3-全套ela+源码+ik分词器
- 韦东山嵌入式linux应用开发完全手册视
- linux下LaTex配置完全指南
- libpcap-1.9.0
- linux平台 DHT11驱动程序
- ZigBee 协议在Linux上的实现
- 使用Linux的V4L2读取摄像头数据+Opencv图
- 嵌入式Linux系统移植开发-1基于Yocto构
- linux下的QT串口通信
- linux的外文文献
- 老段带你学-鸟哥的Linux私房菜基础+服
- zw_linux0.11带注解源代码.zip
- 基于Linux平台的串口数据接收程序
- ntpdate-4.2.8p12-1.x86_64.rpm
- 东北大学Linux实验报告及代码sk.zip
- understand5.952 for linux破解安装教程
- linux字符设备驱动代码,副实验报告很
- telnet-server-0.17-47.el6.x86_64.rpm和telnet-
- ST7701_854*480显示屏初始化参数
- 最新vivado2019版本,win和linux都有,安
- linux上实现多进程和多线程实现同步互
- linux下使用minicom连接开发板.doc
- ARM linux 和上位机windows10进行TCP/IP网络
- Linux系统下基于Qt的局域网即时通信系
评论
共有 条评论