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