#include "components/playlist/panels.hpp"
#include "components/playlist/selector.hpp"
-PlaylistWidget::PlaylistWidget( intf_thread_t *_p_intf ) : QFrame(NULL),
- p_intf( _p_intf )
+PlaylistWidget::PlaylistWidget( intf_thread_t *_p_intf ) :
+ BasePlaylistWidget ( _p_intf)
{
QVBoxLayout *left = new QVBoxLayout( );
QHBoxLayout *middle = new QHBoxLayout;
selector->setMaximumWidth( 130 );
left->addWidget( selector );
- QPushButton *undockButton = new QPushButton( "UN", this );
+/* QPushButton *undockButton = new QPushButton( "UN", this );
undockButton->setMaximumWidth( 25 );
undockButton->setToolTip( qtr( "Undock playlist for main interface" ) );
BUTTONACT( undockButton, undock() );
middle->addWidget( undockButton );
-
- addButton = new QPushButton( "+", this );
- addButton->setMaximumWidth( 25 );
- BUTTONACT( addButton, add() );
- middle->addWidget( addButton );
-
+*/
left->addLayout( middle );
QLabel *art = new QLabel( "" );
playlist_item_t *p_root = playlist_GetPreferredNode( THEPL,
THEPL->p_local_category );
- currentRootId = p_root->i_id;
rightPanel = qobject_cast<PLPanel *>(new StandardPLPanel( this,
p_intf, THEPL, p_root ) );
CONNECT( selector, activated( int ), rightPanel, setRoot( int ) );
- CONNECT( selector, activated( int ), this, setCurrentRootId( int ) );
+
+ connect( selector, SIGNAL(activated( int )),
+ this, SIGNAL( rootChanged( int ) ) );
+ emit rootChanged( p_root->i_id );
QHBoxLayout *layout = new QHBoxLayout(this);
layout->addLayout( left, 0 );
{
}
-void PlaylistWidget::setCurrentRootId( int _new )
-{
- currentRootId = _new;
- if( currentRootId == THEPL->p_local_category->i_id ||
- currentRootId == THEPL->p_local_onelevel->i_id )
- {
- addButton->setEnabled( true );
- addButton->setToolTip( qtr("Add to playlist" ) );
- }
- else if( currentRootId == THEPL->p_ml_category->i_id ||
- currentRootId == THEPL->p_ml_onelevel->i_id )
- {
- addButton->setEnabled( true );
- addButton->setToolTip( qtr("Add to media library" ) );
- }
- else
- addButton->setEnabled( false );
-}
-
-void PlaylistWidget::undock()
-{
- hide();
- THEDP->playlistDialog();
- deleteLater();
-
- QEvent *event = new QEvent( (QEvent::Type)(PLUndockEvent_Type) );
- QApplication::postEvent( p_intf->p_sys->p_mi, event );
-}
-
-void PlaylistWidget::add()
-{
- QMenu *popup = new QMenu();
- if( currentRootId == THEPL->p_local_category->i_id ||
- currentRootId == THEPL->p_local_onelevel->i_id )
- {
- popup->addAction( "Add file", THEDP, SLOT( simplePLAppendDialog() ) );
- popup->addAction( "Advanced add", THEDP, SLOT( PLAppendDialog() ) );
- }
- else if( currentRootId == THEPL->p_ml_category->i_id ||
- currentRootId == THEPL->p_ml_onelevel->i_id )
- {
- popup->addAction( "Add file", THEDP, SLOT( simpleMLAppendDialog() ) );
- popup->addAction( "Advanced add", THEDP, SLOT( MLAppendDialog() ) );
- popup->addAction( "Directory", THEDP, SLOT( openMLDirectory() ) );
- }
- popup->popup( QCursor::pos() );
-}
-
QSize PlaylistWidget::sizeHint() const
{
return widgetSize;
#include <vlc/vlc.h>
#include <vlc/intf.h>
+
+#include "qt4.hpp"
+
#include <QWidget>
#include <QFrame>
#include <QPalette>
intf_thread_t *p_intf;
};
-/******************** Playlist Widget ****************/
+/******************** Playlist Widgets ****************/
#include <QModelIndex>
class QSignalMapper;
class PLSelector;
class PLPanel;
class QPushButton;
-class PlaylistWidget : public QFrame
+class PlaylistWidget : public BasePlaylistWidget
{
Q_OBJECT;
public:
private:
PLSelector *selector;
PLPanel *rightPanel;
- intf_thread_t *p_intf;
- int currentRootId;
QPushButton *addButton;
-private slots:
- void undock();
- void add();
- void setCurrentRootId( int );
+signals:
+ void rootChanged( int );
};
#endif
#define _PLPANELS_H_
#include <vlc/vlc.h>
+
+#include "qt4.hpp"
+
#include <QModelIndex>
#include <QWidget>
#include <QString>
{
Q_OBJECT;
public:
- PLPanel( QWidget *p, intf_thread_t *_p_intf ) : QWidget( p )
+ PLPanel( BasePlaylistWidget *p, intf_thread_t *_p_intf ) : QWidget( p )
{
p_intf = _p_intf;
+ parent = p;
}
virtual ~PLPanel() {};
protected:
intf_thread_t *p_intf;
+ BasePlaylistWidget *parent;
public slots:
virtual void setRoot( int ) = 0;
};
{
Q_OBJECT;
public:
- StandardPLPanel( QWidget *, intf_thread_t *,
+ StandardPLPanel( BasePlaylistWidget *, intf_thread_t *,
playlist_t *,playlist_item_t * );
virtual ~StandardPLPanel();
protected:
private:
PLModel *model;
QTreeView *view;
- QPushButton *repeatButton , *randomButton;
+ QPushButton *repeatButton , *randomButton,*addButton;
ClickLineEdit *searchLine;
+ int currentRootId;
public slots:
virtual void setRoot( int );
private slots:
void doPopup( QModelIndex index, QPoint point );
void search( QString search );
void clearFilter();
+ void add();
+ void setCurrentRootId( int );
};
#endif
*****************************************************************************/
#include "qt4.hpp"
+#include "dialogs_provider.hpp"
#include "playlist_model.hpp"
#include "components/playlist/panels.hpp"
#include "util/customwidgets.hpp"
#include <QToolBar>
#include <QLabel>
#include <QSpacerItem>
+#include <QMenu>
#include <assert.h>
-StandardPLPanel::StandardPLPanel( QWidget *_parent, intf_thread_t *_p_intf,
+StandardPLPanel::StandardPLPanel( BasePlaylistWidget *_parent,
+ intf_thread_t *_p_intf,
playlist_t *p_playlist,
playlist_item_t *p_root ):
PLPanel( _parent, _p_intf )
CONNECT( model, dataChanged( const QModelIndex&, const QModelIndex& ),
this, handleExpansion( const QModelIndex& ) );
+ currentRootId = -1;
+ CONNECT( parent, rootChanged(int), this, setCurrentRootId( int ) );
+
QVBoxLayout *layout = new QVBoxLayout();
layout->setSpacing( 0 ); layout->setMargin( 0 );
QHBoxLayout *buttons = new QHBoxLayout();
+ addButton = new QPushButton( "+", this );
+ addButton->setMaximumWidth( 25 );
+ BUTTONACT( addButton, add() );
+ buttons->addWidget( addButton );
+
repeatButton = new QPushButton( 0 ); buttons->addWidget( repeatButton );
- if( model->hasRepeat() ) repeatButton->setText( qtr( "Repeat One" ) );
- else if( model->hasLoop() ) repeatButton->setText( qtr( "Repeat All" ) );
- else repeatButton->setText( qtr( "No Repeat" ) );
+ if( model->hasRepeat() ) repeatButton->setText( qtr( "R1" ) );
+ else if( model->hasLoop() ) repeatButton->setText( qtr( "RA" ) );
+ else repeatButton->setText( qtr( "NR" ) );
BUTTONACT( repeatButton, toggleRepeat() );
randomButton = new QPushButton( 0 ); buttons->addWidget( randomButton );
- if( model->hasRandom() ) randomButton->setText( qtr( "Random" ) );
- else randomButton->setText( qtr( "No random" ) );
+ if( model->hasRandom() ) randomButton->setText( qtr( " RND" ) );
+ else randomButton->setText( qtr( "NRND" ) );
BUTTONACT( randomButton, toggleRandom() );
QSpacerItem *spacer = new QSpacerItem( 10, 20 );buttons->addItem( spacer );
buttons->addWidget( searchLine ); filter->setBuddy( searchLine );
QPushButton *clear = new QPushButton( qfu( "CL") );
+ clear->setMaximumWidth( 30 );
buttons->addWidget( clear );
BUTTONACT( clear, clearFilter() );
}
}
+void StandardPLPanel::setCurrentRootId( int _new )
+{
+ currentRootId = _new;
+ if( currentRootId == THEPL->p_local_category->i_id ||
+ currentRootId == THEPL->p_local_onelevel->i_id )
+ {
+ addButton->setEnabled( true );
+ addButton->setToolTip( qtr("Add to playlist" ) );
+ }
+ else if( currentRootId == THEPL->p_ml_category->i_id ||
+ currentRootId == THEPL->p_ml_onelevel->i_id )
+ {
+ addButton->setEnabled( true );
+ addButton->setToolTip( qtr("Add to media library" ) );
+ }
+ else
+ addButton->setEnabled( false );
+}
+
+void StandardPLPanel::add()
+{
+ QMenu *popup = new QMenu();
+ if( currentRootId == THEPL->p_local_category->i_id ||
+ currentRootId == THEPL->p_local_onelevel->i_id )
+ {
+ popup->addAction( "Add file", THEDP, SLOT( simplePLAppendDialog() ) );
+ popup->addAction( "Advanced add", THEDP, SLOT( PLAppendDialog() ) );
+ }
+ else if( currentRootId == THEPL->p_ml_category->i_id ||
+ currentRootId == THEPL->p_ml_onelevel->i_id )
+ {
+ popup->addAction( "Add file", THEDP, SLOT( simpleMLAppendDialog() ) );
+ popup->addAction( "Advanced add", THEDP, SLOT( MLAppendDialog() ) );
+ popup->addAction( "Directory", THEDP, SLOT( openMLDirectory() ) );
+ }
+ popup->popup( QCursor::pos() );
+}
+
void StandardPLPanel::clearFilter()
{
searchLine->setText( "" );
#include "qt4.hpp"
#include "main_interface.hpp"
#include "util/qvlcframe.hpp"
-#include "components/playlist/panels.hpp"
-#include "components/playlist/selector.hpp"
+#include "components/interface_widgets.hpp"
#include "dialogs_provider.hpp"
#include "menus.hpp"
setCentralWidget( main );
setWindowTitle( qtr( "Playlist" ) );
- createPlMenuBar( menuBar(), p_intf );
+ createPlMenuBar( menuBar(), p_intf );
- selector = new PLSelector( centralWidget(), p_intf, THEPL );
- selector->setMaximumWidth( 130 );
+ QHBoxLayout *l = new QHBoxLayout( centralWidget() );
+ PlaylistWidget *plw = new PlaylistWidget( p_intf );
+ l->addWidget( plw );
- playlist_item_t *p_root = playlist_GetPreferredNode( THEPL,
- THEPL->p_local_category );
-
- rightPanel = qobject_cast<PLPanel *>(new StandardPLPanel( centralWidget(),
- p_intf, THEPL, p_root ) );
- CONNECT( selector, activated( int ), rightPanel, setRoot( int ) );
-
- QHBoxLayout *layout = new QHBoxLayout();
- layout->addWidget( selector, 0 );
- layout->addWidget( rightPanel, 10 );
- centralWidget()->setLayout( layout );
readSettings( "playlist", QSize( 600,700 ) );
}
void PlaylistDialog::createPlMenuBar( QMenuBar *bar, intf_thread_t *p_intf )
{
QMenu *manageMenu = new QMenu();
- manageMenu->setTitle( qtr("Add") );
-
- QMenu *subPlaylist = new QMenu();
- subPlaylist->setTitle( qtr("Add to current playlist") );
- subPlaylist->addAction( "&File...", THEDP,
- SLOT( simplePLAppendDialog() ) );
- subPlaylist->addAction( "&Advanced add...", THEDP,
- SLOT( PLAppendDialog() ) );
- manageMenu->addMenu( subPlaylist );
- manageMenu->addSeparator();
-
- QMenu *subML = new QMenu();
- subML->setTitle( qtr("Add to Media library") );
- subML->addAction( "&File...", THEDP,
- SLOT( simpleMLAppendDialog() ) );
- subML->addAction( "Directory", THEDP, SLOT( openMLDirectory() ));
- subML->addAction( "&Advanced add...", THEDP,
- SLOT( MLAppendDialog() ) );
- manageMenu->addMenu( subML );
+ manageMenu->setTitle( qtr("Manage") );
manageMenu->addAction( "Open playlist file", THEDP, SLOT( openPlaylist() ));
-
+ manageMenu->addSeparator();
manageMenu->addAction( "Dock playlist", this, SLOT( dock() ) );
bar->addMenu( manageMenu );
bar->addMenu( QVLCMenu::SDMenu( p_intf ) );
setWindowTitle( QString::fromUtf8( _("VLC media player") ) );
handleMainUi( settings );
- QVLCMenu::createMenuBar( menuBar(), p_intf, playlistEmbeddedFlag );
+ QVLCMenu::createMenuBar( this, p_intf, playlistEmbeddedFlag );
/* Status bar */
timeLabel = new QLabel( 0 );
resize( mainSize );
}
-void MainInterface::customEvent( QEvent *event )
+void MainInterface::undockPlaylist()
{
- if( event->type() == PLUndockEvent_Type )
+ if( playlistWidget )
{
+ playlistWidget->hide();
+ playlistWidget->deleteLater();
ui.vboxLayout->removeWidget( playlistWidget );
playlistWidget = NULL;
playlistEmbeddedFlag = false;
- doComponentsUpdate();
+
menuBar()->clear();
- QVLCMenu::createMenuBar( menuBar(), p_intf, false );
+ QVLCMenu::createMenuBar( this, p_intf, false );
+
+ if( videoIsActive )
+ {
+ videoWidget->widgetSize = savedVideoSize;
+ videoWidget->resize( videoWidget->widgetSize );
+ videoWidget->updateGeometry();
+ }
+
+ doComponentsUpdate();
+ THEDP->playlistDialog();
}
- else if( event->type() == PLDockEvent_Type )
+}
+
+void MainInterface::customEvent( QEvent *event )
+{
+ if( event->type() == PLDockEvent_Type )
{
PlaylistDialog::killInstance();
playlistEmbeddedFlag = true;
menuBar()->clear();
- QVLCMenu::createMenuBar( menuBar(), p_intf, true );
+ QVLCMenu::createMenuBar(this, p_intf, true );
playlist();
}
}
QLabel *nameLabel;
void customEvent( QEvent *);
+public slots:
+ void undockPlaylist();
private slots:
void setStatus( int );
void setName( QString );
#include <QActionGroup>
#include <QSignalMapper>
+#include "main_interface.hpp"
+
#include "menus.hpp"
#include "dialogs_provider.hpp"
#include "input_manager.hpp"
CONNECT( menu, aboutToShow(), THEDP->menusUpdateMapper, map() ); \
THEDP->menusUpdateMapper->setMapping( menu, f ); }
-void QVLCMenu::createMenuBar( QMenuBar *bar, intf_thread_t *p_intf,
+void QVLCMenu::createMenuBar( MainInterface *mi, intf_thread_t *p_intf,
bool playlist )
{
+ QMenuBar *bar = mi->menuBar();
BAR_ADD( FileMenu(), qtr("File") );
if( playlist )
{
- BAR_ADD( PlaylistMenu( p_intf ), qtr("Playlist" ) );
+ BAR_ADD( PlaylistMenu( mi,p_intf ), qtr("Playlist" ) );
}
BAR_ADD( ToolsMenu( p_intf ), qtr("Tools") );
BAR_DADD( VideoMenu( p_intf, NULL ), qtr("Video"), 1 );
return menu;
}
-QMenu *QVLCMenu::PlaylistMenu( intf_thread_t *p_intf )
+QMenu *QVLCMenu::PlaylistMenu( MainInterface *mi, intf_thread_t *p_intf )
{
QMenu *menu = new QMenu();
menu->addMenu( SDMenu( p_intf ) );
DP_SADD( qtr( "Open playlist file"), "", "", openPlaylist() );
// DP_SADD( qtr( "Save playlist to file" ), "", "", savePlaylist() );
+ menu->addSeparator();
+ menu->addAction( qtr("Undock from interface"), mi,
+ SLOT( undockPlaylist() ) );
return menu;
}
{
Q_OBJECT;
public:
- static void createMenuBar( QMenuBar *, intf_thread_t *, bool );
+ static void createMenuBar( MainInterface *mi, intf_thread_t *, bool );
/* Menus */
static QMenu *FileMenu();
static QMenu *SDMenu( intf_thread_t * );
- static QMenu *PlaylistMenu( intf_thread_t *);
+ static QMenu *PlaylistMenu( MainInterface *, intf_thread_t *);
static QMenu *ToolsMenu( intf_thread_t *, bool with_intf = true );
static QMenu *NavigMenu( intf_thread_t * , QMenu * );
static QMenu *VideoMenu( intf_thread_t * , QMenu * );
intf_dialog_args_t *p_arg;
};
+/* Ugly to put it here, but don't want more files ... */
+#include <QFrame>
+class BasePlaylistWidget : public QFrame
+{
+public:
+ BasePlaylistWidget( intf_thread_t *_p_i ) : p_intf( _p_i) {};
+ virtual ~BasePlaylistWidget() {};
+protected:
+ intf_thread_t *p_intf;
+};
+
#endif