Commit d4adf92f authored by Simon Depiets's avatar Simon Depiets
Browse files

Coding style

parent cc83fa26
......@@ -373,13 +373,11 @@ void updateHeader(QString& header,
Project::LangSource projLangSource = Project::instance()->languageSource();
QString projLT = Project::instance()->projLangTeam();
if (projLangSource == Project::LangSource::Project) {
temp = QStringLiteral("Language-Team: ")+projLT+QStringLiteral("\\n");
}
else if ((projLangSource == Project::LangSource::Application) && (Settings::overrideLangTeam())) {
temp = QStringLiteral("Language-Team: ")+Settings::userLangTeam()+QStringLiteral("\\n");
}
else {
temp = QStringLiteral("Language-Team: ")+language+QStringLiteral(" <")+mailingList+QStringLiteral(">\\n");
temp = QStringLiteral("Language-Team: ") + projLT + QStringLiteral("\\n");
} else if ((projLangSource == Project::LangSource::Application) && (Settings::overrideLangTeam())) {
temp = QStringLiteral("Language-Team: ") + Settings::userLangTeam() + QStringLiteral("\\n");
} else {
temp = QStringLiteral("Language-Team: ") + language + QStringLiteral(" <") + mailingList + QStringLiteral(">\\n");
}
if (Q_LIKELY(found))
(*ait) = temp;
......
......@@ -244,7 +244,7 @@ void CatalogView::fillFilterOptionsMenu()
}
if (!extStates)
m_filterOptionsMenu->addSeparator();
for (int i = -1; i < CatalogTreeModel::DisplayedColumnCount-1; ++i) {
for (int i = -1; i < CatalogTreeModel::DisplayedColumnCount - 1; ++i) {
txt = columnsMenu->addAction((i == -1) ? i18nc("@item:inmenu all columns", "All") :
m_model->headerData(i, Qt::Horizontal, Qt::DisplayRole).toString());
txt->setData(-i - 2);
......
......@@ -117,26 +117,26 @@ QVariant CatalogTreeModel::headerData(int section, Qt::Orientation /*orientation
return QVariant();
switch (static_cast<CatalogModelColumns>(section)) {
case CatalogModelColumns::Key:
return i18nc("@title:column", "Entry");
case CatalogModelColumns::Source:
return i18nc("@title:column Original text", "Source");
case CatalogModelColumns::Target:
return i18nc("@title:column Text in target language", "Target");
case CatalogModelColumns::Notes:
return i18nc("@title:column", "Notes");
case CatalogModelColumns::Context:
return i18nc("@title:column", "Context");
case CatalogModelColumns::Files:
return i18nc("@title:column", "Files");
case CatalogModelColumns::TranslationStatus:
return i18nc("@title:column", "Translation Status");
case CatalogModelColumns::SourceLength:
return i18nc("@title:column Length of the original text", "Source length");
case CatalogModelColumns::TargetLength:
return i18nc("@title:column Length of the text in target language", "Target length");
default:
return {};
case CatalogModelColumns::Key:
return i18nc("@title:column", "Entry");
case CatalogModelColumns::Source:
return i18nc("@title:column Original text", "Source");
case CatalogModelColumns::Target:
return i18nc("@title:column Text in target language", "Target");
case CatalogModelColumns::Notes:
return i18nc("@title:column", "Notes");
case CatalogModelColumns::Context:
return i18nc("@title:column", "Context");
case CatalogModelColumns::Files:
return i18nc("@title:column", "Files");
case CatalogModelColumns::TranslationStatus:
return i18nc("@title:column", "Translation Status");
case CatalogModelColumns::SourceLength:
return i18nc("@title:column Length of the original text", "Source length");
case CatalogModelColumns::TargetLength:
return i18nc("@title:column Length of the text in target language", "Target length");
default:
return {};
}
}
......@@ -169,12 +169,12 @@ QVariant CatalogTreeModel::data(const QModelIndex& index, int role) const
}
switch (getTranslationStatus(index.row())) {
case TranslationStatus::Ready:
return i18nc("@info:status 'non-fuzzy' in gettext terminology", "Ready");
case TranslationStatus::NeedsReview:
return i18nc("@info:status 'fuzzy' in gettext terminology", "Needs review");
case TranslationStatus::Untranslated:
return i18nc("@info:status", "Untranslated");
case TranslationStatus::Ready:
return i18nc("@info:status 'non-fuzzy' in gettext terminology", "Ready");
case TranslationStatus::NeedsReview:
return i18nc("@info:status 'fuzzy' in gettext terminology", "Needs review");
case TranslationStatus::Untranslated:
return i18nc("@info:status", "Untranslated");
}
} else if (role == Qt::DecorationRole) {
if (column != CatalogModelColumns::TranslationStatus) {
......@@ -182,27 +182,27 @@ QVariant CatalogTreeModel::data(const QModelIndex& index, int role) const
}
switch (getTranslationStatus(index.row())) {
case TranslationStatus::Ready:
return QIcon::fromTheme("emblem-checked");
case TranslationStatus::NeedsReview:
return QIcon::fromTheme("emblem-question");
case TranslationStatus::Untranslated:
return QIcon::fromTheme("emblem-unavailable");
case TranslationStatus::Ready:
return QIcon::fromTheme("emblem-checked");
case TranslationStatus::NeedsReview:
return QIcon::fromTheme("emblem-question");
case TranslationStatus::Untranslated:
return QIcon::fromTheme("emblem-unavailable");
}
} else if (role == Qt::UserRole) {
switch (column) {
case CatalogModelColumns::TranslationStatus:
return m_catalog->isApproved(index.row());
case CatalogModelColumns::IsEmpty:
return m_catalog->isEmpty(index.row());
case CatalogModelColumns::State:
return int(m_catalog->state(index.row()));
case CatalogModelColumns::IsModified:
return m_catalog->isModified(index.row());
case CatalogModelColumns::IsPlural:
return m_catalog->isPlural(index.row());
default:
role = Qt::DisplayRole;
case CatalogModelColumns::TranslationStatus:
return m_catalog->isApproved(index.row());
case CatalogModelColumns::IsEmpty:
return m_catalog->isEmpty(index.row());
case CatalogModelColumns::State:
return int(m_catalog->state(index.row()));
case CatalogModelColumns::IsModified:
return m_catalog->isModified(index.row());
case CatalogModelColumns::IsPlural:
return m_catalog->isPlural(index.row());
default:
role = Qt::DisplayRole;
}
} else if (role == StringFilterRole) { //exclude UI strings
if (column >= CatalogModelColumns::TranslationStatus)
......@@ -225,28 +225,28 @@ QVariant CatalogTreeModel::data(const QModelIndex& index, int role) const
switch (column) {
case CatalogModelColumns::Key:
return index.row() + 1;
case CatalogModelColumns::Source:
return m_catalog->msgidWithPlurals(index.row(), true);
case CatalogModelColumns::Target:
return m_catalog->msgstrWithPlurals(index.row(), true);
case CatalogModelColumns::Notes: {
QString result;
foreach (const Note &note, m_catalog->notes(index.row()))
result += note.content;
return result;
}
case CatalogModelColumns::Context:
return m_catalog->context(index.row());
case CatalogModelColumns::Files:
return m_catalog->sourceFiles(index.row()).join('|');
case CatalogModelColumns::SourceLength:
return m_catalog->msgidWithPlurals(index.row(), false).length();
case CatalogModelColumns::TargetLength:
return m_catalog->msgstrWithPlurals(index.row(), false).length();
default:
return {};
case CatalogModelColumns::Key:
return index.row() + 1;
case CatalogModelColumns::Source:
return m_catalog->msgidWithPlurals(index.row(), true);
case CatalogModelColumns::Target:
return m_catalog->msgstrWithPlurals(index.row(), true);
case CatalogModelColumns::Notes: {
QString result;
foreach (const Note &note, m_catalog->notes(index.row()))
result += note.content;
return result;
}
case CatalogModelColumns::Context:
return m_catalog->context(index.row());
case CatalogModelColumns::Files:
return m_catalog->sourceFiles(index.row()).join('|');
case CatalogModelColumns::SourceLength:
return m_catalog->msgidWithPlurals(index.row(), false).length();
case CatalogModelColumns::TargetLength:
return m_catalog->msgstrWithPlurals(index.row(), false).length();
default:
return {};
}
}
......
......@@ -91,7 +91,7 @@ bool Glossary::load(const QString& newPath)
}
QXmlSimpleReader reader;
reader.setFeature("http://qt-project.org/xml/features/report-whitespace-only-CharData",true);
reader.setFeature("http://qt-project.org/xml/features/report-whitespace-only-CharData", true);
reader.setFeature("http://xml.org/sax/features/namespaces", false);
QXmlInputSource source(device);
......
......@@ -35,7 +35,7 @@ LanguageToolGrammarError::~LanguageToolGrammarError()
QString LanguageToolGrammarError::parse(const QJsonObject &obj, const QString &text)
{
QString mError = obj[QStringLiteral("message")].toString();
int mStart = obj[QStringLiteral("offset")].toInt(-1);
int mLength = obj[QStringLiteral("length")].toInt(-1);
......
......@@ -53,7 +53,7 @@ QNetworkAccessManager *LanguageToolManager::networkAccessManager() const
QString LanguageToolManager::languageToolCheckPath() const
{
return (Settings::self()->languageToolCustom() ?
Settings::self()->languageToolInstancePath() :
QStringLiteral("https://languagetool.org/api/v2")
) + QStringLiteral("/check");
Settings::self()->languageToolInstancePath() :
QStringLiteral("https://languagetool.org/api/v2")
) + QStringLiteral("/check");
}
......@@ -89,7 +89,7 @@ void LanguageToolResultJob::start()
void LanguageToolResultJob::slotFinish(QNetworkReply *reply)
{
if (reply->error() != QNetworkReply::NoError) {
qCWarning(LOKALIZE_LOG) << " Error reply - "<<reply->errorString();
qCWarning(LOKALIZE_LOG) << " Error reply - " << reply->errorString();
Q_EMIT error(reply->errorString());
}
}
......
......@@ -589,8 +589,7 @@ bool LokalizeMainWindow::closeProject()
m_fileToEditor.remove(static_cast<EditorTab*>(subwindow->widget())->currentFilePath());//safety
m_mdiArea->removeSubWindow(subwindow);
subwindow->deleteLater();
}
else if (subwindow == m_projectSubWindow && m_projectSubWindow)
} else if (subwindow == m_projectSubWindow && m_projectSubWindow)
static_cast<ProjectTab*>(m_projectSubWindow->widget())->showWelcomeScreen();
}
Project::instance()->load(QString());
......
......@@ -124,11 +124,11 @@ void SettingsController::showSettingsDialog()
Ui_prefs_general ui_prefs_general;
ui_prefs_general.setupUi(w);
connect(ui_prefs_general.kcfg_CustomEditorEnabled, &QCheckBox::toggled, ui_prefs_general.kcfg_CustomEditorCommand, &QLineEdit::setEnabled);
ui_prefs_general.kcfg_CustomEditorCommand->setEnabled(Settings::self()->customEditorEnabled());
ui_prefs_general.kcfg_CustomEditorCommand->setEnabled(Settings::self()->customEditorEnabled());
//Set here to avoid I18N_ARGUMENT_MISSING if set in ui file
ui_prefs_general.kcfg_CustomEditorCommand->setToolTip(i18n(
"The following parameters are available\n%1 - Path of the source file\n%2 - Line number"
,QStringLiteral("%1"),QStringLiteral("%2")));
"The following parameters are available\n%1 - Path of the source file\n%2 - Line number"
, QStringLiteral("%1"), QStringLiteral("%2")));
dialog->addPage(w, i18nc("@title:tab", "General"), "preferences-system-windows");
//Editor
......@@ -313,9 +313,11 @@ void SettingsController::projectConfigure()
auto kcfg_ProjLangTeam = ui_prefs_projectmain.kcfg_ProjLangTeam;
connect(ui_prefs_projectmain.kcfg_LanguageSource, static_cast<void(KComboBox::*)(int)>(&KComboBox::currentIndexChanged),
this, [kcfg_ProjLangTeam](int index) { kcfg_ProjLangTeam->setEnabled(static_cast<Project::LangSource>(index) == Project::LangSource::Project); });
this, [kcfg_ProjLangTeam](int index) {
kcfg_ProjLangTeam->setEnabled(static_cast<Project::LangSource>(index) == Project::LangSource::Project);
});
connect(ui_prefs_projectmain.kcfg_LanguageSource, static_cast<void(KComboBox::*)(const QString &)>(&KComboBox::currentIndexChanged),
this, [kcfg_ProjLangTeam] { kcfg_ProjLangTeam->setFocus(); });
this, [kcfg_ProjLangTeam] { kcfg_ProjLangTeam->setFocus(); });
......
......@@ -507,42 +507,42 @@ QVariant ProjectModel::headerData(int section, Qt::Orientation, int role) const
switch (role) {
case Qt::TextAlignmentRole: {
switch (column) {
// Align numeric columns to the right and other columns to the left
// Qt::AlignAbsolute is needed for RTL languages, ref. https://phabricator.kde.org/D13098
case ProjectModelColumns::TotalCount:
case ProjectModelColumns::TranslatedCount:
case ProjectModelColumns::FuzzyCount:
case ProjectModelColumns::UntranslatedCount:
case ProjectModelColumns::IncompleteCount:
return QVariant(Qt::AlignRight | Qt::AlignAbsolute);
default:
return QVariant(Qt::AlignLeft);
// Align numeric columns to the right and other columns to the left
// Qt::AlignAbsolute is needed for RTL languages, ref. https://phabricator.kde.org/D13098
case ProjectModelColumns::TotalCount:
case ProjectModelColumns::TranslatedCount:
case ProjectModelColumns::FuzzyCount:
case ProjectModelColumns::UntranslatedCount:
case ProjectModelColumns::IncompleteCount:
return QVariant(Qt::AlignRight | Qt::AlignAbsolute);
default:
return QVariant(Qt::AlignLeft);
}
}
case Qt::DisplayRole: {
switch (column) {
case ProjectModelColumns::FileName:
return i18nc("@title:column File name", "Name");
case ProjectModelColumns::Graph:
return i18nc("@title:column Graphical representation of Translated/Fuzzy/Untranslated counts", "Graph");
case ProjectModelColumns::TotalCount:
return i18nc("@title:column Number of entries", "Total");
case ProjectModelColumns::TranslatedCount:
return i18nc("@title:column Number of entries", "Translated");
case ProjectModelColumns::FuzzyCount:
return i18nc("@title:column Number of entries", "Not ready");
case ProjectModelColumns::UntranslatedCount:
return i18nc("@title:column Number of entries", "Untranslated");
case ProjectModelColumns::IncompleteCount:
return i18nc("@title:column Number of fuzzy or untranslated entries", "Incomplete");
case ProjectModelColumns::TranslationDate:
return i18nc("@title:column", "Last Translation");
case ProjectModelColumns::SourceDate:
return i18nc("@title:column", "Template Revision");
case ProjectModelColumns::LastTranslator:
return i18nc("@title:column", "Last Translator");
default:
return {};
case ProjectModelColumns::FileName:
return i18nc("@title:column File name", "Name");
case ProjectModelColumns::Graph:
return i18nc("@title:column Graphical representation of Translated/Fuzzy/Untranslated counts", "Graph");
case ProjectModelColumns::TotalCount:
return i18nc("@title:column Number of entries", "Total");
case ProjectModelColumns::TranslatedCount:
return i18nc("@title:column Number of entries", "Translated");
case ProjectModelColumns::FuzzyCount:
return i18nc("@title:column Number of entries", "Not ready");
case ProjectModelColumns::UntranslatedCount:
return i18nc("@title:column Number of entries", "Untranslated");
case ProjectModelColumns::IncompleteCount:
return i18nc("@title:column Number of fuzzy or untranslated entries", "Incomplete");
case ProjectModelColumns::TranslationDate:
return i18nc("@title:column", "Last Translation");
case ProjectModelColumns::SourceDate:
return i18nc("@title:column", "Template Revision");
case ProjectModelColumns::LastTranslator:
return i18nc("@title:column", "Last Translator");
default:
return {};
}
}
default:
......@@ -646,28 +646,28 @@ QVariant ProjectModel::data(const QModelIndex& index, const int role) const
return ProjectModel::headerData(index.column(), Qt::Horizontal, role); // Use same alignment as header
case Qt::DisplayRole:
switch (column) {
case ProjectModelColumns::FileName:
return item.text();
case ProjectModelColumns::Graph:
return hasStats ? QRect(translated, untranslated, fuzzy, 0) : QVariant();
case ProjectModelColumns::TotalCount:
return hasStats ? (translated + untranslated + fuzzy) : QVariant();
case ProjectModelColumns::TranslatedCount:
return hasStats ? translated : QVariant();
case ProjectModelColumns::FuzzyCount:
return hasStats ? fuzzy : QVariant();
case ProjectModelColumns::UntranslatedCount:
return hasStats ? untranslated : QVariant();
case ProjectModelColumns::IncompleteCount:
return hasStats ? (untranslated + fuzzy) : QVariant();
case ProjectModelColumns::SourceDate:
return node->metaData.sourceDate;
case ProjectModelColumns::TranslationDate:
return node->metaData.translationDate;
case ProjectModelColumns::LastTranslator:
return node->metaData.lastTranslator;
default:
return {};
case ProjectModelColumns::FileName:
return item.text();
case ProjectModelColumns::Graph:
return hasStats ? QRect(translated, untranslated, fuzzy, 0) : QVariant();
case ProjectModelColumns::TotalCount:
return hasStats ? (translated + untranslated + fuzzy) : QVariant();
case ProjectModelColumns::TranslatedCount:
return hasStats ? translated : QVariant();
case ProjectModelColumns::FuzzyCount:
return hasStats ? fuzzy : QVariant();
case ProjectModelColumns::UntranslatedCount:
return hasStats ? untranslated : QVariant();
case ProjectModelColumns::IncompleteCount:
return hasStats ? (untranslated + fuzzy) : QVariant();
case ProjectModelColumns::SourceDate:
return node->metaData.sourceDate;
case ProjectModelColumns::TranslationDate:
return node->metaData.translationDate;
case ProjectModelColumns::LastTranslator:
return node->metaData.lastTranslator;
default:
return {};
}
case Qt::ToolTipRole:
if (column == ProjectModelColumns::FileName) {
......@@ -754,8 +754,8 @@ KFileItem ProjectModel::itemForIndex(const QModelIndex& index) const
qCInfo(LOKALIZE_LOG) << "returning empty KFileItem()" << index.parent().data().toString();
qCInfo(LOKALIZE_LOG) << "returning empty KFileItem()" << index.internalPointer();
qCInfo(LOKALIZE_LOG) << "returning empty KFileItem()" <<
static_cast<ProjectNode*>(index.internalPointer())->metaData.untranslated <<
static_cast<ProjectNode*>(index.internalPointer())->metaData.sourceDate;
static_cast<ProjectNode*>(index.internalPointer())->metaData.untranslated <<
static_cast<ProjectNode*>(index.internalPointer())->metaData.sourceDate;
return KFileItem();
}
......
......@@ -362,12 +362,12 @@ void ProjectTab::openFile()
+ QStringLiteral("\n\n")
+ i18n("Are you sure you want to open this many files?");
auto yes = KGuiItem(
i18np("&Open %1 File", "&Open %1 Files", i),
QStringLiteral("document-open")
);
i18np("&Open %1 File", "&Open %1 Files", i),
QStringLiteral("document-open")
);
const int answer = KMessageBox::warningYesNo(
this, text, caption, yes, KStandardGuiItem::cancel()
);
this, text, caption, yes, KStandardGuiItem::cancel()
);
if (answer != KMessageBox::Yes) {
return;
}
......
......@@ -130,7 +130,8 @@ void PoItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option
// Temporary workaround for Qt bug https://bugreports.qt.io/browse/QTBUG-78094
// to ensure that large numbers are formatted using a thousands separator
QString PoItemDelegate::displayText(const QVariant & value, const QLocale & locale) const {
QString PoItemDelegate::displayText(const QVariant & value, const QLocale & locale) const
{
return QStyledItemDelegate::displayText(value, QLocale::system());
}
......
......@@ -36,19 +36,19 @@ private Q_SLOTS:
void GettextHeaderTest::testFormatDate()
{
QCOMPARE(formatGettextDate(
QDateTime(QDate(2006, 8, 3), QTime(7, 31, 32), Qt::UTC)), "2006-08-03 07:31+0000");
QDateTime(QDate(2006, 8, 3), QTime(7, 31, 32), Qt::UTC)), "2006-08-03 07:31+0000");
QCOMPARE(formatGettextDate(
QDateTime(QDate(2006, 8, 3), QTime(7, 31, 32), QTimeZone("Europe/Moscow"))), "2006-08-03 07:31+0400");
QDateTime(QDate(2006, 8, 3), QTime(7, 31, 32), QTimeZone("Europe/Moscow"))), "2006-08-03 07:31+0400");
QCOMPARE(formatGettextDate(
QDateTime(QDate(2018, 8, 3), QTime(7, 31, 32), QTimeZone("Europe/Moscow"))), "2018-08-03 07:31+0300");
QDateTime(QDate(2018, 8, 3), QTime(7, 31, 32), QTimeZone("Europe/Moscow"))), "2018-08-03 07:31+0300");
QCOMPARE(formatGettextDate(
QDateTime(QDate(2018, 8, 3), QTime(7, 31, 32), QTimeZone("America/New_York"))), "2018-08-03 07:31-0400");
QDateTime(QDate(2018, 8, 3), QTime(7, 31, 32), QTimeZone("America/New_York"))), "2018-08-03 07:31-0400");
QCOMPARE(formatGettextDate(
QDateTime(QDate(2018, 8, 3), QTime(7, 31, 32), QTimeZone(-14 * 3600))), "2018-08-03 07:31-1400");
QDateTime(QDate(2018, 8, 3), QTime(7, 31, 32), QTimeZone(-14 * 3600))), "2018-08-03 07:31-1400");
QCOMPARE(formatGettextDate(
QDateTime(QDate(2018, 8, 3), QTime(7, 31, 32), QTimeZone(14 * 3600))), "2018-08-03 07:31+1400");
QDateTime(QDate(2018, 8, 3), QTime(7, 31, 32), QTimeZone(14 * 3600))), "2018-08-03 07:31+1400");
QCOMPARE(formatGettextDate(
QDateTime(QDate(2018, 8, 3), QTime(7, 31, 32), QTimeZone("Asia/Kolkata"))), "2018-08-03 07:31+0530");
QDateTime(QDate(2018, 8, 3), QTime(7, 31, 32), QTimeZone("Asia/Kolkata"))), "2018-08-03 07:31+0530");
}
QTEST_GUILESS_MAIN(GettextHeaderTest)
......
......@@ -29,7 +29,7 @@
class ProjectModelTest : public QObject
{
Q_OBJECT
Q_OBJECT
private Q_SLOTS:
void testInvalid();
......@@ -43,7 +43,7 @@ void ProjectModelTest::testInvalid()
connect(model, &ProjectModel::loadingFinished, [&loaded]() {
loaded.fetchAndAddRelaxed(1);
});
connect(model, &ProjectModel::totalsChanged, [=](int fuzzy, int translated, int untranslated, bool done) {
connect(model, &ProjectModel::totalsChanged, [ = ](int fuzzy, int translated, int untranslated, bool done) {
QCOMPARE(fuzzy, 0);
QCOMPARE(translated, 0);
QCOMPARE(untranslated, 0);
......@@ -77,7 +77,7 @@ void ProjectModelTest::testHalfTranslated()
connect(model, &ProjectModel::loadingFinished, [&loaded]() {
loaded.fetchAndAddRelaxed(1);
});
connect(model, &ProjectModel::totalsChanged, [=](int fuzzy, int translated, int untranslated, bool done) {
connect(model, &ProjectModel::totalsChanged, [ = ](int fuzzy, int translated, int untranslated, bool done) {
QCOMPARE(fuzzy, 1);
QCOMPARE(translated, 3);
QCOMPARE(untranslated, 2);
......
......@@ -176,8 +176,7 @@ void TranslationUnitTextEdit::fileLoaded()
if (m_highlighter->currentLanguage() != langLocale.name() || m_highlighter->currentLanguage().isEmpty()) {
m_highlighter->setCurrentLanguage(langCode);
//qCWarning(LOKALIZE_LOG) << "Attempting to set highlighting for " << m_part << " as " << langCode;
if (m_highlighter->currentLanguage() != langCode && langCode.length() > 2)
{
if (m_highlighter->currentLanguage() != langCode && langCode.length() > 2) {
m_highlighter->setCurrentLanguage(langCode.left(2));
//qCWarning(LOKALIZE_LOG) << "Attempting to set highlighting for " << m_part << " as " << langCode.left(2);
}
......@@ -311,8 +310,7 @@ 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)
{
if (Settings::self()->languageToolDelay() > 0) {
m_languageToolTimer->start(Settings::self()->languageToolDelay() * 1000);
}
}
......@@ -534,8 +532,7 @@ void insertContent(QTextCursor& cursor, const CatalogString& catStr, const Catal
m_completionBox->hide();
//qCWarning(LOKALIZE_LOG)<<"finish";
//Start LanguageToolTimer
if (Settings::self()->languageToolDelay() > 0)
{
if (Settings::self()->languageToolDelay() > 0) {
m_languageToolTimer->start(Settings::self()->languageToolDelay() * 1000);
}
}
......@@ -1041,8 +1038,7 @@ void insertContent(QTextCursor& cursor, const CatalogString& catStr, const Catal
// QAction* spellchecking=menu.addAction();
// event->accept();
}
void TranslationUnitTextEdit::zoomRequestedSlot(qreal fontSize)
{
void TranslationUnitTextEdit::zoomRequestedSlot(qreal fontSize) {
QFont curFont = font();
curFont.setPointSizeF(fontSize);
setFont(curFont);
......@@ -1058,10 +1054,8 @@ void insertContent(QTextCursor& cursor, const CatalogString& catStr, const Catal
return;
}
if (m_part == DocPosition::Source || !Settings::mouseWheelGo())
{
if (event->modifiers() == Qt::ControlModifier)
{
if (m_part == DocPosition::Source || !Settings::mouseWheelGo()) {
if (event->modifiers() == Qt::ControlModifier) {
float delta = event->angleDelta().y() / 120.f;
zoomInF(delta);
//Also zoom in the target
......@@ -1153,16 +1147,14 @@ void insertContent(QTextCursor& cursor, const CatalogString& catStr, const Catal
return KTextEdit::event(event);
}
void TranslationUnitTextEdit::slotLanguageToolFinished(const QString &result)
{
void TranslationUnitTextEdit::slotLanguageToolFinished(const QString & result) {
LanguageToolParser parser;
const QJsonDocument doc = QJsonDocument::fromJson(result.toUtf8());
const QJsonObject fields = doc.object();
emit languageToolChanged(parser.parseResult(fields, toPlainText()));
}
void TranslationUnitTextEdit::slotLanguageToolError(const QString &str)
{
void TranslationUnitTextEdit::slotLanguageToolError(const QString & str) {
emit languageToolChanged(i18n("An error was reported: %1", str));
}
......
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