37 HsLoadSceneState::HsLoadSceneState(QState *parent) |
37 HsLoadSceneState::HsLoadSceneState(QState *parent) |
38 : QState(parent) |
38 : QState(parent) |
39 #ifdef Q_OS_SYMBIAN |
39 #ifdef Q_OS_SYMBIAN |
40 ,mStartupKey(KPSUidStartup.iUid, KPSStartupUiPhase), |
40 ,mStartupKey(KPSUidStartup.iUid, KPSStartupUiPhase), |
41 mSettingsMgr(0) |
41 mSettingsMgr(0) |
42 #endif |
42 #endif |
43 { |
43 { |
44 connect(this, SIGNAL(entered()), SLOT(action_loadScene())); |
44 connect(this, SIGNAL(entered()), SLOT(action_loadScene())); |
45 #ifdef Q_OS_SYMBIAN |
45 #ifdef Q_OS_SYMBIAN |
46 |
46 |
47 mSettingsMgr = new XQSettingsManager(this); |
47 mSettingsMgr = new XQSettingsManager(this); |
48 |
48 |
49 #endif //Q_OS_SYMBIAN |
49 #endif //Q_OS_SYMBIAN |
50 } |
50 } |
51 |
51 |
52 /*! |
52 /*! |
53 Destroys this idle state. |
53 Destroys this idle state. |
54 */ |
54 */ |
57 } |
57 } |
58 |
58 |
59 /*! |
59 /*! |
60 \fn HsLoadSceneState::event_idle() |
60 \fn HsLoadSceneState::event_idle() |
61 |
61 |
62 Initiates a transition to idle state. |
62 Loads scene information and initiates a transition to idle state if ready. |
63 */ |
63 */ |
64 |
64 |
65 /*! |
65 /*! |
66 Loads the home screen scene. |
66 Loads the home screen scene. |
67 */ |
67 */ |
68 void HsLoadSceneState::action_loadScene() |
68 void HsLoadSceneState::action_loadScene() |
69 { |
69 { |
|
70 HsScene::setInstance(new HsScene); |
70 HsScene::instance()->load(); |
71 HsScene::instance()->load(); |
71 |
72 |
72 #ifdef Q_OS_SYMBIAN |
73 #ifdef Q_OS_SYMBIAN |
73 |
74 |
74 int startupPhase = mSettingsMgr->readItemValue(mStartupKey).toInt(); |
75 int startupPhase = mSettingsMgr->readItemValue(mStartupKey).toInt(); |
75 qDebug() << "HsLoadSceneState::action_loadScene boot phase " << startupPhase; |
76 qDebug() << "HsLoadSceneState::action_loadScene boot phase " << startupPhase; |
76 |
77 |
77 if (EStartupUiPhaseAllDone != startupPhase) { |
78 if (EStartupUiPhaseAllDone != startupPhase) { |
78 qDebug() << "HsLoadSceneState::HsLoadSceneState, starting to listen key"; |
79 qDebug() << "HsLoadSceneState::HsLoadSceneState, starting to listen key"; |
79 |
80 |
80 connect(mSettingsMgr,SIGNAL(valueChanged(XQSettingsKey, const QVariant &)), this, |
81 connect(mSettingsMgr,SIGNAL(valueChanged(XQSettingsKey, const QVariant &)), this, |
81 SLOT(handleKeyChange(XQSettingsKey, const QVariant &))); |
82 SLOT(handleKeyChange(XQSettingsKey, const QVariant &))); |
82 |
83 |
83 mSettingsMgr->startMonitoring(mStartupKey); |
84 mSettingsMgr->startMonitoring(mStartupKey); |
84 } else { |
85 } else { |
85 // We're already at the phase in boot where we can draw ourself to the foreground. |
86 // We're already at the phase in boot where we can draw ourself to the foreground. |
86 showUi(); |
87 showUi(); |
87 delete mSettingsMgr; |
|
88 mSettingsMgr = 0; |
|
89 } |
88 } |
90 |
89 |
91 #else |
90 #else |
92 |
91 |
93 showUi(); |
92 showUi(); |
94 |
93 |
95 #endif |
94 #endif |
96 } |
95 } |
97 #ifdef Q_OS_SYMBIAN |
96 #ifdef Q_OS_SYMBIAN |
98 /*! |
97 /*! |
99 \fn HsLoadSceneState::handleKeyChange() |
98 \fn HsLoadSceneState::handleKeyChange() |
100 |
99 |
103 |
102 |
104 void HsLoadSceneState::handleKeyChange(XQSettingsKey key, const QVariant &value) |
103 void HsLoadSceneState::handleKeyChange(XQSettingsKey key, const QVariant &value) |
105 { |
104 { |
106 qDebug() << "HsLoadSceneState::handleKeyChange key " << key.key() |
105 qDebug() << "HsLoadSceneState::handleKeyChange key " << key.key() |
107 << "value " << value.toInt(); |
106 << "value " << value.toInt(); |
108 |
107 |
109 if (key.key() == KPSStartupUiPhase && value.toInt() == EStartupUiPhaseAllDone) { |
108 if (key.key() == KPSStartupUiPhase && value.toInt() == EStartupUiPhaseAllDone) { |
110 showUi(); |
109 showUi(); |
111 mSettingsMgr->stopMonitoring(mStartupKey); |
110 mSettingsMgr->stopMonitoring(mStartupKey); |
112 mSettingsMgr->deleteLater(); |
|
113 mSettingsMgr = 0; |
|
114 } |
111 } |
115 } |
112 } |
116 #endif |
113 #endif |
117 /*! |
114 /*! |
118 \fn HsLoadSceneState::showUi() |
115 \fn HsLoadSceneState::showUi() |
119 |
116 |
120 Makes the main window visible, signals transition to idle state and |
117 Makes the main window visible, signals transition to idle state and |
121 brings the hs app to the foreground. |
118 brings the hs app to the foreground. |
122 */ |
119 */ |
123 |
120 |
124 void HsLoadSceneState::showUi() |
121 void HsLoadSceneState::showUi() |
125 { |
122 { |
126 qDebug() << "HsLoadSceneState::showUi"; |
123 qDebug() << "HsLoadSceneState::showUi"; |
127 HsScene::mainWindow()->raise(); |
124 HsScene::mainWindow()->raise(); |
128 HsScene::mainWindow()->show(); |
125 HsScene::mainWindow()->show(); |