2024-10-11 19:40:20 +08:00
|
|
|
#include "xsteam_set_ui.h"
|
|
|
|
|
|
|
|
xsteam_set_ui::xsteam_set_ui()
|
|
|
|
{
|
|
|
|
init_set();
|
|
|
|
load_data_set();
|
|
|
|
}
|
|
|
|
xsteam_set_ui::~xsteam_set_ui()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
void xsteam_set_ui::init_set()
|
|
|
|
{
|
2024-10-31 12:23:59 +08:00
|
|
|
main_qwidget=new QWidget;
|
2024-10-11 19:40:20 +08:00
|
|
|
main_layout = new QVBoxLayout;
|
|
|
|
foot_layout = new QHBoxLayout;
|
|
|
|
body_layout = new QVBoxLayout;
|
2024-10-29 07:39:29 +08:00
|
|
|
set_group=new QGroupBox(tr("参数设置"));
|
|
|
|
set_group->setObjectName("SET_GROUP");
|
2024-10-11 19:40:20 +08:00
|
|
|
|
|
|
|
steam_layout=new QHBoxLayout;
|
|
|
|
steam_path_str=new QLabel(tr("Steam路径设置:"));
|
|
|
|
steam_path_edit=new QLineEdit();
|
|
|
|
steam_path_btn=new QPushButton(tr("浏览"));
|
|
|
|
steam_layout->addWidget(steam_path_str);
|
|
|
|
steam_layout->addWidget(steam_path_edit);
|
|
|
|
steam_layout->addWidget(steam_path_btn);
|
|
|
|
|
|
|
|
steamtools_layout=new QHBoxLayout;
|
|
|
|
steamtools_path_str=new QLabel(tr("SteamTools路径设置:"));
|
|
|
|
steamtools_path_edit=new QLineEdit();
|
|
|
|
steamtools_path_btn=new QPushButton(tr("浏览"));
|
|
|
|
steamtools_layout->addWidget(steamtools_path_str);
|
|
|
|
steamtools_layout->addWidget(steamtools_path_edit);
|
|
|
|
steamtools_layout->addWidget(steamtools_path_btn);
|
|
|
|
|
|
|
|
steamtools_st_layout=new QHBoxLayout;
|
2024-10-17 18:53:10 +08:00
|
|
|
steamtools_st_path_str=new QLabel(tr("SteamTools .st路径设置(不建议修改):"));
|
2024-10-11 19:40:20 +08:00
|
|
|
steamtools_st_path_edit=new QLineEdit();
|
|
|
|
steamtools_st_path_btn=new QPushButton(tr("浏览"));
|
|
|
|
steamtools_st_layout->addWidget(steamtools_st_path_str);
|
|
|
|
steamtools_st_layout->addWidget(steamtools_st_path_edit);
|
|
|
|
steamtools_st_layout->addWidget(steamtools_st_path_btn);
|
|
|
|
|
|
|
|
|
|
|
|
steam_api_layout=new QHBoxLayout;
|
2024-10-17 18:53:10 +08:00
|
|
|
steaminfo_api_path_str=new QLabel(tr("Steam Info Api Url(不建议修改):"));
|
|
|
|
steaminfo_api_path_edit=new QLineEdit();
|
2024-10-11 19:40:20 +08:00
|
|
|
steam_api_layout->addWidget(steaminfo_api_path_str);
|
|
|
|
steam_api_layout->addWidget(steaminfo_api_path_edit);
|
|
|
|
|
|
|
|
|
|
|
|
steam_head_api_layout=new QHBoxLayout;
|
2024-10-17 18:53:10 +08:00
|
|
|
steaminfo_head_path_str=new QLabel(tr("Steam Logo Api Url(不建议修改):"));
|
|
|
|
steaminfo_head_path_edit=new QLineEdit();
|
2024-10-11 19:40:20 +08:00
|
|
|
steam_head_api_layout->addWidget(steaminfo_head_path_str);
|
|
|
|
steam_head_api_layout->addWidget(steaminfo_head_path_edit);
|
|
|
|
|
|
|
|
body_layout->addLayout(steam_layout);
|
|
|
|
body_layout->addLayout(steamtools_layout);
|
|
|
|
body_layout->addLayout(steamtools_st_layout);
|
|
|
|
body_layout->addLayout(steam_api_layout);
|
|
|
|
body_layout->addLayout(steam_head_api_layout);
|
2024-10-17 18:53:10 +08:00
|
|
|
body_layout->addWidget(new QWidget());
|
2024-10-29 07:39:29 +08:00
|
|
|
set_group->setLayout(body_layout);
|
2024-10-11 19:40:20 +08:00
|
|
|
|
|
|
|
_pSaveData = new QPushButton(tr("保存"));
|
|
|
|
foot_layout->addSpacerItem(sparcer_item);
|
|
|
|
foot_layout->addWidget(_pSaveData);
|
|
|
|
foot_layout->addSpacerItem(sparcer_item);
|
|
|
|
|
2024-10-29 07:39:29 +08:00
|
|
|
main_layout->addWidget(set_group);
|
2024-10-11 19:40:20 +08:00
|
|
|
main_layout->addLayout(foot_layout);
|
|
|
|
main_layout->setStretch(0, 8);
|
|
|
|
main_layout->setStretch(1, 2);
|
2024-10-31 12:23:59 +08:00
|
|
|
main_layout->setContentsMargins(5, 5, 5, 5);
|
|
|
|
main_qwidget->setLayout(main_layout);
|
|
|
|
layout()->addWidget(main_qwidget);
|
2024-10-11 19:40:20 +08:00
|
|
|
connect_slots();
|
|
|
|
}
|
|
|
|
void xsteam_set_ui::connect_slots(){
|
|
|
|
connect(_pSaveData, SIGNAL(clicked()), this, SLOT(slotsSaveDone()));
|
|
|
|
}
|
|
|
|
void xsteam_set_ui::load_data_set(){
|
|
|
|
steam_path_edit->setText(QString::fromStdString(_data.x_config.steam_dir));
|
|
|
|
steamtools_path_edit->setText(QString::fromStdString(_data.x_config.steamtools_dir));
|
|
|
|
steamtools_st_path_edit->setText(QString::fromStdString(_data.x_config.steamtools_st_dir));
|
|
|
|
steaminfo_api_path_edit->setText(QString::fromStdString(_data.x_config.steam_api_url));
|
|
|
|
steaminfo_head_path_edit->setText(QString::fromStdString(_data.x_config.steam_logo_url));
|
|
|
|
}
|
|
|
|
void xsteam_set_ui::slotsSaveDone(){
|
2024-10-13 21:09:14 +08:00
|
|
|
_data.x_config.steam_dir=steam_path_edit->text().toStdString();
|
|
|
|
_data.x_config.steamtools_dir=steamtools_path_edit->text().toStdString();
|
|
|
|
_data.x_config.steamtools_st_dir=steamtools_st_path_edit->text().toStdString();
|
|
|
|
_data.x_config.steam_api_url=steaminfo_api_path_edit->text().toStdString();
|
|
|
|
_data.x_config.steam_logo_url=steaminfo_head_path_edit->text().toStdString();
|
|
|
|
xsteam_save_data_write();
|
|
|
|
xsteam_msg_tip(nullptr, "保存成功");
|
2024-10-11 19:40:20 +08:00
|
|
|
this->close();
|
|
|
|
}
|