From 3e22593ae71f388972a59079ccf6d719f980d035 Mon Sep 17 00:00:00 2001 From: agilob Date: Tue, 10 May 2016 13:41:56 +0100 Subject: [PATCH 1/3] feat(i18n): make Markdown settings translatable --- src/widget/form/settings/generalform.cpp | 5 ----- src/widget/form/settings/generalsettings.ui | 19 +++++++++++++++++-- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/src/widget/form/settings/generalform.cpp b/src/widget/form/settings/generalform.cpp index e35018afa..def6302b5 100644 --- a/src/widget/form/settings/generalform.cpp +++ b/src/widget/form/settings/generalform.cpp @@ -92,9 +92,6 @@ static QStringList langs = {"Arabic", "Türkçe", "Українська", "简体中文"}; -static QStringList mdPrefs = {"Plaintext", - "Show Formatting Characters", - "Don't Show Formatting Characters"}; static QStringList timeFormats = {"hh:mm AP", "hh:mm", "hh:mm:ss AP", "hh:mm:ss"}; // http://doc.qt.io/qt-4.8/qdate.html#fromString @@ -116,8 +113,6 @@ GeneralForm::GeneralForm(SettingsWidget *myParent) : bodyUI->transComboBox->insertItem(i, langs[i]); bodyUI->transComboBox->setCurrentIndex(locales.indexOf(Settings::getInstance().getTranslation())); - for (int i = 0; i < mdPrefs.size(); i++) - bodyUI->markdownComboBox->insertItem(i, mdPrefs[i]); bodyUI->markdownComboBox->setCurrentIndex(Settings::getInstance().getMarkdownPreference()); bodyUI->cbAutorun->setChecked(Settings::getInstance().getAutorun()); diff --git a/src/widget/form/settings/generalsettings.ui b/src/widget/form/settings/generalsettings.ui index 71eb8139d..87c34a3fe 100644 --- a/src/widget/form/settings/generalsettings.ui +++ b/src/widget/form/settings/generalsettings.ui @@ -39,8 +39,8 @@ 0 0 - 1277 - 1272 + 1278 + 1413 @@ -382,6 +382,21 @@ instead of closing itself. Select Markdown preference. + + + Plaintext + + + + + Show formatting characters + + + + + Don't show formatting characters + + From f2aada8f4fd404947ca4fa2d34e00df45c25f76f Mon Sep 17 00:00:00 2001 From: agilob Date: Tue, 10 May 2016 15:33:15 +0100 Subject: [PATCH 2/3] feat(i18n): Make activity by time labels translated by locale --- src/widget/friendlistwidget.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/widget/friendlistwidget.cpp b/src/widget/friendlistwidget.cpp index 707091ad7..2d719f2e7 100644 --- a/src/widget/friendlistwidget.cpp +++ b/src/widget/friendlistwidget.cpp @@ -254,28 +254,30 @@ void FriendListWidget::setMode(Mode mode) currentDate = currentDate.addMonths(-1); } + QLocale *ql = new QLocale(Settings::getInstance().getTranslation()); + CategoryWidget* categoryLast1Month = new CategoryWidget(this); - categoryLast1Month->setName(QDate::longMonthName(currentDate.month())); + categoryLast1Month->setName(ql->monthName(currentDate.month())); activityLayout->addWidget(categoryLast1Month); currentDate = currentDate.addMonths(-1); CategoryWidget* categoryLast2Month = new CategoryWidget(this); - categoryLast2Month->setName(QDate::longMonthName(currentDate.month())); + categoryLast2Month->setName(ql->monthName(currentDate.month())); activityLayout->addWidget(categoryLast2Month); currentDate = currentDate.addMonths(-1); CategoryWidget* categoryLast3Month = new CategoryWidget(this); - categoryLast3Month->setName(QDate::longMonthName(currentDate.month())); + categoryLast3Month->setName(ql->monthName(currentDate.month())); activityLayout->addWidget(categoryLast3Month); currentDate = currentDate.addMonths(-1); CategoryWidget* categoryLast4Month = new CategoryWidget(this); - categoryLast4Month->setName(QDate::longMonthName(currentDate.month())); + categoryLast4Month->setName(ql->monthName(currentDate.month())); activityLayout->addWidget(categoryLast4Month); currentDate = currentDate.addMonths(-1); CategoryWidget* categoryLast5Month = new CategoryWidget(this); - categoryLast5Month->setName(QDate::longMonthName(currentDate.month())); + categoryLast5Month->setName(ql->monthName(currentDate.month())); activityLayout->addWidget(categoryLast5Month); CategoryWidget* categoryOlder = new CategoryWidget(this); @@ -286,6 +288,9 @@ void FriendListWidget::setMode(Mode mode) categoryNever->setName(tr("Unknown", "Category for sorting friends by activity")); activityLayout->addWidget(categoryNever); + delete ql; + ql = 0; + QList friendList = FriendList::getAllFriends(); for (Friend* contact : friendList) { From f1543144be7726a9d2dbb6e04ca9b0a4c1000737 Mon Sep 17 00:00:00 2001 From: Zetok Zalbavar Date: Sat, 14 May 2016 19:57:10 +0100 Subject: [PATCH 3/3] fix(friendlistwidget): use nullptr instead of `0` thanks to @sudden6's suggestion --- src/widget/friendlistwidget.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/widget/friendlistwidget.cpp b/src/widget/friendlistwidget.cpp index 2d719f2e7..f8c8472e6 100644 --- a/src/widget/friendlistwidget.cpp +++ b/src/widget/friendlistwidget.cpp @@ -289,7 +289,7 @@ void FriendListWidget::setMode(Mode mode) activityLayout->addWidget(categoryNever); delete ql; - ql = 0; + ql = nullptr; QList friendList = FriendList::getAllFriends(); for (Friend* contact : friendList)