1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 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
|
#define HE
#include <QApplication>
#include <QFont>
#include <QPushButton>
#include <QLabel>
#include <QTextEdit>
#include <QtNetwork\QTcpServer>
#include <QtCore\QObject>
#include <QtCore\QString>
#include <QTcpServer>
#include <QTcpSocket>
#include <QSound>
#include "link.h"
using namespace std;
int main(int argc, char* argv[])
{
QApplication app(argc, argv);
QWidget fenetrep; /**objet parent*/
/**Server et client*/
QTcpServer serveur;
QTcpSocket client;
serveur.listen(QHostAddress::Any,8282);
/**end*/
/**creation of objects link to the parent */
QPushButton BoutonSeb("Seb",&fenetrep);
QPushButton BoutonJer("Jer",&fenetrep);
QPushButton BoutonThi("Thi",&fenetrep);
QPushButton BoutonEnvoyer("Envoyer",&fenetrep);
QPushButton BoutonQuitter("Quitter",&fenetrep);
QLabel LabelConnection("Label d'info--Programme développé par Seb",&fenetrep);
QLabel LabelReceive("Label de reception",&fenetrep);
QTextEdit TextZone(&fenetrep);
link tra(&TextZone,&LabelConnection,&serveur,&client);
QSound son("ringin.wav",&fenetrep);
/**end */
/**Resize*/
fenetrep.resize(800,600);
BoutonJer.setGeometry(10, 10,50,30);
BoutonSeb.setGeometry(375, 10,50,30);
BoutonThi.setGeometry(740, 10,50,30);
BoutonEnvoyer.setGeometry(370, 500,75,45);
BoutonQuitter.setGeometry(370,550,75,45);
LabelConnection.setGeometry(10,30,775,45);
LabelReceive.setGeometry(10,60,775,300);
TextZone.setGeometry(10,450,775,45);
/**end*/
/**event*/
QObject::connect(&BoutonQuitter,SIGNAL(clicked()),&app,SLOT(quit()));
QObject::connect(&BoutonEnvoyer,SIGNAL(clicked()),&tra,SLOT(appaff()));
QObject::connect(&BoutonSeb,SIGNAL(clicked()),&tra,SLOT(connectionToSeb()));
QObject::connect(&BoutonJer,SIGNAL(clicked()),&tra,SLOT(connectionToJer()));
QObject::connect(&BoutonThi,SIGNAL(clicked()),&tra,SLOT(connectionToThi()));
QObject::connect(&serveur,SIGNAL(newConnection()),&son,SLOT(play()));
QObject::connect(&serveur,SIGNAL(newConnection()),&tra,SLOT(acceptClient()));
/**end*/
fenetrep.show();
return app.exec();
} |
Partager