--- a/mpviewplugins/mpplaybackviewplugin/src/mpplaybackview.cpp Fri Jun 11 13:36:36 2010 +0300
+++ b/mpviewplugins/mpplaybackviewplugin/src/mpplaybackview.cpp Wed Jun 23 18:10:13 2010 +0300
@@ -24,8 +24,6 @@
#include <hbtoolbutton.h>
#include <hbaction.h>
#include <hbicon.h>
-#include <QTranslator>
-#include <QLocale>
#include "mpplaybackview.h"
#include "mpplaybackwidget.h"
@@ -68,8 +66,6 @@
mPauseIcon( 0 ),
mShuffleOnIcon( 0 ),
mShuffleOffIcon( 0 ),
- mMpTranslator( 0 ),
- mCommonTranslator( 0 ),
mTimer(0),
mSeeking(false)
@@ -89,8 +85,6 @@
delete mShuffleOnIcon;
delete mShuffleOffIcon;
delete mEqualizerWidget;
- delete mMpTranslator;
- delete mCommonTranslator;
TX_EXIT
}
@@ -102,25 +96,6 @@
{
TX_ENTRY
- //Load musicplayer and common translators
- QString lang = QLocale::system().name();
- QString path = QString( "z:/resource/qt/translations/" );
- bool translatorLoaded = false;
-
- mMpTranslator = new QTranslator( this );
- translatorLoaded = mMpTranslator->load( path + "musicplayer_" + lang );
- TX_LOG_ARGS( "Loading translator ok=" << translatorLoaded );
- if ( translatorLoaded ) {
- qApp->installTranslator( mMpTranslator );
- }
-
- mCommonTranslator = new QTranslator( this );
- translatorLoaded = mCommonTranslator->load( path + "common_" + lang );
- TX_LOG_ARGS( "Loading common translator ok=" << translatorLoaded );
- if ( translatorLoaded ) {
- qApp->installTranslator( mCommonTranslator );
- }
-
mWindow = mainWindow();
mSoftKeyBack = new HbAction( Hb::BackNaviAction, this );
@@ -151,6 +126,7 @@
this, SLOT( shuffleChanged( bool ) ) );
connect( MpSettingsManager::instance(), SIGNAL( repeatChanged( bool ) ),
this, SLOT( repeatChanged( bool ) ) );
+ connect( mMpEngine, SIGNAL( libraryUpdated() ), this, SLOT( closeEqualizerDialog() ) );
}
TX_EXIT
@@ -173,18 +149,64 @@
void MpPlaybackView::deactivateView()
{
TX_ENTRY
- if ( mEqualizerWidget && mEqualizerWidget->isActive() ) {
- mEqualizerWidget->close();
- }
-
menu()->close();
-
setNavigationAction( 0 );
mActivated = false;
TX_EXIT
}
/*!
+ Gets the current status of the view in a form of string
+ */
+QString MpPlaybackView::playbackStatus()
+{
+ TX_ENTRY
+ QString currentStatus;
+
+ switch ( mPlaybackData->playbackState() ) {
+ case MpPlaybackData::NotPlaying:
+ TX_LOG_ARGS( "playbackStatus: NotPlaying" )
+ currentStatus = "NotPlaying";
+ break;
+ case MpPlaybackData::Playing:
+ TX_LOG_ARGS( "playbackStatus: Playing" )
+ currentStatus = "Playing";
+ break;
+ case MpPlaybackData::Paused:
+ TX_LOG_ARGS( "playbackStatus: Paused" )
+ currentStatus ="Paused";
+ break;
+ case MpPlaybackData::Stopped:
+ TX_LOG_ARGS( "playbackStatus: Stopped" )
+ currentStatus = "Stopped";
+ break;
+ default:
+ break;
+ }
+ TX_EXIT
+ return currentStatus;
+
+}
+
+/*!
+ Gets the current Shuffle setting value
+ */
+bool MpPlaybackView::shuffleEnabled()
+{
+ TX_ENTRY
+ return mShuffle;
+}
+
+/*!
+ Gets the current Repeat setting value
+ */
+bool MpPlaybackView::repeatEnabled()
+{
+ TX_ENTRY
+ return mRepeat;
+}
+
+/*!
Slot to be called to activate settings view.
*/
void MpPlaybackView::startSettingsView()
@@ -324,6 +346,7 @@
{
TX_ENTRY
HbToolBar *myToolBar = toolBar();
+ myToolBar->setObjectName("PlaybackToolbar");
myToolBar->setOrientation( Qt::Horizontal );
QActionGroup *actionsGroup = new QActionGroup( myToolBar );
@@ -539,6 +562,7 @@
}
}
}
+
/*!
Slot to be called to activate equalizer dialog.
*/
@@ -553,3 +577,17 @@
TX_EXIT
}
+
+/*!
+ Slot to be called when library has been updated
+ */
+void MpPlaybackView::closeEqualizerDialog()
+{
+ TX_ENTRY
+
+ if ( mEqualizerWidget ) {
+ mEqualizerWidget->close();
+ }
+
+ TX_EXIT
+}