├── FdogClient ├── .qmake.stash ├── Fdog.pro ├── Fdog.pro.user ├── Fdog.pro.user.add54ce ├── FdogUserFile │ ├── 12345678 │ │ ├── 12345678.jpg │ │ └── data.txt │ ├── 19070015 │ │ ├── 19070015.jpg │ │ └── data.txt │ ├── 23101116 │ │ ├── 23101116.jpg │ │ └── data.txt │ └── 61673228 │ │ ├── 61673228.jpg │ │ └── data.txt ├── Makefile ├── Makefile.Debug ├── Makefile.Release ├── addfriend.cpp ├── addfriend.h ├── addfriend.ui ├── agreefriend.cpp ├── agreefriend.h ├── agreefriend.ui ├── chat.cpp ├── chat.h ├── chat.ui ├── globalobserver.cpp ├── globalobserver.h ├── lib │ ├── 036428b265240e27035db396a284521a.gif │ ├── 10001.jpg │ ├── add.png │ ├── anquan.png │ ├── back.gif │ ├── background.png │ ├── background2.png │ ├── body.png │ ├── caijian.png │ ├── close.png │ ├── delete.png │ ├── delete2.png │ ├── dengji.png │ ├── down.png │ ├── error.png │ ├── erweima.png │ ├── fangda.png │ ├── fdog.png │ ├── fdog2.png │ ├── fdogicon.png │ ├── guanbi.png │ ├── icon2505897252.png │ ├── jianpan.png │ ├── jietou.png │ ├── jietou1.png │ ├── jietou2.png │ ├── kaifdog.png │ ├── kaisuo.png │ ├── likaishijian.png │ ├── lixianim.png │ ├── mainicon.png │ ├── mainicon2.png │ ├── manglu.png │ ├── max.png │ ├── mian.gif │ ├── mian2.gif │ ├── mianxingtubiao_zhendong.png │ ├── min.png │ ├── network.png │ ├── qusefdogicon.png │ ├── sangangy.png │ ├── search.png │ ├── setting.png │ ├── shijian.png │ ├── skin.png │ ├── suo.png │ ├── svip.png │ ├── taiyang.png │ ├── tianjiahaoyou.png │ ├── verify1.png │ ├── verify2.png │ ├── weixiao.png │ ├── wurao.png │ ├── xiaolian.png │ ├── xing1.png │ ├── yinshenim.png │ ├── yueliang.png │ ├── zaixian.png │ └── zuixiaohua.png ├── libres.qrc ├── login.cpp ├── login.h ├── login.ui ├── main.cpp ├── mainwindow.cpp ├── mainwindow.h ├── mainwindow.ui ├── query.cpp ├── query.h ├── query.ui ├── settingcolor.cpp ├── settingcolor.h ├── settingcolor.ui ├── trayiconmenu.cpp ├── trayiconmenu.h ├── traywidget.cpp ├── traywidget.h ├── traywidget.ui ├── ui_addfriend.h ├── ui_agreefriend.h ├── ui_chat.h ├── ui_login.h ├── ui_mainwindow.h ├── ui_query.h ├── ui_settingcolor.h ├── ui_traywidget.h ├── ui_verify.h ├── usersql.cpp ├── usersql.h ├── verify.cpp ├── verify.h └── verify.ui ├── FdogServer ├── .qmake.stash ├── Makefile ├── Makefile.Debug ├── Makefile.Release ├── lib.qrc ├── main.cpp ├── mainwindow.cpp ├── mainwindow.h ├── mainwindow.ui ├── ui_mainwindow.h ├── untitled2.pro ├── untitled2.pro.user ├── untitled2.pro.user.add54ce ├── usersql.cpp └── usersql.h ├── FdogSql └── fdogsql.sql ├── FdogWeb └── FdogMaven │ └── src │ └── main │ ├── java │ └── com │ │ ├── fdog │ │ ├── AuthCode.java │ │ └── FdogMaven.java │ │ ├── fdogrand │ │ └── Rand.java │ │ └── filter │ │ └── Filter.java │ └── webapp │ ├── WEB-INF │ ├── lib │ │ └── mysql-connector-java-5.1.34.jar │ └── web.xml │ ├── css │ ├── fdog.css │ └── index_1.css │ ├── download.html │ ├── home.jsp │ ├── img │ ├── 2046597.jpg │ ├── anzhuologo.png │ ├── background.jpg │ ├── background01.png │ ├── background02.png │ ├── background03.png │ ├── background04.png │ ├── down.png │ ├── favicon1.ico │ ├── fdogicon.png │ ├── fdogpcandroid.png │ ├── mainicon.png │ ├── pc.png │ ├── phone.png │ ├── succeed.png │ ├── suo.png │ └── up.png │ ├── index.jsp │ ├── js │ ├── backv.js │ └── check.js │ └── success.jsp ├── LICENSE └── README.md /FdogClient/.qmake.stash: -------------------------------------------------------------------------------- 1 | QMAKE_CXX.INCDIRS = \ 2 | D:\\VisualStudio2015\\VC\\INCLUDE \ 3 | D:\\VisualStudio2015\\VC\\ATLMFC\\INCLUDE \ 4 | "C:\\Program Files (x86)\\Windows Kits\\10\\include\\10.0.10240.0\\ucrt" \ 5 | "C:\\Program Files (x86)\\Windows Kits\\NETFXSDK\\4.6.1\\include\\um" \ 6 | "C:\\Program Files (x86)\\Windows Kits\\8.1\\include\\\\shared" \ 7 | "C:\\Program Files (x86)\\Windows Kits\\8.1\\include\\\\um" \ 8 | "C:\\Program Files (x86)\\Windows Kits\\8.1\\include\\\\winrt" \ 9 | "C:\\Program Files (x86)\\Windows Kits\\8.1\\Include" 10 | QMAKE_CXX.LIBDIRS = \ 11 | D:\\VisualStudio2015\\VC\\LIB\\amd64 \ 12 | D:\\VisualStudio2015\\VC\\ATLMFC\\LIB\\amd64 \ 13 | "C:\\Program Files (x86)\\Windows Kits\\10\\lib\\10.0.10240.0\\ucrt\\x64" \ 14 | "C:\\Program Files (x86)\\Windows Kits\\NETFXSDK\\4.6.1\\lib\\um\\x64" \ 15 | "C:\\Program Files (x86)\\Windows Kits\\8.1\\lib\\winv6.3\\um\\x64" 16 | QMAKE_CXX.QT_COMPILER_STDCXX = 199711L 17 | QMAKE_CXX.QMAKE_MSC_VER = 1900 18 | QMAKE_CXX.QMAKE_MSC_FULL_VER = 190024215 19 | QMAKE_CXX.COMPILER_MACROS = \ 20 | QT_COMPILER_STDCXX \ 21 | QMAKE_MSC_VER \ 22 | QMAKE_MSC_FULL_VER 23 | -------------------------------------------------------------------------------- /FdogClient/Fdog.pro: -------------------------------------------------------------------------------- 1 | #------------------------------------------------- 2 | # 3 | # Project created by QtCreator 2021-03-20T22:04:42 4 | # 5 | #------------------------------------------------- 6 | 7 | QT += core gui 8 | 9 | greaterThan(QT_MAJOR_VERSION, 4): QT += widgets 10 | 11 | TARGET = Fdog 12 | TEMPLATE = app 13 | 14 | # The following define makes your compiler emit warnings if you use 15 | # any feature of Qt which has been marked as deprecated (the exact warnings 16 | # depend on your compiler). Please consult the documentation of the 17 | # deprecated API in order to know how to port your code away from it. 18 | DEFINES += QT_DEPRECATED_WARNINGS 19 | 20 | # You can also make your code fail to compile if you use deprecated APIs. 21 | # In order to do so, uncomment the following line. 22 | # You can also select to disable deprecated APIs only up to a certain version of Qt. 23 | #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 24 | 25 | 26 | SOURCES += \ 27 | main.cpp \ 28 | mainwindow.cpp \ 29 | login.cpp \ 30 | usersql.cpp \ 31 | query.cpp \ 32 | chat.cpp \ 33 | settingcolor.cpp \ 34 | addfriend.cpp \ 35 | globalobserver.cpp \ 36 | verify.cpp \ 37 | traywidget.cpp \ 38 | agreefriend.cpp 39 | 40 | HEADERS += \ 41 | mainwindow.h \ 42 | login.h \ 43 | usersql.h \ 44 | query.h \ 45 | chat.h \ 46 | settingcolor.h \ 47 | addfriend.h \ 48 | globalobserver.h \ 49 | verify.h \ 50 | traywidget.h \ 51 | agreefriend.h 52 | 53 | FORMS += \ 54 | mainwindow.ui \ 55 | login.ui \ 56 | query.ui \ 57 | chat.ui \ 58 | settingcolor.ui \ 59 | addfriend.ui \ 60 | verify.ui \ 61 | traywidget.ui \ 62 | agreefriend.ui 63 | 64 | RESOURCES += \ 65 | libres.qrc 66 | 67 | 68 | QT +=sql 69 | 70 | QT += network 71 | 72 | CONFIG += resources_big 73 | 74 | QMAKE_CXXFLAGS += /MP 75 | 76 | -------------------------------------------------------------------------------- /FdogClient/FdogUserFile/12345678/12345678.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HuaGouFdog/FdogInstantMessaging/4d2e9a12d90dfc79a90d8367b373df8828578f06/FdogClient/FdogUserFile/12345678/12345678.jpg -------------------------------------------------------------------------------- /FdogClient/FdogUserFile/12345678/data.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HuaGouFdog/FdogInstantMessaging/4d2e9a12d90dfc79a90d8367b373df8828578f06/FdogClient/FdogUserFile/12345678/data.txt -------------------------------------------------------------------------------- /FdogClient/FdogUserFile/19070015/19070015.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HuaGouFdog/FdogInstantMessaging/4d2e9a12d90dfc79a90d8367b373df8828578f06/FdogClient/FdogUserFile/19070015/19070015.jpg -------------------------------------------------------------------------------- /FdogClient/FdogUserFile/19070015/data.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HuaGouFdog/FdogInstantMessaging/4d2e9a12d90dfc79a90d8367b373df8828578f06/FdogClient/FdogUserFile/19070015/data.txt -------------------------------------------------------------------------------- /FdogClient/FdogUserFile/23101116/23101116.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HuaGouFdog/FdogInstantMessaging/4d2e9a12d90dfc79a90d8367b373df8828578f06/FdogClient/FdogUserFile/23101116/23101116.jpg -------------------------------------------------------------------------------- /FdogClient/FdogUserFile/23101116/data.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HuaGouFdog/FdogInstantMessaging/4d2e9a12d90dfc79a90d8367b373df8828578f06/FdogClient/FdogUserFile/23101116/data.txt -------------------------------------------------------------------------------- /FdogClient/FdogUserFile/61673228/61673228.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HuaGouFdog/FdogInstantMessaging/4d2e9a12d90dfc79a90d8367b373df8828578f06/FdogClient/FdogUserFile/61673228/61673228.jpg -------------------------------------------------------------------------------- /FdogClient/FdogUserFile/61673228/data.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HuaGouFdog/FdogInstantMessaging/4d2e9a12d90dfc79a90d8367b373df8828578f06/FdogClient/FdogUserFile/61673228/data.txt -------------------------------------------------------------------------------- /FdogClient/addfriend.cpp: -------------------------------------------------------------------------------- 1 | #include "addfriend.h" 2 | #include "ui_addfriend.h" 3 | #if _MSC_VER >= 1600 4 | #pragma execution_character_set("utf-8") 5 | #endif 6 | Addfriend::Addfriend(QPixmap icon,QString otheraccount,QString name,QString account,QString sex, QString age,QString Profession,QWidget *parent) : 7 | QWidget(parent), 8 | ui(new Ui::Addfriend) 9 | { 10 | ui->setupUi(this); 11 | setWindowFlags (Qt::FramelessWindowHint); 12 | setAttribute(Qt::WA_TranslucentBackground); 13 | Globalobserver::setAddfriendp(this); 14 | //显示该用户信息 15 | this->setOtheraccount(otheraccount); 16 | this->setAccount(account); 17 | this->setName(name); 18 | ui->pushButton_3->setIcon(QIcon(icon)); 19 | ui->pushButton_3->setIconSize(QSize(70,70)); 20 | ui->label_8->setText(name); 21 | ui->label_9->setText(otheraccount); 22 | ui->label_10->setText("性别:"+sex); 23 | ui->label_11->setText("年龄:"+age); 24 | ui->label_12->setText("职业:"+Profession); 25 | sqconn.connData(); 26 | sqconn.queryUserInfo(account); 27 | ui->comboBox->addItem(this->getName()); 28 | QStringList groupings = sqconn.getGrouping(); 29 | ui->comboBox_2->addItems(groupings); 30 | } 31 | 32 | Addfriend::~Addfriend() 33 | { 34 | delete ui; 35 | } 36 | 37 | void Addfriend::paintEvent(QPaintEvent *e) 38 | { 39 | Q_UNUSED(e) 40 | QPainter painter(this); 41 | QPixmap pixmap(":/lib/background.png");//做好的图 42 | qDrawBorderPixmap(&painter, this->rect(), QMargins(0, 0, 0, 0), pixmap); 43 | QRect rect(this->rect().x()+8, this->rect().y()+8, this->rect().width()-16, this->rect().height()-16); 44 | painter.fillRect(rect, QColor(255, 255, 255)); 45 | } 46 | 47 | void Addfriend::mousePressEvent(QMouseEvent *event) 48 | { 49 | isPressedWidget = true; // 当前鼠标按下的即是QWidget而非界面上布局的其它控件 50 | last = event->globalPos(); 51 | } 52 | 53 | void Addfriend::mouseMoveEvent(QMouseEvent *event) 54 | { 55 | if (isPressedWidget) 56 | { 57 | int dx = event->globalX() - last.x(); 58 | int dy = event->globalY() - last.y(); 59 | last = event->globalPos(); 60 | move(x()+dx, y()+dy); 61 | } 62 | } 63 | 64 | void Addfriend::mouseReleaseEvent(QMouseEvent *event) 65 | { 66 | int dx = event->globalX() - last.x(); 67 | int dy = event->globalY() - last.y(); 68 | move(x()+dx, y()+dy); 69 | isPressedWidget = false; // 鼠标松开时,置为false 70 | } 71 | 72 | void Addfriend::on_pushButton_clicked() 73 | { 74 | ui->stackedWidget->setCurrentIndex(ui->stackedWidget->currentIndex()+1); 75 | switch(ui->stackedWidget->currentIndex()) 76 | { 77 | case 0: 78 | ui->pushButton_2->setText("关闭"); 79 | break; 80 | case 1: 81 | ui->pushButton_2->setText("取消"); 82 | break; 83 | case 2: 84 | ui->pushButton_2->setText("完成"); 85 | ui->pushButton->hide(); 86 | QString otheraccount = this->getOtheraccount(); //发送方 87 | QString account = this->getAccount(); //接收方 88 | QString info = ui->lineEdit->text(); //验证信息 89 | QString name = ui->comboBox->currentText();//备注(默认网名) 90 | QString grouping = ui->comboBox_2->currentText();//分组 91 | QDateTime curDateTime=QDateTime::currentDateTime(); 92 | QString time = curDateTime.toString("MM.dd"); 93 | if(info=="")info="你好"; 94 | //消息格式:接收方+添加方+验证信息+备注名字(默认网名)+分组+消息类型 95 | QString data = otheraccount+account+info+":"+name+":"+grouping+"yan"; 96 | sqconn.setverify(time,account,"等待同意",name,grouping,otheraccount); 97 | //qDebug()<<"发送验证消息"<close(); 110 | } 111 | 112 | void Addfriend::on_toolButton_2_clicked() 113 | { 114 | this->hide(); 115 | } 116 | 117 | void Addfriend::on_toolButton_3_clicked() 118 | { 119 | this->close(); 120 | } 121 | 122 | QString Addfriend::getOtheraccount() const 123 | { 124 | return otheraccount; 125 | } 126 | 127 | void Addfriend::setOtheraccount(const QString &value) 128 | { 129 | otheraccount = value; 130 | } 131 | 132 | QString Addfriend::getAccount() const 133 | { 134 | return account; 135 | } 136 | 137 | void Addfriend::setAccount(const QString &value) 138 | { 139 | account = value; 140 | } 141 | 142 | QString Addfriend::getName() const 143 | { 144 | return name; 145 | } 146 | 147 | void Addfriend::setName(const QString &value) 148 | { 149 | name = value; 150 | } 151 | -------------------------------------------------------------------------------- /FdogClient/addfriend.h: -------------------------------------------------------------------------------- 1 | #ifndef ADDFRIEND_H 2 | #define ADDFRIEND_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include"mainwindow.h" 8 | #include"usersql.h" 9 | #include"globalobserver.h" 10 | namespace Ui { 11 | class Addfriend; 12 | } 13 | 14 | class Addfriend : public QWidget 15 | { 16 | Q_OBJECT 17 | QString otheraccount; 18 | QString account; 19 | Usersql sqconn; 20 | QString name; 21 | QPoint last; //窗口拖动用变量 22 | bool isPressedWidget; 23 | 24 | public: 25 | explicit Addfriend(QPixmap icon,QString otheraccount,QString name,QString account,QString sex, QString age,QString Profession,QWidget *parent = 0); 26 | ~Addfriend(); 27 | void paintEvent(QPaintEvent *e); 28 | void mousePressEvent(QMouseEvent *event);//鼠标点击 29 | void mouseMoveEvent(QMouseEvent *event);//鼠标移动 30 | void mouseReleaseEvent(QMouseEvent *event);//鼠标释放 31 | 32 | QString getOtheraccount() const; 33 | void setOtheraccount(const QString &value); 34 | 35 | QString getAccount() const; 36 | void setAccount(const QString &value); 37 | 38 | QString getName() const; 39 | void setName(const QString &value); 40 | 41 | signals: 42 | void sendaddinfo(QString data); 43 | 44 | private slots: 45 | void on_pushButton_clicked(); 46 | 47 | void on_pushButton_2_clicked(); 48 | 49 | void on_toolButton_2_clicked(); 50 | 51 | void on_toolButton_3_clicked(); 52 | 53 | private: 54 | Ui::Addfriend *ui; 55 | }; 56 | 57 | #endif // ADDFRIEND_H 58 | -------------------------------------------------------------------------------- /FdogClient/agreefriend.cpp: -------------------------------------------------------------------------------- 1 | #include "agreefriend.h" 2 | #include "ui_agreefriend.h" 3 | #if _MSC_VER >= 1600 4 | #pragma execution_character_set("utf-8") 5 | #endif 6 | Agreefriend::Agreefriend(QString account,QString otheraccount,QString name,QStringList grouping,QWidget *parent) : 7 | QWidget(parent), 8 | ui(new Ui::Agreefriend) 9 | { 10 | ui->setupUi(this); 11 | this->account = account; 12 | this->otheraccount = otheraccount; 13 | ui->lineEdit->setText(name); 14 | ui->comboBox->addItems(grouping); 15 | Globalobserver::setAgreefriend(this); 16 | connect(Globalobserver::getAgreefriend(),SIGNAL(updategrouping(QString,QString,QString,QString)), 17 | Globalobserver::getMainwindowp(),SLOT(updatamaingrouping(QString,QString,QString,QString))); 18 | 19 | connect(Globalobserver::getAgreefriend(),SIGNAL(updateverify(QString,QString)), 20 | Globalobserver::getMainwindowp(),SLOT(updatamainverify(QString,QString))); 21 | } 22 | 23 | Agreefriend::~Agreefriend() 24 | { 25 | delete ui; 26 | } 27 | 28 | void Agreefriend::on_pushButton_clicked() 29 | { 30 | //同意 31 | //数据库找到发起方,更新数据,在对应分组增加该好友 32 | //QString time, QString otheraccount, QString sate, QString name, QString grouping, QString account 33 | Usersql sqconn; 34 | sqconn.connData(); 35 | sqconn.getverify("今日",this->otheraccount,"同意",ui->lineEdit->text(),ui->comboBox->currentText(),this->account); 36 | //数据库找到目的方 37 | //两个作用,第一个是告诉自己更新列表,第二个是告诉对方更新列表 38 | //通知主界面更新ui 39 | emit updategrouping(this->otheraccount,this->account,ui->lineEdit->text(),ui->comboBox->currentText());//更新数据库内容 40 | //emit updateverify(this->otheraccount,this->account);//更新列表显示内容 41 | this->hide(); 42 | } 43 | 44 | void Agreefriend::on_pushButton_2_clicked() 45 | { 46 | Usersql sqconn; 47 | sqconn.connData(); 48 | sqconn.getverify("今日",this->otheraccount,"拒绝",ui->lineEdit->text(),ui->comboBox->currentText(),this->account); 49 | //拒绝 50 | emit updateverify(this->otheraccount,this->account); 51 | //两个作用,第一个是告诉自己更新列表,第二个是告诉对方更新列表 52 | //通知主界面更新ui 53 | this->hide(); 54 | } 55 | -------------------------------------------------------------------------------- /FdogClient/agreefriend.h: -------------------------------------------------------------------------------- 1 | #ifndef AGREEFRIEND_H 2 | #define AGREEFRIEND_H 3 | class Globalobserver; 4 | #include 5 | #include"usersql.h" 6 | #include"globalobserver.h" 7 | namespace Ui { 8 | class Agreefriend; 9 | } 10 | 11 | class Agreefriend : public QWidget 12 | { 13 | Q_OBJECT 14 | private: 15 | QString account; 16 | QString otheraccount; 17 | 18 | public: 19 | explicit Agreefriend(QString account,QString otheraccount,QString name,QStringList grouping,QWidget *parent = 0); 20 | ~Agreefriend(); 21 | 22 | signals: 23 | void updategrouping(QString otheraccount,QString account,QString name,QString grouping); 24 | void updateverify(QString otheraccount,QString account); 25 | private slots: 26 | void on_pushButton_clicked(); 27 | 28 | void on_pushButton_2_clicked(); 29 | 30 | private: 31 | Ui::Agreefriend *ui; 32 | }; 33 | 34 | #endif // AGREEFRIEND_H 35 | -------------------------------------------------------------------------------- /FdogClient/agreefriend.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | Agreefriend 4 | 5 | 6 | 7 | 0 8 | 0 9 | 322 10 | 183 11 | 12 | 13 | 14 | 15 | Microsoft YaHei 16 | PreferAntialias 17 | 18 | 19 | 20 | Form 21 | 22 | 23 | *{font-family:Microsoft YaHei;} 24 | 25 | 26 | 27 | 28 | 40 29 | 20 30 | 61 31 | 31 32 | 33 | 34 | 35 | 36 | Microsoft YaHei 37 | PreferAntialias 38 | 39 | 40 | 41 | 备注: 42 | 43 | 44 | 45 | 46 | 47 | 40 48 | 60 49 | 61 50 | 31 51 | 52 | 53 | 54 | 55 | Microsoft YaHei 56 | PreferAntialias 57 | 58 | 59 | 60 | 分组: 61 | 62 | 63 | 64 | 65 | 66 | 100 67 | 60 68 | 151 69 | 31 70 | 71 | 72 | 73 | 74 | Microsoft YaHei 75 | PreferAntialias 76 | 77 | 78 | 79 | 80 | 81 | 82 | 100 83 | 20 84 | 151 85 | 31 86 | 87 | 88 | 89 | 90 | Microsoft YaHei 91 | PreferAntialias 92 | 93 | 94 | 95 | 96 | 97 | 98 | 50 99 | 120 100 | 91 101 | 31 102 | 103 | 104 | 105 | 106 | Microsoft YaHei 107 | PreferAntialias 108 | 109 | 110 | 111 | 同意 112 | 113 | 114 | 115 | 116 | 117 | 170 118 | 120 119 | 91 120 | 31 121 | 122 | 123 | 124 | 125 | Microsoft YaHei 126 | PreferAntialias 127 | 128 | 129 | 130 | 拒绝 131 | 132 | 133 | 134 | 135 | 136 | 137 | -------------------------------------------------------------------------------- /FdogClient/chat.cpp: -------------------------------------------------------------------------------- 1 | #include "chat.h" 2 | #include "ui_chat.h" 3 | #include 4 | #include 5 | #include 6 | #include 7 | #if _MSC_VER >= 1600 8 | #pragma execution_character_set("utf-8") 9 | #endif 10 | Chat::Chat(QPixmap mypixmap,QPixmap pixmap,QString otheraccount,QString name,MainWindow * main,QWidget *parent) : 11 | QWidget(parent), 12 | ui(new Ui::Chat) 13 | { 14 | ui->setupUi(this); 15 | setWindowFlags (Qt::FramelessWindowHint);//隐藏标题栏 16 | setAttribute(Qt::WA_DeleteOnClose); 17 | setWindowFlag(Qt::CoverWindow); 18 | setAttribute(Qt::WA_TranslucentBackground); 19 | this->otheraccount=otheraccount; 20 | this->name=name; 21 | this->setWindowTitle(name); 22 | tcpClient=new QTcpSocket(this); 23 | LabSocketate = new QLabel("Socket状态:"); 24 | LabSocketate->setMinimumWidth(250); 25 | this->setWindowIcon(QIcon(pixmap)); 26 | this->pixmap=pixmap; 27 | this->mypixmap=mypixmap; 28 | //ui->statusBar->addWidget(LabSocketate); 29 | //QString localIP = getLocalIP(); 30 | ui->label->setText(this->name); 31 | //接收主窗口的消息信号 32 | mainwindow = main; 33 | connect(mainwindow,SIGNAL(sendChatData(QString)),this,SLOT(onSocketReadyRead(QString))); 34 | } 35 | 36 | void Chat::paintEvent(QPaintEvent *e) 37 | { 38 | Q_UNUSED(e) 39 | QPainter painter(this); 40 | QPixmap pixmap(":/lib/background.png");//做好的图 41 | qDrawBorderPixmap(&painter, this->rect(), QMargins(0, 0, 0, 0), pixmap); 42 | QRect rect(this->rect().x()+8, this->rect().y()+8, this->rect().width()-16, this->rect().height()-16); 43 | painter.fillRect(rect, QColor(255, 255, 255,0)); 44 | } 45 | 46 | void Chat::mousePressEvent(QMouseEvent *event) 47 | { 48 | isPressedWidget = true; // 当前鼠标按下的即是QWidget而非界面上布局的其它控件 49 | last = event->globalPos(); 50 | } 51 | 52 | void Chat::mouseMoveEvent(QMouseEvent *event) 53 | { 54 | if (isPressedWidget) 55 | { 56 | int dx = event->globalX() - last.x(); 57 | int dy = event->globalY() - last.y(); 58 | last = event->globalPos(); 59 | move(x()+dx, y()+dy); 60 | } 61 | } 62 | 63 | void Chat::mouseReleaseEvent(QMouseEvent *event) 64 | { 65 | int dx = event->globalX() - last.x(); 66 | int dy = event->globalY() - last.y(); 67 | move(x()+dx, y()+dy); 68 | isPressedWidget = false; // 鼠标松开时,置为false 69 | } 70 | 71 | Chat::~Chat() 72 | { 73 | delete ui; 74 | 75 | } 76 | 77 | void Chat::closeEvent(QCloseEvent *e) 78 | { 79 | //qDebug()<<"关不掉"; 80 | //this->hide(); 81 | e->ignore(); 82 | e->accept(); 83 | } 84 | 85 | 86 | 87 | QString Chat::getLocalIP() 88 | { 89 | //获取本机IPv4地址 90 | QString hostName = QHostInfo::localHostName();//本机主机名 91 | QHostInfo hostInfo = QHostInfo::fromName(hostName); 92 | QString localIP=""; 93 | QList addList = hostInfo.addresses(); 94 | if(!addList.isEmpty()) 95 | { 96 | for(int i = 0;isetStyleSheet("background:rgba(0,0,0,0);"); 117 | widget->setFixedSize(660,50); 118 | QHBoxLayout *horLayout = new QHBoxLayout();//水平布局 119 | horLayout->setContentsMargins(0,0,0,0); 120 | horLayout->setSpacing(0); 121 | QPushButton * btnicon = new QPushButton(); 122 | btnicon->setFixedSize(55,40); 123 | btnicon->setIconSize(QSize(40,40)); 124 | btnicon->setStyleSheet("background:rgba(0,0,0,0);"); 125 | QLabel * label = new QLabel(data); 126 | label->setFont(font1); 127 | label->setStyleSheet("background-color: rgb(140, 105, 255);border-style:solid;border-width:2px;border-color: rgb(125, 242, 255);border-radius:10px;");// background-color: rgb(255, 123, 249); 128 | label->setTextInteractionFlags(Qt::TextSelectableByMouse); 129 | label->setMaximumHeight(40); 130 | if(i==1) 131 | { 132 | label->setAlignment(Qt::AlignVCenter|Qt::AlignLeft); 133 | horLayout->addWidget(btnicon); 134 | horLayout->addWidget(label); 135 | horLayout->addStretch(); 136 | btnicon->setIcon(this->pixmap); 137 | } 138 | else 139 | { 140 | label->setAlignment(Qt::AlignVCenter|Qt::AlignRight); 141 | horLayout->addStretch(); 142 | horLayout->addWidget(label); 143 | horLayout->addWidget(btnicon); 144 | btnicon->setIcon(this->mypixmap); 145 | } 146 | widget->setLayout(horLayout); 147 | return widget; 148 | } 149 | 150 | void Chat::onSocketStateChange(QAbstractSocket::SocketState socketState) 151 | { 152 | switch (socketState) { 153 | case QAbstractSocket::UnconnectedState: 154 | LabSocketate->setText("scoket状态:UnconnectedState"); 155 | break; 156 | case QAbstractSocket::HostLookupState: 157 | LabSocketate->setText("scoket状态:HostLookupState"); 158 | break; 159 | case QAbstractSocket::ConnectingState: 160 | LabSocketate->setText("scoket状态:ConnectingState"); 161 | break; 162 | case QAbstractSocket::ConnectedState: 163 | LabSocketate->setText("scoket状态:ConnectedState"); 164 | break; 165 | case QAbstractSocket::BoundState: 166 | LabSocketate->setText("scoket状态:BoundState"); 167 | break; 168 | case QAbstractSocket::ClosingState: 169 | LabSocketate->setText("scoket状态:ClosingState"); 170 | break; 171 | case QAbstractSocket::ListeningState: 172 | LabSocketate->setText("scoket状态:ListeningState"); 173 | break; 174 | default: 175 | break; 176 | } 177 | } 178 | 179 | void Chat::onConnected() 180 | { 181 | // ui->plainTextEdit->appendPlainText("已连接服务器"); 182 | // ui->plainTextEdit->appendPlainText("**peer address"+tcpClient->peerAddress().toString()); 183 | // ui->plainTextEdit->appendPlainText("**peer port:"+QString::number(tcpClient->peerPort())); 184 | // ui->pushButton->setEnabled(false); 185 | // ui->pushButton_2->setEnabled(true); 186 | } 187 | 188 | void Chat::onDisconnected() 189 | { 190 | // ui->plainTextEdit->appendPlainText("已断开服务器的连接"); 191 | // ui->pushButton->setEnabled(true); 192 | // ui->pushButton_2->setEnabled(true); 193 | } 194 | 195 | void Chat::onSocketReadyRead(QString data) 196 | { 197 | QDateTime curDateTime=QDateTime::currentDateTime(); 198 | QString time = curDateTime.toString("hh:mm:ss"); 199 | if(this->isread==true) 200 | { 201 | data = data.mid(8); 202 | data = data.left(data.size() - 1); 203 | qDebug()<<"数据:"<verticalLayout_5->addWidget(widget); 207 | widget->show(); 208 | this->isread=false; 209 | } 210 | } 211 | 212 | void Chat::on_pushButton_3_clicked() 213 | { 214 | QDateTime curDateTime=QDateTime::currentDateTime(); 215 | QString time = curDateTime.toString("hh:mm:ss"); 216 | //数据格式为: 到达方账号,发送方账号,内容 217 | QString msg = this->getOtheraccount()+this->getAccount()+ui->lineEdit->text(); 218 | //我发送的内容显示在右边 219 | QWidget * widget = CreateWidgetL_R(2,ui->lineEdit->text()); 220 | ui->verticalLayout_5->addWidget(widget); 221 | widget->show(); 222 | ui->lineEdit->clear(); 223 | ui->lineEdit->setFocus(); 224 | QByteArray str = msg.toUtf8(); 225 | //发送信号 226 | emit sendData(str); 227 | } 228 | 229 | 230 | void Chat::on_pushButton_4_clicked() 231 | { 232 | on_toolButton_3_clicked(); 233 | } 234 | 235 | void Chat::on_toolButton_3_clicked() 236 | { 237 | this->close(); 238 | emit sendCount(this->otheraccount); 239 | } 240 | 241 | void Chat::on_toolButton_clicked() 242 | { 243 | this->hide(); 244 | } 245 | 246 | QString Chat::getName() const 247 | { 248 | return name; 249 | } 250 | 251 | void Chat::setName(const QString &value) 252 | { 253 | name = value; 254 | } 255 | 256 | bool Chat::getIsread() const 257 | { 258 | return isread; 259 | } 260 | 261 | void Chat::setIsread(bool value) 262 | { 263 | isread = value; 264 | } 265 | 266 | MainWindow *Chat::getMainwindow() const 267 | { 268 | return mainwindow; 269 | } 270 | 271 | void Chat::setMainwindow(MainWindow *value) 272 | { 273 | mainwindow = value; 274 | } 275 | 276 | QString Chat::getAccount() const 277 | { 278 | return account; 279 | } 280 | 281 | void Chat::setAccount(const QString &value) 282 | { 283 | account = value; 284 | } 285 | 286 | int Chat::getIsdown() const 287 | { 288 | return isdown; 289 | } 290 | 291 | void Chat::setIsdown(int value) 292 | { 293 | isdown = value; 294 | } 295 | 296 | QString Chat::getOtheraccount() const 297 | { 298 | return otheraccount; 299 | } 300 | 301 | void Chat::setOtheraccount(const QString &value) 302 | { 303 | otheraccount = value; 304 | } 305 | -------------------------------------------------------------------------------- /FdogClient/chat.h: -------------------------------------------------------------------------------- 1 | #ifndef CHAT_H 2 | #define CHAT_H 3 | class MainWindow; 4 | #include"mainwindow.h" 5 | #include 6 | #include 7 | #include 8 | namespace Ui { 9 | class Chat; 10 | } 11 | 12 | class Chat : public QWidget 13 | { 14 | Q_OBJECT 15 | private: 16 | QTcpSocket * tcpClient; 17 | QLabel * LabSocketate; 18 | QString name;//对方网名 19 | QString otheraccount;//对方账号 20 | QString account; //本身帐户 21 | MainWindow * mainwindow;//主窗口指针 22 | bool isread = false; 23 | int isdown; 24 | QPixmap pixmap; 25 | QPixmap mypixmap; 26 | QPoint last; //窗口拖动用变量 27 | bool isPressedWidget; 28 | public: 29 | explicit Chat(QPixmap mypixmap,QPixmap pixmap,QString otheraccount,QString name,MainWindow * main, QWidget *parent = 0); 30 | QString getLocalIP(); 31 | QWidget * CreateWidgetL_R(int i,QString data); 32 | void paintEvent(QPaintEvent *e); 33 | void mousePressEvent(QMouseEvent *event);//鼠标点击 34 | void mouseMoveEvent(QMouseEvent *event);//鼠标移动 35 | void mouseReleaseEvent(QMouseEvent *event);//鼠标释放 36 | ~Chat(); 37 | 38 | QString getName() const; 39 | void setName(const QString &value); 40 | 41 | QString getID() const; 42 | void setID(const QString &value); 43 | 44 | bool getIsread() const; 45 | void setIsread(bool value); 46 | 47 | MainWindow *getMainwindow() const; 48 | void setMainwindow(MainWindow *value); 49 | 50 | QString getAccount() const; 51 | void setAccount(const QString &value); 52 | 53 | int getIsdown() const; 54 | void setIsdown(int value); 55 | 56 | QString getOtheraccount() const; 57 | void setOtheraccount(const QString &value); 58 | 59 | signals: 60 | void sendData(QString str); 61 | void sendCount(QString otheraccount); 62 | private slots: 63 | void closeEvent(QCloseEvent *e); 64 | void onSocketStateChange(QAbstractSocket::SocketState socketState); 65 | void onConnected(); 66 | void onDisconnected(); 67 | void onSocketReadyRead(QString data); 68 | // void on_pushButton_clicked(); 69 | 70 | // void on_pushButton_2_clicked(); 71 | 72 | void on_pushButton_3_clicked(); 73 | 74 | 75 | void on_pushButton_4_clicked(); 76 | 77 | void on_toolButton_3_clicked(); 78 | 79 | void on_toolButton_clicked(); 80 | 81 | private: 82 | Ui::Chat *ui; 83 | }; 84 | 85 | #endif // CHAT_H 86 | -------------------------------------------------------------------------------- /FdogClient/globalobserver.cpp: -------------------------------------------------------------------------------- 1 | #include "globalobserver.h" 2 | #include 3 | #include 4 | #include 5 | MainWindow * Globalobserver::mainwindowp =NULL; 6 | Addfriend * Globalobserver::addfriendp =NULL; 7 | Agreefriend * Globalobserver::agreefriend=NULL; 8 | QList Globalobserver::listchat; 9 | QFont Globalobserver::font1; 10 | QFont Globalobserver::font2; 11 | MainWindow *Globalobserver::getMainwindowp() 12 | { 13 | return mainwindowp; 14 | } 15 | 16 | void Globalobserver::setMainwindowp(MainWindow *value) 17 | { 18 | mainwindowp = value; 19 | } 20 | 21 | Addfriend *Globalobserver::getAddfriendp() 22 | { 23 | return addfriendp; 24 | } 25 | 26 | void Globalobserver::setAddfriendp(Addfriend *value) 27 | { 28 | addfriendp = value; 29 | } 30 | 31 | Agreefriend *Globalobserver::getAgreefriend() 32 | { 33 | return agreefriend; 34 | } 35 | 36 | void Globalobserver::setAgreefriend(Agreefriend *value) 37 | { 38 | agreefriend = value; 39 | } 40 | 41 | QList Globalobserver::getListchat() 42 | { 43 | return listchat; 44 | } 45 | 46 | void Globalobserver::setListchat(const QList &value) 47 | { 48 | listchat = value; 49 | } 50 | 51 | Globalobserver::Globalobserver() 52 | { 53 | font1.setFamily("Microsoft YaHei"); 54 | font1.setPointSize(8); 55 | font1.setStyleStrategy(QFont::PreferAntialias); 56 | font2.setFamily("Microsoft YaHei"); 57 | font2.setPointSize(9); 58 | font2.setStyleStrategy(QFont::PreferAntialias); 59 | } 60 | 61 | void Globalobserver::installPersonInfo(MainWindow *p) 62 | { 63 | mainwindowp = p; 64 | } 65 | 66 | void Globalobserver::installPersonInfo(Addfriend *p) 67 | { 68 | addfriendp = p; 69 | } 70 | 71 | QPixmap Globalobserver::PixmapToRound(const QPixmap &src, const int &radius) 72 | { 73 | if (src.isNull()) { 74 | return QPixmap(); 75 | } 76 | QSize size(2*radius, 2*radius); 77 | //掩码图(黑白色) 78 | QBitmap mask(size); 79 | QPainter painter(&mask); 80 | //Antialiasing:反走样(抗锯齿) 81 | painter.setRenderHint(QPainter::Antialiasing); 82 | //SmoothPixmapTransform:用来在对图片进行缩放时启用线性插值算法而不是最邻近算法 83 | painter.setRenderHint(QPainter::SmoothPixmapTransform); 84 | //填充矩形 85 | painter.fillRect(0, 0, size.width(), size.height(), Qt::white); 86 | //画刷 87 | painter.setBrush(QColor(0, 0, 0)); 88 | //绘制圆角矩形 89 | painter.drawRoundedRect(0, 0, size.width(), size.height(), 190, 190); 90 | //自适应图片 91 | QPixmap image = src.scaled(size); 92 | //setMask:创建不规则窗口使用 93 | image.setMask(mask); 94 | return image; 95 | } 96 | 97 | -------------------------------------------------------------------------------- /FdogClient/globalobserver.h: -------------------------------------------------------------------------------- 1 | #ifndef GLOBALOBSERVER_H 2 | #define GLOBALOBSERVER_H 3 | class MainWindow; 4 | class Addfriend; 5 | class Agreefriend; 6 | class Chat; 7 | #include"mainwindow.h" 8 | #include"addfriend.h" 9 | #include"agreefriend.h" 10 | #include"chat.h" 11 | #include"login.h" 12 | class Globalobserver 13 | { 14 | private: 15 | static MainWindow * mainwindowp; 16 | static Addfriend * addfriendp; 17 | static Agreefriend * agreefriend; 18 | static QList listchat; 19 | public: 20 | static QFont font1; 21 | static QFont font2; 22 | public: 23 | Globalobserver(); 24 | static void installPersonInfo(MainWindow *p); 25 | static void installPersonInfo(Addfriend *p); 26 | static void installPersonInfo(Agreefriend *p); 27 | static QPixmap PixmapToRound(const QPixmap &src, const int &radius); //图片反锯齿化 28 | static MainWindow *getMainwindowp(); 29 | static void setMainwindowp(MainWindow *value); 30 | static Addfriend *getAddfriendp(); 31 | static void setAddfriendp(Addfriend *value); 32 | static Agreefriend *getAgreefriend(); 33 | static void setAgreefriend(Agreefriend *value); 34 | static QList getListchat(); 35 | static void setListchat(const QList &value); 36 | }; 37 | 38 | #endif // GLOBALOBSERVER_H 39 | -------------------------------------------------------------------------------- /FdogClient/lib/036428b265240e27035db396a284521a.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HuaGouFdog/FdogInstantMessaging/4d2e9a12d90dfc79a90d8367b373df8828578f06/FdogClient/lib/036428b265240e27035db396a284521a.gif -------------------------------------------------------------------------------- /FdogClient/lib/10001.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HuaGouFdog/FdogInstantMessaging/4d2e9a12d90dfc79a90d8367b373df8828578f06/FdogClient/lib/10001.jpg -------------------------------------------------------------------------------- /FdogClient/lib/add.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HuaGouFdog/FdogInstantMessaging/4d2e9a12d90dfc79a90d8367b373df8828578f06/FdogClient/lib/add.png -------------------------------------------------------------------------------- /FdogClient/lib/anquan.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HuaGouFdog/FdogInstantMessaging/4d2e9a12d90dfc79a90d8367b373df8828578f06/FdogClient/lib/anquan.png -------------------------------------------------------------------------------- /FdogClient/lib/back.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HuaGouFdog/FdogInstantMessaging/4d2e9a12d90dfc79a90d8367b373df8828578f06/FdogClient/lib/back.gif -------------------------------------------------------------------------------- /FdogClient/lib/background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HuaGouFdog/FdogInstantMessaging/4d2e9a12d90dfc79a90d8367b373df8828578f06/FdogClient/lib/background.png -------------------------------------------------------------------------------- /FdogClient/lib/background2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HuaGouFdog/FdogInstantMessaging/4d2e9a12d90dfc79a90d8367b373df8828578f06/FdogClient/lib/background2.png -------------------------------------------------------------------------------- /FdogClient/lib/body.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HuaGouFdog/FdogInstantMessaging/4d2e9a12d90dfc79a90d8367b373df8828578f06/FdogClient/lib/body.png -------------------------------------------------------------------------------- /FdogClient/lib/caijian.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HuaGouFdog/FdogInstantMessaging/4d2e9a12d90dfc79a90d8367b373df8828578f06/FdogClient/lib/caijian.png -------------------------------------------------------------------------------- /FdogClient/lib/close.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HuaGouFdog/FdogInstantMessaging/4d2e9a12d90dfc79a90d8367b373df8828578f06/FdogClient/lib/close.png -------------------------------------------------------------------------------- /FdogClient/lib/delete.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HuaGouFdog/FdogInstantMessaging/4d2e9a12d90dfc79a90d8367b373df8828578f06/FdogClient/lib/delete.png -------------------------------------------------------------------------------- /FdogClient/lib/delete2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HuaGouFdog/FdogInstantMessaging/4d2e9a12d90dfc79a90d8367b373df8828578f06/FdogClient/lib/delete2.png -------------------------------------------------------------------------------- /FdogClient/lib/dengji.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HuaGouFdog/FdogInstantMessaging/4d2e9a12d90dfc79a90d8367b373df8828578f06/FdogClient/lib/dengji.png -------------------------------------------------------------------------------- /FdogClient/lib/down.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HuaGouFdog/FdogInstantMessaging/4d2e9a12d90dfc79a90d8367b373df8828578f06/FdogClient/lib/down.png -------------------------------------------------------------------------------- /FdogClient/lib/error.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HuaGouFdog/FdogInstantMessaging/4d2e9a12d90dfc79a90d8367b373df8828578f06/FdogClient/lib/error.png -------------------------------------------------------------------------------- /FdogClient/lib/erweima.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HuaGouFdog/FdogInstantMessaging/4d2e9a12d90dfc79a90d8367b373df8828578f06/FdogClient/lib/erweima.png -------------------------------------------------------------------------------- /FdogClient/lib/fangda.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HuaGouFdog/FdogInstantMessaging/4d2e9a12d90dfc79a90d8367b373df8828578f06/FdogClient/lib/fangda.png -------------------------------------------------------------------------------- /FdogClient/lib/fdog.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HuaGouFdog/FdogInstantMessaging/4d2e9a12d90dfc79a90d8367b373df8828578f06/FdogClient/lib/fdog.png -------------------------------------------------------------------------------- /FdogClient/lib/fdog2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HuaGouFdog/FdogInstantMessaging/4d2e9a12d90dfc79a90d8367b373df8828578f06/FdogClient/lib/fdog2.png -------------------------------------------------------------------------------- /FdogClient/lib/fdogicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HuaGouFdog/FdogInstantMessaging/4d2e9a12d90dfc79a90d8367b373df8828578f06/FdogClient/lib/fdogicon.png -------------------------------------------------------------------------------- /FdogClient/lib/guanbi.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HuaGouFdog/FdogInstantMessaging/4d2e9a12d90dfc79a90d8367b373df8828578f06/FdogClient/lib/guanbi.png -------------------------------------------------------------------------------- /FdogClient/lib/icon2505897252.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HuaGouFdog/FdogInstantMessaging/4d2e9a12d90dfc79a90d8367b373df8828578f06/FdogClient/lib/icon2505897252.png -------------------------------------------------------------------------------- /FdogClient/lib/jianpan.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HuaGouFdog/FdogInstantMessaging/4d2e9a12d90dfc79a90d8367b373df8828578f06/FdogClient/lib/jianpan.png -------------------------------------------------------------------------------- /FdogClient/lib/jietou.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HuaGouFdog/FdogInstantMessaging/4d2e9a12d90dfc79a90d8367b373df8828578f06/FdogClient/lib/jietou.png -------------------------------------------------------------------------------- /FdogClient/lib/jietou1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HuaGouFdog/FdogInstantMessaging/4d2e9a12d90dfc79a90d8367b373df8828578f06/FdogClient/lib/jietou1.png -------------------------------------------------------------------------------- /FdogClient/lib/jietou2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HuaGouFdog/FdogInstantMessaging/4d2e9a12d90dfc79a90d8367b373df8828578f06/FdogClient/lib/jietou2.png -------------------------------------------------------------------------------- /FdogClient/lib/kaifdog.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HuaGouFdog/FdogInstantMessaging/4d2e9a12d90dfc79a90d8367b373df8828578f06/FdogClient/lib/kaifdog.png -------------------------------------------------------------------------------- /FdogClient/lib/kaisuo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HuaGouFdog/FdogInstantMessaging/4d2e9a12d90dfc79a90d8367b373df8828578f06/FdogClient/lib/kaisuo.png -------------------------------------------------------------------------------- /FdogClient/lib/likaishijian.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HuaGouFdog/FdogInstantMessaging/4d2e9a12d90dfc79a90d8367b373df8828578f06/FdogClient/lib/likaishijian.png -------------------------------------------------------------------------------- /FdogClient/lib/lixianim.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HuaGouFdog/FdogInstantMessaging/4d2e9a12d90dfc79a90d8367b373df8828578f06/FdogClient/lib/lixianim.png -------------------------------------------------------------------------------- /FdogClient/lib/mainicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HuaGouFdog/FdogInstantMessaging/4d2e9a12d90dfc79a90d8367b373df8828578f06/FdogClient/lib/mainicon.png -------------------------------------------------------------------------------- /FdogClient/lib/mainicon2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HuaGouFdog/FdogInstantMessaging/4d2e9a12d90dfc79a90d8367b373df8828578f06/FdogClient/lib/mainicon2.png -------------------------------------------------------------------------------- /FdogClient/lib/manglu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HuaGouFdog/FdogInstantMessaging/4d2e9a12d90dfc79a90d8367b373df8828578f06/FdogClient/lib/manglu.png -------------------------------------------------------------------------------- /FdogClient/lib/max.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HuaGouFdog/FdogInstantMessaging/4d2e9a12d90dfc79a90d8367b373df8828578f06/FdogClient/lib/max.png -------------------------------------------------------------------------------- /FdogClient/lib/mian.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HuaGouFdog/FdogInstantMessaging/4d2e9a12d90dfc79a90d8367b373df8828578f06/FdogClient/lib/mian.gif -------------------------------------------------------------------------------- /FdogClient/lib/mian2.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HuaGouFdog/FdogInstantMessaging/4d2e9a12d90dfc79a90d8367b373df8828578f06/FdogClient/lib/mian2.gif -------------------------------------------------------------------------------- /FdogClient/lib/mianxingtubiao_zhendong.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HuaGouFdog/FdogInstantMessaging/4d2e9a12d90dfc79a90d8367b373df8828578f06/FdogClient/lib/mianxingtubiao_zhendong.png -------------------------------------------------------------------------------- /FdogClient/lib/min.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HuaGouFdog/FdogInstantMessaging/4d2e9a12d90dfc79a90d8367b373df8828578f06/FdogClient/lib/min.png -------------------------------------------------------------------------------- /FdogClient/lib/network.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HuaGouFdog/FdogInstantMessaging/4d2e9a12d90dfc79a90d8367b373df8828578f06/FdogClient/lib/network.png -------------------------------------------------------------------------------- /FdogClient/lib/qusefdogicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HuaGouFdog/FdogInstantMessaging/4d2e9a12d90dfc79a90d8367b373df8828578f06/FdogClient/lib/qusefdogicon.png -------------------------------------------------------------------------------- /FdogClient/lib/sangangy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HuaGouFdog/FdogInstantMessaging/4d2e9a12d90dfc79a90d8367b373df8828578f06/FdogClient/lib/sangangy.png -------------------------------------------------------------------------------- /FdogClient/lib/search.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HuaGouFdog/FdogInstantMessaging/4d2e9a12d90dfc79a90d8367b373df8828578f06/FdogClient/lib/search.png -------------------------------------------------------------------------------- /FdogClient/lib/setting.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HuaGouFdog/FdogInstantMessaging/4d2e9a12d90dfc79a90d8367b373df8828578f06/FdogClient/lib/setting.png -------------------------------------------------------------------------------- /FdogClient/lib/shijian.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HuaGouFdog/FdogInstantMessaging/4d2e9a12d90dfc79a90d8367b373df8828578f06/FdogClient/lib/shijian.png -------------------------------------------------------------------------------- /FdogClient/lib/skin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HuaGouFdog/FdogInstantMessaging/4d2e9a12d90dfc79a90d8367b373df8828578f06/FdogClient/lib/skin.png -------------------------------------------------------------------------------- /FdogClient/lib/suo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HuaGouFdog/FdogInstantMessaging/4d2e9a12d90dfc79a90d8367b373df8828578f06/FdogClient/lib/suo.png -------------------------------------------------------------------------------- /FdogClient/lib/svip.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HuaGouFdog/FdogInstantMessaging/4d2e9a12d90dfc79a90d8367b373df8828578f06/FdogClient/lib/svip.png -------------------------------------------------------------------------------- /FdogClient/lib/taiyang.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HuaGouFdog/FdogInstantMessaging/4d2e9a12d90dfc79a90d8367b373df8828578f06/FdogClient/lib/taiyang.png -------------------------------------------------------------------------------- /FdogClient/lib/tianjiahaoyou.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HuaGouFdog/FdogInstantMessaging/4d2e9a12d90dfc79a90d8367b373df8828578f06/FdogClient/lib/tianjiahaoyou.png -------------------------------------------------------------------------------- /FdogClient/lib/verify1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HuaGouFdog/FdogInstantMessaging/4d2e9a12d90dfc79a90d8367b373df8828578f06/FdogClient/lib/verify1.png -------------------------------------------------------------------------------- /FdogClient/lib/verify2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HuaGouFdog/FdogInstantMessaging/4d2e9a12d90dfc79a90d8367b373df8828578f06/FdogClient/lib/verify2.png -------------------------------------------------------------------------------- /FdogClient/lib/weixiao.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HuaGouFdog/FdogInstantMessaging/4d2e9a12d90dfc79a90d8367b373df8828578f06/FdogClient/lib/weixiao.png -------------------------------------------------------------------------------- /FdogClient/lib/wurao.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HuaGouFdog/FdogInstantMessaging/4d2e9a12d90dfc79a90d8367b373df8828578f06/FdogClient/lib/wurao.png -------------------------------------------------------------------------------- /FdogClient/lib/xiaolian.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HuaGouFdog/FdogInstantMessaging/4d2e9a12d90dfc79a90d8367b373df8828578f06/FdogClient/lib/xiaolian.png -------------------------------------------------------------------------------- /FdogClient/lib/xing1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HuaGouFdog/FdogInstantMessaging/4d2e9a12d90dfc79a90d8367b373df8828578f06/FdogClient/lib/xing1.png -------------------------------------------------------------------------------- /FdogClient/lib/yinshenim.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HuaGouFdog/FdogInstantMessaging/4d2e9a12d90dfc79a90d8367b373df8828578f06/FdogClient/lib/yinshenim.png -------------------------------------------------------------------------------- /FdogClient/lib/yueliang.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HuaGouFdog/FdogInstantMessaging/4d2e9a12d90dfc79a90d8367b373df8828578f06/FdogClient/lib/yueliang.png -------------------------------------------------------------------------------- /FdogClient/lib/zaixian.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HuaGouFdog/FdogInstantMessaging/4d2e9a12d90dfc79a90d8367b373df8828578f06/FdogClient/lib/zaixian.png -------------------------------------------------------------------------------- /FdogClient/lib/zuixiaohua.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HuaGouFdog/FdogInstantMessaging/4d2e9a12d90dfc79a90d8367b373df8828578f06/FdogClient/lib/zuixiaohua.png -------------------------------------------------------------------------------- /FdogClient/libres.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | lib/fdogicon.png 4 | lib/min.png 5 | lib/close.png 6 | lib/skin.png 7 | lib/search.png 8 | lib/likaishijian.png 9 | lib/lixianim.png 10 | lib/wurao.png 11 | lib/xiaolian.png 12 | lib/yinshenim.png 13 | lib/zaixian.png 14 | lib/mian.gif 15 | lib/036428b265240e27035db396a284521a.gif 16 | lib/mainicon.png 17 | lib/guanbi.png 18 | lib/zuixiaohua.png 19 | lib/fdog.png 20 | lib/jianpan.png 21 | lib/kaifdog.png 22 | lib/kaisuo.png 23 | lib/suo.png 24 | lib/qusefdogicon.png 25 | lib/icon2505897252.png 26 | lib/jietou.png 27 | lib/sangangy.png 28 | lib/tianjiahaoyou.png 29 | lib/dengji.png 30 | lib/svip.png 31 | lib/background.png 32 | lib/10001.jpg 33 | lib/back.gif 34 | lib/delete.png 35 | lib/max.png 36 | lib/delete2.png 37 | lib/verify1.png 38 | lib/verify2.png 39 | lib/setting.png 40 | lib/jietou1.png 41 | lib/body.png 42 | lib/caijian.png 43 | lib/fangda.png 44 | lib/mianxingtubiao_zhendong.png 45 | lib/shijian.png 46 | lib/weixiao.png 47 | lib/mian2.gif 48 | lib/erweima.png 49 | lib/jietou2.png 50 | lib/fdog2.png 51 | lib/down.png 52 | lib/add.png 53 | lib/manglu.png 54 | lib/anquan.png 55 | lib/error.png 56 | lib/network.png 57 | lib/background2.png 58 | 59 | 60 | -------------------------------------------------------------------------------- /FdogClient/login.h: -------------------------------------------------------------------------------- 1 | #ifndef LOGIN_H 2 | #define LOGIN_H 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include"usersql.h" 27 | #include"mainwindow.h" 28 | namespace Ui { 29 | class Login; 30 | } 31 | 32 | class Login : public QWidget 33 | { 34 | Q_OBJECT 35 | QTcpSocket * tcpClient = NULL;//连接网络 36 | QSystemTrayIcon * systemtrayicon = NULL; //系统托盘 37 | QPoint m_point; //点类 38 | QMovie * m_movie = NULL; //添加动态图 39 | QMovie * m_movie2 = NULL; //添加动态图2 40 | QSize m_si; //动态图压缩大小 41 | QSize m_si2; //动态图压缩大小2 42 | Usersql sqconn; //数据库类 43 | MainWindow * w = NULL; //主界面类 44 | QString account =""; //查询账户 45 | QPoint last; //窗口拖动用变量 46 | bool isPressedWidget; 47 | bool ispasswd=false; //判断是否是密码 48 | QStringList infoList; //用户账号 49 | QStringList infopasswd; //用户密码 50 | QStringList icon; //头像保存地址 51 | QListWidget * m_AccountList = NULL; //下拉列表框 52 | QMenu * menu = NULL; //右击菜单 53 | QAction *m_pShowAction = NULL; //显示选项 54 | QAction *m_pCloseAction = NULL; //退出选项 55 | QSignalMapper * myMapper = NULL; 56 | QVector infoListsign; 57 | QTimer timesignin; 58 | quint16 port; 59 | QString addr =getLocalIP(); 60 | bool network = true; //是否能正常连接主机 61 | 62 | QAction * searchAction = NULL; 63 | QAction * searchAction_2 = NULL; 64 | QAction * searchAction_3 = NULL; 65 | QHBoxLayout *horLayout = NULL; 66 | QPushButton * la = NULL; 67 | QLabel * la2 = NULL; 68 | QPushButton * b1 = NULL; 69 | 70 | public: 71 | explicit Login(QWidget *parent = 0); 72 | QString getLocalIP(); //获取本机IP地址 73 | void paintEvent(QPaintEvent *e); 74 | void mousePressEvent(QMouseEvent *event);//鼠标点击 75 | void mouseMoveEvent(QMouseEvent *event);//鼠标移动 76 | void mouseReleaseEvent(QMouseEvent *event);//鼠标释放 77 | QStringList GetDirNameList(const QString &strDirpath); 78 | ~Login(); 79 | 80 | private slots: 81 | 82 | void on_toolButton_2_clicked(); 83 | 84 | void on_toolButton_clicked(); 85 | 86 | void on_register_btn_clicked(); 87 | 88 | void on_pushButton_clicked(); 89 | 90 | void on_activatedSysTratIcon(QSystemTrayIcon::ActivationReason reason); 91 | 92 | void on_comboBox_currentIndexChanged(int index); 93 | void onConnected();//连接 94 | //void onSocketStateChange(QAbstractSocket::SocketState);//状态 95 | void onSocketErrorChange(QAbstractSocket::SocketError);//连接错误类型 96 | 97 | void showwidget(); 98 | void closewidget(); 99 | void deleteaccount(int i); 100 | 101 | 102 | 103 | void on_pushButton_4_clicked(); 104 | 105 | void on_pushButton_5_clicked(); 106 | 107 | void on_pushButton_6_clicked(); 108 | 109 | void on_toolButton_6_clicked(); 110 | 111 | private: 112 | Ui::Login *ui; 113 | }; 114 | 115 | #endif // LOGIN_H 116 | -------------------------------------------------------------------------------- /FdogClient/main.cpp: -------------------------------------------------------------------------------- 1 | #include "mainwindow.h" 2 | #include 3 | #include"login.h" 4 | #include"globalobserver.h" 5 | int main(int argc, char *argv[]) 6 | { 7 | QApplication a(argc, argv); 8 | Login n; 9 | n.show(); 10 | return a.exec(); 11 | } 12 | -------------------------------------------------------------------------------- /FdogClient/mainwindow.h: -------------------------------------------------------------------------------- 1 | #ifndef MAINWINDOW_H 2 | #define MAINWINDOW_H 3 | class Chat; 4 | class Globalobserver; 5 | class Verify; 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include"query.h" 30 | #include"usersql.h" 31 | #include"chat.h" 32 | #include"verify.h" 33 | #include"traywidget.h" 34 | #include"addfriend.h" 35 | #include"globalobserver.h" 36 | namespace Ui { 37 | class MainWindow; 38 | } 39 | 40 | class MainWindow : public QMainWindow 41 | { 42 | Q_OBJECT 43 | 44 | private: 45 | /*创系统图标以及托盘菜单*/ 46 | QSystemTrayIcon * systemtrayicon; //系统托盘 47 | QMenu * menu; //菜单 48 | QMenu * mainmenu; //主界面菜单 49 | QAction *m_pShowAction; //显示选项 50 | QAction *m_pCloseAction; //退出选项 51 | QAction *m_pOnLineAction; //在线 52 | QAction *m_pCallAction; //call我 53 | QAction *m_pCloakingAction; //隐身 54 | QAction *m_pLeaveAction; //离开 55 | QAction *m_pBusyAction; //忙碌 56 | QAction *m_pDisturbAction; //请勿打扰 57 | QAction *m_pOffLineAtion; //离线 58 | /*消息通知*/ 59 | Traywidget * tarywidget; //右下角消息显示列表 60 | QPixmap icondata; //用于保存需要闪动头像 61 | bool iconbool =false; //和icondata搭配使用 62 | /*定时器用于托盘头像闪动,显示等*/ 63 | QTimer timerT; 64 | QTimer timerNoT; 65 | QTimer timemouse; 66 | /*账号基本数据*/ 67 | Usersql sqconn; //获取个人信息 68 | QPixmap icon; //头像 69 | QString account = ""; //账号 70 | QString name = ""; //昵称 71 | QString signature =""; //个性签名 72 | QList listbtn; //分组名 73 | QList listwidget; //分组列表 74 | /*子窗口*/ 75 | Query * a; //查找窗口 76 | Verify * verify; //验证窗口 77 | QWidget * myinfo = new QWidget();//当鼠标悬浮头像弹出该窗口 78 | /*聊天相关*/ 79 | QStringList stringlistdata; //数据池 80 | //QStringList stringaccount; //消息池 81 | QList listchat; //保存聊天窗口 82 | QVector Globalinfo; //全局消息管理 1为普通消息,二位验证消息 83 | /*连接网络*/ 84 | QTcpSocket * tcpClient;//连接网络 85 | QLabel * LabSocketate; //显示网络类型 86 | /*鼠标拖动事件*/ 87 | QList iswidget; //列表展开 88 | QPoint last; //窗口拖动变量 89 | bool isPressedWidget; 90 | /*其他*/ 91 | QSignalMapper * myMapper; //信号管理 92 | QSignalMapper * menuAction; 93 | bool ishover = false;//判断鼠标是否进过托盘图标 94 | 95 | public: 96 | explicit MainWindow(QString account,QTcpSocket *tcpClient,QWidget *parent = 0); //构造函数 97 | ~MainWindow();//析构函数 98 | void paintEvent(QPaintEvent *e); //重绘背景 99 | bool eventFilter(QObject *obj, QEvent *event); //事件过滤器 100 | void showicon(); //显示系统托盘图标 101 | QString getLocalIP(); //获取本机IP地址 102 | void datawidget(QPixmap pixmap,QString str,QString account); //更新消息列表 103 | signals: 104 | void sendChatData(QString data);//给聊天窗口发送信号及数据 105 | void sendquitData();//给登录窗口发送信息 106 | 107 | private slots: 108 | void on_min_tool_clicked(); //最小化 109 | void on_close_tool_clicked(); //关闭按钮 110 | void on_toolButton_3_clicked(); //主界面在线按钮 111 | void mousePressEvent(QMouseEvent *event); //鼠标点击 112 | void mouseMoveEvent(QMouseEvent *event); //鼠标移动 113 | void mouseReleaseEvent(QMouseEvent *event); //鼠标释放 114 | void onWidgetClicked(int i); //分组按钮被点击 115 | void onDoubleWidgetClicked(QListWidgetItem * witem);//好友列表被双击 116 | void on_activatedSysTratIcon(QSystemTrayIcon::ActivationReason reason);//对托盘按钮的点击 117 | /*TCP相关*/ 118 | void onConnected(); //连接 119 | void onDisconnected(); //断开连接 120 | void onSocketReadyRead(); //收到数据 121 | void onSocketStateChange(QAbstractSocket::SocketState socketState); //状态 122 | void onSocketErrorChange(QAbstractSocket::SocketError); //连接错误类型 123 | void listchatcount(QString otheraccount); //监视chat数据 124 | /*托盘图标闪动相关*/ 125 | void sltTimerT();//定时器开始 126 | void sltTimerNoT();//定时器停止 127 | void actionexe(int);//菜单,切换在线状态 128 | /*信息发送相关*/ 129 | void showdata(); 130 | void MainSendData(QString str); //发送普通消息 131 | void MainSendAddData(QString str); //发送验证消息 132 | /*消息验证*/ 133 | void updatamaingrouping(QString,QString,QString,QString); //更新好友列表 134 | void updatamainverify(QString,QString); //更新验证消息 135 | 136 | void on_listWidget_itemDoubleClicked(QListWidgetItem *item); 137 | void showAllChat(); 138 | void hideAllChat(); 139 | void showAChat(QString account); 140 | private: 141 | Ui::MainWindow *ui; 142 | }; 143 | #endif // MAINWINDOW_H 144 | -------------------------------------------------------------------------------- /FdogClient/query.cpp: -------------------------------------------------------------------------------- 1 | #include "query.h" 2 | #include "ui_query.h" 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include"addfriend.h" 8 | #if _MSC_VER >= 1600 9 | #pragma execution_character_set("utf-8") 10 | #endif 11 | 12 | Query::Query(QString account,QWidget *parent) : 13 | QWidget(parent), 14 | ui(new Ui::Query) 15 | { 16 | ui->setupUi(this); 17 | this->account = account; 18 | setWindowFlags (Qt::FramelessWindowHint); 19 | setAttribute(Qt::WA_TranslucentBackground); 20 | ui->pushButton_3->setIcon(QIcon(":/lib/add.png")); 21 | } 22 | 23 | Query::~Query() 24 | { 25 | delete ui; 26 | } 27 | 28 | void Query::paintEvent(QPaintEvent *e) 29 | { 30 | Q_UNUSED(e) 31 | QPainter painter(this); 32 | QPixmap pixmap(":/lib/background.png");//做好的图 33 | qDrawBorderPixmap(&painter, this->rect(), QMargins(0, 0, 0, 0), pixmap); 34 | QRect rect(this->rect().x()+8, this->rect().y()+8, this->rect().width()-16, this->rect().height()-16); 35 | painter.fillRect(rect, QColor(255, 255, 255)); 36 | } 37 | 38 | void Query::mousePressEvent(QMouseEvent *event) 39 | { 40 | isPressedWidget = true; // 当前鼠标按下的即是QWidget而非界面上布局的其它控件 41 | last = event->globalPos(); 42 | } 43 | 44 | void Query::mouseMoveEvent(QMouseEvent *event) 45 | { 46 | if (isPressedWidget) 47 | { 48 | int dx = event->globalX() - last.x(); 49 | int dy = event->globalY() - last.y(); 50 | last = event->globalPos(); 51 | move(x()+dx, y()+dy); 52 | } 53 | } 54 | 55 | void Query::mouseReleaseEvent(QMouseEvent *event) 56 | { 57 | int dx = event->globalX() - last.x(); 58 | int dy = event->globalY() - last.y(); 59 | move(x()+dx, y()+dy); 60 | isPressedWidget = false; // 鼠标松开时,置为false 61 | } 62 | void Query::on_pushButton_clicked() 63 | { 64 | QString otheraccount = ui->lineEdit->text(); 65 | //this->account = account; 66 | //qDebug()<<"输入的账号是:"<lineEdit->text(); 67 | //链接数据库 68 | this->sqconn.connData(); 69 | //获取头像 70 | this->icon=sqconn.getPixmapIcon(otheraccount); 71 | this->icon=this->icon.scaled(QSize(this->icon.width(), this->icon.height()), Qt::IgnoreAspectRatio); 72 | this->icon= Globalobserver::PixmapToRound(this->icon, this->icon.width()/2); 73 | ui->pushButton_4->setIcon(QIcon(this->icon)); 74 | //获取昵称 75 | ui->label_2->setText(sqconn.getOtherAccountName(otheraccount)); 76 | ui->label_3->setText(sqconn.getOtherAccountAge(otheraccount)+"岁"); 77 | 78 | 79 | } 80 | 81 | void Query::on_pushButton_3_clicked() 82 | { 83 | //头像, 搜索账号,名字,本身账号,性别,年龄职业 84 | //this->account 被搜索账号 85 | Addfriend * a = new Addfriend(this->icon,ui->lineEdit->text(),ui->label_2->text(),this->account,sqconn.getOtherAccountSex(this->account),ui->label_3->text(),sqconn.getOtherAccountProfession(this->account)); 86 | connect(Globalobserver::getAddfriendp(),SIGNAL(sendaddinfo(QString)),Globalobserver::getMainwindowp(),SLOT(MainSendAddData(QString))); 87 | a->show(); 88 | } 89 | 90 | 91 | void Query::on_toolButton_4_clicked() 92 | { 93 | this->hide(); 94 | } 95 | 96 | void Query::MainSendAddData(QString) 97 | { 98 | qDebug()<<"查找窗口接收到信号"; 99 | } 100 | -------------------------------------------------------------------------------- /FdogClient/query.h: -------------------------------------------------------------------------------- 1 | #ifndef QUERY_H 2 | #define QUERY_H 3 | 4 | #include 5 | #include"usersql.h" 6 | namespace Ui { 7 | class Query; 8 | } 9 | 10 | class Query : public QWidget 11 | { 12 | Q_OBJECT 13 | private: 14 | Usersql sqconn; 15 | QPixmap icon = ""; //头像 16 | QString account; 17 | QPoint last; //窗口拖动用变量 18 | bool isPressedWidget; 19 | 20 | public: 21 | QPixmap PixmapToRound(QPixmap &src, int radius); 22 | explicit Query(QString account,QWidget *parent = 0); 23 | ~Query(); 24 | void paintEvent(QPaintEvent *e); 25 | void mousePressEvent(QMouseEvent *event);//鼠标点击 26 | void mouseMoveEvent(QMouseEvent *event);//鼠标移动 27 | void mouseReleaseEvent(QMouseEvent *event);//鼠标释放 28 | 29 | private slots: 30 | 31 | void on_pushButton_clicked(); 32 | 33 | void on_pushButton_3_clicked(); 34 | 35 | void on_toolButton_4_clicked(); 36 | void MainSendAddData(QString); 37 | 38 | private: 39 | Ui::Query *ui; 40 | }; 41 | 42 | #endif // QUERY_H 43 | -------------------------------------------------------------------------------- /FdogClient/settingcolor.cpp: -------------------------------------------------------------------------------- 1 | #include "settingcolor.h" 2 | #include "ui_settingcolor.h" 3 | 4 | Settingcolor::Settingcolor(QWidget *parent) : 5 | QWidget(parent), 6 | ui(new Ui::Settingcolor) 7 | { 8 | ui->setupUi(this); 9 | } 10 | 11 | Settingcolor::~Settingcolor() 12 | { 13 | delete ui; 14 | } 15 | -------------------------------------------------------------------------------- /FdogClient/settingcolor.h: -------------------------------------------------------------------------------- 1 | #ifndef SETTINGCOLOR_H 2 | #define SETTINGCOLOR_H 3 | 4 | #include 5 | 6 | namespace Ui { 7 | class Settingcolor; 8 | } 9 | 10 | class Settingcolor : public QWidget 11 | { 12 | Q_OBJECT 13 | 14 | public: 15 | explicit Settingcolor(QWidget *parent = 0); 16 | ~Settingcolor(); 17 | 18 | private: 19 | Ui::Settingcolor *ui; 20 | }; 21 | 22 | #endif // SETTINGCOLOR_H 23 | -------------------------------------------------------------------------------- /FdogClient/settingcolor.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | Settingcolor 4 | 5 | 6 | 7 | 0 8 | 0 9 | 794 10 | 472 11 | 12 | 13 | 14 | Form 15 | 16 | 17 | 18 | 19 | 0 20 | 0 21 | 371 22 | 271 23 | 24 | 25 | 26 | #tab,#tab_2{ 27 | border-image: url(:/lib/10001.jpg); 28 | } 29 | 30 | 31 | 1 32 | 33 | 34 | 35 | Tab 1 36 | 37 | 38 | 39 | 40 | Tab 2 41 | 42 | 43 | 44 | 45 | 70 46 | 60 47 | 75 48 | 23 49 | 50 | 51 | 52 | PushButton 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 420 61 | 110 62 | 241 63 | 181 64 | 65 | 66 | 67 | background-color: rgb(255, 123, 249); 68 | 69 | 70 | 71 | 72 | 73 | 70 74 | 330 75 | 141 76 | 51 77 | 78 | 79 | 80 | 81 | 14 82 | 83 | 84 | 85 | background-color: rgb(175, 148, 255); 86 | 87 | 88 | 你哈 89 | 90 | 91 | Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter 92 | 93 | 94 | false 95 | 96 | 97 | 98 | 99 | 100 | 270 101 | 370 102 | 401 103 | 31 104 | 105 | 106 | 107 | 108 | 109 | 110 | PushButton 111 | 112 | 113 | 114 | 115 | 116 | 117 | 3213123333 118 | 119 | 120 | Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop 121 | 122 | 123 | 124 | 125 | 126 | 127 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> 128 | <html><head><meta name="qrichtext" content="1" /><style type="text/css"> 129 | p, li { white-space: pre-wrap; } 130 | </style></head><body style=" font-family:'SimSun'; font-size:9pt; font-weight:400; font-style:normal;"> 131 | <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">你好</p> 132 | <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p></body></html> 133 | 134 | 135 | 136 | 137 | 138 | 139 | Qt::Horizontal 140 | 141 | 142 | 143 | 40 144 | 20 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | -------------------------------------------------------------------------------- /FdogClient/trayiconmenu.cpp: -------------------------------------------------------------------------------- 1 | #include "trayiconmenu.h" 2 | 3 | TrayIconMenu::TrayIconMenu() 4 | { 5 | 6 | } 7 | -------------------------------------------------------------------------------- /FdogClient/trayiconmenu.h: -------------------------------------------------------------------------------- 1 | #ifndef TRAYICONMENU_H 2 | #define TRAYICONMENU_H 3 | #include 4 | 5 | class TrayIconMenu :public QMenu 6 | { 7 | Q_OBJECT 8 | public: 9 | TrayIconMenu(); 10 | }; 11 | 12 | #endif // TRAYICONMENU_H 13 | -------------------------------------------------------------------------------- /FdogClient/traywidget.cpp: -------------------------------------------------------------------------------- 1 | #include "traywidget.h" 2 | #include "ui_traywidget.h" 3 | #include 4 | #if _MSC_VER >= 1600 5 | #pragma execution_character_set("utf-8") 6 | #endif 7 | Traywidget::Traywidget(QString name,QWidget *parent) : 8 | QWidget(parent), 9 | ui(new Ui::Traywidget) 10 | { 11 | qDebug()<<"创1"; 12 | ui->setupUi(this); 13 | this->setWindowFlags(Qt::SplashScreen|Qt::WindowStaysOnTopHint|Qt::FramelessWindowHint); 14 | setAttribute(Qt::WA_TranslucentBackground); 15 | ui->listWidget->setFrameShape(QListWidget::NoFrame); 16 | ui->label->setText(name); 17 | qDebug()<<"创1"; 18 | } 19 | 20 | Traywidget::~Traywidget() 21 | { 22 | delete ui; 23 | } 24 | QString Traywidget::getName() const 25 | { 26 | return name; 27 | } 28 | 29 | void Traywidget::setName(const QString &value) 30 | { 31 | name = value; 32 | ui->label->setText(name); 33 | } 34 | 35 | void Traywidget::setTrayWidgetItem(QPixmap pixmap,const QString &str,const QString &account) 36 | { 37 | qDebug()<<"消息1"; 38 | QFont font; 39 | font.setFamily("Microsoft YaHei"); 40 | font.setPointSize(10); 41 | //font.setBold(true); 42 | font.setStyleStrategy(QFont::PreferAntialias); 43 | QHBoxLayout *horLayout = new QHBoxLayout();//水平布局 44 | horLayout->setContentsMargins(0,0,0,0); 45 | horLayout->setSpacing(0); 46 | QPushButton * btn = new QPushButton(); 47 | btn->setIcon(pixmap); 48 | QSize btnsize(25,25); 49 | btn->setIconSize(btnsize); 50 | btn->setFixedSize(26,26); 51 | btn->setFlat(true); 52 | QLabel * la = new QLabel(" "+str); 53 | la->setFont(font); 54 | horLayout->addWidget(btn); 55 | horLayout->addWidget(la); 56 | QWidget * widget = new QWidget(this); 57 | widget->setObjectName(account); 58 | widget->setLayout(horLayout); 59 | QListWidgetItem * Listitem = new QListWidgetItem(ui->listWidget); 60 | Listitem->setSizeHint(QSize(270, 26)); //每次改变Item的高度 61 | ui->listWidget->setItemWidget(Listitem,widget); 62 | ui->listWidget->setStyleSheet("QListWidget{color:gray;font-size:12px;background:#FAFAFD;}\ 63 | QScrollBar{width:0;height:0}"); 64 | //ui->listWidget->setFixedSize(270,26*(1)); 65 | //ui->listWidget->sortItems(); 66 | } 67 | 68 | void Traywidget::deleteItem() 69 | { 70 | ui->listWidget->clear(); 71 | } 72 | 73 | void Traywidget::paintEvent(QPaintEvent *e) 74 | { 75 | Q_UNUSED(e) 76 | QPainter painter(this); 77 | QPixmap pixmap(":/lib/background.png");//做好的图 78 | qDrawBorderPixmap(&painter, this->rect(), QMargins(0, 0, 0, 0), pixmap); 79 | QRect rect(this->rect().x()+8, this->rect().y()+8, this->rect().width()-16, this->rect().height()-16); 80 | painter.fillRect(rect, QColor(255, 255, 255)); 81 | } 82 | 83 | void Traywidget::on_listWidget_itemDoubleClicked(QListWidgetItem *item) 84 | { 85 | //获得信息,包括头像,名字,账号,传给主界面 86 | QWidget * widget = ui->listWidget->itemWidget(item); 87 | //从消息池找到正确的消息 88 | emit senddata3(widget->objectName());//获取正确的消息 89 | //删除选中消息 90 | ui->listWidget->removeItemWidget(item); 91 | } 92 | 93 | void Traywidget::on_pushButton_2_clicked()//查看全部 94 | { 95 | emit senddata(); 96 | } 97 | 98 | void Traywidget::on_pushButton_clicked()//忽略全部 99 | { 100 | emit senddata2(); 101 | } 102 | -------------------------------------------------------------------------------- /FdogClient/traywidget.h: -------------------------------------------------------------------------------- 1 | #ifndef TRAYWIDGET_H 2 | #define TRAYWIDGET_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | namespace Ui { 9 | class Traywidget; 10 | } 11 | 12 | class Traywidget : public QWidget 13 | { 14 | Q_OBJECT 15 | private: 16 | QString name; 17 | public: 18 | explicit Traywidget(QString name,QWidget *parent = 0); 19 | ~Traywidget(); 20 | void setTrayWidgetItem(QPixmap pixmap,const QString &str,const QString &account); 21 | void deleteItem();//清空列表 22 | void paintEvent(QPaintEvent *e); 23 | QString getName() const; 24 | void setName(const QString &value); 25 | 26 | signals: 27 | void senddata(); 28 | void senddata2(); 29 | void senddata3(QString account); 30 | 31 | private slots: 32 | void on_listWidget_itemDoubleClicked(QListWidgetItem *item); 33 | 34 | void on_pushButton_2_clicked(); 35 | 36 | void on_pushButton_clicked(); 37 | 38 | private: 39 | Ui::Traywidget *ui; 40 | }; 41 | 42 | #endif // TRAYWIDGET_H 43 | -------------------------------------------------------------------------------- /FdogClient/traywidget.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | Traywidget 4 | 5 | 6 | 7 | 0 8 | 0 9 | 229 10 | 153 11 | 12 | 13 | 14 | 15 | 229 16 | 16777215 17 | 18 | 19 | 20 | 21 | Microsoft YaHei 22 | 23 | 24 | 25 | Form 26 | 27 | 28 | *{font-family:Microsoft YaHei;} 29 | #Traywidget{ 30 | background-color: rgb(255, 255, 255); 31 | } 32 | 33 | 34 | 35 | 1 36 | 37 | 38 | 2 39 | 40 | 41 | 5 42 | 43 | 44 | 2 45 | 46 | 47 | 0 48 | 49 | 50 | 51 | 52 | 0 53 | 54 | 55 | 8 56 | 57 | 58 | 8 59 | 60 | 61 | 62 | 63 | 64 | Microsoft YaHei 65 | 10 66 | 75 67 | true 68 | PreferAntialias 69 | 70 | 71 | 72 | 73 | 74 | 75 | 花狗Fdog 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | Microsoft YaHei 84 | PreferAntialias 85 | 86 | 87 | 88 | Qt::Horizontal 89 | 90 | 91 | 92 | 40 93 | 20 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | Microsoft YaHei 103 | PreferAntialias 104 | 105 | 106 | 107 | ... 108 | 109 | 110 | 111 | :/lib/setting.png:/lib/setting.png 112 | 113 | 114 | true 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | Microsoft YaHei 125 | PreferAntialias 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 16777215 134 | 16777215 135 | 136 | 137 | 138 | 139 | Microsoft YaHei 140 | PreferAntialias 141 | 142 | 143 | 144 | background-color: rgba(255, 255, 255, 0); 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | border-style:solid; 155 | border-width:1px; 156 | border-top-color:rgb(161, 161, 161); 157 | 158 | 159 | 160 | 2 161 | 162 | 163 | 164 | 165 | 166 | 55 167 | 20 168 | 169 | 170 | 171 | 172 | Microsoft YaHei 173 | PreferAntialias 174 | 175 | 176 | 177 | color: rgb(44, 164, 255); 178 | 179 | 180 | 忽略全部 181 | 182 | 183 | false 184 | 185 | 186 | true 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | Microsoft YaHei 195 | PreferAntialias 196 | 197 | 198 | 199 | Qt::Horizontal 200 | 201 | 202 | 203 | 40 204 | 20 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 55 214 | 80 215 | 216 | 217 | 218 | 219 | Microsoft YaHei 220 | PreferAntialias 221 | 222 | 223 | 224 | color: rgb(44, 164, 255); 225 | 226 | 227 | 查看全部 228 | 229 | 230 | true 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | -------------------------------------------------------------------------------- /FdogClient/ui_agreefriend.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************** 2 | ** Form generated from reading UI file 'agreefriend.ui' 3 | ** 4 | ** Created by: Qt User Interface Compiler version 5.10.0 5 | ** 6 | ** WARNING! All changes made in this file will be lost when recompiling UI file! 7 | ********************************************************************************/ 8 | 9 | #ifndef UI_AGREEFRIEND_H 10 | #define UI_AGREEFRIEND_H 11 | 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | 23 | QT_BEGIN_NAMESPACE 24 | 25 | class Ui_Agreefriend 26 | { 27 | public: 28 | QLabel *label; 29 | QLabel *label_2; 30 | QComboBox *comboBox; 31 | QLineEdit *lineEdit; 32 | QPushButton *pushButton; 33 | QPushButton *pushButton_2; 34 | 35 | void setupUi(QWidget *Agreefriend) 36 | { 37 | if (Agreefriend->objectName().isEmpty()) 38 | Agreefriend->setObjectName(QStringLiteral("Agreefriend")); 39 | Agreefriend->resize(322, 183); 40 | QFont font; 41 | font.setFamily(QStringLiteral("Microsoft YaHei")); 42 | font.setStyleStrategy(QFont::PreferAntialias); 43 | Agreefriend->setFont(font); 44 | Agreefriend->setStyleSheet(QStringLiteral("*{font-family:Microsoft YaHei;}")); 45 | label = new QLabel(Agreefriend); 46 | label->setObjectName(QStringLiteral("label")); 47 | label->setGeometry(QRect(40, 20, 61, 31)); 48 | label->setFont(font); 49 | label_2 = new QLabel(Agreefriend); 50 | label_2->setObjectName(QStringLiteral("label_2")); 51 | label_2->setGeometry(QRect(40, 60, 61, 31)); 52 | label_2->setFont(font); 53 | comboBox = new QComboBox(Agreefriend); 54 | comboBox->setObjectName(QStringLiteral("comboBox")); 55 | comboBox->setGeometry(QRect(100, 60, 151, 31)); 56 | comboBox->setFont(font); 57 | lineEdit = new QLineEdit(Agreefriend); 58 | lineEdit->setObjectName(QStringLiteral("lineEdit")); 59 | lineEdit->setGeometry(QRect(100, 20, 151, 31)); 60 | lineEdit->setFont(font); 61 | pushButton = new QPushButton(Agreefriend); 62 | pushButton->setObjectName(QStringLiteral("pushButton")); 63 | pushButton->setGeometry(QRect(50, 120, 91, 31)); 64 | pushButton->setFont(font); 65 | pushButton_2 = new QPushButton(Agreefriend); 66 | pushButton_2->setObjectName(QStringLiteral("pushButton_2")); 67 | pushButton_2->setGeometry(QRect(170, 120, 91, 31)); 68 | pushButton_2->setFont(font); 69 | 70 | retranslateUi(Agreefriend); 71 | 72 | QMetaObject::connectSlotsByName(Agreefriend); 73 | } // setupUi 74 | 75 | void retranslateUi(QWidget *Agreefriend) 76 | { 77 | Agreefriend->setWindowTitle(QApplication::translate("Agreefriend", "Form", nullptr)); 78 | label->setText(QApplication::translate("Agreefriend", "\345\244\207\346\263\250\357\274\232", nullptr)); 79 | label_2->setText(QApplication::translate("Agreefriend", "\345\210\206\347\273\204\357\274\232", nullptr)); 80 | pushButton->setText(QApplication::translate("Agreefriend", "\345\220\214\346\204\217", nullptr)); 81 | pushButton_2->setText(QApplication::translate("Agreefriend", "\346\213\222\347\273\235", nullptr)); 82 | } // retranslateUi 83 | 84 | }; 85 | 86 | namespace Ui { 87 | class Agreefriend: public Ui_Agreefriend {}; 88 | } // namespace Ui 89 | 90 | QT_END_NAMESPACE 91 | 92 | #endif // UI_AGREEFRIEND_H 93 | -------------------------------------------------------------------------------- /FdogClient/ui_settingcolor.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************** 2 | ** Form generated from reading UI file 'settingcolor.ui' 3 | ** 4 | ** Created by: Qt User Interface Compiler version 5.10.0 5 | ** 6 | ** WARNING! All changes made in this file will be lost when recompiling UI file! 7 | ********************************************************************************/ 8 | 9 | #ifndef UI_SETTINGCOLOR_H 10 | #define UI_SETTINGCOLOR_H 11 | 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | 25 | QT_BEGIN_NAMESPACE 26 | 27 | class Ui_Settingcolor 28 | { 29 | public: 30 | QTabWidget *tabWidget; 31 | QWidget *tab; 32 | QWidget *tab_2; 33 | QPushButton *pushButton; 34 | QWidget *widget; 35 | QLabel *label; 36 | QWidget *horizontalLayoutWidget; 37 | QHBoxLayout *horizontalLayout; 38 | QPushButton *pushButton_2; 39 | QLabel *label_2; 40 | QTextEdit *textEdit; 41 | QSpacerItem *horizontalSpacer; 42 | 43 | void setupUi(QWidget *Settingcolor) 44 | { 45 | if (Settingcolor->objectName().isEmpty()) 46 | Settingcolor->setObjectName(QStringLiteral("Settingcolor")); 47 | Settingcolor->resize(794, 472); 48 | tabWidget = new QTabWidget(Settingcolor); 49 | tabWidget->setObjectName(QStringLiteral("tabWidget")); 50 | tabWidget->setGeometry(QRect(0, 0, 371, 271)); 51 | tabWidget->setStyleSheet(QLatin1String("#tab,#tab_2{\n" 52 | "border-image: url(:/lib/10001.jpg);\n" 53 | "}")); 54 | tab = new QWidget(); 55 | tab->setObjectName(QStringLiteral("tab")); 56 | tabWidget->addTab(tab, QString()); 57 | tab_2 = new QWidget(); 58 | tab_2->setObjectName(QStringLiteral("tab_2")); 59 | pushButton = new QPushButton(tab_2); 60 | pushButton->setObjectName(QStringLiteral("pushButton")); 61 | pushButton->setGeometry(QRect(70, 60, 75, 23)); 62 | tabWidget->addTab(tab_2, QString()); 63 | widget = new QWidget(Settingcolor); 64 | widget->setObjectName(QStringLiteral("widget")); 65 | widget->setGeometry(QRect(420, 110, 241, 181)); 66 | widget->setStyleSheet(QStringLiteral("background-color: rgb(255, 123, 249);")); 67 | label = new QLabel(Settingcolor); 68 | label->setObjectName(QStringLiteral("label")); 69 | label->setGeometry(QRect(70, 330, 141, 51)); 70 | QFont font; 71 | font.setPointSize(14); 72 | label->setFont(font); 73 | label->setStyleSheet(QStringLiteral("background-color: rgb(175, 148, 255);")); 74 | label->setAlignment(Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter); 75 | label->setWordWrap(false); 76 | horizontalLayoutWidget = new QWidget(Settingcolor); 77 | horizontalLayoutWidget->setObjectName(QStringLiteral("horizontalLayoutWidget")); 78 | horizontalLayoutWidget->setGeometry(QRect(270, 370, 401, 31)); 79 | horizontalLayout = new QHBoxLayout(horizontalLayoutWidget); 80 | horizontalLayout->setObjectName(QStringLiteral("horizontalLayout")); 81 | horizontalLayout->setContentsMargins(0, 0, 0, 0); 82 | pushButton_2 = new QPushButton(horizontalLayoutWidget); 83 | pushButton_2->setObjectName(QStringLiteral("pushButton_2")); 84 | 85 | horizontalLayout->addWidget(pushButton_2); 86 | 87 | label_2 = new QLabel(horizontalLayoutWidget); 88 | label_2->setObjectName(QStringLiteral("label_2")); 89 | label_2->setAlignment(Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop); 90 | 91 | horizontalLayout->addWidget(label_2); 92 | 93 | textEdit = new QTextEdit(horizontalLayoutWidget); 94 | textEdit->setObjectName(QStringLiteral("textEdit")); 95 | 96 | horizontalLayout->addWidget(textEdit); 97 | 98 | horizontalSpacer = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum); 99 | 100 | horizontalLayout->addItem(horizontalSpacer); 101 | 102 | 103 | retranslateUi(Settingcolor); 104 | 105 | tabWidget->setCurrentIndex(1); 106 | 107 | 108 | QMetaObject::connectSlotsByName(Settingcolor); 109 | } // setupUi 110 | 111 | void retranslateUi(QWidget *Settingcolor) 112 | { 113 | Settingcolor->setWindowTitle(QApplication::translate("Settingcolor", "Form", nullptr)); 114 | tabWidget->setTabText(tabWidget->indexOf(tab), QApplication::translate("Settingcolor", "Tab 1", nullptr)); 115 | pushButton->setText(QApplication::translate("Settingcolor", "PushButton", nullptr)); 116 | tabWidget->setTabText(tabWidget->indexOf(tab_2), QApplication::translate("Settingcolor", "Tab 2", nullptr)); 117 | label->setText(QApplication::translate("Settingcolor", "\344\275\240\345\223\210", nullptr)); 118 | pushButton_2->setText(QApplication::translate("Settingcolor", "PushButton", nullptr)); 119 | label_2->setText(QApplication::translate("Settingcolor", "3213123333", nullptr)); 120 | textEdit->setHtml(QApplication::translate("Settingcolor", "\n" 121 | "\n" 124 | "

\344\275\240\345\245\275

\n" 125 | "


", nullptr)); 126 | } // retranslateUi 127 | 128 | }; 129 | 130 | namespace Ui { 131 | class Settingcolor: public Ui_Settingcolor {}; 132 | } // namespace Ui 133 | 134 | QT_END_NAMESPACE 135 | 136 | #endif // UI_SETTINGCOLOR_H 137 | -------------------------------------------------------------------------------- /FdogClient/ui_traywidget.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************** 2 | ** Form generated from reading UI file 'traywidget.ui' 3 | ** 4 | ** Created by: Qt User Interface Compiler version 5.10.0 5 | ** 6 | ** WARNING! All changes made in this file will be lost when recompiling UI file! 7 | ********************************************************************************/ 8 | 9 | #ifndef UI_TRAYWIDGET_H 10 | #define UI_TRAYWIDGET_H 11 | 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | 27 | QT_BEGIN_NAMESPACE 28 | 29 | class Ui_Traywidget 30 | { 31 | public: 32 | QVBoxLayout *verticalLayout; 33 | QHBoxLayout *horizontalLayout_2; 34 | QLabel *label; 35 | QSpacerItem *horizontalSpacer_2; 36 | QToolButton *toolButton; 37 | QWidget *widget; 38 | QGridLayout *gridLayout; 39 | QListWidget *listWidget; 40 | QWidget *widget_2; 41 | QHBoxLayout *horizontalLayout; 42 | QPushButton *pushButton; 43 | QSpacerItem *horizontalSpacer; 44 | QPushButton *pushButton_2; 45 | 46 | void setupUi(QWidget *Traywidget) 47 | { 48 | if (Traywidget->objectName().isEmpty()) 49 | Traywidget->setObjectName(QStringLiteral("Traywidget")); 50 | Traywidget->resize(229, 153); 51 | Traywidget->setMaximumSize(QSize(229, 16777215)); 52 | QFont font; 53 | font.setFamily(QStringLiteral("Microsoft YaHei")); 54 | Traywidget->setFont(font); 55 | Traywidget->setStyleSheet(QLatin1String("*{font-family:Microsoft YaHei;}\n" 56 | "#Traywidget{\n" 57 | "background-color: rgb(255, 255, 255);\n" 58 | "}")); 59 | verticalLayout = new QVBoxLayout(Traywidget); 60 | verticalLayout->setSpacing(1); 61 | verticalLayout->setObjectName(QStringLiteral("verticalLayout")); 62 | verticalLayout->setContentsMargins(2, 5, 2, 0); 63 | horizontalLayout_2 = new QHBoxLayout(); 64 | horizontalLayout_2->setSpacing(0); 65 | horizontalLayout_2->setObjectName(QStringLiteral("horizontalLayout_2")); 66 | horizontalLayout_2->setContentsMargins(8, -1, 8, -1); 67 | label = new QLabel(Traywidget); 68 | label->setObjectName(QStringLiteral("label")); 69 | QFont font1; 70 | font1.setFamily(QStringLiteral("Microsoft YaHei")); 71 | font1.setPointSize(10); 72 | font1.setBold(true); 73 | font1.setWeight(75); 74 | font1.setStyleStrategy(QFont::PreferAntialias); 75 | label->setFont(font1); 76 | label->setStyleSheet(QStringLiteral("")); 77 | 78 | horizontalLayout_2->addWidget(label); 79 | 80 | horizontalSpacer_2 = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum); 81 | 82 | horizontalLayout_2->addItem(horizontalSpacer_2); 83 | 84 | toolButton = new QToolButton(Traywidget); 85 | toolButton->setObjectName(QStringLiteral("toolButton")); 86 | QFont font2; 87 | font2.setFamily(QStringLiteral("Microsoft YaHei")); 88 | font2.setStyleStrategy(QFont::PreferAntialias); 89 | toolButton->setFont(font2); 90 | QIcon icon; 91 | icon.addFile(QStringLiteral(":/lib/setting.png"), QSize(), QIcon::Normal, QIcon::Off); 92 | toolButton->setIcon(icon); 93 | toolButton->setAutoRaise(true); 94 | 95 | horizontalLayout_2->addWidget(toolButton); 96 | 97 | 98 | verticalLayout->addLayout(horizontalLayout_2); 99 | 100 | widget = new QWidget(Traywidget); 101 | widget->setObjectName(QStringLiteral("widget")); 102 | widget->setFont(font2); 103 | gridLayout = new QGridLayout(widget); 104 | gridLayout->setObjectName(QStringLiteral("gridLayout")); 105 | listWidget = new QListWidget(widget); 106 | listWidget->setObjectName(QStringLiteral("listWidget")); 107 | listWidget->setMaximumSize(QSize(16777215, 16777215)); 108 | listWidget->setFont(font2); 109 | listWidget->setStyleSheet(QStringLiteral("background-color: rgba(255, 255, 255, 0);")); 110 | 111 | gridLayout->addWidget(listWidget, 0, 0, 1, 1); 112 | 113 | 114 | verticalLayout->addWidget(widget); 115 | 116 | widget_2 = new QWidget(Traywidget); 117 | widget_2->setObjectName(QStringLiteral("widget_2")); 118 | widget_2->setStyleSheet(QLatin1String("border-style:solid;\n" 119 | "border-width:1px;\n" 120 | "border-top-color:rgb(161, 161, 161);")); 121 | horizontalLayout = new QHBoxLayout(widget_2); 122 | horizontalLayout->setSpacing(2); 123 | horizontalLayout->setObjectName(QStringLiteral("horizontalLayout")); 124 | pushButton = new QPushButton(widget_2); 125 | pushButton->setObjectName(QStringLiteral("pushButton")); 126 | pushButton->setMaximumSize(QSize(55, 20)); 127 | pushButton->setFont(font2); 128 | pushButton->setStyleSheet(QStringLiteral("color: rgb(44, 164, 255);")); 129 | pushButton->setAutoDefault(false); 130 | pushButton->setFlat(true); 131 | 132 | horizontalLayout->addWidget(pushButton); 133 | 134 | horizontalSpacer = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum); 135 | 136 | horizontalLayout->addItem(horizontalSpacer); 137 | 138 | pushButton_2 = new QPushButton(widget_2); 139 | pushButton_2->setObjectName(QStringLiteral("pushButton_2")); 140 | pushButton_2->setMaximumSize(QSize(55, 80)); 141 | pushButton_2->setFont(font2); 142 | pushButton_2->setStyleSheet(QStringLiteral("color: rgb(44, 164, 255);")); 143 | pushButton_2->setFlat(true); 144 | 145 | horizontalLayout->addWidget(pushButton_2); 146 | 147 | 148 | verticalLayout->addWidget(widget_2); 149 | 150 | 151 | retranslateUi(Traywidget); 152 | 153 | QMetaObject::connectSlotsByName(Traywidget); 154 | } // setupUi 155 | 156 | void retranslateUi(QWidget *Traywidget) 157 | { 158 | Traywidget->setWindowTitle(QApplication::translate("Traywidget", "Form", nullptr)); 159 | label->setText(QApplication::translate("Traywidget", "\350\212\261\347\213\227Fdog", nullptr)); 160 | toolButton->setText(QApplication::translate("Traywidget", "...", nullptr)); 161 | pushButton->setText(QApplication::translate("Traywidget", "\345\277\275\347\225\245\345\205\250\351\203\250", nullptr)); 162 | pushButton_2->setText(QApplication::translate("Traywidget", "\346\237\245\347\234\213\345\205\250\351\203\250", nullptr)); 163 | } // retranslateUi 164 | 165 | }; 166 | 167 | namespace Ui { 168 | class Traywidget: public Ui_Traywidget {}; 169 | } // namespace Ui 170 | 171 | QT_END_NAMESPACE 172 | 173 | #endif // UI_TRAYWIDGET_H 174 | -------------------------------------------------------------------------------- /FdogClient/ui_verify.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************** 2 | ** Form generated from reading UI file 'verify.ui' 3 | ** 4 | ** Created by: Qt User Interface Compiler version 5.10.0 5 | ** 6 | ** WARNING! All changes made in this file will be lost when recompiling UI file! 7 | ********************************************************************************/ 8 | 9 | #ifndef UI_VERIFY_H 10 | #define UI_VERIFY_H 11 | 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | 27 | QT_BEGIN_NAMESPACE 28 | 29 | class Ui_Verify 30 | { 31 | public: 32 | QVBoxLayout *verticalLayout; 33 | QWidget *widget_2; 34 | QGridLayout *gridLayout; 35 | QHBoxLayout *horizontalLayout; 36 | QLabel *label; 37 | QLabel *label_2; 38 | QSpacerItem *horizontalSpacer; 39 | QToolButton *toolButton; 40 | QToolButton *toolButton_2; 41 | QWidget *widget; 42 | QGridLayout *gridLayout_2; 43 | QTabWidget *tabWidget; 44 | QWidget *tab; 45 | QLabel *label_3; 46 | QLabel *label_5; 47 | QLabel *label_6; 48 | QLabel *label_7; 49 | QPushButton *pushButton; 50 | QPushButton *pushButton_3; 51 | QWidget *tab_2; 52 | 53 | void setupUi(QWidget *Verify) 54 | { 55 | if (Verify->objectName().isEmpty()) 56 | Verify->setObjectName(QStringLiteral("Verify")); 57 | Verify->resize(568, 445); 58 | Verify->setStyleSheet(QLatin1String("*{font-family:Microsoft YaHei;}\n" 59 | "#Verify{\n" 60 | "background-color: rgb(116, 195, 255);\n" 61 | "}")); 62 | verticalLayout = new QVBoxLayout(Verify); 63 | verticalLayout->setSpacing(0); 64 | verticalLayout->setObjectName(QStringLiteral("verticalLayout")); 65 | verticalLayout->setContentsMargins(0, 0, 0, 0); 66 | widget_2 = new QWidget(Verify); 67 | widget_2->setObjectName(QStringLiteral("widget_2")); 68 | widget_2->setStyleSheet(QStringLiteral("background-color: rgb(187, 255, 155);")); 69 | gridLayout = new QGridLayout(widget_2); 70 | gridLayout->setObjectName(QStringLiteral("gridLayout")); 71 | gridLayout->setContentsMargins(6, 0, 6, 0); 72 | horizontalLayout = new QHBoxLayout(); 73 | horizontalLayout->setObjectName(QStringLiteral("horizontalLayout")); 74 | label = new QLabel(widget_2); 75 | label->setObjectName(QStringLiteral("label")); 76 | label->setMinimumSize(QSize(20, 20)); 77 | label->setMaximumSize(QSize(20, 20)); 78 | QFont font; 79 | font.setFamily(QStringLiteral("Microsoft YaHei")); 80 | font.setStyleStrategy(QFont::PreferAntialias); 81 | label->setFont(font); 82 | label->setStyleSheet(QStringLiteral("border-image: url(:/lib/yinshenim.png);")); 83 | 84 | horizontalLayout->addWidget(label); 85 | 86 | label_2 = new QLabel(widget_2); 87 | label_2->setObjectName(QStringLiteral("label_2")); 88 | label_2->setFont(font); 89 | 90 | horizontalLayout->addWidget(label_2); 91 | 92 | horizontalSpacer = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum); 93 | 94 | horizontalLayout->addItem(horizontalSpacer); 95 | 96 | toolButton = new QToolButton(widget_2); 97 | toolButton->setObjectName(QStringLiteral("toolButton")); 98 | toolButton->setFont(font); 99 | QIcon icon; 100 | icon.addFile(QStringLiteral(":/lib/zuixiaohua.png"), QSize(), QIcon::Normal, QIcon::Off); 101 | toolButton->setIcon(icon); 102 | toolButton->setIconSize(QSize(20, 20)); 103 | toolButton->setAutoRaise(true); 104 | 105 | horizontalLayout->addWidget(toolButton); 106 | 107 | toolButton_2 = new QToolButton(widget_2); 108 | toolButton_2->setObjectName(QStringLiteral("toolButton_2")); 109 | toolButton_2->setFont(font); 110 | QIcon icon1; 111 | icon1.addFile(QStringLiteral(":/lib/guanbi.png"), QSize(), QIcon::Normal, QIcon::Off); 112 | toolButton_2->setIcon(icon1); 113 | toolButton_2->setIconSize(QSize(20, 20)); 114 | toolButton_2->setAutoRaise(true); 115 | 116 | horizontalLayout->addWidget(toolButton_2); 117 | 118 | 119 | gridLayout->addLayout(horizontalLayout, 0, 0, 1, 1); 120 | 121 | 122 | verticalLayout->addWidget(widget_2); 123 | 124 | widget = new QWidget(Verify); 125 | widget->setObjectName(QStringLiteral("widget")); 126 | widget->setMinimumSize(QSize(0, 417)); 127 | widget->setFont(font); 128 | widget->setStyleSheet(QStringLiteral("background-color: rgb(179, 255, 250);")); 129 | gridLayout_2 = new QGridLayout(widget); 130 | gridLayout_2->setObjectName(QStringLiteral("gridLayout_2")); 131 | tabWidget = new QTabWidget(widget); 132 | tabWidget->setObjectName(QStringLiteral("tabWidget")); 133 | tabWidget->setFont(font); 134 | tab = new QWidget(); 135 | tab->setObjectName(QStringLiteral("tab")); 136 | label_3 = new QLabel(tab); 137 | label_3->setObjectName(QStringLiteral("label_3")); 138 | label_3->setGeometry(QRect(20, 10, 54, 12)); 139 | label_3->setFont(font); 140 | label_5 = new QLabel(tab); 141 | label_5->setObjectName(QStringLiteral("label_5")); 142 | label_5->setGeometry(QRect(100, 32, 54, 20)); 143 | label_5->setFont(font); 144 | label_6 = new QLabel(tab); 145 | label_6->setObjectName(QStringLiteral("label_6")); 146 | label_6->setGeometry(QRect(100, 60, 54, 16)); 147 | label_6->setFont(font); 148 | label_7 = new QLabel(tab); 149 | label_7->setObjectName(QStringLiteral("label_7")); 150 | label_7->setGeometry(QRect(100, 80, 54, 21)); 151 | label_7->setFont(font); 152 | pushButton = new QPushButton(tab); 153 | pushButton->setObjectName(QStringLiteral("pushButton")); 154 | pushButton->setGeometry(QRect(400, 70, 81, 31)); 155 | QFont font1; 156 | font1.setFamily(QStringLiteral("Microsoft YaHei")); 157 | font1.setPointSize(10); 158 | font1.setStyleStrategy(QFont::PreferAntialias); 159 | pushButton->setFont(font1); 160 | pushButton->setStyleSheet(QLatin1String("#pushButton{\n" 161 | "background-color: rgb(99, 188, 255);\n" 162 | "color: rgb(255, 255, 255);\n" 163 | "border-radius: 5px;\n" 164 | "}\n" 165 | "#pushButton:hover{\n" 166 | "background-color: rgb(99, 170, 255);\n" 167 | "color: rgb(255, 255, 255);\n" 168 | "border-radius: 5px;\n" 169 | "\n" 170 | "}\n" 171 | "#pushButton:pressed{\n" 172 | "background-color: rgb(99, 188, 255);\n" 173 | "color: rgb(255, 255, 255);\n" 174 | "border-radius: 5px;\n" 175 | "padding-left:2px;\n" 176 | "padding-top:2px;\n" 177 | "}\n" 178 | "")); 179 | pushButton_3 = new QPushButton(tab); 180 | pushButton_3->setObjectName(QStringLiteral("pushButton_3")); 181 | pushButton_3->setGeometry(QRect(20, 40, 61, 61)); 182 | pushButton_3->setFont(font); 183 | pushButton_3->setIconSize(QSize(55, 55)); 184 | pushButton_3->setAutoDefault(false); 185 | pushButton_3->setFlat(true); 186 | tabWidget->addTab(tab, QString()); 187 | tab_2 = new QWidget(); 188 | tab_2->setObjectName(QStringLiteral("tab_2")); 189 | tabWidget->addTab(tab_2, QString()); 190 | 191 | gridLayout_2->addWidget(tabWidget, 0, 0, 1, 1); 192 | 193 | 194 | verticalLayout->addWidget(widget); 195 | 196 | verticalLayout->setStretch(0, 1); 197 | verticalLayout->setStretch(1, 12); 198 | 199 | retranslateUi(Verify); 200 | 201 | tabWidget->setCurrentIndex(0); 202 | pushButton_3->setDefault(false); 203 | 204 | 205 | QMetaObject::connectSlotsByName(Verify); 206 | } // setupUi 207 | 208 | void retranslateUi(QWidget *Verify) 209 | { 210 | Verify->setWindowTitle(QApplication::translate("Verify", "Form", nullptr)); 211 | label->setText(QString()); 212 | label_2->setText(QApplication::translate("Verify", "\351\252\214\350\257\201\344\277\241\346\201\257", nullptr)); 213 | toolButton->setText(QApplication::translate("Verify", "...", nullptr)); 214 | toolButton_2->setText(QApplication::translate("Verify", "...", nullptr)); 215 | label_3->setText(QApplication::translate("Verify", "4\346\234\21028\346\227\245", nullptr)); 216 | label_5->setText(QString()); 217 | label_6->setText(QString()); 218 | label_7->setText(QString()); 219 | pushButton->setText(QApplication::translate("Verify", "\346\267\273\345\212\240/\346\213\222\347\273\235", nullptr)); 220 | pushButton_3->setText(QString()); 221 | tabWidget->setTabText(tabWidget->indexOf(tab), QApplication::translate("Verify", "\345\245\275\345\217\213\351\252\214\350\257\201", nullptr)); 222 | tabWidget->setTabText(tabWidget->indexOf(tab_2), QApplication::translate("Verify", "\347\276\244\351\252\214\350\257\201", nullptr)); 223 | } // retranslateUi 224 | 225 | }; 226 | 227 | namespace Ui { 228 | class Verify: public Ui_Verify {}; 229 | } // namespace Ui 230 | 231 | QT_END_NAMESPACE 232 | 233 | #endif // UI_VERIFY_H 234 | -------------------------------------------------------------------------------- /FdogClient/usersql.h: -------------------------------------------------------------------------------- 1 | #ifndef USERSQL_H 2 | #define USERSQL_H 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | class Usersql 9 | { 10 | private: 11 | QString IP = ""; 12 | QSqlDatabase dbconn; //连接数据库 13 | QSqlQuery query; //查询操作 14 | QString account = ""; //主体账号 15 | QString phone = ""; //主体手机号 16 | QString name = ""; //主体昵称 17 | QString passwd = ""; //主体密码 18 | QString signature =""; //主体个性签名 19 | QString iconurl = ""; //主体地址 20 | QPixmap icon; //主体头像 21 | QString grade = ""; //主体帐号等级 22 | QString namet = ""; //主体姓名 23 | QString sex = ""; //主体性别 24 | QString age = ""; //主体年龄 25 | QString birthday = ""; //主体生日 26 | QString profession = "";//主体职业 27 | QStringList grouping; //分组信息 28 | QStringList mfriend; //好友帐户 29 | QStringList mfriendname;//好友昵称 30 | int sate = -1; //主体账号登录显示状态 -1离线 0在线 1F我吧 2隐身 3离开 4忙碌 5勿扰 31 | bool power; //权限 32 | public: 33 | Usersql(); 34 | bool connData(); //连接数据库 35 | bool queryUser(const QString &user,const QString &password); //查询是否有该账户 36 | QPixmap getIconUrl(const QString &url); //获取账户图片 37 | QPixmap getPixmapIcon(const QString &url); //调用geticonurl函数并对图片进行圆角化 38 | void queryUserInfo(const QString &account); //获取账号基本信息 39 | void AccountIP(const QString &ip);//获取ip在线状态,包括在线,隐身,Q我,忙碌,离线等等 40 | QString getOtherAccountName(const QString &otheraccount); //根据账号获取名字 41 | QString getOtherAccountSex(const QString &otheraccount); //根据账号获取性别 42 | QString getOtherAccountAge(const QString &otheraccount); //根据账号获取年龄 43 | QString getOtherAccountProfession(const QString &otheraccount);//根据账号获取职业 44 | void setverify(const QString &time,const QString &account,const QString &sate,const QString &name,const QString &grouping,const QString &otheraccount);//添加好友数据 45 | void getverify(const QString &time,const QString &otheraccount,const QString &sate,const QString &name,const QString &grouping,const QString &account);//添加好友数据 46 | QString getverifygrouping(const QString &account,const QString &otheraccount);//获取主动添加方设置的分组 47 | void updatagrouping(const QString &otheraccount,const QString &account);//暂无 48 | QString isLine(const QString &account); 49 | //getset函数 50 | QPixmap getIcon() const; 51 | void setIcon(const QPixmap &value); 52 | QString getAccount() const; 53 | void setAccount(const QString &value); 54 | QString getName() const; 55 | void setName(const QString &value); 56 | QString getSignature() const; 57 | void setSignature(const QString &value); 58 | QString getPasswd() const; 59 | void setPasswd(const QString &value); 60 | QString getAge() const; 61 | void setAge(const QString &value); 62 | QStringList getGrouping() const; 63 | void setGrouping(const QStringList &value); 64 | QStringList getMfriend() const; 65 | void setMfriend(const QStringList &value); 66 | QStringList getMfriendname() const; 67 | void setMfriendname(const QStringList &value); 68 | QString getGrade() const; 69 | void setGrade(const QString &value); 70 | QString getProfession() const; 71 | void setProfession(const QString &value); 72 | QString getSex() const; 73 | void setSex(const QString &value); 74 | QString getIP() const; 75 | void setIP(const QString &value); 76 | int getA() const; 77 | void setA(int value); 78 | int getSate() const; 79 | void setSate(int value); 80 | }; 81 | 82 | #endif // USERSQL_H 83 | -------------------------------------------------------------------------------- /FdogClient/verify.cpp: -------------------------------------------------------------------------------- 1 | #include "verify.h" 2 | #include "ui_verify.h" 3 | #include"globalobserver.h" 4 | #include"agreefriend.h" 5 | #if _MSC_VER >= 1600 6 | #pragma execution_character_set("utf-8") 7 | #endif 8 | 9 | Verify::Verify(QString account,QString otheraccount,QString time,QPixmap icon,QString name,QString sex,QString age,QString add,QWidget *parent) : 10 | QWidget(parent), 11 | ui(new Ui::Verify) 12 | { 13 | ui->setupUi(this); 14 | this->time=time; 15 | this->name=name; 16 | this->sex=sex; 17 | this->age=age; 18 | this->account=account; 19 | this->otheraccount=otheraccount; 20 | setWindowFlags (Qt::FramelessWindowHint); 21 | ui->label_3->setText(time); 22 | ui->pushButton_3->setIcon(Globalobserver::PixmapToRound(icon, icon.width()/2)); 23 | ui->label_5->setText(name); 24 | ui->label_6->setText(sex+" "+age); 25 | ui->label_7->setText("附加信息:"+add); 26 | } 27 | 28 | Verify::~Verify() 29 | { 30 | delete ui; 31 | } 32 | 33 | void Verify::mousePressEvent(QMouseEvent *event) 34 | { 35 | isPressedWidget = true; // 当前鼠标按下的即是QWidget而非界面上布局的其它控件 36 | last = event->globalPos(); 37 | } 38 | 39 | void Verify::mouseMoveEvent(QMouseEvent *event) 40 | { 41 | if (isPressedWidget) 42 | { 43 | int dx = event->globalX() - last.x(); 44 | int dy = event->globalY() - last.y(); 45 | last = event->globalPos(); 46 | move(x()+dx, y()+dy); 47 | } 48 | } 49 | 50 | void Verify::mouseReleaseEvent(QMouseEvent *event) 51 | { 52 | int dx = event->globalX() - last.x(); 53 | int dy = event->globalY() - last.y(); 54 | move(x()+dx, y()+dy); 55 | isPressedWidget = false; // 鼠标松开时,置为false 56 | } 57 | 58 | void Verify::on_pushButton_clicked() 59 | { 60 | Usersql sqconn; 61 | sqconn.connData(); 62 | sqconn.queryUserInfo(this->account); 63 | QStringList grouping =sqconn.getGrouping(); 64 | agreefriend = new Agreefriend(this->account,this->otheraccount,this->name,grouping); 65 | agreefriend->show(); 66 | } 67 | 68 | void Verify::on_toolButton_clicked() 69 | { 70 | this->hide(); 71 | } 72 | 73 | void Verify::on_toolButton_2_clicked() 74 | { 75 | this->hide(); 76 | } 77 | -------------------------------------------------------------------------------- /FdogClient/verify.h: -------------------------------------------------------------------------------- 1 | #ifndef VERIFY_H 2 | #define VERIFY_H 3 | class Agreefriend; 4 | #include 5 | #include"agreefriend.h" 6 | #include"usersql.h" 7 | #include"globalobserver.h" 8 | namespace Ui { 9 | class Verify; 10 | } 11 | 12 | class Verify : public QWidget 13 | { 14 | Q_OBJECT 15 | 16 | QPoint last; //窗口拖动用变量 17 | bool isPressedWidget; 18 | Agreefriend * agreefriend; 19 | QString account; //账号 20 | QString time; //时间 21 | QString name; //对方网名 22 | QString sex; //对方性别 23 | QString age; //对方年龄 24 | QString otheraccount;//对方账号 25 | 26 | public: 27 | //时间 头像 名字 男 16岁 28 | //附加信息 29 | explicit Verify(QString account,QString otheraccount,QString time,QPixmap icon,QString name,QString sex,QString age,QString add = "申请添加我为好友",QWidget *parent = 0); 30 | ~Verify(); 31 | void mousePressEvent(QMouseEvent *event);//鼠标点击 32 | void mouseMoveEvent(QMouseEvent *event);//鼠标移动 33 | void mouseReleaseEvent(QMouseEvent *event);//鼠标释放 34 | 35 | private slots: 36 | void on_pushButton_clicked(); 37 | 38 | void on_toolButton_clicked(); 39 | 40 | void on_toolButton_2_clicked(); 41 | 42 | private: 43 | Ui::Verify *ui; 44 | }; 45 | 46 | #endif // VERIFY_H 47 | -------------------------------------------------------------------------------- /FdogServer/.qmake.stash: -------------------------------------------------------------------------------- 1 | QMAKE_CXX.INCDIRS = \ 2 | D:\\VisualStudio2015\\VC\\INCLUDE \ 3 | D:\\VisualStudio2015\\VC\\ATLMFC\\INCLUDE \ 4 | "C:\\Program Files (x86)\\Windows Kits\\10\\include\\10.0.10240.0\\ucrt" \ 5 | "C:\\Program Files (x86)\\Windows Kits\\NETFXSDK\\4.6.1\\include\\um" \ 6 | "C:\\Program Files (x86)\\Windows Kits\\8.1\\include\\\\shared" \ 7 | "C:\\Program Files (x86)\\Windows Kits\\8.1\\include\\\\um" \ 8 | "C:\\Program Files (x86)\\Windows Kits\\8.1\\include\\\\winrt" \ 9 | "C:\\Program Files (x86)\\Windows Kits\\8.1\\Include" 10 | QMAKE_CXX.LIBDIRS = \ 11 | D:\\VisualStudio2015\\VC\\LIB\\amd64 \ 12 | D:\\VisualStudio2015\\VC\\ATLMFC\\LIB\\amd64 \ 13 | "C:\\Program Files (x86)\\Windows Kits\\10\\lib\\10.0.10240.0\\ucrt\\x64" \ 14 | "C:\\Program Files (x86)\\Windows Kits\\NETFXSDK\\4.6.1\\lib\\um\\x64" \ 15 | "C:\\Program Files (x86)\\Windows Kits\\8.1\\lib\\winv6.3\\um\\x64" 16 | QMAKE_CXX.QT_COMPILER_STDCXX = 199711L 17 | QMAKE_CXX.QMAKE_MSC_VER = 1900 18 | QMAKE_CXX.QMAKE_MSC_FULL_VER = 190024215 19 | QMAKE_CXX.COMPILER_MACROS = \ 20 | QT_COMPILER_STDCXX \ 21 | QMAKE_MSC_VER \ 22 | QMAKE_MSC_FULL_VER 23 | -------------------------------------------------------------------------------- /FdogServer/lib.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /FdogServer/main.cpp: -------------------------------------------------------------------------------- 1 | #include "mainwindow.h" 2 | #include 3 | 4 | int main(int argc, char *argv[]) 5 | { 6 | QApplication a(argc, argv); 7 | MainWindow w; 8 | w.show(); 9 | 10 | return a.exec(); 11 | } 12 | -------------------------------------------------------------------------------- /FdogServer/mainwindow.cpp: -------------------------------------------------------------------------------- 1 | #include "mainwindow.h" 2 | #include "ui_mainwindow.h" 3 | #include 4 | #include 5 | #include 6 | #include 7 | #if _MSC_VER >= 1600 8 | #pragma execution_character_set("utf-8") 9 | #endif 10 | MainWindow::MainWindow(QWidget *parent) : 11 | QMainWindow(parent), 12 | ui(new Ui::MainWindow) 13 | { 14 | ui->setupUi(this); 15 | if(!sqconn.conndata())//连接数据库 16 | { 17 | ui->plainTextEdit->appendPlainText("数据库连接不成功,请重试!"); 18 | return; 19 | } 20 | LabListen = new QLabel("监听状态:"); 21 | LabListen->setMinimumWidth(150); 22 | ui->statusBar->addWidget(LabListen); 23 | 24 | LabSocketState = new QLabel("Socket状态:"); 25 | LabSocketState->setMinimumWidth(200); 26 | ui->statusBar->addWidget(LabSocketState); 27 | 28 | QString localIP = getLocalIP();//本机IP 29 | this->setWindowTitle(this->windowTitle()+"----本机IP:"+localIP); 30 | ui->comboIP->addItem(localIP); 31 | tcpServer = new QTcpServer(this); 32 | connect(tcpServer,SIGNAL(newConnection()),this,SLOT(onNewConnection())); 33 | on_pushButton_clicked(); 34 | } 35 | 36 | MainWindow::~MainWindow() 37 | { 38 | delete ui; 39 | } 40 | 41 | void MainWindow::onNewConnection() 42 | { 43 | QTcpSocket * tcpSocket = new QTcpSocket(); 44 | tcpSocket = tcpServer->nextPendingConnection(); 45 | this->tcpSocket.append(tcpSocket); 46 | this->isfrist.append(false); 47 | onClientConnected(tcpSocket->peerPort()); 48 | QSignalMapper * myMapper1 = new QSignalMapper(this); 49 | connect(tcpSocket, SIGNAL(disconnected()), myMapper1, SLOT(map())); 50 | myMapper1->setMapping(tcpSocket,tcpSocket->peerPort()); 51 | connect(myMapper1, SIGNAL(mapped(int)), this, SLOT(onClientDisconnected(int))); 52 | 53 | connect(tcpSocket,SIGNAL(stateChanged(QAbstractSocket::SocketState)), 54 | this,SLOT(onSocketStateChange(QAbstractSocket::SocketState))); 55 | QSignalMapper * myMapper2 = new QSignalMapper(this); 56 | connect(tcpSocket, SIGNAL(readyRead()), myMapper2, SLOT(map())); 57 | myMapper2->setMapping(tcpSocket,tcpSocket->peerPort()); 58 | connect(myMapper2, SIGNAL(mapped(int)), this, SLOT(onSocketReadyRead(int))); 59 | } 60 | 61 | void MainWindow::onSocketStateChange(QAbstractSocket::SocketState socketState) 62 | { 63 | switch (socketState) { 64 | case QAbstractSocket::UnconnectedState: 65 | LabSocketState->setText("scoket状态:UnconnectedState"); 66 | break; 67 | case QAbstractSocket::HostLookupState: 68 | LabSocketState->setText("scoket状态:HostLookupState"); 69 | break; 70 | case QAbstractSocket::ConnectingState: 71 | LabSocketState->setText("scoket状态:ConnectingState"); 72 | break; 73 | case QAbstractSocket::ConnectedState: 74 | LabSocketState->setText("scoket状态:ConnectedState"); 75 | break; 76 | case QAbstractSocket::BoundState: 77 | LabSocketState->setText("scoket状态:BoundState"); 78 | break; 79 | case QAbstractSocket::ClosingState: 80 | LabSocketState->setText("scoket状态:ClosingState"); 81 | break; 82 | case QAbstractSocket::ListeningState: 83 | LabSocketState->setText("scoket状态:ListeningState"); 84 | break; 85 | default: 86 | break; 87 | } 88 | } 89 | 90 | void MainWindow::onClientConnected(int i) 91 | { 92 | for(int j=0;jpeerPort()==i) 95 | { 96 | ui->plainTextEdit->appendPlainText("客户端套接字已连接"); 97 | ui->plainTextEdit->appendPlainText("客户端IP:"+ 98 | tcpSocket[j]->peerAddress().toString()); 99 | ui->plainTextEdit->appendPlainText("客户端随机分配端口号:"+ 100 | QString::number(tcpSocket[j]->peerPort())); 101 | ui->listWidget->addItem(tcpSocket[j]->peerAddress().toString()+" "+QString::number(tcpSocket[j]->peerPort())); 102 | } 103 | } 104 | } 105 | 106 | void MainWindow::onClientDisconnected(int i) 107 | { 108 | 109 | for(int j=0;jpeerPort()==i) 112 | { 113 | ui->plainTextEdit->appendPlainText("客户端套接字已断开连接"); 114 | sqconn.update(QString::number(tcpSocket[j]->peerPort())); 115 | tcpSocket[j]->deleteLater(); 116 | this->tcpSocket.removeAt(j); 117 | this->isfrist.removeAt(j); 118 | //对列表做删除操作 119 | ui->listWidget->takeItem(j); 120 | } 121 | } 122 | } 123 | 124 | void MainWindow::onSocketReadyRead(int i) 125 | { 126 | 127 | for(int j=0;jpeerPort()==i) 130 | { 131 | if(this->isfrist[j]==false) 132 | { 133 | //获取连接账号 134 | QString account = tcpSocket[j]->readLine(); 135 | //写入数据库 136 | qDebug()<<"写入数据库"; 137 | sqconn.update(account,QString::number(tcpSocket[j]->peerPort())); 138 | this->isfrist[j]=true; 139 | } 140 | else 141 | { 142 | while(tcpSocket[j]->canReadLine()) 143 | { 144 | //ui->plainTextEdit->appendPlainText("[in]"+tcpSocket[i]->readLine()); 145 | //获取内容 146 | QString data = tcpSocket[j]->readLine(); 147 | //data.mid(0,8);为到达方 data.mid(8,8);为发送方 148 | //遍历列表ip是否登录 149 | //遍历数据库查询该帐户 150 | QString account = data.mid(0,8); 151 | qDebug()<<"目标帐户为:"<tcpSocket.length();i++) 155 | { 156 | if(QString::number(tcpSocket[i]->peerPort())==port)//说明在线 157 | { //将数据转发给到达方,并保留发送方帐户,用于窗口识别 158 | QByteArray str = data.mid(8).toUtf8(); 159 | tcpSocket[i]->write(str); 160 | qDebug()<<"目标端口号:"<peerPort(); 161 | } 162 | } 163 | } 164 | } 165 | } 166 | } 167 | } 168 | 169 | QString MainWindow::getLocalIP() 170 | { 171 | //获取本机IPv4地址 172 | QString hostName = QHostInfo::localHostName();//本机主机名 173 | QHostInfo hostInfo = QHostInfo::fromName(hostName); 174 | QString localIP=""; 175 | QList addList = hostInfo.addresses(); 176 | if(!addList.isEmpty()) 177 | { 178 | for(int i = 0;iplainTextEdit->clear(); 195 | QString IP = ui->comboIP->currentText();//IP地址 196 | qDebug()<<"值:"<spinBox->value(); 197 | quint16 port = ui->spinBox->value();//端口 198 | QHostAddress addr(IP); 199 | tcpServer->listen(addr,port); 200 | ui->plainTextEdit->appendPlainText("开始监听..."); 201 | ui->plainTextEdit->appendPlainText("服务器地址:" 202 | +tcpServer->serverAddress().toString()); 203 | ui->plainTextEdit->appendPlainText("服务器端口:" 204 | +QString::number(tcpServer->serverPort())); 205 | ui->plainTextEdit->appendPlainText("*******************************"); 206 | ui->pushButton->setEnabled(false); 207 | ui->pushButton_2->setEnabled(true); 208 | 209 | LabListen->setText("监听状态:正在监听"); 210 | } 211 | 212 | void MainWindow::on_pushButton_2_clicked() 213 | { 214 | //停止监听 215 | if(tcpServer->isListening()) 216 | { 217 | tcpServer->close(); 218 | ui->pushButton->setEnabled(true); 219 | ui->pushButton_2->setEnabled(false); 220 | ui->plainTextEdit->clear(); 221 | ui->plainTextEdit->appendPlainText("已停止监听..."); 222 | LabListen->setText("监听状态:已停止监听"); 223 | } 224 | } 225 | -------------------------------------------------------------------------------- /FdogServer/mainwindow.h: -------------------------------------------------------------------------------- 1 | #ifndef MAINWINDOW_H 2 | #define MAINWINDOW_H 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | namespace Ui { 10 | class MainWindow; 11 | } 12 | 13 | class MainWindow : public QMainWindow 14 | { 15 | Q_OBJECT 16 | private: 17 | usersql sqconn; //连接数据库 18 | QLabel * LabListen; //状态栏标签 19 | QLabel * LabSocketState; //状态栏标签 20 | QTcpServer * tcpServer; //TCP服务器 21 | QList tcpSocket;//TCP通信的Socket 22 | QList isfrist; //判断是否第一条消息 23 | public: 24 | explicit MainWindow(QWidget *parent = 0); 25 | QString getLocalIP(); //获取本机IP地址 26 | ~MainWindow(); 27 | 28 | 29 | private slots: 30 | void onNewConnection(); 31 | void onSocketStateChange(QAbstractSocket::SocketState socketState); 32 | void onClientConnected(int); 33 | void onClientDisconnected(int); 34 | void onSocketReadyRead(int); 35 | void on_pushButton_clicked(); 36 | void on_pushButton_2_clicked(); 37 | 38 | private: 39 | Ui::MainWindow *ui; 40 | }; 41 | 42 | #endif // MAINWINDOW_H 43 | -------------------------------------------------------------------------------- /FdogServer/mainwindow.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | MainWindow 4 | 5 | 6 | 7 | 0 8 | 0 9 | 509 10 | 416 11 | 12 | 13 | 14 | 服务端 15 | 16 | 17 | 18 | 19 | 20 | 21 | #MainWindow{ 22 | border-image: url(:/FdogInstantMessaging/Fdogpc/lib/10001.jpg); 23 | } 24 | 25 | 26 | 27 | 9 28 | 29 | 30 | 9 31 | 32 | 33 | 9 34 | 35 | 36 | 9 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 开始监听 50 | 51 | 52 | 53 | 54 | 55 | 56 | 停止监听 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 监听地址: 68 | 69 | 70 | 71 | 72 | 73 | 74 | true 75 | 76 | 77 | 78 | 79 | 80 | 81 | 监听端口: 82 | 83 | 84 | 85 | 86 | 87 | 88 | 60 89 | 90 | 91 | 10000 92 | 93 | 94 | 60 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 当前在线用户: 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | -------------------------------------------------------------------------------- /FdogServer/ui_mainwindow.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************** 2 | ** Form generated from reading UI file 'mainwindow.ui' 3 | ** 4 | ** Created by: Qt User Interface Compiler version 5.10.0 5 | ** 6 | ** WARNING! All changes made in this file will be lost when recompiling UI file! 7 | ********************************************************************************/ 8 | 9 | #ifndef UI_MAINWINDOW_H 10 | #define UI_MAINWINDOW_H 11 | 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | 30 | QT_BEGIN_NAMESPACE 31 | 32 | class Ui_MainWindow 33 | { 34 | public: 35 | QWidget *centralWidget; 36 | QGridLayout *gridLayout_2; 37 | QHBoxLayout *horizontalLayout_4; 38 | QVBoxLayout *verticalLayout_2; 39 | QGridLayout *gridLayout; 40 | QHBoxLayout *horizontalLayout; 41 | QPushButton *pushButton; 42 | QPushButton *pushButton_2; 43 | QHBoxLayout *horizontalLayout_2; 44 | QLabel *label; 45 | QComboBox *comboIP; 46 | QLabel *label_2; 47 | QSpinBox *spinBox; 48 | QPlainTextEdit *plainTextEdit; 49 | QVBoxLayout *verticalLayout; 50 | QListWidget *listWidget; 51 | QLabel *label_3; 52 | QStatusBar *statusBar; 53 | 54 | void setupUi(QMainWindow *MainWindow) 55 | { 56 | if (MainWindow->objectName().isEmpty()) 57 | MainWindow->setObjectName(QStringLiteral("MainWindow")); 58 | MainWindow->resize(509, 416); 59 | MainWindow->setStyleSheet(QStringLiteral("")); 60 | centralWidget = new QWidget(MainWindow); 61 | centralWidget->setObjectName(QStringLiteral("centralWidget")); 62 | centralWidget->setStyleSheet(QLatin1String("#MainWindow{\n" 63 | "border-image: url(:/FdogInstantMessaging/Fdogpc/lib/10001.jpg);\n" 64 | "}")); 65 | gridLayout_2 = new QGridLayout(centralWidget); 66 | gridLayout_2->setSpacing(6); 67 | gridLayout_2->setContentsMargins(11, 11, 11, 11); 68 | gridLayout_2->setObjectName(QStringLiteral("gridLayout_2")); 69 | gridLayout_2->setContentsMargins(9, 9, 9, 9); 70 | horizontalLayout_4 = new QHBoxLayout(); 71 | horizontalLayout_4->setSpacing(6); 72 | horizontalLayout_4->setObjectName(QStringLiteral("horizontalLayout_4")); 73 | verticalLayout_2 = new QVBoxLayout(); 74 | verticalLayout_2->setSpacing(6); 75 | verticalLayout_2->setObjectName(QStringLiteral("verticalLayout_2")); 76 | gridLayout = new QGridLayout(); 77 | gridLayout->setSpacing(6); 78 | gridLayout->setObjectName(QStringLiteral("gridLayout")); 79 | horizontalLayout = new QHBoxLayout(); 80 | horizontalLayout->setSpacing(6); 81 | horizontalLayout->setObjectName(QStringLiteral("horizontalLayout")); 82 | pushButton = new QPushButton(centralWidget); 83 | pushButton->setObjectName(QStringLiteral("pushButton")); 84 | 85 | horizontalLayout->addWidget(pushButton); 86 | 87 | pushButton_2 = new QPushButton(centralWidget); 88 | pushButton_2->setObjectName(QStringLiteral("pushButton_2")); 89 | 90 | horizontalLayout->addWidget(pushButton_2); 91 | 92 | 93 | gridLayout->addLayout(horizontalLayout, 0, 0, 1, 1); 94 | 95 | horizontalLayout_2 = new QHBoxLayout(); 96 | horizontalLayout_2->setSpacing(6); 97 | horizontalLayout_2->setObjectName(QStringLiteral("horizontalLayout_2")); 98 | label = new QLabel(centralWidget); 99 | label->setObjectName(QStringLiteral("label")); 100 | 101 | horizontalLayout_2->addWidget(label); 102 | 103 | comboIP = new QComboBox(centralWidget); 104 | comboIP->setObjectName(QStringLiteral("comboIP")); 105 | comboIP->setEditable(true); 106 | 107 | horizontalLayout_2->addWidget(comboIP); 108 | 109 | label_2 = new QLabel(centralWidget); 110 | label_2->setObjectName(QStringLiteral("label_2")); 111 | 112 | horizontalLayout_2->addWidget(label_2); 113 | 114 | spinBox = new QSpinBox(centralWidget); 115 | spinBox->setObjectName(QStringLiteral("spinBox")); 116 | spinBox->setMinimum(60); 117 | spinBox->setMaximum(10000); 118 | spinBox->setValue(60); 119 | 120 | horizontalLayout_2->addWidget(spinBox); 121 | 122 | 123 | gridLayout->addLayout(horizontalLayout_2, 2, 0, 1, 1); 124 | 125 | plainTextEdit = new QPlainTextEdit(centralWidget); 126 | plainTextEdit->setObjectName(QStringLiteral("plainTextEdit")); 127 | 128 | gridLayout->addWidget(plainTextEdit, 3, 0, 1, 1); 129 | 130 | verticalLayout = new QVBoxLayout(); 131 | verticalLayout->setSpacing(6); 132 | verticalLayout->setObjectName(QStringLiteral("verticalLayout")); 133 | listWidget = new QListWidget(centralWidget); 134 | listWidget->setObjectName(QStringLiteral("listWidget")); 135 | 136 | verticalLayout->addWidget(listWidget); 137 | 138 | 139 | gridLayout->addLayout(verticalLayout, 2, 1, 2, 1); 140 | 141 | label_3 = new QLabel(centralWidget); 142 | label_3->setObjectName(QStringLiteral("label_3")); 143 | 144 | gridLayout->addWidget(label_3, 0, 1, 1, 1); 145 | 146 | 147 | verticalLayout_2->addLayout(gridLayout); 148 | 149 | 150 | horizontalLayout_4->addLayout(verticalLayout_2); 151 | 152 | 153 | gridLayout_2->addLayout(horizontalLayout_4, 0, 0, 1, 1); 154 | 155 | MainWindow->setCentralWidget(centralWidget); 156 | statusBar = new QStatusBar(MainWindow); 157 | statusBar->setObjectName(QStringLiteral("statusBar")); 158 | MainWindow->setStatusBar(statusBar); 159 | 160 | retranslateUi(MainWindow); 161 | 162 | QMetaObject::connectSlotsByName(MainWindow); 163 | } // setupUi 164 | 165 | void retranslateUi(QMainWindow *MainWindow) 166 | { 167 | MainWindow->setWindowTitle(QApplication::translate("MainWindow", "\346\234\215\345\212\241\347\253\257", nullptr)); 168 | pushButton->setText(QApplication::translate("MainWindow", "\345\274\200\345\247\213\347\233\221\345\220\254", nullptr)); 169 | pushButton_2->setText(QApplication::translate("MainWindow", "\345\201\234\346\255\242\347\233\221\345\220\254", nullptr)); 170 | label->setText(QApplication::translate("MainWindow", "\347\233\221\345\220\254\345\234\260\345\235\200\357\274\232", nullptr)); 171 | label_2->setText(QApplication::translate("MainWindow", "\347\233\221\345\220\254\347\253\257\345\217\243\357\274\232", nullptr)); 172 | label_3->setText(QApplication::translate("MainWindow", "\345\275\223\345\211\215\345\234\250\347\272\277\347\224\250\346\210\267\357\274\232", nullptr)); 173 | } // retranslateUi 174 | 175 | }; 176 | 177 | namespace Ui { 178 | class MainWindow: public Ui_MainWindow {}; 179 | } // namespace Ui 180 | 181 | QT_END_NAMESPACE 182 | 183 | #endif // UI_MAINWINDOW_H 184 | -------------------------------------------------------------------------------- /FdogServer/untitled2.pro: -------------------------------------------------------------------------------- 1 | #------------------------------------------------- 2 | # 3 | # Project created by QtCreator 2021-01-21T22:02:48 4 | # 5 | #------------------------------------------------- 6 | 7 | QT += core gui 8 | 9 | greaterThan(QT_MAJOR_VERSION, 4): QT += widgets 10 | 11 | TARGET = untitled2 12 | TEMPLATE = app 13 | 14 | # The following define makes your compiler emit warnings if you use 15 | # any feature of Qt which has been marked as deprecated (the exact warnings 16 | # depend on your compiler). Please consult the documentation of the 17 | # deprecated API in order to know how to port your code away from it. 18 | DEFINES += QT_DEPRECATED_WARNINGS 19 | 20 | # You can also make your code fail to compile if you use deprecated APIs. 21 | # In order to do so, uncomment the following line. 22 | # You can also select to disable deprecated APIs only up to a certain version of Qt. 23 | #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 24 | 25 | 26 | SOURCES += \ 27 | main.cpp \ 28 | mainwindow.cpp \ 29 | usersql.cpp 30 | 31 | HEADERS += \ 32 | mainwindow.h \ 33 | usersql.h 34 | 35 | FORMS += \ 36 | mainwindow.ui 37 | 38 | 39 | QT +=network 40 | 41 | QT +=sql 42 | -------------------------------------------------------------------------------- /FdogServer/usersql.cpp: -------------------------------------------------------------------------------- 1 | #include "usersql.h" 2 | #include 3 | #include 4 | usersql::usersql() 5 | { 6 | 7 | } 8 | 9 | bool usersql::conndata() 10 | { 11 | if(QSqlDatabase::contains(QSqlDatabase::defaultConnection)) 12 | { 13 | this->dbconn = QSqlDatabase::database(QSqlDatabase::defaultConnection); 14 | } 15 | else 16 | { 17 | this->dbconn = QSqlDatabase::addDatabase("QMYSQL"); 18 | } 19 | this-> dbconn.setHostName("82.156.111.139");//主机名字 20 | this-> dbconn.setDatabaseName("fdogsql");//数据库名字 21 | if(this->dbconn.open("root", "xxxxx")) 22 | { 23 | this->query = (QSqlQuery)this->dbconn; //进行绑定 此后可以使用query对象对数据库进行操作 24 | return true; 25 | } 26 | return false; 27 | } 28 | QString usersql::AccountIP(QString account) 29 | { 30 | this->query.exec("select * from state"); 31 | while(query.next()) 32 | { 33 | if(this->query.value(0).toString()==account) 34 | { 35 | return this->query.value(3).toString(); 36 | } 37 | } 38 | return ""; 39 | } 40 | 41 | QString usersql::update(QString account, QString port) 42 | { 43 | QString s = QString("update state set port=%1 where account=%2").arg(port,account); 44 | qDebug()<query.exec(s); 46 | return ""; 47 | } 48 | 49 | QString usersql::update(QString port) 50 | { 51 | QString s = QString("update state set port=0000 where port=%2").arg(port); 52 | qDebug()<query.exec(s); 54 | return ""; 55 | } 56 | -------------------------------------------------------------------------------- /FdogServer/usersql.h: -------------------------------------------------------------------------------- 1 | #ifndef USERSQL_H 2 | #define USERSQL_H 3 | #include 4 | #include 5 | #include 6 | class usersql 7 | { 8 | private: 9 | QSqlDatabase dbconn; //连接数据库 10 | QSqlQuery query; //查询操作 11 | public: 12 | usersql(); 13 | bool conndata(); //连接数据库 14 | QString AccountIP(QString account);//获取目标ip 15 | QString update(QString account,QString port); 16 | QString update(QString port); 17 | }; 18 | 19 | #endif // USERSQL_H 20 | -------------------------------------------------------------------------------- /FdogSql/fdogsql.sql: -------------------------------------------------------------------------------- 1 | /* 2 | Navicat Premium Data Transfer 3 | 4 | Source Server : fdog 5 | Source Server Type : MySQL 6 | Source Server Version : 50733 7 | Source Host : localhost:3306 8 | Source Schema : fdogsql 9 | 10 | Target Server Type : MySQL 11 | Target Server Version : 50733 12 | File Encoding : 65001 13 | 14 | Date: 16/06/2021 16:58:56 15 | */ 16 | 17 | SET NAMES utf8mb4; 18 | SET FOREIGN_KEY_CHECKS = 0; 19 | 20 | -- ---------------------------- 21 | -- Table structure for friend 22 | -- ---------------------------- 23 | DROP TABLE IF EXISTS `friend`; 24 | CREATE TABLE `friend` ( 25 | `characteristic` int(11) NOT NULL, 26 | `friendaccount` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, 27 | `groupingid` int(11) NULL DEFAULT NULL, 28 | `account` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, 29 | `name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL 30 | ) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; 31 | 32 | -- ---------------------------- 33 | -- Records of friend 34 | -- ---------------------------- 35 | INSERT INTO `friend` VALUES (2121, '19070015', 0, '12345678', '捂眼藏泪'); 36 | INSERT INTO `friend` VALUES (312, '54781204', 3, '12345678', '唯宠°'); 37 | INSERT INTO `friend` VALUES (432, '61673228', 1, '12345678', '何去何从i'); 38 | INSERT INTO `friend` VALUES (321, '12345678', 0, '61673228', '今夜无风'); 39 | INSERT INTO `friend` VALUES (32131, '12345678', 0, '19070015', '今夜无风'); 40 | INSERT INTO `friend` VALUES (123, '23101116', 0, '12345678', '帅癌晚期'); 41 | INSERT INTO `friend` VALUES (123, '12345678', 0, '23101116', '今夜无风'); 42 | INSERT INTO `friend` VALUES (123, '12345678', 0, '23101116', '今夜无风'); 43 | INSERT INTO `friend` VALUES (123, '12345678', 0, '23101116', '今夜无风'); 44 | INSERT INTO `friend` VALUES (123, '12345678', 0, '23101116', '今夜无风'); 45 | 46 | -- ---------------------------- 47 | -- Table structure for getverify 48 | -- ---------------------------- 49 | DROP TABLE IF EXISTS `getverify`; 50 | CREATE TABLE `getverify` ( 51 | `time` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, 52 | `otheraccount` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, 53 | `state` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, 54 | `name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, 55 | `grouping` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, 56 | `account` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL 57 | ) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; 58 | 59 | -- ---------------------------- 60 | -- Records of getverify 61 | -- ---------------------------- 62 | INSERT INTO `getverify` VALUES ('今日', '23101116', '同意', '帅癌晚期', '三十年河东', '12345678'); 63 | INSERT INTO `getverify` VALUES ('今日', '12345678', '同意', '今夜无风', '我的好友', '23101116'); 64 | INSERT INTO `getverify` VALUES ('今日', '12345678', '同意', '今夜无风', '我的好友', '23101116'); 65 | INSERT INTO `getverify` VALUES ('今日', '12345678', '同意', '今夜无风', '我的好友', '23101116'); 66 | INSERT INTO `getverify` VALUES ('今日', '12345678', '同意', '今夜无风', '我的好友', '23101116'); 67 | 68 | -- ---------------------------- 69 | -- Table structure for grouping 70 | -- ---------------------------- 71 | DROP TABLE IF EXISTS `grouping`; 72 | CREATE TABLE `grouping` ( 73 | `groupingid` int(11) NULL DEFAULT NULL, 74 | `name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, 75 | `account` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL 76 | ) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; 77 | 78 | -- ---------------------------- 79 | -- Records of grouping 80 | -- ---------------------------- 81 | INSERT INTO `grouping` VALUES (0, '三十年河东', '12345678'); 82 | INSERT INTO `grouping` VALUES (1, '三十年河西', '12345678'); 83 | INSERT INTO `grouping` VALUES (2, '哪里需要三十年', '12345678'); 84 | INSERT INTO `grouping` VALUES (3, '三年就够了', '12345678'); 85 | INSERT INTO `grouping` VALUES (0, '我的好友', '61673228'); 86 | INSERT INTO `grouping` VALUES (0, '我的好友', '19070015'); 87 | INSERT INTO `grouping` VALUES (0, '我的好友', '23101116'); 88 | 89 | -- ---------------------------- 90 | -- Table structure for setverify 91 | -- ---------------------------- 92 | DROP TABLE IF EXISTS `setverify`; 93 | CREATE TABLE `setverify` ( 94 | `time` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, 95 | `account` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, 96 | `state` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, 97 | `name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, 98 | `grouping` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, 99 | `otheraccount` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL 100 | ) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; 101 | 102 | -- ---------------------------- 103 | -- Records of setverify 104 | -- ---------------------------- 105 | INSERT INTO `setverify` VALUES ('06.01', '23101116', '同意', '今夜无风', '我的好友', '12345678'); 106 | INSERT INTO `setverify` VALUES ('06.01', '12345678', '等待同意', '帅癌晚期', '三十年河东', '23101116'); 107 | INSERT INTO `setverify` VALUES ('06.01', '12345678', '等待同意', '帅癌晚期', '三十年河东', '23101116'); 108 | INSERT INTO `setverify` VALUES ('06.01', '12345678', '等待同意', '帅癌晚期', '三十年河东', '23101116'); 109 | INSERT INTO `setverify` VALUES ('06.01', '12345678', '等待同意', '帅癌晚期', '三十年河东', '23101116'); 110 | 111 | -- ---------------------------- 112 | -- Table structure for state 113 | -- ---------------------------- 114 | DROP TABLE IF EXISTS `state`; 115 | CREATE TABLE `state` ( 116 | `account` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, 117 | `isline` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, 118 | `ip` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, 119 | `port` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, 120 | PRIMARY KEY (`account`) USING BTREE 121 | ) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; 122 | 123 | -- ---------------------------- 124 | -- Records of state 125 | -- ---------------------------- 126 | INSERT INTO `state` VALUES ('12345678', '-1', '10.13.130.101', '0'); 127 | INSERT INTO `state` VALUES ('19070015', '-1', '10.12.135.133', '0'); 128 | INSERT INTO `state` VALUES ('23101116', '-1', '10.12.135.133', '0'); 129 | INSERT INTO `state` VALUES ('61673228', '-1', '10.13.130.101', '0'); 130 | 131 | -- ---------------------------- 132 | -- Table structure for user 133 | -- ---------------------------- 134 | DROP TABLE IF EXISTS `user`; 135 | CREATE TABLE `user` ( 136 | `account` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, 137 | `phone` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, 138 | `name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, 139 | `password` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, 140 | `signature` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, 141 | `url` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, 142 | `grade` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, 143 | `namet` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, 144 | `sex` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, 145 | `age` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, 146 | `birthday` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, 147 | `profession` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, 148 | PRIMARY KEY (`account`) USING BTREE 149 | ) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; 150 | 151 | -- ---------------------------- 152 | -- Records of user 153 | -- ---------------------------- 154 | INSERT INTO `user` VALUES ('12345678', '18082069862', '今夜无风', '3226960*', '吾今虽欲自以为不足,而众已妄推之矣。', 'https://www.fdogcsdn.cn/img/10001.jpg', '12', '张旭', '男', '21', '2000.03.31', 'IT计算机服务'); 155 | INSERT INTO `user` VALUES ('19070015', '13081522051', '捂眼藏泪', '123456', '不喝酒,不抽烟,三年省下无数钱。', 'https://www.fdogcsdn.cn/img/19070015.jpg', '13', '朱盛泽', '男', '20', '2000.08.12', '学生'); 156 | INSERT INTO `user` VALUES ('23101116', '17614744373', '帅癌晚期', '3226960*', '葡萄美酒夜光杯,欲饮琵琶马上催。醉卧沙场君莫笑,古来征战几人回?', 'https://www.fdogcsdn.cn/img/23101116.jpg', '43', '王菲', '女', '18', '2001.03.10', '会计'); 157 | INSERT INTO `user` VALUES ('54781204', '17614733828', '唯宠°', '12334455', '我不喜欢喝酒,我只是买醉。', 'https://www.fdogcsdn.cn/img/54781204.jpg', '132', '于静', '女', '20', '1999.03.12', '教师'); 158 | INSERT INTO `user` VALUES ('61673228', '15647649853', '何去何从i', 'wjq123456', '每天的一个人的世界。只有自己一个人才是最真实的。一个人抽烟,一个人喝酒。', 'https://www.fdogcsdn.cn/img/61673228.jpg', '65', '王景奇', '男', '21', '2000.05.07', 'IT计算机服务'); 159 | 160 | SET FOREIGN_KEY_CHECKS = 1; 161 | -------------------------------------------------------------------------------- /FdogWeb/FdogMaven/src/main/java/com/fdog/AuthCode.java: -------------------------------------------------------------------------------- 1 | package com.fdog; 2 | import com.fdogrand.*; 3 | import java.io.IOException; 4 | import java.io.PrintWriter; 5 | import java.sql.Connection; 6 | import java.sql.DriverManager; 7 | import java.sql.ResultSet; 8 | import java.sql.SQLException; 9 | import java.sql.Statement; 10 | 11 | import javax.servlet.ServletException; 12 | 13 | import javax.servlet.http.HttpServlet; 14 | import javax.servlet.http.HttpServletRequest; 15 | import javax.servlet.http.HttpServletResponse; 16 | //发送验证码的servlet 17 | import com.tencentcloudapi.common.Credential; 18 | import com.tencentcloudapi.common.exception.TencentCloudSDKException; 19 | import com.tencentcloudapi.common.profile.ClientProfile; 20 | import com.tencentcloudapi.sms.v20190711.SmsClient; 21 | import com.tencentcloudapi.sms.v20190711.models.SendSmsRequest; 22 | import com.tencentcloudapi.sms.v20190711.models.SendSmsResponse; 23 | /** 24 | * Servlet implementation class AuthCode 25 | */ 26 | public class AuthCode extends HttpServlet { 27 | private static final long serialVersionUID = 1L; 28 | String username=""; 29 | String password=""; 30 | String phone = ""; 31 | /** 32 | * @see HttpServlet#HttpServlet() 33 | */ 34 | public AuthCode() { 35 | super(); 36 | // TODO Auto-generated constructor stub 37 | } 38 | 39 | /** 40 | * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) 41 | */ 42 | protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 43 | // TODO Auto-generated method stub 44 | 45 | //response.getWriter().append("Served at: ").append(request.getContextPath()); 46 | response.setContentType("text/html;charset=utf-8"); 47 | } 48 | 49 | /** 50 | * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) 51 | */ 52 | protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 53 | // TODO Auto-generated method stub 54 | request.setCharacterEncoding("UTF-8"); 55 | response.setContentType("text/html;charset=utf-8"); 56 | //request.getRequestDispatcher("index.jsp").forward(request,response); 57 | phone = request.getParameter("phone"); 58 | username = request.getParameter("username"); 59 | password = request.getParameter("password"); 60 | request.setAttribute("phone",phone); 61 | request.setAttribute("username",username); 62 | request.setAttribute("password",password); 63 | //System.out.println("你好"+phone); 64 | Rand num = new Rand(); 65 | int randnum = num.ReturnRandNumer(); 66 | phone = request.getParameter("phone"); 67 | PrintWriter printWriter = response.getWriter(); //获得输出流对象 68 | printWriter.print("随机码为"+randnum+" "+"手机号:"+phone); 69 | System.out.println("AuthCode生成的验证码为:"+randnum+"昵称:"+username); 70 | //验证手机号,正确则发送验证码 71 | //加载驱动程序 72 | try { 73 | Class.forName("com.mysql.jdbc.Driver"); 74 | System.out.print("驱动程序加载成功,"); 75 | } catch (ClassNotFoundException e) { 76 | e.printStackTrace(); 77 | } 78 | //链接数据库 79 | String str = "jdbc:mysql://0.0.0.0:3306/fdogsql?useUnicode=true&characterEncoding=UTF-8&userSSL=false&serverTimezone=GMT%2B8"; 80 | Connection conn=null; 81 | try { 82 | conn=DriverManager.getConnection(str,"root","1111111"); 83 | if (!conn.isClosed()) { 84 | System.out.println("连接数据库成功"); 85 | } 86 | } catch (SQLException e) { 87 | System.out.println("链接数据库失败: "+e.getMessage()); 88 | } 89 | //数据库查询 90 | int zc =0; 91 | try{ 92 | Statement stmt = conn.createStatement(); 93 | ResultSet rs = stmt.executeQuery("select * from user"); 94 | while(rs.next()){//如果对象中有数据,就会循环打印出来 95 | if(phone.equals(rs.getString("phone"))) { 96 | zc = 1; 97 | } 98 | } 99 | }catch(SQLException e){ 100 | System.out.println("查询失败"); 101 | } 102 | if(zc==1) { 103 | System.out.println("该手机号已经注册"); 104 | PrintWriter pw=response.getWriter(); 105 | pw.write(""); 106 | } 107 | else{ 108 | System.out.println("短信已发送"); 109 | String secretId = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"; 110 | String secretKey= "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"; 111 | //短信应用 ID 112 | String appid = "xxxxxxxx"; 113 | //短信签名内容 114 | String sign = "花狗的小站"; 115 | //短信模板 ID 116 | String templateID = "xxxxxx"; 117 | //+86为国家码,182********为手机号,最多不要超过200个手机号 118 | String[] phoneNumbers = { "+86"+phone}; 119 | //模板参数: 若无模板参数,则设置为空 120 | String[] templateParams = {String.valueOf(randnum)};//对应模板中{1} 121 | try { 122 | //必要步骤: 实例化一个认证对象,入参需要传入腾讯云账户密钥对 secretId 和 secretKey 123 | Credential cred = new Credential(secretId , secretKey); 124 | 125 | ClientProfile clientProfile = new ClientProfile(); 126 | //SDK 默认用 TC3-HMAC-SHA256 进行签名 非必要请不要修改该字段 127 | 128 | clientProfile.setSignMethod("HmacSHA256"); 129 | // 实例化 SMS 的 client 对象 第二个参数是地域信息,可以直接填写字符串 ap-guangzhou,或者引用预设的常量 130 | SmsClient client = new SmsClient(cred, "", clientProfile); 131 | //实例化一个请求对象,根据调用的接口和实际情况,可以进一步设置请求参数 您可以直接查询 SDK 源码确定接口有哪些属性可以设置 132 | SendSmsRequest req = new SendSmsRequest(); 133 | 134 | // 短信应用 ID: 在 [短信控制台] 添加应用后生成的实际 SDKAppID,例如1400006666 135 | req.setSmsSdkAppid(appid); 136 | 137 | // 短信签名内容: 使用 UTF-8 编码,必须填写已审核通过的签名,可登录 [短信控制台] 查看签名信息 138 | req.setSign(sign); 139 | 140 | //短信模板 ID: 必须填写已审核通过的模板 ID,可登录 [短信控制台] 查看模板 ID 141 | req.setTemplateID(templateID); 142 | 143 | //下发手机号码,采用 e.164 标准,+[国家或地区码][手机号] 例如+8613711112222 144 | req.setPhoneNumberSet(phoneNumbers); 145 | 146 | req.setTemplateParamSet(templateParams); 147 | 148 | // 通过 client 对象调用 SendSms 方法发起请求。注意请求方法名与请求对象是对应的 返回的 res 是一个SendSmsResponse 类的实例,与请求对象对应 149 | SendSmsResponse res = client.SendSms(req); 150 | 151 | // 输出 JSON 格式的字符串回包 152 | System.out.println(SendSmsResponse.toJsonString(res)); 153 | 154 | // 可以取出单个值,您可以通过官网接口文档或跳转到 response 对象的定义处查看返回字段的定义 155 | System.out.println(res.getRequestId()); 156 | 157 | } catch (TencentCloudSDKException e) { 158 | e.printStackTrace(); 159 | } 160 | } 161 | 162 | this.getServletContext().setAttribute("fp", String.valueOf(randnum)); 163 | request.getRequestDispatcher("index.jsp").forward(request,response); 164 | //doGet(request, response); 165 | } 166 | 167 | } 168 | -------------------------------------------------------------------------------- /FdogWeb/FdogMaven/src/main/java/com/fdog/FdogMaven.java: -------------------------------------------------------------------------------- 1 | package com.fdog; 2 | 3 | import java.sql.*; 4 | 5 | import java.io.IOException; 6 | import java.io.PrintWriter; 7 | 8 | import javax.servlet.ServletException; 9 | import javax.servlet.http.HttpServlet; 10 | import javax.servlet.http.HttpServletRequest; 11 | import javax.servlet.http.HttpServletResponse; 12 | 13 | import com.fdogrand.*; 14 | public class FdogMaven extends HttpServlet { 15 | private static final long serialVersionUID = 1L; 16 | String value; 17 | /** 18 | * @see HttpServlet#HttpServlet() 19 | */ 20 | public FdogMaven() { 21 | super(); 22 | // TODO Auto-generated constructor stub 23 | } 24 | 25 | /** 26 | * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) 27 | */ 28 | protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 29 | 30 | } 31 | /** 32 | * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) 33 | */ 34 | protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 35 | 36 | 37 | //加载驱动程序 38 | try { 39 | Class.forName("com.mysql.jdbc.Driver"); 40 | System.out.print("驱动程序加载成功,"); 41 | } catch (ClassNotFoundException e) { 42 | e.printStackTrace(); 43 | } 44 | //链接数据库 45 | String str = "jdbc:mysql://0.0.0.0:3306/fdogsql?useUnicode=true&characterEncoding=UTF-8&userSSL=false&serverTimezone=GMT%2B8"; 46 | Connection conn=null; 47 | try { 48 | conn=DriverManager.getConnection(str,"root","1111111"); 49 | if (!conn.isClosed()) { 50 | System.out.println("连接数据库成功"); 51 | } 52 | } catch (SQLException e) { 53 | System.out.println("链接数据库失败: "+e.getMessage()); 54 | } 55 | //数据库查询 56 | try{ 57 | Statement stmt = conn.createStatement(); 58 | ResultSet rs = stmt.executeQuery("select * from user"); 59 | while(rs.next()){//如果对象中有数据,就会循环打印出来 60 | //System.out.println(rs.getString("name")+" "+rs.getString("password")); 61 | } 62 | }catch(SQLException e){ 63 | System.out.println("查询失败"); 64 | } 65 | request.setCharacterEncoding("UTF-8"); 66 | response.setContentType("text/html;charset=utf-8"); 67 | String username = request.getParameter("username"); 68 | String password = request.getParameter("password"); 69 | String phone = request.getParameter("phone"); 70 | //生成用户账户 71 | Rand num = new Rand(); 72 | String account = String.valueOf(num.ReturnRandNumer_2()); 73 | String verificationcode = request.getParameter("verificationcode"); 74 | PrintWriter printWriter = response.getWriter(); //获得输出流对象 75 | printWriter.print("post昵称"+username+" 密码"+password+"手机号"+phone+"\n"); 76 | System.out.print("用户账户: "+account+" 用户昵称 "+username+" 设置密码 "+password+" 注册手机号 "+phone+" 用户输入的验证码"+verificationcode+"\n"); 77 | value = (String) this.getServletContext().getAttribute("fp"); 78 | printWriter.print("随机码为"+value); 79 | System.out.println("终端接受的验证码为:"+value); 80 | //response.getOutputStream().write(value.getBytes()); 81 | //request.setAttribute("account",account); 82 | //System.out.println("account为:"+account); 83 | //request.setAttribute("phone",phone); 84 | //request.setAttribute("username",username); 85 | //request.setAttribute("password",password); 86 | if(value.equals(request.getParameter("verificationcode"))) { 87 | System.out.println("验证码输入正确,写入数据库"); 88 | //写入数据库 89 | try{ 90 | String sql="insert into user(account,phone,name,password) values("+"'"+account+"',"+"'"+phone+"',"+"'"+username+"',"+"'"+password+"'"+")"; 91 | Statement stmt = conn.createStatement(); 92 | stmt.executeUpdate(sql); 93 | System.out.println("写入成功"); 94 | 95 | //调用注册成功页面 96 | request.setAttribute("account", account); //保存账户 97 | request.setAttribute("phone", phone); //保存手机 98 | request.getRequestDispatcher("success.jsp").forward(request,response); 99 | }catch(SQLException e){ 100 | System.out.println("写入失败"); 101 | } 102 | } 103 | else { 104 | request.getRequestDispatcher("index.jsp").forward(request,response); 105 | //PrintWriter pw=response.getWriter(); 106 | //pw.write(""); 107 | } 108 | doGet(request, response); 109 | } 110 | 111 | } 112 | -------------------------------------------------------------------------------- /FdogWeb/FdogMaven/src/main/java/com/fdogrand/Rand.java: -------------------------------------------------------------------------------- 1 | package com.fdogrand; 2 | 3 | public class Rand { 4 | private int randnum =0; 5 | public int ReturnRandNumer() 6 | { 7 | randnum = (int)(Math.random()*90000+10000); 8 | return randnum; 9 | } 10 | public int ReturnRandNumer_2() 11 | { 12 | randnum = (int)(Math.random()*90000000+10000000); 13 | return randnum; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /FdogWeb/FdogMaven/src/main/java/com/filter/Filter.java: -------------------------------------------------------------------------------- 1 | package com.filter; 2 | 3 | import java.io.IOException; 4 | import java.util.Map; 5 | 6 | import javax.servlet.FilterChain; 7 | import javax.servlet.FilterConfig; 8 | import javax.servlet.ServletException; 9 | import javax.servlet.ServletRequest; 10 | import javax.servlet.ServletResponse; 11 | import javax.servlet.http.HttpServletRequest; 12 | import javax.servlet.http.HttpServletRequestWrapper; 13 | import javax.servlet.http.HttpServletResponse; 14 | 15 | public class Filter implements javax.servlet.Filter { 16 | 17 | public Filter() { 18 | // TODO Auto-generated constructor stub 19 | } 20 | 21 | /** 22 | * @see Filter#destroy() 23 | */ 24 | public void destroy() { 25 | // TODO Auto-generated method stub 26 | } 27 | 28 | /** 29 | * @see Filter#doFilter(ServletRequest, ServletResponse, FilterChain) 30 | */ 31 | public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { 32 | HttpServletRequest hsr = (HttpServletRequest)request; 33 | HttpServletResponse hst = (HttpServletResponse)response; 34 | hsr.setCharacterEncoding("utf-8"); 35 | hst.setContentType("text/html;charset=utf-8"); 36 | // pass the request along the filter chain 37 | if(hsr.getMethod().equalsIgnoreCase("get")){ 38 | MyRequest myRequest = new MyRequest(hsr); 39 | chain.doFilter(myRequest, response); 40 | 41 | } 42 | else { 43 | chain.doFilter(request, response); 44 | } 45 | } 46 | 47 | /** 48 | * @see Filter#init(FilterConfig) 49 | */ 50 | public void init(FilterConfig fConfig) throws ServletException { 51 | // TODO Auto-generated method stub 52 | } 53 | 54 | } 55 | 56 | class MyRequest extends HttpServletRequestWrapper{ 57 | 58 | private HttpServletRequest request; 59 | private boolean isEncoding = false; 60 | 61 | public MyRequest(HttpServletRequest request) { 62 | super(request); 63 | this.request = request; 64 | // TODO Auto-generated constructor stub 65 | } 66 | @Override 67 | public String getParameter(String name) { 68 | return getParameterMap().get(name)[0]; 69 | } 70 | 71 | @Override 72 | public Map getParameterMap(){ 73 | Map map = request.getParameterMap(); 74 | if(isEncoding ==true) { 75 | return map; 76 | } 77 | for(Map.Entry entry:map.entrySet()) { 78 | String[] values = entry.getValue(); 79 | for(int i = 0;i 4 | 5 | 6 | Archetype Created Web Application 7 | 17 | 18 | FdogMaven 19 | FdogMaven 20 | 21 | com.fdog.FdogMaven 22 | 23 | 24 | AuthCode 25 | AuthCode 26 | 27 | com.fdog.AuthCode 28 | 29 | 30 | FdogMaven 31 | /FdogMaven 32 | 33 | 34 | AuthCode 35 | /AuthCode 36 | 37 | 38 | -------------------------------------------------------------------------------- /FdogWeb/FdogMaven/src/main/webapp/css/fdog.css: -------------------------------------------------------------------------------- 1 | body, 2 | div { 3 | margin: 0; 4 | padding: 0; 5 | height: 946px; 6 | font-family: FangSong_GB2312; 7 | } 8 | 9 | .fdogback { 10 | /* background-color: aqua; */ 11 | float: left; 12 | width: 25%; 13 | height: 100%; 14 | } 15 | 16 | .fdogback #imgicon_1 { 17 | margin: 20px; 18 | height: 50px; 19 | position: fixed; 20 | } 21 | 22 | .fdogtext { 23 | background-color: white; 24 | float: left; 25 | width: 75%; 26 | height: 946px; 27 | } 28 | 29 | .fdogtext .fdogtext_1 { 30 | width: 100%; 31 | height: 10%; 32 | /* background-color: #00FFFF; */ 33 | } 34 | 35 | .fdogtext .fdogtext_2 { 36 | margin: 0 auto; 37 | width: 100%; 38 | height: 85%; 39 | /* background-color: chartreuse; */ 40 | text-align: center; 41 | } 42 | .fdogtext_1 #mul{ 43 | margin-top: 0px; margin-right: 100px; padding-top: 30px; font-size: 18px; 44 | } 45 | .fdogtext_2 #mh1{ 46 | height: 90px; width: 495px; margin: 0 auto; text-align: left; 47 | } 48 | .fdogtext_2 #mh2{ 49 | height: 65px; width: 495px; margin: 0 auto; text-align: left; 50 | } 51 | 52 | .fdogtext_1 #imgicon_2 { 53 | margin: 20px; 54 | height: 50px; 55 | position: fixed; 56 | display: none; 57 | } 58 | 59 | .fdogtext_2 #userName { 60 | width: 480px; 61 | height: 55px; 62 | border-radius: 5px; 63 | font-size: 20px; 64 | border-style: solid; 65 | border-width: 1px; 66 | border-color: gray; 67 | } 68 | 69 | .fdogtext_2 #userPasword { 70 | width: 480px; 71 | height: 55px; 72 | border-radius: 5px; 73 | font-size: 20px; 74 | border-style: solid; 75 | border-width: 1px; 76 | border-color: gray; 77 | } 78 | 79 | .fdogtext_2 #comboxphone { 80 | width: 180px; 81 | height: 60px; 82 | border-radius: 5px; 83 | font-size: 20px; 84 | border-style: solid; 85 | border-width: 1px; 86 | border-color: gray; 87 | } 88 | 89 | .fdogtext_2 #userPhone { 90 | width: 300px; 91 | height: 55px; 92 | border-radius: 5px; 93 | font-size: 20px; 94 | border-style: solid; 95 | border-width: 1px; 96 | border-color: gray; 97 | } 98 | 99 | .fdogtext_2 #codediv { 100 | height: 100px; 101 | display: none; 102 | } 103 | 104 | .fdogtext_2 #code { 105 | width: 173px; 106 | height: 51px; 107 | border-radius: 5px; 108 | font-size: 20px; 109 | border-style: solid; 110 | border-width: 1px; 111 | border-color: gray; 112 | } 113 | 114 | .fdogtext_2 #codebutton { 115 | width: 307px; 116 | height: 55px; 117 | border-radius: 5px; 118 | font-size: 23px; 119 | color: white; 120 | border-style: solid; 121 | border-width: 1px; 122 | border-color: #3083ff; 123 | background-color: #3083ff; 124 | } 125 | 126 | .fdogtext_2 #up { 127 | width: 485px; 128 | height: 65px; 129 | border-radius: 5px; 130 | border-style: solid; 131 | color: white; 132 | border-width: 1px; 133 | border-color: #3083ff; 134 | background-color: #3083ff; 135 | font-size: 25px; 136 | } 137 | #um{ 138 | height: 37px; width: 480px; margin: 0 auto; text-align: left; 139 | } 140 | #pw{ 141 | height: 50px; width: 480px; margin: 0 auto; text-align: left; 142 | } 143 | 144 | .fdogtext_3 { 145 | margin: 0 auto; 146 | width: 100%; 147 | height: 5%; 148 | /* background-color: chocolate; */ 149 | text-align: center; 150 | font-size: 16px; 151 | color: gray; 152 | } 153 | 154 | .brcopy { 155 | display: none; 156 | color: gray; 157 | } 158 | 159 | @media (max-width:1100px) { 160 | .fdogback { 161 | display: none; 162 | } 163 | 164 | .fdogtext { 165 | height: 100%; 166 | width: 100%; 167 | } 168 | 169 | .fdogtext_1 #imgicon_2 { 170 | margin: 20px; 171 | height: 50px; 172 | position: absolute; 173 | display: block; 174 | } 175 | } 176 | 177 | @media (max-width:600px) { 178 | body{ 179 | margin: 0; 180 | padding: 0; 181 | transform: scale(0.53333); 182 | } 183 | 184 | .fdogtext_1 #imgicon_2 { 185 | margin: 20px; 186 | height: 50px; 187 | position: fixed; 188 | display: block; 189 | } 190 | .brcopy { 191 | display: block; 192 | } 193 | .fdogtext_1 #mul{ 194 | margin-top: 0px; margin-right: 0px; padding-top: 35px; font-size: 18px; 195 | } 196 | .fdogtext_2 #mh1{ 197 | height: 90px; width: 100%; 198 | } 199 | .fdogtext_2 #mh2{ 200 | height: 65px; width: 100%; 201 | } 202 | 203 | .fdogtext_2 #userName { 204 | width: 98%; 205 | height: 55px; 206 | } 207 | .fdogtext_2 #userPasword{ 208 | width: 98%; 209 | height: 55px; 210 | } 211 | .fdogtext_2 #comboxphone{ 212 | width: 39%; 213 | height: 60px; 214 | } 215 | 216 | .fdogtext_2 #userPhone{ 217 | width: 58%; 218 | height: 55px; 219 | } 220 | 221 | .fdogtext_2 #code{ 222 | width: 39%; 223 | height: 51px; 224 | } 225 | .fdogtext_2 #codebutton{ 226 | width: 58%; 227 | height: 55px; 228 | } 229 | .fdogtext_2 #up{ 230 | width: 100%; 231 | height: 65px; 232 | } 233 | #um{ 234 | height: 37px; width: 410px; margin: 0 auto; text-align: left; 235 | } 236 | #pw{ 237 | height: 50px; width: 410px; margin: 0 auto; text-align: left; 238 | } 239 | } 240 | -------------------------------------------------------------------------------- /FdogWeb/FdogMaven/src/main/webapp/css/index_1.css: -------------------------------------------------------------------------------- 1 | body{ 2 | margin: 0; 3 | padding: 0; 4 | font-family: FangSong_GB2312; 5 | background-image: url(../img/2046597.jpg); 6 | height: 946px; 7 | text-align: center; 8 | } -------------------------------------------------------------------------------- /FdogWeb/FdogMaven/src/main/webapp/download.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | Fdog下载 9 | 10 | 11 |
12 | 13 | 19 |
20 |
22 | 23 | 24 |
25 |
26 | 27 |


28 | Fdog PC版1.0 29 |
30 |
31 |
32 | 2021-04-06 33 |
34 | 35 |
36 |
37 |
38 |
39 | 40 |


41 | Fdog 移动版1.0 42 |
43 |
44 |
45 | 2021-04-06 46 |
47 | 48 |
49 |
50 |
51 |
52 | Copyright © 2021.花狗Fdog All rights reserved. 53 | 蒙ICP备2021000567号 54 |
55 | 56 | 57 | -------------------------------------------------------------------------------- /FdogWeb/FdogMaven/src/main/webapp/home.jsp: -------------------------------------------------------------------------------- 1 | <%@page contentType="text/html;charset=utf-8"%> 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | I'm Fdog - 每一天,乐在沟通 10 | 11 | 57 | 58 | 66 | 74 | 75 | 76 |
77 | 78 | 84 |
85 |
87 |
88 | 江湖人称花狗Fdog,读于泰州职业技术学院,软件技术专业,积极入党分子,校学生会干部。 89 |
90 | 私下自学PS,C语言,C++语言,Qt,数据结构与算法,数据库,学校里,学习过java语言,html,以及javaweb。 91 |
92 | 学校曾获得: 93 |
94 | 优秀干事,三好学生,优秀团员,一等奖学金,国家励志奖学金。 95 |
96 | 网络曾获得: 97 |
98 | 华为云·云享专家,CSDN博客专家,CSDN2020年度博客之星第68名,CSDN2020年度优秀创作者。 99 |
100 | 学习的同时本人也喜欢写一些技术博客: 101 | 我的技术博客 102 | ,也曾学习并使用Github: 103 | 我的Github 104 | 。 105 |
106 | 讲尽千言万语,不如拿出一个项目实在,Fdog是我仿照某聊天软件所开发,期间运用到的技术包括使用ps进行ui制作,qt, 107 |
108 | vs进行pc端开发,as进行移动端开发(没动呢),html进行前端页面开发,js,javaweb后台开发并部署于服务器,使用mysql数据库 109 |
110 | 等多项语言技术开发的实时通信软件,同时本软件仅供学习使用,帮助新手了解开发路线,请切勿用于商业用途。 111 |
112 | 漫漫代码路,不敢说学到很多,但一定不少,就把这个fdog作为我的毕设吧。 113 |
114 | 邮箱:2506897252@qq.com 115 |
116 |
117 | Copyright © 2021.花狗Fdog All rights reserved. 118 | 蒙ICP备2021000567号 119 |
120 | 121 | 122 | -------------------------------------------------------------------------------- /FdogWeb/FdogMaven/src/main/webapp/img/2046597.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HuaGouFdog/FdogInstantMessaging/4d2e9a12d90dfc79a90d8367b373df8828578f06/FdogWeb/FdogMaven/src/main/webapp/img/2046597.jpg -------------------------------------------------------------------------------- /FdogWeb/FdogMaven/src/main/webapp/img/anzhuologo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HuaGouFdog/FdogInstantMessaging/4d2e9a12d90dfc79a90d8367b373df8828578f06/FdogWeb/FdogMaven/src/main/webapp/img/anzhuologo.png -------------------------------------------------------------------------------- /FdogWeb/FdogMaven/src/main/webapp/img/background.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HuaGouFdog/FdogInstantMessaging/4d2e9a12d90dfc79a90d8367b373df8828578f06/FdogWeb/FdogMaven/src/main/webapp/img/background.jpg -------------------------------------------------------------------------------- /FdogWeb/FdogMaven/src/main/webapp/img/background01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HuaGouFdog/FdogInstantMessaging/4d2e9a12d90dfc79a90d8367b373df8828578f06/FdogWeb/FdogMaven/src/main/webapp/img/background01.png -------------------------------------------------------------------------------- /FdogWeb/FdogMaven/src/main/webapp/img/background02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HuaGouFdog/FdogInstantMessaging/4d2e9a12d90dfc79a90d8367b373df8828578f06/FdogWeb/FdogMaven/src/main/webapp/img/background02.png -------------------------------------------------------------------------------- /FdogWeb/FdogMaven/src/main/webapp/img/background03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HuaGouFdog/FdogInstantMessaging/4d2e9a12d90dfc79a90d8367b373df8828578f06/FdogWeb/FdogMaven/src/main/webapp/img/background03.png -------------------------------------------------------------------------------- /FdogWeb/FdogMaven/src/main/webapp/img/background04.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HuaGouFdog/FdogInstantMessaging/4d2e9a12d90dfc79a90d8367b373df8828578f06/FdogWeb/FdogMaven/src/main/webapp/img/background04.png -------------------------------------------------------------------------------- /FdogWeb/FdogMaven/src/main/webapp/img/down.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HuaGouFdog/FdogInstantMessaging/4d2e9a12d90dfc79a90d8367b373df8828578f06/FdogWeb/FdogMaven/src/main/webapp/img/down.png -------------------------------------------------------------------------------- /FdogWeb/FdogMaven/src/main/webapp/img/favicon1.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HuaGouFdog/FdogInstantMessaging/4d2e9a12d90dfc79a90d8367b373df8828578f06/FdogWeb/FdogMaven/src/main/webapp/img/favicon1.ico -------------------------------------------------------------------------------- /FdogWeb/FdogMaven/src/main/webapp/img/fdogicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HuaGouFdog/FdogInstantMessaging/4d2e9a12d90dfc79a90d8367b373df8828578f06/FdogWeb/FdogMaven/src/main/webapp/img/fdogicon.png -------------------------------------------------------------------------------- /FdogWeb/FdogMaven/src/main/webapp/img/fdogpcandroid.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HuaGouFdog/FdogInstantMessaging/4d2e9a12d90dfc79a90d8367b373df8828578f06/FdogWeb/FdogMaven/src/main/webapp/img/fdogpcandroid.png -------------------------------------------------------------------------------- /FdogWeb/FdogMaven/src/main/webapp/img/mainicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HuaGouFdog/FdogInstantMessaging/4d2e9a12d90dfc79a90d8367b373df8828578f06/FdogWeb/FdogMaven/src/main/webapp/img/mainicon.png -------------------------------------------------------------------------------- /FdogWeb/FdogMaven/src/main/webapp/img/pc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HuaGouFdog/FdogInstantMessaging/4d2e9a12d90dfc79a90d8367b373df8828578f06/FdogWeb/FdogMaven/src/main/webapp/img/pc.png -------------------------------------------------------------------------------- /FdogWeb/FdogMaven/src/main/webapp/img/phone.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HuaGouFdog/FdogInstantMessaging/4d2e9a12d90dfc79a90d8367b373df8828578f06/FdogWeb/FdogMaven/src/main/webapp/img/phone.png -------------------------------------------------------------------------------- /FdogWeb/FdogMaven/src/main/webapp/img/succeed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HuaGouFdog/FdogInstantMessaging/4d2e9a12d90dfc79a90d8367b373df8828578f06/FdogWeb/FdogMaven/src/main/webapp/img/succeed.png -------------------------------------------------------------------------------- /FdogWeb/FdogMaven/src/main/webapp/img/suo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HuaGouFdog/FdogInstantMessaging/4d2e9a12d90dfc79a90d8367b373df8828578f06/FdogWeb/FdogMaven/src/main/webapp/img/suo.png -------------------------------------------------------------------------------- /FdogWeb/FdogMaven/src/main/webapp/img/up.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HuaGouFdog/FdogInstantMessaging/4d2e9a12d90dfc79a90d8367b373df8828578f06/FdogWeb/FdogMaven/src/main/webapp/img/up.png -------------------------------------------------------------------------------- /FdogWeb/FdogMaven/src/main/webapp/index.jsp: -------------------------------------------------------------------------------- 1 | <%@page contentType="text/html;charset=utf-8"%> 2 | 3 | 4 | 5 | 6 | Fdog注册 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 |
21 |
22 |
23 | 24 | 25 | 26 | 31 |
32 |
33 |
34 | 欢迎注册Fdog 35 |
36 |
37 | 每一天,乐在沟通。 38 |
39 |
40 |
41 | 43 |
44 | 45 |
46 | 48 |
49 | 50 |
51 | 52 | 58 | 60 | 61 |
62 | 可通过该手机号找回密码  63 | 64 |
65 |
66 | 67 | 68 |
69 | 70 |
71 |
72 | 73 |
74 |

75 | 我已阅读并同意相关服务条款和隐私政策 76 | 77 |

78 |
79 | 84 |
85 |
86 |
87 | Copyright © 2021.花狗Fdog All rights reserved. 88 |
89 | 蒙ICP备2021000567号 90 |
91 |
92 | 93 | 94 | -------------------------------------------------------------------------------- /FdogWeb/FdogMaven/src/main/webapp/js/backv.js: -------------------------------------------------------------------------------- 1 | window.onload = init; 2 | var n = 1; //图片标记数 3 | var dingshi; //让图片动的定时器 4 | function init() { 5 | dingshi = window.setInterval("tupian()", 5000); 6 | } 7 | //更换图片 8 | function tupian() { 9 | var obj = document.getElementById("backimg"); 10 | n++; 11 | if (n >= 5) { 12 | n = 1; 13 | } 14 | obj.src = "img/background0" + n + ".png"; 15 | } 16 | -------------------------------------------------------------------------------- /FdogWeb/FdogMaven/src/main/webapp/js/check.js: -------------------------------------------------------------------------------- 1 | //验证用户名 2 | function checkUserName() { 3 | var username = document.getElementById('userName'); 4 | var errname = document.getElementById('nameErr'); 5 | //var pattern = /^\w{3,}$/; //用户名格式正则表达式:用户名要至少三位 6 | if (username.value.length == 0) { 7 | errname.innerHTML = "用户名不能为空" 8 | username.style.borderColor = 'red' 9 | errname.style.color = 'red' 10 | return false; 11 | } 12 | if (username.value.length <= 1) { 13 | errname.innerHTML = "用户名不合规范,至少三位" 14 | username.style.borderColor = 'red' 15 | errname.style.color = 'red' 16 | return false; 17 | } else { 18 | errname.innerHTML = "该昵称可用" 19 | username.style.borderColor = 'lime' 20 | errname.style.color = 'green' 21 | return true; 22 | } 23 | } 24 | 25 | //验证密码 26 | function checkPassword() { 27 | var userpasswd = document.getElementById('userPasword'); 28 | var errPasswd = document.getElementById('passwordErr'); 29 | var pattern = /^\w{4,12}$/; //密码要在4-12位 30 | if (userpasswd.value.length == 0) { 31 | errPasswd.innerHTML = "密码不能为空" 32 | userpasswd.style.borderColor = 'red' 33 | errPasswd.style.color = 'red' 34 | return false; 35 | } 36 | if (!pattern.test(userpasswd.value)) { 37 | errPasswd.innerHTML = "密码不合规范,因在4-12位之间" 38 | userpasswd.style.borderColor = 'red' 39 | errPasswd.style.color = 'red' 40 | return false; 41 | } else { 42 | errPasswd.innerHTML = "密码符合" 43 | userpasswd.style.borderColor = 'lime' 44 | errPasswd.style.color = 'green' 45 | return true; 46 | } 47 | } 48 | 49 | //验证手机号 50 | function checkPhone() { 51 | var codediv = document.getElementById('codediv'); 52 | codediv.style.display = 'block'; 53 | var userphone = document.getElementById('userPhone'); 54 | var phonrErr = document.getElementById('phoneErr'); 55 | var pattern = /^1[34578]\d{9}$/; //验证手机号正则表达式 56 | if (!pattern.test(userphone.value)) { 57 | phonrErr.innerHTML = "手机号码不合规范" 58 | userphone.style.borderColor = 'red' 59 | phonrErr.style.color = 'red' 60 | return false; 61 | } else { 62 | phonrErr.innerHTML = "手机号格式正确" 63 | userphone.style.borderColor = 'lime' 64 | phonrErr.style.color = 'green' 65 | return true; 66 | } 67 | } 68 | //验证发送短信验证码 69 | var clock = ''; 70 | var nums = 60; 71 | var btn; 72 | var xmlhttp; 73 | function codeclick(thisBtn) { 74 | var name = checkUserName(); 75 | var password = checkPassword(); 76 | var phone = checkPhone(); 77 | if (name && password && phone) { 78 | //调用后台发送短信 79 | if (window.XMLHttpRequest) 80 | {// code for IE7+, Firefox, Chrome, Opera, Safari 81 | xmlhttp=new XMLHttpRequest(); 82 | } 83 | else 84 | {// code for IE6, IE5 85 | xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); 86 | } 87 | xmlhttp.open("POST","AuthCode?phone=18082069891",true); 88 | xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded"); 89 | 90 | //xmlhttp.send("fname=Bill&lname=Gates"); 91 | xmlhttp.send(); 92 | //this.form.action='authCode'; 93 | //this.form.submit(); 94 | var codediv = document.getElementById('codediv'); 95 | codediv.style.display = 'block'; 96 | btn = thisBtn; 97 | btn.disabled = true; //按钮不可点击 98 | btn.value = nums+'秒后可重新获取'; 99 | clock = setInterval(doLoop,1000); //一秒执行一次 100 | var codeErr = document.getElementById('codeErr'); 101 | codeErr.innerHTML = "短信已发送,请注意查收"; 102 | codeErr.style.color = 'green' 103 | } 104 | } 105 | function doLoop() 106 | { 107 | nums--; 108 | if(nums>0){ 109 | btn.value = nums+'秒后可重新获取'; 110 | }else{ 111 | clearInterval(clock);//清除js定时器 112 | btn.disabled = false; 113 | btn.value = '获取短信验证码'; 114 | nums =60; 115 | } 116 | } 117 | function callback() { 118 | if (xmlhttp.readyState == 4 && xmlhttp.status == 200) { 119 | //var rt = xmlHttpRequest.responseText; 120 | //alert(xmlHttpRequest.responseText); 121 | // do something with rt 122 | } 123 | } 124 | 125 | function lableclick() 126 | { 127 | var clause = document.getElementById('clause'); 128 | var imgupdown = document.getElementById('imgupdown'); 129 | if(clause.style.display=='none'){ 130 | clause.style.display ='block'; 131 | imgupdown.src='img/down.png' 132 | } 133 | else{ 134 | a=0; 135 | clause.style.display ='none'; 136 | imgupdown.src='img/up.png' 137 | } 138 | } 139 | -------------------------------------------------------------------------------- /FdogWeb/FdogMaven/src/main/webapp/success.jsp: -------------------------------------------------------------------------------- 1 | <%@page contentType="text/html;charset=utf-8"%> 2 | 3 | 4 | 5 | 6 | Fdog注册 7 | 8 | 9 | 10 | 11 | <% 12 | String Maccount = (String)request.getAttribute("account"); 13 | String Mphone = (String)request.getAttribute("phone"); 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 | 你可以通过手机号码 作为辅助账号登录Fdog 41 |
42 |
43 | 44 | 45 |
46 | 47 | 48 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright 2021 花狗Fdog(张旭) 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [TOC] 2 | 3 | 4 | 5 | [![Build Status](https://travis-ci.com/HuaGouFdog/FdogInstantMessaging.svg)](https://travis-ci.com/HuaGouFdog/FdogInstantMessaging) [![Coverage Status](https://shields.io/badge/coverage-67%25-yellow)](https://coveralls.io/github/HuaGouFdog/FdogInstantMessaging?branch=main) ![](https://img.shields.io/badge/QQ-2506897252-brightgreen) ![](https://img.shields.io/badge/CSDN%E5%8D%9A%E5%AE%A2-%E8%8A%B1%E7%8B%97Fdog-brightgreen) 6 | 7 | 8 | 9 | # *新版本正在编写中,文档重写编写中,未来可期!* 10 | 11 | 12 | 13 | # FdogInstantMessaging(Fdog即时通讯软件) 14 | 15 | #### 一. 介绍 16 | FdogInstantMessaging,Fdog即时通讯软件,利用在校所学知识进行编写,主要包括网页端,客户端,以及服务端。 17 | 18 | 1. 网页端主要使用html前端,java后端,使用Tomcat部署在腾讯云服务器上面,实习软件下载和账号注册等功能。 19 | 2. 客户端和服务端是在window平台使用qt5.10进行编写。 20 | 21 | 22 | 23 | 备注: 24 | 25 | 相关软件版本:tomcat7.x,mysql7.x,centOS7.x 26 | 27 | fdogsql.sql文件为数据库对应字段及数据 28 | 29 | 短信使用的是腾讯云的短信服务,其他几家的短信服务都需要企业认证,腾讯云不需要。 30 | 31 | 每个新用户注册腾讯云都有两个个月短信体验,我的体验已到期,现在无法正常发送短信,不要再再试注册了。 32 | 33 | 由于无法将服务器数据库密码等重要信息上传,所以下载下来的程序无法正常运行,这里只提供源码以及相关数据库字段。 34 | 35 | 目前没有上传可执行文件(太大了,github又慢),如下载源码后无法编译,右击项目,重新构建即可。 36 | 37 | 欢迎大家参考学习,如果对你有帮助的话,别忘了给个星星! 38 | 39 | Fdog网站: 40 | 41 | https://www.fdogcsdn.cn 42 | 43 | 我的博客: 44 | 45 | https://blog.csdn.net/Fdog_ 46 | 47 | 下面是提供一些可能有用的技术参考: 48 | 49 | [Fdog系列(一):思来想去,不如写一个聊天软件,那就从仿QQ注册页面开始吧。](https://zxfdog.blog.csdn.net/article/details/115558479) 50 | 51 | [Fdog系列(二):html写完注册页面之后怎么办,用java写后台响应呀。](https://zxfdog.blog.csdn.net/article/details/115601897) 52 | 53 | [Fdog系列(三):使用腾讯云短信接口发送短信,数据库写入,部署到服务器,web收尾篇。](https://zxfdog.blog.csdn.net/article/details/115659789) 54 | 55 | [Fdog系列(四):使用Qt框架模仿QQ实现登录界面,界面篇。](https://blog.csdn.net/Fdog_/article/details/115864249) 56 | 57 | [Fdog系列(五):使用Qt模仿QQ实现登录界面到主界面,功能篇](https://zxfdog.blog.csdn.net/article/details/116308548) 58 | 59 | [Fdog系列(六):利用Qt通过服务端进行客户端与客户端通信(资料少,建议收藏)](https://zxfdog.blog.csdn.net/article/details/116355817) 60 | 61 | [Centos上编译qt程序缺少mysql驱动解决方案](https://zxfdog.blog.csdn.net/article/details/117637402) 62 | 63 | [腾讯云云服务器Centos系统安装MySQL数据库详细教程](https://zxfdog.blog.csdn.net/article/details/113573491) 64 | 65 | [初学Qt不会样式表怎么办,打包好的Qt样式表一键生成送给你](https://zxfdog.blog.csdn.net/article/details/108296647) 66 | 67 | 68 | 69 | --- 70 | 71 | #### 二. 图例 72 | 73 | ##### 1.登录界面 74 | 75 | 76 | 77 | ##### 2.主界面以及聊天窗口 78 | 79 | 80 | 81 | ##### 3.查找以及添加好友界面 82 | 83 | 84 | 85 | ##### 4.数据库字段 86 | 87 | 88 | 89 | 90 | 91 | --- 92 | 93 | #### 三. V1.0更新目录 94 | 95 | ##### 2021.5.1 更新 96 | 1. 完成基本的登录,客户端与客户端的通信 97 | 备注:目前还无法实现好友添加 98 | 99 | 100 | 101 | ##### 2021.5.28 更新 102 | 103 | ``` 104 | 1. 修复了服务端由客户端关闭顺序引起的崩溃 105 | 2. 优化服务端界面ui 106 | 3. 优化主界面ui 107 | 4. 实现主界面登录状态切换和系统托盘登录状态切换 108 | 5. 实现来消息时的头像闪动 109 | 6. 实现右下角消息列表 110 | 7. 主界面列表消息显示 111 | ``` 112 | 113 | 114 | 115 | ##### 2021.5.29 更新 116 | 117 | ``` 118 | 1. 修复一个好友多次发送消息导致打开多个窗口 119 | 2. 优化好友列表样式 120 | 3. 优化好友聊天窗口ui以及内容显示 121 | 4. 实现任务栏显示聊天对象头像 122 | ``` 123 | 124 | 125 | 126 | ##### 2021.5.30更新 127 | 128 | ``` 129 | 1. 优化登录界面动态图,以及登录界面头像锯齿化问题 130 | 2. 优化全局字体反锯齿,优化后字体平滑 131 | 3. 优化分组按钮箭头展开闭合效果以及消息列表 132 | 4. 优化右下角消息框ui 133 | ``` 134 | 135 | 136 | 137 | ##### 2021.6.1更新 138 | 139 | ``` 140 | 1. 实现好友添加,并自动更新好友列表 141 | 2. 优化搜索好友界面ui 142 | ``` 143 | 144 | 145 | 146 | 147 | 148 | ##### 2021.6.4更新 149 | 150 | ``` 151 | 1. 优化Usersql类的代码,采用单例设计模式 152 | 2. 优化部分函数更新写法,增加安全性,以及服务端功能优化 153 | 3. 增加对当前用户登录状态的写入,包括在线,隐身,离开,勿扰,等等(后期将会在好友列表中显示列表好友状态) 154 | 4. 增加了登录界面登录时的取消按钮,以及当密码错误时,显示密码错误界面,优化用户体验 155 | 5. 修复无论是否连接服务器都可以登录到主机面,增加对服务器是否能连接的判断,以及当前网络环境的判断,同时增加界面显示 156 | 6. 修复了之前点击关闭按钮,但是依旧无法调用析构函数导致后台存在进程,无法再次编译的问题 157 | ``` 158 | 159 | 160 | 161 | ##### 2021.6.8更新 162 | 163 | ``` 164 | 1. 优化对话ui,增加聊天气泡 165 | 2. 优化列表颜色显示 166 | ``` 167 | 168 | 169 | 170 | ##### 2021.6.9更新 171 | 172 | ``` 173 | 1. 修复了当前聊天窗口显示在桌面,托盘头像依旧闪烁的BUG 174 | 2. 增加了当前聊天窗口为非活动窗口时,来消息时的任务栏图标的闪烁 175 | 3. 修复了发送消息导致信息列表重复出现好友以及发送方不显示消息列表的问题 176 | 4. 修复了无限登陆的问题,规定同一账号在不同IP下可以互相挤掉对方,而在同一IP下只可以登录一个,并弹出提示框 177 | 5. 修复了点击同一好友,无限弹出聊天窗口的问题 178 | ``` 179 | 180 | 181 | 182 | 183 | 184 | ##### 2021.6.11更新 185 | 186 | ``` 187 | 1. 修复了关闭登录窗口但是后台进程还存在的问题 188 | 2. 修复了修改代码产生的诸多问题,优化整体流畅性 189 | ``` 190 | 191 | 192 | 193 | ##### 2021.6.13更新 194 | 195 | ``` 196 | 1. 优化聊天窗口逻辑 197 | 2. 修复关闭主窗口导致程序异常结束的问题 198 | ``` 199 | 200 | 201 | 202 | ##### 2021.6.15更新 203 | 204 | ``` 205 | 1. 修复并完善某些功能,v1.0版完成。 206 | ``` 207 | 208 | 209 | 210 | #### FdogWeb2.0更新 211 | 212 | ##### 2021.7.18更新 213 | 214 | 215 | 216 | ``` 217 | 1. 重写前端相关html,将之前jsp改写为html 218 | ``` 219 | 220 | 221 | 222 | ##### 2021.7.19更新 223 | 224 | ``` 225 | 1. 前端html大致完成,后端go接口大致完成,完成基本注册。 226 | ``` 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | --- 245 | 246 | #### 其他 247 | 248 | 微信交流群: 249 | 250 | ![image](https://user-images.githubusercontent.com/59921436/116808595-3f322280-ab6c-11eb-84d3-055fa639930d.png) 251 | 252 | 253 | --------------------------------------------------------------------------------