Skip to content

Commit 9361905

Browse files
dl3sdodg0yt
authored andcommitted
Use function Symbol::getNumberAndPlainTextName()
Use function Symbol::getNumberAndPlainTextName() which was introduced by GH-2125 instead of concatenating symbol number and symbol name.
1 parent 39ca931 commit 9361905

File tree

4 files changed

+10
-13
lines changed

4 files changed

+10
-13
lines changed

src/core/symbols/html_symbol_report.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -198,9 +198,7 @@ class HTMLSymbolReportGenerator
198198

199199
QString makeSymbolRow(const Symbol& s)
200200
{
201-
auto label = QString { s.getNumberAsString()
202-
+ QChar::Space
203-
+ QTextDocumentFragment::fromHtml(s.getName()).toPlainText() };
201+
auto label = s.getNumberAndPlainTextName();
204202
auto extra_text = QString{};
205203
if (s.isRotatable())
206204
extra_text += QCoreApplication::translate("OpenOrienteering::SymbolReport", "[X] %1")

src/gui/map/map_editor.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2431,7 +2431,7 @@ void MapEditorController::selectedSymbolsChanged()
24312431
symbol_button->setMenu(mobile_symbol_button_menu);
24322432
const auto actions = mobile_symbol_button_menu->actions();
24332433
int i = 0;
2434-
actions[i]->setText(symbol->getNumberAsString() + QLatin1Char(' ') + symbol->getPlainTextName());
2434+
actions[i]->setText(symbol->getNumberAndPlainTextName());
24352435
actions[++i]->setVisible(!symbol->getDescription().isEmpty());
24362436
++i; // separator
24372437
actions[++i]->setChecked(symbol->isHidden());
@@ -2456,7 +2456,7 @@ void MapEditorController::selectedSymbolsChanged()
24562456
}
24572457

24582458
if (symbol)
2459-
window->showStatusBarMessage(symbol->getNumberAsString() + QLatin1Char(' ') + symbol->getPlainTextName(), 1000);
2459+
window->showStatusBarMessage(symbol->getNumberAndPlainTextName(), 1000);
24602460
}
24612461

24622462
// Even when the symbol (pointer) hasn't changed,
@@ -2630,7 +2630,7 @@ void MapEditorController::updateObjectDependentActions()
26302630
bool const boolean_prerequisite = first_selected_is_path && num_selected_paths >= 2;
26312631
QString const extra_status_tip = QLatin1Char(' ') +
26322632
( boolean_prerequisite
2633-
? tr("Resulting symbol: %1 %2.").arg(first_selected_symbol->getNumberAsString(), first_selected_symbol->getPlainTextName())
2633+
? tr("Resulting symbol: %1.").arg(first_selected_symbol->getNumberAndPlainTextName())
26342634
: tr("Select at least two area or path objects activate this tool.") );
26352635
boolean_union_act->setEnabled(boolean_prerequisite);
26362636
boolean_union_act->setStatusTip(tr("Unify overlapping objects.") + extra_status_tip);

src/gui/widgets/color_list_widget.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ bool ColorListWidget::confirmColorDeletion(const MapColor* color_to_be_removed)
237237
if (symbol->getType() == Symbol::NoSymbol)
238238
return;
239239
if (symbol->containsColor(color_to_be_removed))
240-
direct_usage += symbol->getNumberAsString() + QChar::Space + symbol->getPlainTextName() + QChar::LineFeed;
240+
direct_usage += symbol->getNumberAndPlainTextName() + QChar::LineFeed;
241241
else
242242
remaining_symbols.push_back(symbol);
243243
}
@@ -277,7 +277,7 @@ bool ColorListWidget::confirmColorDeletion(const MapColor* color_to_be_removed)
277277
{
278278
if (symbol->containsColor(color))
279279
{
280-
transitive_usage += symbol->getNumberAsString() + QChar::Space + symbol->getPlainTextName() + QChar::LineFeed;
280+
transitive_usage += symbol->getNumberAndPlainTextName() + QChar::LineFeed;
281281
break;
282282
}
283283
}

test/file_format_t.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -164,8 +164,8 @@ namespace
164164
auto const fill_a = QString().fill(QChar::Space, +diff); \
165165
auto const fill_b = QString().fill(QChar::Space, -diff); \
166166
QFAIL(QString::fromLatin1( \
167-
"Compared values are not the same (%1 %2)\n Actual (%3)%4: %7\n Expected (%5)%6: %8") \
168-
.arg((symbol).getNumberAsString(), (symbol).getPlainTextName(), \
167+
"Compared values are not the same (%1)\n Actual (%2)%3: %6\n Expected (%4)%5: %7") \
168+
.arg((symbol).getNumberAndPlainTextName(), \
169169
QString::fromUtf8(#a), fill_a, \
170170
QString::fromUtf8(#b), fill_b) \
171171
.arg(a).arg(b) \
@@ -185,8 +185,7 @@ namespace
185185
#define VERIFY_SYMBOL_PROPERTY(cond, symbol) \
186186
if (cond) \
187187
{ \
188-
QVERIFY2(cond, QByteArray((symbol).getNumberAsString().toUtf8() + ' ' \
189-
+ (symbol).getPlainTextName().toUtf8())); \
188+
QVERIFY2(cond, QByteArray((symbol).getNumberAndPlainTextName().toUtf8())); \
190189
} \
191190
else \
192191
{ \
@@ -411,7 +410,7 @@ namespace
411410
if (actual)
412411
fuzzyCompareSymbol(*actual, *expected, format_id);
413412
else
414-
QFAIL(qPrintable(QString::fromLatin1("Missing symbol: %1 %2").arg(expected->getNumberAsString(), expected->getPlainTextName())));
413+
QFAIL(qPrintable(QString::fromLatin1("Missing symbol: %1").arg(expected->getNumberAndPlainTextName())));
415414
}
416415

417416
/**

0 commit comments

Comments
 (0)