src/hbcore/utils/hbdeviceprofile.cpp
changeset 34 ed14f46c0e55
parent 7 923ff622b8b9
equal deleted inserted replaced
31:7516d6d86cf5 34:ed14f46c0e55
    27 #include "hbdeviceprofiledatabase_p.h"
    27 #include "hbdeviceprofiledatabase_p.h"
    28 #include "hbinstance_p.h"
    28 #include "hbinstance_p.h"
    29 #include "hbmemorymanager_p.h"
    29 #include "hbmemorymanager_p.h"
    30 #include "hbtheme_p.h"
    30 #include "hbtheme_p.h"
    31 #include "hbthemeclient_p.h"
    31 #include "hbthemeclient_p.h"
    32 #include <hbmainwindow.h>
    32 #include "hbmainwindow.h"
    33 #include "hbmainwindow_p.h"
    33 #include "hbmainwindow_p.h"
    34 
    34 
    35 #include <QDebug>
    35 #ifdef Q_OS_SYMBIAN
       
    36 #include "hbthemecommon_symbian_p.h"
       
    37 #endif
    36 
    38 
    37 // To store the pointer to the deviceProfiles at the client side.
    39 // To store the pointer to the deviceProfiles at the client side.
    38 static HbDeviceProfileList *deviceProfilesList = 0;
    40 static HbDeviceProfileList *deviceProfilesList = 0;
    39 
    41 
    40 #define MM_PER_INCH 25.4
    42 #define MM_PER_INCH 25.4
    84             if (deviceProfilesList->at(i).mName == name) {
    86             if (deviceProfilesList->at(i).mName == name) {
    85                 d_ptr->mProfile = deviceProfilesList->at(i);
    87                 d_ptr->mProfile = deviceProfilesList->at(i);
    86                 found = true;
    88                 found = true;
    87             }
    89             }
    88         }
    90         }
    89         if (!found) {
    91         // The !found case is actually normal, just have the default constructed
    90             qWarning() << "Device profile" << name << "not found!";
    92         // profile in that case, no need to raise errors.
    91         }
       
    92     }
    93     }
    93 }
    94 }
    94 
    95 
    95 
    96 
    96 /*!
    97 /*!
   297 {
   298 {
   298 }
   299 }
   299 
   300 
   300 HbDeviceProfileList *HbDeviceProfilePrivate::deviceProfiles()
   301 HbDeviceProfileList *HbDeviceProfilePrivate::deviceProfiles()
   301 {
   302 {
   302     if (!deviceProfilesList) {
   303     // HbOrientationStatus may call this from the Theme Server process
       
   304     // too and this needs special support.
       
   305     bool isThemeServer = false;
       
   306 #ifdef Q_OS_SYMBIAN
       
   307     RProcess process;
       
   308     isThemeServer = process.SecureId().iId == KServerUid3.iUid;
       
   309     process.Close();
       
   310 #endif
       
   311     if (!deviceProfilesList && !isThemeServer) {
   303         // Will result in IPC call. gets the shared memory offset from themeserver.
   312         // Will result in IPC call. gets the shared memory offset from themeserver.
   304         deviceProfilesList = HbThemeClient::global()->deviceProfiles();
   313         deviceProfilesList = HbThemeClient::global()->deviceProfiles();
   305     }
   314     }
   306 
   315 
   307     if (!deviceProfilesList) {
   316     if (!deviceProfilesList) {
       
   317         HbMemoryManager::MemoryType memType = isThemeServer
       
   318             ? HbMemoryManager::SharedMemory : HbMemoryManager::HeapMemory;
   308         // This is fall back.Create/Get the HbDeviceProfileDatabase Instance at
   319         // This is fall back.Create/Get the HbDeviceProfileDatabase Instance at
   309         // the client side and read the deviceProfilesList.
   320         // the client side and read the deviceProfilesList.
   310         HbDeviceProfileDatabase *deviceProfileDataBase =
   321         HbDeviceProfileDatabase *deviceProfileDataBase =
   311             HbDeviceProfileDatabase::instance(HbMemoryManager::HeapMemory);
   322             HbDeviceProfileDatabase::instance(memType);
   312         deviceProfilesList = HbMemoryUtils::getAddress<HbDeviceProfileList>(HbMemoryManager::HeapMemory,
   323         deviceProfilesList = HbMemoryUtils::getAddress<HbDeviceProfileList>(memType,
   313                              deviceProfileDataBase->deviceProfilesOffset());
   324                              deviceProfileDataBase->deviceProfilesOffset());
   314     }
   325     }
   315     return deviceProfilesList;
   326     return deviceProfilesList;
   316 }
   327 }
   317 // end of file