Utils: Introduce HostOsInfo class.

The class' member functions are intended to be used
instead of the Q_OS_* macros in all contexts where
the latter are not syntactically required.
This lowers the likelihood of changes made on one
platform breaking the build on another, e.g. due to
the code model missing symbols in #ifdef'ed out code
when refactoring.

Change-Id: I4a54788591b4c8f8d589b8368a6c683d4155c9fa
Reviewed-by: hjk <qthjk@ovi.com>
This commit is contained in:
Christian Kandeler
2012-08-23 15:53:58 +02:00
committed by hjk
parent b674b59b3d
commit e669f05406
109 changed files with 1281 additions and 1249 deletions

View File

@@ -31,6 +31,7 @@
#include "fileutils.h"
#include "savefile.h"
#include "hostosinfo.h"
#include "qtcassert.h"
#include <QDir>
@@ -412,12 +413,8 @@ TempFileSaver::~TempFileSaver()
On windows filenames are compared case insensitively.
*/
#ifdef Q_OS_WIN
Qt::CaseSensitivity FileName::cs = Qt::CaseInsensitive;
#else
Qt::CaseSensitivity FileName::cs = Qt::CaseSensitive;
#endif
const Qt::CaseSensitivity FileName::cs
= HostOsInfo::isWindowsHost() ? Qt::CaseInsensitive : Qt::CaseSensitive;
FileName::FileName()
: QString()
@@ -581,10 +578,8 @@ FileName &FileName::append(QChar str)
QT_BEGIN_NAMESPACE
uint qHash(const Utils::FileName &a)
{
#ifdef Q_OS_WIN
return qHash(a.toString().toUpper());
#else
if (Utils::HostOsInfo::isWindowsHost())
return qHash(a.toString().toUpper());
return qHash(a.toString());
#endif
}
QT_END_NAMESPACE