|
|
|
#include "homepagesetingwidget.h"
|
|
|
|
#include "ui_homepagesetingwidget.h"
|
|
|
|
|
|
|
|
HomePageSetingWidget::HomePageSetingWidget(QWidget *parent)
|
|
|
|
: QWidget(parent), ui(new Ui::HomePageSetingWidget), _GDDCIp(""),
|
|
|
|
_lLinkIp(""), _adHocNetwork(""), _satelliteComm("") {
|
|
|
|
ui->setupUi(this);
|
|
|
|
urlFile = QCoreApplication::applicationDirPath() + "/config.ini";
|
|
|
|
_configIni = std::make_unique<QSettings>(urlFile, QSettings::IniFormat);
|
|
|
|
}
|
|
|
|
|
|
|
|
HomePageSetingWidget::~HomePageSetingWidget() { delete ui; }
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief HomePageSetingWidget::setUrl 初始话后从.ini文件中读取的数据显示
|
|
|
|
* @param urlMap
|
|
|
|
*/
|
|
|
|
void HomePageSetingWidget::setUrl(
|
|
|
|
std::unordered_map<QString, QString> &urlMap) {
|
|
|
|
_GDDCIp = urlMap["光电吊舱"];
|
|
|
|
_lLinkIp = urlMap["L链"];
|
|
|
|
_adHocNetwork = urlMap["宽带自组网"];
|
|
|
|
_satelliteComm = urlMap["机载卫通"];
|
|
|
|
initEdit();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief HomePageSetingWidget::initEdit 初始化Edit控件参数
|
|
|
|
*/
|
|
|
|
void HomePageSetingWidget::initEdit() {
|
|
|
|
ui->GDDCLineEdit->setText(_GDDCIp);
|
|
|
|
ui->lLinkLineEdit->setText(_lLinkIp);
|
|
|
|
ui->netLineEdit->setText(_adHocNetwork);
|
|
|
|
ui->sateliteLineEdit->setText(_satelliteComm);
|
|
|
|
}
|
|
|
|
void HomePageSetingWidget::on_GDDCPushButton_clicked() {
|
|
|
|
// 写参数到配置文件
|
|
|
|
_GDDCIp = ui->GDDCLineEdit->text();
|
|
|
|
_configIni->setValue("光电吊舱/IP", _GDDCIp);
|
|
|
|
emit sendOnlyUrl(GDDC, _GDDCIp);
|
|
|
|
}
|
|
|
|
void HomePageSetingWidget::on_lLinkButton_clicked() {
|
|
|
|
// 写参数到配置文件
|
|
|
|
_lLinkIp = ui->lLinkLineEdit->text();
|
|
|
|
_configIni->setValue("L链/IP", _lLinkIp);
|
|
|
|
emit sendOnlyUrl(L_Link, _lLinkIp);
|
|
|
|
}
|
|
|
|
|
|
|
|
void HomePageSetingWidget::on_netButton_clicked() {
|
|
|
|
// 写参数到配置文件
|
|
|
|
_adHocNetwork = ui->netLineEdit->text();
|
|
|
|
_configIni->setValue("宽带自组网/IP", _adHocNetwork);
|
|
|
|
emit sendOnlyUrl(Adhoc_Network, _adHocNetwork);
|
|
|
|
}
|
|
|
|
|
|
|
|
void HomePageSetingWidget::on_sateliteButton_clicked() {
|
|
|
|
// 写参数到配置文件
|
|
|
|
_satelliteComm = ui->sateliteLineEdit->text();
|
|
|
|
_configIni->setValue("机载卫通/IP", _satelliteComm);
|
|
|
|
emit sendOnlyUrl(Satelite_Comm, _satelliteComm);
|
|
|
|
}
|
|
|
|
|
|
|
|
void HomePageSetingWidget::on_oneKeyButton_clicked() {
|
|
|
|
// 写参数到配置文件
|
|
|
|
_GDDCIp = ui->GDDCLineEdit->text();
|
|
|
|
_configIni->setValue("光电吊舱/IP", _GDDCIp);
|
|
|
|
_lLinkIp = ui->lLinkLineEdit->text();
|
|
|
|
_configIni->setValue("L链/IP", _lLinkIp);
|
|
|
|
_adHocNetwork = ui->netLineEdit->text();
|
|
|
|
_configIni->setValue("宽带自组网/IP", _adHocNetwork);
|
|
|
|
_satelliteComm = ui->sateliteLineEdit->text();
|
|
|
|
_configIni->setValue("机载卫通/IP", _satelliteComm);
|
|
|
|
|
|
|
|
std::unordered_map<QString, QString> urlMap;
|
|
|
|
urlMap.insert({"光电吊舱", _GDDCIp});
|
|
|
|
urlMap.insert({"L链", _lLinkIp});
|
|
|
|
urlMap.insert({"宽带自组网", _adHocNetwork});
|
|
|
|
urlMap.insert({"机载卫通", _satelliteComm});
|
|
|
|
emit sendAllUrl(urlMap);
|
|
|
|
}
|