author | hgs |
Wed, 20 Oct 2010 15:25:39 +0300 | |
changeset 101 | ba1b7e218624 |
parent 98 | e6f74eb7f69f |
permissions | -rw-r--r-- |
35
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1 |
/* |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
2 |
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
3 |
* All rights reserved. |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
4 |
* This component and the accompanying materials are made available |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
5 |
* under the terms of "Eclipse Public License v1.0" |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
6 |
* which accompanies this distribution, and is available |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html". |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
8 |
* |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
9 |
* Initial Contributors: |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
10 |
* Nokia Corporation - initial contribution. |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
11 |
* |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
12 |
* Contributors: |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
13 |
* |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
14 |
* Description: |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
15 |
* |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
16 |
*/ |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
17 |
|
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
18 |
#include <QStateMachine> |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
19 |
#include <QGraphicsSceneMouseEvent> |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
20 |
#include <QPropertyAnimation> |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
21 |
#include <QApplication> |
62 | 22 |
#include <QVariantHash> |
86 | 23 |
#include <QInputContext> |
35
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
24 |
|
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
25 |
#include <HbMainWindow> |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
26 |
#include <HbView> |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
27 |
#include <HbMenu> |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
28 |
#include <HbAction> |
39
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
36
diff
changeset
|
29 |
#include <HbMessageBox> |
86 | 30 |
#include <HbInstance> |
39
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
36
diff
changeset
|
31 |
#include <HbLabel> |
46
23b5d6a29cce
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
39
diff
changeset
|
32 |
#include <HbInstantFeedback> |
23b5d6a29cce
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
39
diff
changeset
|
33 |
#include <HbContinuousFeedback> |
62 | 34 |
#include <HbPanGesture> |
35 |
#include <HbTapAndHoldGesture> |
|
86 | 36 |
#include <HbVkbHostBridge> |
37 |
#include <HbInputFocusObject> |
|
62 | 38 |
|
46
23b5d6a29cce
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
39
diff
changeset
|
39 |
#ifdef Q_OS_SYMBIAN |
23b5d6a29cce
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
39
diff
changeset
|
40 |
#include <XQSettingsManager> |
23b5d6a29cce
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
39
diff
changeset
|
41 |
#include <startupdomainpskeys.h> |
23b5d6a29cce
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
39
diff
changeset
|
42 |
#endif |
62 | 43 |
|
35
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
44 |
#include "hsidlestate.h" |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
45 |
#include "hsidlewidget.h" |
36
cdae8c6c3876
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
46 |
#include "hsdomainmodeldatastructures.h" |
35
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
47 |
#include "hsscene.h" |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
48 |
#include "hspage.h" |
69 | 49 |
#include "hspagevisual.h" |
35
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
50 |
#include "hswidgethost.h" |
69 | 51 |
#include "hswidgethostvisual.h" |
35
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
52 |
#include "hswallpaper.h" |
62 | 53 |
#include "hswallpaperselectionstate.h" |
35
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
54 |
#include "hstrashbinwidget.h" |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
55 |
#include "hspageindicator.h" |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
56 |
#include "hsmenueventfactory.h" |
36
cdae8c6c3876
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
57 |
#include "hshomescreenstatecommon.h" |
39
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
36
diff
changeset
|
58 |
#include "hstitleresolver.h" |
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
36
diff
changeset
|
59 |
#include "hsmenuservice.h" |
51
4785f57bf3d4
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
60 |
#include "hsconfiguration.h" |
63 | 61 |
#include "hsmessageboxwrapper.h" |
62 |
#include "hspropertyanimationwrapper.h" |
|
69 | 63 |
#include "hsgui.h" |
35
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
64 |
|
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
65 |
|
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
66 |
namespace |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
67 |
{ |
69 | 68 |
|
39
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
36
diff
changeset
|
69 |
//User adds a new page to home screen |
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
36
diff
changeset
|
70 |
const char hsLocTextId_OptionsMenu_AddPage[] = "txt_homescreen_opt_add_page"; |
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
36
diff
changeset
|
71 |
|
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
36
diff
changeset
|
72 |
//User removes page from home screen |
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
36
diff
changeset
|
73 |
const char hsLocTextId_OptionsMenu_RemovePage[] = "txt_homescreen_opt_remove_page"; |
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
36
diff
changeset
|
74 |
|
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
36
diff
changeset
|
75 |
//Sends request to all widgets to enable data connections |
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
36
diff
changeset
|
76 |
const char hsLocTextId_OptionsMenu_HsToOnline[] = "txt_homescreen_opt_home_screen_to_online"; |
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
36
diff
changeset
|
77 |
|
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
36
diff
changeset
|
78 |
//Sends request to all widgets to disable data connections |
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
36
diff
changeset
|
79 |
const char hsLocTextId_OptionsMenu_HsToOffline[] = "txt_homescreen_opt_home_screen_to_offline"; |
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
36
diff
changeset
|
80 |
|
101 | 81 |
//Home screen options menu item for opening Task switcher |
82 |
const char hsLocTextId_OptionsMenu_TaskSwitcher[] = "txt_homescreen_opt_task_switcher"; |
|
83 |
||
84 |
//Home screen options menu item for opening Application library |
|
85 |
const char hsLocTextId_OptionsMenu_AddContent[] = "txt_homescreen_opt_add_content"; |
|
39
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
36
diff
changeset
|
86 |
|
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
36
diff
changeset
|
87 |
//Home screen canvas menu item for opening Application library |
101 | 88 |
const char hsLocTextId_ContextMenu_AddContent[] = "txt_homescreen_list_add_content"; |
39
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
36
diff
changeset
|
89 |
|
101 | 90 |
//Home screen canvas menu item for opening picture gallery |
91 |
const char hsLocTextId_ContextMenu_ChangeWallpaper[] = "txt_homescreen_list_change_wallpaper"; |
|
46
23b5d6a29cce
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
39
diff
changeset
|
92 |
|
39
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
36
diff
changeset
|
93 |
//Heading text in confirmation dialog while removing page with content |
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
36
diff
changeset
|
94 |
const char hsLocTextId_Title_RemovePage[] = "txt_homescreen_title_remove_page"; |
46
23b5d6a29cce
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
39
diff
changeset
|
95 |
|
39
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
36
diff
changeset
|
96 |
//Text in confirmation dialog while removing page with content |
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
36
diff
changeset
|
97 |
const char hsLocTextId_Confirmation_RemovePage[] = "txt_homescreen_info_page_and_content_will_be_remov"; |
69 | 98 |
} |
46
23b5d6a29cce
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
39
diff
changeset
|
99 |
|
69 | 100 |
// Helper macros for connecting state entry and exit actions. |
101 |
#define ENTRY_ACTION(state, action) \ |
|
102 |
connect(state, SIGNAL(entered()), SLOT(action())); |
|
103 |
#define EXIT_ACTION(state, action) \ |
|
104 |
connect(state, SIGNAL(exited()), SLOT(action())); |
|
105 |
||
106 |
||
35
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
107 |
|
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
108 |
/*! |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
109 |
\class HsIdleState |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
110 |
\ingroup group_hshomescreenstateplugin |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
111 |
\brief Controller part of the home screen idle state. |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
112 |
|
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
113 |
Controls the home screen idle state execution. See the |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
114 |
state chart below for the state structure. |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
115 |
|
62 | 116 |
\imageDEPRECATED html hsidlestate_statechart.png |
35
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
117 |
*/ |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
118 |
|
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
119 |
/*! |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
120 |
Constructs a new idle state with the given \a parent. |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
121 |
*/ |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
122 |
HsIdleState::HsIdleState(QState *parent) |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
123 |
: QState(parent), |
63 | 124 |
mNavigationAction(0), |
39
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
36
diff
changeset
|
125 |
mTitleResolver(0), |
62 | 126 |
mAllowZoneAnimation(false), |
46
23b5d6a29cce
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
39
diff
changeset
|
127 |
mContinuousFeedback(0), |
23b5d6a29cce
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
39
diff
changeset
|
128 |
mTrashBinFeedbackAlreadyPlayed(false), |
51
4785f57bf3d4
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
129 |
mDeltaX(0), |
95 | 130 |
mWidgetX(0), |
131 |
mWidgetY(0), |
|
63 | 132 |
mSceneMenu(0) |
51
4785f57bf3d4
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
133 |
#ifdef Q_OS_SYMBIAN |
46
23b5d6a29cce
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
39
diff
changeset
|
134 |
,mSettingsMgr(0) |
51
4785f57bf3d4
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
135 |
#endif |
63 | 136 |
,mMessageBoxWrapper(0) |
137 |
||
35
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
138 |
{ |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
139 |
setupStates(); |
39
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
36
diff
changeset
|
140 |
mTitleResolver = new HsTitleResolver(this); |
63 | 141 |
|
46
23b5d6a29cce
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
39
diff
changeset
|
142 |
// TODO: Uncomment when updated API available |
23b5d6a29cce
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
39
diff
changeset
|
143 |
//mContinuousFeedback = new HbContinuousFeedback; |
23b5d6a29cce
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
39
diff
changeset
|
144 |
//mContinuousFeedback->setContinuousEffect(HbFeedback::ContinuousSmooth); |
23b5d6a29cce
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
39
diff
changeset
|
145 |
//mContinuousFeedback->setIntensity(HbFeedback::IntensityFull ); |
62 | 146 |
|
147 |
mVerticalSnapLineTimer.setSingleShot(true); |
|
148 |
mHorizontalSnapLineTimer.setSingleShot(true); |
|
101 | 149 |
qRegisterMetaType<HsWidgetHost *>("HsWidgetHost *"); |
35
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
150 |
} |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
151 |
|
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
152 |
/*! |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
153 |
Destroys this idle state. |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
154 |
*/ |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
155 |
HsIdleState::~HsIdleState() |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
156 |
{ |
46
23b5d6a29cce
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
39
diff
changeset
|
157 |
// TODO: Uncomment when updated API available |
23b5d6a29cce
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
39
diff
changeset
|
158 |
//delete mContinuousFeedback; |
39
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
36
diff
changeset
|
159 |
} |
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
36
diff
changeset
|
160 |
|
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
36
diff
changeset
|
161 |
/*! |
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
36
diff
changeset
|
162 |
\copydoc QObject::eventFilter(QObject *watched, QEvent *event) |
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
36
diff
changeset
|
163 |
*/ |
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
36
diff
changeset
|
164 |
bool HsIdleState::eventFilter(QObject *watched, QEvent *event) |
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
36
diff
changeset
|
165 |
{ |
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
36
diff
changeset
|
166 |
switch (event->type()) { |
46
23b5d6a29cce
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
39
diff
changeset
|
167 |
case QEvent::ApplicationActivate: |
23b5d6a29cce
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
39
diff
changeset
|
168 |
action_idle_layoutNewWidgets(); |
23b5d6a29cce
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
39
diff
changeset
|
169 |
break; |
23b5d6a29cce
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
39
diff
changeset
|
170 |
case QEvent::ApplicationDeactivate: |
23b5d6a29cce
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
39
diff
changeset
|
171 |
emit event_waitInput(); |
39
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
36
diff
changeset
|
172 |
break; |
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
36
diff
changeset
|
173 |
default: |
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
36
diff
changeset
|
174 |
break; |
46
23b5d6a29cce
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
39
diff
changeset
|
175 |
} |
23b5d6a29cce
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
39
diff
changeset
|
176 |
return QState::eventFilter(watched, event); |
35
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
177 |
} |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
178 |
|
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
179 |
/*! |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
180 |
\fn HsIdleState::event_applicationLibrary() |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
181 |
|
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
182 |
This signal initiates a transition to application library. |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
183 |
*/ |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
184 |
|
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
185 |
/*! |
46
23b5d6a29cce
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
39
diff
changeset
|
186 |
\fn HsIdleState::event_waitInput() |
35
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
187 |
|
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
188 |
This signal initiates a transition to the waitInput state. |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
189 |
*/ |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
190 |
|
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
191 |
/*! |
46
23b5d6a29cce
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
39
diff
changeset
|
192 |
\fn HsIdleState::event_moveWidget() |
35
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
193 |
|
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
194 |
This signal initiates a transition to the moveWidget state. |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
195 |
*/ |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
196 |
|
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
197 |
/*! |
46
23b5d6a29cce
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
39
diff
changeset
|
198 |
\fn HsIdleState::event_moveScene() |
35
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
199 |
|
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
200 |
This signal initiates a transition to the moveScene state. |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
201 |
*/ |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
202 |
|
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
203 |
/*! |
62 | 204 |
\fn HsIdleState::event_selectWallpaper() |
35
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
205 |
|
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
206 |
This signal initiates a transition to the selectSceneWallpaper state. |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
207 |
*/ |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
208 |
|
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
209 |
/*! |
46
23b5d6a29cce
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
39
diff
changeset
|
210 |
\fn HsIdleState::event_addPage() |
35
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
211 |
|
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
212 |
This signal initiates a transition to the addPage state. |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
213 |
*/ |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
214 |
|
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
215 |
/*! |
46
23b5d6a29cce
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
39
diff
changeset
|
216 |
\fn HsIdleState::event_removePage() |
35
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
217 |
|
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
218 |
This signal initiates a transition to the removePage state. |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
219 |
*/ |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
220 |
|
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
221 |
/*! |
46
23b5d6a29cce
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
39
diff
changeset
|
222 |
\fn HsIdleState::event_toggleConnection() |
35
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
223 |
|
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
224 |
This signal initiates a transition to the toggleConnection state. |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
225 |
*/ |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
226 |
|
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
227 |
/*! |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
228 |
Creates the internal state structure and connects |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
229 |
state entry and exit actions. |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
230 |
*/ |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
231 |
void HsIdleState::setupStates() |
46
23b5d6a29cce
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
39
diff
changeset
|
232 |
{ |
35
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
233 |
// States |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
234 |
|
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
235 |
QState *state_waitInput = new QState(this); |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
236 |
setInitialState(state_waitInput); |
90 | 237 |
|
35
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
238 |
QState *state_moveWidget = new QState(this); |
90 | 239 |
QState *state_moveWidgetMoving = new QState(state_moveWidget); |
240 |
QState *state_moveWidgetDelete = new QState(state_moveWidget); |
|
241 |
state_moveWidget->setInitialState(state_moveWidgetMoving); |
|
242 |
||
35
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
243 |
QState *state_moveScene = new QState(this); |
62 | 244 |
HsWallpaperSelectionState *state_wallpaperSelectionState = |
245 |
new HsWallpaperSelectionState(this); |
|
35
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
246 |
QState *state_addPage = new QState(this); |
63 | 247 |
QState *state_preRemovePage = new QState(this); |
35
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
248 |
QState *state_removePage = new QState(this); |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
249 |
QState *state_toggleConnection = new QState(this); |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
250 |
|
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
251 |
// Transitions |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
252 |
|
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
253 |
state_waitInput->addTransition( |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
254 |
this, SIGNAL(event_addPage()), state_addPage); |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
255 |
state_waitInput->addTransition( |
63 | 256 |
this, SIGNAL(event_preRemovePage()), state_preRemovePage); |
35
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
257 |
state_waitInput->addTransition( |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
258 |
this, SIGNAL(event_toggleConnection()), state_toggleConnection); |
39
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
36
diff
changeset
|
259 |
state_waitInput->addTransition( |
62 | 260 |
this, SIGNAL(event_selectWallpaper()), state_wallpaperSelectionState); |
261 |
state_waitInput->addTransition( |
|
51
4785f57bf3d4
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
262 |
this, SIGNAL(event_moveScene()), state_moveScene); |
62 | 263 |
state_waitInput->addTransition( |
264 |
this, SIGNAL(event_moveWidget()), state_moveWidget); |
|
46
23b5d6a29cce
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
39
diff
changeset
|
265 |
|
90 | 266 |
state_moveWidgetMoving->addTransition( |
267 |
this, SIGNAL(event_waitInput()), state_waitInput); |
|
268 |
state_moveWidgetMoving->addTransition( |
|
269 |
this, SIGNAL(event_MoveWidgetDelete()), state_moveWidgetDelete); |
|
95 | 270 |
state_moveWidgetDelete->addTransition(state_waitInput); |
46
23b5d6a29cce
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
39
diff
changeset
|
271 |
|
35
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
272 |
state_moveScene->addTransition( |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
273 |
this, SIGNAL(event_waitInput()), state_waitInput); |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
274 |
|
62 | 275 |
state_wallpaperSelectionState->addTransition( |
276 |
state_wallpaperSelectionState, SIGNAL(event_waitInput()), state_waitInput); |
|
35
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
277 |
|
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
278 |
state_addPage->addTransition(state_waitInput); |
63 | 279 |
|
280 |
state_preRemovePage->addTransition( |
|
281 |
this,SIGNAL(event_removePage()),state_removePage); |
|
282 |
||
283 |
state_preRemovePage->addTransition( |
|
284 |
this,SIGNAL(event_waitInput()),state_waitInput); |
|
35
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
285 |
|
63 | 286 |
state_removePage->addTransition( |
287 |
this,SIGNAL(event_waitInput()),state_waitInput); |
|
35
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
288 |
|
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
289 |
state_toggleConnection->addTransition(state_waitInput); |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
290 |
|
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
291 |
// Actions |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
292 |
|
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
293 |
ENTRY_ACTION(this, action_idle_setupView) |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
294 |
ENTRY_ACTION(this, action_idle_layoutNewWidgets) |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
295 |
ENTRY_ACTION(this, action_idle_showActivePage) |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
296 |
ENTRY_ACTION(this, action_idle_connectOrientationChangeEventHandler) |
39
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
36
diff
changeset
|
297 |
ENTRY_ACTION(this, action_idle_setupTitle) |
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
36
diff
changeset
|
298 |
ENTRY_ACTION(this, action_idle_installEventFilter) |
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
36
diff
changeset
|
299 |
EXIT_ACTION(this, action_idle_cleanupTitle) |
35
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
300 |
EXIT_ACTION(this, action_idle_cleanupView) |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
301 |
EXIT_ACTION(this, action_idle_disconnectOrientationChangeEventHandler) |
39
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
36
diff
changeset
|
302 |
EXIT_ACTION(this, action_idle_uninstallEventFilter) |
35
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
303 |
|
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
304 |
ENTRY_ACTION(state_waitInput, action_waitInput_updateOptionsMenu) |
62 | 305 |
ENTRY_ACTION(state_waitInput, action_waitInput_connectGestureHandlers) |
51
4785f57bf3d4
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
306 |
ENTRY_ACTION(state_waitInput, action_waitInput_publishIdleKey) |
62 | 307 |
EXIT_ACTION(state_waitInput, action_waitInput_disconnectGestureHandlers) |
308 |
EXIT_ACTION(state_waitInput, action_waitInput_resetNewWidgets) |
|
35
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
309 |
|
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
310 |
ENTRY_ACTION(state_moveWidget, action_moveWidget_reparentToControlLayer) |
46
23b5d6a29cce
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
39
diff
changeset
|
311 |
ENTRY_ACTION(state_moveWidget, action_moveWidget_startWidgetDragEffect) |
62 | 312 |
ENTRY_ACTION(state_moveWidget, action_moveWidget_connectGestureHandlers) |
86 | 313 |
ENTRY_ACTION(state_moveWidget, action_moveWidget_connectOrientationChangeEventHandler) |
62 | 314 |
ENTRY_ACTION(state_moveWidget, action_moveWidget_setWidgetSnap) |
35
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
315 |
EXIT_ACTION(state_moveWidget, action_moveWidget_reparentToPage) |
46
23b5d6a29cce
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
39
diff
changeset
|
316 |
EXIT_ACTION(state_moveWidget, action_moveWidget_startWidgetDropEffect) |
90 | 317 |
EXIT_ACTION(state_moveWidget, action_moveWidget_disableInteractive) |
62 | 318 |
EXIT_ACTION(state_moveWidget, action_moveWidget_disconnectGestureHandlers) |
86 | 319 |
EXIT_ACTION(state_moveWidget, action_moveWidget_disconnectOrientationChangeEventHandler) |
62 | 320 |
EXIT_ACTION(state_moveWidget, action_moveWidget_preventZoneAnimation) |
321 |
EXIT_ACTION(state_moveWidget, action_moveWidget_deleteWidgetSnap) |
|
35
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
322 |
|
90 | 323 |
ENTRY_ACTION(state_moveWidgetDelete, action_moveWidgetDelete_deleteWidgetOnTrashbin) |
324 |
||
62 | 325 |
ENTRY_ACTION(state_moveScene, action_moveScene_connectGestureHandlers) |
46
23b5d6a29cce
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
39
diff
changeset
|
326 |
EXIT_ACTION(state_moveScene, action_moveScene_moveToNearestPage) |
62 | 327 |
EXIT_ACTION(state_moveScene, action_moveScene_disconnectGestureHandlers) |
328 |
||
35
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
329 |
ENTRY_ACTION(state_addPage, action_addPage_addPage) |
63 | 330 |
|
331 |
ENTRY_ACTION(state_preRemovePage, action_preRemovePage_showQuery) |
|
69 | 332 |
EXIT_ACTION(state_preRemovePage, action_preRemovePage_exit); |
46
23b5d6a29cce
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
39
diff
changeset
|
333 |
|
63 | 334 |
ENTRY_ACTION(state_removePage, action_removePage_startRemovePageAnimation) |
101 | 335 |
ENTRY_ACTION(state_removePage, action_removePage_connectAboutToChangeOrientationEventHandler) |
63 | 336 |
EXIT_ACTION(state_removePage, action_removePage_removePage) |
101 | 337 |
EXIT_ACTION(state_removePage, action_removePage_disconnectAboutToChangeOrientationEventHandler) |
35
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
338 |
|
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
339 |
ENTRY_ACTION(state_toggleConnection, action_toggleConnection_toggleConnection) |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
340 |
} |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
341 |
|
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
342 |
/*! |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
343 |
Computes the page layer x position based on the given \a pageIndex. |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
344 |
*/ |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
345 |
qreal HsIdleState::pageLayerXPos(int pageIndex) const |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
346 |
{ |
69 | 347 |
return -pageIndex * HsGui::instance()->layoutRect().width(); |
35
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
348 |
} |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
349 |
|
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
350 |
/*! |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
351 |
Starts the page change animation based on the given \a targetPageIndex |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
352 |
and \a duration. |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
353 |
*/ |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
354 |
void HsIdleState::startPageChangeAnimation(int targetPageIndex, int duration) |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
355 |
{ |
90 | 356 |
if (!HsScene::instance()->activeWidget()) { |
357 |
hbInstance->allMainWindows().first()->setInteractive(false); |
|
358 |
} |
|
69 | 359 |
HsPropertyAnimationWrapper *animation = HsGui::instance()->pageChangeAnimation(); |
360 |
if (animation->isRunning()) { |
|
361 |
animation->stop(); |
|
62 | 362 |
} |
69 | 363 |
animation->disconnect(this); |
364 |
animation->setEndValue(pageLayerXPos(targetPageIndex)); |
|
365 |
animation->setDuration(duration); |
|
71 | 366 |
|
81 | 367 |
if (abs(mDeltaX) < HSCONFIGURATION_GET(pageChangePanDistance)) { |
71 | 368 |
animation->setEasingCurve(HSCONFIGURATION_GET(bounceAnimationEasingCurve)); |
369 |
} |
|
370 |
else { |
|
371 |
animation->setEasingCurve(HSCONFIGURATION_GET(pageChangeAnimationEasingCurve)); |
|
372 |
} |
|
373 |
||
69 | 374 |
connect(animation, |
62 | 375 |
SIGNAL(finished()), |
376 |
SLOT(pageChangeAnimationFinished()), |
|
377 |
Qt::UniqueConnection); |
|
69 | 378 |
animation->start(); |
62 | 379 |
|
380 |
HbInstantFeedback::play(HSCONFIGURATION_GET(pageChangeFeedbackEffect)); |
|
381 |
||
69 | 382 |
HsGui::instance()->idleWidget()->showPageIndicator(); |
383 |
HsGui::instance()->idleWidget()->setActivePage(targetPageIndex); |
|
35
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
384 |
} |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
385 |
|
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
386 |
/*! |
46
23b5d6a29cce
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
39
diff
changeset
|
387 |
Starts the page change zone animation (crawling) based on the given a\ duration |
39
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
36
diff
changeset
|
388 |
*/ |
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
36
diff
changeset
|
389 |
void HsIdleState::startPageChangeZoneAnimation(int duration) |
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
36
diff
changeset
|
390 |
{ |
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
36
diff
changeset
|
391 |
HsScene *scene = HsScene::instance(); |
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
36
diff
changeset
|
392 |
|
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
36
diff
changeset
|
393 |
int targetPageIndex = scene->activePageIndex(); |
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
36
diff
changeset
|
394 |
|
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
36
diff
changeset
|
395 |
if (isInLeftPageChangeZone() && 0 < targetPageIndex) { |
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
36
diff
changeset
|
396 |
--targetPageIndex; |
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
36
diff
changeset
|
397 |
} else if (isInRightPageChangeZone() && |
62 | 398 |
targetPageIndex < HSCONFIGURATION_GET(maximumPageCount) - 1) { |
39
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
36
diff
changeset
|
399 |
++targetPageIndex; |
46
23b5d6a29cce
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
39
diff
changeset
|
400 |
} else { |
23b5d6a29cce
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
39
diff
changeset
|
401 |
return; |
39
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
36
diff
changeset
|
402 |
} |
46
23b5d6a29cce
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
39
diff
changeset
|
403 |
|
62 | 404 |
int bounceEffect = HSCONFIGURATION_GET(bounceEffect); |
69 | 405 |
|
406 |
HsPropertyAnimationWrapper *pageCrawlingAnimation = |
|
407 |
HsGui::instance()->pageCrawlingAnimation(); |
|
51
4785f57bf3d4
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
408 |
|
39
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
36
diff
changeset
|
409 |
if (isInLeftPageChangeZone()) { |
69 | 410 |
pageCrawlingAnimation->setEndValue(pageLayerXPos(scene->activePageIndex()) + bounceEffect); |
39
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
36
diff
changeset
|
411 |
} else { |
69 | 412 |
pageCrawlingAnimation->setEndValue(pageLayerXPos(scene->activePageIndex()) - bounceEffect); |
39
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
36
diff
changeset
|
413 |
} |
69 | 414 |
pageCrawlingAnimation->setDuration(duration); |
415 |
pageCrawlingAnimation->setForward(); |
|
39
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
36
diff
changeset
|
416 |
|
69 | 417 |
connect(pageCrawlingAnimation, |
39
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
36
diff
changeset
|
418 |
SIGNAL(finished()), |
63 | 419 |
SLOT(zoneAnimationFinished()), |
420 |
Qt::UniqueConnection); |
|
62 | 421 |
|
69 | 422 |
pageCrawlingAnimation->start(); |
39
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
36
diff
changeset
|
423 |
} |
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
36
diff
changeset
|
424 |
|
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
36
diff
changeset
|
425 |
/*! |
46
23b5d6a29cce
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
39
diff
changeset
|
426 |
Checks if the active widget is located inside the left or right |
35
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
427 |
page change zone. |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
428 |
*/ |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
429 |
bool HsIdleState::isInPageChangeZone() |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
430 |
{ |
51
4785f57bf3d4
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
431 |
return isInLeftPageChangeZone() || |
4785f57bf3d4
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
432 |
isInRightPageChangeZone(); |
35
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
433 |
} |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
434 |
|
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
435 |
/*! |
51
4785f57bf3d4
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
436 |
Checks if touch point in the active widget is located inside the left |
35
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
437 |
page change zone. |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
438 |
*/ |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
439 |
bool HsIdleState::isInLeftPageChangeZone() |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
440 |
{ |
62 | 441 |
return mWidgetHotSpot.x() < HSCONFIGURATION_GET(pageChangeZoneWidth); |
35
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
442 |
} |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
443 |
|
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
444 |
/*! |
51
4785f57bf3d4
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
445 |
Checks if touch point in the active widget is located inside the right |
35
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
446 |
page change zone. |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
447 |
*/ |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
448 |
bool HsIdleState::isInRightPageChangeZone() |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
449 |
{ |
69 | 450 |
qreal pageWidth = HsGui::instance()->layoutRect().width(); |
62 | 451 |
return mWidgetHotSpot.x() > pageWidth - HSCONFIGURATION_GET(pageChangeZoneWidth); |
35
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
452 |
} |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
453 |
|
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
454 |
/*! |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
455 |
Inserts new page at index position \a pageIndex in the scene. |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
456 |
*/ |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
457 |
void HsIdleState::addPageToScene(int pageIndex) |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
458 |
{ |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
459 |
HsPageData data; |
36
cdae8c6c3876
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
460 |
data.indexPosition = pageIndex; |
35
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
461 |
HsPage *page = HsPage::createInstance(data); |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
462 |
page->load(); |
46
23b5d6a29cce
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
39
diff
changeset
|
463 |
HsScene::instance()->addPage(page); |
69 | 464 |
HsGui::instance()->idleWidget()->insertPage(pageIndex, page); |
35
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
465 |
} |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
466 |
|
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
467 |
/*! |
46
23b5d6a29cce
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
39
diff
changeset
|
468 |
Checks if page change zone animation needs to be started or stopped |
23b5d6a29cce
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
39
diff
changeset
|
469 |
*/ |
23b5d6a29cce
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
39
diff
changeset
|
470 |
void HsIdleState::updateZoneAnimation() |
23b5d6a29cce
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
39
diff
changeset
|
471 |
{ |
69 | 472 |
HsPropertyAnimationWrapper *pageCrawlingAnimation = |
473 |
HsGui::instance()->pageCrawlingAnimation(); |
|
474 |
||
63 | 475 |
if (!mAllowZoneAnimation) { |
69 | 476 |
pageCrawlingAnimation->stop(); |
63 | 477 |
} else if (isInPageChangeZone()) { |
478 |
// should we start it |
|
69 | 479 |
if (!pageCrawlingAnimation->isRunning() && |
480 |
!HsGui::instance()->pageChangeAnimation()->isRunning()) { |
|
62 | 481 |
startPageChangeZoneAnimation(HSCONFIGURATION_GET(pageChangeZoneAnimationDuration)); |
63 | 482 |
} |
69 | 483 |
} else if (pageCrawlingAnimation->isRunning()) { |
63 | 484 |
// Not in zone, but still running |
69 | 485 |
if (pageCrawlingAnimation->isForward()){ |
63 | 486 |
// reverse |
69 | 487 |
pageCrawlingAnimation->setDuration(HSCONFIGURATION_GET(pageChangeZoneReverseAnimationDuration)); |
488 |
pageCrawlingAnimation->setBackward(); |
|
63 | 489 |
} |
490 |
} |
|
46
23b5d6a29cce
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
39
diff
changeset
|
491 |
} |
23b5d6a29cce
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
39
diff
changeset
|
492 |
|
23b5d6a29cce
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
39
diff
changeset
|
493 |
/*! |
51
4785f57bf3d4
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
494 |
Selects which trash bin icon is shown or not shown at all |
4785f57bf3d4
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
495 |
*/ |
4785f57bf3d4
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
496 |
void HsIdleState::showTrashBin() |
4785f57bf3d4
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
497 |
{ |
69 | 498 |
if (HsGui::instance()->idleWidget()->trashBin()->isUnderMouse()) { |
51
4785f57bf3d4
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
499 |
if (!mTrashBinFeedbackAlreadyPlayed) { |
62 | 500 |
HbInstantFeedback::play(HSCONFIGURATION_GET(widgetOverTrashbinFeedbackEffect)); |
51
4785f57bf3d4
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
501 |
mTrashBinFeedbackAlreadyPlayed = true; |
4785f57bf3d4
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
502 |
} |
69 | 503 |
HsGui::instance()->idleWidget()->trashBin()->activate(); |
51
4785f57bf3d4
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
504 |
} else { |
69 | 505 |
HsGui::instance()->idleWidget()->trashBin()->deactivate(); |
51
4785f57bf3d4
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
506 |
mTrashBinFeedbackAlreadyPlayed = false; |
4785f57bf3d4
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
507 |
} |
4785f57bf3d4
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
508 |
|
69 | 509 |
if (!HsGui::instance()->idleWidget()->pageIndicator()->isAnimationRunning()) { |
510 |
HsGui::instance()->idleWidget()->showTrashBin(); |
|
51
4785f57bf3d4
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
511 |
} |
4785f57bf3d4
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
512 |
} |
4785f57bf3d4
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
513 |
|
4785f57bf3d4
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
514 |
/*! |
35
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
515 |
If called for the first time, setups the idle view. |
46
23b5d6a29cce
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
39
diff
changeset
|
516 |
Updates the soft key action and sets the idle view |
35
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
517 |
as the current view to the main window. |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
518 |
*/ |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
519 |
void HsIdleState::action_idle_setupView() |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
520 |
{ |
69 | 521 |
HsGui::instance()->setupIdleUi(); |
522 |
connect(HsGui::instance(),SIGNAL(navigateToApplibrary()),SIGNAL(event_applicationLibrary()),Qt::UniqueConnection); |
|
62 | 523 |
|
35
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
524 |
} |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
525 |
|
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
526 |
/*! |
39
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
36
diff
changeset
|
527 |
Sets the idle view's title. |
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
36
diff
changeset
|
528 |
*/ |
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
36
diff
changeset
|
529 |
void HsIdleState::action_idle_setupTitle() |
62 | 530 |
{ |
39
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
36
diff
changeset
|
531 |
onTitleChanged(mTitleResolver->title()); |
62 | 532 |
connect(mTitleResolver, |
533 |
SIGNAL(titleChanged(QString)), |
|
534 |
SLOT(onTitleChanged(QString))); |
|
39
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
36
diff
changeset
|
535 |
} |
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
36
diff
changeset
|
536 |
|
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
36
diff
changeset
|
537 |
/*! |
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
36
diff
changeset
|
538 |
Updates the idle view's title. |
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
36
diff
changeset
|
539 |
*/ |
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
36
diff
changeset
|
540 |
void HsIdleState::onTitleChanged(QString title) |
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
36
diff
changeset
|
541 |
{ |
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
36
diff
changeset
|
542 |
qDebug() << "HsIdleState::onTitleChanged() to title: " << title; |
69 | 543 |
HsGui::instance()->idleView()->setTitle(title); |
39
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
36
diff
changeset
|
544 |
} |
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
36
diff
changeset
|
545 |
|
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
36
diff
changeset
|
546 |
/*! |
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
36
diff
changeset
|
547 |
|
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
36
diff
changeset
|
548 |
*/ |
62 | 549 |
void HsIdleState::onAddContentFromContextMenuActionTriggered() |
550 |
{ |
|
551 |
/* include position information in homescreen data, |
|
552 |
which passed around in applib and returned when adding content |
|
553 |
*/ |
|
554 |
QVariant homescreenData(mPageHotSpot); |
|
555 |
machine()->postEvent( |
|
81 | 556 |
HsMenuEventFactory::createOpenAppLibraryEvent(Hs::AddHsMenuMode, homescreenData)); |
62 | 557 |
mPageHotSpot = QPointF(); |
558 |
} |
|
559 |
||
560 |
/*! |
|
561 |
||
562 |
*/ |
|
563 |
void HsIdleState::onAddContentFromOptionsMenuActionTriggered() |
|
39
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
36
diff
changeset
|
564 |
{ |
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
36
diff
changeset
|
565 |
machine()->postEvent( |
81 | 566 |
HsMenuEventFactory::createOpenAppLibraryEvent(Hs::AddHsMenuMode)); |
39
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
36
diff
changeset
|
567 |
} |
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
36
diff
changeset
|
568 |
|
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
36
diff
changeset
|
569 |
/*! |
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
36
diff
changeset
|
570 |
Disconnects the idle view's title. |
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
36
diff
changeset
|
571 |
*/ |
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
36
diff
changeset
|
572 |
void HsIdleState::action_idle_cleanupTitle() |
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
36
diff
changeset
|
573 |
{ |
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
36
diff
changeset
|
574 |
mTitleResolver->disconnect(this); |
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
36
diff
changeset
|
575 |
} |
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
36
diff
changeset
|
576 |
|
62 | 577 |
/*! |
578 |
||
579 |
*/ |
|
580 |
void HsIdleState::onPageTapAndHoldFinished(QGestureEvent *event) |
|
581 |
{ |
|
582 |
mPageHotSpot = qobject_cast<HbTapAndHoldGesture *>( |
|
583 |
event->gesture(Qt::TapAndHoldGesture))->scenePosition(); |
|
584 |
||
585 |
mSceneMenu = new HbMenu(); |
|
586 |
mSceneMenu->setObjectName("hs_ctx_menu"); |
|
587 |
mSceneMenu->setAttribute(Qt::WA_DeleteOnClose); |
|
588 |
||
589 |
HbAction *action = mSceneMenu->addAction(hbTrId(hsLocTextId_ContextMenu_AddContent), this, |
|
590 |
SLOT(onAddContentFromContextMenuActionTriggered())); |
|
591 |
action->setObjectName("action_add_content_ctx_menu"); |
|
592 |
||
593 |
HsScene *scene = HsScene::instance(); |
|
594 |
if (scene->pages().count() < HSCONFIGURATION_GET(maximumPageCount)) { |
|
595 |
action = mSceneMenu->addAction(hbTrId(hsLocTextId_OptionsMenu_AddPage), this, SIGNAL(event_addPage())); |
|
596 |
action->setObjectName("action_add_page_ctx_menu"); |
|
597 |
} |
|
598 |
||
599 |
action = mSceneMenu->addAction(hbTrId(hsLocTextId_ContextMenu_ChangeWallpaper), this, SIGNAL(event_selectWallpaper())); |
|
600 |
action->setObjectName("action_change_wallpaper_ctx_menu"); |
|
601 |
mSceneMenu->setPreferredPos(mPageHotSpot); |
|
602 |
mSceneMenu->open(); |
|
603 |
} |
|
604 |
||
605 |
void HsIdleState::onPagePanStarted(QGestureEvent *event) |
|
606 |
{ |
|
607 |
Q_UNUSED(event) |
|
608 |
emit event_moveScene(); |
|
609 |
} |
|
610 |
||
611 |
void HsIdleState::onPagePanUpdated(QGestureEvent *event) |
|
612 |
{ |
|
613 |
HbPanGesture *gesture = qobject_cast<HbPanGesture *>( |
|
614 |
event->gesture(Qt::PanGesture)); |
|
615 |
||
95 | 616 |
qreal temp = gesture->sceneOffset().x(); |
617 |
// for small movement take into consideration also previous delta to remove "shaking" effect |
|
618 |
if (abs(mDeltaX - temp) < 10) { |
|
619 |
mDeltaX = 0.9 * temp + 0.1 * mDeltaX; |
|
620 |
} else { |
|
621 |
mDeltaX = temp; |
|
622 |
} |
|
62 | 623 |
|
624 |
HsScene *scene = HsScene::instance(); |
|
625 |
int bounceEffect = HSCONFIGURATION_GET(bounceEffect); |
|
69 | 626 |
qreal x = qBound(pageLayerXPos(scene->pages().count() - 1) - bounceEffect / 2 / HsGui::instance()->idleWidget()->parallaxFactor(), |
62 | 627 |
pageLayerXPos(scene->activePageIndex()) + mDeltaX, |
69 | 628 |
pageLayerXPos(0) + (bounceEffect / 2 / HsGui::instance()->idleWidget()->parallaxFactor())); |
62 | 629 |
|
69 | 630 |
HsGui::instance()->idleWidget()->setSceneX(x); |
62 | 631 |
} |
632 |
||
633 |
void HsIdleState::onPagePanFinished(QGestureEvent *event) |
|
634 |
{ |
|
635 |
HbPanGesture *gesture = qobject_cast<HbPanGesture *>( |
|
636 |
event->gesture(Qt::PanGesture)); |
|
637 |
mDeltaX = gesture->sceneOffset().x(); |
|
638 |
emit event_waitInput(); |
|
639 |
} |
|
640 |
||
86 | 641 |
void HsIdleState::onWidgetTapStarted(QPointF point, HsWidgetHost *widget) |
62 | 642 |
{ |
643 |
HsScene *scene = HsScene::instance(); |
|
644 |
HsPage *page = scene->activePage(); |
|
101 | 645 |
// If z-values are changed in this event handler flow, then active widget will be |
646 |
// one benieth this one |
|
647 |
QMetaObject::invokeMethod(page, "updateZValues", Qt::QueuedConnection, Q_ARG(HsWidgetHost *,widget)); |
|
648 |
||
86 | 649 |
HbVkbHost::HbVkbStatus status = HbVkbHostBridge::instance()->keypadStatus(); |
650 |
if ( status == HbVkbHost::HbVkbStatusOpened && !isEditor(point, widget) ) { |
|
651 |
closeVirtualKeyboard(); |
|
652 |
} |
|
62 | 653 |
} |
654 |
||
655 |
void HsIdleState::onWidgetTapAndHoldFinished(QGestureEvent *event, HsWidgetHost *widget) |
|
656 |
{ |
|
657 |
HsScene *scene = HsScene::instance(); |
|
658 |
scene->setActiveWidget(widget); |
|
659 |
||
660 |
mWidgetHotSpot = qobject_cast<HbTapAndHoldGesture *>( |
|
661 |
event->gesture(Qt::TapAndHoldGesture))->scenePosition(); |
|
69 | 662 |
mWidgetHotSpotOffset = mWidgetHotSpot - widget->visual()->pos(); |
62 | 663 |
|
664 |
emit event_moveWidget(); |
|
665 |
} |
|
666 |
||
667 |
void HsIdleState::onWidgetMoveUpdated(const QPointF &scenePos, HsWidgetHost *widget) |
|
668 |
{ |
|
97 | 669 |
/* If move was interrupted by a popup and and we plan to move second widget. |
670 |
* Then the erroneous first widget instance is received here, as there is no cancel gesture |
|
671 |
-> we need to use active widget that was saved during TapAndHold. |
|
672 |
*/ |
|
673 |
widget = HsScene::instance()->activeWidget(); |
|
674 |
||
69 | 675 |
QRectF widgetRect = widget->visual()->geometry(); |
62 | 676 |
|
63 | 677 |
// Move widget to updated position. |
62 | 678 |
mWidgetHotSpot = scenePos; |
679 |
widgetRect.moveTopLeft(mWidgetHotSpot - mWidgetHotSpotOffset); |
|
680 |
||
63 | 681 |
// When moving widget can go over the pages left border. |
62 | 682 |
qreal lowerBoundX = -widgetRect.width(); |
63 | 683 |
|
684 |
// When moving widget can go over the pages right border. |
|
69 | 685 |
QRectF pageRect = HsGui::instance()->idleView()->rect(); |
62 | 686 |
qreal upperBoundX = pageRect.width(); |
687 |
||
63 | 688 |
// When moving widget can go under the chrome at the pages upper border. |
62 | 689 |
// Notice that chrome height is 64 pixels. |
690 |
qreal lowerBoundY = qreal(64) - widgetRect.height(); |
|
63 | 691 |
|
692 |
// When moving widget can go over the pages down border. |
|
62 | 693 |
qreal upperBoundY = pageRect.height(); |
694 |
||
695 |
qreal widgetX = qBound(lowerBoundX, widgetRect.x(), upperBoundX); |
|
696 |
qreal widgetY = qBound(lowerBoundY, widgetRect.y(), upperBoundY); |
|
63 | 697 |
|
95 | 698 |
// for small movement take into consideration also previous value to remove "shaking" effect |
699 |
if ((abs(mWidgetX - widgetX) < 10) && (abs(mWidgetY - widgetY) < 10)) { |
|
700 |
mWidgetX = 0.9 * widgetX + 0.1 * mWidgetX; |
|
701 |
mWidgetY = 0.9 * widgetY + 0.1 * mWidgetY; |
|
702 |
} else { |
|
703 |
mWidgetX = widgetX; |
|
704 |
mWidgetY = widgetY; |
|
705 |
} |
|
706 |
||
62 | 707 |
// If using ItemClipsChildrenToShape-flag in widgethost then |
708 |
// setPos does not update position here, however setGeometry does it, QT bug? |
|
95 | 709 |
widget->visual()->setGeometry(mWidgetX, mWidgetY, widgetRect.width(), widgetRect.height()); |
62 | 710 |
|
711 |
if (HSCONFIGURATION_GET(isSnapEnabled)) { |
|
69 | 712 |
mSnapResult = HsWidgetPositioningOnWidgetMove::instance()->run(widget->visual()->sceneBoundingRect()); |
62 | 713 |
|
81 | 714 |
bool isTrashbinOpen = HsGui::instance()->idleWidget()->trashBin()->isUnderMouse(); |
715 |
||
62 | 716 |
if (HSCONFIGURATION_GET(isSnapEffectsEnabled)) { |
81 | 717 |
if (mSnapResult.hasHorizontalSnap && !isTrashbinOpen) { |
62 | 718 |
showVerticalLine(); |
81 | 719 |
} else { |
62 | 720 |
hideVerticalLine(); |
721 |
} |
|
81 | 722 |
if (mSnapResult.hasVerticalSnap && !isTrashbinOpen) { |
62 | 723 |
showHorizontalLine(); |
81 | 724 |
} else { |
62 | 725 |
hideHorizontalLine(); |
726 |
} |
|
727 |
} |
|
728 |
||
729 |
mPreviousSnapResult = mSnapResult; |
|
730 |
} |
|
731 |
||
732 |
// Handle effects: |
|
733 |
// User is indicated by a tactile feedback if he/she is trying to move |
|
734 |
// widget over the first or the last page. |
|
63 | 735 |
HsScene *scene = HsScene::instance(); |
736 |
HsPage *page = scene->activePage(); |
|
737 |
int bounceFeedbackEffectDistance = HSCONFIGURATION_GET(bounceFeedbackEffectDistance); |
|
62 | 738 |
if( (page == scene->pages().first() && mWidgetHotSpot.x() < bounceFeedbackEffectDistance ) || |
739 |
(page == scene->pages().last() && scene->pages().count() == HSCONFIGURATION_GET(maximumPageCount) |
|
740 |
&& mWidgetHotSpot.x() > pageRect.width() - bounceFeedbackEffectDistance)) { |
|
741 |
HbInstantFeedback::play(HSCONFIGURATION_GET(widgetMoveBlockedFeedbackEffect)); |
|
742 |
// TODO: use code below when Orbit has updated ContinuousFeedback API |
|
743 |
//if (!mContinuousFeedback->isPlaying()) { |
|
744 |
// mContinuousFeedback->play(); |
|
745 |
//} |
|
63 | 746 |
} else /*if (mContinuousFeedback->isPlaying())*/ { |
62 | 747 |
//mContinuousFeedback->stop(); |
748 |
} |
|
749 |
||
750 |
updateZoneAnimation(); |
|
751 |
showTrashBin(); |
|
752 |
} |
|
753 |
||
754 |
void HsIdleState::onWidgetMoveFinished(const QPointF &scenePos, HsWidgetHost *widget) |
|
755 |
{ |
|
756 |
Q_UNUSED(scenePos) |
|
757 |
Q_UNUSED(widget) |
|
90 | 758 |
emit event_MoveWidgetDelete(); |
62 | 759 |
} |
760 |
||
39
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
36
diff
changeset
|
761 |
/*! |
35
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
762 |
Lays out the active page's new widgets that were added |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
763 |
from the application library. |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
764 |
*/ |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
765 |
void HsIdleState::action_idle_layoutNewWidgets() |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
766 |
{ |
46
23b5d6a29cce
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
39
diff
changeset
|
767 |
HsPage *page = HsScene::instance()->activePage(); |
35
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
768 |
if (!page) { |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
769 |
return; |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
770 |
} |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
771 |
|
46
23b5d6a29cce
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
39
diff
changeset
|
772 |
QList<HsWidgetHost *> widgets = page->newWidgets(); |
35
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
773 |
if (widgets.isEmpty()) { |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
774 |
return; |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
775 |
} |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
776 |
|
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
777 |
foreach (HsWidgetHost *widget, widgets) { |
55
03646e8da489
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
51
diff
changeset
|
778 |
widget->startWidget(); |
35
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
779 |
} |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
780 |
|
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
781 |
page->layoutNewWidgets(); |
36
cdae8c6c3876
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
782 |
|
35
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
783 |
} |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
784 |
|
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
785 |
/*! |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
786 |
Moves the scene and page layers so that the active |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
787 |
page is shown. |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
788 |
*/ |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
789 |
void HsIdleState::action_idle_showActivePage() |
62 | 790 |
{ |
791 |
HsScene *scene = HsScene::instance(); |
|
792 |
QApplication::instance()->installEventFilter(scene); |
|
793 |
scene->activePage()->showWidgets(); |
|
794 |
qreal x = pageLayerXPos(scene->activePageIndex()); |
|
69 | 795 |
HsGui::instance()->idleWidget()->setSceneX(x); |
35
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
796 |
} |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
797 |
|
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
798 |
/*! |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
799 |
Connects the orientation change event handler. |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
800 |
*/ |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
801 |
void HsIdleState::action_idle_connectOrientationChangeEventHandler() |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
802 |
{ |
69 | 803 |
connect(HsGui::instance(), |
35
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
804 |
SIGNAL(orientationChanged(Qt::Orientation)), |
62 | 805 |
SLOT(action_idle_orientationChanged())); |
806 |
} |
|
807 |
||
808 |
void HsIdleState::action_idle_orientationChanged() |
|
809 |
{ |
|
90 | 810 |
stopPageChangeAnimations(); |
62 | 811 |
action_idle_showActivePage(); |
35
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
812 |
} |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
813 |
|
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
814 |
/*! |
39
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
36
diff
changeset
|
815 |
Installs the event filter. |
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
36
diff
changeset
|
816 |
*/ |
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
36
diff
changeset
|
817 |
void HsIdleState::action_idle_installEventFilter() |
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
36
diff
changeset
|
818 |
{ |
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
36
diff
changeset
|
819 |
QCoreApplication::instance()->installEventFilter(this); |
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
36
diff
changeset
|
820 |
} |
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
36
diff
changeset
|
821 |
|
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
36
diff
changeset
|
822 |
/*! |
46
23b5d6a29cce
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
39
diff
changeset
|
823 |
Publishes the idle key |
23b5d6a29cce
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
39
diff
changeset
|
824 |
*/ |
23b5d6a29cce
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
39
diff
changeset
|
825 |
void HsIdleState::action_waitInput_publishIdleKey() |
23b5d6a29cce
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
39
diff
changeset
|
826 |
{ |
23b5d6a29cce
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
39
diff
changeset
|
827 |
#ifdef Q_OS_SYMBIAN |
23b5d6a29cce
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
39
diff
changeset
|
828 |
qDebug() << "HsIdleState::action_waitInput_publishIdleKey"; |
23b5d6a29cce
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
39
diff
changeset
|
829 |
if (!mSettingsMgr){ |
23b5d6a29cce
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
39
diff
changeset
|
830 |
// All done, let others know it too |
23b5d6a29cce
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
39
diff
changeset
|
831 |
qDebug() << "Setting the idle key"; |
23b5d6a29cce
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
39
diff
changeset
|
832 |
mSettingsMgr = new XQSettingsManager(this); |
23b5d6a29cce
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
39
diff
changeset
|
833 |
XQPublishAndSubscribeSettingsKey key(KPSUidStartup.iUid, KPSIdlePhase1Ok); |
23b5d6a29cce
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
39
diff
changeset
|
834 |
mSettingsMgr->writeItemValue(key, EIdlePhase1Ok); |
51
4785f57bf3d4
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
835 |
|
46
23b5d6a29cce
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
39
diff
changeset
|
836 |
// Done, we can disconnect this signal. |
23b5d6a29cce
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
39
diff
changeset
|
837 |
disconnect(sender(), SIGNAL(entered()), this, SLOT(action_waitInput_publishIdleKey())); |
23b5d6a29cce
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
39
diff
changeset
|
838 |
} |
23b5d6a29cce
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
39
diff
changeset
|
839 |
#endif |
23b5d6a29cce
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
39
diff
changeset
|
840 |
} |
23b5d6a29cce
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
39
diff
changeset
|
841 |
|
23b5d6a29cce
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
39
diff
changeset
|
842 |
/*! |
35
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
843 |
Cleans up the idle view. |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
844 |
*/ |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
845 |
void HsIdleState::action_idle_cleanupView() |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
846 |
{ |
62 | 847 |
HsScene *scene = HsScene::instance(); |
848 |
QApplication::instance()->removeEventFilter(scene); |
|
849 |
scene->activePage()->hideWidgets(); |
|
69 | 850 |
|
851 |
HsGui::instance()->disconnect(this,SIGNAL(event_applicationLibrary())); |
|
51
4785f57bf3d4
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
852 |
//Close options menu on view change |
69 | 853 |
HsGui::instance()->idleView()->setMenu(NULL); |
51
4785f57bf3d4
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
854 |
|
4785f57bf3d4
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
855 |
//Close context menu on view change |
4785f57bf3d4
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
856 |
if (mSceneMenu) { |
4785f57bf3d4
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
857 |
mSceneMenu->close(); |
4785f57bf3d4
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
858 |
} |
35
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
859 |
} |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
860 |
|
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
861 |
/*! |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
862 |
Disconnects the orientation change event handler. |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
863 |
*/ |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
864 |
void HsIdleState::action_idle_disconnectOrientationChangeEventHandler() |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
865 |
{ |
69 | 866 |
disconnect(HsGui::instance(), |
35
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
867 |
SIGNAL(orientationChanged(Qt::Orientation)), |
62 | 868 |
this, SLOT(action_idle_orientationChanged())); |
35
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
869 |
} |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
870 |
|
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
871 |
/*! |
39
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
36
diff
changeset
|
872 |
Disconnects the event filter. |
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
36
diff
changeset
|
873 |
*/ |
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
36
diff
changeset
|
874 |
void HsIdleState::action_idle_uninstallEventFilter() |
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
36
diff
changeset
|
875 |
{ |
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
36
diff
changeset
|
876 |
QCoreApplication::instance()->removeEventFilter(this); |
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
36
diff
changeset
|
877 |
} |
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
36
diff
changeset
|
878 |
|
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
36
diff
changeset
|
879 |
/*! |
35
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
880 |
Updates the options menu content. |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
881 |
*/ |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
882 |
void HsIdleState::action_waitInput_updateOptionsMenu() |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
883 |
{ |
36
cdae8c6c3876
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
884 |
HsScene *scene = HsScene::instance(); |
cdae8c6c3876
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
885 |
|
35
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
886 |
HbMenu *menu = new HbMenu(); |
62 | 887 |
menu->setObjectName("hs_menu"); |
39
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
36
diff
changeset
|
888 |
// Task switcher |
63 | 889 |
menu->addAction(hbTrId(hsLocTextId_OptionsMenu_TaskSwitcher), |
39
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
36
diff
changeset
|
890 |
this, SLOT(openTaskSwitcher())); |
63 | 891 |
|
39
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
36
diff
changeset
|
892 |
// Add content |
101 | 893 |
menu->addAction(hbTrId(hsLocTextId_OptionsMenu_AddContent), |
62 | 894 |
this, SLOT(onAddContentFromOptionsMenuActionTriggered())); |
36
cdae8c6c3876
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
895 |
// Add page |
62 | 896 |
if (scene->pages().count() < HSCONFIGURATION_GET(maximumPageCount)) { |
63 | 897 |
menu->addAction(hbTrId(hsLocTextId_OptionsMenu_AddPage), |
36
cdae8c6c3876
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
898 |
this, SIGNAL(event_addPage())); |
63 | 899 |
|
36
cdae8c6c3876
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
900 |
} |
cdae8c6c3876
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
901 |
|
39
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
36
diff
changeset
|
902 |
// Change wallpaper |
63 | 903 |
menu->addAction(hbTrId(hsLocTextId_ContextMenu_ChangeWallpaper), |
62 | 904 |
this, SIGNAL(event_selectWallpaper())); |
63 | 905 |
|
36
cdae8c6c3876
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
906 |
// Remove page |
cdae8c6c3876
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
907 |
if (scene->activePage()->isRemovable()) { |
63 | 908 |
menu->addAction(hbTrId(hsLocTextId_OptionsMenu_RemovePage), |
909 |
this, SIGNAL(event_preRemovePage())); |
|
36
cdae8c6c3876
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
910 |
} |
46
23b5d6a29cce
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
39
diff
changeset
|
911 |
|
36
cdae8c6c3876
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
912 |
// Online / Offline |
cdae8c6c3876
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
913 |
if (scene->isOnline()) { |
63 | 914 |
menu->addAction(hbTrId(hsLocTextId_OptionsMenu_HsToOffline), |
35
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
915 |
this, SIGNAL(event_toggleConnection())); |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
916 |
} else { |
63 | 917 |
menu->addAction(hbTrId(hsLocTextId_OptionsMenu_HsToOnline), |
46
23b5d6a29cce
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
39
diff
changeset
|
918 |
this, SIGNAL(event_toggleConnection())); |
35
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
919 |
} |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
920 |
|
69 | 921 |
HsGui::instance()->idleView()->setMenu(menu); |
35
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
922 |
} |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
923 |
|
62 | 924 |
void HsIdleState::action_waitInput_connectGestureHandlers() |
35
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
925 |
{ |
62 | 926 |
HsScene *scene = HsScene::instance(); |
927 |
||
928 |
connect(scene, |
|
86 | 929 |
SIGNAL(pageTapFinished(QGestureEvent*)), |
930 |
SLOT(closeVirtualKeyboard()), |
|
931 |
Qt::UniqueConnection); |
|
932 |
connect(scene, |
|
933 |
SIGNAL(pagePanStarted(QGestureEvent*)), |
|
934 |
SLOT(closeVirtualKeyboard()), |
|
935 |
Qt::UniqueConnection); |
|
936 |
||
937 |
connect(scene, |
|
62 | 938 |
SIGNAL(pageTapAndHoldFinished(QGestureEvent*)), |
939 |
SLOT(onPageTapAndHoldFinished(QGestureEvent*)), |
|
940 |
Qt::UniqueConnection); |
|
46
23b5d6a29cce
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
39
diff
changeset
|
941 |
|
62 | 942 |
connect(scene, |
943 |
SIGNAL(pagePanStarted(QGestureEvent*)), |
|
944 |
SLOT(onPagePanStarted(QGestureEvent*)), |
|
945 |
Qt::UniqueConnection); |
|
946 |
||
947 |
connect(scene, |
|
86 | 948 |
SIGNAL(widgetTapStarted(QPointF, HsWidgetHost*)), |
949 |
SLOT(onWidgetTapStarted(QPointF, HsWidgetHost*)), |
|
62 | 950 |
Qt::UniqueConnection); |
951 |
||
952 |
connect(scene, |
|
953 |
SIGNAL(widgetTapAndHoldFinished(QGestureEvent*,HsWidgetHost*)), |
|
954 |
SLOT(onWidgetTapAndHoldFinished(QGestureEvent*,HsWidgetHost*)), |
|
955 |
Qt::UniqueConnection); |
|
35
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
956 |
} |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
957 |
|
62 | 958 |
void HsIdleState::action_waitInput_disconnectGestureHandlers() |
35
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
959 |
{ |
62 | 960 |
HsScene *scene = HsScene::instance(); |
961 |
scene->disconnect(this); |
|
35
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
962 |
} |
46
23b5d6a29cce
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
39
diff
changeset
|
963 |
|
35
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
964 |
/*! |
62 | 965 |
Resets new widget layout. |
35
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
966 |
*/ |
62 | 967 |
void HsIdleState::action_waitInput_resetNewWidgets() |
35
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
968 |
{ |
62 | 969 |
HsScene::instance()->activePage()->resetNewWidgets(); |
35
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
970 |
} |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
971 |
|
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
972 |
/*! |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
973 |
Reparents the active widget to the control layer. |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
974 |
*/ |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
975 |
void HsIdleState::action_moveWidget_reparentToControlLayer() |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
976 |
{ |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
977 |
HsWidgetHost *widget = HsScene::instance()->activeWidget(); |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
978 |
Q_ASSERT(widget); |
69 | 979 |
widget->visual()->setParentItem(HsGui::instance()->idleWidget()->controlLayer()); |
35
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
980 |
|
69 | 981 |
HsGui::instance()->idleWidget()->showTrashBin(); |
35
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
982 |
} |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
983 |
|
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
984 |
/*! |
46
23b5d6a29cce
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
39
diff
changeset
|
985 |
Starts the widget drag effect. |
35
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
986 |
*/ |
46
23b5d6a29cce
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
39
diff
changeset
|
987 |
void HsIdleState::action_moveWidget_startWidgetDragEffect() |
35
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
988 |
{ |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
989 |
HsWidgetHost *widget = HsScene::instance()->activeWidget(); |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
990 |
Q_ASSERT(widget); |
46
23b5d6a29cce
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
39
diff
changeset
|
991 |
widget->startDragEffect(); |
62 | 992 |
mAllowZoneAnimation = true; |
993 |
} |
|
994 |
||
86 | 995 |
/*! |
996 |
*/ |
|
62 | 997 |
void HsIdleState::action_moveWidget_connectGestureHandlers() |
998 |
{ |
|
999 |
HsScene *scene = HsScene::instance(); |
|
1000 |
||
1001 |
connect(scene, |
|
1002 |
SIGNAL(widgetMoveUpdated(const QPointF&,HsWidgetHost*)), |
|
1003 |
SLOT(onWidgetMoveUpdated(const QPointF&,HsWidgetHost*)), |
|
1004 |
Qt::UniqueConnection); |
|
1005 |
||
1006 |
connect(scene, |
|
1007 |
SIGNAL(widgetMoveFinished(const QPointF&,HsWidgetHost*)), |
|
1008 |
SLOT(onWidgetMoveFinished(const QPointF&,HsWidgetHost*)), |
|
1009 |
Qt::UniqueConnection); |
|
35
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1010 |
} |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1011 |
|
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1012 |
/*! |
86 | 1013 |
Connects the SIGNAL for changing the orientation for moveWidget state |
1014 |
to update the snapping algorithm accordingly. |
|
1015 |
*/ |
|
1016 |
void HsIdleState::action_moveWidget_connectOrientationChangeEventHandler() |
|
1017 |
{ |
|
1018 |
connect(HsGui::instance(), |
|
1019 |
SIGNAL(orientationChanged(Qt::Orientation)), |
|
1020 |
SLOT(updateSnapAlgorithmParameters())); |
|
1021 |
} |
|
1022 |
||
1023 |
/*! |
|
62 | 1024 |
Initializes the presentation to the snapping algorithm |
1025 |
Connects the SIGNAL for changing the presentation on active page changed |
|
1026 |
Connects the timer for showing the snap lines |
|
35
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1027 |
*/ |
62 | 1028 |
void HsIdleState::action_moveWidget_setWidgetSnap() |
35
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1029 |
{ |
62 | 1030 |
if (HSCONFIGURATION_GET(isSnapEnabled)) { |
1031 |
||
1032 |
QVariantHash snapConfiguration; |
|
81 | 1033 |
snapConfiguration[Hs::snapEnabled] = QString::number(HSCONFIGURATION_GET(isSnapEnabled)); |
1034 |
snapConfiguration[Hs::snapForce] = QString::number(HSCONFIGURATION_GET(snapForce)); |
|
1035 |
snapConfiguration[Hs::snapGap] = QString::number(HSCONFIGURATION_GET(snapGap)); |
|
62 | 1036 |
HsWidgetPositioningOnWidgetMove::instance()->setConfiguration(snapConfiguration); |
1037 |
||
1038 |
updatePagePresentationToWidgetSnap(); |
|
1039 |
||
1040 |
connect(HsScene::instance(), SIGNAL(activePageChanged()), |
|
86 | 1041 |
SLOT(updateSnapAlgorithmParameters())); |
62 | 1042 |
|
1043 |
if (HSCONFIGURATION_GET(isSnapEffectsEnabled)) { |
|
1044 |
mVerticalSnapLineTimer.setInterval(HSCONFIGURATION_GET(snapTimeout)); |
|
1045 |
mHorizontalSnapLineTimer.setInterval(HSCONFIGURATION_GET(snapTimeout)); |
|
1046 |
||
1047 |
connect(&mVerticalSnapLineTimer, SIGNAL(timeout()), |
|
1048 |
SLOT(onVerticalSnapLineTimerTimeout())); |
|
1049 |
connect(&mHorizontalSnapLineTimer, SIGNAL(timeout()), |
|
1050 |
SLOT(onHorizontalSnapLineTimerTimeout())); |
|
1051 |
||
1052 |
} |
|
1053 |
} |
|
1054 |
} |
|
1055 |
||
1056 |
/*! |
|
1057 |
Create the list of inactive rectangles on the page. |
|
1058 |
*/ |
|
1059 |
QList<QRectF> HsIdleState::createInactiveWidgetRects() |
|
1060 |
{ |
|
1061 |
HsScene *scene = HsScene::instance(); |
|
1062 |
HsPage *activePage = scene->activePage(); |
|
1063 |
HsWidgetHost *activeWidget = scene->activeWidget(); |
|
1064 |
||
1065 |
QList<QRectF> incativeWidgetRects; |
|
1066 |
||
1067 |
foreach (HsWidgetHost* widget, activePage->widgets()) { |
|
1068 |
//If the above function returns the active widget, skip over it as widget and mMovingRect represent same widget. |
|
1069 |
if (widget == activeWidget) { |
|
1070 |
continue; |
|
1071 |
} |
|
69 | 1072 |
QRectF widgetRect = widget->visual()->geometry(); |
62 | 1073 |
incativeWidgetRects.append(widgetRect); |
1074 |
} |
|
1075 |
return incativeWidgetRects; |
|
35
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1076 |
} |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1077 |
|
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1078 |
/*! |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1079 |
Reparents the active widget to the active page. |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1080 |
*/ |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1081 |
void HsIdleState::action_moveWidget_reparentToPage() |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1082 |
{ |
69 | 1083 |
HsPropertyAnimationWrapper *pageCrawlingAnimation = |
1084 |
HsGui::instance()->pageCrawlingAnimation(); |
|
1085 |
if (pageCrawlingAnimation->isRunning()&& |
|
1086 |
pageCrawlingAnimation->isForward()) { |
|
1087 |
pageCrawlingAnimation->setDuration(HSCONFIGURATION_GET(pageChangeZoneReverseAnimationDuration)); |
|
1088 |
pageCrawlingAnimation->setBackward(); |
|
35
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1089 |
} |
46
23b5d6a29cce
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
39
diff
changeset
|
1090 |
|
23b5d6a29cce
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
39
diff
changeset
|
1091 |
HsScene *scene = HsScene::instance(); |
23b5d6a29cce
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
39
diff
changeset
|
1092 |
HsPage *page = scene->activePage(); |
23b5d6a29cce
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
39
diff
changeset
|
1093 |
HsWidgetHost *widget = scene->activeWidget(); |
90 | 1094 |
|
1095 |
if (widget) { |
|
46
23b5d6a29cce
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
39
diff
changeset
|
1096 |
if (widget->page() != page) { |
23b5d6a29cce
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
39
diff
changeset
|
1097 |
widget->page()->removeWidget(widget); |
23b5d6a29cce
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
39
diff
changeset
|
1098 |
page->addExistingWidget(widget); |
69 | 1099 |
if (HsGui::instance()->orientation() == Qt::Horizontal) { |
55
03646e8da489
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
51
diff
changeset
|
1100 |
widget->removePresentation(Qt::Vertical); |
46
23b5d6a29cce
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
39
diff
changeset
|
1101 |
} else { |
55
03646e8da489
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
51
diff
changeset
|
1102 |
widget->removePresentation(Qt::Horizontal); |
46
23b5d6a29cce
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
39
diff
changeset
|
1103 |
} |
23b5d6a29cce
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
39
diff
changeset
|
1104 |
} |
23b5d6a29cce
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
39
diff
changeset
|
1105 |
|
63 | 1106 |
//Set the snap position of the widget and save the position |
69 | 1107 |
QRectF widgetRect = widget->visual()->geometry(); |
62 | 1108 |
if (mSnapResult.hasHorizontalSnap) { |
1109 |
widgetRect.moveLeft(mSnapResult.horizontalSnapPosition); |
|
1110 |
} |
|
1111 |
if (mSnapResult.hasVerticalSnap) { |
|
1112 |
widgetRect.moveTop(mSnapResult.verticalSnapPosition); |
|
1113 |
} |
|
1114 |
||
63 | 1115 |
QPointF adjustedWidgetPosition = page->adjustedWidgetPosition(widgetRect); |
69 | 1116 |
widget->visual()->setPos(adjustedWidgetPosition); |
46
23b5d6a29cce
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
39
diff
changeset
|
1117 |
|
55
03646e8da489
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
51
diff
changeset
|
1118 |
widget->savePresentation(); |
101 | 1119 |
page->updateZValues(widget); |
90 | 1120 |
|
1121 |
widget->visual()->setParentItem(HsScene::instance()->activePage()->visual()); |
|
46
23b5d6a29cce
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
39
diff
changeset
|
1122 |
} |
90 | 1123 |
HsGui::instance()->idleWidget()->showPageIndicator(); |
1124 |
||
1125 |
emit event_waitInput(); |
|
1126 |
} |
|
1127 |
||
46
23b5d6a29cce
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
39
diff
changeset
|
1128 |
|
90 | 1129 |
/*! |
1130 |
Reparents the active widget to the active page. |
|
1131 |
*/ |
|
1132 |
void HsIdleState::action_moveWidgetDelete_deleteWidgetOnTrashbin() |
|
1133 |
{ |
|
1134 |
HsScene *scene = HsScene::instance(); |
|
1135 |
HsWidgetHost *widget = scene->activeWidget(); |
|
46
23b5d6a29cce
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
39
diff
changeset
|
1136 |
|
90 | 1137 |
if ( widget && HsGui::instance()->idleWidget()->trashBin()->isUnderMouse() ) { |
1138 |
HbInstantFeedback::play(HSCONFIGURATION_GET(widgetDropToTrashbinFeedbackEffect)); |
|
1139 |
widget->page()->removeWidget(widget); |
|
1140 |
widget->remove(); |
|
1141 |
scene->setActiveWidget(0); |
|
1142 |
} |
|
35
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1143 |
} |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1144 |
|
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1145 |
/*! |
46
23b5d6a29cce
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
39
diff
changeset
|
1146 |
Starts the widget drop effect. |
35
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1147 |
*/ |
46
23b5d6a29cce
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
39
diff
changeset
|
1148 |
void HsIdleState::action_moveWidget_startWidgetDropEffect() |
35
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1149 |
{ |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1150 |
HsWidgetHost *widget = HsScene::instance()->activeWidget(); |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1151 |
if (widget) { |
46
23b5d6a29cce
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
39
diff
changeset
|
1152 |
widget->startDropEffect(); |
35
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1153 |
} |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1154 |
} |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1155 |
|
86 | 1156 |
/*! |
90 | 1157 |
Set interactive to false. |
1158 |
*/ |
|
1159 |
void HsIdleState::action_moveWidget_disableInteractive() |
|
1160 |
{ |
|
1161 |
HsWidgetHost *widget = HsScene::instance()->activeWidget(); |
|
1162 |
if (widget) { |
|
1163 |
HsPropertyAnimationWrapper *animation = HsGui::instance()->pageChangeAnimation(); |
|
1164 |
if (animation->isRunning()) { |
|
1165 |
hbInstance->allMainWindows().first()->setInteractive(false); |
|
1166 |
} |
|
1167 |
HsScene::instance()->setActiveWidget(0); |
|
1168 |
} |
|
1169 |
} |
|
1170 |
||
1171 |
/*! |
|
86 | 1172 |
Disconnects gesture handlers |
1173 |
*/ |
|
62 | 1174 |
void HsIdleState::action_moveWidget_disconnectGestureHandlers() |
35
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1175 |
{ |
62 | 1176 |
HsScene *scene = HsScene::instance(); |
1177 |
scene->disconnect(this); |
|
35
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1178 |
} |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1179 |
|
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1180 |
/*! |
86 | 1181 |
Disconnects orientation change on moveWidget state |
1182 |
*/ |
|
1183 |
void HsIdleState::action_moveWidget_disconnectOrientationChangeEventHandler() |
|
1184 |
{ |
|
1185 |
disconnect(HsGui::instance(), |
|
1186 |
SIGNAL(orientationChanged(Qt::Orientation)), |
|
1187 |
this, SLOT(updateSnapAlgorithmParameters())); |
|
1188 |
||
1189 |
} |
|
1190 |
||
1191 |
/*! |
|
62 | 1192 |
Resets the snap position |
1193 |
Disconnect the Active Page Changed SIGNAL |
|
1194 |
Disconnects the timers to show snap lines |
|
35
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1195 |
*/ |
62 | 1196 |
void HsIdleState::action_moveWidget_deleteWidgetSnap() |
35
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1197 |
{ |
62 | 1198 |
if (HSCONFIGURATION_GET(isSnapEnabled)) { |
1199 |
resetSnapPosition(); |
|
1200 |
||
1201 |
disconnect(HsScene::instance(), SIGNAL(activePageChanged()), |
|
86 | 1202 |
this, SLOT(updateSnapAlgorithmParameters())); |
62 | 1203 |
|
1204 |
if (HSCONFIGURATION_GET(isSnapEffectsEnabled)) { |
|
1205 |
disconnect(&mVerticalSnapLineTimer, SIGNAL(timeout()), |
|
1206 |
this, SLOT(onVerticalSnapLineTimerTimeout())); |
|
1207 |
disconnect(&mHorizontalSnapLineTimer, SIGNAL(timeout()), |
|
1208 |
this, SLOT(onHorizontalSnapLineTimerTimeout())); |
|
1209 |
} |
|
1210 |
} |
|
1211 |
} |
|
1212 |
||
1213 |
/*! |
|
1214 |
Prevents page change zone animation. |
|
1215 |
*/ |
|
1216 |
void HsIdleState::action_moveWidget_preventZoneAnimation() |
|
1217 |
{ |
|
1218 |
mAllowZoneAnimation = false; |
|
1219 |
} |
|
1220 |
||
1221 |
void HsIdleState::action_moveScene_connectGestureHandlers() |
|
1222 |
{ |
|
1223 |
HsScene *scene = HsScene::instance(); |
|
1224 |
||
1225 |
connect(scene, |
|
1226 |
SIGNAL(pagePanUpdated(QGestureEvent*)), |
|
1227 |
SLOT(onPagePanUpdated(QGestureEvent*)), |
|
1228 |
Qt::UniqueConnection); |
|
1229 |
||
1230 |
connect(scene, |
|
1231 |
SIGNAL(pagePanFinished(QGestureEvent*)), |
|
1232 |
SLOT(onPagePanFinished(QGestureEvent*)), |
|
1233 |
Qt::UniqueConnection); |
|
35
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1234 |
} |
46
23b5d6a29cce
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
39
diff
changeset
|
1235 |
|
23b5d6a29cce
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
39
diff
changeset
|
1236 |
/*! |
23b5d6a29cce
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
39
diff
changeset
|
1237 |
Moves to the nearest page. |
23b5d6a29cce
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
39
diff
changeset
|
1238 |
*/ |
23b5d6a29cce
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
39
diff
changeset
|
1239 |
void HsIdleState::action_moveScene_moveToNearestPage() |
23b5d6a29cce
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
39
diff
changeset
|
1240 |
{ |
23b5d6a29cce
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
39
diff
changeset
|
1241 |
QList<HsPage *> pages = HsScene::instance()->pages(); |
69 | 1242 |
QSizeF pageSize = pages.first()->visual()->size(); |
46
23b5d6a29cce
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
39
diff
changeset
|
1243 |
|
23b5d6a29cce
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
39
diff
changeset
|
1244 |
int pageIndex = HsScene::instance()->activePageIndex(); |
23b5d6a29cce
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
39
diff
changeset
|
1245 |
|
81 | 1246 |
if (mDeltaX < -HSCONFIGURATION_GET(pageChangePanDistance)) { |
46
23b5d6a29cce
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
39
diff
changeset
|
1247 |
pageIndex = qMin(pageIndex + 1, pages.count() - 1); |
81 | 1248 |
} else if (HSCONFIGURATION_GET(pageChangePanDistance) < mDeltaX) { |
46
23b5d6a29cce
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
39
diff
changeset
|
1249 |
pageIndex = qMax(pageIndex - 1, 0); |
23b5d6a29cce
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
39
diff
changeset
|
1250 |
} |
23b5d6a29cce
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
39
diff
changeset
|
1251 |
|
23b5d6a29cce
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
39
diff
changeset
|
1252 |
HsScene::instance()->setActivePageIndex(pageIndex); |
23b5d6a29cce
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
39
diff
changeset
|
1253 |
|
69 | 1254 |
HsPage *page = HsScene::instance()->activePage(); |
1255 |
if (page) { |
|
1256 |
QList<HsWidgetHost *> widgets = page->newWidgets(); |
|
1257 |
if (!widgets.isEmpty()) { |
|
1258 |
foreach (HsWidgetHost *widget, widgets) { |
|
1259 |
widget->startWidget(); |
|
1260 |
} |
|
1261 |
} |
|
1262 |
page->layoutNewWidgets(); |
|
1263 |
} |
|
1264 |
||
62 | 1265 |
startPageChangeAnimation(pageIndex, HSCONFIGURATION_GET(pageChangeAnimationDuration)); |
35
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1266 |
} |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1267 |
|
62 | 1268 |
void HsIdleState::action_moveScene_disconnectGestureHandlers() |
35
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1269 |
{ |
39
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
36
diff
changeset
|
1270 |
HsScene *scene = HsScene::instance(); |
62 | 1271 |
scene->disconnect(this); |
35
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1272 |
} |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1273 |
|
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1274 |
/*! |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1275 |
Adds a new page to the scene. |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1276 |
*/ |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1277 |
void HsIdleState::action_addPage_addPage() |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1278 |
{ |
46
23b5d6a29cce
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
39
diff
changeset
|
1279 |
HsScene *scene = HsScene::instance(); |
62 | 1280 |
int pageIndex = scene->activePageIndex() + 1; |
46
23b5d6a29cce
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
39
diff
changeset
|
1281 |
addPageToScene(pageIndex); |
35
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1282 |
scene->setActivePageIndex(pageIndex); |
62 | 1283 |
startPageChangeAnimation(pageIndex, HSCONFIGURATION_GET(newPageAddedAnimationDuration)); |
69 | 1284 |
HsGui::instance()->idleWidget()->pageIndicator()->addItem(pageIndex); |
1285 |
HsGui::instance()->idleWidget()->showPageIndicator(); |
|
35
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1286 |
} |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1287 |
|
69 | 1288 |
/*! |
1289 |
Displays a confirmation query before page is removed if there are widgets on page |
|
1290 |
*/ |
|
63 | 1291 |
void HsIdleState::action_preRemovePage_showQuery() |
35
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1292 |
{ |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1293 |
HsScene *scene = HsScene::instance(); |
39
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
36
diff
changeset
|
1294 |
HsPage *page = scene->activePage(); |
35
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1295 |
|
46
23b5d6a29cce
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
39
diff
changeset
|
1296 |
if (!page->widgets().isEmpty()) { |
63 | 1297 |
if (!mMessageBoxWrapper) { |
1298 |
mMessageBoxWrapper = new HsMessageBoxWrapper(this); |
|
1299 |
mMessageBoxWrapper->setHeader(hbTrId(hsLocTextId_Title_RemovePage)); |
|
1300 |
mMessageBoxWrapper->setQueryText(hbTrId(hsLocTextId_Confirmation_RemovePage)); |
|
1301 |
connect(mMessageBoxWrapper,SIGNAL(accepted()),SIGNAL(event_removePage())); |
|
1302 |
connect(mMessageBoxWrapper,SIGNAL(rejected()),SIGNAL(event_waitInput())); |
|
1303 |
} |
|
1304 |
mMessageBoxWrapper->show(); |
|
46
23b5d6a29cce
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
39
diff
changeset
|
1305 |
} else { |
62 | 1306 |
// Empty page can be removed without confirmation |
63 | 1307 |
emit event_removePage(); |
46
23b5d6a29cce
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
39
diff
changeset
|
1308 |
} |
35
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1309 |
} |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1310 |
|
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1311 |
/*! |
69 | 1312 |
Make sure confirmation query gets closed if user exits preRemovePage state e.g. by pressing application key |
1313 |
*/ |
|
1314 |
void HsIdleState::action_preRemovePage_exit() |
|
1315 |
{ |
|
1316 |
if (mMessageBoxWrapper) { |
|
1317 |
mMessageBoxWrapper->close(); |
|
1318 |
} |
|
1319 |
} |
|
1320 |
||
1321 |
/*! |
|
63 | 1322 |
Start remove page animation. |
1323 |
*/ |
|
1324 |
void HsIdleState::action_removePage_startRemovePageAnimation() |
|
1325 |
{ |
|
1326 |
HsScene *scene = HsScene::instance(); |
|
1327 |
||
1328 |
int pageToRemoveIndex = scene->activePageIndex(); |
|
1329 |
bool isLastPage(scene->activePage() == scene->pages().last()); |
|
1330 |
||
1331 |
int nextPageIndex(pageToRemoveIndex); |
|
81 | 1332 |
|
63 | 1333 |
if (isLastPage) { |
1334 |
nextPageIndex--; |
|
81 | 1335 |
} else { |
1336 |
nextPageIndex++; |
|
63 | 1337 |
} |
81 | 1338 |
|
69 | 1339 |
HsPropertyAnimationWrapper *animation = HsGui::instance()->pageChangeAnimation(); |
1340 |
if (animation->isRunning()) { |
|
1341 |
animation->stop(); |
|
63 | 1342 |
} |
69 | 1343 |
animation->disconnect(this); |
101 | 1344 |
|
69 | 1345 |
connect(animation, |
63 | 1346 |
SIGNAL(finished()), |
1347 |
SIGNAL(event_waitInput()), |
|
1348 |
Qt::UniqueConnection); |
|
101 | 1349 |
|
69 | 1350 |
animation->setEndValue(pageLayerXPos(nextPageIndex)); |
1351 |
animation->setDuration(HSCONFIGURATION_GET(pageRemovedAnimationDuration)); |
|
63 | 1352 |
|
69 | 1353 |
animation->start(); |
63 | 1354 |
|
1355 |
HbInstantFeedback::play(HSCONFIGURATION_GET(pageChangeFeedbackEffect)); |
|
101 | 1356 |
} |
1357 |
||
1358 |
/*! |
|
1359 |
Connects the SIGNAL for about to change the orientation for removePage state |
|
1360 |
to go back to waitInput state |
|
1361 |
*/ |
|
1362 |
void HsIdleState::action_removePage_connectAboutToChangeOrientationEventHandler() |
|
1363 |
{ |
|
1364 |
connect(HsGui::instance(), |
|
1365 |
SIGNAL(aboutToChangeOrientation()), |
|
1366 |
SIGNAL(event_waitInput())); |
|
63 | 1367 |
} |
1368 |
||
1369 |
/*! |
|
1370 |
Removes an existing page from the scene. |
|
1371 |
*/ |
|
1372 |
void HsIdleState::action_removePage_removePage() |
|
1373 |
{ |
|
69 | 1374 |
HsIdleWidget *idleWidget = HsGui::instance()->idleWidget(); |
1375 |
HsPropertyAnimationWrapper *animation = HsGui::instance()->pageChangeAnimation(); |
|
63 | 1376 |
HsScene *scene = HsScene::instance(); |
1377 |
HsPage *pageToRemove = scene->activePage(); |
|
69 | 1378 |
|
1379 |
if (animation->isRunning()) { |
|
1380 |
animation->stop(); |
|
1381 |
} |
|
63 | 1382 |
// remove from ui |
69 | 1383 |
idleWidget->removePage(pageToRemove->pageIndex()); |
1384 |
idleWidget->showPageIndicator(); |
|
63 | 1385 |
// update data model |
69 | 1386 |
scene->removePage(pageToRemove); |
63 | 1387 |
// Take new active page (previous was removed) and move scene to right position |
1388 |
qreal x = pageLayerXPos(scene->activePageIndex()); |
|
69 | 1389 |
idleWidget->setSceneX(x); |
63 | 1390 |
// delete it |
1391 |
pageToRemove->deleteLater(); |
|
1392 |
} |
|
101 | 1393 |
|
1394 |
/*! |
|
1395 |
Disconnects the SIGNAL for about to change the orientation for removePage state |
|
1396 |
to go back to waitInput state |
|
1397 |
||
1398 |
*/ |
|
1399 |
void HsIdleState::action_removePage_disconnectAboutToChangeOrientationEventHandler() |
|
1400 |
{ |
|
1401 |
disconnect(HsGui::instance(), |
|
1402 |
SIGNAL(aboutToChangeOrientation()), |
|
1403 |
this, SIGNAL(event_waitInput())); |
|
1404 |
} |
|
1405 |
||
63 | 1406 |
/*! |
35
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1407 |
Toggles the homescreen online/offline state. |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1408 |
*/ |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1409 |
void HsIdleState::action_toggleConnection_toggleConnection() |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1410 |
{ |
46
23b5d6a29cce
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
39
diff
changeset
|
1411 |
HsScene *scene = HsScene::instance(); |
35
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1412 |
scene->setOnline(!scene->isOnline()); |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1413 |
} |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1414 |
|
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1415 |
#ifdef COVERAGE_MEASUREMENT |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1416 |
#pragma CTC SKIP |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1417 |
#endif //COVERAGE_MEASUREMENT |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1418 |
|
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1419 |
/*! |
39
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
36
diff
changeset
|
1420 |
Open task switcher. |
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
36
diff
changeset
|
1421 |
\retval true if operation is successful. |
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
36
diff
changeset
|
1422 |
*/ |
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
36
diff
changeset
|
1423 |
bool HsIdleState::openTaskSwitcher() |
35
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1424 |
{ |
39
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
36
diff
changeset
|
1425 |
return HsMenuService::launchTaskSwitcher(); |
35
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1426 |
} |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1427 |
#ifdef COVERAGE_MEASUREMENT |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1428 |
#pragma CTC ENDSKIP |
f9ce957a272c
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1429 |
#endif //COVERAGE_MEASUREMENT |
39
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
36
diff
changeset
|
1430 |
|
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
36
diff
changeset
|
1431 |
/*! |
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
36
diff
changeset
|
1432 |
Page change zone animation has been finished. |
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
36
diff
changeset
|
1433 |
*/ |
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
36
diff
changeset
|
1434 |
void HsIdleState::zoneAnimationFinished() |
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
36
diff
changeset
|
1435 |
{ |
46
23b5d6a29cce
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
39
diff
changeset
|
1436 |
HsScene *scene = HsScene::instance(); |
39
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
36
diff
changeset
|
1437 |
int pageIndex = scene->activePageIndex(); |
69 | 1438 |
HsGui *gui(HsGui::instance()); |
1439 |
if (gui->pageCrawlingAnimation()->isForward()) { |
|
46
23b5d6a29cce
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
39
diff
changeset
|
1440 |
if (isInLeftPageChangeZone() && |
23b5d6a29cce
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
39
diff
changeset
|
1441 |
0 < pageIndex) { |
23b5d6a29cce
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
39
diff
changeset
|
1442 |
--pageIndex; |
62 | 1443 |
} else if (isInRightPageChangeZone() && |
1444 |
pageIndex < scene->pages().count()) { |
|
46
23b5d6a29cce
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
39
diff
changeset
|
1445 |
++pageIndex; |
23b5d6a29cce
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
39
diff
changeset
|
1446 |
} |
23b5d6a29cce
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
39
diff
changeset
|
1447 |
if (pageIndex == scene->pages().count()) { |
62 | 1448 |
if (pageIndex < HSCONFIGURATION_GET(maximumPageCount)) { |
46
23b5d6a29cce
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
39
diff
changeset
|
1449 |
addPageToScene(pageIndex); |
69 | 1450 |
gui->idleWidget()->showPageIndicator(); |
1451 |
gui->idleWidget()->pageIndicator()->addItem(pageIndex); |
|
46
23b5d6a29cce
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
39
diff
changeset
|
1452 |
} |
23b5d6a29cce
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
39
diff
changeset
|
1453 |
} |
23b5d6a29cce
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
39
diff
changeset
|
1454 |
scene->setActivePageIndex(pageIndex); |
62 | 1455 |
startPageChangeAnimation(pageIndex, HSCONFIGURATION_GET(pageChangeAnimationDuration)); |
1456 |
} else { |
|
46
23b5d6a29cce
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
39
diff
changeset
|
1457 |
scene->setActivePageIndex(pageIndex); |
69 | 1458 |
gui->idleWidget()->setActivePage(pageIndex); |
39
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
36
diff
changeset
|
1459 |
} |
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
36
diff
changeset
|
1460 |
} |
46
23b5d6a29cce
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
39
diff
changeset
|
1461 |
|
23b5d6a29cce
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
39
diff
changeset
|
1462 |
/*! |
62 | 1463 |
Page change animation has been finished. |
1464 |
*/ |
|
1465 |
void HsIdleState::pageChangeAnimationFinished() |
|
51
4785f57bf3d4
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
1466 |
{ |
86 | 1467 |
hbInstance->allMainWindows().first()->setInteractive(true); |
62 | 1468 |
updateZoneAnimation(); |
46
23b5d6a29cce
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
39
diff
changeset
|
1469 |
} |
23b5d6a29cce
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
39
diff
changeset
|
1470 |
|
23b5d6a29cce
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
39
diff
changeset
|
1471 |
|
51
4785f57bf3d4
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
1472 |
/*! |
62 | 1473 |
Provides the page presentation to the Widget Snap algorithm |
1474 |
*/ |
|
1475 |
void HsIdleState::updatePagePresentationToWidgetSnap() |
|
1476 |
{ |
|
63 | 1477 |
QRectF containerRect = HsScene::instance()->activePage()->contentGeometry(); |
62 | 1478 |
HsWidgetHost *activeWidget = HsScene::instance()->activeWidget(); |
69 | 1479 |
HsWidgetPositioningOnWidgetMove::instance()->setPagePresentation( |
1480 |
containerRect, createInactiveWidgetRects(), activeWidget->visual()->geometry()); |
|
62 | 1481 |
} |
51
4785f57bf3d4
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
1482 |
|
62 | 1483 |
/*! |
1484 |
Reset Snap position, hide the snap lines |
|
51
4785f57bf3d4
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
1485 |
*/ |
62 | 1486 |
void HsIdleState::resetSnapPosition() |
1487 |
{ |
|
1488 |
mSnapResult = HsWidgetPositioningOnWidgetMove::Result(); |
|
1489 |
mPreviousSnapResult = HsWidgetPositioningOnWidgetMove::Result(); |
|
1490 |
hideVerticalLine(); |
|
1491 |
hideHorizontalLine(); |
|
1492 |
} |
|
1493 |
||
1494 |
/*! |
|
1495 |
Show the Vertical line for Snap guidance |
|
1496 |
*/ |
|
1497 |
void HsIdleState::showVerticalLine() |
|
1498 |
{ |
|
1499 |
if (mPreviousSnapResult.verticalSnapLine.x1() != mSnapResult.verticalSnapLine.x1()) { |
|
1500 |
hideVerticalLine(); |
|
1501 |
mVerticalSnapLineTimer.start(); |
|
1502 |
} |
|
1503 |
else { |
|
1504 |
//As the Vertical Line position is at the same place, |
|
1505 |
//the timer was started when vertical line positions were at different locations |
|
1506 |
//the line will be shown when the timer expires. |
|
1507 |
//If timer has already expired, just show the line, which is redrawn to new geometry. |
|
1508 |
if (!mVerticalSnapLineTimer.isActive()) { |
|
69 | 1509 |
HsGui::instance()->idleWidget()->showVerticalSnapLine(mSnapResult.verticalSnapLine); |
62 | 1510 |
} |
51
4785f57bf3d4
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
1511 |
} |
4785f57bf3d4
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
1512 |
} |
62 | 1513 |
|
1514 |
/*! |
|
1515 |
Timer for showing the Vertical line expires |
|
1516 |
*/ |
|
1517 |
void HsIdleState::onVerticalSnapLineTimerTimeout() |
|
1518 |
{ |
|
69 | 1519 |
HsGui::instance()->idleWidget()->showVerticalSnapLine(mSnapResult.verticalSnapLine); |
62 | 1520 |
} |
1521 |
||
1522 |
/*! |
|
1523 |
Hide the Vertical line for Snap guidance |
|
1524 |
*/ |
|
1525 |
void HsIdleState::hideVerticalLine() |
|
1526 |
{ |
|
69 | 1527 |
HsGui::instance()->idleWidget()->hideVerticalSnapLine(); |
62 | 1528 |
mVerticalSnapLineTimer.stop(); |
1529 |
} |
|
1530 |
||
1531 |
/*! |
|
1532 |
Show the Horizontal line for Snap guidance |
|
1533 |
*/ |
|
1534 |
void HsIdleState::showHorizontalLine() |
|
1535 |
{ |
|
1536 |
if (mPreviousSnapResult.horizontalSnapLine.y1() != mSnapResult.horizontalSnapLine.y1()) { |
|
1537 |
hideHorizontalLine(); |
|
1538 |
mHorizontalSnapLineTimer.start(); |
|
1539 |
} |
|
1540 |
else { |
|
1541 |
if (!mHorizontalSnapLineTimer.isActive()) { |
|
69 | 1542 |
HsGui::instance()->idleWidget()->showHorizontalSnapLine(mSnapResult.horizontalSnapLine); |
62 | 1543 |
} |
1544 |
} |
|
1545 |
} |
|
1546 |
||
1547 |
/*! |
|
1548 |
Timer for showing the Horizontal line expires |
|
1549 |
*/ |
|
1550 |
void HsIdleState::onHorizontalSnapLineTimerTimeout() |
|
1551 |
{ |
|
69 | 1552 |
HsGui::instance()->idleWidget()->showHorizontalSnapLine(mSnapResult.horizontalSnapLine); |
62 | 1553 |
} |
1554 |
||
1555 |
/*! |
|
1556 |
Hide the Horizontal line for Snap guidance |
|
1557 |
*/ |
|
1558 |
void HsIdleState::hideHorizontalLine() |
|
1559 |
{ |
|
69 | 1560 |
HsGui::instance()->idleWidget()->hideHorizontalSnapLine(); |
62 | 1561 |
mHorizontalSnapLineTimer.stop(); |
1562 |
} |
|
1563 |
||
1564 |
/*! |
|
1565 |
Handles updating the Snap algorithm with page presentation on page change |
|
1566 |
*/ |
|
86 | 1567 |
void HsIdleState::updateSnapAlgorithmParameters() |
62 | 1568 |
{ |
1569 |
updatePagePresentationToWidgetSnap(); |
|
1570 |
resetSnapPosition(); |
|
1571 |
} |
|
63 | 1572 |
|
86 | 1573 |
/*! |
1574 |
Closes virtual keyboard |
|
1575 |
*/ |
|
1576 |
void HsIdleState::closeVirtualKeyboard() |
|
1577 |
{ |
|
1578 |
HbVkbHost::HbVkbStatus status = HbVkbHostBridge::instance()->keypadStatus(); |
|
1579 |
if (status == HbVkbHost::HbVkbStatusOpened ) { |
|
1580 |
QInputContext *ic = qApp->inputContext(); |
|
1581 |
if (ic) { |
|
1582 |
QEvent *event = new QEvent(QEvent::CloseSoftwareInputPanel); |
|
1583 |
ic->filterEvent(event); |
|
1584 |
delete event; |
|
1585 |
} |
|
1586 |
} |
|
1587 |
} |
|
63 | 1588 |
|
86 | 1589 |
/*! |
1590 |
Returns true if \a widget has editor field under \a point. |
|
1591 |
*/ |
|
1592 |
bool HsIdleState::isEditor(const QPointF &point, HsWidgetHost *widget) |
|
1593 |
{ |
|
1594 |
bool isWidgetEditor = false; |
|
1595 |
QList<QGraphicsItem *> items; |
|
1596 |
if ( widget->visual()->scene() ) { |
|
1597 |
items = widget->visual()->scene()->items(point); |
|
1598 |
} |
|
1599 |
int count = items.count(); |
|
1600 |
for (int i=0; i<count && !isWidgetEditor; i++ ) { |
|
1601 |
QGraphicsItem *item = items.at(i); |
|
1602 |
if (item->isWidget()) { |
|
1603 |
isWidgetEditor = HbInputFocusObject::isEditor(item->toGraphicsObject()) && |
|
1604 |
qobject_cast<QGraphicsWidget *>(widget->visual()->widget())->isAncestorOf(item); |
|
1605 |
} |
|
1606 |
} |
|
1607 |
return isWidgetEditor; |
|
1608 |
} |
|
90 | 1609 |
|
1610 |
/*! |
|
1611 |
Stops page change and page crawling animations. |
|
1612 |
*/ |
|
1613 |
void HsIdleState::stopPageChangeAnimations() |
|
1614 |
{ |
|
1615 |
HsPropertyAnimationWrapper *animation = HsGui::instance()->pageChangeAnimation(); |
|
1616 |
if (animation->isRunning()) { |
|
1617 |
animation->stop(); |
|
1618 |
hbInstance->allMainWindows().first()->setInteractive(true); |
|
1619 |
} |
|
1620 |
animation->disconnect(this); |
|
1621 |
||
1622 |
HsPropertyAnimationWrapper *pageCrawlingAnimation = |
|
1623 |
HsGui::instance()->pageCrawlingAnimation(); |
|
1624 |
||
1625 |
if (pageCrawlingAnimation->isRunning()) { |
|
1626 |
pageCrawlingAnimation->stop(); |
|
1627 |
} |
|
1628 |
} |
|
1629 |