diff --git a/CMakeLists.txt b/CMakeLists.txt index 75af1e0..d145f47 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,5 @@ #cmake最低版本 -cmake_minimum_required(VERSION 3.16) +cmake_minimum_required(VERSION 3.19) set(VCPKG_ROOT "F:/SourceCode/vcpkg") set(CMAKE_TOOLCHAIN_FILE "F:/SourceCode/vcpkg/scripts/buildsystems/vcpkg.cmake") @@ -42,7 +42,10 @@ endif() MESSAGE(STATUS "----------编译模式 END---------------") #设置QT .cmake文件路径 -SET(QT_DIR "D:/Dev/Qt/6.3.2/mingw1120_static_x64_base/lib/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}) @@ -146,11 +149,13 @@ SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS} -ftrapv") #开启栈检查 SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS} -fstack-check") -#增加winpthread和gcc_s静态库 -SET(CMAKE_CXX_FLAGS "-static-libstdc++ -static-libgcc") #忽略多重定引用 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" ) target_link_libraries( ${PROJECT_NAME} PRIVATE Qt6::Core Qt6::Gui Qt6::Widgets PkgConfig::LIBGIT2 PkgConfig::CURL ) diff --git a/README.md b/README.md index bc54619..2ae8bf7 100644 --- a/README.md +++ b/README.md @@ -9,11 +9,16 @@ 2-入库游戏ID这个项目的选择用于确定steam的游戏名字对应的ID,有此ID就可以在上面数据服务器中寻找游戏的文件清单.
# Windows Mingw64 Msys2编译环境 -依赖库QT,libcurl,libgit2 -QT编译方式可静态可动态 -libcurl采用msys2静态编译,编译后安装在msys2中 -libgit2采用msys2静态编译,编译后安装在msys2中 - +依赖库QT,libcurl,libgit2
+QT编译方式可静态可动态
+libcurl采用msys2静态编译,编译后安装在msys2中
+libgit2采用msys2静态编译,编译后安装在msys2中
+想要编译出来的exe不依赖任何dll库则需要修改QT静态库下面文件
+mingw73_32_static\mkspecs\common\g++-win32.conf下增加和修改
+在g++-win32.conf文件中新增QMAKE_LFLAGS = -static
+在g++-win32.conf文件中修改QMAKE_LFLAGS_DLL = -static
+mingw73_32_static\mkspecs\common\base.conf
+在base.conf文件中新增QMAKE_LFLAGS = -static
# 完成进度 1-数据服务器增删改减√
2-一键游戏ID入库√
diff --git a/src/common.h b/src/common.h index 51183e0..1dc5e31 100644 --- a/src/common.h +++ b/src/common.h @@ -51,5 +51,4 @@ #include #include #include -#include #endif // COMMON_H diff --git a/src/sui.cpp b/src/sui.cpp index 639bdf7..0100aee 100644 --- a/src/sui.cpp +++ b/src/sui.cpp @@ -6,6 +6,8 @@ sui::sui(QWidget *parent) m_press(false), m_border_width(5) { + QFuture future = QtConcurrent::run([=]() + { xsteam_init_opts();}); init_layout(); } sui::~sui() diff --git a/src/sui_base.h b/src/sui_base.h deleted file mode 100644 index aae7c00..0000000 --- a/src/sui_base.h +++ /dev/null @@ -1,12 +0,0 @@ -#ifndef SUI_BASE_H -#define SUI_BASE_H - -#include -#include -typedef struct { - int set_font; - int set_style; -}sui_sets; - -extern sui_sets s_sets; -#endif // SUI_BASE_H \ No newline at end of file diff --git a/src/sui_title.cpp b/src/sui_title.cpp index 008f75b..c6c0c42 100644 --- a/src/sui_title.cpp +++ b/src/sui_title.cpp @@ -59,8 +59,6 @@ sui_title::sui_title(QWidget *parent) m_layout->setContentsMargins(0, 0, 0, 0); setFixedHeight(40); setLayout(m_layout); - s_sets.set_font=0; - s_sets.set_style=1; QDir *fontDir = new QDir(tr(":/res/font/")); font_table = fontDir->entryList(QDir::Files); font_table.append(QFontDatabase::applicationFontFamilies(QFontDatabase::SimplifiedChinese)); @@ -92,7 +90,7 @@ void sui_title::slots_ico_menu() QAction* s_Action=new QAction(sName,s_QGroup); s_Action->setObjectName(QString::number(i)); s_Action->setCheckable(true); - if(i==s_sets.set_style){ + if(i==_data.x_config.style){ s_Action->setChecked(true); } connect(s_Action,SIGNAL(triggered (bool)),this,SLOT(slots_set_style_change())); @@ -107,7 +105,7 @@ void sui_title::slots_ico_menu() QAction* f_Action=new QAction(font_table[i],f_QGroup); f_Action->setObjectName(QString::number(i)); f_Action->setCheckable(true); - if(i==s_sets.set_font){ + if(i==_data.x_config.font){ f_Action->setChecked(true); } connect(f_Action,SIGNAL(triggered (bool)),this,SLOT(slots_set_font_change())); @@ -123,16 +121,16 @@ void sui_title::slots_ico_menu() void sui_title::slots_set_style_change() { if(sender()!=nullptr){ - s_sets.set_style=sender()->objectName().toInt(); + _data.x_config.style=sender()->objectName().toInt(); } - change_style(s_sets.set_style); + change_style(_data.x_config.style); } void sui_title::slots_set_font_change() { if(sender()!=nullptr){ - s_sets.set_font=sender()->objectName().toInt(); + _data.x_config.font=sender()->objectName().toInt(); } - QString font=tr(":/res/font/")+font_table[s_sets.set_font]; + QString font=tr(":/res/font/")+font_table[_data.x_config.font]; int fontId = QFontDatabase::addApplicationFont(font); QStringList fontIDs = QFontDatabase::applicationFontFamilies(fontId); if (!fontIDs.isEmpty()) { @@ -143,7 +141,7 @@ void sui_title::slots_set_font_change() else { qDebug()<<"Failed to load font."; } - change_style(s_sets.set_style); + change_style(_data.x_config.style); } void sui_title::change_style(int index){ QString style=tr(":/res/qss/")+style_table[index]; diff --git a/src/sui_title.h b/src/sui_title.h index 2229c9d..fb93440 100644 --- a/src/sui_title.h +++ b/src/sui_title.h @@ -15,9 +15,7 @@ #include #include #include -#include "sui_base.h" #include "xsteam_ex.h" -sui_sets s_sets; class sui_title: public QWidget { Q_OBJECT diff --git a/src/xsteam_ex.cpp b/src/xsteam_ex.cpp index 80cdabf..fe65ea7 100644 --- a/src/xsteam_ex.cpp +++ b/src/xsteam_ex.cpp @@ -365,7 +365,7 @@ void xsteam_save_data_read() _data.s_data.push_back(_src_data); // 默认配置 _data.x_config.font = 0; - _data.x_config.style = 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(); _data.x_config.steam_api_url = "https://store.steampowered.com/api/appdetails/?appids="; diff --git a/src/xsteam_set_ui.cpp b/src/xsteam_set_ui.cpp index 5d4d76e..3659ffa 100644 --- a/src/xsteam_set_ui.cpp +++ b/src/xsteam_set_ui.cpp @@ -84,6 +84,12 @@ void xsteam_set_ui::load_data_set(){ steaminfo_head_path_edit->setText(QString::fromStdString(_data.x_config.steam_logo_url)); } void xsteam_set_ui::slotsSaveDone(){ - qInfo()<<"Done Object!"; + _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, "保存成功"); this->close(); } \ No newline at end of file diff --git a/src/xsteam_set_ui.h b/src/xsteam_set_ui.h index 9055ebb..169a8d7 100644 --- a/src/xsteam_set_ui.h +++ b/src/xsteam_set_ui.h @@ -13,6 +13,7 @@ #include #include #include "xsteam_base.h" +#include "xsteam_ex.h" class xsteam_set_ui :public QDialog{ Q_OBJECT public: diff --git a/src/xsteam_ui.cpp b/src/xsteam_ui.cpp index e779ba4..0fb45ee 100644 --- a/src/xsteam_ui.cpp +++ b/src/xsteam_ui.cpp @@ -16,7 +16,6 @@ xsteam_ui::xsteam_ui(QWidget *parent) : QWidget(parent), { bool steam_ok=false; bool steamtools_ok=false; - xsteam_init_opts(); emit signals_src_combobox_update(); slots_disable_enable_function(true); table_load_ui_data(); diff --git a/upx/upx.exe b/upx/upx.exe new file mode 100644 index 0000000..7f89f50 Binary files /dev/null and b/upx/upx.exe differ