Skip to content

Commit 8742d6b

Browse files
dl3sdolpechacek
authored andcommitted
Use function Symbol::getNumberAndPlainTextName()
Use function Symbol::getNumberAndPlainTextName() which was introduced by OpenOrienteeringGH-2125 instead of concatenating symbol number and symbol name.
1 parent 0c9f1cd commit 8742d6b

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
@@ -186,9 +186,7 @@ class HTMLSymbolReportGenerator
186186

187187
QString makeSymbolRow(const Symbol& s)
188188
{
189-
auto label = QString { s.getNumberAsString()
190-
+ QChar::Space
191-
+ QTextDocumentFragment::fromHtml(s.getName()).toPlainText() };
189+
auto label = s.getNumberAndPlainTextName();
192190
auto extra_text = QString{};
193191
if (s.isRotatable())
194192
extra_text += QCoreApplication::translate("LibreMapper::SymbolReport", "[X] %1")

src/gui/map/map_editor.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2423,7 +2423,7 @@ void MapEditorController::selectedSymbolsChanged()
24232423
symbol_button->setMenu(mobile_symbol_button_menu);
24242424
const auto actions = mobile_symbol_button_menu->actions();
24252425
int i = 0;
2426-
actions[i]->setText(symbol->getNumberAsString() + QLatin1Char(' ') + symbol->getPlainTextName());
2426+
actions[i]->setText(symbol->getNumberAndPlainTextName());
24272427
actions[++i]->setVisible(!symbol->getDescription().isEmpty());
24282428
++i; // separator
24292429
actions[++i]->setChecked(symbol->isHidden());
@@ -2448,7 +2448,7 @@ void MapEditorController::selectedSymbolsChanged()
24482448
}
24492449

24502450
if (symbol)
2451-
window->showStatusBarMessage(symbol->getNumberAsString() + QLatin1Char(' ') + symbol->getPlainTextName(), 1000);
2451+
window->showStatusBarMessage(symbol->getNumberAndPlainTextName(), 1000);
24522452
}
24532453

24542454
// Even when the symbol (pointer) hasn't changed,
@@ -2622,7 +2622,7 @@ void MapEditorController::updateObjectDependentActions()
26222622
bool const boolean_prerequisite = first_selected_is_path && num_selected_paths >= 2;
26232623
QString const extra_status_tip = QLatin1Char(' ') +
26242624
( boolean_prerequisite
2625-
? tr("Resulting symbol: %1 %2.").arg(first_selected_symbol->getNumberAsString(), first_selected_symbol->getPlainTextName())
2625+
? tr("Resulting symbol: %1.").arg(first_selected_symbol->getNumberAndPlainTextName())
26262626
: tr("Select at least two area or path objects activate this tool.") );
26272627
boolean_union_act->setEnabled(boolean_prerequisite);
26282628
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
@@ -225,7 +225,7 @@ bool ColorListWidget::confirmColorDeletion(const MapColor* color_to_be_removed)
225225
if (symbol->getType() == Symbol::NoSymbol)
226226
return;
227227
if (symbol->containsColor(color_to_be_removed))
228-
direct_usage += symbol->getNumberAsString() + QChar::Space + symbol->getPlainTextName() + QChar::LineFeed;
228+
direct_usage += symbol->getNumberAndPlainTextName() + QChar::LineFeed;
229229
else
230230
remaining_symbols.push_back(symbol);
231231
}
@@ -265,7 +265,7 @@ bool ColorListWidget::confirmColorDeletion(const MapColor* color_to_be_removed)
265265
{
266266
if (symbol->containsColor(color))
267267
{
268-
transitive_usage += symbol->getNumberAsString() + QChar::Space + symbol->getPlainTextName() + QChar::LineFeed;
268+
transitive_usage += symbol->getNumberAndPlainTextName() + QChar::LineFeed;
269269
break;
270270
}
271271
}

test/file_format_t.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -151,8 +151,8 @@ namespace
151151
auto const fill_a = QString().fill(QChar::Space, +diff); \
152152
auto const fill_b = QString().fill(QChar::Space, -diff); \
153153
QFAIL(QString::fromLatin1( \
154-
"Compared values are not the same (%1 %2)\n Actual (%3)%4: %7\n Expected (%5)%6: %8") \
155-
.arg((symbol).getNumberAsString(), (symbol).getPlainTextName(), \
154+
"Compared values are not the same (%1)\n Actual (%2)%3: %6\n Expected (%4)%5: %7") \
155+
.arg((symbol).getNumberAndPlainTextName(), \
156156
QString::fromUtf8(#a), fill_a, \
157157
QString::fromUtf8(#b), fill_b) \
158158
.arg(a).arg(b) \
@@ -172,8 +172,7 @@ namespace
172172
#define VERIFY_SYMBOL_PROPERTY(cond, symbol) \
173173
if (cond) \
174174
{ \
175-
QVERIFY2(cond, QByteArray((symbol).getNumberAsString().toUtf8() + ' ' \
176-
+ (symbol).getPlainTextName().toUtf8())); \
175+
QVERIFY2(cond, QByteArray((symbol).getNumberAndPlainTextName().toUtf8())); \
177176
} \
178177
else \
179178
{ \
@@ -398,7 +397,7 @@ namespace
398397
if (actual)
399398
fuzzyCompareSymbol(*actual, *expected, format_id);
400399
else
401-
QFAIL(qPrintable(QString::fromLatin1("Missing symbol: %1 %2").arg(expected->getNumberAsString(), expected->getPlainTextName())));
400+
QFAIL(qPrintable(QString::fromLatin1("Missing symbol: %1").arg(expected->getNumberAndPlainTextName())));
402401
}
403402

404403
/**

0 commit comments

Comments
 (0)