Tidy up, check platform and add comments in qlocale_win.cpp

MS says we should stop using LCID, so make a note about that.
This file should only be compiled when Q_OS_WIN is defined, so
don't bother with #if-ery to check that.
Remove two redundant forward-declarations.

Record what qt_localeFromLCID is for - undocumented private API
exported for the use of a platform plugin - since that isn't
immediately obvious to someone only looking at QLocale.

Change-Id: I81ad945bb92d4f81a3ca2aaf97a945635b137a2e
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
This commit is contained in:
Edward Welbourne 2024-01-17 18:54:45 +01:00
parent 0f770b0b34
commit d4d3d6fdba

View File

@ -14,10 +14,9 @@
#include <q20algorithm.h>
#ifdef Q_OS_WIN
# include <qt_windows.h>
# include <time.h>
#endif
// TODO QTBUG-121193: port away from the use of LCID to always use names.
#include <qt_windows.h>
#include <time.h>
#if QT_CONFIG(cpp_winrt)
# include <QtCore/private/qt_winrtbase_p.h>
@ -67,8 +66,6 @@ static auto getDefaultWinId()
}
static QByteArray getWinLocaleName(LCID id = LOCALE_USER_DEFAULT);
static QString winIso639LangName(LCID id = LOCALE_USER_DEFAULT);
static QString winIso3116CtryName(LCID id = LOCALE_USER_DEFAULT);
#ifndef QT_NO_SYSTEMLOCALE
@ -1174,6 +1171,7 @@ static QByteArray getWinLocaleName(LCID id)
return std::move(resultusage).toLatin1();
}
// Helper for plugins/platforms/windows/
Q_CORE_EXPORT QLocale qt_localeFromLCID(LCID id)
{
return QLocale(QString::fromLatin1(getWinLocaleName(id)));