src/hbcore/theme/hbthemeclient_p.cpp
changeset 34 ed14f46c0e55
parent 7 923ff622b8b9
equal deleted inserted replaced
31:7516d6d86cf5 34:ed14f46c0e55
    57 /**
    57 /**
    58  * HbThemeClient::getSharedIconInfo()
    58  * HbThemeClient::getSharedIconInfo()
    59  *
    59  *
    60  * Returns HbIconInfo structure to the clients. This basically contains information about the shared
    60  * Returns HbIconInfo structure to the clients. This basically contains information about the shared
    61  * icon resources on server's shared memory
    61  * icon resources on server's shared memory
    62  *
    62  */
    63  * \a iconPath
    63 HbSharedIconInfo HbThemeClient::getSharedIconInfo(const IconReqInfo &reqInfo)
    64  * \a size
    64 {
    65  * \a aspectRatioMode
    65 #ifdef Q_OS_SYMBIAN
    66  * \a mode
    66     Q_D(HbThemeClient);
    67  * \a mirrored
    67     return d->getSharedIconInfo(reqInfo);
    68  * \a options
    68 #else
    69  * \a color
    69     Q_UNUSED(reqInfo);
    70  *
       
    71 
       
    72  */
       
    73 HbSharedIconInfo HbThemeClient::getSharedIconInfo(const QString& iconPath ,
       
    74                                                   const QSizeF &size,
       
    75                                                   Qt::AspectRatioMode aspectRatioMode,
       
    76                                                   QIcon::Mode mode,
       
    77                                                   bool mirrored,
       
    78                                                   HbIconLoader::IconLoaderOptions options,
       
    79                                                   const QColor &color,
       
    80                                                   HbRenderingMode renderMode)
       
    81 {
       
    82 #ifdef Q_OS_SYMBIAN
       
    83     Q_D(HbThemeClient);
       
    84     return d->getSharedIconInfo(iconPath,
       
    85                                 size,
       
    86                                 aspectRatioMode,
       
    87                                 mode,
       
    88                                 mirrored,
       
    89                                 options,
       
    90                                 color,
       
    91                                 renderMode);
       
    92 #else
       
    93     Q_UNUSED(iconPath);
       
    94     Q_UNUSED(size);
       
    95     Q_UNUSED(aspectRatioMode);
       
    96     Q_UNUSED(mode);
       
    97     Q_UNUSED(mirrored);
       
    98     Q_UNUSED(options);
       
    99     Q_UNUSED(color);
       
   100     Q_UNUSED(renderMode);
       
   101 
       
   102     return HbSharedIconInfo();
    70     return HbSharedIconInfo();
   103 #endif
    71 #endif
   104 }
    72 }
   105 
    73 
   106 /**
    74 /**
       
    75    Asynchronous version.
       
    76  */
       
    77 void HbThemeClient::getSharedIconInfo(const IconReqInfo &reqInfo,
       
    78                                       HbAsyncIconInfoCallback callback,
       
    79                                       void *callbackParam)
       
    80 {
       
    81 #ifdef Q_OS_SYMBIAN
       
    82     Q_D(HbThemeClient);
       
    83     d->getSharedIconInfo(reqInfo, callback, callbackParam);
       
    84 #else
       
    85     Q_UNUSED(reqInfo);
       
    86     Q_UNUSED(callback);
       
    87     Q_UNUSED(callbackParam);
       
    88 #endif
       
    89 }
       
    90 
       
    91 /**
       
    92    Cancels one or more previous async requests. All requests using the
       
    93    same callback are canceled.
       
    94  */
       
    95 void HbThemeClient::cancelGetSharedIconInfo(HbAsyncIconInfoCallback callback,
       
    96                                             void *callbackParam)
       
    97 {
       
    98 #ifdef Q_OS_SYMBIAN
       
    99     Q_D(HbThemeClient);
       
   100     d->cancelGetSharedIconInfo(callback, callbackParam);
       
   101 #else
       
   102     Q_UNUSED(callback);
       
   103     Q_UNUSED(callbackParam);
       
   104 #endif
       
   105 }
       
   106 
       
   107 /**
   107  * HbThemeClient::getSharedBlob()
   108  * HbThemeClient::getSharedBlob()
   108  *
   109  *
   109  * \a name
   110  * \a name
   110  */
   111  */
   111 QByteArray HbThemeClient::getSharedBlob(const QString &name)
   112 QByteArray HbThemeClient::getSharedBlob(const QString &name)
   112 {
   113 {
   113 #ifdef Q_OS_SYMBIAN
   114 #ifdef Q_OS_SYMBIAN
   114     HbSharedIconInfo info = getSharedIconInfo(
   115     IconReqInfo reqInfo;
   115         name,
   116     reqInfo.iconPath = name;
   116         QSizeF(),
   117     reqInfo.size = QSizeF();
   117         Qt::KeepAspectRatio,
   118     reqInfo.aspectRatioMode = Qt::KeepAspectRatio;
   118         QIcon::Normal,
   119     reqInfo.mode = QIcon::Normal;
   119         false,
   120     reqInfo.mirrored = false;
   120         HbIconLoader::NoOptions,
   121     reqInfo.options = HbIconLoader::NoOptions;
   121         QColor(),
   122     reqInfo.color = QColor();
   122         ESWRendering);
   123     reqInfo.renderMode = ESWRendering;
       
   124     HbSharedIconInfo info = getSharedIconInfo(reqInfo);
   123     return info.type == BLOB
   125     return info.type == BLOB
   124         ? QByteArray::fromRawData(HbMemoryUtils::getAddress<char>(
   126         ? QByteArray::fromRawData(HbMemoryUtils::getAddress<char>(
   125                                       HbMemoryManager::SharedMemory,
   127                                       HbMemoryManager::SharedMemory,
   126                                       info.blobData.offset),
   128                                       info.blobData.offset),
   127                                   info.blobData.dataSize)
   129                                   info.blobData.dataSize)
   166  *
   168  *
   167  * \a filePath  css filepath. Only acceptable path separator is '/'.
   169  * \a filePath  css filepath. Only acceptable path separator is '/'.
   168  * \a priority  layer priority
   170  * \a priority  layer priority
   169  */
   171  */
   170 HbCss::StyleSheet *HbThemeClient::getSharedStyleSheet(const QString &filePath,
   172 HbCss::StyleSheet *HbThemeClient::getSharedStyleSheet(const QString &filePath,
   171                                                       HbLayeredStyleLoader::LayerPriority priority)
   173                                                       HbLayeredStyleLoader::LayerPriority priority,
       
   174                                                       bool &fileExists)
   172 {
   175 {
   173     HbCss::StyleSheet *styleSheet = 0;
   176     HbCss::StyleSheet *styleSheet = 0;
   174 #ifdef Q_OS_SYMBIAN
   177 #ifdef Q_OS_SYMBIAN
   175     const QString filePathFixed = QDir::fromNativeSeparators(filePath);
   178     const QString filePathFixed = QDir::fromNativeSeparators(filePath);
   176 
   179 
   188             styleSheet =
   191             styleSheet =
   189                     HbMemoryUtils::getAddress<HbCss::StyleSheet>(HbMemoryManager::SharedMemory,
   192                     HbMemoryUtils::getAddress<HbCss::StyleSheet>(HbMemoryManager::SharedMemory,
   190                                                                  offset);
   193                                                                  offset);
   191         } else {
   194         } else {
   192             Q_D(HbThemeClient);
   195             Q_D(HbThemeClient);
   193             styleSheet = d->getSharedStyleSheet(filePathFixed, priority);
   196             styleSheet = d->getSharedStyleSheet(filePathFixed, priority, fileExists);
   194         }
   197         }
   195     }
   198     }
   196 #else
   199 #else
   197     Q_UNUSED(filePath);
   200     Q_UNUSED(filePath);
   198     Q_UNUSED(priority);
   201     Q_UNUSED(priority);
       
   202     Q_UNUSED(fileExists);
   199 #endif
   203 #endif
   200     return styleSheet;
   204     return styleSheet;
       
   205 }
       
   206 
       
   207 /**
       
   208  * HbThemeClient::getSharedMissedHbCss()
       
   209  */
       
   210 HbVector<uint> *HbThemeClient::getSharedMissedHbCss()
       
   211 {
       
   212     HbVector<uint> *list = 0;
       
   213 #ifdef Q_OS_SYMBIAN
       
   214     Q_D(HbThemeClient);
       
   215     list = d->getSharedMissedHbCss();
       
   216 #endif
       
   217     return list;
   201 }
   218 }
   202 
   219 
   203 /**
   220 /**
   204  * HbThemeClient::getSharedLayoutDefs()
   221  * HbThemeClient::getSharedLayoutDefs()
   205  * \a filePath  layout definition filepath. Only acceptable path separator is '/'.
   222  * \a filePath  layout definition filepath. Only acceptable path separator is '/'.
   206  * \a layout  layout name
   223  * \a layout  layout name
   207  * \a section section name
   224  * \a section section name
       
   225  * \a fileExists on return will be true if the file exists, otherwise false. Note that
       
   226  *      the file may exist but the LayoutDefinition variable may return null, meaning
       
   227  *      the layout should be loaded client-side.
   208  */
   228  */
   209 HbWidgetLoader::LayoutDefinition *HbThemeClient::getSharedLayoutDefs(const QString &filePath,
   229 HbWidgetLoader::LayoutDefinition *HbThemeClient::getSharedLayoutDefs(const QString &filePath,
   210                                                                      const QString &layout,
   230                                                                      const QString &layout,
   211                                                                      const QString &section)
   231                                                                      const QString &section,
       
   232                                                                      bool &fileExists)
   212 {
   233 {
   213     HbWidgetLoader::LayoutDefinition *layoutDefinition = 0;
   234     HbWidgetLoader::LayoutDefinition *layoutDefinition = 0;
   214 #ifdef Q_OS_SYMBIAN
   235 #ifdef Q_OS_SYMBIAN
   215     const QString filePathFixed = QDir::fromNativeSeparators(filePath);
   236     const QString filePathFixed = QDir::fromNativeSeparators(filePath);
   216 
   237 
   225            layoutDefinition =
   246            layoutDefinition =
   226                HbMemoryUtils::getAddress<HbWidgetLoader::LayoutDefinition>(
   247                HbMemoryUtils::getAddress<HbWidgetLoader::LayoutDefinition>(
   227                        HbMemoryManager::SharedMemory, offset);
   248                        HbMemoryManager::SharedMemory, offset);
   228         } else {
   249         } else {
   229             Q_D(HbThemeClient);
   250             Q_D(HbThemeClient);
   230             layoutDefinition = d->getSharedLayoutDefs(filePathFixed, layout, section);
   251             layoutDefinition = d->getSharedLayoutDefs(filePathFixed, layout, section, fileExists);
   231         }
   252         }
   232     }
   253     }
   233 #else
   254 #else
   234     Q_UNUSED(filePath);
   255     Q_UNUSED(filePath);
   235     Q_UNUSED(layout);
   256     Q_UNUSED(layout);
   236     Q_UNUSED(section);
   257     Q_UNUSED(section);
       
   258     Q_UNUSED(fileExists);
   237 #endif
   259 #endif
   238     return layoutDefinition;
   260     return layoutDefinition;
   239 }
   261 }
   240 /**
   262 /**
   241  * HbThemeClient::deviceProfiles()
   263  * HbThemeClient::deviceProfiles()
   322 #endif
   344 #endif
   323 }
   345 }
   324 
   346 
   325 /**
   347 /**
   326  * HbThemeClient::unloadIcon()
   348  * HbThemeClient::unloadIcon()
   327  *
   349  */
   328  * \a iconPath
   350 void HbThemeClient::unloadIcon(const IconReqInfo &reqInfo)
   329  * \a size
   351 {
   330  * \a aspectRatioMode
   352 #ifdef Q_OS_SYMBIAN
   331  * \a mode
   353     Q_D(HbThemeClient);
   332  * \a mirrored
   354     return d->unloadIcon(reqInfo);
   333  * \a options
   355 #else
   334  * \a color
   356     Q_UNUSED(reqInfo);
   335 
   357 #endif
   336  */
   358 }
   337 void HbThemeClient::unloadIcon(const QString& iconPath ,
   359 
   338                                const QSizeF &size,
   360 /**
   339                                Qt::AspectRatioMode aspectRatioMode,
   361  * HbThemeClient::batchUnloadIcon()
   340                                QIcon::Mode mode,
   362  */
   341                                bool mirrored,
   363 void HbThemeClient::batchUnloadIcon(const QVector<IconReqInfo> &reqInfos)
   342                                const QColor &color,
   364 {
   343                                HbRenderingMode renderMode)
   365 #ifdef Q_OS_SYMBIAN
   344 {
   366     Q_D(HbThemeClient);
   345 #ifdef Q_OS_SYMBIAN
   367     return d->batchUnloadIcon(reqInfos);
   346     Q_D(HbThemeClient);
   368 #else
   347     return d->unloadIcon(iconPath,
   369     Q_UNUSED(reqInfos);
   348                          size,
       
   349                          aspectRatioMode,
       
   350                          mode,
       
   351                          mirrored,
       
   352                          color,
       
   353                          renderMode);
       
   354 #else
       
   355     Q_UNUSED(iconPath);
       
   356     Q_UNUSED(size);
       
   357     Q_UNUSED(aspectRatioMode);
       
   358     Q_UNUSED(mode);
       
   359     Q_UNUSED(mirrored);
       
   360     Q_UNUSED(color);
       
   361     Q_UNUSED(renderMode);
       
   362 #endif
   370 #endif
   363 }
   371 }
   364 
   372 
   365 /**
   373 /**
   366  * HbThemeClient::unLoadMultiIcon()
   374  * HbThemeClient::unLoadMultiIcon()