fix: 修复 clangformat 设置无效问题;GitAction 相关配置更改;

This commit is contained in:
寂静的羽夏 2025-02-15 12:46:04 +08:00
parent a09caae797
commit 3f75b5645d
13 changed files with 32 additions and 23 deletions

View File

@ -6,7 +6,7 @@ on:
- release - release
env: env:
BUILD_TYPE: Release BUILD_TYPE: RelWithDebInfo
jobs: jobs:
build-release: build-release:

View File

@ -6,7 +6,7 @@ on:
- release - release
env: env:
BUILD_TYPE: Release BUILD_TYPE: RelWithDebInfo
jobs: jobs:
build-release: build-release:

View File

@ -9,7 +9,7 @@ on:
- main - main
env: env:
BUILD_TYPE: Release BUILD_TYPE: RelWithDebInfo
jobs: jobs:
build-test: build-test:

View File

@ -1258,14 +1258,9 @@ bool QDocument::isClean() const {
void QDocument::setClean() { void QDocument::setClean() {
if (m_impl) { if (m_impl) {
m_impl->m_commands.setClean(); m_impl->m_commands.setClean();
// m_impl->m_status.clear();
QHash<QDocumentLineHandle *, QPair<int, int>>::iterator it = for (auto &item : m_impl->m_status) {
m_impl->m_status.begin(); item.first = item.second;
while (it != m_impl->m_status.end()) {
it->second = it->first;
++it;
} }
} }
} }

View File

@ -727,8 +727,8 @@ bool QEditor::save() {
m_doc->setClean(); m_doc->setClean();
emit saved(this, fileName());
m_saveState = Saved; m_saveState = Saved;
emit saved(this, fileName());
QTimer::singleShot(100, this, SLOT(reconnectWatcher())); QTimer::singleShot(100, this, SLOT(reconnectWatcher()));

View File

@ -68,6 +68,7 @@ def main():
package_name = "WingHexExplorer2" package_name = "WingHexExplorer2"
exe_name = package_name + ".exe" exe_name = package_name + ".exe"
sym_name = package_name + ".pdb"
# start parsing build directory # start parsing build directory
projectdeb = os.path.abspath(args.folder) projectdeb = os.path.abspath(args.folder)
@ -123,17 +124,20 @@ def main():
# check # check
exemain_src = "" exemain_src = ""
exesym_src = ""
if(os.path.exists(os.path.join(projectdeb, "WingHexExplorer2.sln"))): if(os.path.exists(os.path.join(projectdeb, "WingHexExplorer2.sln"))):
exemain_src = os.path.join(projectdeb, "Release", exe_name) # only support Release for MSVC sln build (GitAction) exemain_src = os.path.join(projectdeb, "RelWithDebInfo", exe_name)
exesym_src = os.path.join(projectdeb, "RelWithDebInfo", sym_name)
else: else:
exemain_src = os.path.join(projectdeb, exe_name) exemain_src = os.path.join(projectdeb, exe_name)
exesym_src = os.path.join(projectdeb, sym_name)
if (os.path.exists(exemain_src) == False): if (os.path.exists(exemain_src) == False):
print( print(
Fore.RED + "[Error] WingHexExplorer2.exe is not found!" + Style.RESET_ALL) Fore.RED + "[Error] WingHexExplorer2.exe is not found!" + Style.RESET_ALL)
exit(-3) exit(-3)
# calculate the md5 checksum # calculate the md5 checksum
with open(exemain_src, 'rb') as file_to_check: with open(exemain_src, 'rb') as file_to_check:
data = file_to_check.read() data = file_to_check.read()
@ -150,6 +154,7 @@ def main():
os.mkdir(os.path.join(exeDebPath, "aslib")) os.mkdir(os.path.join(exeDebPath, "aslib"))
shutil.copy2(exemain_src, os.path.join(exeDebPath, exe_name)) shutil.copy2(exemain_src, os.path.join(exeDebPath, exe_name))
shutil.copy2(exesym_src, os.path.join(exeDebPath, sym_name))
shutil.copytree(os.path.join(buildinstaller, "share"), shutil.copytree(os.path.join(buildinstaller, "share"),
os.path.join(exeDebPath, "share")) os.path.join(exeDebPath, "share"))

View File

@ -18,6 +18,8 @@
#include "clangformatmanager.h" #include "clangformatmanager.h"
#include "settings/settings.h" #include "settings/settings.h"
#include "dbghelper.h"
#include <QDir> #include <QDir>
#include <QProcess> #include <QProcess>
#include <QProcessEnvironment> #include <QProcessEnvironment>
@ -31,6 +33,8 @@ Q_GLOBAL_STATIC_WITH_ARGS(QString, CLANG_DEFAULT_CUSTOM,
("BasedOnStyle: llvm, IndentWidth: 4")) ("BasedOnStyle: llvm, IndentWidth: 4"))
ClangFormatManager::ClangFormatManager() { ClangFormatManager::ClangFormatManager() {
ASSERT_SINGLETON;
// load config // load config
HANDLE_CONFIG; HANDLE_CONFIG;

View File

@ -84,6 +84,9 @@ private:
QString m_customStyleString; QString m_customStyleString;
int m_timeout = 5000; int m_timeout = 5000;
private:
Q_DISABLE_COPY_MOVE(ClangFormatManager)
}; };
#endif // CLANGFORMATMANAGER_H #endif // CLANGFORMATMANAGER_H

View File

@ -197,7 +197,7 @@ private:
QVariantList QVariantList
getVarList(const QList<RecentFileManager::RecentInfo> &infos) const; getVarList(const QList<RecentFileManager::RecentInfo> &infos) const;
Q_DISABLE_COPY(SettingManager) Q_DISABLE_COPY_MOVE(SettingManager)
private: private:
int m_themeID = 0; int m_themeID = 0;
int m_appfontSize = 18; int m_appfontSize = 18;

View File

@ -45,7 +45,7 @@ private:
explicit SkinManager(QObject *parent = nullptr); explicit SkinManager(QObject *parent = nullptr);
Q_DISABLE_COPY(SkinManager) Q_DISABLE_COPY_MOVE(SkinManager)
}; };
#endif // SKINMANAGER_H #endif // SKINMANAGER_H

View File

@ -75,7 +75,7 @@ bool ScriptEditor::save(const QString &path) {
auto needAdjustFile = !QFile::exists(path); auto needAdjustFile = !QFile::exists(path);
#endif #endif
auto clang = ClangFormatManager::instance(); auto &clang = ClangFormatManager::instance();
if (clang.exists() && clang.autoFormat()) { if (clang.exists() && clang.autoFormat()) {
formatCode(); formatCode();
} }

View File

@ -410,6 +410,8 @@ private:
private: private:
QString _curLoadingPlg; QString _curLoadingPlg;
Q_DISABLE_COPY_MOVE(PluginSystem)
}; };
#endif // PLUGINSYSTEM_H #endif // PLUGINSYSTEM_H

View File

@ -10,7 +10,7 @@ ClangFormatSetDialog::ClangFormatSetDialog(QWidget *parent)
: WingHex::SettingPage(parent), ui(new Ui::ClangFormatSetDialog) { : WingHex::SettingPage(parent), ui(new Ui::ClangFormatSetDialog) {
ui->setupUi(this); ui->setupUi(this);
auto clang = ClangFormatManager::instance(); auto &clang = ClangFormatManager::instance();
ui->cbStyle->addItems(clang.supportedStyles()); ui->cbStyle->addItems(clang.supportedStyles());
ui->leLocation->setText(ClangFormatManager::getProgramName()); ui->leLocation->setText(ClangFormatManager::getProgramName());
@ -29,7 +29,7 @@ ClangFormatSetDialog::ClangFormatSetDialog(QWidget *parent)
ClangFormatSetDialog::~ClangFormatSetDialog() { delete ui; } ClangFormatSetDialog::~ClangFormatSetDialog() { delete ui; }
QStringList ClangFormatSetDialog::getEditableStyleTextLines() { QStringList ClangFormatSetDialog::getEditableStyleTextLines() {
auto clang = ClangFormatManager::instance(); auto &clang = ClangFormatManager::instance();
auto styles = clang.customStyleString().split(','); auto styles = clang.customStyleString().split(',');
for (auto &style : styles) { for (auto &style : styles) {
style = style.simplified(); style = style.simplified();
@ -42,7 +42,7 @@ QString ClangFormatSetDialog::getEditableStyleTexts() {
} }
void ClangFormatSetDialog::reload() { void ClangFormatSetDialog::reload() {
auto clang = ClangFormatManager::instance(); auto &clang = ClangFormatManager::instance();
ui->cbEnabled->setChecked(clang.enabled()); ui->cbEnabled->setChecked(clang.enabled());
ui->cbAutoFmt->setChecked(clang.autoFormat()); ui->cbAutoFmt->setChecked(clang.autoFormat());
ui->cbStyle->setCurrentIndex(clang.clangCurrentStyleIndex()); ui->cbStyle->setCurrentIndex(clang.clangCurrentStyleIndex());
@ -60,14 +60,14 @@ QString ClangFormatSetDialog::id() const {
} }
void ClangFormatSetDialog::apply() { void ClangFormatSetDialog::apply() {
auto clang = ClangFormatManager::instance(); auto &clang = ClangFormatManager::instance();
clang.setEnabled(ui->cbEnabled->isChecked()); clang.setEnabled(ui->cbEnabled->isChecked());
clang.setAutoFormat(ui->cbAutoFmt->isChecked()); clang.setAutoFormat(ui->cbAutoFmt->isChecked());
clang.setClangStyle(ui->cbStyle->currentText()); clang.setClangStyle(ui->cbStyle->currentText());
} }
void ClangFormatSetDialog::reset() { void ClangFormatSetDialog::reset() {
auto clang = ClangFormatManager::instance(); auto &clang = ClangFormatManager::instance();
clang.reset(); clang.reset();
reload(); reload();
} }
@ -79,7 +79,7 @@ void ClangFormatSetDialog::on_cbStyle_currentTextChanged(const QString &arg1) {
} }
void ClangFormatSetDialog::on_btnStyleCustom_clicked() { void ClangFormatSetDialog::on_btnStyleCustom_clicked() {
auto clang = ClangFormatManager::instance(); auto &clang = ClangFormatManager::instance();
bool ok = false; bool ok = false;
while (true) { while (true) {
auto style = WingInputDialog::getMultiLineText( auto style = WingInputDialog::getMultiLineText(