src/hbtools/hbthemeindexer/main.cpp
changeset 28 b7da29130b0e
parent 6 c3690ec91ef8
equal deleted inserted replaced
23:e6ad4ef83b23 28:b7da29130b0e
    23 **
    23 **
    24 ****************************************************************************/
    24 ****************************************************************************/
    25 
    25 
    26 #include <hbiconsource_p.h>
    26 #include <hbiconsource_p.h>
    27 #include <hbthemeindex_p.h>
    27 #include <hbthemeindex_p.h>
       
    28 #include <hbhash_p.h>
       
    29 
    28 #include <assert.h>
    30 #include <assert.h>
    29 #include <iostream>
    31 #include <iostream>
    30 #include <QApplication>
    32 #include <QApplication>
    31 #include <QStringList>
    33 #include <QStringList>
    32 #include <QTextStream>
    34 #include <QTextStream>
   229             // Define fileName (remove file extension)
   231             // Define fileName (remove file extension)
   230             QString iconname;
   232             QString iconname;
   231             // If we come here, the filename must end with .* (e.g. .svg)
   233             // If we come here, the filename must end with .* (e.g. .svg)
   232             iconname = filename.left(filename.lastIndexOf('.'));
   234             iconname = filename.left(filename.lastIndexOf('.'));
   233 
   235 
   234             itemData.itemNameHash = HbThemeIndex::hash(iconname);
   236             itemData.itemNameHash = hbHash(iconname);
   235 
   237 
   236             // Define default size
   238             // Define default size
   237             QSize defaultSize = getDefaultSize(fullFilename);
   239             QSize defaultSize = getDefaultSize(fullFilename);
   238             itemData.defaultWidth = static_cast<quint32>(defaultSize.width());
   240             itemData.defaultWidth = static_cast<quint32>(defaultSize.width());
   239             itemData.defaultHeight = static_cast<quint32>(defaultSize.height());
   241             itemData.defaultHeight = static_cast<quint32>(defaultSize.height());
   286 
   288 
   287         case HbThemeIndexItemData::AxmlItem: // fallback, these are handled same way
   289         case HbThemeIndexItemData::AxmlItem: // fallback, these are handled same way
   288         case HbThemeIndexItemData::FxmlItem:
   290         case HbThemeIndexItemData::FxmlItem:
   289             {
   291             {
   290             // Define fileName (file extension not removed)
   292             // Define fileName (file extension not removed)
   291             itemData.itemNameHash = HbThemeIndex::hash(filename);
   293             itemData.itemNameHash = hbHash(filename);
   292 
   294 
   293             if (LockedList.contains(filename)) {
   295             if (LockedList.contains(filename)) {
   294                 itemData.flags |= HbThemeIndexItemData::Locked;
   296                 itemData.flags |= HbThemeIndexItemData::Locked;
   295                 // Remove all found items from the list so that in the end we can handle with missing items.
   297                 // Remove all found items from the list so that in the end we can handle with missing items.
   296                 LockedList.removeOne(filename);
   298                 LockedList.removeOne(filename);
   340                     int startIndex = line.indexOf("var(") + 4;
   342                     int startIndex = line.indexOf("var(") + 4;
   341                     int endIndex = line.indexOf(')');
   343                     int endIndex = line.indexOf(')');
   342                     value = line.mid(startIndex, endIndex - startIndex).trimmed();
   344                     value = line.mid(startIndex, endIndex - startIndex).trimmed();
   343                 }
   345                 }
   344 
   346 
   345                 itemData.itemNameHash = HbThemeIndex::hash(name);
   347                 itemData.itemNameHash = hbHash(name);
   346                 itemData.itemType = HbThemeIndexItemData::ColorItem;
   348                 itemData.itemType = HbThemeIndexItemData::ColorItem;
   347                 bool ok = false;
   349                 bool ok = false;
   348                 itemData.colorValue = (quint32)value.toUInt(&ok, 16);   // Might cause compiler warning in 64 bit systems
   350                 itemData.colorValue = (quint32)value.toUInt(&ok, 16);   // Might cause compiler warning in 64 bit systems
   349                 appendItem(itemData, name);
   351                 appendItem(itemData, name);
   350             }
   352             }
   385     if (!subDir) {
   387     if (!subDir) {
   386         // There might still be items in mirrored list (e.g. frames are not actual items, but they are still mirrored)
   388         // There might still be items in mirrored list (e.g. frames are not actual items, but they are still mirrored)
   387         // So just create empty items for the rest of mirrored items in list
   389         // So just create empty items for the rest of mirrored items in list
   388         foreach (QString mirrored, MirroredList) {
   390         foreach (QString mirrored, MirroredList) {
   389             HbThemeIndexItemData itemData;
   391             HbThemeIndexItemData itemData;
   390             itemData.itemNameHash = HbThemeIndex::hash(mirrored);
   392             itemData.itemNameHash = hbHash(mirrored);
   391             itemData.flags |= HbThemeIndexItemData::Mirrorable;
   393             itemData.flags |= HbThemeIndexItemData::Mirrorable;
   392             appendItem(itemData, mirrored);
   394             appendItem(itemData, mirrored);
   393         }
   395         }
   394 
   396 
   395         // Read application and widget color group CSS files and index their content
   397         // Read application and widget color group CSS files and index their content