homescreenapp/stateplugins/hshomescreenstateplugin/src/hswallpaperselectionstate.cpp
changeset 98 e6f74eb7f69f
parent 90 3ac3aaebaee5
equal deleted inserted replaced
97:66b5fe3c07fd 98:e6f74eb7f69f
     1 /*
     1 /*
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
     2 * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     4 * This component and the accompanying materials are made available
     5 * under the terms of "Eclipse Public License v1.0"
     5 * under the terms of "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
    19 #include "hsspinnerdialog.h"
    19 #include "hsspinnerdialog.h"
    20 #include "hsscene.h"
    20 #include "hsscene.h"
    21 #include "hspage.h"
    21 #include "hspage.h"
    22 #include "hswallpaper.h"
    22 #include "hswallpaper.h"
    23 #include "hsconfiguration.h"
    23 #include "hsconfiguration.h"
       
    24 #include "hssystemevents.h"
       
    25 
       
    26 #include <QDebug>
    24 
    27 
    25 #ifdef Q_OS_SYMBIAN
    28 #ifdef Q_OS_SYMBIAN
    26 #include "hsimagehandlingclient.h"
    29 #include "hsimagehandlingclient.h"
    27 #else
    30 #else
    28 #include "xqaiwgetimageclient.h"
    31 #include "xqaiwgetimageclient.h"
    75     
    78     
    76     setInitialState(state_processing);
    79     setInitialState(state_processing);
    77     state_processing->setInitialState(state_selectingImage);
    80     state_processing->setInitialState(state_selectingImage);
    78     
    81     
    79     // Transitions
    82     // Transitions
       
    83     
    80 #if defined (Q_OS_SYMBIAN) && !defined (__WINSCW__)
    84 #if defined (Q_OS_SYMBIAN) && !defined (__WINSCW__)
    81     state_selectingImage->addTransition(
    85     state_selectingImage->addTransition(
    82         this, SIGNAL(event_assignImage()), state_editingImage);
    86         this, SIGNAL(event_assignImage()), state_editingImage);           
    83 #else
    87 #else
    84     state_selectingImage->addTransition(
    88     state_selectingImage->addTransition(
    85         this, SIGNAL(event_assignImage()), state_assigningImage);
    89         this, SIGNAL(event_assignImage()), state_assigningImage);
    86 #endif // Q_OS_SYMBIAN
    90 #endif // Q_OS_SYMBIAN
    87     
    91    
    88     state_processing->addTransition(
    92     state_processing->addTransition(
    89         this, SIGNAL(event_error()), state_errorMessage);
    93         this, SIGNAL(event_error()), state_errorMessage);
    90 
    94 
    91     // Actions
    95     // Actions
    92 
    96     
    93     ENTRY_ACTION(state_selectingImage, action_selectingImage_start)
    97     ENTRY_ACTION(state_selectingImage, action_selectingImage_start)
    94     EXIT_ACTION(state_selectingImage, action_imageHandler_cleanup)
    98     EXIT_ACTION(state_selectingImage, action_imageHandler_cleanup)
    95 
    99 
    96     ENTRY_ACTION(state_editingImage, action_editingImage_start)
   100     ENTRY_ACTION(state_editingImage, action_editingImage_start)
    97     EXIT_ACTION(state_editingImage, action_imageHandler_cleanup)
   101     EXIT_ACTION(state_editingImage, action_imageHandler_cleanup)
   117 
   121 
   118     connect(mImageHandler, SIGNAL(fetchCompleted(const QString&)),
   122     connect(mImageHandler, SIGNAL(fetchCompleted(const QString&)),
   119             this, SLOT(onFetchCompleted(const QString&)));
   123             this, SLOT(onFetchCompleted(const QString&)));
   120     connect(mImageHandler, SIGNAL(fetchFailed(int, const QString&)),
   124     connect(mImageHandler, SIGNAL(fetchFailed(int, const QString&)),
   121             this, SLOT(onFetchFailed(int, const QString&)));
   125             this, SLOT(onFetchFailed(int, const QString&)));
       
   126     // Qt::QueuedConnection due to different event loop -> we use deleteLater
       
   127     connect(HsSystemEvents::instance(), SIGNAL(homeKeyClicked()),
       
   128             SIGNAL(event_waitInput()), Qt::QueuedConnection);  
   122 
   129 
   123     mImageHandler->fetch();
   130     mImageHandler->fetch();
   124 }
   131 }
   125  
   132   
   126 /*!
   133 /*!
   127 
   134 
   128 */
   135 */
   129 void HsWallpaperSelectionState::action_imageHandler_cleanup()
   136 void HsWallpaperSelectionState::action_imageHandler_cleanup()
   130 {
   137 {
   201 
   208 
   202     connect(mImageHandler, SIGNAL(editorCompleted()),
   209     connect(mImageHandler, SIGNAL(editorCompleted()),
   203             this, SLOT(onEditorCompleted()));
   210             this, SLOT(onEditorCompleted()));
   204     connect(mImageHandler, SIGNAL(editorFailed(int, const QString&)),
   211     connect(mImageHandler, SIGNAL(editorFailed(int, const QString&)),
   205             this, SLOT(onFetchFailed(int, const QString&)));
   212             this, SLOT(onFetchFailed(int, const QString&)));
       
   213     connect(HsSystemEvents::instance(), SIGNAL(homeKeyClicked()),
       
   214             SIGNAL(event_waitInput()), Qt::QueuedConnection);  
   206 
   215 
   207     mImageHandler->edit(mImagePath);
   216     mImageHandler->edit(mImagePath);
   208 #endif //Q_OS_SYMBIAN
   217 #endif //Q_OS_SYMBIAN
   209 }
   218 }
   210 #ifdef COVERAGE_MEASUREMENT
   219 #ifdef COVERAGE_MEASUREMENT