21 |
21 |
22 #include "videooperatorservice.h" |
22 #include "videooperatorservice.h" |
23 #include "videooperatorservicedata.h" |
23 #include "videooperatorservicedata.h" |
24 #include "videocollectionviewutils.h" |
24 #include "videocollectionviewutils.h" |
25 #include "videocollectioncenrepdefs.h" |
25 #include "videocollectioncenrepdefs.h" |
|
26 #define private public |
|
27 #include "videooperatorservice_p.h" |
|
28 #undef private |
26 |
29 |
27 QList<QString> VideoOperatorServiceData::mTitles; |
30 QList<QString> VideoOperatorServiceData::mTitles; |
28 QList<QString> VideoOperatorServiceData::mIcons; |
31 QList<QString> VideoOperatorServiceData::mIcons; |
29 QList<QString> VideoOperatorServiceData::mUris; |
32 QList<QString> VideoOperatorServiceData::mUris; |
30 QList<int> VideoOperatorServiceData::mUids; |
33 QList<int> VideoOperatorServiceData::mUids; |
31 |
34 |
32 int VideoOperatorServiceData::mLoadCallCount = 0; |
35 int VideoOperatorServiceData::mLoadCallCount = 0; |
33 int VideoOperatorServiceData::mTitleCallCount = 0; |
36 int VideoOperatorServiceData::mTitleCallCount = 0; |
34 int VideoOperatorServiceData::mIconResourceCallCount = 0; |
37 int VideoOperatorServiceData::mIconResourceCallCount = 0; |
35 int VideoOperatorServiceData::mLaunchServiceCallCount = 0; |
38 int VideoOperatorServiceData::mLaunchServiceCallCount = 0; |
36 int VideoOperatorServiceData::mLaunchApplicationLCallCount = 0; |
|
37 |
39 |
38 // --------------------------------------------------------------------------- |
40 // --------------------------------------------------------------------------- |
39 // Constructor |
41 // Constructor |
40 // --------------------------------------------------------------------------- |
42 // --------------------------------------------------------------------------- |
41 // |
43 // |
42 VideoOperatorService::VideoOperatorService(QObject *parent) : |
44 VideoOperatorService::VideoOperatorService(QObject *parent) : |
43 QObject(parent) |
45 QObject(parent), d_ptr(new VideoOperatorServicePrivate()) |
44 { |
46 { |
45 mTitle = ""; |
47 } |
46 mIconResource = ""; |
48 |
47 mServiceUri = ""; |
49 // --------------------------------------------------------------------------- |
48 mApplicationUid = 0; |
50 // Destructor |
|
51 // --------------------------------------------------------------------------- |
|
52 // |
|
53 VideoOperatorService::~VideoOperatorService() |
|
54 { |
|
55 delete d_ptr; |
49 } |
56 } |
50 |
57 |
51 // --------------------------------------------------------------------------- |
58 // --------------------------------------------------------------------------- |
52 // load |
59 // load |
53 // --------------------------------------------------------------------------- |
60 // --------------------------------------------------------------------------- |
54 // |
61 // |
55 bool VideoOperatorService::load(int titleKey, int iconKey, int serviceUriKey, int appUidKey) |
62 bool VideoOperatorService::load(int titleKey, int iconKey, int serviceUriKey, int appUidKey) |
56 { |
63 { |
|
64 Q_UNUSED(titleKey); |
|
65 Q_UNUSED(iconKey); |
|
66 Q_UNUSED(serviceUriKey); |
|
67 Q_UNUSED(appUidKey); |
|
68 if(d_ptr) |
|
69 { |
|
70 if(!VideoOperatorServiceData::mTitles.isEmpty()) |
|
71 { |
|
72 d_ptr->mTitle = VideoOperatorServiceData::mTitles.takeFirst(); |
|
73 } |
|
74 |
|
75 if(!VideoOperatorServiceData::mUris.isEmpty()) |
|
76 { |
|
77 d_ptr->mServiceUri = VideoOperatorServiceData::mUris.takeFirst(); |
|
78 } |
|
79 |
|
80 if(!VideoOperatorServiceData::mIcons.isEmpty()) |
|
81 { |
|
82 d_ptr->mIconResource = VideoOperatorServiceData::mIcons.takeFirst(); |
|
83 } |
|
84 } |
57 VideoOperatorServiceData::mLoadCallCount++; |
85 VideoOperatorServiceData::mLoadCallCount++; |
58 |
|
59 if(VideoOperatorServiceData::mTitles.count() > 0) |
|
60 { |
|
61 mTitle = VideoOperatorServiceData::mTitles.takeFirst(); |
|
62 } |
|
63 if(VideoOperatorServiceData::mIcons.count() > 0) |
|
64 { |
|
65 mIconResource = VideoOperatorServiceData::mIcons.takeFirst(); |
|
66 } |
|
67 if(VideoOperatorServiceData::mUris.count() > 0) |
|
68 { |
|
69 mServiceUri = VideoOperatorServiceData::mUris.takeFirst(); |
|
70 } |
|
71 if(VideoOperatorServiceData::mUids.count() > 0) |
|
72 { |
|
73 mApplicationUid = VideoOperatorServiceData::mUids.takeFirst(); |
|
74 } |
|
75 |
86 |
76 // Icon is required, either service uri or application uid is required. |
87 // Icon is required, either service uri or application uid is required. |
77 if(mIconResource.isEmpty() && (mServiceUri.isEmpty() || mApplicationUid > 0)) |
88 if(d_ptr->mIconResource.isEmpty() || (d_ptr->mServiceUri.isEmpty() && d_ptr->mApplicationUid <= 0)) |
78 { |
89 { |
79 return false; |
90 return false; |
80 } |
91 } |
81 return true; |
92 return true; |
82 } |
93 } |
83 |
94 |
84 // --------------------------------------------------------------------------- |
95 // --------------------------------------------------------------------------- |
85 // title |
96 // title |
86 // --------------------------------------------------------------------------- |
97 // --------------------------------------------------------------------------- |
87 // |
98 // |
88 const QString VideoOperatorService::title() const |
99 const QString VideoOperatorService::title() const |
89 { |
100 { |
90 VideoOperatorServiceData::mTitleCallCount++; |
101 VideoOperatorServiceData::mTitleCallCount++; |
91 return mTitle; |
102 return d_ptr->mTitle; |
92 } |
103 } |
93 |
104 |
94 // --------------------------------------------------------------------------- |
105 // --------------------------------------------------------------------------- |
95 // iconResource |
106 // iconResource |
96 // --------------------------------------------------------------------------- |
107 // --------------------------------------------------------------------------- |
97 // |
108 // |
98 const QString VideoOperatorService::iconResource() const |
109 const QString VideoOperatorService::iconResource() const |
99 { |
110 { |
100 VideoOperatorServiceData::mIconResourceCallCount++; |
111 VideoOperatorServiceData::mIconResourceCallCount++; |
101 return mIconResource; |
112 return d_ptr->mIconResource; |
102 } |
113 } |
103 |
114 |
104 // --------------------------------------------------------------------------- |
115 // --------------------------------------------------------------------------- |
105 // launchService |
116 // launchService |
106 // --------------------------------------------------------------------------- |
117 // --------------------------------------------------------------------------- |