Browse Source

Bugfix: Do not perform a search if mouse enters text field.

tags/0.14.0
tastytea 1 year ago
parent
commit
1a99bf1ded
Signed by: tastytea <tastytea@tastytea.de> GPG Key ID: CFC39497F1B26E07
4 changed files with 53 additions and 348 deletions
  1. +44
    -27
      src/interface_qt.cpp
  2. +1
    -1
      src/whyblocked.ui
  3. +4
    -160
      translations/whyblocked_de.ts
  4. +4
    -160
      translations/whyblocked_en.ts

+ 44
- 27
src/interface_qt.cpp View File

@@ -283,40 +283,57 @@ void MainWindow::find()

bool MainWindow::eventFilter(QObject *obj, QEvent *event)
{
if (obj == text_find &&
(event->type() == QEvent::KeyRelease || event->type() == QEvent::Enter))
wstring searchfor;

if (obj == text_find)
{
if (event->type() == QEvent::KeyRelease)
{
searchfor = text_find->text().toLower().toStdWString();
}
else if (event->type() == QEvent::Drop)
{
QDropEvent *drop = static_cast<QDropEvent*>(event);
searchfor = drop->mimeData()->text().toLower().toStdWString();
}
else
{
return QObject::eventFilter(obj, event);
}
}
else
{
vector<Database::data> filtered_entries;
if (!_dbdata.empty())
return QObject::eventFilter(obj, event);
}

vector<Database::data> filtered_entries;
if (!_dbdata.empty())
{
for (const Database::data &entry : _dbdata)
{
for (const Database::data &entry : _dbdata)
wstring searchstring;

std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>> convert;

if (check_user->isChecked())
{
wstring searchstring;

std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>> convert;

if (check_user->isChecked())
{
searchstring += convert.from_bytes(entry.user);
}
if (check_reason->isChecked())
{
searchstring += convert.from_bytes(entry.reason);
}
std::transform(searchstring.begin(), searchstring.end(),
searchstring.begin(), ::towlower);
if (searchstring.find(
text_find->text().toLower().toStdWString())
!= std::string::npos)
{
filtered_entries.push_back(entry);
}
searchstring += convert.from_bytes(entry.user);
}
if (check_reason->isChecked())
{
searchstring += convert.from_bytes(entry.reason);
}
std::transform(searchstring.begin(), searchstring.end(),
searchstring.begin(), ::towlower);
if (searchstring.find(searchfor) != std::string::npos)
{
filtered_entries.push_back(entry);
}
}

populate_tableview(filtered_entries);
}

populate_tableview(filtered_entries);

return QObject::eventFilter(obj, event);
}


+ 1
- 1
src/whyblocked.ui View File

@@ -46,7 +46,7 @@
<bool>true</bool>
</property>
<property name="clearButtonEnabled">
<bool>true</bool>
<bool>false</bool>
</property>
</widget>
</item>

+ 4
- 160
translations/whyblocked_de.ts View File

@@ -74,7 +74,7 @@
<translation>Du kannst URLs hier hineinziehen</translation>
</message>
<message>
<location filename="../src/interface_qt.cpp" line="444"/>
<location filename="../src/interface_qt.cpp" line="461"/>
<source>Insert receipt here.</source>
<translation>Beleg hier einfügen.</translation>
</message>
@@ -270,175 +270,19 @@
<translation>Bitte wähle einträge aus, die gelöscht werden sollen.</translation>
</message>
<message>
<location filename="../src/interface_qt.cpp" line="325"/>
<location filename="../src/interface_qt.cpp" line="342"/>
<source>About Whyblocked</source>
<translation>Über Whyblocked</translation>
</message>
<message>
<location filename="../src/interface_qt.cpp" line="326"/>
<location filename="../src/interface_qt.cpp" line="343"/>
<source>&lt;p&gt;&lt;b&gt;Whyblocked&lt;/b&gt; %1&lt;/p&gt;&lt;p&gt;Reminds you why you blocked someone.&lt;/p&gt;&lt;p&gt;Sourcecode: &lt;a href=&quot;https://schlomp.space/tastytea/whyblocked&quot;&gt;https://schlomp.space/tastytea/whyblocked&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;small&gt;Copyright © 2018 &lt;a href=&quot;mailto:tastytea@tastytea.de&quot;&gt;tastytea&lt;/a&gt;.&lt;br&gt;Licence GPLv3: &lt;a href=&quot;https://www.gnu.org/licenses/gpl-3.0.html&quot;&gt;GNU GPL version 3&lt;/a&gt;.&lt;br&gt;This program comes with ABSOLUTELY NO WARRANTY. This is free software, and you are welcome to redistribute it under certain conditions.&lt;/small&gt;&lt;/p&gt;</source>
<translation>&lt;p&gt;&lt;b&gt;Whyblocked&lt;/b&gt; %1&lt;/p&gt;&lt;p&gt;Erinnert dich, warum du jemanden blockiertest.&lt;/p&gt;&lt;p&gt;Quelltext: &lt;a href=&quot;https://schlomp.space/tastytea/whyblocked&quot;&gt;https://schlomp.space/tastytea/whyblocked&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;small&gt;Copyright © 2018 &lt;a href=&quot;mailto:tastytea@tastytea.de&quot;&gt;tastytea&lt;/a&gt;.&lt;br&gt;Lizenz GPLv3: &lt;a href=&quot;https://www.gnu.org/licenses/gpl-3.0.html&quot;&gt;GNU GPL version 3&lt;/a&gt;.&lt;br&gt;Für dieses Programm besteht KEINERLEI GARANTIE. Dies ist freie Software, die Sie unter bestimmten Bedingungen weitergeben dürfen.&lt;/small&gt;&lt;/p&gt;</translation>
</message>
<message>
<location filename="../src/interface_qt.cpp" line="347"/>
<location filename="../src/interface_qt.cpp" line="364"/>
<source>Receipts:</source>
<translation>Belege:</translation>
</message>
</context>
<context>
<name>Text</name>
<message>
<location filename="../src/interface_text.cpp" line="51"/>
<source>Blocked or silenced?</source>
<translation>Blockiert oder gedämpft?</translation>
</message>
<message>
<location filename="../src/interface_text.cpp" line="68"/>
<source>Add receipt? [y/n]</source>
<translation>Beleg hinzufügen? [j/n]</translation>
</message>
<message>
<location filename="../src/interface_text.cpp" line="69"/>
<source>y</source>
<translation>j</translation>
</message>
<message>
<location filename="../src/interface_text.cpp" line="69"/>
<source>Y</source>
<translation>J</translation>
</message>
<message>
<location filename="../src/interface_text.cpp" line="71"/>
<source>Receipt</source>
<translation>Beleg</translation>
</message>
<message>
<location filename="../src/interface_text.cpp" line="75"/>
<source>Receipt added.</source>
<translation>Beleg hinzugefügt.</translation>
</message>
<message>
<location filename="../src/interface_text.cpp" line="78"/>
<source>n</source>
<translation>n</translation>
</message>
<message>
<location filename="../src/interface_text.cpp" line="78"/>
<source>N</source>
<translation>N</translation>
</message>
<message>
<location filename="../src/interface_text.cpp" line="91"/>
<location filename="../src/interface_text.cpp" line="115"/>
<location filename="../src/interface_text.cpp" line="175"/>
<location filename="../src/interface_text.cpp" line="206"/>
<source>User or instance</source>
<translation>Benutzer oder Instanz</translation>
</message>
<message>
<location filename="../src/interface_text.cpp" line="102"/>
<source>Reason</source>
<translation>Begründung</translation>
</message>
<message>
<location filename="../src/interface_text.cpp" line="106"/>
<source>added.</source>
<translation>hinzugefügt.</translation>
</message>
<message>
<location filename="../src/interface_text.cpp" line="118"/>
<source>A blank line keeps the former value.</source>
<translation>Leere Zeile um den alten Wert zu erhalten.</translation>
</message>
<message>
<location filename="../src/interface_text.cpp" line="119"/>
<source>Change user or instance to</source>
<translation>Ändere Benutzer oder Instanz zu</translation>
</message>
<message>
<location filename="../src/interface_text.cpp" line="135"/>
<source>Old reason was:</source>
<translation>Alte Begründung war:</translation>
</message>
<message>
<location filename="../src/interface_text.cpp" line="136"/>
<source>Change reason to</source>
<translation>Ändere Begründung zu</translation>
</message>
<message>
<location filename="../src/interface_text.cpp" line="145"/>
<source>Old receipt was:</source>
<translation>Alter Beleg war:</translation>
</message>
<message>
<location filename="../src/interface_text.cpp" line="146"/>
<source>Change receipt to</source>
<translation>Ändere beleg zu</translation>
</message>
<message>
<location filename="../src/interface_text.cpp" line="168"/>
<source>Could not remove</source>
<translation>Konnte nicht entfernen:</translation>
</message>
<message>
<location filename="../src/interface_text.cpp" line="179"/>
<source>removed.</source>
<translation>entfernt.</translation>
</message>
<message>
<location filename="../src/interface_text.cpp" line="192"/>
<source> Blocked:</source>
<translation>Blockiert:</translation>
</message>
<message>
<location filename="../src/interface_text.cpp" line="196"/>
<source>Silenced:</source>
<translation> Gedämpft:</translation>
</message>
<message>
<location filename="../src/interface_text.cpp" line="198"/>
<source>because:</source>
<translation>weil:</translation>
</message>
<message>
<location filename="../src/interface_text.cpp" line="211"/>
<source>is</source>
<translation>ist</translation>
</message>
<message>
<location filename="../src/interface_text.cpp" line="214"/>
<source>blocked, because:</source>
<translation>blockiert, weil:</translation>
</message>
<message>
<location filename="../src/interface_text.cpp" line="218"/>
<source>silenced, because:</source>
<translation>gedämpft, weil:</translation>
</message>
<message>
<location filename="../src/interface_text.cpp" line="224"/>
<source>Receipts:</source>
<translation>Belege:</translation>
</message>
<message>
<location filename="../src/interface_text.cpp" line="236"/>
<source>Type add, edit, remove, view or details. Or just the first letter.</source>
<translation>Schreibe a für hinzufügen, e für ändern, r für entfernen, v für anschauen oder d für Details.</translation>
</message>
<message>
<location filename="../src/interface_text.cpp" line="239"/>
<source>Type help or h to show this help. Type quit or q to quit the program.</source>
<translation>Schreibe hilfe oder h, um die Hilfe anzuzeigen. Schreibe q um das Programm zu beenden.</translation>
</message>
<message>
<location filename="../src/interface_text.cpp" line="248"/>
<source>This is Whyblocked</source>
<translation>Dies ist Whyblocked</translation>
</message>
<message>
<location filename="../src/interface_text.cpp" line="299"/>
<source>Response not understood.</source>
<translation>Antwort nicht verstanden.</translation>
</message>
</context>
</TS>

+ 4
- 160
translations/whyblocked_en.ts View File

@@ -74,7 +74,7 @@
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/interface_qt.cpp" line="444"/>
<location filename="../src/interface_qt.cpp" line="461"/>
<source>Insert receipt here.</source>
<translation type="unfinished"></translation>
</message>
@@ -270,175 +270,19 @@
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/interface_qt.cpp" line="325"/>
<location filename="../src/interface_qt.cpp" line="342"/>
<source>About Whyblocked</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/interface_qt.cpp" line="326"/>
<location filename="../src/interface_qt.cpp" line="343"/>
<source>&lt;p&gt;&lt;b&gt;Whyblocked&lt;/b&gt; %1&lt;/p&gt;&lt;p&gt;Reminds you why you blocked someone.&lt;/p&gt;&lt;p&gt;Sourcecode: &lt;a href=&quot;https://schlomp.space/tastytea/whyblocked&quot;&gt;https://schlomp.space/tastytea/whyblocked&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;small&gt;Copyright © 2018 &lt;a href=&quot;mailto:tastytea@tastytea.de&quot;&gt;tastytea&lt;/a&gt;.&lt;br&gt;Licence GPLv3: &lt;a href=&quot;https://www.gnu.org/licenses/gpl-3.0.html&quot;&gt;GNU GPL version 3&lt;/a&gt;.&lt;br&gt;This program comes with ABSOLUTELY NO WARRANTY. This is free software, and you are welcome to redistribute it under certain conditions.&lt;/small&gt;&lt;/p&gt;</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/interface_qt.cpp" line="347"/>
<location filename="../src/interface_qt.cpp" line="364"/>
<source>Receipts:</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>Text</name>
<message>
<location filename="../src/interface_text.cpp" line="51"/>
<source>Blocked or silenced?</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/interface_text.cpp" line="68"/>
<source>Add receipt? [y/n]</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/interface_text.cpp" line="69"/>
<source>y</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/interface_text.cpp" line="69"/>
<source>Y</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/interface_text.cpp" line="71"/>
<source>Receipt</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/interface_text.cpp" line="75"/>
<source>Receipt added.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/interface_text.cpp" line="78"/>
<source>n</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/interface_text.cpp" line="78"/>
<source>N</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/interface_text.cpp" line="91"/>
<location filename="../src/interface_text.cpp" line="115"/>
<location filename="../src/interface_text.cpp" line="175"/>
<location filename="../src/interface_text.cpp" line="206"/>
<source>User or instance</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/interface_text.cpp" line="102"/>
<source>Reason</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/interface_text.cpp" line="106"/>
<source>added.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/interface_text.cpp" line="118"/>
<source>A blank line keeps the former value.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/interface_text.cpp" line="119"/>
<source>Change user or instance to</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/interface_text.cpp" line="135"/>
<source>Old reason was:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/interface_text.cpp" line="136"/>
<source>Change reason to</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/interface_text.cpp" line="145"/>
<source>Old receipt was:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/interface_text.cpp" line="146"/>
<source>Change receipt to</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/interface_text.cpp" line="168"/>
<source>Could not remove</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/interface_text.cpp" line="179"/>
<source>removed.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/interface_text.cpp" line="192"/>
<source> Blocked:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/interface_text.cpp" line="196"/>
<source>Silenced:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/interface_text.cpp" line="198"/>
<source>because:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/interface_text.cpp" line="211"/>
<source>is</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/interface_text.cpp" line="214"/>
<source>blocked, because:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/interface_text.cpp" line="218"/>
<source>silenced, because:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/interface_text.cpp" line="224"/>
<source>Receipts:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/interface_text.cpp" line="236"/>
<source>Type add, edit, remove, view or details. Or just the first letter.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/interface_text.cpp" line="239"/>
<source>Type help or h to show this help. Type quit or q to quit the program.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/interface_text.cpp" line="248"/>
<source>This is Whyblocked</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/interface_text.cpp" line="299"/>
<source>Response not understood.</source>
<translation type="unfinished"></translation>
</message>
</context>
</TS>

Loading…
Cancel
Save