rename:项目更名。

This commit is contained in:
taynpg 2025-02-07 10:12:12 +08:00
parent 489f4fff58
commit 74031eb1e0
10 changed files with 90 additions and 76 deletions

View File

@ -1,6 +1,6 @@
{ {
"files.autoSave": "onFocusChange", "files.autoSave": "onFocusChange",
"editor.fontSize": 13, "editor.fontSize": 14,
"editor.fontFamily": "'Source Code Pro', 'Source Code Pro', 'Source Code Pro'", "editor.fontFamily": "'Source Code Pro', 'Source Code Pro', 'Source Code Pro'",
"cmake.configureOnOpen": true, "cmake.configureOnOpen": true,
"terminal.integrated.fontFamily": "Source Code Pro", "terminal.integrated.fontFamily": "Source Code Pro",
@ -25,7 +25,7 @@
"cmake.options.statusBarVisibility": "visible", "cmake.options.statusBarVisibility": "visible",
"cmake.generator": "Ninja", "cmake.generator": "Ninja",
"C_Cpp.default.compileCommands": "${workspaceRoot}/build/compile_commands.json", "C_Cpp.default.compileCommands": "${workspaceRoot}/build/compile_commands.json",
"C_Cpp.default.cppStandard": "c++14", "C_Cpp.default.cppStandard": "c++17",
"editor.inlayHints.enabled": "off", "editor.inlayHints.enabled": "off",
"editor.unicodeHighlight.allowedLocales": { "editor.unicodeHighlight.allowedLocales": {
"ja": true, "ja": true,

View File

@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.16) cmake_minimum_required(VERSION 3.16)
project(packqt VERSION 0.1 LANGUAGES CXX) project(binpack VERSION 0.1 LANGUAGES CXX)
# HOME # HOME
if (UNIX) if (UNIX)
@ -49,41 +49,41 @@ set(PROJECT_SOURCES
adddesktop.ui adddesktop.ui
adddesktop.h adddesktop.h
adddesktop.cpp adddesktop.cpp
packqt.qrc binpack.qrc
) )
if(${QT_VERSION_MAJOR} GREATER_EQUAL 6) if(${QT_VERSION_MAJOR} GREATER_EQUAL 6)
qt_add_executable(packqt qt_add_executable(binpack
MANUAL_FINALIZATION MANUAL_FINALIZATION
${PROJECT_SOURCES} ${PROJECT_SOURCES}
) )
# Define target properties for Android with Qt 6 as: # Define target properties for Android with Qt 6 as:
# set_property(TARGET packqt APPEND PROPERTY QT_ANDROID_PACKAGE_SOURCE_DIR # set_property(TARGET binpack APPEND PROPERTY QT_ANDROID_PACKAGE_SOURCE_DIR
# ${CMAKE_CURRENT_SOURCE_DIR}/android) # ${CMAKE_CURRENT_SOURCE_DIR}/android)
# For more information, see https://doc.qt.io/qt-6/qt-add-executable.html#target-creation # For more information, see https://doc.qt.io/qt-6/qt-add-executable.html#target-creation
else() else()
if(ANDROID) if(ANDROID)
add_library(packqt SHARED add_library(binpack SHARED
${PROJECT_SOURCES} ${PROJECT_SOURCES}
) )
# Define properties for Android with Qt 5 after find_package() calls as: # Define properties for Android with Qt 5 after find_package() calls as:
# set(ANDROID_PACKAGE_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/android") # set(ANDROID_PACKAGE_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/android")
else() else()
add_executable(packqt add_executable(binpack
${PROJECT_SOURCES} ${PROJECT_SOURCES}
) )
endif() endif()
endif() endif()
target_link_libraries(packqt PRIVATE Qt${QT_VERSION_MAJOR}::Widgets ofen) target_link_libraries(binpack PRIVATE Qt${QT_VERSION_MAJOR}::Widgets ofen)
# Qt for iOS sets MACOSX_BUNDLE_GUI_IDENTIFIER automatically since Qt 6.1. # Qt for iOS sets MACOSX_BUNDLE_GUI_IDENTIFIER automatically since Qt 6.1.
# If you are developing for iOS or macOS you should consider setting an # If you are developing for iOS or macOS you should consider setting an
# explicit, fixed bundle identifier manually though. # explicit, fixed bundle identifier manually though.
if(${QT_VERSION} VERSION_LESS 6.1.0) if(${QT_VERSION} VERSION_LESS 6.1.0)
set(BUNDLE_ID_OPTION MACOSX_BUNDLE_GUI_IDENTIFIER com.example.packqt) set(BUNDLE_ID_OPTION MACOSX_BUNDLE_GUI_IDENTIFIER com.example.binpack)
endif() endif()
set_target_properties(packqt PROPERTIES set_target_properties(binpack PROPERTIES
${BUNDLE_ID_OPTION} ${BUNDLE_ID_OPTION}
MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION} MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION}
MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR} MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}
@ -92,12 +92,12 @@ set_target_properties(packqt PROPERTIES
) )
include(GNUInstallDirs) include(GNUInstallDirs)
install(TARGETS packqt install(TARGETS binpack
BUNDLE DESTINATION . BUNDLE DESTINATION .
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
) )
if(QT_VERSION_MAJOR EQUAL 6) if(QT_VERSION_MAJOR EQUAL 6)
qt_finalize_executable(packqt) qt_finalize_executable(binpack)
endif() endif()

View File

@ -10,7 +10,7 @@ using namespace ofen;
MainWidget::MainWidget(QWidget* parent) : QWidget(parent), ui(new Ui::MainWidget) MainWidget::MainWidget(QWidget* parent) : QWidget(parent), ui(new Ui::MainWidget)
{ {
ui->setupUi(this); ui->setupUi(this);
setWindowTitle("packqt v1.0.4"); setWindowTitle("binpack v1.0.5");
connect_operator(); connect_operator();
control_init(); control_init();
} }
@ -23,9 +23,8 @@ MainWidget::~MainWidget()
void MainWidget::connect_operator() void MainWidget::connect_operator()
{ {
connect(ui->btnSelcetBinary, &QPushButton::clicked, this, connect(ui->btnSelcetBinary, &QPushButton::clicked, this,
[=]() { SelectFile(this, ui->edBinary, "请选择Qt二进制文件", "所有文件 (*)"); }); [=]() { SelectFile(this, ui->edBinary, "请选择二进制文件", "所有文件 (*)"); });
connect(ui->btnSelectOut, &QPushButton::clicked, this, [=]() { SelectDirectory(this, ui->edOutDir); }); connect(ui->btnSelectOut, &QPushButton::clicked, this, [=]() { SelectDirectory(this, ui->edOutDir); });
connect(ui->btnSelectQt, &QPushButton::clicked, this, [=]() { SelectDirectory(this, ui->edQtDir); });
connect(ui->btnAddEnv, &QPushButton::clicked, this, [=]() { add_env_btn(); }); connect(ui->btnAddEnv, &QPushButton::clicked, this, [=]() { add_env_btn(); });
connect(ui->btnDelEnv, &QPushButton::clicked, this, [=]() { del_env_btn(); }); connect(ui->btnDelEnv, &QPushButton::clicked, this, [=]() { del_env_btn(); });
connect(ui->btnGenerate, &QPushButton::clicked, this, [=]() { generate(); }); connect(ui->btnGenerate, &QPushButton::clicked, this, [=]() { generate(); });
@ -36,7 +35,6 @@ void MainWidget::connect_operator()
void MainWidget::control_init() void MainWidget::control_init()
{ {
ui->plainTextEdit->setReadOnly(true); ui->plainTextEdit->setReadOnly(true);
ui->edQtDir->setText(QDir::homePath() + "/Qt5.14.2/5.14.2/gcc_64");
ui->edOutDir->setText(QDir::homePath() + "/program"); ui->edOutDir->setText(QDir::homePath() + "/program");
#if !defined(NDEBUG) #if !defined(NDEBUG)
#endif #endif
@ -249,14 +247,6 @@ void MainWidget::generate()
std::vector<std::string> dynamic_so{}; std::vector<std::string> dynamic_so{};
std::copy(result.begin(), result.end(), std::back_inserter(dynamic_so)); std::copy(result.begin(), result.end(), std::back_inserter(dynamic_so));
// 处理 platform文件夹
std::list<fs::path> platform{};
fs::path qt_platform(ui->edQtDir->text().trimmed().toStdString());
qt_platform.append("plugins/platforms");
for (const auto& entry : fs::directory_iterator(qt_platform)) {
result.push_back(entry.path().string());
}
while (!result.empty()) { while (!result.empty()) {
std::string bin = result.front(); std::string bin = result.front();
result.pop_front(); result.pop_front();
@ -283,9 +273,6 @@ void MainWidget::generate()
fs::copy_file(data, purpose, fs::copy_options::overwrite_existing); fs::copy_file(data, purpose, fs::copy_options::overwrite_existing);
} }
// 复制platform文件夹
copy_dir(qt_platform.string(), out_dir.string());
// 复制主体文件 // 复制主体文件
fs::path out_binary = fs::path(out_dir).append(fs::path(binary_.toStdString()).filename().string()); fs::path out_binary = fs::path(out_dir).append(fs::path(binary_.toStdString()).filename().string());
fs::copy_file(binary_.toStdString(), out_binary, fs::copy_options::overwrite_existing); fs::copy_file(binary_.toStdString(), out_binary, fs::copy_options::overwrite_existing);

View File

@ -6,8 +6,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>1057</width> <width>965</width>
<height>778</height> <height>591</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
@ -60,44 +60,6 @@
</item> </item>
</layout> </layout>
</item> </item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QLabel" name="label_2">
<property name="text">
<string>Qt路径(选到bin的父目录):</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<widget class="QLineEdit" name="edQtDir"/>
</item>
<item>
<widget class="QPushButton" name="btnSelectQt">
<property name="text">
<string>选择</string>
</property>
</widget>
</item>
</layout>
</item>
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout_5"> <layout class="QHBoxLayout" name="horizontalLayout_5">
<item> <item>
@ -142,7 +104,7 @@
<item> <item>
<widget class="QGroupBox" name="gboxEnv"> <widget class="QGroupBox" name="gboxEnv">
<property name="title"> <property name="title">
<string>2.LD_LIBRARY_PATH配置</string> <string>2.要搜寻的LD_LIBRARY_PATH位置</string>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_2"> <layout class="QVBoxLayout" name="verticalLayout_2">
<item> <item>

View File

@ -44,6 +44,8 @@ AddDesktop::AddDesktop(QWidget* parent) : QDialog(parent), ui(new Ui::AddDesktop
"png图标(*.png);;ico图标(*.ico);;svg图标(*.svg);;所有文件 (*)"); "png图标(*.png);;ico图标(*.ico);;svg图标(*.svg);;所有文件 (*)");
}); });
connect(ui->btnInstall, &QPushButton::clicked, this, &AddDesktop::install_to_desktop); connect(ui->btnInstall, &QPushButton::clicked, this, &AddDesktop::install_to_desktop);
connect(ui->envAdd, &QPushButton::clicked, this, &AddDesktop::add_env_btn);
connect(ui->envDel, &QPushButton::clicked, this, &AddDesktop::del_env_btn);
} }
void AddDesktop::checkchange() void AddDesktop::checkchange()
@ -132,3 +134,21 @@ AddDesktop::~AddDesktop()
{ {
delete ui; delete ui;
} }
void AddDesktop::add_env_btn()
{
QString env = MainWidget::SelectDirectory(this, nullptr);
if (env.isEmpty()) {
return;
}
ui->listWidget->addItem(env);
}
void AddDesktop::del_env_btn()
{
QListWidgetItem* item = ui->listWidget->currentItem();
if (!item) {
return;
}
delete ui->listWidget->takeItem(ui->listWidget->currentRow());
}

View File

@ -16,6 +16,10 @@ public:
explicit AddDesktop(QWidget *parent = nullptr); explicit AddDesktop(QWidget *parent = nullptr);
~AddDesktop(); ~AddDesktop();
private:
void add_env_btn();
void del_env_btn();
private: private:
void checkchange(); void checkchange();
void install_to_desktop(); void install_to_desktop();

View File

@ -6,8 +6,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>429</width> <width>485</width>
<height>259</height> <height>411</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
@ -124,6 +124,47 @@
</item> </item>
</layout> </layout>
</item> </item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_7">
<item>
<widget class="QLabel" name="label_4">
<property name="text">
<string>附加环境目录:</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_5">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="envAdd">
<property name="text">
<string>添加</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="envDel">
<property name="text">
<string>删除</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QListWidget" name="listWidget"/>
</item>
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout_6"> <layout class="QHBoxLayout" name="horizontalLayout_6">
<item> <item>

View File

@ -10,7 +10,7 @@ cd "$SCRIPT_DIR" || exit
echo "当前目录是:$SCRIPT_DIR" echo "当前目录是:$SCRIPT_DIR"
# 将脚本所在目录添加到 LD_LIBRARY_PATH 环境变量 # 将脚本所在目录添加到 LD_LIBRARY_PATH 环境变量
export LD_LIBRARY_PATH="$SCRIPT_DIR" export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:"$SCRIPT_DIR":REPLACE
# 定义 replace_string 脚本的绝对路径 # 定义 replace_string 脚本的绝对路径
REPLACE_STRING_SCRIPT="$SCRIPT_DIR/replace_string" REPLACE_STRING_SCRIPT="$SCRIPT_DIR/replace_string"