[vlmc-devel] commit: StackViewNavController: Factorization (Hugo Beauzee-Luyssen )
git at videolan.org
git at videolan.org
Tue Mar 16 23:52:03 CET 2010
vlmc | branch: master | Hugo Beauzee-Luyssen <beauze.h at gmail.com> | Tue Mar 16 23:51:57 2010 +0100| [89f2719d570135c0dbfd3027f44452d7c02db4d1] | committer: Hugo Beauzee-Luyssen
StackViewNavController: Factorization
> http://git.videolan.org/gitweb.cgi/vlmc.git/?a=commit;h=89f2719d570135c0dbfd3027f44452d7c02db4d1
---
src/Gui/library/StackViewController.cpp | 46 +++++++++++++-----------------
src/Gui/library/StackViewController.h | 3 ++
2 files changed, 23 insertions(+), 26 deletions(-)
diff --git a/src/Gui/library/StackViewController.cpp b/src/Gui/library/StackViewController.cpp
index b4bb6b5..6babcb5 100644
--- a/src/Gui/library/StackViewController.cpp
+++ b/src/Gui/library/StackViewController.cpp
@@ -67,6 +67,24 @@ void StackViewController::pushViewController( ViewController* viewController,
}
void
+StackViewController::restorePrevious()
+{
+ m_current = m_controllerStack->pop();
+
+ m_nav->setTitle( m_current->title() );
+ m_layout->insertWidget( 1, m_current->view() );
+ m_current->view()->setHidden( false );
+
+ if ( !m_controllerStack->size() )
+ m_nav->previousButton()->setHidden( true );
+ else
+ {
+ m_nav->previousButton()->setText( "< " +
+ m_controllerStack->value( m_controllerStack->size() - 1 )->title() );
+ }
+}
+
+void
StackViewController::viewDestroyed()
{
//This should'nt happen.
@@ -74,19 +92,7 @@ StackViewController::viewDestroyed()
return ;
if ( QObject::sender() == m_current )
{
- m_current = m_controllerStack->pop();
-
- m_nav->setTitle( m_current->title() );
- m_layout->insertWidget( 1, m_current->view() );
- m_current->view()->setHidden( false );
-
- if ( !m_controllerStack->size() )
- m_nav->previousButton()->setHidden( true );
- else
- {
- m_nav->previousButton()->setText( "< " +
- m_controllerStack->value( m_controllerStack->size() - 1 )->title() );
- }
+ restorePrevious();
}
}
@@ -100,19 +106,7 @@ void StackViewController::popViewController( bool animated )
m_layout->removeWidget( m_current->view() );
m_current->view()->hide();
delete m_current;
- m_current = m_controllerStack->pop();
-
- m_nav->setTitle( m_current->title() );
- m_layout->insertWidget( 1, m_current->view() );
- m_current->view()->setHidden( false );
-
- if ( !m_controllerStack->size() )
- m_nav->previousButton()->setHidden( true );
- else
- {
- m_nav->previousButton()->setText( "< " +
- m_controllerStack->value( m_controllerStack->size() - 1 )->title() );
- }
+ restorePrevious();
}
void StackViewController::previous()
diff --git a/src/Gui/library/StackViewController.h b/src/Gui/library/StackViewController.h
index d9d3435..e30cf53 100644
--- a/src/Gui/library/StackViewController.h
+++ b/src/Gui/library/StackViewController.h
@@ -47,6 +47,9 @@ public:
void popViewController( bool animated = false );
private:
+ void restorePrevious();
+
+private:
StackViewNavController* m_nav;
QVBoxLayout* m_layout;
ViewController* m_current;
More information about the Vlmc-devel
mailing list