ui/views/slideshowsettingsview/src/glxslideshowsettingsview.cpp
changeset 26 c499df2dbb33
child 29 2c833fc9e98f
equal deleted inserted replaced
24:99ad1390cd33 26:c499df2dbb33
       
     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 "glxmodelparm.h"
       
    31 
       
    32 
       
    33 
       
    34 
       
    35 GlxSlideShowSettingsView::GlxSlideShowSettingsView(HbMainWindow *window) 
       
    36     : GlxView ( GLX_SLIDESHOWSETTINGSVIEW_ID ), 
       
    37       mDelay(NULL),
       
    38       mEffect(NULL), 
       
    39       mContextlabel (NULL),
       
    40       mEffectlabel (NULL),
       
    41       mDelaylabel (NULL),
       
    42       mWindow(window)
       
    43 {
       
    44 	 	mTempEffect = 0;
       
    45   	mTempDelay =0 ;
       
    46   	setContentFullScreen( true );
       
    47 }
       
    48 
       
    49 GlxSlideShowSettingsView::~GlxSlideShowSettingsView()
       
    50 {
       
    51 		if(mContextlabel) {
       
    52     	delete mContextlabel;
       
    53     	mContextlabel = NULL;
       
    54   	}
       
    55     if(mEffectlabel) {
       
    56     	delete mEffectlabel;
       
    57     	mEffectlabel = NULL;
       
    58     }
       
    59     if(mDelaylabel) {
       
    60     	delete mDelaylabel;
       
    61     	 mDelaylabel = NULL;
       
    62     }
       
    63     if(mEffect) {
       
    64     	delete mEffect;
       
    65     	mEffect = NULL;
       
    66     }
       
    67     if(mDelay) {
       
    68     	delete mDelay;
       
    69     	mDelay = NULL;
       
    70     }
       
    71 }
       
    72 
       
    73 void GlxSlideShowSettingsView::setModel(QAbstractItemModel *model)
       
    74 {
       
    75     return;
       
    76 }
       
    77 
       
    78 void GlxSlideShowSettingsView::orientationChanged(Qt::Orientation)
       
    79 {
       
    80     setLayout();
       
    81 }
       
    82 
       
    83 void GlxSlideShowSettingsView::activate()
       
    84 {
       
    85     connect(mWindow, SIGNAL(orientationChanged(Qt::Orientation)), this, SLOT(orientationChanged(Qt::Orientation)));
       
    86     
       
    87     if ( mContextlabel == NULL ) {
       
    88         mContextlabel = new HbLabel("Slideshow", this);
       
    89     }
       
    90     
       
    91     if ( mEffectlabel == NULL ) {
       
    92         mEffectlabel = new HbLabel("Transition effect:", this);
       
    93     }
       
    94     
       
    95     if ( mEffect == NULL ) {
       
    96         mEffect = new HbComboBox(this);
       
    97         QStringList effectList;
       
    98         effectList<<"wave"<<"smooth fade"<<"zoom to face";
       
    99         mEffect->addItems( effectList );
       
   100         
       
   101     }
       
   102     
       
   103     if ( mDelaylabel == NULL ) {
       
   104         mDelaylabel = new HbLabel("Transition delay:", this);
       
   105     }
       
   106     
       
   107     if ( mDelay == NULL ) {
       
   108         mDelay = new HbComboBox(this);
       
   109         QStringList delayList;
       
   110         delayList<<"slow"<<"medium"<<"fast";
       
   111         mDelay->addItems( delayList );
       
   112     }
       
   113    
       
   114     mEffect->setCurrentIndex( mTempEffect);
       
   115     mDelay->setCurrentIndex ( mTempDelay );
       
   116     
       
   117     setLayout();
       
   118 }
       
   119 
       
   120 void GlxSlideShowSettingsView::setLayout()
       
   121 {
       
   122     QSize sz = screenSize();
       
   123     
       
   124     mContextlabel->setGeometry( 5, 25, sz.width() - 50, 100);
       
   125     mEffectlabel->setGeometry(5, 75, sz.width() - 50, 100 );
       
   126     mEffect->setGeometry(15, 150, sz.width() - 50, 100 );
       
   127     mDelaylabel->setGeometry(5, 180, sz.width() - 50, 100 );
       
   128     mDelay->setGeometry(15, 255, sz.width() - 50, 100 );
       
   129 }
       
   130 
       
   131 void GlxSlideShowSettingsView::deActivate()
       
   132 {
       
   133 	 //Store the current effect and delay before going back to the previous view
       
   134     mTempEffect = mEffect->currentIndex();
       
   135     mTempDelay = mDelay->currentIndex();
       
   136     disconnect(mWindow, SIGNAL(orientationChanged(Qt::Orientation)), this, SLOT(orientationChanged(Qt::Orientation)));
       
   137 }
       
   138 
       
   139 
       
   140