Commit bc32a19e authored by Clément Stenac's avatar Clément Stenac

* Fix preparse of directories

* Add right-click "info" item in qt4 playlist
parent bb97f8e0
......@@ -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 );
......
......@@ -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) );
......
......@@ -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();
}
}
......@@ -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();
......
......@@ -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()
......
......@@ -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];
......
......@@ -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 )
......
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