qt_demoe/tool/nettool/form/frmmain.cpp

52 lines
1.2 KiB
C++
Raw Normal View History

2019-09-29 05:13:01 +00:00
#include "frmmain.h"
#include "ui_frmmain.h"
2021-06-08 11:02:49 +00:00
#include "quihelper.h"
2019-09-29 05:13:01 +00:00
#include "frmtcpclient.h"
#include "frmtcpserver.h"
#include "frmudpclient.h"
#include "frmudpserver.h"
#ifdef websocket
#include "frmwebclient.h"
#include "frmwebserver.h"
#endif
2019-09-29 05:13:01 +00:00
frmMain::frmMain(QWidget *parent) : QWidget(parent), ui(new Ui::frmMain)
{
ui->setupUi(this);
this->initForm();
this->initConfig();
2019-09-29 05:13:01 +00:00
}
frmMain::~frmMain()
{
delete ui;
}
void frmMain::initForm()
{
ui->tabWidget->addTab(new frmTcpClient, "TCP客户端");
ui->tabWidget->addTab(new frmTcpServer, "TCP服务端");
ui->tabWidget->addTab(new frmUdpClient, "UDP客户端");
ui->tabWidget->addTab(new frmUdpServer, "UDP服务端");
#ifdef websocket
ui->tabWidget->addTab(new frmWebClient, "WEB客户端");
ui->tabWidget->addTab(new frmWebServer, "WEB服务端");
#endif
#ifdef emsdk
2021-04-13 01:36:22 +00:00
AppConfig::CurrentIndex = 4;
#endif
}
void frmMain::initConfig()
{
2021-04-13 01:36:22 +00:00
ui->tabWidget->setCurrentIndex(AppConfig::CurrentIndex);
connect(ui->tabWidget, SIGNAL(currentChanged(int)), this, SLOT(saveConfig()));
}
void frmMain::saveConfig()
2019-09-29 05:13:01 +00:00
{
2021-04-13 01:36:22 +00:00
AppConfig::CurrentIndex = ui->tabWidget->currentIndex();
AppConfig::writeConfig();
2019-09-29 05:13:01 +00:00
}