ui/views/slideshowsettingsview/src/glxslideshowsettingsview.cpp
changeset 71 27f2d7aec52a
parent 45 863223ea6961
equal deleted inserted replaced
69:45459746d5e8 71:27f2d7aec52a
    13 *
    13 *
    14 * Description:   ?Description
    14 * Description:   ?Description
    15 *
    15 *
    16 */
    16 */
    17 
    17 
    18 
       
    19 
       
    20 //Includes
    18 //Includes
    21 #include <hbcombobox.h>
    19 #include <hbcombobox.h>
    22 #include <hbmainwindow.h>
    20 #include <hbmainwindow.h>
    23 #include <hblabel.h>
    21 #include <hblabel.h>
       
    22 #include <hbicon.h>
       
    23 #include <hbpushbutton.h>
    24 #include <QSize>
    24 #include <QSize>
    25 
    25 
    26 //User Includes
    26 //User Includes
    27 #include "glxuistd.h"
    27 #include "glxuistd.h"
    28 #include "glxviewids.h"
    28 #include "glxviewids.h"
    29 #include "glxslideshowsettingsview.h"
    29 #include "glxslideshowsettingsview.h"
    30 #include "glxsettinginterface.h"
    30 #include "glxsettinginterface.h"
    31 #include "glxlocalisationstrings.h"
    31 #include "glxlocalisationstrings.h"
       
    32 #include "glxcommandhandlers.hrh"
    32 
    33 
    33 
    34 GlxSlideShowSettingsView::GlxSlideShowSettingsView( HbMainWindow *window ) 
    34 GlxSlideShowSettingsView::GlxSlideShowSettingsView(HbMainWindow *window) 
    35     : GlxView( GLX_SLIDESHOWSETTINGSVIEW_ID ), 
    35     : GlxView ( GLX_SLIDESHOWSETTINGSVIEW_ID ), 
    36       mEffect( NULL ), 
    36       mEffect(NULL),
    37       mDelay( NULL ), 
    37       mDelay(NULL),
    38       mWindow( window ),
    38       mWindow(window), 
    39       mContextlabel( NULL ), 
    39       mContextlabel (NULL),
    40       mEffectlabel( NULL ), 
    40       mEffectlabel (NULL),
    41       mDelaylabel( NULL ), 
    41       mDelaylabel (NULL),
    42       mPlaySlideShow( NULL ),
    42       mSettings( NULL )
    43       mSettings( NULL )
    43 {
    44 {
    44     mSettings = GlxSettingInterface::instance() ;
    45     mSettings = GlxSettingInterface::instance();
    45   	setContentFullScreen( true );
    46     setContentFullScreen( true );
    46 }
    47 }
    47 
    48 
    48 GlxSlideShowSettingsView::~GlxSlideShowSettingsView()
    49 GlxSlideShowSettingsView::~GlxSlideShowSettingsView()
    49 {
    50 {
    50     delete mContextlabel;
    51     delete mContextlabel;
    51     delete mEffectlabel;
    52     delete mEffectlabel;
    52     delete mDelaylabel;
    53     delete mDelaylabel;
    53     delete mEffect;
    54     delete mEffect;
    54     delete mDelay;
    55     delete mDelay;
       
    56     delete mPlaySlideShow;
    55 }
    57 }
    56 
    58 
    57 void GlxSlideShowSettingsView::setModel(QAbstractItemModel *model)
    59 void GlxSlideShowSettingsView::setModel( QAbstractItemModel *model )
    58 {
    60 {
    59     Q_UNUSED( model )
    61     Q_UNUSED( model )
    60     return;
    62     return;
    61 }
    63 }
    62 
    64 
    63 void GlxSlideShowSettingsView::orientationChanged(Qt::Orientation)
    65 void GlxSlideShowSettingsView::orientationChanged( Qt::Orientation )
    64 {
    66 {
    65     setLayout();
    67     setLayout();
    66 }
    68 }
    67 
    69 
       
    70 void GlxSlideShowSettingsView::playSlideShow()
       
    71 {
       
    72     emit actionTriggered( EGlxCmdSelectSlideshow );
       
    73 }
       
    74 
    68 void GlxSlideShowSettingsView::activate()
    75 void GlxSlideShowSettingsView::activate()
    69 {
    76 {
    70     connect(mWindow, SIGNAL(orientationChanged(Qt::Orientation)), this, SLOT(orientationChanged(Qt::Orientation)));
    77     connect( mWindow, SIGNAL( orientationChanged( Qt::Orientation ) ), this, SLOT( orientationChanged( Qt::Orientation ) ) );
    71     
    78     
    72     if ( mContextlabel == NULL ) {
    79     if ( mContextlabel == NULL ) {
    73         mContextlabel = new HbLabel( GLX_MENU_SLIDESHOW, this );
    80         mContextlabel = new HbLabel( GLX_MENU_SLIDESHOW, this );
    74         mContextlabel->setObjectName( "SlideShow" );
    81         mContextlabel->setObjectName( "SlideShow" );
    75     }
    82     }
    76     
    83 
    77     if ( mEffectlabel == NULL ) {
    84     if ( mEffectlabel == NULL ) {
    78         mEffectlabel = new HbLabel( GLX_LABEL_TRANSITION_EFFECT, this );
    85         mEffectlabel = new HbLabel( GLX_LABEL_TRANSITION_EFFECT, this );
    79         mEffectlabel->setObjectName( "Effect" );
    86         mEffectlabel->setObjectName( "Effect" );
    80     }
    87     }
    81     
    88 
    82     if ( mEffect == NULL ) {
    89     if ( mEffect == NULL ) {
    83         mEffect = new HbComboBox(this);
    90         mEffect = new HbComboBox( this );
    84         QStringList effectList = mSettings->slideShowEffectList();
    91         QStringList effectList = mSettings->slideShowEffectList();
    85         mEffect->addItems( effectList ); 
    92         mEffect->addItems( effectList );
    86         mEffect->setObjectName( "Effect List" );
    93         mEffect->setObjectName( "Effect List" );
    87     }
    94     }
    88     
    95 
    89     if ( mDelaylabel == NULL ) {
    96     if ( mDelaylabel == NULL ) {
    90         mDelaylabel = new HbLabel( GLX_LABEL_TRANSITION_DELAY, this );
    97         mDelaylabel = new HbLabel( GLX_LABEL_TRANSITION_DELAY, this );
    91         mDelaylabel->setObjectName( "Delay" );
    98         mDelaylabel->setObjectName( "Delay" );
    92     }
    99     }
    93     
   100 
    94     if ( mDelay == NULL ) {
   101     if ( mDelay == NULL ) {
    95         mDelay = new HbComboBox(this);
   102         mDelay = new HbComboBox( this );
    96         mDelay->setObjectName( "Delay List" );
   103         mDelay->setObjectName( "Delay List" );
    97         QStringList delayList;
   104         QStringList delayList;
    98         delayList <<  GLX_VAL_SLOW << GLX_VAL_MEDIUM << GLX_VAL_FAST ;
   105         delayList << GLX_VAL_SLOW << GLX_VAL_MEDIUM << GLX_VAL_FAST;
    99         mDelay->addItems( delayList );
   106         mDelay->addItems( delayList );
   100     }
   107     }
   101    
   108     
   102    // Read the values from the cenrep    
   109     if ( mPlaySlideShow == NULL ) {
       
   110         mPlaySlideShow = new HbPushButton( this );
       
   111         mPlaySlideShow->setText( GLX_BUTTON_PLAY ) ; 
       
   112         connect( mPlaySlideShow, SIGNAL( clicked( bool ) ), this, SLOT( playSlideShow() ) );
       
   113     }
       
   114 
       
   115     // Read the values from the cenrep    
   103     mEffect->setCurrentIndex( mSettings->slideShowEffectIndex() );
   116     mEffect->setCurrentIndex( mSettings->slideShowEffectIndex() );
   104     mDelay->setCurrentIndex( mSettings->slideShowDelayIndex() );
   117     mDelay->setCurrentIndex( mSettings->slideShowDelayIndex() );
   105     setLayout();
   118     setLayout();
   106 }
   119 }
   107 
   120 
   108 void GlxSlideShowSettingsView::setLayout()
   121 void GlxSlideShowSettingsView::setLayout()
   109 {
   122 {
   110     QSize sz = screenSize();
   123     QSize sz = screenSize();
   111     
   124 
   112     mContextlabel->setGeometry( 5, 25, sz.width() - 50, 100);
   125     mContextlabel->setGeometry( 5, 25, sz.width() - 50, 100 );
   113     mEffectlabel->setGeometry(5, 75, sz.width() - 50, 100 );
   126     mEffectlabel->setGeometry( 5, 60, sz.width() - 50, 100 );
   114     mEffect->setGeometry(15, 150, sz.width() - 50, 100 );
   127     mEffect->setGeometry( 15, 130, sz.width() - 50, 100 );
   115     mDelaylabel->setGeometry(5, 180, sz.width() - 50, 100 );
   128     mDelaylabel->setGeometry( 5, 160, sz.width() - 50, 100 );
   116     mDelay->setGeometry(15, 255, sz.width() - 50, 100 );
   129     mDelay->setGeometry( 15, 230, sz.width() - 50, 100 );
       
   130     if( mWindow->orientation() == Qt::Vertical ) {
       
   131         mPlaySlideShow->setGeometry( 120, 300, 120, 60 );
       
   132     }
       
   133     else {
       
   134         mPlaySlideShow->setGeometry( 260, 300, 120, 60 );
       
   135     }
   117 }
   136 }
   118 
   137 
   119 void GlxSlideShowSettingsView::deActivate()
   138 void GlxSlideShowSettingsView::deActivate()
   120 {
   139 {
   121 	 //Store the current effect and delay before going back to the previous view
   140     //Store the current effect and delay before going back to the previous view
   122 	mSettings->setslideShowEffectIndex( mEffect->currentIndex() );
   141     mSettings->setslideShowEffectIndex( mEffect->currentIndex() );
   123 	mSettings->setSlideShowDelayIndex( mDelay->currentIndex() ); 
   142     mSettings->setSlideShowDelayIndex( mDelay->currentIndex() );
   124     disconnect(mWindow, SIGNAL(orientationChanged(Qt::Orientation)), this, SLOT(orientationChanged(Qt::Orientation)));
   143     disconnect(mWindow, SIGNAL(orientationChanged(Qt::Orientation)), this, SLOT(orientationChanged(Qt::Orientation)));
   125 }
   144 }
   126 
   145