videocollection/tsrc/stubs/src/videocollectionuiloader.cpp
changeset 35 3738fe97f027
parent 34 bbb98528c666
child 36 8aed59de29f9
equal deleted inserted replaced
34:bbb98528c666 35:3738fe97f027
    13 *
    13 *
    14 * Description:
    14 * Description:
    15 *
    15 *
    16 */
    16 */
    17 
    17 
       
    18 #include <qdebug.h>
    18 #include <qset.h>
    19 #include <qset.h>
    19 #include <qstring.h>
    20 #include <qstring.h>
    20 #include <hblistview.h>
    21 #include <hblistview.h>
       
    22 #include <hbmenu.h>
    21 
    23 
    22 #include "videocollectionuiloader.h"
    24 #include "videocollectionuiloader.h"
    23 #include "videolistview.h"
    25 #include "videolistview.h"
    24 #include "videolistwidget.h"
    26 #include "videolistwidget.h"
    25 #include "videohintwidget.h"
    27 #include "videohintwidget.h"
    62 }
    64 }
    63 
    65 
    64 QGraphicsWidget* VideoCollectionUiLoader::doFindWidget(const QString &name)
    66 QGraphicsWidget* VideoCollectionUiLoader::doFindWidget(const QString &name)
    65 {
    67 {
    66     QGraphicsWidget *widget = 0;
    68     QGraphicsWidget *widget = 0;
    67     widget = HbDocumentLoader::findWidget(name);
    69     if(VideoCollectionUiLoaderData::mFindFailure)
       
    70     {
       
    71         return 0; 
       
    72     }
       
    73     if(!VideoCollectionUiLoaderData::mFindFailureNameList.contains(name))
       
    74     {
       
    75         widget = HbDocumentLoader::findWidget(name);
       
    76     }
    68     return widget;
    77     return widget;
    69 }
    78 }
    70 
    79 
    71 QObject* VideoCollectionUiLoader::doFindObject(const QString &name)
    80 QObject* VideoCollectionUiLoader::doFindObject(const QString &name)
    72 {
    81 {
    73     QObject *object = 0;
    82     QObject *object = 0;
    74     object = HbDocumentLoader::findObject(name);
    83     if(VideoCollectionUiLoaderData::mFindFailure)
       
    84     {
       
    85         return 0; 
       
    86     }
       
    87     if(!VideoCollectionUiLoaderData::mFindFailureNameList.contains(name))
       
    88     {
       
    89         object = HbDocumentLoader::findObject(name);
       
    90     }
    75     return object;
    91     return object;
    76 }
    92 }
    77 
    93 
    78 void VideoCollectionUiLoader::addToQueue(Params &params)
    94 void VideoCollectionUiLoader::addToQueue(Params &params)
    79 {
    95 {
   107     const QString &name)
   123     const QString &name)
   108 {
   124 {
   109     QObject* object = doFindObject(name);
   125     QObject* object = doFindObject(name);
   110     if (!object)
   126     if (!object)
   111     {
   127     {
   112         if (type == VideoListView::staticMetaObject.className())
   128         if (name == DOCML_NAME_VIEW)
   113         {
   129         {
   114             object = new VideoListView(this);
   130             object = new VideoListView(this);
   115         }
   131         }
   116         else if (type == VideoListWidget::staticMetaObject.className())
   132         else if (name == DOCML_NAME_VC_COLLECTIONWIDGET ||
       
   133                  name == DOCML_NAME_VC_COLLECTIONCONTENTWIDGET ||
       
   134                  name == DOCML_NAME_VC_VIDEOLISTWIDGET)
   117         {
   135         {
   118             object = new VideoListWidget(this);
   136             object = new VideoListWidget(this);
   119         }
   137         }
   120         else if ( type == VideoListSelectionDialog::staticMetaObject.className() )
   138         else if (name == DOCML_NAME_DIALOG)
   121         {
   139         {
   122             if(!VideoCollectionUiLoaderData::mFailDialogLoad)
   140             if(!VideoCollectionUiLoaderData::mFailDialogLoad)
   123             {
   141             {
   124                 object = new VideoListSelectionDialog(this);
   142                 object = new VideoListSelectionDialog(this);
   125                 
       
   126             }
   143             }
   127             else
   144             else
   128             {
   145             {
   129                 return 0;
   146                 return 0;
   130             }
   147             }
   131         }
   148         }
   132         else if (type == VideoHintWidget::staticMetaObject.className())
   149         else if (name == DOCML_NAME_VC_VIDEOHINTWIDGET)
   133         {
   150         {
   134             object = new VideoHintWidget(this);
   151             object = new VideoHintWidget(this);
   135         }
   152         }
   136         if (object)
   153         if (object)
   137         {
   154         {
   138             object->setObjectName(name);
   155             object->setObjectName(name);
   139 
   156 
   140             if (VideoCollectionUiLoaderData::mFindFailure)
   157 
   141             {
       
   142                 if (!VideoCollectionUiLoaderData::mFindFailureNameList.empty())
       
   143                 {
       
   144                     if (VideoCollectionUiLoaderData::mFindFailureNameList.contains(name))
       
   145                     {
       
   146                         delete object;
       
   147                         object = 0;
       
   148                     }
       
   149                 }
       
   150                 else
       
   151                 {
       
   152                     delete object;
       
   153                     object = 0;
       
   154                 }
       
   155             }
       
   156             return object;
   158             return object;
   157         }
   159         }
   158 
       
   159         object = HbDocumentLoader::createObject(type, name);
   160         object = HbDocumentLoader::createObject(type, name);
   160     }
   161     }
   161     
   162     
   162     return object;
   163     return object;
   163 }
   164 }