Todo: Fix a premature ::tr() call

The order of meta object initialization and the call of tr() can be
wrong, and then the Todo plugin is not loaded.

Change-Id: I2d8481892e78af5e04d632c427d55d2a2fd67402
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
Alessandro Portale
2016-05-15 18:49:22 +02:00
parent ec231b5910
commit b9e941105d

View File

@@ -29,11 +29,14 @@
#include <projectexplorer/project.h>
static QString excludePlaceholder()
{
return Todo::Internal::TodoProjectSettingsWidget::tr("<Enter regular expression to exclude>");
}
namespace Todo {
namespace Internal {
static const QString EXCLUDE_PLACEHOLDER = TodoProjectSettingsWidget::tr("<Enter regular expression to exclude>");
TodoProjectSettingsWidget::TodoProjectSettingsWidget(ProjectExplorer::Project *project) :
QWidget(0),
ui(new Ui::TodoProjectSettingsWidget),
@@ -99,9 +102,9 @@ void TodoProjectSettingsWidget::prepareItem(QListWidgetItem *item) const
void TodoProjectSettingsWidget::addExcludedPatternButtonClicked()
{
if (ui->excludedPatternsList->findItems(EXCLUDE_PLACEHOLDER, Qt::MatchFixedString).count())
if (ui->excludedPatternsList->findItems(excludePlaceholder(), Qt::MatchFixedString).count())
return;
ui->excludedPatternsList->editItem(addToExcludedPatternsList(EXCLUDE_PLACEHOLDER));
ui->excludedPatternsList->editItem(addToExcludedPatternsList(excludePlaceholder()));
}
void TodoProjectSettingsWidget::removeExcludedPatternButtonClicked()
@@ -118,7 +121,7 @@ void TodoProjectSettingsWidget::setExcludedPatternsButtonsEnabled()
void TodoProjectSettingsWidget::excludedPatternChanged(QListWidgetItem *item)
{
if (item->text().isEmpty() || item->text() == EXCLUDE_PLACEHOLDER) {
if (item->text().isEmpty() || item->text() == excludePlaceholder()) {
ui->excludedPatternsList->removeItemWidget(item);
delete item;
} else {