From a03c939043d89e45777095012e8a9b3a73029b3b Mon Sep 17 00:00:00 2001 From: Akash Mozumdar Date: Sat, 30 Jan 2021 12:07:37 -0700 Subject: [PATCH] fix small bugs --- GUI/extenwindow.cpp | 3 +-- GUI/mainwindow.cpp | 8 ++++---- extensions/blockmarkup.h | 3 +-- extensions/extrawindow.cpp | 6 ++---- extensions/lua.cpp | 4 +--- extensions/regexfilter.cpp | 3 +-- extensions/styler.cpp | 5 ++--- extensions/threadlinker.cpp | 3 +-- extensions/translatewrapper.cpp | 4 +--- texthook/hookfinder.cc | 2 +- texthook/texthook.cc | 2 +- 11 files changed, 16 insertions(+), 27 deletions(-) diff --git a/GUI/extenwindow.cpp b/GUI/extenwindow.cpp index 019830c..807d429 100644 --- a/GUI/extenwindow.cpp +++ b/GUI/extenwindow.cpp @@ -122,8 +122,7 @@ void CleanupExtensions() extensions.clear(); } -ExtenWindow::ExtenWindow(QWidget* parent) : - QMainWindow(parent, Qt::WindowCloseButtonHint) +ExtenWindow::ExtenWindow(QWidget* parent) : QMainWindow(parent, Qt::WindowCloseButtonHint) { This = this; ui.setupUi(this); diff --git a/GUI/mainwindow.cpp b/GUI/mainwindow.cpp index c72dd00..0f31732 100644 --- a/GUI/mainwindow.cpp +++ b/GUI/mainwindow.cpp @@ -303,8 +303,8 @@ namespace QDialog dialog(This, Qt::WindowCloseButtonHint); QFormLayout layout(&dialog); - QCheckBox CJKCheck(&dialog); - layout.addRow(SEARCH_CJK, &CJKCheck); + QCheckBox asianCheck(&dialog); + layout.addRow(SEARCH_CJK, &asianCheck); QDialogButtonBox confirm(QDialogButtonBox::Ok | QDialogButtonBox::Help | QDialogButtonBox::Retry, &dialog); layout.addRow(&confirm); confirm.button(QDialogButtonBox::Ok)->setText(START_HOOK_SEARCH); @@ -338,7 +338,7 @@ namespace return; } - filter.setPattern(CJKCheck.isChecked() ? "[\\x{3000}-\\x{a000}]{4,}" : "[\\x{0020}-\\x{1000}]{4,}"); + filter.setPattern(asianCheck.isChecked() ? "[\\x{3000}-\\x{a000}]{4,}" : "[\\x{0020}-\\x{1000}]{4,}"); if (customSettings) { QDialog dialog(This, Qt::WindowCloseButtonHint); @@ -678,5 +678,5 @@ MainWindow::~MainWindow() void MainWindow::closeEvent(QCloseEvent*) { - QCoreApplication::quit(); // Need to do this to kill any windows that might've been made by extensions + QApplication::quit(); // Need to do this to kill any windows that might've been made by extensions } diff --git a/extensions/blockmarkup.h b/extensions/blockmarkup.h index ebd8654..a6fe5ba 100644 --- a/extensions/blockmarkup.h +++ b/extensions/blockmarkup.h @@ -6,8 +6,7 @@ template // class BlockMarkupIterator { public: - BlockMarkupIterator(const std::istream& stream, const std::basic_string_view(&delimiters)[delimiterCount]) : - streambuf(*stream.rdbuf()) + BlockMarkupIterator(const std::istream& stream, const std::basic_string_view(&delimiters)[delimiterCount]) : streambuf(*stream.rdbuf()) { std::copy_n(delimiters, delimiterCount, this->delimiters.begin()); } diff --git a/extensions/extrawindow.cpp b/extensions/extrawindow.cpp index 92be065..7d3f332 100644 --- a/extensions/extrawindow.cpp +++ b/extensions/extrawindow.cpp @@ -154,8 +154,7 @@ private: class ExtraWindow : public PrettyWindow { public: - ExtraWindow() : - PrettyWindow("Extra Window") + ExtraWindow() : PrettyWindow("Extra Window") { ui.display->setTextFormat(Qt::PlainText); if (settings.contains(WINDOW) && QApplication::screenAt(settings.value(WINDOW).toRect().bottomRight())) setGeometry(settings.value(WINDOW).toRect()); @@ -330,8 +329,7 @@ private: class DictionaryWindow : public PrettyWindow { public: - DictionaryWindow() : - PrettyWindow("Dictionary Window") + DictionaryWindow() : PrettyWindow("Dictionary Window") { ui.display->setSizePolicy({ QSizePolicy::Fixed, QSizePolicy::Minimum }); } diff --git a/extensions/lua.cpp b/extensions/lua.cpp index 5b102f3..3a5d541 100644 --- a/extensions/lua.cpp +++ b/extensions/lua.cpp @@ -1,6 +1,5 @@ #include "qtcommon.h" #include "extension.h" -#include #include extern const char* LUA_INTRO; @@ -44,8 +43,7 @@ std::atomic revCount = 0; class Window : public QDialog, Localizer { public: - Window() - : QDialog(nullptr, Qt::WindowMinMaxButtonsHint) + Window() : QDialog(nullptr, Qt::WindowMinMaxButtonsHint) { connect(&loadButton, &QPushButton::clicked, this, &Window::LoadScript); diff --git a/extensions/regexfilter.cpp b/extensions/regexfilter.cpp index 56a174d..0d2e060 100644 --- a/extensions/regexfilter.cpp +++ b/extensions/regexfilter.cpp @@ -19,8 +19,7 @@ DWORD (*GetSelectedProcessId)() = nullptr; class Window : public QDialog, Localizer { public: - Window() - : QDialog(nullptr, Qt::WindowMinMaxButtonsHint) + Window() : QDialog(nullptr, Qt::WindowMinMaxButtonsHint) { ui.setupUi(this); diff --git a/extensions/styler.cpp b/extensions/styler.cpp index 6b15e1d..9ea6982 100644 --- a/extensions/styler.cpp +++ b/extensions/styler.cpp @@ -1,6 +1,5 @@ #include "qtcommon.h" #include "extension.h" -#include #include extern const char* LOAD_SCRIPT; @@ -10,8 +9,7 @@ constexpr auto STYLE_SAVE_FILE = u8"Textractor.css"; class Window : public QDialog, Localizer { public: - Window() - : QDialog(nullptr, Qt::WindowMinMaxButtonsHint) + Window() : QDialog(nullptr, Qt::WindowMinMaxButtonsHint) { connect(&loadButton, &QPushButton::clicked, this, &Window::LoadScript); @@ -28,6 +26,7 @@ public: ~Window() { + qApp->setStyleSheet(""); Save(); } diff --git a/extensions/threadlinker.cpp b/extensions/threadlinker.cpp index 0097171..91dfff7 100644 --- a/extensions/threadlinker.cpp +++ b/extensions/threadlinker.cpp @@ -14,8 +14,7 @@ std::shared_mutex m; class Window : public QDialog, Localizer { public: - Window() - : QDialog(nullptr, Qt::WindowMinMaxButtonsHint) + Window() : QDialog(nullptr, Qt::WindowMinMaxButtonsHint) { connect(&linkButton, &QPushButton::clicked, this, &Window::Link); diff --git a/extensions/translatewrapper.cpp b/extensions/translatewrapper.cpp index 7d2d699..f5ce104 100644 --- a/extensions/translatewrapper.cpp +++ b/extensions/translatewrapper.cpp @@ -52,8 +52,7 @@ namespace class Window : public QDialog, Localizer { public: - Window() : - QDialog(nullptr, Qt::WindowMinMaxButtonsHint) + Window() : QDialog(nullptr, Qt::WindowMinMaxButtonsHint) { display = new QFormLayout(this); @@ -75,7 +74,6 @@ public: translateFromCombo->addItems(languages); language = -1; if (settings.contains(TRANSLATE_FROM)) language = translateFromCombo->findText(settings.value(TRANSLATE_FROM).toString(), Qt::MatchEndsWith); - if (language < 0) language = translateFromCombo->findText(NATIVE_LANGUAGE, Qt::MatchStartsWith); if (language < 0) language = translateFromCombo->findText("?", Qt::MatchStartsWith); translateFromCombo->setCurrentIndex(language); SaveTranslateFrom(translateFromCombo->currentText()); diff --git a/texthook/hookfinder.cc b/texthook/hookfinder.cc index befa499..b96329d 100644 --- a/texthook/hookfinder.cc +++ b/texthook/hookfinder.cc @@ -97,7 +97,7 @@ namespace 0x5b, // pop rbx 0x58, // pop rax 0x9d, // pop rflags - 0xff, 0x25, 0x00, 0x00, 0x00, 0x00, // jmp qword ptr [0] ; relative to next instruction (i.e. jmp @original) + 0xff, 0x25, 0x00, 0x00, 0x00, 0x00, // jmp qword ptr [rip] 0,0,0,0,0,0,0,0 // @original }; constexpr int addr_offset = 50, send_offset = 60, original_offset = 126, registers = 16; diff --git a/texthook/texthook.cc b/texthook/texthook.cc index ee52048..d91d410 100644 --- a/texthook/texthook.cc +++ b/texthook/texthook.cc @@ -86,7 +86,7 @@ namespace { // unnamed 0x5b, // pop rbx 0x58, // pop rax 0x9d, // pop rflags - 0xff, 0x25, 0x00, 0x00, 0x00, 0x00, // jmp qword ptr [rip] ; relative to next instruction (i.e. jmp @original) + 0xff, 0x25, 0x00, 0x00, 0x00, 0x00, // jmp qword ptr [rip] 0,0,0,0,0,0,0,0 // @original }; int this_offset = 50, send_offset = 60, original_offset = 126;