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
env:
BUILD_TYPE: Release
BUILD_TYPE: RelWithDebInfo
jobs:
build-release:

View File

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

View File

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

View File

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

View File

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

View File

@ -68,6 +68,7 @@ def main():
package_name = "WingHexExplorer2"
exe_name = package_name + ".exe"
sym_name = package_name + ".pdb"
# start parsing build directory
projectdeb = os.path.abspath(args.folder)
@ -123,17 +124,20 @@ def main():
# check
exemain_src = ""
exesym_src = ""
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:
exemain_src = os.path.join(projectdeb, exe_name)
exesym_src = os.path.join(projectdeb, sym_name)
if (os.path.exists(exemain_src) == False):
print(
Fore.RED + "[Error] WingHexExplorer2.exe is not found!" + Style.RESET_ALL)
exit(-3)
# calculate the md5 checksum
with open(exemain_src, 'rb') as file_to_check:
data = file_to_check.read()
@ -150,6 +154,7 @@ def main():
os.mkdir(os.path.join(exeDebPath, "aslib"))
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"),
os.path.join(exeDebPath, "share"))

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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