refactor regex filter, add guide, and make it a default
This commit is contained in:
parent
7cdbd93dcb
commit
3a36dbca1d
@ -1,8 +1,5 @@
|
||||
#include "extension.h"
|
||||
#include <QMainWindow>
|
||||
#include <QLayout>
|
||||
#include <QLabel>
|
||||
#include <QLineEdit>
|
||||
#include "ui_regexfilter.h"
|
||||
#include <QTimer>
|
||||
|
||||
extern const char* REGEX_FILTER;
|
||||
@ -16,25 +13,19 @@ struct : QMainWindow
|
||||
{
|
||||
void launch()
|
||||
{
|
||||
auto centralWidget = new QWidget(this);
|
||||
auto layout = new QVBoxLayout(centralWidget);
|
||||
auto input = new QLineEdit(centralWidget);
|
||||
auto output = new QLabel(centralWidget);
|
||||
output->setAlignment(Qt::AlignCenter);
|
||||
layout->addWidget(input);
|
||||
layout->addWidget(output);
|
||||
connect(input, &QLineEdit::textEdited, [=](QString newRegex)
|
||||
ui.setupUi(this);
|
||||
connect(ui.input, &QLineEdit::textEdited, [=](QString newRegex)
|
||||
{
|
||||
std::lock_guard l(m);
|
||||
try { regex = newRegex.toStdWString(); }
|
||||
catch (...) { return output->setText(INVALID_REGEX); }
|
||||
output->setText(QString(CURRENT_FILTER).arg(newRegex));
|
||||
catch (...) { return ui.output->setText(INVALID_REGEX); }
|
||||
ui.output->setText(QString(CURRENT_FILTER).arg(newRegex));
|
||||
});
|
||||
resize(350, 60);
|
||||
setCentralWidget(centralWidget);
|
||||
setWindowTitle(REGEX_FILTER);
|
||||
show();
|
||||
}
|
||||
|
||||
Ui::FilterWindow ui;
|
||||
}*window = nullptr;
|
||||
|
||||
BOOL WINAPI DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved)
|
||||
|
52
extensions/regexfilter.ui
Normal file
52
extensions/regexfilter.ui
Normal file
@ -0,0 +1,52 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>FilterWindow</class>
|
||||
<widget class="QMainWindow" name="FilterWindow">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>350</width>
|
||||
<height>76</height>
|
||||
</rect>
|
||||
</property>
|
||||
<widget class="QWidget">
|
||||
<layout class="QVBoxLayout">
|
||||
<item>
|
||||
<widget class="QLineEdit" name="input"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="output">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel">
|
||||
<property name="text">
|
||||
<string><a href="https://regexr.com">regexr.com</a></string>
|
||||
</property>
|
||||
<property name="textFormat">
|
||||
<enum>Qt::RichText</enum>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
<property name="openExternalLinks">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="textInteractionFlags">
|
||||
<set>Qt::TextBrowserInteraction</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
@ -28,7 +28,7 @@ constexpr auto CONFIG_FILE = u8"Textractor.ini";
|
||||
|
||||
// Misc
|
||||
|
||||
constexpr auto DEFAULT_EXTENSIONS = u8"Remove Repetition>Lua>Copy to Clipboard>Bing Translate>Extra Window>Extra Newlines";
|
||||
constexpr auto DEFAULT_EXTENSIONS = u8"Remove Repetition>Regex Filter>Copy to Clipboard>Bing Translate>Extra Window>Extra Newlines";
|
||||
constexpr auto WINDOW = u8"Window";
|
||||
|
||||
// EOF
|
||||
|
Loading…
x
Reference in New Issue
Block a user