[escher] In stack view controller, load only the visible view (and

unload the root view when required)

Change-Id: Idba6db2cb881c587095f8db2445bd1c712b79737
This commit is contained in:
Émilie Feral
2017-04-28 14:09:29 +02:00
parent 0517066cc0
commit 9e94cdb553

View File

@@ -88,14 +88,8 @@ void StackViewController::push(ViewController * vc, KDColor textColor, KDColor b
pushModel(frame);
if (m_numberOfChildren > 1) {
m_childrenFrame[m_numberOfChildren-2].viewController()->viewDidDisappear();
/* The first added view controller is never unloaded because the view might
* record some usefull information (which should be store in a model ideally).
* And We do not to delete these information.
* TODO: better compartmentalize views and models to avoid this weird exception */
if (m_numberOfChildren > 2) {
m_childrenFrame[m_numberOfChildren-2].viewController()->unloadView();
}
}
setupActiveViewController();
}
@@ -117,10 +111,7 @@ void StackViewController::pushModel(Frame frame) {
void StackViewController::setupActiveViewController() {
ViewController * vc = m_childrenFrame[m_numberOfChildren-1].viewController();
vc->setParentResponder(this);
/* Same comment as above (TODO) */
if (m_numberOfChildren > 1) {
vc->loadView();
}
vc->loadView();
m_view.setContentView(vc->view());
vc->viewWillAppear();
vc->setParentResponder(this);