#include "components/playlist/vlc_model.hpp" /* VLCModel */
#include "components/playlist/playlist_model.hpp" /* PLModel */
-#include "components/playlist/ml_model.hpp" /* MLModel */
#include "components/playlist/views.hpp" /* 3 views */
#include "components/playlist/selector.hpp" /* PLSelector */
-#include "util/customwidgets.hpp" /* PixmapAnimator */
+#include "util/animators.hpp" /* PixmapAnimator */
#include "menus.hpp" /* Popup */
#include "input_manager.hpp" /* THEMIM */
#include "dialogs_provider.hpp" /* THEDP */
I_DIR_OR_FOLDER( N_( "Enter name for new directory:" ), \
N_( "Enter name for new folder:" ) )
+#define I_RENAME_DIR \
+ I_DIR_OR_FOLDER( N_("Rename Directory"), N_( "Rename Folder" ) )
+#define I_RENAME_DIR_NAME \
+ I_DIR_OR_FOLDER( N_( "Enter a new name for the directory:" ), \
+ N_( "Enter a new name for the folder:" ) )
+
#include <QHeaderView>
#include <QMenu>
#include <QKeyEvent>
intf_thread_t *_p_intf,
playlist_item_t *p_root,
PLSelector *_p_selector,
- VLCProxyModel *_p_model )
+ VLCModel *_p_model )
: QWidget( _parent ),
model( _p_model ),
p_intf( _p_intf ),
DCONNECT( THEMIM, leafBecameParent( int ),
this, browseInto( int ) );
- CONNECT( model->sigs, currentIndexChanged( const QModelIndex& ),
+ CONNECT( model, currentIndexChanged( const QModelIndex& ),
this, handleExpansion( const QModelIndex& ) );
- CONNECT( model->sigs, rootIndexChanged(), this, browseInto() );
+ CONNECT( model, rootIndexChanged(), this, browseInto() );
setRootItem( p_root, false );
}
currentView->selectionModel()->select( index, QItemSelectionModel::Select );
}
- if( !popup( globalPoint ) ) VLCMenuBar::PopupMenu( p_intf, true );
+ if( !popup( globalPoint ) ) THEDP->setPopupMenu();
}
/*********** Popup *********/
bool StandardPLPanel::popup( const QPoint &point )
{
QModelIndex index = popupIndex( currentView ); /* index for menu logic only. Do not store.*/
- VLCProxyModel *model = qobject_cast<VLCProxyModel *>(currentView->model());
+ VLCModel *model = qobject_cast<VLCModel *>(currentView->model());
#define ADD_MENU_ENTRY( icon, title, act ) \
if ( model->isSupportedAction( act, index ) )\
ADD_MENU_ENTRY( addIcon, qtr(I_POP_NEWFOLDER),
VLCModelSubInterface::ACTION_CREATENODE )
+ ADD_MENU_ENTRY( QIcon(), qtr(I_POP_RENAMEFOLDER),
+ VLCModelSubInterface::ACTION_RENAMENODE )
+
menu.addSeparator();
/* In PL or ML, allow to add a file/folder */
ADD_MENU_ENTRY( addIcon, qtr(I_PL_ADDF),
ADD_MENU_ENTRY( QIcon(), qtr(I_PL_ADDPL),
VLCModelSubInterface::ACTION_ADDTOPLAYLIST );
+ menu.addSeparator();
+ ADD_MENU_ENTRY( QIcon(), qtr( I_PL_SAVE ),
+ VLCModelSubInterface::ACTION_SAVETOPLAYLIST );
+
menu.addSeparator();
/* Item removal */
void StandardPLPanel::popupAction( QAction *action )
{
- VLCProxyModel *model = qobject_cast<VLCProxyModel *>(currentView->model());
+ VLCModel *model = qobject_cast<VLCModel *>(currentView->model());
VLCModelSubInterface::actionsContainerType a =
action->data().value<VLCModelSubInterface::actionsContainerType>();
QModelIndexList list = currentView->selectionModel()->selectedRows();
case VLCModelSubInterface::ACTION_EXPLORE:
/* locally handled only */
temp = model->getURI( index );
- if( ! temp.isEmpty() ) path = make_path( temp.toAscii().constData() );
+ if( ! temp.isEmpty() ) path = make_path( temp.toLatin1().constData() );
if( path == NULL ) return;
QDesktopServices::openUrl(
QUrl::fromLocalFile( QFileInfo( qfu( path ) ).absolutePath() ) );
/* locally handled only */
temp = model->getURI( index );
if ( ! temp.isEmpty() )
- THEDP->streamingDialog( NULL, temp, false );
+ {
+ QStringList tempList;
+ tempList.append(temp);
+ THEDP->streamingDialog( NULL, tempList, false );
+ }
break;
case VLCModelSubInterface::ACTION_SAVE:
/* locally handled only */
temp = model->getURI( index );
if ( ! temp.isEmpty() )
- THEDP->streamingDialog( NULL, temp );
+ {
+ QStringList tempList;
+ tempList.append(temp);
+ THEDP->streamingDialog( NULL, tempList );
+ }
break;
case VLCModelSubInterface::ACTION_CREATENODE:
model->createNode( index, temp );
break;
+ case VLCModelSubInterface::ACTION_RENAMENODE:
+ temp = QInputDialog::getText( PlaylistDialog::getInstance( p_intf ),
+ qtr( I_RENAME_DIR ), qtr( I_RENAME_DIR_NAME ),
+ QLineEdit::Normal, model->getTitle( index ), &ok);
+ if ( !ok ) return;
+ model->renameNode( index, temp );
+ break;
+
case VLCModelSubInterface::ACTION_ENQUEUEFILE:
uris = THEDP->showSimpleOpen();
if ( uris.isEmpty() ) return;
break;
case VLCModelSubInterface::ACTION_ENQUEUEDIR:
- temp = THEDP->getDirectoryDialog();
+ temp = DialogsProvider::getDirectoryDialog( p_intf );
if ( temp.isEmpty() ) return;
a.uris << temp;
action->setData( QVariant::fromValue( a ) );
RecentsMRL::getInstance( p_intf )->addRecent( file );
break;
+ case VLCModelSubInterface::ACTION_SAVETOPLAYLIST:
+ THEDP->savePlayingToPlaylist();
+ break;
default:
model->action( action, list );
}
/* This activated by the selector selection */
void StandardPLPanel::setRootItem( playlist_item_t *p_item, bool b )
{
-#ifdef SQL_MEDIA_LIBRARY
- if( b )
- {
- msg_Dbg( p_intf, "Setting the SQL ML" );
- if ( model->switchToModel( VLCProxyModel::SQLML_MODEL ) )
- currentView->setModel( model );
- }
- else
-#else
Q_UNUSED( b );
-#endif
- {
- if ( model->switchToModel( VLCProxyModel::PL_MODEL ) )
- model->rebuild( p_item );
- }
+ model->rebuild( p_item );
}
void StandardPLPanel::browseInto( const QModelIndex &index )
{
playlist_Lock( THEPL );
playlist_item_t *p_item = playlist_ItemGetById( THEPL, model->itemId( index, PLAYLIST_ID ) );
- p_item->i_flags |= PLAYLIST_SUBITEM_STOP_FLAG;
- lastActivatedPLItemId = p_item->i_id;
+ if ( p_item )
+ {
+ p_item->i_flags |= PLAYLIST_SUBITEM_STOP_FLAG;
+ lastActivatedPLItemId = p_item->i_id;
+ }
playlist_Unlock( THEPL );
- if ( index.isValid() )
+ if ( p_item && index.isValid() )
model->activateItem( index );
}
}