修复全DLC列表错误问题

修复文本描述错误问题
增加默认测试列表,并非单个
This commit is contained in:
JackLee_CN 2024-10-14 18:13:16 +08:00
parent 0b55dfd546
commit 6b9bb016c8
4 changed files with 55 additions and 21 deletions

View File

@ -99,4 +99,8 @@ extern QStringList ex_in_dlc_table_head_tips;
extern QStringList ex_all_dlc_table_head_tips;
extern QStringList ex_default_src_name;
extern QStringList ex_default_src_url;
#endif

View File

@ -17,6 +17,18 @@ QStringList ex_in_dlc_table_head_tips = {QStringLiteral("已增加DLC")};
QStringList ex_all_dlc_table_head_tips = {QStringLiteral("DLC列表")};
QStringList ex_default_src_name = {QStringLiteral("ikun0014"),
QStringLiteral("ManifestHub "),
QStringLiteral("fast_ikun0014"),
QStringLiteral("fast_ManifestHub ")
};
QStringList ex_default_src_url = {QStringLiteral("https://github.com/ikun0014/ManifestHub"),
QStringLiteral("https://github.com/ManifestHub/ManifestHub.git"),
QStringLiteral("https://githubfast.com/ikun0014/ManifestHub.git"),
QStringLiteral("https://githubfast.com/ManifestHub/ManifestHub.git"),
};
GloablData _data;
#endif // STEAM_BASE_EX_H

View File

@ -255,9 +255,13 @@ bool xsteam_curl_steam_id_app_info(std::string uid, UidData &u_data)
{
if (data.key() == "dlc")
{
for (auto x : data.value())
if (data.value().size() > 0)
{
u_data.r_dlc.push_back(x.dump());
u_data.r_dlc.clear();
for (auto x : data.value())
{
u_data.r_dlc.push_back(x.dump());
}
}
}
}
@ -359,14 +363,18 @@ void xsteam_save_data_read()
{
// 当本地保存数据文件不存在或者读取data.json文件出错或者导致用户修改配置使得读取data.json出错.
// 默认测试数据源
SrcData _src_data;
_src_data.src_name = "FastGitHud";
_src_data.src_url = "https://githubfast.com/ManifestHub/ManifestHub.git";
_src_data.src_type = GIT_MODE::TAG;
_data.s_data.push_back(_src_data);
for (int i = 0; i <= ex_default_src_name.count() - 1; i++)
{
SrcData _src_data;
_src_data.src_name = ex_default_src_name[i].toStdString();
_src_data.src_url = ex_default_src_url[i].toStdString();
_src_data.src_type = GIT_MODE::TAG;
_data.s_data.push_back(_src_data);
}
// 默认配置
_data.x_config.font = 0;
_data.x_config.font_bold=0;
_data.x_config.font_bold = 0;
_data.x_config.style = 1;
QSettings settings("HKEY_CURRENT_USER\\Software\\Valve\\Steam", QSettings::NativeFormat);
_data.x_config.steam_dir = (settings.value("SteamPath", "").toString()).toStdString();
@ -518,8 +526,8 @@ bool xsteam_lua_to_com(UidData u_data)
m_cmd->kill();
delete m_cmd;
m_cmd = nullptr;
std::cout <<"lua_file exists:"<<_lua_file.exists()<<std::endl;
std::cout <<"lua_packa_file exists:"<<_lua_packa_file.exists()<<std::endl;
std::cout << "lua_file exists:" << _lua_file.exists() << std::endl;
std::cout << "lua_packa_file exists:" << _lua_packa_file.exists() << std::endl;
if (_lua_file.exists())
{
_lua_file.remove();
@ -597,8 +605,9 @@ void xsteam_delete_uid_st(std::string uid)
if (it->uid == uid)
{
it = _data.u_data.erase(it);
QFile st(QString::fromStdString(_data.x_config.steamtools_st_dir+uid+".st"));
if(st.exists()){
QFile st(QString::fromStdString(_data.x_config.steamtools_st_dir + uid + ".st"));
if (st.exists())
{
st.remove();
}
xsteam_save_data_write();
@ -606,9 +615,11 @@ void xsteam_delete_uid_st(std::string uid)
}
}
}
bool xsteam_src_data_exists(std::string src_name){
bool xsteam_src_data_exists(std::string src_name)
{
QString save_file_str = ex_save_path_ex + "tags_" + QString::fromStdString(src_name) + ".data";
if(QFile(save_file_str).exists()){
if (QFile(save_file_str).exists())
{
return true;
}
return false;

View File

@ -86,7 +86,7 @@ void xsteam_ui::xsteam_init_mind_layout()
ip_layout->addWidget(ip_uid_edit);
ip_layout->setContentsMargins(2, 2, 2, 2);
btn_dlc_push = new QPushButton(tr("入库信息"));
btn_dlc_push = new QPushButton(tr("获取DLC列表"));
btn_dlc_push->setObjectName("SET_DLC");
ip_iu_layout = new QHBoxLayout();
@ -112,7 +112,7 @@ void xsteam_ui::xsteam_init_mind_layout()
ip_uid_group->setLayout(ip_uid_group_layout);
// all dlc info
ip_dlc_info_layout = new QVBoxLayout();
ip_all_dlc_group = new QGroupBox(tr("DLC信息"));
ip_all_dlc_group = new QGroupBox(tr("入库信息"));
ip_all_dlc_group->setObjectName("ALL_DLC_GROUP");
ip_all_dlc_table = new xsteam_view();
ip_all_dlc_table->setObjectName("ALL_DLC_TABLE");
@ -204,16 +204,22 @@ void xsteam_ui::slots_get_uid_dlcs()
UidData uid_data;
slots_msg_text("获取DLC信息...");
ip_all_dlc_table->item_clear();
if (xsteam_curl_steam_id_app_info(ip_uid_edit->text().toStdString(), uid_data))
ip_in_dlc_table->item_clear();
slots_disable_enable_function(false);
QFuture<void> future = QtConcurrent::run([=](UidData uid_data)
{
if (xsteam_curl_steam_id_app_info(ip_uid_edit->text().toStdString(), uid_data))
{
ip_all_dlc_table->item_append(uid_data, VIEW_MODE::ALL_DLC_INFO);
xs_data = uid_data;
slots_msg_text("DLC信息获取完毕");
slots_disable_enable_function(true);
}
else
{
slots_msg_text("获取DLC信息失败!请检查UID是否正确&网络是否畅通");
}
slots_disable_enable_function(true);
}},uid_data);
}
void xsteam_ui::slots_rightMenu(const QPoint &pos)
{
@ -309,7 +315,7 @@ void xsteam_ui::slots_in_dlc_delete()
if (dlc == dlc_id.toStdString())
{
data.n_dlc.erase(std::remove(data.n_dlc.begin(), data.n_dlc.end(), dlc_id), data.n_dlc.end());
slots_msg_text("删除DLC:"+dlc_id.toStdString()+"成功!");
slots_msg_text("删除DLC:" + dlc_id.toStdString() + "成功!");
}
}
}
@ -331,7 +337,7 @@ void xsteam_ui::slots_in_dlc_add()
if (x_dlc.uid == ip_uid_edit->text().toStdString())
{
x_dlc.n_dlc.push_back(dlc_id.toStdString());
slots_msg_text("增加:"+dlc_id.toStdString()+"成功!");
slots_msg_text("增加:" + dlc_id.toStdString() + "成功!");
}
}
}
@ -483,7 +489,8 @@ void xsteam_ui::slots_imput_uid_push()
bool steamtools_ok = false;
in_data.t_g_uid = ip_uid_edit->text().toStdString();
in_data.t_s_name = server_txt->currentText().toStdString();
if(ip_uid_edit->text().toStdString()==""){
if (ip_uid_edit->text().toStdString() == "")
{
slots_msg_text("入库UID不能为空");
}
if (xsteam_uid_exists(in_data.t_g_uid))