[vlmc-devel] commit: StackViewController: Cleaning things a bit. (Hugo Beauzee-Luyssen )

git at videolan.org git at videolan.org
Wed Mar 10 22:24:40 CET 2010


vlmc | branch: master | Hugo Beauzee-Luyssen <beauze.h at gmail.com> | Wed Mar 10 21:33:15 2010 +0100| [30bfb34a3555746c1e47d1e7064585c97b04cc68] | committer: Hugo Beauzee-Luyssen 

StackViewController: Cleaning things a bit.

When previous button is clicked, the current view is directly deleted,
which avoid doing it in every ListViewController implementation

> http://git.videolan.org/gitweb.cgi/vlmc.git/?a=commit;h=30bfb34a3555746c1e47d1e7064585c97b04cc68
---

 src/Gui/library/MediaLibraryWidget.cpp  |    5 -----
 src/Gui/library/MediaLibraryWidget.h    |    2 --
 src/Gui/library/MediaListView.cpp       |   12 +-----------
 src/Gui/library/MediaListView.h         |    2 --
 src/Gui/library/StackViewController.cpp |   12 +-----------
 src/Gui/library/StackViewController.h   |    1 -
 6 files changed, 2 insertions(+), 32 deletions(-)

diff --git a/src/Gui/library/MediaLibraryWidget.cpp b/src/Gui/library/MediaLibraryWidget.cpp
index 701c64e..40c072d 100644
--- a/src/Gui/library/MediaLibraryWidget.cpp
+++ b/src/Gui/library/MediaLibraryWidget.cpp
@@ -46,8 +46,3 @@ MediaLibraryWidget::~MediaLibraryWidget()
 {
     delete m_nav;
 }
-
-const ViewController*       MediaLibraryWidget::getCurrentViewController()
-{
-    return m_nav->getCurrentViewController();
-}
diff --git a/src/Gui/library/MediaLibraryWidget.h b/src/Gui/library/MediaLibraryWidget.h
index e6db2ec..e798f69 100644
--- a/src/Gui/library/MediaLibraryWidget.h
+++ b/src/Gui/library/MediaLibraryWidget.h
@@ -39,8 +39,6 @@ public:
     MediaLibraryWidget( QWidget* parent = 0 );
     virtual ~MediaLibraryWidget();
 
-    const ViewController*   getCurrentViewController();
-
 private:
     StackViewController*    m_nav;
 
diff --git a/src/Gui/library/MediaListView.cpp b/src/Gui/library/MediaListView.cpp
index 323208c..6860a7a 100644
--- a/src/Gui/library/MediaListView.cpp
+++ b/src/Gui/library/MediaListView.cpp
@@ -28,7 +28,6 @@
 MediaListView::MediaListView( StackViewController* nav, MediaContainer* mc ) :
         ListViewController( nav ),
         m_nav( nav ),
-        m_clipsListView( 0 ),
         m_mediaContainer( mc )
 {
     connect( mc, SIGNAL( newClipLoaded(Clip*) ),
@@ -37,8 +36,6 @@ MediaListView::MediaListView( StackViewController* nav, MediaContainer* mc ) :
              mc, SLOT(removeClip( const QUuid& ) ) );
     foreach ( Clip* clip, mc->clips() )
         newClipLoaded( clip );
-    connect( m_nav, SIGNAL( previousButtonPushed() ),
-             this, SLOT( restoreContext() ) );
 }
 
 MediaListView::~MediaListView()
@@ -103,12 +100,5 @@ MediaListView::clear()
 void    MediaListView::showSubClips( const QUuid& uuid )
 {
     Clip*   clip = m_mediaContainer->clip( uuid );
-    m_clipsListView = new MediaListView( m_nav, clip->getChilds() );
-    m_nav->pushViewController( m_clipsListView );
-}
-
-void    MediaListView::restoreContext()
-{
-    delete m_clipsListView;
-    m_currentUuid = QUuid();
+    m_nav->pushViewController( new MediaListView( m_nav, clip->getChilds() ) );
 }
diff --git a/src/Gui/library/MediaListView.h b/src/Gui/library/MediaListView.h
index ffc1c49..b5c6374 100644
--- a/src/Gui/library/MediaListView.h
+++ b/src/Gui/library/MediaListView.h
@@ -44,7 +44,6 @@ private:
     StackViewController*        m_nav;
     QUuid                       m_currentUuid;
     QHash<QUuid, QWidget*>      m_cells;
-    MediaListView*              m_clipsListView;
     QUuid                       m_lastUuidClipListAsked;
     MediaContainer*             m_mediaContainer;
 
@@ -54,7 +53,6 @@ public slots:
     void        clear();
 
 private slots:
-    void        restoreContext();
     void        clipRemoved( const Clip* );
     void        newClipLoaded( Clip* clip );
 
diff --git a/src/Gui/library/StackViewController.cpp b/src/Gui/library/StackViewController.cpp
index a8de250..1d601d6 100644
--- a/src/Gui/library/StackViewController.cpp
+++ b/src/Gui/library/StackViewController.cpp
@@ -27,16 +27,11 @@ StackViewController::StackViewController( QWidget* parent, bool enableImport ) :
         QWidget( parent ), m_importButton( NULL ), m_current( 0 )
 {
     m_nav     = new StackViewNavController( this );
-
     m_layout  = new QVBoxLayout;
-
     m_controllerStack = new QStack<ViewController*>();
 
     connect( m_nav->previousButton(), SIGNAL( clicked() ),
                      this, SLOT( previous() ) );
-
-
-
     m_layout->addWidget( m_nav );
 
     if ( enableImport )
@@ -45,7 +40,6 @@ StackViewController::StackViewController( QWidget* parent, bool enableImport ) :
         m_layout->addWidget( m_importButton );
         connect( m_importButton, SIGNAL( clicked() ), this, SIGNAL( importRequired() ) );
     }
-
     parent->setLayout( m_layout );
 }
 
@@ -89,6 +83,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() );
@@ -110,8 +105,3 @@ void        StackViewController::previous()
     emit previousButtonPushed();
 }
 
-const ViewController*   StackViewController::getCurrentViewController() const
-{
-    return m_current;
-}
-
diff --git a/src/Gui/library/StackViewController.h b/src/Gui/library/StackViewController.h
index 69cf12a..49ed1fc 100644
--- a/src/Gui/library/StackViewController.h
+++ b/src/Gui/library/StackViewController.h
@@ -46,7 +46,6 @@ public:
     void                    pushViewController( ViewController* viewController,
                                                 bool animated = false );
     void                    popViewController( bool animated = false );
-    const ViewController*   getCurrentViewController() const;
 
 private:
     StackViewNavController*     m_nav;



More information about the Vlmc-devel mailing list