|
1 /* |
|
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Plugin interface for Music Player media wall view. |
|
15 * |
|
16 */ |
|
17 |
|
18 #include <xqplugin.h> |
|
19 |
|
20 #include "mpmediawallviewplugin.h" |
|
21 #include "mpmediawallview.h" |
|
22 #include "mptrace.h" |
|
23 |
|
24 /*! |
|
25 \class MpMediaWallViewPlugin |
|
26 \brief Plugin interface for Music Player media wall view. |
|
27 |
|
28 media wall view plugin provides interface to the media wall view |
|
29 beyond a plugin interface for application and view separation. |
|
30 */ |
|
31 |
|
32 /*! |
|
33 \fn void command( int command ) |
|
34 |
|
35 This signal is emitted when the view issues a \a command to the |
|
36 application such as request to switch to a different view. |
|
37 */ |
|
38 |
|
39 /*! |
|
40 Constructs the media wall view plugin. |
|
41 */ |
|
42 MpMediaWallViewPlugin::MpMediaWallViewPlugin() |
|
43 : mView(0), |
|
44 mState(NullView) |
|
45 { |
|
46 TX_LOG |
|
47 } |
|
48 |
|
49 /*! |
|
50 Destructs the media wall view plugin. |
|
51 */ |
|
52 MpMediaWallViewPlugin::~MpMediaWallViewPlugin() |
|
53 { |
|
54 TX_LOG |
|
55 } |
|
56 |
|
57 /*! |
|
58 Creates the media wall view. |
|
59 */ |
|
60 void MpMediaWallViewPlugin::createView() |
|
61 { |
|
62 TX_ENTRY |
|
63 if ( mState == NullView ) { |
|
64 mView = new MpMediaWallView(); |
|
65 connect( mView, SIGNAL(command(int)), this, SIGNAL(command(int)) ); |
|
66 mState = Created; |
|
67 } |
|
68 TX_EXIT |
|
69 } |
|
70 |
|
71 /*! |
|
72 Destroys the media wall view. |
|
73 */ |
|
74 void MpMediaWallViewPlugin::destroyView() |
|
75 { |
|
76 TX_ENTRY |
|
77 if ( mState != NullView ) { |
|
78 delete mView; |
|
79 mView = 0; |
|
80 mState = NullView; |
|
81 } |
|
82 TX_EXIT |
|
83 } |
|
84 |
|
85 /*! |
|
86 Activates the media wall view. View initialization is done very first time. |
|
87 */ |
|
88 void MpMediaWallViewPlugin::activateView() |
|
89 { |
|
90 TX_ENTRY_ARGS("mState=" << mState); |
|
91 switch ( mState ) { |
|
92 case Created: |
|
93 mView->initializeView(); |
|
94 mView->activateView(); |
|
95 mState = Activated; |
|
96 break; |
|
97 case Initialized: |
|
98 mView->activateView(); |
|
99 mState = Activated; |
|
100 break; |
|
101 default: |
|
102 // Ignore |
|
103 break; |
|
104 } |
|
105 TX_EXIT |
|
106 } |
|
107 |
|
108 /*! |
|
109 Deactivates the media wall view. |
|
110 */ |
|
111 void MpMediaWallViewPlugin::deactivateView() |
|
112 { |
|
113 TX_ENTRY |
|
114 if ( mState == Activated ) { |
|
115 mView->deactivateView(); |
|
116 mState = Initialized; |
|
117 } |
|
118 TX_EXIT |
|
119 } |
|
120 |
|
121 /*! |
|
122 Returns pointer to QGraphicsWidget, which is the media wall view. |
|
123 The returned pointer is 0, if it is not created first. |
|
124 |
|
125 \sa createView() |
|
126 */ |
|
127 QGraphicsWidget* MpMediaWallViewPlugin::getView() |
|
128 { |
|
129 TX_LOG |
|
130 return mView; |
|
131 } |
|
132 |
|
133 /*! |
|
134 Slot to be called when application orientation changes. |
|
135 |
|
136 \reimp |
|
137 */ |
|
138 void MpMediaWallViewPlugin::orientationChange( Qt::Orientation orientation ) |
|
139 { |
|
140 TX_LOG |
|
141 Q_UNUSED(orientation); |
|
142 } |
|
143 |
|
144 /*! |
|
145 Slot to handle back command from softkey. |
|
146 |
|
147 \reimp |
|
148 */ |
|
149 void MpMediaWallViewPlugin::back() |
|
150 { |
|
151 //do nothing, softkey is handledinternally by the view. |
|
152 TX_LOG |
|
153 } |
|
154 |
|
155 XQ_EXPORT_PLUGIN2( mpmediawallviewplugin, MpMediaWallViewPlugin ); |
|
156 |