diff -r 16d8024aca5e -r f7ac710697a9 src/hbcore/utils/hbdeviceprofile.cpp --- a/src/hbcore/utils/hbdeviceprofile.cpp Mon Apr 19 14:02:13 2010 +0300 +++ b/src/hbcore/utils/hbdeviceprofile.cpp Mon May 03 12:48:33 2010 +0300 @@ -28,12 +28,17 @@ #include "hbinstance_p.h" #include "hbmemorymanager_p.h" #include "hbtheme_p.h" +#include "hbthemeclient_p.h" #include #include "hbmainwindow_p.h" +#include + // To store the pointer to the deviceProfiles at the client side. static HbDeviceProfileList *deviceProfilesList = NULL; +#define MM_PER_INCH 25.4 + /*! @stable @hbcore @@ -74,12 +79,16 @@ { if (d_ptr->deviceProfiles()) { int count = deviceProfilesList->count(); - for (int i = 0; i < count; i++) { + bool found( false ); + for (int i = 0; !found && i < count; i++) { if (deviceProfilesList->at(i).mName == name) { d_ptr->mProfile = deviceProfilesList->at(i); - break; + found = true; } } + if (!found) { + qWarning() << "Device profile" << name << "not found!"; + } } } @@ -134,7 +143,9 @@ */ QSizeF HbDeviceProfile::physicalSize() const { - return d_ptr->mProfile.mPhysicalSize; + QSizeF physicalSize(d_ptr->mProfile.mLogicalSize); + physicalSize /= ppmValue(); + return physicalSize; } /*! @@ -142,7 +153,8 @@ */ Qt::Orientation HbDeviceProfile::orientation() const { - return d_ptr->mProfile.mOrientation; + QSize s = d_ptr->mProfile.mLogicalSize; + return (s.width() > s.height()) ? Qt::Horizontal : Qt::Vertical; } /*! @@ -192,11 +204,7 @@ */ qreal HbDeviceProfile::ppmValue() const { - // Assuming square pixels - if (d_ptr->mProfile.mPhysicalSize.width() != 0) { - return d_ptr->mProfile.mLogicalSize.width() / d_ptr->mProfile.mPhysicalSize.width(); - } - return 0.0; + return d_ptr->mProfile.mPpiValue / MM_PER_INCH; } /*!