You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
84 lines
2.4 KiB
C++
84 lines
2.4 KiB
C++
7 months ago
|
#include "homepagesetingwidget.h"
|
||
|
#include "ui_homepagesetingwidget.h"
|
||
|
|
||
|
HomePageSetingWidget::HomePageSetingWidget(QWidget *parent)
|
||
|
: QWidget(parent)
|
||
|
, ui(new Ui::HomePageSetingWidget)
|
||
|
, _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)
|
||
|
{
|
||
|
_lLinkIp = urlMap["L链"];
|
||
|
_adHocNetwork = urlMap["宽带自组网"];
|
||
|
_satelliteComm = urlMap["机载卫通"];
|
||
|
initEdit();
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* @brief HomePageSetingWidget::initEdit 初始化Edit控件参数
|
||
|
*/
|
||
|
void HomePageSetingWidget::initEdit()
|
||
|
{
|
||
|
ui->lLinkLineEdit->setText(_lLinkIp);
|
||
|
ui->netLineEdit->setText(_adHocNetwork);
|
||
|
ui->sateliteLineEdit->setText(_satelliteComm);
|
||
|
}
|
||
|
|
||
|
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()
|
||
|
{
|
||
|
//写参数到配置文件
|
||
|
_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({"L链",_lLinkIp});
|
||
|
urlMap.insert({"宽带自组网",_adHocNetwork});
|
||
|
urlMap.insert({"机载卫通",_satelliteComm});
|
||
|
emit sendAllUrl(urlMap);
|
||
|
}
|
||
|
|