|
|
@ -5,34 +5,40 @@ HomePageSetingWidget::HomePageSetingWidget(QWidget *parent)
|
|
|
|
: QWidget(parent), ui(new Ui::HomePageSetingWidget), _GDDCIp(""),
|
|
|
|
: QWidget(parent), ui(new Ui::HomePageSetingWidget), _GDDCIp(""),
|
|
|
|
_lLinkIp(""), _adHocNetwork(""), _satelliteComm("") {
|
|
|
|
_lLinkIp(""), _adHocNetwork(""), _satelliteComm("") {
|
|
|
|
ui->setupUi(this);
|
|
|
|
ui->setupUi(this);
|
|
|
|
|
|
|
|
init();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
HomePageSetingWidget::~HomePageSetingWidget() { delete ui; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void HomePageSetingWidget::init() {
|
|
|
|
|
|
|
|
// 选择配置文件
|
|
|
|
urlFile = QCoreApplication::applicationDirPath() + "/config.ini";
|
|
|
|
urlFile = QCoreApplication::applicationDirPath() + "/config.ini";
|
|
|
|
_configIni = std::make_unique<QSettings>(urlFile, QSettings::IniFormat);
|
|
|
|
_configIni = std::make_unique<QSettings>(urlFile, QSettings::IniFormat);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
HomePageSetingWidget::~HomePageSetingWidget() { delete ui; }
|
|
|
|
// 读取配置信息
|
|
|
|
|
|
|
|
_GDDCIp = _configIni->value("光电吊舱/IP").toString();
|
|
|
|
|
|
|
|
_lLinkIp = _configIni->value("L链/IP").toString();
|
|
|
|
|
|
|
|
_adHocNetwork = _configIni->value("宽带自组网/IP").toString();
|
|
|
|
|
|
|
|
_satelliteComm = _configIni->value("机载卫通/IP").toString();
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
// 存储配置信息到MAP容器中
|
|
|
|
* @brief HomePageSetingWidget::setUrl 初始话后从.ini文件中读取的数据显示
|
|
|
|
_urlMap.insert({"光电吊舱", _GDDCIp});
|
|
|
|
* @param urlMap
|
|
|
|
_urlMap.insert({"L链", _lLinkIp});
|
|
|
|
*/
|
|
|
|
_urlMap.insert({"宽带自组网", _adHocNetwork});
|
|
|
|
void HomePageSetingWidget::setUrl(
|
|
|
|
_urlMap.insert({"机载卫通", _satelliteComm});
|
|
|
|
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->GDDCLineEdit->setText(_GDDCIp);
|
|
|
|
ui->lLinkLineEdit->setText(_lLinkIp);
|
|
|
|
ui->lLinkLineEdit->setText(_lLinkIp);
|
|
|
|
ui->netLineEdit->setText(_adHocNetwork);
|
|
|
|
ui->netLineEdit->setText(_adHocNetwork);
|
|
|
|
ui->sateliteLineEdit->setText(_satelliteComm);
|
|
|
|
ui->sateliteLineEdit->setText(_satelliteComm);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 发送消息到其他页面
|
|
|
|
|
|
|
|
emit sendOnlyUrl(GDDC, _GDDCIp);
|
|
|
|
|
|
|
|
emit sendOnlyUrl(L_Link, _lLinkIp);
|
|
|
|
|
|
|
|
emit sendOnlyUrl(Adhoc_Network, _adHocNetwork);
|
|
|
|
|
|
|
|
emit sendOnlyUrl(Satelite_Comm, _satelliteComm);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void HomePageSetingWidget::on_GDDCPushButton_clicked() {
|
|
|
|
void HomePageSetingWidget::on_GDDCPushButton_clicked() {
|
|
|
|
// 写参数到配置文件
|
|
|
|
// 写参数到配置文件
|
|
|
|
_GDDCIp = ui->GDDCLineEdit->text();
|
|
|
|
_GDDCIp = ui->GDDCLineEdit->text();
|
|
|
@ -59,22 +65,18 @@ void HomePageSetingWidget::on_sateliteButton_clicked() {
|
|
|
|
_configIni->setValue("机载卫通/IP", _satelliteComm);
|
|
|
|
_configIni->setValue("机载卫通/IP", _satelliteComm);
|
|
|
|
emit sendOnlyUrl(Satelite_Comm, _satelliteComm);
|
|
|
|
emit sendOnlyUrl(Satelite_Comm, _satelliteComm);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// 一键配置
|
|
|
|
void HomePageSetingWidget::on_oneKeyButton_clicked() {
|
|
|
|
void HomePageSetingWidget::on_oneKeyButton_clicked() {
|
|
|
|
// 写参数到配置文件
|
|
|
|
on_GDDCPushButton_clicked();
|
|
|
|
_GDDCIp = ui->GDDCLineEdit->text();
|
|
|
|
on_lLinkButton_clicked();
|
|
|
|
_configIni->setValue("光电吊舱/IP", _GDDCIp);
|
|
|
|
on_netButton_clicked();
|
|
|
|
_lLinkIp = ui->lLinkLineEdit->text();
|
|
|
|
on_sateliteButton_clicked();
|
|
|
|
_configIni->setValue("L链/IP", _lLinkIp);
|
|
|
|
}
|
|
|
|
_adHocNetwork = ui->netLineEdit->text();
|
|
|
|
/*************************************************
|
|
|
|
_configIni->setValue("宽带自组网/IP", _adHocNetwork);
|
|
|
|
* @func getUrl
|
|
|
|
_satelliteComm = ui->sateliteLineEdit->text();
|
|
|
|
* @brief 向外部提供接口 获取配置文件中的所有url信息
|
|
|
|
_configIni->setValue("机载卫通/IP", _satelliteComm);
|
|
|
|
* @param
|
|
|
|
|
|
|
|
**************************************************/
|
|
|
|
std::unordered_map<QString, QString> urlMap;
|
|
|
|
std::unordered_map<QString, QString> HomePageSetingWidget::getUrl() {
|
|
|
|
urlMap.insert({"光电吊舱", _GDDCIp});
|
|
|
|
return _urlMap;
|
|
|
|
urlMap.insert({"L链", _lLinkIp});
|
|
|
|
|
|
|
|
urlMap.insert({"宽带自组网", _adHocNetwork});
|
|
|
|
|
|
|
|
urlMap.insert({"机载卫通", _satelliteComm});
|
|
|
|
|
|
|
|
emit sendAllUrl(urlMap);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|