Commit 48bb636f authored by Simon Depiets's avatar Simon Depiets
Browse files

Add auto language tool check after X seconds of wait

parent ccdff871
......@@ -72,7 +72,8 @@ int main(int argc, char **argv)
about.addCredit(i18n("Google Inc."), i18n("sponsored development as part of Google Summer Of Code program"), QString(), QStringLiteral("https://google.com"));
about.addCredit(i18n("NLNet Foundation"), i18n("sponsored XLIFF-related work"), QString(), QStringLiteral("https://nlnet.nl/"));
about.addCredit(i18n("Translate-toolkit"), i18n("provided excellent cross-format converting scripts"), QString(), QStringLiteral("https://toolkit.translatehouse.org"));
about.addCredit(i18n("Viesturs Zarins"), i18n("project tree merging translation+templates"), QStringLiteral("viesturs.zarins@mii.lu.lv"), QString());
about.addCredit(i18n("LanguageTool"), i18n("grammar, style and spell checker"), QString(), QStringLiteral("https://toolkit.translatehouse.org"));
about.addCredit(i18n("Viesturs Zarins"), i18n("project tree merging translation+templates"), QStringLiteral("https://languagetool.org"), QString());
about.addCredit(i18n("Stephan Johach"), i18n("bug fixing patches"), QStringLiteral("hunsum@gmx.de"));
about.addCredit(i18n("Chusslove Illich"), i18n("bug fixing patches"), QStringLiteral("caslav.ilic@gmx.net"));
about.addCredit(i18n("Jure Repinc"), i18n("testing and bug fixing"), QStringLiteral("jlp@holodeck1.com"));
......
......@@ -50,7 +50,7 @@
</item>
</layout>
</item>
<!--<item row="3" column="0">
<item row="3" column="0">
<layout class="QHBoxLayout">
<item>
<widget class="QLabel" name="l1">
......@@ -79,7 +79,7 @@
</widget>
</item>
</layout>
</item>-->
</item>
</layout>
</item>
</layout>
......
......@@ -123,6 +123,7 @@ TranslationUnitTextEdit::TranslationUnitTextEdit(Catalog* catalog, DocPosition::
, m_completionBox(0)
, m_cursorSelectionStart(0)
, m_cursorSelectionEnd(0)
, m_languageToolTimer(new QTimer(this))
{
setReadOnly(part == DocPosition::Source);
setUndoRedoEnabled(false);
......@@ -137,6 +138,7 @@ TranslationUnitTextEdit::TranslationUnitTextEdit(Catalog* catalog, DocPosition::
}
connect(catalog, QOverload<>::of(&Catalog::signalFileLoaded), this, &TranslationUnitTextEdit::fileLoaded);
//connect (Project::instance(), &Project::configChanged, this, &TranslationUnitTextEdit::projectConfigChanged);
connect(m_languageToolTimer, &QTimer::timeout, this, &TranslationUnitTextEdit::launchLanguageTool);
}
void TranslationUnitTextEdit::setSpellCheckingEnabled(bool enable)
......@@ -308,6 +310,10 @@ void TranslationUnitTextEdit::setContent(const CatalogString& catStr, const Cata
else
//reflectApprovementState() does this for Target
m_highlighter->rehighlight(); //explicitly because the signals were disabled
if (Settings::self()->languageToolDelay() > 0)
{
m_languageToolTimer->start(Settings::self()->languageToolDelay() * 1000);
}
}
#if 0
......@@ -526,6 +532,11 @@ void insertContent(QTextCursor& cursor, const CatalogString& catStr, const Catal
} else if (m_completionBox)
m_completionBox->hide();
//qCWarning(LOKALIZE_LOG)<<"finish";
//Start LanguageToolTimer
if (Settings::self()->languageToolDelay() > 0)
{
m_languageToolTimer->start(Settings::self()->languageToolDelay() * 1000);
}
}
......
......@@ -172,6 +172,9 @@ private:
//For text move with mouse
int m_cursorSelectionStart;
int m_cursorSelectionEnd;
//For LanguageTool timer
QTimer* m_languageToolTimer;
};
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment