equal
deleted
inserted
replaced
22 #include <mpxviewpluginqt.h> |
22 #include <mpxviewpluginqt.h> |
23 #include <xqpluginloader.h> |
23 #include <xqpluginloader.h> |
24 #include <xqplugininfo.h> |
24 #include <xqplugininfo.h> |
25 #include <xqserviceutil.h> |
25 #include <xqserviceutil.h> |
26 #include <xqsharablefile.h> |
26 #include <xqsharablefile.h> |
27 #include <QTranslator> |
|
28 #include <QLocale> |
|
29 |
27 |
30 #include "mpmainwindow.h" |
28 #include "mpmainwindow.h" |
31 #include "mpviewbase.h" |
29 #include "mpviewbase.h" |
32 #include "musicservices.h" |
30 #include "musicservices.h" |
33 #include "mpenginefactory.h" |
31 #include "mpenginefactory.h" |
34 #include "mpsettingsmanager.h" |
32 #include "mpsettingsmanager.h" |
|
33 #include "mpglobalpopuphandler.h" |
35 #include "mptrace.h" |
34 #include "mptrace.h" |
36 |
35 |
37 /*! |
36 /*! |
38 \class MpMainWindow |
37 \class MpMainWindow |
39 \brief The MpMainWindow class provides Main Window functionalities. |
38 \brief The MpMainWindow class provides Main Window functionalities. |
53 mSettingsViewPlugin(0), |
52 mSettingsViewPlugin(0), |
54 mDetailsViewPlugin(0), |
53 mDetailsViewPlugin(0), |
55 mMediaWallViewPlugin(0), |
54 mMediaWallViewPlugin(0), |
56 mCurrentViewPlugin(0), |
55 mCurrentViewPlugin(0), |
57 mVerticalViewType( CollectionView ), |
56 mVerticalViewType( CollectionView ), |
58 mMusicServices(0) |
57 mMusicServices(0), |
|
58 mPopupHandler(0) |
59 { |
59 { |
60 TX_LOG |
60 TX_LOG |
61 } |
61 } |
62 |
62 |
63 /*! |
63 /*! |
101 Initialize and activate the collection view |
101 Initialize and activate the collection view |
102 */ |
102 */ |
103 void MpMainWindow::initialize( ActivityMode mode ) |
103 void MpMainWindow::initialize( ActivityMode mode ) |
104 { |
104 { |
105 TX_ENTRY |
105 TX_ENTRY |
106 |
|
107 //Load musicplayer translator |
|
108 QTranslator translator; |
|
109 QString lang = QLocale::system().name(); |
|
110 QString path = QString("z:/resource/qt/translations/"); |
|
111 |
|
112 bool translatorLoaded = false; |
|
113 translatorLoaded = translator.load(path + "musicplayer_" + lang); |
|
114 TX_LOG_ARGS("Loading musicplayer translator ok=" << translatorLoaded); |
|
115 if ( translatorLoaded ) { |
|
116 qApp->installTranslator( &translator ); |
|
117 } |
|
118 |
106 |
119 #ifdef _DEBUG |
107 #ifdef _DEBUG |
120 QList<XQPluginInfo> impls; |
108 QList<XQPluginInfo> impls; |
121 XQPluginLoader::listImplementations("org.nokia.mmdt.MpxViewPlugin/1.0", impls); |
109 XQPluginLoader::listImplementations("org.nokia.mmdt.MpxViewPlugin/1.0", impls); |
122 TX_LOG_ARGS("Available plugins:"); |
110 TX_LOG_ARGS("Available plugins:"); |
134 XQServiceUtil::toBackground( false ); |
122 XQServiceUtil::toBackground( false ); |
135 } |
123 } |
136 |
124 |
137 if ( !mMusicServices ) { |
125 if ( !mMusicServices ) { |
138 MpEngineFactory::createSharedEngine(); |
126 MpEngineFactory::createSharedEngine(); |
|
127 mPopupHandler = new MpGlobalPopupHandler( this ); |
139 if ( orientation() == Qt::Vertical ) { |
128 if ( orientation() == Qt::Vertical ) { |
140 // If first startup ignore shuffleAll and send to collection view to refresh library |
129 // If first startup ignore shuffleAll and send to collection view to refresh library |
141 if ( mode == MusicMainView || MpSettingsManager::firstStartup() ) { |
130 if ( mode == MusicMainView || MpSettingsManager::firstStartup() ) { |
142 loadView(CollectionView); |
131 loadView(CollectionView); |
143 activateView(CollectionView); |
132 activateView(CollectionView); |
172 |
161 |
173 } |
162 } |
174 else { |
163 else { |
175 setOrientation(Qt::Vertical, true);//This sould prevent media wall activation. |
164 setOrientation(Qt::Vertical, true);//This sould prevent media wall activation. |
176 } |
165 } |
|
166 //since we only have one landscape view, media wall, disable automatic |
|
167 //orientation transitions, they look like a flicker. |
|
168 //This will make the view switch faster. |
|
169 setAutomaticOrientationEffectEnabled( false ); |
177 TX_EXIT |
170 TX_EXIT |
178 } |
171 } |
179 |
172 |
180 /*! |
173 /*! |
181 Slot to be called to handle the \a commandCode. |
174 Slot to be called to handle the \a commandCode. |
338 switch (mMusicServices->currentService()) { |
331 switch (mMusicServices->currentService()) { |
339 |
332 |
340 case MusicServices::EUriFetcher: |
333 case MusicServices::EUriFetcher: |
341 { |
334 { |
342 MpEngineFactory::createSharedEngine( hostUid , MpEngine::Fetch ); |
335 MpEngineFactory::createSharedEngine( hostUid , MpEngine::Fetch ); |
|
336 mPopupHandler = new MpGlobalPopupHandler( this ); |
343 loadView( CollectionView, MpCommon::FetchView ); |
337 loadView( CollectionView, MpCommon::FetchView ); |
344 MpViewBase* collectionView = reinterpret_cast<MpViewBase*>(mCollectionViewPlugin->getView()); |
338 MpViewBase* collectionView = reinterpret_cast<MpViewBase*>(mCollectionViewPlugin->getView()); |
345 connect(collectionView, SIGNAL(songSelected(QString)), mMusicServices, SLOT(itemSelected(QString))); |
339 connect(collectionView, SIGNAL(songSelected(QString)), mMusicServices, SLOT(itemSelected(QString))); |
346 activateView( CollectionView ); |
340 activateView( CollectionView ); |
347 loadView(PlaybackView, MpCommon::FetchView ); |
341 loadView(PlaybackView, MpCommon::FetchView ); |