|
|
|
#include "homepagesetingwidget.h"
|
|
|
|
#include "ui_homepagesetingwidget.h"
|
|
|
|
|
|
|
|
HomePageSetingWidget::HomePageSetingWidget(QWidget *parent)
|
|
|
|
: QWidget(parent), ui(new Ui::HomePageSetingWidget) {
|
|
|
|
ui->setupUi(this);
|
|
|
|
init();
|
|
|
|
}
|
|
|
|
HomePageSetingWidget::~HomePageSetingWidget() { delete ui; }
|
|
|
|
|
|
|
|
void HomePageSetingWidget::init() {
|
|
|
|
// 选择配置文件
|
|
|
|
urlFile = QCoreApplication::applicationDirPath() + "/config.ini";
|
|
|
|
_configIni = std::make_unique<QSettings>(urlFile, QSettings::IniFormat);
|
|
|
|
|
|
|
|
// 读取配置信息
|
|
|
|
_GDDC.net.remoteIp = _configIni->value("光电吊舱/IP").toString();
|
|
|
|
_GDDC.net.remotePort = _configIni->value("光电吊舱/Port").toInt();
|
|
|
|
_lLink.url = _configIni->value("L链/IP").toString();
|
|
|
|
_adHocNetwork.url = _configIni->value("宽带自组网/IP").toString();
|
|
|
|
_satelliteComm.url = _configIni->value("机载卫通/IP").toString();
|
|
|
|
_ModelCamera.net.remoteIp = _configIni->value("三维建模/remoteIp").toString();
|
|
|
|
_ModelCamera.net.remotePort =
|
|
|
|
_configIni->value("三维建模/remotePort").toInt();
|
|
|
|
_ModelCamera.net.localIp = _configIni->value("三维建模/localIp").toString();
|
|
|
|
_ModelCamera.net.localPort = _configIni->value("三维建模/localPort").toInt();
|
|
|
|
|
|
|
|
// 存储配置信息到MAP容器中
|
|
|
|
_allParamMap.insert({"光电吊舱", _GDDC});
|
|
|
|
_allParamMap.insert({"L链", _lLink});
|
|
|
|
_allParamMap.insert({"宽带自组网", _adHocNetwork});
|
|
|
|
_allParamMap.insert({"机载卫通", _satelliteComm});
|
|
|
|
_allParamMap.insert({"三维建模", _ModelCamera});
|
|
|
|
|
|
|
|
// 显示到配置页面
|
|
|
|
ui->GDDCLineEdit->setText(_GDDC.net.remoteIp);
|
|
|
|
ui->lLinkLineEdit->setText(_lLink.url);
|
|
|
|
ui->netLineEdit->setText(_adHocNetwork.url);
|
|
|
|
ui->sateliteLineEdit->setText(_satelliteComm.url);
|
|
|
|
ui->modelCameraLineEditRemoteIp->setText(_ModelCamera.net.remoteIp);
|
|
|
|
ui->modelCameraLineEditRemotePort->setText(
|
|
|
|
QString::number(_ModelCamera.net.remotePort));
|
|
|
|
ui->modelCameraLineEditLocalIp->setText(_ModelCamera.net.localIp);
|
|
|
|
ui->modelCameraLineEditLocalPort->setText(
|
|
|
|
QString::number(_ModelCamera.net.localPort));
|
|
|
|
|
|
|
|
// 发送消息到其他页面
|
|
|
|
emit sendOneSet(GDDC, _GDDC);
|
|
|
|
emit sendOneSet(L_Link, _lLink);
|
|
|
|
emit sendOneSet(Adhoc_Network, _adHocNetwork);
|
|
|
|
emit sendOneSet(Satelite_Comm, _satelliteComm);
|
|
|
|
emit sendOneSet(ModelCamera, _ModelCamera);
|
|
|
|
}
|
|
|
|
|
|
|
|
void HomePageSetingWidget::on_GDDCPushButton_clicked() {
|
|
|
|
// 写参数到配置文件
|
|
|
|
_GDDC.net.remoteIp = ui->GDDCLineEdit->text();
|
|
|
|
_configIni->setValue("光电吊舱/IP", _GDDC.net.remoteIp);
|
|
|
|
emit sendOneSet(GDDC, _GDDC);
|
|
|
|
}
|
|
|
|
void HomePageSetingWidget::on_lLinkButton_clicked() {
|
|
|
|
// 写参数到配置文件
|
|
|
|
_lLink.url = ui->lLinkLineEdit->text();
|
|
|
|
_configIni->setValue("L链/IP", _lLink.url);
|
|
|
|
emit sendOneSet(L_Link, _lLink);
|
|
|
|
}
|
|
|
|
|
|
|
|
void HomePageSetingWidget::on_netButton_clicked() {
|
|
|
|
// 写参数到配置文件
|
|
|
|
_adHocNetwork.url = ui->netLineEdit->text();
|
|
|
|
_configIni->setValue("宽带自组网/IP", _adHocNetwork.url);
|
|
|
|
emit sendOneSet(Adhoc_Network, _adHocNetwork);
|
|
|
|
}
|
|
|
|
|
|
|
|
void HomePageSetingWidget::on_sateliteButton_clicked() {
|
|
|
|
// 写参数到配置文件
|
|
|
|
_satelliteComm.url = ui->sateliteLineEdit->text();
|
|
|
|
_configIni->setValue("机载卫通/IP", _satelliteComm.url);
|
|
|
|
emit sendOneSet(Satelite_Comm, _satelliteComm);
|
|
|
|
}
|
|
|
|
// 三维相机
|
|
|
|
void HomePageSetingWidget::on_modelCameraButton_clicked() {
|
|
|
|
// 写参数到配置文件
|
|
|
|
_ModelCamera.net.remoteIp = ui->modelCameraLineEditRemoteIp->text();
|
|
|
|
_ModelCamera.net.remotePort =
|
|
|
|
ui->modelCameraLineEditRemotePort->text().toInt();
|
|
|
|
_ModelCamera.net.localIp = ui->modelCameraLineEditLocalIp->text();
|
|
|
|
_ModelCamera.net.localPort = ui->modelCameraLineEditLocalPort->text().toInt();
|
|
|
|
_configIni->setValue("三维建模/remoteIp", _ModelCamera.net.remoteIp);
|
|
|
|
_configIni->setValue("三维建模/remotePort", _ModelCamera.net.remotePort);
|
|
|
|
_configIni->setValue("三维建模/localIp", _ModelCamera.net.localIp);
|
|
|
|
_configIni->setValue("三维建模/localPort", _ModelCamera.net.localPort);
|
|
|
|
emit sendOneSet(ModelCamera, _ModelCamera);
|
|
|
|
}
|
|
|
|
// 一键配置
|
|
|
|
void HomePageSetingWidget::on_oneKeyButton_clicked() {
|
|
|
|
on_GDDCPushButton_clicked();
|
|
|
|
on_lLinkButton_clicked();
|
|
|
|
on_netButton_clicked();
|
|
|
|
on_sateliteButton_clicked();
|
|
|
|
}
|
|
|
|
/*************************************************
|
|
|
|
* @func getAllParam
|
|
|
|
* @brief 向外部提供接口 获取配置文件中的所有url信息
|
|
|
|
* @param
|
|
|
|
**************************************************/
|
|
|
|
std::unordered_map<QString, settingStruct> HomePageSetingWidget::getAllParam() {
|
|
|
|
return _allParamMap;
|
|
|
|
}
|