]> git.sesse.net Git - vlc/commitdiff
* Fix preparse of directories
authorClément Stenac <zorglub@videolan.org>
Sun, 3 Dec 2006 16:13:40 +0000 (16:13 +0000)
committerClément Stenac <zorglub@videolan.org>
Sun, 3 Dec 2006 16:13:40 +0000 (16:13 +0000)
* Add right-click "info" item in qt4 playlist

modules/gui/qt4/components/playlist/selector.cpp
modules/gui/qt4/components/playlist/standardpanel.cpp
modules/gui/qt4/dialogs/mediainfo.cpp
modules/gui/qt4/dialogs/mediainfo.hpp
modules/gui/qt4/playlist_model.cpp
modules/gui/qt4/playlist_model.hpp
src/input/access.c

index 50f966f729eabd71b92763333f19689d070fd6ae..60891e9421d7257a4ffe3dec76c56a560a78d546 100644 (file)
@@ -30,7 +30,7 @@
 PLSelector::PLSelector( QWidget *p, intf_thread_t *_p_intf,
                         playlist_t *p_playlist ) : QWidget( p ), p_intf(_p_intf)
 {
-    model = new PLModel( THEPL, THEPL->p_root_category, 1, this );
+    model = new PLModel( THEPL, p_intf, THEPL->p_root_category, 1, this );
     view = new QTreeView( 0 );
     view->setIconSize( QSize( 24,24 ) );
     view->setAlternatingRowColors( true );
index ab1c953a76fb6bec5c30efcb3eaf4a199a3a6a8f..e873141a20482d3fcf2c645c118604b3e527658b 100644 (file)
@@ -47,7 +47,7 @@ StandardPLPanel::StandardPLPanel( BasePlaylistWidget *_parent,
                                   playlist_item_t *p_root ):
                                   PLPanel( _parent, _p_intf )
 {
-    model = new PLModel( p_playlist, p_root, -1, this );
+    model = new PLModel( p_playlist, p_intf, p_root, -1, this );
     view = new QVLCTreeView( 0 );
     view->setModel(model);
     view->setIconSize( QSize(20,20) );
index 5c23853ffae3160836eaaf7a94cbcea524311d3e..a5fcf0cce28dc2f48b5bad98994626f5201c9bc9 100644 (file)
@@ -19,7 +19,8 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. *****************************************************************************/
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ ******************************************************************************/
 
 #include <QTabWidget>
 #include <QGridLayout>
@@ -36,7 +37,8 @@ static int ItemChanged( vlc_object_t *p_this, const char *psz_var,
                         vlc_value_t oldval, vlc_value_t newval, void *param );
 MediaInfoDialog *MediaInfoDialog::instance = NULL;
 
-MediaInfoDialog::MediaInfoDialog( intf_thread_t *_p_intf ) :QVLCFrame( _p_intf )
+MediaInfoDialog::MediaInfoDialog( intf_thread_t *_p_intf, bool _mainInput ) :
+                                    QVLCFrame( _p_intf ), mainInput(_mainInput)
 {
     i_runs = 0;
     p_input = NULL;
@@ -51,15 +53,19 @@ MediaInfoDialog::MediaInfoDialog( intf_thread_t *_p_intf ) :QVLCFrame( _p_intf )
     layout->addWidget(closeButton,1,2);
 
     BUTTONACT( closeButton, close() );
-    ON_TIMEOUT( update() );
 
-    var_AddCallback( THEPL, "item-change", ItemChanged, this );
+    if( mainInput ) {
+        ON_TIMEOUT( update() );
+        var_AddCallback( THEPL, "item-change", ItemChanged, this );
+    }
     readSettings( "mediainfo" , QSize( 500, 450 ) );
 }
 
 MediaInfoDialog::~MediaInfoDialog()
 {
-    var_DelCallback( THEPL, "item-change", ItemChanged, this );
+    if( mainInput ) {
+        var_DelCallback( THEPL, "item-change", ItemChanged, this );
+    }
     writeSettings( "mediainfo" );
 }
 
@@ -71,13 +77,22 @@ static int ItemChanged( vlc_object_t *p_this, const char *psz_var,
     return VLC_SUCCESS;
 }
 
+void MediaInfoDialog::setInput(input_item_t *p_input)
+{
+    IT->clear();
+    vlc_mutex_lock( &p_input->lock );
+    IT->update( p_input, true, true );
+    vlc_mutex_unlock( &p_input->lock );
+}
+
 void MediaInfoDialog::update()
 {
     // Timer runs at 150 ms, dont' update more than 2 times per second
     i_runs++;
     if( i_runs % 3 != 0 ) return;
 
-    input_thread_t *p_input = MainInputManager::getInstance( p_intf )->getInput();
+    input_thread_t *p_input =
+             MainInputManager::getInstance( p_intf )->getInput();
     if( !p_input || p_input->b_dead )
     {
         IT->clear();
@@ -97,4 +112,8 @@ void MediaInfoDialog::update()
 void MediaInfoDialog::close()
 {
     this->toggleVisible();
+
+    if( mainInput == false ) {
+        deleteLater();
+    }
 }
index 6545319c2d2ee9d60adff6ab91e214f0b03b2891..b04fb04d748d01657a346f2a3885e34f50017830 100644 (file)
@@ -35,10 +35,11 @@ class MediaInfoDialog : public QVLCFrame
 {
     Q_OBJECT;
 public:
+    MediaInfoDialog( intf_thread_t *, bool mainInput = false );
     static MediaInfoDialog * getInstance( intf_thread_t *p_intf )
     {
         if( !instance)
-            instance = new MediaInfoDialog( p_intf);
+            instance = new MediaInfoDialog( p_intf, true);
         return instance;
     }
     static void killInstance()
@@ -48,12 +49,13 @@ public:
     }
     virtual ~MediaInfoDialog();
     bool need_update;
+    void setInput( input_item_t * );
 private:
-    MediaInfoDialog( intf_thread_t * );
     input_thread_t *p_input;
     InfoTab *IT;
     static MediaInfoDialog *instance;
     int i_runs;
+    bool mainInput;
 public slots:
     void update();
     void close();
index cb38d3bbd5efa97d6458fc8cccad937094a450f6..3a43c766f1745af16980af4f2405494afad2deee 100644 (file)
@@ -30,6 +30,7 @@
 
 #include "qt4.hpp"
 #include "playlist_model.hpp"
+#include "dialogs/mediainfo.hpp"
 #include <vlc_intf_strings.h>
 
 #include "pixmaps/type_unknown.xpm"
@@ -146,12 +147,13 @@ void PLItem::update( playlist_item_t *p_item, bool iscurrent )
  * Playlist model implementation
  *************************************************************************/
 
-PLModel::PLModel( playlist_t *_p_playlist,
+PLModel::PLModel( playlist_t *_p_playlist, intf_thread_t *_p_intf,
                   playlist_item_t * p_root, int _i_depth, QObject *parent)
                                     : QAbstractItemModel(parent)
 {
     i_depth = _i_depth;
     assert( i_depth == 1 || i_depth == -1 );
+    p_intf = _p_intf;
     p_playlist= _p_playlist;
     i_items_to_append = 0;
     b_need_update     = false;
@@ -880,7 +882,14 @@ void PLModel::popupPlay()
 
 void PLModel::popupInfo()
 {
-    fprintf( stderr, "Popup Info is NOT implemented\n" );
+    playlist_item_t *p_item = playlist_ItemGetById( p_playlist,
+                                                    i_popup_item,VLC_TRUE );
+    if( p_item )
+    {
+        MediaInfoDialog *mid = new MediaInfoDialog( p_intf );
+        mid->setInput( p_item->p_input );
+        mid->show();
+    }
 }
 
 void PLModel::popupStream()
index 61050bf36bd926dff5e81843f070dd2803c9fade..5909fbc0e11bc94997e2f63bfd6d97d460ba96b7 100644 (file)
@@ -96,7 +96,8 @@ class PLModel : public QAbstractItemModel
     Q_OBJECT
 
 public:
-    PLModel( playlist_t *, playlist_item_t *, int, QObject *parent = 0);
+    PLModel( playlist_t *, intf_thread_t *,
+             playlist_item_t *, int, QObject *parent = 0);
     ~PLModel();
 
     /* All types of lookups / QModel stuff */
@@ -142,6 +143,7 @@ private:
     PLItem *rootItem;
 
     playlist_t *p_playlist;
+    intf_thread_t *p_intf;
     int i_depth;
 
     static QIcon icons[ITEM_TYPE_NUMBER];
index 702a4aa342c95a81ca4706da77bbc7092b3ee8d0..9ce14db09fe2a7764f15550158d7ee0d974c0d3a 100644 (file)
@@ -53,8 +53,16 @@ static access_t *access2_InternalNew( vlc_object_t *p_obj, const char *psz_acces
     else
     {
         p_access->psz_path   = strdup( psz_path );
-        p_access->psz_access =
-            b_quick ? strdup( "file" ) : strdup( psz_access );
+        if( b_quick )
+        {
+            if( strstr( psz_path, "file://" ) )
+                p_access->psz_access = strdup( "" );
+            else
+                p_access->psz_access = strdup( "file" );
+        }
+        else
+            p_access->psz_access = strdup( psz_access );
+
         p_access->psz_demux  = strdup( psz_demux );
 
         if( !b_quick )