Commit f88d44e1 authored by Andreas Cord-Landwehr's avatar Andreas Cord-Landwehr

Close unit when it is finished

parent e00e26a6
......@@ -186,14 +186,20 @@ void TrainingSession::selectNextPhrase()
action->setChecked(false);
}
// try to find next phrase, otherwise return completed
// 1. case: last phrase in unit
if (m_indexPhrase >= m_actions.at(m_indexUnit)->actions().count() - 1) {
// close current unit
emit closeUnit();
qDebug() << "switching to next unit";
if (m_indexUnit >= m_actions.count() - 1) {
emit completed();
} else {
++m_indexUnit;
m_indexPhrase = 0;
// currently there is no way to automatically enter a submenu, at least inform user about new unit
m_actions.at(m_indexUnit)->setChecked(true);
}
// 2. case: next phrase inside current unit
} else {
++m_indexPhrase;
}
......
......@@ -64,6 +64,7 @@ Q_SIGNALS:
* @brief Emitted when last phrase of session is skipped or marked as completed.
*/
void completed();
void closeUnit();
private:
Q_DISABLE_COPY(TrainingSession)
......
......@@ -55,6 +55,12 @@ Kirigami.GlobalDrawer {
root.pageStack.push(trainingPageComponent);
}
}
Connections {
target: g_trainingSession
onCloseUnit: {
root.resetMenu()
}
}
//TODO integrate again
// [
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment