fix small bugs

This commit is contained in:
Akash Mozumdar 2021-01-30 12:07:37 -07:00
parent faa14f8cb9
commit a03c939043
11 changed files with 16 additions and 27 deletions

View File

@ -122,8 +122,7 @@ void CleanupExtensions()
extensions.clear(); extensions.clear();
} }
ExtenWindow::ExtenWindow(QWidget* parent) : ExtenWindow::ExtenWindow(QWidget* parent) : QMainWindow(parent, Qt::WindowCloseButtonHint)
QMainWindow(parent, Qt::WindowCloseButtonHint)
{ {
This = this; This = this;
ui.setupUi(this); ui.setupUi(this);

View File

@ -303,8 +303,8 @@ namespace
QDialog dialog(This, Qt::WindowCloseButtonHint); QDialog dialog(This, Qt::WindowCloseButtonHint);
QFormLayout layout(&dialog); QFormLayout layout(&dialog);
QCheckBox CJKCheck(&dialog); QCheckBox asianCheck(&dialog);
layout.addRow(SEARCH_CJK, &CJKCheck); layout.addRow(SEARCH_CJK, &asianCheck);
QDialogButtonBox confirm(QDialogButtonBox::Ok | QDialogButtonBox::Help | QDialogButtonBox::Retry, &dialog); QDialogButtonBox confirm(QDialogButtonBox::Ok | QDialogButtonBox::Help | QDialogButtonBox::Retry, &dialog);
layout.addRow(&confirm); layout.addRow(&confirm);
confirm.button(QDialogButtonBox::Ok)->setText(START_HOOK_SEARCH); confirm.button(QDialogButtonBox::Ok)->setText(START_HOOK_SEARCH);
@ -338,7 +338,7 @@ namespace
return; 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) if (customSettings)
{ {
QDialog dialog(This, Qt::WindowCloseButtonHint); QDialog dialog(This, Qt::WindowCloseButtonHint);
@ -678,5 +678,5 @@ MainWindow::~MainWindow()
void MainWindow::closeEvent(QCloseEvent*) 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
} }

View File

@ -6,8 +6,7 @@ template <typename C, int delimiterCount, int blockSize = 0x1000 / sizeof(C)> //
class BlockMarkupIterator class BlockMarkupIterator
{ {
public: public:
BlockMarkupIterator(const std::istream& stream, const std::basic_string_view<C>(&delimiters)[delimiterCount]) : BlockMarkupIterator(const std::istream& stream, const std::basic_string_view<C>(&delimiters)[delimiterCount]) : streambuf(*stream.rdbuf())
streambuf(*stream.rdbuf())
{ {
std::copy_n(delimiters, delimiterCount, this->delimiters.begin()); std::copy_n(delimiters, delimiterCount, this->delimiters.begin());
} }

View File

@ -154,8 +154,7 @@ private:
class ExtraWindow : public PrettyWindow class ExtraWindow : public PrettyWindow
{ {
public: public:
ExtraWindow() : ExtraWindow() : PrettyWindow("Extra Window")
PrettyWindow("Extra Window")
{ {
ui.display->setTextFormat(Qt::PlainText); ui.display->setTextFormat(Qt::PlainText);
if (settings.contains(WINDOW) && QApplication::screenAt(settings.value(WINDOW).toRect().bottomRight())) setGeometry(settings.value(WINDOW).toRect()); 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 class DictionaryWindow : public PrettyWindow
{ {
public: public:
DictionaryWindow() : DictionaryWindow() : PrettyWindow("Dictionary Window")
PrettyWindow("Dictionary Window")
{ {
ui.display->setSizePolicy({ QSizePolicy::Fixed, QSizePolicy::Minimum }); ui.display->setSizePolicy({ QSizePolicy::Fixed, QSizePolicy::Minimum });
} }

View File

@ -1,6 +1,5 @@
#include "qtcommon.h" #include "qtcommon.h"
#include "extension.h" #include "extension.h"
#include <fstream>
#include <QPlainTextEdit> #include <QPlainTextEdit>
extern const char* LUA_INTRO; extern const char* LUA_INTRO;
@ -44,8 +43,7 @@ std::atomic<int> revCount = 0;
class Window : public QDialog, Localizer class Window : public QDialog, Localizer
{ {
public: public:
Window() Window() : QDialog(nullptr, Qt::WindowMinMaxButtonsHint)
: QDialog(nullptr, Qt::WindowMinMaxButtonsHint)
{ {
connect(&loadButton, &QPushButton::clicked, this, &Window::LoadScript); connect(&loadButton, &QPushButton::clicked, this, &Window::LoadScript);

View File

@ -19,8 +19,7 @@ DWORD (*GetSelectedProcessId)() = nullptr;
class Window : public QDialog, Localizer class Window : public QDialog, Localizer
{ {
public: public:
Window() Window() : QDialog(nullptr, Qt::WindowMinMaxButtonsHint)
: QDialog(nullptr, Qt::WindowMinMaxButtonsHint)
{ {
ui.setupUi(this); ui.setupUi(this);

View File

@ -1,6 +1,5 @@
#include "qtcommon.h" #include "qtcommon.h"
#include "extension.h" #include "extension.h"
#include <fstream>
#include <QPlainTextEdit> #include <QPlainTextEdit>
extern const char* LOAD_SCRIPT; extern const char* LOAD_SCRIPT;
@ -10,8 +9,7 @@ constexpr auto STYLE_SAVE_FILE = u8"Textractor.css";
class Window : public QDialog, Localizer class Window : public QDialog, Localizer
{ {
public: public:
Window() Window() : QDialog(nullptr, Qt::WindowMinMaxButtonsHint)
: QDialog(nullptr, Qt::WindowMinMaxButtonsHint)
{ {
connect(&loadButton, &QPushButton::clicked, this, &Window::LoadScript); connect(&loadButton, &QPushButton::clicked, this, &Window::LoadScript);
@ -28,6 +26,7 @@ public:
~Window() ~Window()
{ {
qApp->setStyleSheet("");
Save(); Save();
} }

View File

@ -14,8 +14,7 @@ std::shared_mutex m;
class Window : public QDialog, Localizer class Window : public QDialog, Localizer
{ {
public: public:
Window() Window() : QDialog(nullptr, Qt::WindowMinMaxButtonsHint)
: QDialog(nullptr, Qt::WindowMinMaxButtonsHint)
{ {
connect(&linkButton, &QPushButton::clicked, this, &Window::Link); connect(&linkButton, &QPushButton::clicked, this, &Window::Link);

View File

@ -52,8 +52,7 @@ namespace
class Window : public QDialog, Localizer class Window : public QDialog, Localizer
{ {
public: public:
Window() : Window() : QDialog(nullptr, Qt::WindowMinMaxButtonsHint)
QDialog(nullptr, Qt::WindowMinMaxButtonsHint)
{ {
display = new QFormLayout(this); display = new QFormLayout(this);
@ -75,7 +74,6 @@ public:
translateFromCombo->addItems(languages); translateFromCombo->addItems(languages);
language = -1; language = -1;
if (settings.contains(TRANSLATE_FROM)) language = translateFromCombo->findText(settings.value(TRANSLATE_FROM).toString(), Qt::MatchEndsWith); 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); if (language < 0) language = translateFromCombo->findText("?", Qt::MatchStartsWith);
translateFromCombo->setCurrentIndex(language); translateFromCombo->setCurrentIndex(language);
SaveTranslateFrom(translateFromCombo->currentText()); SaveTranslateFrom(translateFromCombo->currentText());

View File

@ -97,7 +97,7 @@ namespace
0x5b, // pop rbx 0x5b, // pop rbx
0x58, // pop rax 0x58, // pop rax
0x9d, // pop rflags 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 0,0,0,0,0,0,0,0 // @original
}; };
constexpr int addr_offset = 50, send_offset = 60, original_offset = 126, registers = 16; constexpr int addr_offset = 50, send_offset = 60, original_offset = 126, registers = 16;

View File

@ -86,7 +86,7 @@ namespace { // unnamed
0x5b, // pop rbx 0x5b, // pop rbx
0x58, // pop rax 0x58, // pop rax
0x9d, // pop rflags 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 0,0,0,0,0,0,0,0 // @original
}; };
int this_offset = 50, send_offset = 60, original_offset = 126; int this_offset = 50, send_offset = 60, original_offset = 126;