1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-03-01 04:39:44 +00:00

Use multiplication character in the launcher instead of 'x'

This commit is contained in:
Andrei Kortunov 2023-11-28 22:47:27 +04:00
parent 81a6a7cd2f
commit 623510c073
4 changed files with 7 additions and 7 deletions

View file

@ -102,7 +102,7 @@ bool Launcher::GraphicsPage::loadSettings()
const int width = Settings::video().mResolutionX; const int width = Settings::video().mResolutionX;
const int height = Settings::video().mResolutionY; const int height = Settings::video().mResolutionY;
QString resolution = QString::number(width) + QString(" x ") + QString::number(height); QString resolution = QString::number(width) + QString(" × ") + QString::number(height);
screenComboBox->setCurrentIndex(Settings::video().mScreen); screenComboBox->setCurrentIndex(Settings::video().mScreen);
int resIndex = resolutionComboBox->findText(resolution, Qt::MatchStartsWith); int resIndex = resolutionComboBox->findText(resolution, Qt::MatchStartsWith);
@ -189,7 +189,7 @@ void Launcher::GraphicsPage::saveSettings()
int cHeight = 0; int cHeight = 0;
if (standardRadioButton->isChecked()) if (standardRadioButton->isChecked())
{ {
QRegularExpression resolutionRe("^(\\d+) x (\\d+)"); QRegularExpression resolutionRe("^(\\d+) × (\\d+)");
QRegularExpressionMatch match = resolutionRe.match(resolutionComboBox->currentText().simplified()); QRegularExpressionMatch match = resolutionRe.match(resolutionComboBox->currentText().simplified());
if (match.hasMatch()) if (match.hasMatch())
{ {
@ -289,7 +289,7 @@ QStringList Launcher::GraphicsPage::getAvailableResolutions(int screen)
return result; return result;
} }
auto str = Misc::getResolutionText(mode.w, mode.h); auto str = Misc::getResolutionText(mode.w, mode.h, "%i × %i (%i:%i)");
result.append(QString(str.c_str())); result.append(QString(str.c_str()));
} }

View file

@ -352,7 +352,7 @@ namespace MWGui
std::sort(resolutions.begin(), resolutions.end(), sortResolutions); std::sort(resolutions.begin(), resolutions.end(), sortResolutions);
for (std::pair<int, int>& resolution : resolutions) for (std::pair<int, int>& resolution : resolutions)
{ {
std::string str = Misc::getResolutionText(resolution.first, resolution.second); std::string str = Misc::getResolutionText(resolution.first, resolution.second, "%i x %i (%i:%i)");
if (mResolutionList->findItemIndexWith(str) == MyGUI::ITEM_NONE) if (mResolutionList->findItemIndexWith(str) == MyGUI::ITEM_NONE)
mResolutionList->addItem(str); mResolutionList->addItem(str);

View file

@ -7,7 +7,7 @@
namespace Misc namespace Misc
{ {
std::string getResolutionText(int x, int y) std::string getResolutionText(int x, int y, const std::string& format)
{ {
int gcd = std::gcd(x, y); int gcd = std::gcd(x, y);
if (gcd == 0) if (gcd == 0)
@ -77,6 +77,6 @@ namespace Misc
if (flipped) if (flipped)
std::swap(xaspect, yaspect); std::swap(xaspect, yaspect);
return Misc::StringUtils::format("%i x %i (%i:%i)", x, y, xaspect, yaspect); return Misc::StringUtils::format(format, x, y, xaspect, yaspect);
} }
} }

View file

@ -5,7 +5,7 @@
namespace Misc namespace Misc
{ {
std::string getResolutionText(int x, int y); std::string getResolutionText(int x, int y, const std::string& format);
} }
#endif #endif