ui/views/slideshowsettingsview/src/glxslideshowsettingsview.cpp
changeset 71 27f2d7aec52a
parent 45 863223ea6961
--- a/ui/views/slideshowsettingsview/src/glxslideshowsettingsview.cpp	Mon Sep 27 15:13:20 2010 +0530
+++ b/ui/views/slideshowsettingsview/src/glxslideshowsettingsview.cpp	Wed Oct 06 14:49:39 2010 +0530
@@ -15,12 +15,12 @@
 *
 */
 
-
-
 //Includes
 #include <hbcombobox.h>
 #include <hbmainwindow.h>
 #include <hblabel.h>
+#include <hbicon.h>
+#include <hbpushbutton.h>
 #include <QSize>
 
 //User Includes
@@ -29,20 +29,21 @@
 #include "glxslideshowsettingsview.h"
 #include "glxsettinginterface.h"
 #include "glxlocalisationstrings.h"
-
+#include "glxcommandhandlers.hrh"
 
-GlxSlideShowSettingsView::GlxSlideShowSettingsView(HbMainWindow *window) 
-    : GlxView ( GLX_SLIDESHOWSETTINGSVIEW_ID ), 
-      mEffect(NULL),
-      mDelay(NULL),
-      mWindow(window), 
-      mContextlabel (NULL),
-      mEffectlabel (NULL),
-      mDelaylabel (NULL),
+GlxSlideShowSettingsView::GlxSlideShowSettingsView( HbMainWindow *window ) 
+    : GlxView( GLX_SLIDESHOWSETTINGSVIEW_ID ), 
+      mEffect( NULL ), 
+      mDelay( NULL ), 
+      mWindow( window ),
+      mContextlabel( NULL ), 
+      mEffectlabel( NULL ), 
+      mDelaylabel( NULL ), 
+      mPlaySlideShow( NULL ),
       mSettings( NULL )
 {
-    mSettings = GlxSettingInterface::instance() ;
-  	setContentFullScreen( true );
+    mSettings = GlxSettingInterface::instance();
+    setContentFullScreen( true );
 }
 
 GlxSlideShowSettingsView::~GlxSlideShowSettingsView()
@@ -52,54 +53,66 @@
     delete mDelaylabel;
     delete mEffect;
     delete mDelay;
+    delete mPlaySlideShow;
 }
 
-void GlxSlideShowSettingsView::setModel(QAbstractItemModel *model)
+void GlxSlideShowSettingsView::setModel( QAbstractItemModel *model )
 {
     Q_UNUSED( model )
     return;
 }
 
-void GlxSlideShowSettingsView::orientationChanged(Qt::Orientation)
+void GlxSlideShowSettingsView::orientationChanged( Qt::Orientation )
 {
     setLayout();
 }
 
+void GlxSlideShowSettingsView::playSlideShow()
+{
+    emit actionTriggered( EGlxCmdSelectSlideshow );
+}
+
 void GlxSlideShowSettingsView::activate()
 {
-    connect(mWindow, SIGNAL(orientationChanged(Qt::Orientation)), this, SLOT(orientationChanged(Qt::Orientation)));
+    connect( mWindow, SIGNAL( orientationChanged( Qt::Orientation ) ), this, SLOT( orientationChanged( Qt::Orientation ) ) );
     
     if ( mContextlabel == NULL ) {
         mContextlabel = new HbLabel( GLX_MENU_SLIDESHOW, this );
         mContextlabel->setObjectName( "SlideShow" );
     }
-    
+
     if ( mEffectlabel == NULL ) {
         mEffectlabel = new HbLabel( GLX_LABEL_TRANSITION_EFFECT, this );
         mEffectlabel->setObjectName( "Effect" );
     }
-    
+
     if ( mEffect == NULL ) {
-        mEffect = new HbComboBox(this);
+        mEffect = new HbComboBox( this );
         QStringList effectList = mSettings->slideShowEffectList();
-        mEffect->addItems( effectList ); 
+        mEffect->addItems( effectList );
         mEffect->setObjectName( "Effect List" );
     }
-    
+
     if ( mDelaylabel == NULL ) {
         mDelaylabel = new HbLabel( GLX_LABEL_TRANSITION_DELAY, this );
         mDelaylabel->setObjectName( "Delay" );
     }
-    
+
     if ( mDelay == NULL ) {
-        mDelay = new HbComboBox(this);
+        mDelay = new HbComboBox( this );
         mDelay->setObjectName( "Delay List" );
         QStringList delayList;
-        delayList <<  GLX_VAL_SLOW << GLX_VAL_MEDIUM << GLX_VAL_FAST ;
+        delayList << GLX_VAL_SLOW << GLX_VAL_MEDIUM << GLX_VAL_FAST;
         mDelay->addItems( delayList );
     }
-   
-   // Read the values from the cenrep    
+    
+    if ( mPlaySlideShow == NULL ) {
+        mPlaySlideShow = new HbPushButton( this );
+        mPlaySlideShow->setText( GLX_BUTTON_PLAY ) ; 
+        connect( mPlaySlideShow, SIGNAL( clicked( bool ) ), this, SLOT( playSlideShow() ) );
+    }
+
+    // Read the values from the cenrep    
     mEffect->setCurrentIndex( mSettings->slideShowEffectIndex() );
     mDelay->setCurrentIndex( mSettings->slideShowDelayIndex() );
     setLayout();
@@ -108,19 +121,25 @@
 void GlxSlideShowSettingsView::setLayout()
 {
     QSize sz = screenSize();
-    
-    mContextlabel->setGeometry( 5, 25, sz.width() - 50, 100);
-    mEffectlabel->setGeometry(5, 75, sz.width() - 50, 100 );
-    mEffect->setGeometry(15, 150, sz.width() - 50, 100 );
-    mDelaylabel->setGeometry(5, 180, sz.width() - 50, 100 );
-    mDelay->setGeometry(15, 255, sz.width() - 50, 100 );
+
+    mContextlabel->setGeometry( 5, 25, sz.width() - 50, 100 );
+    mEffectlabel->setGeometry( 5, 60, sz.width() - 50, 100 );
+    mEffect->setGeometry( 15, 130, sz.width() - 50, 100 );
+    mDelaylabel->setGeometry( 5, 160, sz.width() - 50, 100 );
+    mDelay->setGeometry( 15, 230, sz.width() - 50, 100 );
+    if( mWindow->orientation() == Qt::Vertical ) {
+        mPlaySlideShow->setGeometry( 120, 300, 120, 60 );
+    }
+    else {
+        mPlaySlideShow->setGeometry( 260, 300, 120, 60 );
+    }
 }
 
 void GlxSlideShowSettingsView::deActivate()
 {
-	 //Store the current effect and delay before going back to the previous view
-	mSettings->setslideShowEffectIndex( mEffect->currentIndex() );
-	mSettings->setSlideShowDelayIndex( mDelay->currentIndex() ); 
+    //Store the current effect and delay before going back to the previous view
+    mSettings->setslideShowEffectIndex( mEffect->currentIndex() );
+    mSettings->setSlideShowDelayIndex( mDelay->currentIndex() );
     disconnect(mWindow, SIGNAL(orientationChanged(Qt::Orientation)), this, SLOT(orientationChanged(Qt::Orientation)));
 }