13 * |
13 * |
14 * Description: VideoCollectionWrapperPrivate class implementation |
14 * Description: VideoCollectionWrapperPrivate class implementation |
15 * |
15 * |
16 */ |
16 */ |
17 |
17 |
|
18 // Version : %version: % |
|
19 |
18 // INCLUDE FILES |
20 // INCLUDE FILES |
19 |
|
20 #include <qapplication.h> |
21 #include <qapplication.h> |
21 #include <qabstractitemmodel.h> |
22 #include <qabstractitemmodel.h> |
22 #include <vcxmyvideosdefs.h> |
23 #include <vcxmyvideosdefs.h> |
|
24 |
23 #include "videocollectionwrapper.h" |
25 #include "videocollectionwrapper.h" |
24 #include "videocollectionwrapper_p.h" |
26 #include "videocollectionwrapper_p.h" |
25 #include "videolistdatamodel.h" |
27 #include "videolistdatamodel.h" |
26 #include "videosortfilterproxymodel.h" |
28 #include "videosortfilterproxymodel.h" |
27 #include "videocollectionclient.h" |
29 #include "videocollectionclient.h" |
28 #include "videocollectioncommon.h" |
30 #include "videocollectioncommon.h" |
|
31 #include "videocollectiontrace.h" |
29 |
32 |
30 // ================= MEMBER FUNCTIONS ======================= |
33 // ================= MEMBER FUNCTIONS ======================= |
31 // |
34 // |
32 |
35 |
33 // ----------------------------------------------------------------------------- |
36 // ----------------------------------------------------------------------------- |
34 // VideoCollectionWrapperPrivate::VideoCollectionWrapperPrivate() |
37 // VideoCollectionWrapperPrivate::VideoCollectionWrapperPrivate() |
35 // ----------------------------------------------------------------------------- |
38 // ----------------------------------------------------------------------------- |
36 // |
39 // |
37 VideoCollectionWrapperPrivate::VideoCollectionWrapperPrivate() : |
40 VideoCollectionWrapperPrivate::VideoCollectionWrapperPrivate() |
38 mAllVideosModel(0), |
41 : mAllVideosModel( 0 ) |
39 mCollectionsModel(0), |
42 , mCollectionsModel( 0 ) |
40 mGenericModel(0), |
43 , mGenericModel( 0 ) |
41 mSourceModel(0) |
44 , mSourceModel( 0 ) |
42 { |
45 { |
|
46 FUNC_LOG; |
43 // NOP |
47 // NOP |
44 } |
48 } |
45 |
49 |
46 // ----------------------------------------------------------------------------- |
50 // ----------------------------------------------------------------------------- |
47 // VideoCollectionWrapperPrivate::~VideoCollectionWrapperPrivate() |
51 // VideoCollectionWrapperPrivate::~VideoCollectionWrapperPrivate() |
48 // ----------------------------------------------------------------------------- |
52 // ----------------------------------------------------------------------------- |
49 // |
53 // |
50 VideoCollectionWrapperPrivate::~VideoCollectionWrapperPrivate() |
54 VideoCollectionWrapperPrivate::~VideoCollectionWrapperPrivate() |
51 { |
55 { |
|
56 FUNC_LOG; |
52 // NOP here |
57 // NOP here |
53 } |
58 } |
54 |
59 |
55 |
60 |
56 // ----------------------------------------------------------------------------- |
61 // ----------------------------------------------------------------------------- |
57 // VideoCollectionWrapperPrivate::getModel() |
62 // VideoCollectionWrapperPrivate::getModel() |
58 // ----------------------------------------------------------------------------- |
63 // ----------------------------------------------------------------------------- |
59 // |
64 // |
60 VideoSortFilterProxyModel* VideoCollectionWrapperPrivate::getModel(int &type) |
65 VideoSortFilterProxyModel* VideoCollectionWrapperPrivate::getModel(VideoCollectionCommon::TModelType &type) |
61 { |
66 { |
62 |
67 FUNC_LOG; |
|
68 INFO_1("VideoCollectionWrapperPrivate::getModel() type: %d", type); |
|
69 |
63 VideoSortFilterProxyModel *model = 0; |
70 VideoSortFilterProxyModel *model = 0; |
64 if(!mSourceModel) |
71 if(!mSourceModel) |
65 { |
72 { |
66 mSourceModel = new VideoListDataModel(); |
73 mSourceModel = new VideoListDataModel(); |
67 if(!mSourceModel || mSourceModel->initialize() < 0 || |
74 if(!mSourceModel || mSourceModel->initialize() < 0 || |
68 !connect(qApp, SIGNAL(aboutToQuit()), this, SLOT(aboutToQuitSlot())) ) |
75 !connect(qApp, SIGNAL(aboutToQuit()), this, SLOT(aboutToQuitSlot())) ) |
69 { |
76 { |
|
77 ERROR(-1, "VideoCollectionWrapperPrivate::getModel() sourceModel setup failed."); |
70 return 0; |
78 return 0; |
71 } |
79 } |
72 } |
80 } |
73 bool needsInitialization = false; |
81 bool needsInitialization = false; |
74 if(type == VideoCollectionWrapper::EAllVideos) |
82 if(type == VideoCollectionCommon::EModelTypeAllVideos) |
75 { |
83 { |
76 if(!mAllVideosModel) |
84 if(!mAllVideosModel) |
77 { |
85 { |
78 mAllVideosModel = new VideoSortFilterProxyModel(type); |
86 mAllVideosModel = new VideoSortFilterProxyModel(type); |
79 needsInitialization = true; |
87 needsInitialization = true; |
80 } |
88 } |
81 model = mAllVideosModel; |
89 model = mAllVideosModel; |
82 } |
90 } |
83 else if(type == VideoCollectionWrapper::ECollections) |
91 else if(type == VideoCollectionCommon::EModelTypeCollections) |
84 { |
92 { |
85 if(!mCollectionsModel) |
93 if(!mCollectionsModel) |
86 { |
94 { |
87 mCollectionsModel = new VideoSortFilterProxyModel(type); |
95 mCollectionsModel = new VideoSortFilterProxyModel(type); |
88 needsInitialization = true; |
96 needsInitialization = true; |
89 } |
97 } |
90 model = mCollectionsModel; |
98 model = mCollectionsModel; |
91 } |
99 } |
92 else if(type == VideoCollectionWrapper::ECollectionContent) |
100 else if(type == VideoCollectionCommon::EModelTypeCollectionContent) |
93 { |
101 { |
94 if(!mCollectionContentModel) |
102 if(!mCollectionContentModel) |
95 { |
103 { |
96 mCollectionContentModel = new VideoSortFilterProxyModel(type); |
104 mCollectionContentModel = new VideoSortFilterProxyModel(type); |
97 needsInitialization = true; |
105 needsInitialization = true; |
98 } |
106 } |
99 model = mCollectionContentModel; |
107 model = mCollectionContentModel; |
100 } |
108 } |
101 else if(type == VideoCollectionWrapper::EGeneric) |
109 else if(type == VideoCollectionCommon::EModelTypeGeneric) |
102 { |
110 { |
103 if(!mGenericModel) |
111 if(!mGenericModel) |
104 { |
112 { |
105 mGenericModel = new VideoSortFilterProxyModel(type); |
113 mGenericModel = new VideoSortFilterProxyModel(type); |
106 needsInitialization = true; |
114 needsInitialization = true; |