13 * |
13 * |
14 * Description: Implementation of VideoServices |
14 * Description: Implementation of VideoServices |
15 * |
15 * |
16 */ |
16 */ |
17 |
17 |
|
18 // Version : %version: % |
|
19 |
18 #include <qobject.h> |
20 #include <qobject.h> |
19 #include "videoplayerappexport.h" |
21 #include "videoplayerappexport.h" |
20 #include "videoservices.h" |
22 #include "videoservices.h" |
21 #include "videoserviceurifetch.h" |
23 #include "videoserviceurifetch.h" |
22 #include "videoservicebrowse.h" |
24 #include "videoservicebrowse.h" |
23 #include "xqserviceutilxtra.h" |
25 #include "xqserviceutilxtra.h" |
24 |
26 |
25 VideoServices* g_Instance = 0; |
27 VideoServices* g_Instance = 0; |
26 |
28 |
27 VideoServices* VideoServices::instance(QVideoPlayerEngine* engine) |
29 VideoServices* VideoServices::instance( VideoPlayerEngine* engine ) |
28 { |
30 { |
29 static VideoServices* g_Instance = 0; |
31 static VideoServices* g_Instance = 0; |
30 |
32 |
31 if(!g_Instance) |
33 if ( ! g_Instance ) |
32 { |
34 { |
33 g_Instance = new VideoServices(engine); |
35 g_Instance = new VideoServices( engine ); |
34 } |
36 } |
35 else if(engine && !g_Instance->engine()) |
37 else if ( engine && !g_Instance->engine() ) |
36 { |
38 { |
37 g_Instance->setEngine(engine); |
39 g_Instance->setEngine( engine ); |
38 } |
40 } |
|
41 |
39 g_Instance->mReferenceCount++; |
42 g_Instance->mReferenceCount++; |
|
43 |
40 return g_Instance; |
44 return g_Instance; |
41 } |
45 } |
42 |
46 |
43 void VideoServices::decreaseReferenceCount() |
47 void VideoServices::decreaseReferenceCount() |
44 { |
48 { |
45 if(g_Instance) |
49 if ( g_Instance ) |
46 { |
50 { |
47 if(--g_Instance->mReferenceCount == 0) |
51 if ( --g_Instance->mReferenceCount == 0 ) |
48 { |
52 { |
49 delete g_Instance; |
53 delete g_Instance; |
50 g_Instance = NULL; |
54 g_Instance = NULL; |
51 } |
55 } |
52 } |
56 } |
53 } |
57 } |
54 |
58 |
55 void VideoServices::setEngine(QVideoPlayerEngine* engine) |
59 void VideoServices::setEngine( VideoPlayerEngine* engine ) |
56 { |
60 { |
57 Q_UNUSED(engine); |
61 Q_UNUSED(engine); |
58 // not stubbed |
62 // not stubbed |
59 } |
63 } |
60 |
64 |
61 QVideoPlayerEngine* VideoServices::engine() |
65 VideoPlayerEngine* VideoServices::engine() |
62 { |
66 { |
63 // not stubbed |
67 // not stubbed |
64 return 0; |
68 return 0; |
65 } |
69 } |
66 |
70 |
67 VideoServices::VideoServices(QVideoPlayerEngine* engine): |
71 VideoServices::VideoServices( VideoPlayerEngine* engine ) |
68 mReferenceCount(0), |
72 : mReferenceCount( 0 ) |
69 mEngine(engine), |
73 , mEngine( engine ) |
70 mCurrentService(VideoServices::ENoService), |
74 , mCurrentService( VideoServices::ENoService ) |
71 mSortRole(0) |
75 , mSortRole( 0 ) |
72 { |
76 { |
73 mServiceUriFetch = new VideoServiceUriFetch(this, QLatin1String("TestListView")); |
77 mServiceUriFetch = new VideoServiceUriFetch( this, QLatin1String("TestListView") ); |
74 mServiceBrowse = new VideoServiceBrowse(this, QLatin1String("TestListView")); |
78 mServiceBrowse = new VideoServiceBrowse( this, QLatin1String("TestListView") ); |
75 } |
79 } |
76 |
80 |
77 VideoServices::~VideoServices() |
81 VideoServices::~VideoServices() |
78 { |
82 { |
79 delete mServiceUriFetch; |
83 delete mServiceUriFetch; |