From 54f60f7657192327528b0b4c9f61e3ec05aea268 Mon Sep 17 00:00:00 2001 From: Akash Mozumdar Date: Thu, 26 Sep 2019 07:07:58 -0400 Subject: [PATCH] small fixes --- extensions/extrawindow.cpp | 5 ++++- text.cpp | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/extensions/extrawindow.cpp b/extensions/extrawindow.cpp index fcaa4a1..65e8e70 100644 --- a/extensions/extrawindow.cpp +++ b/extensions/extrawindow.cpp @@ -101,6 +101,7 @@ public: ExtraWindow() : PrettyWindow("Extra Window") { + ui.display->setTextFormat(Qt::PlainText); setGeometry(settings.value(WINDOW, geometry()).toRect()); for (auto [name, default, slot] : Array>{ @@ -261,9 +262,11 @@ private: UpdateDictionary(); definitions.clear(); definitionIndex = 0; + std::unordered_set definitionSet; for (QByteArray utf8term = term.left(200).toUtf8(); !utf8term.isEmpty(); utf8term.chop(1)) for (auto [it, end] = std::equal_range(dictionary.begin(), dictionary.end(), DictionaryEntry{ utf8term }); it != end; ++it) - definitions.push_back(QStringLiteral("

%1 (%3/%4)

%2").arg(utf8term, it->definition)); + if (definitionSet.emplace(it->definition).second) + definitions.push_back(QStringLiteral("

%1 (%3/%4)

%2").arg(utf8term, it->definition)); for (int i = 0; i < definitions.size(); ++i) definitions[i] = definitions[i].arg(i + 1).arg(definitions.size()); ShowDefinition(); } diff --git a/text.cpp b/text.cpp index 918c8ab..a99cddd 100644 --- a/text.cpp +++ b/text.cpp @@ -121,7 +121,7 @@ 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. It uses a custom format specific to Textractor and is not meant to be written manually. -You should look for a dictionary in this format online (https://artikash.github.io/?dictionary is a good place to start). +You should look for a dictionary in this format online (https://github.com/Artikash/Textractor-Dictionaries/releases is a good place to start). Alternatively, if you're a programmer, you can write a script to convert a dictionary from another format with the info below. Once you have a dictionary, to look up some text in Extra Window, select it. All matching definitions will be shown. Definitions are formatted like this:|TERM|Hola|TERM|hola|TERM|Bonjour|TERM|bonjour|DEFINITION|hello|END|