src/hbutils/document/hbdocumentloadersyntax_p.cpp
changeset 30 80e4d18b72f5
parent 7 923ff622b8b9
equal deleted inserted replaced
28:b7da29130b0e 30:80e4d18b72f5
    37 #include <QDebug>
    37 #include <QDebug>
    38 
    38 
    39 
    39 
    40 // Document loader version number
    40 // Document loader version number
    41 #define VERSION_MAJOR 1
    41 #define VERSION_MAJOR 1
    42 #define VERSION_MINOR 2
    42 #define VERSION_MINOR 3
    43 
    43 
    44 #define MIN_SUPPORTED_VERSION_MAJOR 0
    44 #define MIN_SUPPORTED_VERSION_MAJOR 0
    45 #define MIN_SUPPORTED_VERSION_MINOR 1
    45 #define MIN_SUPPORTED_VERSION_MINOR 1
    46 
    46 
    47 
    47 
  1117         result = mActions->setToolTip(variable);
  1117         result = mActions->setToolTip(variable);
  1118 
  1118 
  1119         if (!result) {
  1119         if (!result) {
  1120             qWarning() << "Invalid tooltip, line " << mReader.lineNumber();
  1120             qWarning() << "Invalid tooltip, line " << mReader.lineNumber();
  1121         }
  1121         }
       
  1122     } else if ( type == lexemValue( TYPE_BACKGROUND ) ) {
       
  1123         const QString name = attribute( ATTR_NAME );
       
  1124         const QString type = attribute( ATTR_TYPE );
       
  1125 
       
  1126         result = true;
       
  1127 
       
  1128         HbFrameDrawer::FrameType frameType(HbFrameDrawer::Undefined);
       
  1129         if (!type.isEmpty()) {
       
  1130             result = convertFrameType(type, frameType);
       
  1131         }
       
  1132         if (result) {
       
  1133             result = mActions->setBackground(name, frameType);
       
  1134         }
       
  1135         if (!result) {
       
  1136             qWarning() << "Invalid background, line " << mReader.lineNumber();
       
  1137         }
  1122     }
  1138     }
  1123 
  1139 
  1124     return result;
  1140     return result;
  1125 }
  1141 }
  1126 
  1142 
  1350     }
  1366     }
  1351     return ok;
  1367     return ok;
  1352 }
  1368 }
  1353 
  1369 
  1354 bool HbDocumentLoaderSyntax::convertSizeHintType(
  1370 bool HbDocumentLoaderSyntax::convertSizeHintType(
  1355         const QString &type,
  1371     const QString &type,
  1356         Qt::SizeHint &resultHint,
  1372     Qt::SizeHint &resultHint,
  1357         bool &resultFixed)
  1373     bool &resultFixed)
  1358 {
  1374 {
  1359     bool ok = true;
  1375     bool ok = true;
  1360     resultFixed = false;
  1376     resultFixed = false;
  1361 
  1377 
  1362     if (type == QLatin1String("MINIMUM")) {
  1378     if (type == QLatin1String("MINIMUM")) {
  1372         ok = false;
  1388         ok = false;
  1373     }
  1389     }
  1374     return ok;
  1390     return ok;
  1375 }
  1391 }
  1376 
  1392 
       
  1393 bool HbDocumentLoaderSyntax::convertFrameType(
       
  1394     const QString &type,
       
  1395     HbFrameDrawer::FrameType &resultType)
       
  1396 {
       
  1397     bool ok = true;
       
  1398     if (type == QLatin1String("OnePiece")) {
       
  1399         resultType = HbFrameDrawer::OnePiece;
       
  1400     } else if (type == QLatin1String("ThreePiecesHorizontal")) {
       
  1401         resultType = HbFrameDrawer::ThreePiecesHorizontal;
       
  1402     } else if (type == QLatin1String("ThreePiecesVertical")) {
       
  1403         resultType = HbFrameDrawer::ThreePiecesVertical;
       
  1404     } else if (type == QLatin1String("NinePieces")) {
       
  1405         resultType = HbFrameDrawer::NinePieces;
       
  1406     } else {
       
  1407         ok = false;
       
  1408     }
       
  1409     return ok;
       
  1410 }
       
  1411 
       
  1412 
  1377 QString HbDocumentLoaderSyntax::version()
  1413 QString HbDocumentLoaderSyntax::version()
  1378 {
  1414 {
  1379     return ( QString::number( VERSION_MAJOR ) + QString( "." )
  1415     return ( QString::number( VERSION_MAJOR ) + QString( "." )
  1380             + QString::number( VERSION_MINOR ) + QString( " (" )
  1416             + QString::number( VERSION_MINOR ) + QString( " (" )
  1381             + QString::number( MIN_SUPPORTED_VERSION_MAJOR ) + QString( "." )
  1417             + QString::number( MIN_SUPPORTED_VERSION_MAJOR ) + QString( "." )