增加入库源信息

增加更新功能
调整拉取信息参数
调整读取本地json函数名
删除curl全局初始化函数
This commit is contained in:
JackLee_CN 2024-10-15 11:05:44 +08:00
parent 6b9bb016c8
commit 6c8b430f77
13 changed files with 166 additions and 138 deletions

View File

@ -110,12 +110,12 @@ SET(PROJECT_SOURCES
${src}
)
# qFatalqDebug
LIST(APPEND CMAKE_CXX_FLAGS "-DQT_NO_DEBUG_OUTPUT")
#LIST(APPEND CMAKE_CXX_FLAGS "-DQT_NO_DEBUG_OUTPUT")
#
QT6_ADD_RESOURCES(RCFILES res.qrc)
#WIN32
add_executable(${PROJECT_NAME} WIN32 ${PROJECT_SOURCES} ${RCFILES} xsteam.rc)
add_executable(${PROJECT_NAME} ${PROJECT_SOURCES} ${RCFILES} xsteam.rc)
#
#RPATH

View File

@ -6,6 +6,7 @@
"generator": "Ninja",
"binaryDir": "${sourceDir}/build",
"cacheVariables": {
"CMAKE_BUILD_TYPE":"Release",
"CMAKE_MAKE_PROGRAM": "ninja.exe",
"CMAKE_C_COMPILER": "x86_64-w64-mingw32-gcc.exe",
"CMAKE_CXX_COMPILER": "x86_64-w64-mingw32-g++.exe",

View File

@ -27,8 +27,8 @@ void sui::init_layout()
setWindowFlags(Qt::FramelessWindowHint);
setAttribute(Qt::WA_TranslucentBackground);
setMouseTracking(true);
setBaseSize(660, 600);
resize(660, 600);
setBaseSize(700, 600);
resize(700, 600);
setLayout(m_layout);
}

View File

@ -19,6 +19,11 @@ typedef enum{
STEAMTOOLS
}RUN_MODE;
typedef enum
{
PUSH_ADD,
PUSH_UPDATE
} PUSH_MODE;
// vdf file read mode
typedef enum
{
@ -41,6 +46,7 @@ typedef struct
std::string uid = {};
std::string m_time = {};
std::string i_time = {};
std::string s_name = {};
std::vector<std::string> n_dlc={};
std::vector<std::string> r_dlc={};
std::vector<std::string> manifest = {};
@ -64,12 +70,6 @@ typedef struct
std::string steam_logo_url={};
} XSteamConfig;
typedef struct
{
std::string t_g_uid = {};
std::string t_s_name{};
} InputData;
// gloabal data
typedef struct
{

View File

@ -11,7 +11,7 @@ QString ex_save_path_ex;
QStringList ex_src_table_head_tips = {QStringLiteral("Src Name"), QStringLiteral("Git Mode"), QStringLiteral("Url")};
QStringList ex_uid_table_head_tips = {QStringLiteral("游戏ICO"),QStringLiteral("游戏UID"),QStringLiteral("游戏名"),
QStringLiteral("更新时间"),QStringLiteral("入库时间")};
QStringLiteral("更新时间"),QStringLiteral("入库时间"),QStringLiteral("源服务器")};
QStringList ex_in_dlc_table_head_tips = {QStringLiteral("已增加DLC")};

View File

@ -31,7 +31,6 @@ std::string xsteam_curl::get_steam_id_info(std::string api_url,std::string _c_ui
{
std::string u_str = api_url + _c_uid;
std::string strRsp;
curl_global_init(CURL_GLOBAL_DEFAULT);
init_curl();
CURLcode res = CURLE_QUOTE_ERROR;
int retry = 3;
@ -88,7 +87,6 @@ bool xsteam_curl::get_steam_header_ico(std::string logo_url,std::string _c_uid)
if(!dir.exists()){
QDir().mkpath(QString::fromStdString(base_str + "/save/img"));
}
curl_global_init(CURL_GLOBAL_ALL);
init_curl();
// 访问网址
curl_easy_setopt(curl, CURLOPT_URL, u_str.c_str());

View File

@ -12,7 +12,7 @@ void xsteam_init_opts()
ex_save_path = ex_base_exe_path + QStringLiteral("/save");
// current dir+/save/
ex_save_path_ex = ex_save_path + QStringLiteral("/");
xsteam_save_data_read();
xsteam_data_unserialize();
if (_data.s_data.size() > 0)
{
for (auto x : _data.s_data)
@ -152,35 +152,23 @@ void xsteam_vdf_read_key(vdf::object vdf_data, UidData &u_data)
{
std::cout << vdf_data.name << std::endl;
std::map<std::string, std::string> keys;
u_data.uid_key.clear();
for (auto &k : vdf_data.childs)
{
std::string u_id = k.first;
std::string u_key = k.second->attribs.find("DecryptionKey")->second;
if (std::to_string((std::stoi(u_data.uid) + 1)) == u_id)
{
qDebug() << QString::fromStdString(u_id) << ":" << QString::fromStdString(u_key);
u_data.uid_key.insert(std::pair<std::string, std::string>(u_id, u_key));
}
else
{
// 考虑是否需要仅仅针对dlc自行保存key的值.是否全部读入data.json内
for (auto x : u_data.n_dlc)
{
if (std::to_string((std::stoi(x) + 1)) == u_id)
{
qDebug() << QString::fromStdString(u_id) << ":" << QString::fromStdString(u_key);
u_data.uid_key.insert(std::pair<std::string, std::string>(u_id, u_key));
}
}
}
// 游戏UID depots的key
qDebug() << QString::fromStdString(u_id) << ":" << QString::fromStdString(u_key);
u_data.uid_key.insert(std::pair<std::string, std::string>(u_id, u_key));
}
}
// 读取指定uid目录下的文件名
void xsteam_vdf_manifest_name(QString uid_dir, UidData &u_data)
{
QDir _uid_dir(uid_dir);
QStringList _manifest_list = _uid_dir.entryList(QStringList() << "*.manifest", QDir::Files);
for (auto &x : _manifest_list)
QStringList manifest_list = _uid_dir.entryList(QStringList() << "*.manifest", QDir::Files);
u_data.manifest.clear();
for (auto &x : manifest_list)
{
u_data.manifest.push_back(x.toStdString());
}
@ -216,10 +204,10 @@ void xsteam_vdf_edit(vdf::object, std::map<std::string, std::string> data, VDF_E
}
}
// curl get steam id info to _data
bool xsteam_curl_steam_id_app_info(std::string uid, UidData &u_data)
bool xsteam_curl_steam_id_app_info(UidData &u_data)
{
xsteam_curl *_x_curl = new xsteam_curl();
auto info_str = _x_curl->get_steam_id_info(_data.x_config.steam_api_url, uid);
auto info_str = _x_curl->get_steam_id_info(_data.x_config.steam_api_url, u_data.uid);
delete _x_curl;
_x_curl = nullptr;
if (info_str == "error" || info_str == "")
@ -237,7 +225,6 @@ bool xsteam_curl_steam_id_app_info(std::string uid, UidData &u_data)
std::cerr << "位置:字符索引 " << e.byte << std::endl;
return false;
}
u_data.uid = uid;
qDebug() << QString::fromStdString(info_json.dump(4));
for (auto &root_data : info_json.items())
{
@ -257,6 +244,7 @@ bool xsteam_curl_steam_id_app_info(std::string uid, UidData &u_data)
{
if (data.value().size() > 0)
{
u_data.r_dlc.clear();
for (auto x : data.value())
{
@ -275,7 +263,7 @@ bool xsteam_curl_steam_id_app_info(std::string uid, UidData &u_data)
return false;
}
// 读取xsteam软件保存在save目录下的data.json并且反序列化读取到全局变量内
void xsteam_save_data_read()
void xsteam_data_unserialize()
{
QString save_file = ex_save_path_ex + "data.json";
if (!QDir(ex_save_path).exists())
@ -326,6 +314,8 @@ void xsteam_save_data_read()
_temp_data.i_time = x.value().at("In_Time");
_temp_data.m_time = x.value().at("Up_Time");
_temp_data.ico = x.value().at("Ico");
_temp_data.s_name = x.value().at("Src_Name");
if (x.value().contains("Manifest"))
{
_temp_data.manifest = x.value().at("Manifest").get<std::vector<std::string>>();
@ -412,6 +402,7 @@ json xsteam_data_serialize(json jsonData)
jsonData[toStr(uid_data)][u.uid][toStr(Up_Time)] = u.m_time;
// 游戏ico图标参数
jsonData[toStr(uid_data)][u.uid][toStr(Ico)] = u.ico;
jsonData[toStr(uid_data)][u.uid][toStr(Src_Name)] = u.s_name;
// 游戏清单列表
for (auto &w : u.manifest)
{
@ -478,36 +469,44 @@ bool xsteam_lua_to_com(UidData u_data)
1-UID和DLC末尾为0是游戏的解锁代码
2-UID内末尾为1则是windows系统的文件包
*/
// 游戏UID-0
lua_str = "addappid(" + QString::fromStdString(u_data.uid) + ",1,\"None\")";
dp << lua_str.toStdString() << "\n";
qDebug() << "UID_KEY_0" << lua_str.toStdString();
// 增加已经入库的DLC的UID-0
for (auto &x : u_data.n_dlc)
{
for (auto [u, w] : u_data.uid_key)
// 增加DLC的uid同时必须和uid_key列表的u比对只增加远程服务器有的DLC
lua_str = "addappid(" + QString::fromStdString(x) + ",1,\"None\")";
dp << lua_str.toStdString() << "\n";
qDebug() << "DLC_KEY_0" << lua_str.toStdString();
}
for (auto &[uid, key] : u_data.uid_key)
{
if (std::to_string((std::stoi(u_data.uid) + 1)) == uid)
{
if (std::to_string((std::stoi(x) + 1)) == u)
// 增加游戏本体的uid和key
lua_str = "addappid(" + QString::fromStdString(uid) + ",1," + "\"" + QString::fromStdString(key) + "\"" + ")";
dp << lua_str.toStdString() << "\n";
qDebug() << "UID_KEY:" << lua_str.toStdString();
}
}
for (auto &d_id : u_data.n_dlc)
{
for (auto &[uid, key] : u_data.uid_key)
{
if (std::to_string((std::stoi(d_id) + 1)) == uid)
{
// 增加DLC的uid同时必须和uid_key列表的u比对只增加远程服务器有的DLC
lua_str = "addappid(" + QString::fromStdString(x) + ",1,\"None\")";
// 增加DLC的uid和key
lua_str = "addappid(" + QString::fromStdString(uid) + ",1," + "\"" + QString::fromStdString(key) + "\"" + ")";
dp << lua_str.toStdString() << "\n";
qDebug() << "DLC_KEY:" << lua_str.toStdString();
}
}
}
for (auto &[u, w] : u_data.uid_key)
{
qDebug() << "u:" << QString::fromStdString(u) << "w:" << QString::fromStdString(w);
if (std::to_string((std::stoi(u_data.uid) + 1)) == u)
{
// 增加游戏本体的uid和key
lua_str = "addappid(" + QString::fromStdString(u) + ",1," + "\"" + QString::fromStdString(w) + "\"" + ")";
}
else
{
// 增加DLC的uid和key
lua_str = "addappid(" + QString::fromStdString(u) + ",1," + "\"" + QString::fromStdString(w) + "\"" + ")";
}
dp << lua_str.toStdString() << "\n";
}
dp.close();
qDebug() << "n_dlc_size:" << u_data.n_dlc;
// luapacka文件不存在则释放luapacka.exe文件
if (!_lua_packa_file.exists())
{
@ -528,6 +527,7 @@ bool xsteam_lua_to_com(UidData u_data)
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;
/*
if (_lua_file.exists())
{
_lua_file.remove();
@ -536,6 +536,7 @@ bool xsteam_lua_to_com(UidData u_data)
{
_lua_packa_file.remove();
};
*/
return true;
}
void xsteam_run_steam_steamtools(RUN_MODE _mode)

View File

@ -34,7 +34,7 @@ extern void xsteam_vdf_edit(vdf::object obj,std::map<std::string,std::string>,VD
extern void xsteam_vdf_delete(QString d_string,...);
extern void xsteam_run_steam_steamtools(RUN_MODE);
extern bool xsteam_lua_to_com(UidData u_data);
extern bool xsteam_curl_steam_id_app_info(std::string uid, UidData& u_data);
extern bool xsteam_curl_steam_id_app_info(UidData& u_data);
extern void xsteam_vdf_free_dir_file(UidData u_data);
extern void xsteam_delete_uid_st(std::string uid);
@ -44,7 +44,7 @@ extern bool xsteam_uid_exists(std::string);
extern bool xsteam_steam_steamtools_exists(bool&,bool&);
extern void xsteam_save_data_read();
extern void xsteam_data_unserialize();
extern void xsteam_save_data_write();
extern json xsteam_data_serialize(json);

View File

@ -9,16 +9,18 @@ xsteam_git_fetch::~xsteam_git_fetch()
}
void xsteam_git_fetch::free_git_fetch()
{
if(x_git!=nullptr){
if (x_git != nullptr)
{
delete x_git;
x_git = nullptr;
x_git = nullptr;
}
if(x_curl!=nullptr){
if (x_curl != nullptr)
{
delete x_curl;
x_curl = nullptr;
x_curl = nullptr;
}
}
void xsteam_git_fetch::fecth_uid_to_steam(InputData& i_data,UidData& u_data)
void xsteam_git_fetch::fecth_uid_to_steam(UidData &u_data)
{
x_git = new xsteam_git();
x_curl = new xsteam_curl();
@ -34,21 +36,25 @@ void xsteam_git_fetch::fecth_uid_to_steam(InputData& i_data,UidData& u_data)
}
}
*/
emit signal_fetch_return_msg("连接Steam API获取uid对应游戏信息...");
if (!xsteam_curl_steam_id_app_info(i_data.t_g_uid, u_data))
if (u_data.name=="")
{
emit signal_fetch_return_msg("连接Steam API获取游戏信息失败");
free_git_fetch();
return;
}
else
{
emit signal_fetch_return_msg("通过Steam API获取游戏信息完毕!");
emit signal_fetch_return_msg("连接Steam API获取uid对应游戏信息...");
if (!xsteam_curl_steam_id_app_info(u_data))
{
emit signal_fetch_return_msg("连接Steam API获取游戏信息失败");
free_git_fetch();
return;
}
else
{
emit signal_fetch_return_msg("通过Steam API获取游戏信息完毕!");
}
}
emit signal_fetch_return_msg("正在uid对应文件清单...");
// fetch remote library data
x_git->branch_or_tags_set_opts(i_data.t_g_uid, i_data.t_s_name);
x_git->branch_or_tags_set_opts(u_data.uid, u_data.s_name);
if (!x_git->branch_or_tags_clone_ext(u_data))
{
emit signal_fetch_return_msg("拉取uid对应文件清单失败!");
@ -56,9 +62,9 @@ void xsteam_git_fetch::fecth_uid_to_steam(InputData& i_data,UidData& u_data)
return;
}
// vdf dir & vdf file path
QString vdf_dir = ex_base_exe_ex + QString::fromStdString(i_data.t_g_uid);
QString vdf_dir = ex_base_exe_ex + QString::fromStdString(u_data.uid);
QString vdf_key_file = vdf_dir + "/Key.vdf";
QString vdf_config_file = QString::fromStdString(_data.x_config.steam_dir) + "/config/config.vdf";
QString vdf_config_file = QString::fromStdString(_data.x_config.steam_dir) + "/config/config.vdf";
// check fetch dir exists
if (!QDir(vdf_dir).exists())
{
@ -102,10 +108,11 @@ void xsteam_git_fetch::fecth_uid_to_steam(InputData& i_data,UidData& u_data)
}
// download game ico
emit signal_fetch_return_msg("正在下载游戏ico图标...");
if(x_curl->get_steam_header_ico(_data.x_config.steam_logo_url,u_data.uid)){
if (x_curl->get_steam_header_ico(_data.x_config.steam_logo_url, u_data.uid))
{
free_git_fetch();
}
u_data.ico = u_data.uid+".png";
u_data.ico = u_data.uid + ".png";
// lua to luapaker .st to steamtools dir
emit signal_fetch_return_msg("生成游戏入库lua脚本...");
if (xsteam_lua_to_com(u_data))
@ -116,14 +123,15 @@ void xsteam_git_fetch::fecth_uid_to_steam(InputData& i_data,UidData& u_data)
// key写入config.vdf文件
emit signal_fetch_return_msg("写入key到steam的config.vdf...");
xsteam_vdf_write(vdf_config_file, vdf_data);
u_data.i_time= (QDateTime::currentDateTime().toString("yyyy.MM.dd hh:mm:ss")).toStdString();
u_data.i_time = (QDateTime::currentDateTime().toString("yyyy.MM.dd hh:mm:ss")).toStdString();
}
/*
if (QDir(vdf_dir).exists())
{
QDir(vdf_dir).removeRecursively();
}
*/
free_git_fetch();
emit signal_fetch_return_msg(u_data.uid+"入库完毕!");
emit signal_fetch_return_data(u_data);
return;
}

View File

@ -11,7 +11,7 @@ class xsteam_git_fetch : public QObject
public:
explicit xsteam_git_fetch(QObject *parent = nullptr);
~xsteam_git_fetch();
void fecth_uid_to_steam(InputData& i_data,UidData& _uid_data);
void fecth_uid_to_steam(UidData& _uid_data);
private:
void free_git_fetch();
xsteam_git *x_git;

View File

@ -188,7 +188,8 @@ void xsteam_ui::xsteam_init_connect()
connect(btn_run_steamtools, SIGNAL(clicked()), this, SLOT(slots_run_steam_steamtools()));
connect(btn_xs_about, SIGNAL(clicked()), this, SLOT(slots_open_about()));
connect(btn_fetch_src_data, SIGNAL(clicked()), this, SLOT(slots_fetch_src_data()));
connect(btn_uid_push, SIGNAL(clicked()), this, SLOT(slots_imput_uid_push()));
connect(btn_uid_push, SIGNAL(clicked()), this, SLOT(slots_imput_update_uid_push()));
connect(btn_uid_update, SIGNAL(clicked()), this, SLOT(slots_imput_update_uid_push()));
connect(btn_run_steamdb, SIGNAL(clicked()), this, SLOT(slots_open_steamdb()));
connect(this, SIGNAL(signals_src_combobox_update()), this, SLOT(slots_server_combobox_load_data()));
connect(xs_git_fetch, SIGNAL(signal_fetch_return_msg(std::string)), this, SLOT(slots_msg_text(std::string)));
@ -202,13 +203,15 @@ void xsteam_ui::xsteam_init_connect()
void xsteam_ui::slots_get_uid_dlcs()
{
UidData uid_data;
uid_data.uid = ip_uid_edit->text().toStdString();
uid_data.s_name = server_txt->currentText().toStdString();
slots_msg_text("获取DLC信息...");
ip_all_dlc_table->item_clear();
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))
if (xsteam_curl_steam_id_app_info(uid_data))
{
ip_all_dlc_table->item_append(uid_data, VIEW_MODE::ALL_DLC_INFO);
xs_data = uid_data;
@ -219,7 +222,7 @@ void xsteam_ui::slots_get_uid_dlcs()
{
slots_msg_text("获取DLC信息失败!请检查UID是否正确&网络是否畅通");
slots_disable_enable_function(true);
}},uid_data);
} }, uid_data);
}
void xsteam_ui::slots_rightMenu(const QPoint &pos)
{
@ -254,13 +257,13 @@ void xsteam_ui::slots_rightMenu(const QPoint &pos)
{
// 创建菜单对象
QMenu *m_menu = new QMenu(this);
QAction *delete_task = new QAction(tr("增加DLC"), this);
delete_task->setData(1);
delete_task->setObjectName(signalSrc->objectName());
QAction *add_task = new QAction(tr("增加DLC"), this);
add_task->setData(1);
add_task->setObjectName(signalSrc->objectName());
// 把QAction对象添加到菜单上
m_menu->addAction(delete_task);
m_menu->addAction(add_task);
// 连接鼠标右键点击信号
connect(delete_task, SIGNAL(triggered()), this, SLOT(slots_in_dlc_add()));
connect(add_task, SIGNAL(triggered()), this, SLOT(slots_in_dlc_add()));
// 在鼠标右键点击的地方显示菜单
m_menu->exec(QCursor::pos());
QList<QAction *> list = m_menu->actions();
@ -306,20 +309,7 @@ void xsteam_ui::slots_in_dlc_delete()
modessl->removeRow(curRow);
ip_in_dlc_table->setModel(modessl);
xs_data.n_dlc.erase(std::remove(xs_data.n_dlc.begin(), xs_data.n_dlc.end(), dlc_id), xs_data.n_dlc.end());
for (auto &data : _data.u_data)
{
if (data.uid == ip_uid_edit->text().toStdString())
{
for (auto &dlc : data.n_dlc)
{
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() + "成功!");
}
}
void xsteam_ui::slots_in_dlc_add()
@ -332,14 +322,7 @@ void xsteam_ui::slots_in_dlc_add()
QString dlc_id = modessl->data(indextemp).value<QString>();
xs_data.n_dlc.push_back(dlc_id.toStdString());
ip_in_dlc_table->item_append(xs_data, VIEW_MODE::IN_DLC_INFO);
for (auto &x_dlc : _data.u_data)
{
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() + "成功!");
}
}
void xsteam_ui::slots_delete_uid_st()
@ -385,18 +368,25 @@ void xsteam_ui::slots_selection_row(const QItemSelection &current, const QItemSe
QModelIndex index = indexes.first();
QAbstractItemModel *model = ip_uid_table->model();
std::string uid = (model->data(model->index(index.row(), 1)).value<QString>()).toStdString();
UidData u_data;
for (auto x : _data.u_data)
{
if (x.uid == uid)
{
u_data = x;
xs_data = x;
break;
}
}
ip_uid_edit->setText(QString::fromStdString(u_data.uid));
ip_all_dlc_table->item_append(u_data, VIEW_MODE::ALL_DLC_INFO);
ip_in_dlc_table->item_append(u_data, VIEW_MODE::IN_DLC_INFO);
for (int i = 0; i < server_txt->count(); ++i)
{
std::string item_str = server_txt->itemText(i).toStdString();
if(xs_data.s_name==item_str){
server_txt->setCurrentIndex(i);
break;
}
}
ip_uid_edit->setText(QString::fromStdString(xs_data.uid));
ip_all_dlc_table->item_append(xs_data, VIEW_MODE::ALL_DLC_INFO);
ip_in_dlc_table->item_append(xs_data, VIEW_MODE::IN_DLC_INFO);
}
}
@ -418,6 +408,8 @@ void xsteam_ui::slots_disable_enable_function(bool state)
btn_uid_push->setEnabled(state);
btn_run_steam->setEnabled(state);
btn_run_steamtools->setEnabled(state);
btn_uid_update->setEnabled(state);
btn_dlc_push->setEnabled(state);
}
void xsteam_ui::slots_server_combobox_load_data()
{
@ -472,30 +464,38 @@ void xsteam_ui::slots_open_about()
}
void xsteam_ui::slots_table_append(UidData u_data)
{
// 增加条目到游戏表格
ip_uid_table->item_append(u_data, VIEW_MODE::UID_INFO);
// 清空状态显示
slots_msg_text("");
// 增加到全局变量内
_data.u_data.push_back(u_data);
// 写入data.json->保存功能
if (xs_state == PUSH_MODE::PUSH_ADD)
{
// 增加条目到游戏表格
ip_uid_table->item_append(u_data, VIEW_MODE::UID_INFO);
// 清空状态显示
slots_msg_text(u_data.uid + "入库完毕!");
// 增加到全局变量内
_data.u_data.push_back(u_data);
// 写入data.json->保存功能
}
else if (xs_state == PUSH_MODE::PUSH_UPDATE)
{
for (auto &x : _data.u_data)
{
if (x.uid == u_data.uid)
{
x = u_data;
break;
}
}
slots_msg_text(u_data.uid + "更新完毕!");
}
QFuture<void> future = QtConcurrent::run([=]()
{ xsteam_save_data_write(); });
}
void xsteam_ui::slots_imput_uid_push()
void xsteam_ui::slots_imput_update_uid_push()
{
in_data = {};
bool steam_ok = false;
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() == "")
{
slots_msg_text("入库UID不能为空");
}
if (xsteam_uid_exists(in_data.t_g_uid))
{
slots_msg_text("当前游戏已入库!请勿反复入库");
return;
}
if (!xsteam_steam_steamtools_exists(steam_ok, steamtools_ok))
@ -503,14 +503,32 @@ void xsteam_ui::slots_imput_uid_push()
slots_msg_text("请检查steam和steamtools路径");
return;
}
if (!xsteam_src_data_exists(in_data.t_s_name))
if (!xsteam_src_data_exists(server_txt->currentText().toStdString()))
{
slots_msg_text("请先拉取源服务器清单列表到本地");
return;
}
slots_disable_enable_function(false);
QFuture<void> future = QtConcurrent::run([=](InputData i_data, UidData u_data)
{
xs_git_fetch->fecth_uid_to_steam(in_data, xs_data);
slots_disable_enable_function(true); }, in_data, xs_data);
if (sender()->objectName() == "INPUT")
{
if (xsteam_uid_exists(ip_uid_edit->text().toStdString()))
{
slots_msg_text("当前游戏已入库!请勿反复入库");
return;
}
xs_state = PUSH_MODE::PUSH_ADD;
}
else
{
xs_state = PUSH_MODE::PUSH_UPDATE;
}
slots_imput_uid_push();
}
void xsteam_ui::slots_imput_uid_push()
{
xs_data.s_name = server_txt->currentText().toStdString();
slots_disable_enable_function(false);
QFuture<void> future = QtConcurrent::run([=](UidData u_data)
{
xs_git_fetch->fecth_uid_to_steam(xs_data);
slots_disable_enable_function(true); }, xs_data);
}

View File

@ -81,8 +81,8 @@ private:
xsteam_git_fetch* xs_git_fetch;
QSpacerItem * sparcer_item = new QSpacerItem(0,0,QSizePolicy::Expanding,QSizePolicy::Fixed);
InputData in_data;
UidData xs_data;
PUSH_MODE xs_state;
private slots:
void slots_open_server_edit();
void slots_open_setting();
@ -102,6 +102,7 @@ private slots:
void slots_get_uid_dlcs();
void slots_in_dlc_delete();
void slots_in_dlc_add();
void slots_imput_update_uid_push();
signals:
void signals_src_combobox_update();
};

View File

@ -49,6 +49,7 @@ void xsteam_view::item_append(UidData& data, VIEW_MODE mode)
rows.push_back(new QStandardItem(QString::fromStdString(data.name)));
rows.push_back(new QStandardItem(QString::fromStdString(data.m_time)));
rows.push_back(new QStandardItem(QString::fromStdString(data.i_time)));
rows.push_back(new QStandardItem(QString::fromStdString(data.s_name)));
for (auto row : rows)
{
row->setTextAlignment(Qt::AlignCenter);