14 * Description: Implementation of VideoServices |
14 * Description: Implementation of VideoServices |
15 * |
15 * |
16 */ |
16 */ |
17 |
17 |
18 #include <qobject.h> |
18 #include <qobject.h> |
|
19 #include "videoplayerappexport.h" |
19 #include "videoservices.h" |
20 #include "videoservices.h" |
20 #include "videoserviceurifetch.h" |
21 #include "videoserviceurifetch.h" |
|
22 #include "videoservicebrowse.h" |
|
23 #include "xqserviceutilxtra.h" |
21 |
24 |
22 VideoServices *VideoServices::mInstance = 0; |
25 VideoServices* g_Instance = 0; |
23 |
26 |
24 VideoServices* VideoServices::instance(QVideoPlayerEngine* engine) |
27 VideoServices* VideoServices::instance(QVideoPlayerEngine* engine) |
25 { |
28 { |
26 if(!mInstance) |
29 static VideoServices* g_Instance = 0; |
|
30 |
|
31 if(!g_Instance) |
27 { |
32 { |
28 mInstance = new VideoServices(engine); |
33 g_Instance = new VideoServices(engine); |
29 } |
34 } |
30 else if(engine && !mInstance->engine()) |
35 else if(engine && !g_Instance->engine()) |
31 { |
36 { |
32 mInstance->setEngine(engine); |
37 g_Instance->setEngine(engine); |
33 } |
38 } |
34 mInstance->mReferenceCount++; |
39 g_Instance->mReferenceCount++; |
35 return mInstance; |
40 return g_Instance; |
36 } |
41 } |
37 |
42 |
38 void VideoServices::decreaseReferenceCount() |
43 void VideoServices::decreaseReferenceCount() |
39 { |
44 { |
40 if(mInstance) |
45 if(g_Instance) |
41 { |
46 { |
42 if(--mInstance->mReferenceCount == 0) |
47 if(--g_Instance->mReferenceCount == 0) |
43 { |
48 { |
44 delete mInstance; |
49 delete g_Instance; |
45 mInstance = NULL; |
50 g_Instance = NULL; |
46 } |
51 } |
47 } |
52 } |
48 } |
53 } |
49 |
54 |
50 void VideoServices::setEngine(QVideoPlayerEngine* engine) |
55 void VideoServices::setEngine(QVideoPlayerEngine* engine) |
63 mReferenceCount(0), |
68 mReferenceCount(0), |
64 mEngine(engine), |
69 mEngine(engine), |
65 mCurrentService(VideoServices::ENoService) |
70 mCurrentService(VideoServices::ENoService) |
66 { |
71 { |
67 mServiceUriFetch = new VideoServiceUriFetch(this); |
72 mServiceUriFetch = new VideoServiceUriFetch(this); |
|
73 mServiceBrowse = new VideoServiceBrowse(this); |
68 } |
74 } |
69 |
75 |
70 VideoServices::~VideoServices() |
76 VideoServices::~VideoServices() |
71 { |
77 { |
72 delete mServiceUriFetch; |
78 delete mServiceUriFetch; |
|
79 delete mServiceBrowse; |
73 } |
80 } |
74 |
81 |
75 VideoServices::TVideoService VideoServices::currentService() |
82 VideoServices::TVideoService VideoServices::currentService() |
76 { |
83 { |
77 return mCurrentService; |
84 return mCurrentService; |
|
85 } |
|
86 |
|
87 int VideoServices::getBrowseCategory() const |
|
88 { |
|
89 int category = 0; |
|
90 |
|
91 if (mServiceBrowse) |
|
92 { |
|
93 category = mServiceBrowse->getBrowseCategory(); |
|
94 } |
|
95 |
|
96 return category; |
78 } |
97 } |
79 |
98 |
80 void VideoServices::setCurrentService(VideoServices::TVideoService service) |
99 void VideoServices::setCurrentService(VideoServices::TVideoService service) |
81 { |
100 { |
82 mCurrentService = service; |
101 mCurrentService = service; |