No changes, just refactor the code in MSW wxGetOsDescription() slightly.

Construct the description string from several pieces: the OS name, its build
number and any extra information about it, instead of duplicating the code
appending the build number to the name in several places.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@67753 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2011-05-16 10:01:12 +00:00
parent 7c7eed5656
commit 5f081e28fa

View File

@@ -1274,8 +1274,7 @@ wxString wxGetOsDescription()
switch ( info.dwMinorVersion ) switch ( info.dwMinorVersion )
{ {
case 0: case 0:
str.Printf(_("Windows 2000 (build %lu"), str = _("Windows 2000");
info.dwBuildNumber);
break; break;
case 2: case 2:
@@ -1284,15 +1283,13 @@ wxString wxGetOsDescription()
// type to resolve this ambiguity // type to resolve this ambiguity
if ( wxIsWindowsServer() == 1 ) if ( wxIsWindowsServer() == 1 )
{ {
str.Printf(_("Windows Server 2003 (build %lu"), str = _("Windows Server 2003");
info.dwBuildNumber);
break; break;
} }
//else: must be XP, fall through //else: must be XP, fall through
case 1: case 1:
str.Printf(_("Windows XP (build %lu"), str = _("Windows XP");
info.dwBuildNumber);
break; break;
} }
break; break;
@@ -1301,29 +1298,15 @@ wxString wxGetOsDescription()
switch ( info.dwMinorVersion ) switch ( info.dwMinorVersion )
{ {
case 0: case 0:
if ( wxIsWindowsServer() == 1 ) str = wxIsWindowsServer() == 1
{ ? _("Windows Server 2008")
str.Printf(_("Windows Server 2008 (build %lu"), : _("Windows Vista");
info.dwBuildNumber);
}
else
{
str.Printf(_("Windows Vista (build %lu"),
info.dwBuildNumber);
}
break; break;
case 1: case 1:
if ( wxIsWindowsServer() == 1 ) str = wxIsWindowsServer() == 1
{ ? _("Windows Server 2008 R2")
str.Printf(_("Windows Server 2008 R2 (build %lu"), : _("Windows 7");
info.dwBuildNumber);
}
else
{
str.Printf(_("Windows 7 (build %lu"),
info.dwBuildNumber);
}
break; break;
} }
break; break;
@@ -1331,12 +1314,13 @@ wxString wxGetOsDescription()
if ( str.empty() ) if ( str.empty() )
{ {
str.Printf(_("Windows NT %lu.%lu (build %lu"), str.Printf(_("Windows NT %lu.%lu"),
info.dwMajorVersion, info.dwMajorVersion,
info.dwMinorVersion, info.dwMinorVersion);
info.dwBuildNumber);
} }
str << wxT(" (")
<< wxString::Format(_("build %lu"), info.dwBuildNumber);
if ( !wxIsEmpty(info.szCSDVersion) ) if ( !wxIsEmpty(info.szCSDVersion) )
{ {
str << wxT(", ") << info.szCSDVersion; str << wxT(", ") << info.szCSDVersion;