Kaydet (Commit) b0dbd78d authored tarafından Jan-Marek Glogowski's avatar Jan-Marek Glogowski

Strip _dark and _svg iconset filenames for display

The new display name code handles _dark and _svg like an property
or extension. It strips both from the back of the base filename
and adds them in brackets to the display name as (SVG), (dark)
and (SVG + dark).

This way we can drop the special handling for breeze_dark and
sifr_dark display names.

Change-Id: I0ebc8392582d7240b51528078de9d81b36e5a9e9
Reviewed-on: https://gerrit.libreoffice.org/62788
Tested-by: Jenkins
Reviewed-by: 's avatarJan-Marek Glogowski <glogow@fbihome.de>
üst b932577b
...@@ -20,10 +20,6 @@ const OUStringLiteral vcl::IconThemeInfo::HIGH_CONTRAST_ID("sifr"); ...@@ -20,10 +20,6 @@ const OUStringLiteral vcl::IconThemeInfo::HIGH_CONTRAST_ID("sifr");
namespace { namespace {
static const OUStringLiteral BREEZE_DARK_ID("breeze_dark");
static const OUStringLiteral BREEZE_DARK_DISPLAY_NAME("Breeze Dark");
static const OUStringLiteral SIFR_DARK_ID("sifr_dark");
static const OUStringLiteral SIFR_DARK_DISPLAY_NAME("Sifr Dark");
static const OUStringLiteral KARASA_JAGA_ID("karasa_jaga"); static const OUStringLiteral KARASA_JAGA_ID("karasa_jaga");
static const OUStringLiteral KARASA_JAGA_DISPLAY_NAME("Karasa Jaga"); static const OUStringLiteral KARASA_JAGA_DISPLAY_NAME("Karasa Jaga");
static const OUStringLiteral HELPIMG_FAKE_THEME("helpimg"); static const OUStringLiteral HELPIMG_FAKE_THEME("helpimg");
...@@ -122,30 +118,38 @@ IconThemeInfo::ThemeIdToDisplayName(const OUString& themeId) ...@@ -122,30 +118,38 @@ IconThemeInfo::ThemeIdToDisplayName(const OUString& themeId)
throw std::runtime_error("IconThemeInfo::ThemeIdToDisplayName() called with invalid id."); throw std::runtime_error("IconThemeInfo::ThemeIdToDisplayName() called with invalid id.");
} }
// special cases // Strip _svg and _dark filename "extensions"
if (themeId.equalsIgnoreAsciiCase(BREEZE_DARK_ID)) { OUString aDisplayName = themeId;
return BREEZE_DARK_DISPLAY_NAME;
}
else if (themeId.equalsIgnoreAsciiCase(SIFR_DARK_ID)) {
return SIFR_DARK_DISPLAY_NAME;
}
else if (themeId.equalsIgnoreAsciiCase(KARASA_JAGA_ID)) { bool bIsSvg = aDisplayName.endsWith("_svg", &aDisplayName);
return KARASA_JAGA_DISPLAY_NAME; bool bIsDark = aDisplayName.endsWith("_dark", &aDisplayName);
} if (!bIsSvg && bIsDark)
bIsSvg = aDisplayName.endsWith("_svg", &aDisplayName);
// make the first letter uppercase // special cases
OUString r; if (aDisplayName.equalsIgnoreAsciiCase(KARASA_JAGA_ID)) {
sal_Unicode firstLetter = themeId[0]; aDisplayName = KARASA_JAGA_DISPLAY_NAME;
if (rtl::isAsciiLowerCase(firstLetter)) {
r = OUString(sal_Unicode(rtl::toAsciiUpperCase(firstLetter)));
r += themeId.copy(1);
} }
else { else
r = themeId; {
// make the first letter uppercase
sal_Unicode firstLetter = aDisplayName[0];
if (rtl::isAsciiLowerCase(firstLetter))
{
OUString aUpper(sal_Unicode(rtl::toAsciiUpperCase(firstLetter)));
aUpper += aDisplayName.copy(1);
aDisplayName = aUpper;
}
} }
return r; if (bIsSvg && bIsDark)
aDisplayName += " (SVG + dark)";
else if (bIsSvg)
aDisplayName += " (SVG)";
else if (bIsDark)
aDisplayName += " (dark)";
return aDisplayName;
} }
namespace namespace
......
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