#ifndef DIALOG_H
#define DIALOG_H
#include <QDialog>
#include"mainwindow.h"
namespace Ui {
class Dialog;
}
class Dialog : public QDialog
{
Q_OBJECT
public:
explicit Dialog(QWidget *parent = 0);
~Dialog();
private slots:
void on_pushButton_clicked();
private:
Ui::Dialog *ui;
QString name;
MainWindow *man;
};
#endif
#include "dialog.h"
#include "ui_dialog.h"
Dialog::Dialog(QWidget *parent) :
QDialog(parent),
ui(new Ui::Dialog)
{
ui->setupUi(this);
}
Dialog::~Dialog()
{
delete ui;
}
void Dialog::on_pushButton_clicked()
{
name = ui->lineEdit->text();
man = new MainWindow(name,this);
man->show();
this->hide();
}
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
#include<QUdpSocket>
#include<QMap>
#include<QTreeWidgetItem>
namespace Ui {
class MainWindow;
}
enum STATUS
{
OFFLINE = 0,ONLINE,MESSAGE,FILES
};
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
explicit MainWindow(QString name,QWidget