compile:编译修正。

This commit is contained in:
taynpg 2025-01-17 11:43:11 +08:00
parent e575377af3
commit 7de59dc618
7 changed files with 146 additions and 44 deletions

View File

@ -1,4 +1,4 @@
BasedOnStyle: Google
BasedOnStyle: LLVM
IndentWidth: 4
PointerAlignment: Left
AccessModifierOffset: -4
@ -8,11 +8,10 @@ BraceWrapping:
AfterClass: true
Cpp11BracedListStyle: true
ReflowComments: true
SortIncludes: Never
SpacesBeforeTrailingComments: 3
TabWidth: 4
ConstructorInitializerAllOnOneLineOrOnePerLine: true
ColumnLimit: 150
ColumnLimit: 110
AllowShortBlocksOnASingleLine: Never
AllowShortFunctionsOnASingleLine: None
AllowShortEnumsOnASingleLine: false

110
.vscode/settings.json vendored
View File

@ -1,8 +1,9 @@
{
"files.autoSave": "onFocusChange",
"editor.fontSize": 12,
"editor.fontFamily": "'FiraCode Nerd Font Mono', 'FiraCode Nerd Font Mono', 'FiraCode Nerd Font Mono'",
"editor.fontSize": 13,
"editor.fontFamily": "'Source Code Pro', 'Source Code Pro', 'Source Code Pro'",
"cmake.configureOnOpen": true,
"terminal.integrated.fontFamily": "Source Code Pro",
"cmake.debugConfig": {
"console": "integratedTerminal",
"setupCommands": [
@ -16,25 +17,112 @@
"ignoreFailures": true
}
],
"args": [
]
"visualizerFile": "${workspaceRoot}/.vscode/qt6.natvis"
},
"cmake.environment": {
"PATH": "${env:PATH};D:/library/wxWidgets/lib/vc_x64_dll",
"LD_LIBRARY_PATH": "$LD_LIBRARY_PATH:/home/lebo/library/wxWidgets/lib"
"PATH": "${env:PATH};C:/Qt/6.7.2/bin;C:/Qt/Qt5.14.2/5.14.2/msvc2017_64/bin;D:/Qt/Qt5.14.2/5.14.2/msvc2017_64/bin"
},
// "cmake.configureSettings": {
// "CMAKE_TOOLCHAIN_FILE": "${env:VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake"
// },
"cmake.options.statusBarVisibility": "visible",
"cmake.generator": "Ninja",
"C_Cpp.default.compileCommands": "${workspaceRoot}/build/compile_commands.json",
"C_Cpp.default.cppStandard": "c++17",
"C_Cpp.default.configurationProvider": "ms-vscode.cmake-tools",
"C_Cpp.default.cppStandard": "c++14",
"editor.inlayHints.enabled": "off",
"editor.unicodeHighlight.allowedLocales": {
"ja": true,
"zh-hant": true,
"zh-hans": true
},
"files.associations": {
"algorithm": "cpp",
"atomic": "cpp",
"cctype": "cpp",
"chrono": "cpp",
"cmath": "cpp",
"cstdarg": "cpp",
"cstddef": "cpp",
"cstdint": "cpp",
"cstdio": "cpp",
"cstdlib": "cpp",
"cstring": "cpp",
"ctime": "cpp",
"cwchar": "cpp",
"exception": "cpp",
"filesystem": "cpp",
"functional": "cpp",
"initializer_list": "cpp",
"iomanip": "cpp",
"ios": "cpp",
"iosfwd": "cpp",
"iostream": "cpp",
"istream": "cpp",
"iterator": "cpp",
"limits": "cpp",
"list": "cpp",
"locale": "cpp",
"map": "cpp",
"memory": "cpp",
"mutex": "cpp",
"new": "cpp",
"numeric": "cpp",
"ostream": "cpp",
"ratio": "cpp",
"stdexcept": "cpp",
"streambuf": "cpp",
"string": "cpp",
"string_view": "cpp",
"system_error": "cpp",
"thread": "cpp",
"tuple": "cpp",
"type_traits": "cpp",
"typeinfo": "cpp",
"unordered_map": "cpp",
"utility": "cpp",
"variant": "cpp",
"vector": "cpp",
"xfacet": "cpp",
"xhash": "cpp",
"xiosbase": "cpp",
"xlocale": "cpp",
"xlocbuf": "cpp",
"xlocinfo": "cpp",
"xlocmes": "cpp",
"xlocmon": "cpp",
"xlocnum": "cpp",
"xloctime": "cpp",
"xmemory": "cpp",
"xmemory0": "cpp",
"xstddef": "cpp",
"xstring": "cpp",
"xtr1common": "cpp",
"xtree": "cpp",
"xutility": "cpp",
"qtablewidget": "cpp",
"qmenu": "cpp",
"qmessagebox": "cpp",
"qaction": "cpp",
"codecvt": "cpp",
"qregexp": "cpp",
"qregularexpression": "cpp",
"array": "cpp",
"bit": "cpp",
"charconv": "cpp",
"clocale": "cpp",
"compare": "cpp",
"concepts": "cpp",
"condition_variable": "cpp",
"format": "cpp",
"forward_list": "cpp",
"future": "cpp",
"optional": "cpp",
"sstream": "cpp",
"stop_token": "cpp",
"regex": "cpp",
"*.tcc": "cpp",
"cwctype": "cpp",
"deque": "cpp",
"memory_resource": "cpp",
"random": "cpp",
"fstream": "cpp",
"cinttypes": "cpp"
}
}

View File

@ -3,16 +3,16 @@
//
#include "FunctionImp.h"
#include <wx/tokenzr.h>
#include "data.hpp"
#include <filesystem>
#include <fstream>
#include <wx/base64.h>
#include <wx/filename.h>
#include <wx/log.h>
#include <filesystem>
#include <wx/base64.h>
#include <wx/msgdlg.h>
#include <wx/textfile.h>
#include <wx/stdpaths.h>
#include "data.hpp"
#include <fstream>
#include <wx/textfile.h>
#include <wx/tokenzr.h>
namespace fs = std::filesystem;
@ -27,7 +27,7 @@ bool CFunPack::gen(const wxString& bin, const wxString& out_dir, const wxArraySt
wxArrayString CFunPack::get_depend_on(const wxString& bin, const wxArrayString& dirs)
{
filename_ = fs::path(bin).filename().wstring();
filename_ = fs::path(bin.ToStdWstring()).filename().wstring();
wxArrayString array;
wxString cmd;
@ -103,10 +103,11 @@ bool CFunPack::handle_copy(const std::list<wxString>& rets, const wxString& dest
need_copy.push_back(item.ToStdWstring());
}
dest_dir_ = fs::path(dest_dir).append(filename_.ToStdWstring()).wstring();
dest_dir_ = fs::path(dest_dir.ToStdWstring()).append(filename_.ToStdWstring()).wstring();
fs::create_directories(dest_dir_.ToStdWstring());
for (const auto& item : need_copy) {
std::wstring new_path = fs::path(dest_dir_).append(item.filename().wstring()).wstring();
std::wstring new_path =
fs::path(dest_dir_.ToStdWstring()).append(item.filename().wstring()).wstring();
fs::copy_file(item, new_path, fs::copy_options::overwrite_existing);
}
return true;
@ -158,22 +159,26 @@ bool CFunInstall::install(const wxString& file, const wxString& category, const
fs::path full_path(file.ToStdWstring());
wxString file_name = full_path.filename().wstring();
wxString script_name = file_name + "_run.sh";
wxString script_full_path = fs::path(file).parent_path().append(script_name.ToStdWstring()).wstring();
wxString script_full_path =
fs::path(file.ToStdWstring()).parent_path().append(script_name.ToStdWstring()).wstring();
wxString script_content =
"IyEvYmluL2Jhc2gKU0NSSVBUX0RJUj0kKGNkICIkKGRpcm5hbWUgIiQwIikiICYmIHB3ZCkKY2QgIiRTQ1JJUFRfRElSIiB8fCBleGl0CmV4cG9ydCBMRF9MSUJSQVJZX1BBVEg9JExE"
"IyEvYmluL2Jhc2gKU0NSSVBUX0RJUj0kKGNkICIkKGRpcm5hbWUgIiQwIikiICYmIHB3ZCkKY2QgIiRTQ1JJUFRfRElSIiB8fCBl"
"eGl0CmV4cG9ydCBMRF9MSUJSQVJZX1BBVEg9JExE"
"X0xJQlJBUllfUEFUSDoiJFNDUklQVF9ESVIiCiIkU0NSSVBUX0RJUi9yZXBsYWNlX3N0ciIgIiRAIgo=";
wxMemoryBuffer decodeData = wxBase64Decode(script_content);
script_content = wxString::FromUTF8(static_cast<const char*>(decodeData.GetData()), decodeData.GetBufSize());
script_content =
wxString::FromUTF8(static_cast<const char*>(decodeData.GetData()), decodeData.GetBufSize());
wxString desktop_content =
"W0Rlc2t0b3AgRW50cnldCk5hbWU9cmVfbmFtZQpDb21tZW50PXJlX2Rlc2NyaWJlCkV4ZWM9cmVfcGF0aApJY29uPXJlX2ljb24KVGVybWluYWw9ZmFsc2UKVHlwZT1BcHBsaWNhdGlv"
"bgpDYXRlZ29yaWVzPXJlX2NhdGVnb3J5Owo=";
wxString desktop_content = "W0Rlc2t0b3AgRW50cnldCk5hbWU9cmVfbmFtZQpDb21tZW50PXJlX2Rlc2NyaWJlCkV4ZWM9cmVfc"
"GF0aApJY29uPXJlX2ljb24KVGVybWluYWw9ZmFsc2UKVHlwZT1BcHBsaWNhdGlv"
"bgpDYXRlZ29yaWVzPXJlX2NhdGVnb3J5Owo=";
wxMemoryBuffer decodeData2 = wxBase64Decode(desktop_content);
desktop_content = wxString::FromUTF8(static_cast<const char*>(decodeData2.GetData()), decodeData2.GetDataLen());
desktop_content =
wxString::FromUTF8(static_cast<const char*>(decodeData2.GetData()), decodeData2.GetDataLen());
// write temp file
fs::path temp(wxGetHomeDir());
fs::path temp(wxGetHomeDir().ToStdWstring());
temp.append(".config").append("LinuxPack");
fs::path temp_png = temp;
temp_png.append("default.png");

View File

@ -4,7 +4,8 @@
#include "InstallWidget.h"
CInstallDialog::CInstallDialog(wxWindow* parent, const wxString& title) : wxDialog(parent, wxID_ANY, title, wxDefaultPosition)
CInstallDialog::CInstallDialog(wxWindow* parent, const wxString& title)
: wxDialog(parent, wxID_ANY, title, wxDefaultPosition)
{
handle_ = new CFunInstall();
InitInstall();
@ -116,17 +117,20 @@ void CInstallDialog::selectBinaryFile(wxCommandEvent& event)
{
wxFileDialog openFileDialog(this, wxT("选择binary文件"), "", "", "*", wxFD_OPEN | wxFD_FILE_MUST_EXIST);
if (openFileDialog.ShowModal() == wxID_CANCEL) return;
if (openFileDialog.ShowModal() == wxID_CANCEL)
return;
wxString filePath = openFileDialog.GetPath();
text_binary_file_->SetValue(filePath);
}
void CInstallDialog::selectIcoFile(wxCommandEvent& event)
{
wxFileDialog openFileDialog(this, _("Open file"), "", "", "ICO (*.ico)|*.ico|PNG (*.png)|*.png|SVG (*.svg)|*.svg|All files (*.*)|*.*",
wxFileDialog openFileDialog(this, _("Open file"), "", "",
"ICO (*.ico)|*.ico|PNG (*.png)|*.png|SVG (*.svg)|*.svg|All files (*.*)|*.*",
wxFD_OPEN | wxFD_FILE_MUST_EXIST);
if (openFileDialog.ShowModal() == wxID_CANCEL) return;
if (openFileDialog.ShowModal() == wxID_CANCEL)
return;
wxString filePath = openFileDialog.GetPath();
text_ico_file_->SetValue(filePath);

View File

@ -5,9 +5,9 @@
#ifndef INSTALL_H
#define INSTALL_H
#include <wx/wx.h>
#include <wx/dialog.h>
#include "FunctionImp.h"
#include <wx/dialog.h>
#include <wx/wx.h>
constexpr int g_Border2 = 3;

View File

@ -2,7 +2,8 @@
#include "InstallWidget.h"
CMainPanel::CMainPanel(wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxString& name)
CMainPanel::CMainPanel(wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style,
const wxString& name)
: wxPanel(parent, id, pos, size, style, name)
{
top_sizer_ = new wxBoxSizer(wxVERTICAL);
@ -113,7 +114,8 @@ void CMainPanel::installDialog(wxCommandEvent& event)
void CMainPanel::selectDir(wxCommandEvent& event)
{
wxDirDialog dirDialog(this, wxT("Select Directory"), wxEmptyString, wxDD_DIR_MUST_EXIST);
if (dirDialog.ShowModal() == wxID_CANCEL) return; // 用户取消选择
if (dirDialog.ShowModal() == wxID_CANCEL)
return; // 用户取消选择
wxString selectedDir = dirDialog.GetPath();
text_output_ctrl_->SetValue(selectedDir);
}
@ -157,13 +159,15 @@ void CMainPanel::addEnv(wxCommandEvent& event)
{
wxDirDialog dirDialog(this, wxT("Select Directory"), wxEmptyString, wxDD_DIR_MUST_EXIST);
if (dirDialog.ShowModal() == wxID_CANCEL) return; // 用户取消选择
if (dirDialog.ShowModal() == wxID_CANCEL)
return; // 用户取消选择
wxString selectedDir = dirDialog.GetPath();
// 检查列表中是否已经存在此目录
for (unsigned int i = 0; i < env_list_->GetCount(); ++i) {
if (env_list_->GetString(i) == selectedDir) return; // 目录已存在,不再添加
if (env_list_->GetString(i) == selectedDir)
return; // 目录已存在,不再添加
}
// 添加目录到列表
@ -174,7 +178,8 @@ void CMainPanel::selectBinaryFile(wxCommandEvent& event)
{
wxFileDialog openFileDialog(this, _("Open file"), "", "", "*", wxFD_OPEN | wxFD_FILE_MUST_EXIST);
if (openFileDialog.ShowModal() == wxID_CANCEL) return;
if (openFileDialog.ShowModal() == wxID_CANCEL)
return;
wxString filePath = openFileDialog.GetPath();
text_select_ctrl_->SetValue(filePath);

View File

@ -1,8 +1,8 @@
#ifndef MAIN_PANEL
#define MAIN_PANEL
#include <wx/wx.h>
#include "FunctionImp.h"
#include <wx/wx.h>
constexpr int g_Width = 700;
constexpr int g_Heigh = 450;
@ -40,7 +40,8 @@ protected:
public:
explicit CMainPanel(wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxSize(g_Width, g_Heigh), long style = wxTAB_TRAVERSAL, const wxString& name = wxEmptyString);
const wxSize& size = wxSize(g_Width, g_Heigh), long style = wxTAB_TRAVERSAL,
const wxString& name = wxEmptyString);
~CMainPanel() override;
public: