mirror of
https://github.com/Artikash/Textractor.git
synced 2024-12-23 08:54:12 +08:00
configurable max size
This commit is contained in:
parent
6bd0c74c83
commit
99be5fd40f
@ -17,6 +17,7 @@
|
||||
|
||||
extern const char* EXTRA_WINDOW_INFO;
|
||||
extern const char* SENTENCE_TOO_BIG;
|
||||
extern const char* MAX_SENTENCE_SIZE;
|
||||
extern const char* TOPMOST;
|
||||
extern const char* OPACITY;
|
||||
extern const char* SHOW_ORIGINAL;
|
||||
@ -159,6 +160,7 @@ public:
|
||||
{
|
||||
ui.display->setTextFormat(Qt::PlainText);
|
||||
if (settings.contains(WINDOW) && QGuiApplication::screenAt(settings.value(WINDOW).toRect().bottomRight())) setGeometry(settings.value(WINDOW).toRect());
|
||||
maxSentenceSize = settings.value(MAX_SENTENCE_SIZE, maxSentenceSize).toInt();
|
||||
|
||||
for (auto [name, default, slot] : Array<const char*, bool, void(ExtraWindow::*)(bool)>{
|
||||
{ TOPMOST, false, &ExtraWindow::setTopmost },
|
||||
@ -173,6 +175,10 @@ public:
|
||||
action->setCheckable(true);
|
||||
action->setChecked(default);
|
||||
}
|
||||
menu.addAction(MAX_SENTENCE_SIZE, this, [this]
|
||||
{
|
||||
settings.setValue(MAX_SENTENCE_SIZE, maxSentenceSize = QInputDialog::getInt(this, MAX_SENTENCE_SIZE, "", maxSentenceSize, 0, INT_MAX, 1, nullptr, Qt::WindowCloseButtonHint));
|
||||
});
|
||||
ui.display->installEventFilter(this);
|
||||
ui.display->setMouseTracking(true);
|
||||
|
||||
@ -296,7 +302,7 @@ private:
|
||||
}
|
||||
|
||||
bool locked, showOriginal, useDictionary;
|
||||
int maxSentenceSize = 1500;
|
||||
int maxSentenceSize = 500;
|
||||
QPoint oldPos;
|
||||
|
||||
class
|
||||
@ -389,7 +395,7 @@ private:
|
||||
definitions.clear();
|
||||
definitionIndex = 0;
|
||||
std::unordered_set<const char*> foundDefinitions;
|
||||
for (term = term.left(500); !term.isEmpty(); term.chop(1))
|
||||
for (term = term.left(100); !term.isEmpty(); term.chop(1))
|
||||
for (const auto& [rootTerm, definition, inflections] : LookupDefinitions(term, foundDefinitions))
|
||||
definitions.push_back(
|
||||
QStringLiteral("<h3>%1 (%5/%6)</h3><small>%2%3</small><p>%4</p>").arg(
|
||||
|
3
text.cpp
3
text.cpp
@ -122,7 +122,8 @@ const wchar_t* TOO_MANY_TRANS_REQUESTS = L"Too many translation requests: refuse
|
||||
const wchar_t* TRANSLATION_ERROR = L"Error while translating";
|
||||
const char* EXTRA_WINDOW_INFO = u8R"(Right click to change settings
|
||||
Click and drag on window edges to move, or the bottom right corner to resize)";
|
||||
const char* SENTENCE_TOO_BIG = u8"Sentence much too large to display";
|
||||
const char* SENTENCE_TOO_BIG = u8"Sentence too large to display";
|
||||
const char* MAX_SENTENCE_SIZE = u8"Max sentence size";
|
||||
const char* TOPMOST = u8"Always on top";
|
||||
const char* DICTIONARY = u8"Dictionary";
|
||||
const char* DICTIONARY_INSTRUCTIONS = u8R"(This file is used only for the "Dictionary" feature of the Extra Window extension.
|
||||
|
Loading…
x
Reference in New Issue
Block a user