Compare commits

...

10 Commits

Author SHA1 Message Date
c7b6c87d61 调整ico图片为jpg,使得更加直观 2024-10-18 11:51:21 +08:00
c5213e6804 增加提示功能 2024-10-17 19:56:23 +08:00
017edb3018 增加变量环境版本 2024-10-17 18:53:10 +08:00
f8cd167769 1-数据源模式修改为下拉菜单选择 2024-10-17 15:07:08 +08:00
e097174bb9 修复luapacka.exe删除失败问题 2024-10-17 14:05:49 +08:00
77ae838f0a 调整UI,调整编译EXE 2024-10-15 18:50:14 +08:00
c2abae6119 1-修复删除入库信息BUG问题
2-修复源删除BUG
2024-10-15 18:39:14 +08:00
6c8b430f77 增加入库源信息
增加更新功能
调整拉取信息参数
调整读取本地json函数名
删除curl全局初始化函数
2024-10-15 11:05:44 +08:00
6b9bb016c8 修复全DLC列表错误问题
修复文本描述错误问题
增加默认测试列表,并非单个
2024-10-14 18:13:16 +08:00
0b55dfd546 1-全部表单选
2-取消默认入库UID
3-对DLC信息进行增加
2024-10-14 13:38:50 +08:00
27 changed files with 555 additions and 287 deletions

View File

@ -108,7 +108,9 @@
"shared_mutex": "cpp",
"qgroupbox": "cpp",
"qheaderview": "cpp",
"qabstractlistmodel": "cpp"
"qabstractlistmodel": "cpp",
"qtconcurrentrun": "cpp",
"*.in": "cpp"
},
"Codegeex.RepoIndex": true
}

View File

@ -44,8 +44,7 @@ endif()
#QT .cmake
#QT
SET(QT_DIR "D:/Dev/Qt/6.8.0/mingw1310_static_x64/lib/cmake")
#Msys2
#SET(QT_DIR "D:/Dev/msys64/mingw64/qt6-static/lib/cmake")
SET(JSON ${PROJECT_SOURCE_DIR}/3rdparty/json)
LIST(APPEND CMAKE_PREFIX_PATH ${QT_DIR} ${MSYS})
@ -151,11 +150,25 @@ SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS} -fstack-check")
#
target_link_options(${PROJECT_NAME} PUBLIC -Wl,--allow-multiple-definition)
#
#SET(CMAKE_EXE_LINKER_FLAGS -static)
#set_property(TARGET harfbuzz::harfbuzz PROPERTY
# IMPORTED_IMPLIB "D:/Dev/msys64/mingw64/lib/libharfbuzz.dll.a" )
# GCC
message(STATUS "G++ version: ${CMAKE_CXX_COMPILER_VERSION}")
# CMAKE_
foreach(var IN LISTS CMAKE_VARIABLES)
if(var MATCHES "^CMAKE_")
message(STATUS "${var} = ${${var}}")
endif()
endforeach()
# Qt
SET(QT_VERSION_STR "${Qt6_VERSION}")
# Qt
message(STATUS "Qt Version: ${QT_VERSION_STR}")
#
configure_file (version.h.in version.h @ONLY)
#
SET(CMAKE_EXE_LINKER_FLAGS -static)
target_link_libraries(
${PROJECT_NAME} PRIVATE Qt6::Core Qt6::Gui Qt6::Widgets PkgConfig::LIBGIT2 PkgConfig::CURL
)

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

@ -32,6 +32,26 @@ QGroupBox#GAME_INFO_GROUP,QGroupBox#ALL_DLC_GROUP{
QTableView#GAME_INFO_TABLE::item:selected {
background-color: #0078d4;
}
QMenu {
background-color: #444;
color: #fff;
border: 1px solid #666;
}
QMenu::item {
padding: 2px 20px 2px 20px;
}
QMenu::icon:checked {
background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:1 #fff, stop:0 #aaa);
}
QMenu::item:selected {
background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:1 #ffc, stop:0 #9c9);
color: black;
}
/*------------------标题栏样式 最小化 最大化 关闭---------------------*/
/*标题栏变量参数值定义*/
/*标题栏背景*/
@ -75,6 +95,6 @@ QPushButton#min_button:hover,QPushButton#max_button:hover,QPushButton#close_butt
}
QPushButton#min_button:pressed,QPushButton#max_button:pressed,QPushButton#close_button:pressed{
padding-left:2px;
padding-top:2px;
padding-left:1px;
padding-top:1px;
}

View File

@ -1,3 +1,7 @@
QWidget#m_widget{
background-color: #F3F3F3;
color:#2F4F4F;
}
QWidget#m_widget{
border-radius:10px;
background-color: #F3F3F3;
@ -34,6 +38,7 @@ QGroupBox#GAME_INFO_GROUP,QGroupBox#ALL_DLC_GROUP{
QTableView#GAME_INFO_TABLE::item:selected {
background-color: #0078d4;
}
/*------------------标题栏样式 最小化 最大化 关闭---------------------*/
/*标题栏变量参数值定义*/
/*标题栏背景*/
@ -77,6 +82,6 @@ QPushButton#min_button:hover,QPushButton#max_button:hover,QPushButton#close_butt
}
QPushButton#min_button:pressed,QPushButton#max_button:pressed,QPushButton#close_button:pressed{
padding-left:2px;
padding-top:2px;
padding-left:1px;
padding-top:1px;
}

View File

@ -1,10 +1,4 @@
 About XSteam
software name:XSteam
builder:JackLee_CN
github:vek-zvo
src github(don't open)
作者申明
 作者申明
本软件仅供学习和研究,软件内置数据仅限于测试.
开发者不对本软件所造成的计算机软件侵权法律问题承担任何法律责任.
禁止本软件源码和软件用于任何商业用途.
@ -14,5 +8,9 @@ src github(don't open)
鸣谢列表
皓月代码托管平台
倒卖商用举报黑名单
About XSteam
software name:XSteam
builder:JackLee_CN
github:vek-zvo
src github(don't open)

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(800, 600);
resize(800, 600);
setLayout(m_layout);
}

View File

@ -32,6 +32,12 @@ void xsteam_about_ui::load_about()
QByteArray line = file.readLine();
strs.append(QString::fromStdString(line.data()));
}
strs.append(QString::fromStdString("编译环境")+"\n");
strs.append("qt_version:"+QString::fromStdString(QT_VERSION_STR)+"\n");
strs.append("gcc_version:"+QString::fromStdString(GCC_GXX_VERSION_STR)+"\n");
strs.append("g++_version:"+QString::fromStdString(GCC_GXX_VERSION_STR)+"\n");
strs.append("libcurl_version:"+QString::fromStdString(LIBCURL_VERSION_STR)+"\n");
strs.append("libgit2_version:"+QString::fromStdString(LIBGIT2_VERSION_STR)+"\n");
info->setPlainText(strs);
}
}

View File

@ -9,6 +9,7 @@
#include <QFile>
#include <QIODevice>
#include <QLabel>
#include <version.h>
class xsteam_about_ui :public QDialog{
Q_OBJECT
@ -34,14 +35,14 @@ private:
const xsteam_about_ui &operator=(const xsteam_about_ui &other);
static xsteam_about_ui* _instance;
static QMutex mutex;
QVBoxLayout* m_Layout=nullptr;
QHBoxLayout* f_Layout=nullptr;
QTextEdit* info=nullptr;
QVBoxLayout* m_Layout={};
QHBoxLayout* f_Layout={};
QTextEdit* info={};
void load_about();
QLabel* copyright_tips_txt;
QSpacerItem * sparcer_item = new QSpacerItem(0,0,QSizePolicy::Expanding,QSizePolicy::Fixed);
};
xsteam_about_ui *xsteam_about_ui::_instance = nullptr;
xsteam_about_ui *xsteam_about_ui::_instance = {};
QMutex xsteam_about_ui::mutex;
#endif

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
{
@ -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

@ -9,14 +9,26 @@ QString ex_base_exe_ex;
QString ex_save_path;
QString ex_save_path_ex;
QStringList ex_src_table_head_tips = {QStringLiteral("Src Name"), QStringLiteral("Git Mode"), QStringLiteral("Url")};
QStringList ex_src_table_head_tips = {QStringLiteral("源名称"), QStringLiteral("GIT模式"), QStringLiteral("地址")};
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")};
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

@ -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;
@ -83,12 +82,11 @@ bool xsteam_curl::get_steam_header_ico(std::string logo_url,std::string _c_uid)
{
std::string base_str=QDir::currentPath().toStdString();
QDir dir(QString::fromStdString(base_str + "/save/img"));
std::string u_str = logo_url + _c_uid + "/logo.png";
std::string s_str = base_str + "/save/img/" + _c_uid + ".png";
std::string u_str = logo_url + _c_uid + "/header.jpg";
std::string s_str = base_str + "/save/img/" + _c_uid + ".jpg";
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)
{
// 游戏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));
}
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目录下的文件名
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())
{
@ -255,6 +242,10 @@ bool xsteam_curl_steam_id_app_info(std::string uid, UidData &u_data)
{
if (data.key() == "dlc")
{
if (data.value().size() > 0)
{
u_data.r_dlc.clear();
for (auto x : data.value())
{
u_data.r_dlc.push_back(x.dump());
@ -263,6 +254,7 @@ bool xsteam_curl_steam_id_app_info(std::string uid, UidData &u_data)
}
}
}
}
if (u_data.name != "")
{
//_data.u_data.push_back(u_data);
@ -271,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())
@ -322,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>>();
@ -359,11 +353,15 @@ void xsteam_save_data_read()
{
// 当本地保存数据文件不存在或者读取data.json文件出错或者导致用户修改配置使得读取data.json出错.
// 默认测试数据源
for (int i = 0; i <= ex_default_src_name.count() - 1; i++)
{
SrcData _src_data;
_src_data.src_name = "FastGitHud";
_src_data.src_url = "https://githubfast.com/ManifestHub/ManifestHub.git";
_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;
@ -404,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)
{
@ -470,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)
{
if (std::to_string((std::stoi(x) + 1)) == u)
{
// 增加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 &[u, w] : u_data.uid_key)
for (auto &[uid, key] : u_data.uid_key)
{
qDebug() << "u:" << QString::fromStdString(u) << "w:" << QString::fromStdString(w);
if (std::to_string((std::stoi(u_data.uid) + 1)) == u)
if (std::to_string((std::stoi(u_data.uid) + 1)) == uid)
{
// 增加游戏本体的uid和key
lua_str = "addappid(" + QString::fromStdString(u) + ",1," + "\"" + QString::fromStdString(w) + "\"" + ")";
lua_str = "addappid(" + QString::fromStdString(uid) + ",1," + "\"" + QString::fromStdString(key) + "\"" + ")";
dp << lua_str.toStdString() << "\n";
qDebug() << "UID_KEY:" << lua_str.toStdString();
}
else
}
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和key
lua_str = "addappid(" + QString::fromStdString(u) + ",1," + "\"" + QString::fromStdString(w) + "\"" + ")";
}
lua_str = "addappid(" + QString::fromStdString(uid) + ",1," + "\"" + QString::fromStdString(key) + "\"" + ")";
dp << lua_str.toStdString() << "\n";
qDebug() << "DLC_KEY:" << lua_str.toStdString();
}
}
}
dp.close();
qDebug() << "n_dlc_size:" << u_data.n_dlc;
// luapacka文件不存在则释放luapacka.exe文件
if (!_lua_packa_file.exists())
{
@ -526,6 +533,7 @@ bool xsteam_lua_to_com(UidData u_data)
};
if (_lua_packa_file.exists())
{
QFile::setPermissions(lua_packa_file,QFile::ReadOther | QFile::WriteOther);
_lua_packa_file.remove();
};
return true;
@ -592,23 +600,26 @@ bool xsteam_steam_steamtools_exists(bool &steam_ok, bool &steamtools_ok)
}
void xsteam_delete_uid_st(std::string uid)
{
for (auto it = _data.u_data.begin(); it != _data.u_data.end();)
for (auto it = _data.u_data.begin(); it != _data.u_data.end(); ++it)
{
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()){
if (st.exists())
{
st.remove();
}
_data.u_data.erase(it);
xsteam_save_data_write();
break;
}
}
}
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

@ -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

@ -32,8 +32,8 @@ private:
void free_git_ext();
void error_git_ext(int error, QString str);
git_repository *repo = nullptr;
git_remote *remote = nullptr;
git_repository *repo = {};
git_remote *remote = {};
std::string src_name;
std::string branch_target_name;
std::string tag_target_name;

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;
}
if(x_curl!=nullptr){
if (x_curl != nullptr)
{
delete x_curl;
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,8 +36,10 @@ void xsteam_git_fetch::fecth_uid_to_steam(InputData& i_data,UidData& u_data)
}
}
*/
if (u_data.name=="")
{
emit signal_fetch_return_msg("连接Steam API获取uid对应游戏信息...");
if (!xsteam_curl_steam_id_app_info(i_data.t_g_uid, u_data))
if (!xsteam_curl_steam_id_app_info(u_data))
{
emit signal_fetch_return_msg("连接Steam API获取游戏信息失败");
free_git_fetch();
@ -45,10 +49,12 @@ void xsteam_git_fetch::fecth_uid_to_steam(InputData& i_data,UidData& u_data)
{
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,7 +62,7 @@ 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";
// check fetch 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 + ".jpg";
// lua to luapaker .st to steamtools dir
emit signal_fetch_return_msg("生成游戏入库lua脚本...");
if (xsteam_lua_to_com(u_data))
@ -123,7 +130,6 @@ void xsteam_git_fetch::fecth_uid_to_steam(InputData& i_data,UidData& u_data)
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

@ -10,10 +10,11 @@ xsteam_set_ui::~xsteam_set_ui()
}
void xsteam_set_ui::init_set()
{
setWindowTitle(tr("XSteam Options"));
setWindowTitle(tr("XSteam设置"));
main_layout = new QVBoxLayout;
foot_layout = new QHBoxLayout;
body_layout = new QVBoxLayout;
src_group=new QGroupBox(tr("设置参数"));
steam_layout=new QHBoxLayout;
steam_path_str=new QLabel(tr("Steam路径设置:"));
@ -32,7 +33,7 @@ void xsteam_set_ui::init_set()
steamtools_layout->addWidget(steamtools_path_btn);
steamtools_st_layout=new QHBoxLayout;
steamtools_st_path_str=new QLabel(tr("SteamTools .st路径设置:"));
steamtools_st_path_str=new QLabel(tr("SteamTools .st路径设置(不建议修改):"));
steamtools_st_path_edit=new QLineEdit();
steamtools_st_path_btn=new QPushButton(tr("浏览"));
steamtools_st_layout->addWidget(steamtools_st_path_str);
@ -41,15 +42,15 @@ void xsteam_set_ui::init_set()
steam_api_layout=new QHBoxLayout;
steaminfo_api_path_str=new QLabel(tr("Steam Info Api Url:"));
steaminfo_api_path_edit=new QLineEdit(tr("不建议修改"));
steaminfo_api_path_str=new QLabel(tr("Steam Info Api Url(不建议修改):"));
steaminfo_api_path_edit=new QLineEdit();
steam_api_layout->addWidget(steaminfo_api_path_str);
steam_api_layout->addWidget(steaminfo_api_path_edit);
steam_head_api_layout=new QHBoxLayout;
steaminfo_head_path_str=new QLabel(tr("Steam Logo Api Url:"));
steaminfo_head_path_edit=new QLineEdit(tr("不建议修改"));
steaminfo_head_path_str=new QLabel(tr("Steam Logo Api Url(不建议修改):"));
steaminfo_head_path_edit=new QLineEdit();
steam_head_api_layout->addWidget(steaminfo_head_path_str);
steam_head_api_layout->addWidget(steaminfo_head_path_edit);
@ -59,13 +60,14 @@ void xsteam_set_ui::init_set()
body_layout->addLayout(steam_api_layout);
body_layout->addLayout(steam_head_api_layout);
body_layout->addWidget(new QWidget());
src_group->setLayout(body_layout);
_pSaveData = new QPushButton(tr("保存"));
foot_layout->addSpacerItem(sparcer_item);
foot_layout->addWidget(_pSaveData);
foot_layout->addSpacerItem(sparcer_item);
main_layout->addLayout(body_layout);
main_layout->addWidget(src_group);
main_layout->addLayout(foot_layout);
main_layout->setStretch(0, 8);
main_layout->setStretch(1, 2);

View File

@ -9,6 +9,7 @@
#include <QTableView>
#include <QTableWidgetItem>
#include <QVBoxLayout>
#include <QGroupBox>
#include <QHBoxLayout>
#include <QPushButton>
#include <QLabel>
@ -44,7 +45,9 @@ private:
QVBoxLayout* body_layout;
QHBoxLayout* foot_layout;
QPushButton* _pSaveData=nullptr;
QGroupBox* src_group;
QPushButton* _pSaveData={};
QSpacerItem * sparcer_item = new QSpacerItem(0,0,QSizePolicy::Expanding,QSizePolicy::Fixed);
QHBoxLayout* steam_layout;
@ -75,6 +78,6 @@ private slots:
//void clicked_rightMenu(const QPoint &pos); //右键信号槽函数
void slotsSaveDone();
};
xsteam_set_ui *xsteam_set_ui::_instance = nullptr;
xsteam_set_ui *xsteam_set_ui::_instance = {};
QMutex xsteam_set_ui::mutex;
#endif

View File

@ -18,8 +18,8 @@ void xsteam_src_edit_ui::init_table_view_style()
m_Table->setWordWrap(false);
m_Table->setHorizontalScrollMode(QAbstractItemView::ScrollPerPixel);
m_Table->setVerticalScrollMode(QAbstractItemView::ScrollPerPixel);
m_Table->horizontalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents);
m_Table->setShowGrid(false);
m_Table->setAlternatingRowColors(true);
m_Table->setFrameShape(QFrame::NoFrame);
m_Table->horizontalHeader()->setStretchLastSection(true);
m_Table->setColumnWidth(0, m_Table->width() / 5);
@ -27,7 +27,9 @@ void xsteam_src_edit_ui::init_table_view_style()
void xsteam_src_edit_ui::init_src_edit_ui()
{
setWindowTitle(tr("XSteam源数据编辑"));
setWindowTitle(tr("XSteam源数据"));
src_group = new QGroupBox(tr("数据源信息"));
gr_Layout = new QVBoxLayout();
main_Layout = new QVBoxLayout;
foot_Layout = new QHBoxLayout;
m_Table = new QTableView;
@ -35,16 +37,18 @@ void xsteam_src_edit_ui::init_src_edit_ui()
m_Model->setHorizontalHeaderLabels(ex_src_table_head_tips);
m_Table->setModel(m_Model);
m_Save_Data = new QPushButton(tr("保存"));
m_Update_Src_Data = new QPushButton(tr("更新源数据"));
m_Update_Src_Data = new QPushButton(tr("更新"));
foot_Layout->addSpacerItem(sparcer_Item);
foot_Layout->addWidget(m_Save_Data);
foot_Layout->addWidget(m_Update_Src_Data);
foot_Layout->addSpacerItem(sparcer_Item);
main_Layout->addWidget(m_Table);
main_Layout->addLayout(foot_Layout);
main_Layout->setStretch(0, 8);
main_Layout->setStretch(1, 2);
main_Layout->setContentsMargins(2, 2, 2, 2);
gr_Layout->addWidget(m_Table);
gr_Layout->addLayout(foot_Layout);
gr_Layout->setStretch(0, 8);
gr_Layout->setStretch(1, 2);
gr_Layout->setContentsMargins(2, 2, 2, 2);
src_group->setLayout(gr_Layout);
main_Layout->addWidget(src_group);
setLayout(main_Layout);
init_table_view_style();
connect_slots();
@ -66,17 +70,17 @@ void xsteam_src_edit_ui::load_src_data_view(std::vector<SrcData> src_data)
{
int x = i++;
m_Model->setItem(x, 0, new QStandardItem(QString::fromStdString(k.src_name)));
QString g_mode_str;
if (k.src_type == GIT_MODE::BRANCH)
QComboBox *cmb = new QComboBox();
cmb->addItems(src_type);
if (k.src_type == GIT_MODE::TAG)
{
g_mode_str = "BRANCH";
cmb->setCurrentIndex(1);
}
else
{
g_mode_str = "TAG";
cmb->setCurrentIndex(0);
}
QStandardItem *t_item = new QStandardItem(g_mode_str);
m_Model->setItem(x, 1, t_item);
m_Table->setIndexWidget(m_Model->index(x, 1), cmb);
m_Model->setItem(x, 2, new QStandardItem(QString::fromStdString(k.src_url)));
}
m_Table->setModel(m_Model);
@ -128,9 +132,18 @@ void xsteam_src_edit_ui::slots_on_task_event()
}
void xsteam_src_edit_ui::object_add_src()
{
QAbstractItemModel *modessl = m_Table->model();
modessl->insertRow(modessl->rowCount());
m_Table->setModel(modessl);
/*
m_Model->insertRow(m_Model->rowCount());
QComboBox *cmb = new QComboBox();
cmb->addItems(src_type);
m_Table->setIndexWidget(m_Model->index(4, 1), cmb);
*/
int index = m_Model->rowCount();
m_Model->setItem(index, 0, new QStandardItem(QString::fromStdString("")));
QComboBox *cmb = new QComboBox();
cmb->addItems(src_type);
m_Table->setIndexWidget(m_Model->index(index, 1), cmb);
m_Model->setItem(index, 2, new QStandardItem(QString::fromStdString("")));
}
void xsteam_src_edit_ui::object_delete_src()
{
@ -147,11 +160,17 @@ void xsteam_src_edit_ui::object_delete_src()
QAbstractItemModel *modessl = m_Table->model();
QModelIndex indextemp = modessl->index(curRow, 0);
QString _name = modessl->data(indextemp).value<QString>();
if (_name == "")
{
modessl->removeRow(curRow);
}
else
{
for (auto it = _data.s_data.begin(); it != _data.s_data.end();)
{
if (it->src_name == _name.toStdString())
{
it = _data.s_data.erase(it);
_data.s_data.erase(it);
modessl->removeRow(curRow);
m_Table->setModel(modessl);
}
@ -162,6 +181,7 @@ void xsteam_src_edit_ui::object_delete_src()
}
}
}
}
void xsteam_src_edit_ui::slots_save_done()
{
@ -173,19 +193,27 @@ void xsteam_src_edit_ui::slots_save_done()
for (int i = 0; i <= curRow - 1; i++)
{
SrcData _src_data = {};
QString dataTempA = modessl->data(modessl->index(i, 0)).value<QString>();
QString dataTempB = modessl->data(modessl->index(i, 1)).value<QString>();
QString dataTempC = modessl->data(modessl->index(i, 2)).value<QString>();
_src_data.src_name = dataTempA.toStdString();
if (dataTempB == tr("BRANCH"))
{
_src_data.src_type = GIT_MODE::BRANCH;
QString src_name = modessl->data(modessl->index(i, 0)).value<QString>();
QComboBox *cmb = (QComboBox *)m_Table->indexWidget(modessl->index(i, 1));
QString src_url = modessl->data(modessl->index(i, 2)).value<QString>();
if(src_name==""){
xsteam_msg_tip(nullptr,""+QString::number(curRow)+"行源名字不允许为空!");
return;
}
else if (dataTempB == tr("TAG"))
if(src_url==""){
xsteam_msg_tip(nullptr,""+QString::number(curRow)+"行源地址不允许为空!");
return;
}
_src_data.src_name = src_name.toStdString();
if (cmb->currentIndex() == GIT_MODE::TAG)
{
_src_data.src_type = GIT_MODE::TAG;
}
_src_data.src_url = dataTempC.toStdString();
else
{
_src_data.src_type = GIT_MODE::BRANCH;
}
_src_data.src_url = src_url.toStdString();
_data.s_data.push_back(_src_data);
}
}

View File

@ -3,7 +3,10 @@
#include <QDialog>
#include <QMutex>
#include <QGroupBox>
#include <QTableView>
#include <QComboBox>
#include <QStringList>
#include <QVBoxLayout>
#include <QHBoxLayout>
#include <QPushButton>
@ -46,12 +49,15 @@ private:
void object_add_src();
void object_delete_src();
void connect_slots();
QGroupBox* src_group;
QVBoxLayout *gr_Layout;
QVBoxLayout *main_Layout;
QHBoxLayout *foot_Layout;
QStandardItemModel *m_Model = nullptr;
QTableView *m_Table = nullptr;
QPushButton *m_Save_Data = nullptr;
QPushButton *m_Update_Src_Data = nullptr;
QStandardItemModel *m_Model = {};
QTableView *m_Table = {};
QPushButton *m_Save_Data = {};
QPushButton *m_Update_Src_Data = {};
QStringList src_type={"BRANCH","TAG"};
QSpacerItem *sparcer_Item = new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Fixed);
private slots:
void slots_rightMenu(const QPoint &pos);
@ -61,6 +67,6 @@ private slots:
signals:
void signals_update();
};
xsteam_src_edit_ui *xsteam_src_edit_ui::_instance = nullptr;
xsteam_src_edit_ui *xsteam_src_edit_ui::_instance = {};
QMutex xsteam_src_edit_ui::mutex;
#endif

View File

@ -1,11 +1,11 @@
#include "xsteam_ui.h"
xsteam_ui::xsteam_ui(QWidget *parent) : QWidget(parent),
main_layout(new QVBoxLayout),
head_layout(new QHBoxLayout),
info_layout(new QHBoxLayout),
mind_layout(new QVBoxLayout),
foot_layout(new QHBoxLayout)
{
// xsteam_init_head_layout();
xsteam_init_info_layout();
xsteam_init_mind_layout();
xsteam_init_foot_layout();
xsteam_init_style();
@ -31,20 +31,17 @@ xsteam_ui::~xsteam_ui()
}
void xsteam_ui::xsteam_init_main_layout()
{
main_layout->addLayout(head_layout);
main_layout->addLayout(mind_layout);
main_layout->addLayout(foot_layout);
setLayout(main_layout);
}
void xsteam_ui::xsteam_init_head_layout()
void xsteam_ui::xsteam_init_info_layout()
{
head_tag = new QLabel();
head_tag->setText(tr("Public Steam"));
QFont font("Microsoft YaHei", 10, 75);
head_tag->setFont(font);
head_layout->addItem(sparcer_item);
head_layout->addWidget(head_tag);
head_layout->addItem(sparcer_item);
info_layout=new QHBoxLayout();
info_txt_tag=new QLabel(tr("本工具建议配合SteamTools和Steam++使用"));
info_layout->addItem(sparcer_item);
info_layout->addWidget(info_txt_tag);
info_layout->addItem(sparcer_item);
}
void xsteam_ui::xsteam_init_mind_layout()
{
@ -79,14 +76,14 @@ void xsteam_ui::xsteam_init_mind_layout()
ip_uid_tag = new QLabel(tr("游戏UID:"));
ip_uid_tag->setObjectName("GAME_UID");
ip_uid_edit = new QLineEdit("457140");
ip_uid_edit = new QLineEdit("");
ip_uid_edit->setValidator(new QRegularExpressionValidator(QRegularExpression("[0-9]+$")));
ip_uid_edit->setMaxLength(8);
ip_layout->addWidget(ip_uid_tag);
ip_layout->addWidget(ip_uid_edit);
ip_layout->setContentsMargins(2, 2, 2, 2);
btn_dlc_push = new QPushButton(tr("获取DLC"));
btn_dlc_push = new QPushButton(tr("获取DLC列表"));
btn_dlc_push->setObjectName("SET_DLC");
ip_iu_layout = new QHBoxLayout();
@ -112,11 +109,13 @@ 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");
ip_all_dlc_table->init_view(VIEW_MODE::ALL_DLC_INFO);
ip_in_dlc_table = new xsteam_view();
ip_in_dlc_table->setObjectName("IN_DLC_TABLE");
ip_in_dlc_table->init_view(VIEW_MODE::IN_DLC_INFO);
ip_dlc_info_layout->addLayout(ip_layout);
@ -131,10 +130,11 @@ void xsteam_ui::xsteam_init_mind_layout()
ip_data_layout->addWidget(ip_uid_group);
ip_data_layout->addWidget(ip_all_dlc_group);
ip_data_layout->setStretch(0, 7);
ip_data_layout->setStretch(1, 3);
ip_data_layout->setStretch(0, 8);
ip_data_layout->setStretch(1, 2);
mind_layout->addLayout(server_layout);
mind_layout->addLayout(info_layout);
mind_layout->addLayout(ip_data_layout);
}
void xsteam_ui::xsteam_init_foot_layout()
@ -178,48 +178,151 @@ void xsteam_ui::xsteam_init_style()
void xsteam_ui::xsteam_init_connect()
{
ip_uid_table->setContextMenuPolicy(Qt::CustomContextMenu);
ip_all_dlc_table->setContextMenuPolicy(Qt::CustomContextMenu);
ip_in_dlc_table->setContextMenuPolicy(Qt::CustomContextMenu);
connect(btn_server_edit, SIGNAL(clicked()), this, SLOT(slots_open_server_edit()));
connect(btn_xs_sets, SIGNAL(clicked()), this, SLOT(slots_open_setting()));
connect(btn_run_steam, SIGNAL(clicked()), this, SLOT(slots_run_steam_steamtools()));
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)));
connect(xs_git_fetch, SIGNAL(signal_fetch_return_data(UidData)), this, SLOT(slots_table_append(UidData)));
connect(ip_uid_table->selectionModel(), SIGNAL(selectionChanged(const QItemSelection &, const QItemSelection &)), this, SLOT(slots_selection_row(const QItemSelection &, const QItemSelection &)));
connect(ip_uid_table, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(slots_rightMenu(QPoint)));
connect(ip_all_dlc_table, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(slots_rightMenu(QPoint)));
connect(ip_in_dlc_table, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(slots_rightMenu(QPoint)));
connect(btn_dlc_push, SIGNAL(clicked()), this, SLOT(slots_get_uid_dlcs()));
}
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(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)
{
QTableView *signalSrc = (QTableView *)sender(); // 获取到了发送该信号按钮的指针
QModelIndex index = signalSrc->indexAt(pos);
if (sender()->objectName() == "GAME_INFO_TABLE")
{
if (index.row() > -1)
{
// 创建菜单对象
QMenu *m_menu = new QMenu(this);
QAction *delete_task = new QAction(tr("移除入库"), this);
QAction *update_task = new QAction(tr("更新入库"), this);
delete_task->setData(1);
update_task->setData(2);
delete_task->setObjectName(signalSrc->objectName());
update_task->setObjectName(signalSrc->objectName());
// 把QAction对象添加到菜单上
m_menu->addAction(delete_task);
m_menu->addAction(update_task);
// 连接鼠标右键点击信号
connect(delete_task, SIGNAL(triggered()), this, SLOT(slots_delete_uid_st()));
connect(update_task, SIGNAL(triggered()), this, SLOT(slots_updata_uid_st()));
// 在鼠标右键点击的地方显示菜单
m_menu->exec(QCursor::pos());
QList<QAction *> list = m_menu->actions();
foreach (QAction *pAction, list)
{
delete pAction;
}
delete m_menu;
}
}
else if (sender()->objectName() == "ALL_DLC_TABLE")
{
if (index.row() > -1)
{
// 创建菜单对象
QMenu *m_menu = new QMenu(this);
QAction *add_task = new QAction(tr("增加DLC"), this);
add_task->setData(1);
add_task->setObjectName(signalSrc->objectName());
// 把QAction对象添加到菜单上
m_menu->addAction(add_task);
// 连接鼠标右键点击信号
connect(add_task, SIGNAL(triggered()), this, SLOT(slots_in_dlc_add()));
// 在鼠标右键点击的地方显示菜单
m_menu->exec(QCursor::pos());
QList<QAction *> list = m_menu->actions();
foreach (QAction *pAction, list)
{
delete pAction;
}
delete m_menu;
}
}
else if (sender()->objectName() == "IN_DLC_TABLE")
{
if (index.row() > -1)
{
// 创建菜单对象
QMenu *m_menu = new QMenu(this);
QAction *delete_task = new QAction(tr("移除DLC"), this);
delete_task->setData(1);
delete_task->setObjectName(signalSrc->objectName());
// 把QAction对象添加到菜单上
m_menu->addAction(delete_task);
// 连接鼠标右键点击信号
connect(delete_task, SIGNAL(triggered()), this, SLOT(slots_in_dlc_delete()));
// 在鼠标右键点击的地方显示菜单
m_menu->exec(QCursor::pos());
QList<QAction *> list = m_menu->actions();
foreach (QAction *pAction, list)
{
delete pAction;
}
delete m_menu;
}
}
}
void xsteam_ui::slots_in_dlc_delete()
{
int curRow = ip_in_dlc_table->currentIndex().row();
if (curRow > -1)
{
QAbstractItemModel *modessl = ip_in_dlc_table->model();
QModelIndex indextemp = modessl->index(curRow, 0);
QString dlc_id = modessl->data(indextemp).value<QString>();
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());
slots_msg_text("删除DLC:" + dlc_id.toStdString() + "成功!");
}
}
void xsteam_ui::slots_in_dlc_add()
{
int curRow = ip_all_dlc_table->currentIndex().row();
if (curRow > -1)
{
QAbstractItemModel *modessl = ip_all_dlc_table->model();
QModelIndex indextemp = modessl->index(curRow, 0);
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);
slots_msg_text("增加DLC:" + dlc_id.toStdString() + "成功!");
}
}
void xsteam_ui::slots_delete_uid_st()
{
int curRow = ip_uid_table->currentIndex().row();
@ -227,18 +330,13 @@ void xsteam_ui::slots_delete_uid_st()
{
QAbstractItemModel *modessl = ip_uid_table->model();
QModelIndex indextemp = modessl->index(curRow, 1);
QString uid = modessl->data(indextemp).value<QString>();
QString d_uid = modessl->data(indextemp).value<QString>();
modessl->removeRow(curRow);
ip_uid_table->setModel(modessl);
QFuture<void> future = QtConcurrent::run([=]()
{
xsteam_delete_uid_st(uid.toStdString());
});
QFuture<void> future = QtConcurrent::run([=](std::string _uid)
{ xsteam_delete_uid_st(_uid); }, d_uid.toStdString());
}
}
void xsteam_ui::slots_updata_uid_st()
{
}
void xsteam_ui::slots_fetch_src_data()
{
slots_msg_text("正在拉取" + server_txt->currentText().toStdString() + "数据...");
@ -265,17 +363,26 @@ 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_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);
}
}
@ -297,6 +404,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()
{
@ -314,13 +423,6 @@ void xsteam_ui::table_load_ui_data()
ip_uid_table->item_append(x, VIEW_MODE::UID_INFO);
}
}
void xsteam_ui::slots_open_server_edit()
{
xs_src_edit_ui = xsteam_src_edit_ui::Instance();
xs_src_edit_ui->setGeometry(((QWidget *)this->parent())->geometry());
connect(xs_src_edit_ui, SIGNAL(signals_update()), this, SLOT(slots_server_combobox_load_data()));
xs_src_edit_ui->exec();
}
void xsteam_ui::slots_run_steam_steamtools()
{
@ -334,42 +436,62 @@ void xsteam_ui::slots_run_steam_steamtools()
xsteam_run_steam_steamtools(RUN_MODE::STEAMTOOLS);
}
}
void xsteam_ui::slots_open_server_edit()
{
xs_src_edit_ui = xsteam_src_edit_ui::Instance();
xs_src_edit_ui->setMaximumSize(660, 580);
xs_src_edit_ui->setGeometry(((QWidget *)this->parent())->geometry());
connect(xs_src_edit_ui, SIGNAL(signals_update()), this, SLOT(slots_server_combobox_load_data()));
xs_src_edit_ui->exec();
}
void xsteam_ui::slots_open_setting()
{
xs_sets_ui = xsteam_set_ui::Instance();
xs_sets_ui->setMaximumSize(660, 580);
xs_sets_ui->setGeometry(((QWidget *)this->parent())->geometry());
xs_sets_ui->exec();
}
void xsteam_ui::slots_open_about()
{
xs_about_ui = xsteam_about_ui::Instance();
xs_about_ui->setMaximumSize(440, 580);
xs_about_ui->setGeometry(((QWidget *)this->parent())->geometry());
xs_about_ui->exec();
}
void xsteam_ui::slots_table_append(UidData u_data)
{
if (xs_state == PUSH_MODE::PUSH_ADD)
{
// 增加条目到游戏表格
ip_uid_table->item_append(u_data, VIEW_MODE::UID_INFO);
// 清空状态显示
slots_msg_text("");
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()
{
InputData i_data;
UidData u_data;
bool steam_ok = false;
bool steamtools_ok = false;
i_data.t_g_uid = ip_uid_edit->text().toStdString();
i_data.t_s_name = server_txt->currentText().toStdString();
if (xsteam_uid_exists(i_data.t_g_uid))
if (ip_uid_edit->text().toStdString() == "")
{
slots_msg_text("当前游戏已入库!请勿反复入库");
slots_msg_text("入库UID不能为空");
return;
}
if (!xsteam_steam_steamtools_exists(steam_ok, steamtools_ok))
@ -377,13 +499,32 @@ void xsteam_ui::slots_imput_uid_push()
slots_msg_text("请检查steam和steamtools路径");
return;
}
if(!xsteam_src_data_exists(i_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)
if (sender()->objectName() == "INPUT")
{
xs_git_fetch->fecth_uid_to_steam(i_data, u_data);
slots_disable_enable_function(true); }, i_data, u_data);
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

@ -16,7 +16,6 @@
#include "xsteam_about_ui.h"
#include "xsteam_view.h"
#include "xsteam_git_fetch.h"
#include <iostream>
#include <version.h>
class xsteam_ui:public QWidget{
@ -25,7 +24,7 @@ public:
xsteam_ui(QWidget* parent=nullptr);
~xsteam_ui();
void xsteam_init_main_layout();
void xsteam_init_head_layout();
void xsteam_init_info_layout();
void xsteam_init_mind_layout();
void xsteam_init_foot_layout();
void xsteam_init_style();
@ -34,10 +33,9 @@ private:
void table_load_ui_data();
private:
QVBoxLayout* main_layout;
QHBoxLayout* head_layout;
QHBoxLayout* info_layout;
QVBoxLayout* mind_layout;
QHBoxLayout* foot_layout;
QLabel* head_tag;
//托管服务器选择
QHBoxLayout* server_layout;
QLabel* server_tag;
@ -46,6 +44,8 @@ private:
QPushButton* btn_fetch_src_data;
QPushButton* btn_run_steam;
QPushButton* btn_run_steamtools;
//头部信息
QLabel* info_txt_tag;
//入库游戏信息
QHBoxLayout* ip_layout;
QHBoxLayout* ip_iu_layout;
@ -80,7 +80,9 @@ private:
xsteam_about_ui* xs_about_ui;
xsteam_git_fetch* xs_git_fetch;
QSpacerItem * sparcer_item = new QSpacerItem(0,0,QSizePolicy::Expanding,QSizePolicy::Fixed);
//connect
UidData xs_data;
PUSH_MODE xs_state;
private slots:
void slots_open_server_edit();
void slots_open_setting();
@ -96,7 +98,10 @@ private slots:
void slots_fetch_src_data();
void slots_rightMenu(const QPoint &pos);
void slots_delete_uid_st();
void slots_updata_uid_st();
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

@ -29,30 +29,33 @@ void xsteam_view::init_view(VIEW_MODE view_mode)
m_model->setColumnCount(ex_in_dlc_table_head_tips.count());
m_model->setHorizontalHeaderLabels(ex_in_dlc_table_head_tips);
}
setSelectionMode(QAbstractItemView::SingleSelection);
horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch);
setSelectionBehavior(QAbstractItemView::SelectRows);
setEditTriggers(QAbstractItemView::NoEditTriggers);
verticalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents); // 自动设置行高
setFocusPolicy(Qt::NoFocus);
verticalHeader()->hide();
setModel(m_model);
}
void xsteam_view::item_append(UidData& data, VIEW_MODE mode)
{
QList<QStandardItem *> rows;
QList<QStandardItem *> d_rows;
std::vector<std::string> dlc_uid;
if (mode == VIEW_MODE::UID_INFO)
{
rows.push_back(new QStandardItem(QString::fromStdString(data.ico)));
rows.push_back(new QStandardItem(QString::fromStdString(data.uid)));
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)));
for (auto row : rows)
d_rows.push_back(new QStandardItem(QString::fromStdString(data.ico)));
d_rows.push_back(new QStandardItem(QString::fromStdString(data.uid)));
d_rows.push_back(new QStandardItem(QString::fromStdString(data.name)));
d_rows.push_back(new QStandardItem(QString::fromStdString(data.m_time)));
d_rows.push_back(new QStandardItem(QString::fromStdString(data.i_time)));
d_rows.push_back(new QStandardItem(QString::fromStdString(data.s_name)));
for (auto d_row : d_rows)
{
row->setTextAlignment(Qt::AlignCenter);
d_row->setTextAlignment(Qt::AlignCenter);
}
m_model->appendRow(rows);
m_model->appendRow(d_rows);
}
else
{
@ -67,9 +70,9 @@ void xsteam_view::item_append(UidData& data, VIEW_MODE mode)
}
for (auto x : dlc_uid)
{
rows.clear();
rows.push_back(new QStandardItem(QString::fromStdString(x)));
m_model->appendRow(rows);
d_rows.clear();
d_rows.push_back(new QStandardItem(QString::fromStdString(x)));
m_model->appendRow(d_rows);
}
}
}

View File

@ -7,6 +7,7 @@
#include <QFile>
#include <QDir>
#include <QLabel>
#include <QComboBox>
#include <QStandardItemModel>
#include "xsteam_view_item.h"
#include "xsteam_base.h"
@ -25,7 +26,6 @@ public:
~xsteam_view();
void init_view(VIEW_MODE);
void item_append(UidData& data,VIEW_MODE mode);
private:
void item_clear();
private:
QStandardItemModel* m_model;

View File

@ -27,8 +27,7 @@ void xsteam_view_item::paint(QPainter *painter,
}
QRect rect = option.rect;
pic = pic.scaled(rect.width(), rect.height(),
Qt::KeepAspectRatio);
pic = pic.scaled(rect.width(), rect.height(),Qt::KeepAspectRatio);
int width = pic.width();
int height = pic.height();

View File

@ -7,4 +7,8 @@
#define PROJECT_MINOR_VERSION "@PROJECT_VERSION_MINOR@"
#define PROJECT_PATCH_VERSION "@PROJECT_VERSION_PATCH@"
#define QT_VERSION_STR "@QT_VERSION_STR@"
#define GCC_GXX_VERSION_STR "@CMAKE_CXX_COMPILER_VERSION@"
#define LIBCURL_VERSION_STR "@CURL_VERSION@"
#define LIBGIT2_VERSION_STR "@LIBGIT2_VERSION@"
#endif // VERSION_H