Commit 0b5c3c57 authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

Qt4 - Typos/Code conventions/spaces/Cleaning.

Patch by Rémi Duraffort.
parent c3bcb323
......@@ -88,48 +88,48 @@ void DialogsProvider::customEvent( QEvent *event )
DialogEvent *de = static_cast<DialogEvent*>(event);
switch( de->i_dialog )
{
case INTF_DIALOG_FILE_SIMPLE:
case INTF_DIALOG_FILE:
openDialog(); break;
case INTF_DIALOG_DISC:
openDiscDialog(); break;
case INTF_DIALOG_NET:
openNetDialog(); break;
case INTF_DIALOG_SAT:
case INTF_DIALOG_CAPTURE:
openCaptureDialog(); break;
case INTF_DIALOG_DIRECTORY:
PLAppendDir(); break;
case INTF_DIALOG_PLAYLIST:
playlistDialog(); break;
case INTF_DIALOG_MESSAGES:
messagesDialog(); break;
case INTF_DIALOG_FILEINFO:
mediaInfoDialog(); break;
case INTF_DIALOG_PREFS:
prefsDialog(); break;
case INTF_DIALOG_BOOKMARKS:
bookmarksDialog(); break;
case INTF_DIALOG_EXTENDED:
extendedDialog(); break;
case INTF_DIALOG_VLM:
vlmDialog(); break;
case INTF_DIALOG_INTERACTION:
doInteraction( de->p_arg ); break;
case INTF_DIALOG_POPUPMENU:
QVLCMenu::PopupMenu( p_intf, (de->i_arg != 0) ); break;
case INTF_DIALOG_AUDIOPOPUPMENU:
QVLCMenu::AudioPopupMenu( p_intf ); break;
case INTF_DIALOG_VIDEOPOPUPMENU:
QVLCMenu::VideoPopupMenu( p_intf ); break;
case INTF_DIALOG_MISCPOPUPMENU:
QVLCMenu::MiscPopupMenu( p_intf ); break;
case INTF_DIALOG_WIZARD:
case INTF_DIALOG_STREAMWIZARD:
case INTF_DIALOG_UPDATEVLC:
case INTF_DIALOG_EXIT:
default:
msg_Warn( p_intf, "unimplemented dialog\n" );
case INTF_DIALOG_FILE_SIMPLE:
case INTF_DIALOG_FILE:
openDialog(); break;
case INTF_DIALOG_DISC:
openDiscDialog(); break;
case INTF_DIALOG_NET:
openNetDialog(); break;
case INTF_DIALOG_SAT:
case INTF_DIALOG_CAPTURE:
openCaptureDialog(); break;
case INTF_DIALOG_DIRECTORY:
PLAppendDir(); break;
case INTF_DIALOG_PLAYLIST:
playlistDialog(); break;
case INTF_DIALOG_MESSAGES:
messagesDialog(); break;
case INTF_DIALOG_FILEINFO:
mediaInfoDialog(); break;
case INTF_DIALOG_PREFS:
prefsDialog(); break;
case INTF_DIALOG_BOOKMARKS:
bookmarksDialog(); break;
case INTF_DIALOG_EXTENDED:
extendedDialog(); break;
case INTF_DIALOG_VLM:
vlmDialog(); break;
case INTF_DIALOG_INTERACTION:
doInteraction( de->p_arg ); break;
case INTF_DIALOG_POPUPMENU:
QVLCMenu::PopupMenu( p_intf, (de->i_arg != 0) ); break;
case INTF_DIALOG_AUDIOPOPUPMENU:
QVLCMenu::AudioPopupMenu( p_intf ); break;
case INTF_DIALOG_VIDEOPOPUPMENU:
QVLCMenu::VideoPopupMenu( p_intf ); break;
case INTF_DIALOG_MISCPOPUPMENU:
QVLCMenu::MiscPopupMenu( p_intf ); break;
case INTF_DIALOG_WIZARD:
case INTF_DIALOG_STREAMWIZARD:
case INTF_DIALOG_UPDATEVLC:
case INTF_DIALOG_EXIT:
default:
msg_Warn( p_intf, "unimplemented dialog" );
}
}
}
......@@ -362,10 +362,10 @@ void DialogsProvider::openAPlaylist()
void DialogsProvider::saveAPlaylist()
{
QFileDialog *qfd = new QFileDialog( NULL,
qtr("Choose a filename to save playlist"),
qtr( "Choose a filename to save playlist" ),
qfu( p_intf->p_libvlc->psz_homedir ),
qtr("XSPF playlist (*.xspf);; ") +
qtr("M3U playlist (*.m3u);; Any (*.*) ") );
qtr( "XSPF playlist (*.xspf);; " ) +
qtr( "M3U playlist (*.m3u);; Any (*.*) " ) );
qfd->setFileMode( QFileDialog::AnyFile );
qfd->setAcceptMode( QFileDialog::AcceptSave );
qfd->setConfirmOverwrite( true );
......@@ -381,8 +381,8 @@ void DialogsProvider::saveAPlaylist()
QString file = qfd->selectedFiles().first();
QString filter = qfd->selectedFilter();
if( file.contains(".xsp") ||
( filter.contains(".xspf") && !file.contains(".m3u") ) )
if( file.contains( ".xsp" ) ||
( filter.contains( ".xspf" ) && !file.contains( ".m3u" ) ) )
{
psz_module = psz_xspf;
if( !file.contains( ".xsp" ) )
......@@ -395,7 +395,7 @@ void DialogsProvider::saveAPlaylist()
file.append( ".m3u" );
}
playlist_Export( THEPL, qtu(file), THEPL->p_local_category,
playlist_Export( THEPL, qtu( file ), THEPL->p_local_category,
psz_module);
}
}
......@@ -414,10 +414,10 @@ void DialogsProvider::streamingDialog( QString mrl, bool b_transcode_only )
b_transcode_only );
if( s->exec() == QDialog::Accepted )
{
msg_Err( p_intf, "mrl %s\n", qta( s->getMrl() ) );
msg_Err( p_intf, "mrl %s", qta( s->getMrl() ) );
/* Just do it */
int i_len = strlen( qtu( s->getMrl() ) ) + 10;
char *psz_option = (char*)malloc(i_len);
char *psz_option = (char*)malloc( i_len );
snprintf( psz_option, i_len - 1, "%s", qtu( s->getMrl() ) );
playlist_AddExt( THEPL, qtu( mrl ), "Streaming",
......
......@@ -35,33 +35,33 @@
#include <QTimer>
#include <QApplication>
#define ADD_FILTER_MEDIA( string ) \
string += qtr("Media Files"); \
string += " ( "; \
string += EXTENSIONS_MEDIA; \
#define ADD_FILTER_MEDIA( string ) \
string += qtr( "Media Files" ); \
string += " ( "; \
string += EXTENSIONS_MEDIA; \
string += ");;";
#define ADD_FILTER_VIDEO( string ) \
string += qtr("Video Files"); \
string += " ( "; \
string += EXTENSIONS_VIDEO; \
#define ADD_FILTER_VIDEO( string ) \
string += qtr( "Video Files" ); \
string += " ( "; \
string += EXTENSIONS_VIDEO; \
string += ");;";
#define ADD_FILTER_AUDIO( string ) \
string += qtr("Audio Files"); \
string += " ( "; \
string += EXTENSIONS_AUDIO; \
#define ADD_FILTER_AUDIO( string ) \
string += qtr( "Audio Files" ); \
string += " ( "; \
string += EXTENSIONS_AUDIO; \
string += ");;";
#define ADD_FILTER_PLAYLIST( string )\
string += qtr("Playlist Files"); \
string += " ( "; \
string += EXTENSIONS_PLAYLIST; \
#define ADD_FILTER_PLAYLIST( string ) \
string += qtr( "Playlist Files" ); \
string += " ( "; \
string += EXTENSIONS_PLAYLIST; \
string += ");;";
#define ADD_FILTER_SUBTITLE( string )\
string += qtr("Subtitles Files"); \
string += " ( "; \
string += EXTENSIONS_SUBTITLE; \
#define ADD_FILTER_SUBTITLE( string ) \
string += qtr( "Subtitles Files" );\
string += " ( "; \
string += EXTENSIONS_SUBTITLE; \
string += ");;";
#define ADD_FILTER_ALL( string ) \
string += qtr("All Files"); \
#define ADD_FILTER_ALL( string ) \
string += qtr( "All Files" ); \
string += " (*.*)";
#define EXT_FILTER_MEDIA 0x01
......@@ -132,7 +132,7 @@ private:
public slots:
void doInteraction( intf_dialog_args_t * );
void menuAction( QObject *);
void menuUpdateAction( QObject *);
void menuUpdateAction( QObject * );
void SDMenuAction( QString );
void playlistDialog();
......
......@@ -38,7 +38,7 @@ InputManager::InputManager( QObject *parent, intf_thread_t *_p_intf) :
QObject( parent ), p_intf( _p_intf )
{
i_old_playing_status = END_S;
old_name="";
old_name = "";
p_input = NULL;
i_rate = 0;
ON_TIMEOUT( update() );
......@@ -176,7 +176,7 @@ void InputManager::update()
if( i_old_playing_status != val.i_int )
{
i_old_playing_status = val.i_int;
emit statusChanged( val.i_int == PAUSE_S ? PAUSE_S : PLAYING_S );
emit statusChanged( val.i_int == PAUSE_S ? PAUSE_S : PLAYING_S );
}
}
......
......@@ -33,7 +33,7 @@ class InputManager : public QObject
{
Q_OBJECT;
public:
InputManager( QObject *, intf_thread_t *);
InputManager( QObject *, intf_thread_t * );
virtual ~InputManager();
void delInput();
......@@ -89,7 +89,7 @@ public:
InputManager *getIM() { return im; };
private:
MainInputManager( intf_thread_t *);
MainInputManager( intf_thread_t * );
InputManager *im;
intf_thread_t *p_intf;
......@@ -103,7 +103,7 @@ public slots:
private slots:
void updateInput();
signals:
void inputChanged( input_thread_t *);
void inputChanged( input_thread_t * );
};
#endif
......@@ -143,7 +143,7 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf )
handleMainUi( settings );
/* Create a Dock to get the playlist */
dockPL = new QDockWidget( qtr("Playlist"), this );
dockPL = new QDockWidget( qtr( "Playlist" ), this );
dockPL->setSizePolicy( QSizePolicy::Preferred,
QSizePolicy::MinimumExpanding );
dockPL->setFeatures( QDockWidget::AllDockWidgetFeatures );
......@@ -789,7 +789,7 @@ void MainInterface::setStatus( int status )
void MainInterface::setRate( int rate )
{
QString str;
str.setNum( ( 1000 / (double)rate), 'f', 2 );
str.setNum( ( 1000 / (double)rate ), 'f', 2 );
str.append( "x" );
speedLabel->setText( str );
speedControl->updateControls( rate );
......
......@@ -58,7 +58,7 @@ static int ItemDeleted( vlc_object_t *p_this, const char *psz_variable,
* Duration
*/
void PLItem::init( int _i_id, int _i_input_id, PLItem *parent, PLModel *m)
void PLItem::init( int _i_id, int _i_input_id, PLItem *parent, PLModel *m )
{
parentItem = parent;
i_id = _i_id; i_input_id = _i_input_id;
......@@ -91,39 +91,39 @@ void PLItem::updateview( void )
{
switch( i_index )
{
case VLC_META_ENGINE_ARTIST:
strings.append( qtr( VLC_META_ARTIST ) );
break;
case VLC_META_ENGINE_TITLE:
strings.append( qtr( VLC_META_TITLE ) );
break;
case VLC_META_ENGINE_DESCRIPTION:
strings.append( qtr( VLC_META_DESCRIPTION ) );
break;
case VLC_META_ENGINE_DURATION:
strings.append( qtr( "Duration" ) );
break;
case VLC_META_ENGINE_GENRE:
strings.append( qtr( VLC_META_GENRE ) );
break;
case VLC_META_ENGINE_COLLECTION:
strings.append( qtr( VLC_META_COLLECTION ) );
break;
case VLC_META_ENGINE_SEQ_NUM:
strings.append( qtr( VLC_META_SEQ_NUM ) );
break;
case VLC_META_ENGINE_RATING:
strings.append( qtr( VLC_META_RATING ) );
break;
default:
break;
case VLC_META_ENGINE_ARTIST:
strings.append( qtr( VLC_META_ARTIST ) );
break;
case VLC_META_ENGINE_TITLE:
strings.append( qtr( VLC_META_TITLE ) );
break;
case VLC_META_ENGINE_DESCRIPTION:
strings.append( qtr( VLC_META_DESCRIPTION ) );
break;
case VLC_META_ENGINE_DURATION:
strings.append( qtr( "Duration" ) );
break;
case VLC_META_ENGINE_GENRE:
strings.append( qtr( VLC_META_GENRE ) );
break;
case VLC_META_ENGINE_COLLECTION:
strings.append( qtr( VLC_META_COLLECTION ) );
break;
case VLC_META_ENGINE_SEQ_NUM:
strings.append( qtr( VLC_META_SEQ_NUM ) );
break;
case VLC_META_ENGINE_RATING:
strings.append( qtr( VLC_META_RATING ) );
break;
default:
break;
}
}
}
}
PLItem::PLItem( int _i_id, int _i_input_id, PLItem *parent, PLModel *m)
PLItem::PLItem( int _i_id, int _i_input_id, PLItem *parent, PLModel *m )
{
init( _i_id, _i_input_id, parent, m );
}
......@@ -135,7 +135,7 @@ PLItem::PLItem( playlist_item_t * p_item, PLItem *parent, PLModel *m )
PLItem::~PLItem()
{
qDeleteAll(children);
qDeleteAll( children );
children.clear();
}
......@@ -161,7 +161,7 @@ void PLItem::remove( PLItem *removed )
int PLItem::row() const
{
if( parentItem )
return parentItem->children.indexOf(const_cast<PLItem*>(this));
return parentItem->children.indexOf( const_cast<PLItem*>(this) );
return 0;
}
......@@ -201,43 +201,43 @@ void PLItem::update( playlist_item_t *p_item, bool iscurrent )
{
switch( i_index )
{
case VLC_META_ENGINE_ARTIST:
ADD_META( p_item, Artist );
break;
case VLC_META_ENGINE_TITLE:
char *psz_title, *psz_name;
psz_title = input_item_GetTitle( p_item->p_input );
psz_name = input_item_GetName( p_item->p_input );
if( psz_title )
{
ADD_META( p_item, Title );
} else {
strings.append( qfu( psz_name ) );
}
free( psz_title );
free( psz_name );
break;
case VLC_META_ENGINE_DESCRIPTION:
ADD_META( p_item, Description );
break;
case VLC_META_ENGINE_DURATION:
secstotimestr( psz_duration,
input_item_GetDuration( p_item->p_input ) / 1000000 );
strings.append( QString( psz_duration ) );
break;
case VLC_META_ENGINE_GENRE:
ADD_META( p_item, Genre );
break;
case VLC_META_ENGINE_COLLECTION:
ADD_META( p_item, Album );
break;
case VLC_META_ENGINE_SEQ_NUM:
ADD_META( p_item, TrackNum );
break;
case VLC_META_ENGINE_RATING:
ADD_META( p_item, Rating );
default:
break;
case VLC_META_ENGINE_ARTIST:
ADD_META( p_item, Artist );
break;
case VLC_META_ENGINE_TITLE:
char *psz_title, *psz_name;
psz_title = input_item_GetTitle( p_item->p_input );
psz_name = input_item_GetName( p_item->p_input );
if( psz_title )
{
ADD_META( p_item, Title );
} else {
strings.append( qfu( psz_name ) );
}
free( psz_title );
free( psz_name );
break;
case VLC_META_ENGINE_DESCRIPTION:
ADD_META( p_item, Description );
break;
case VLC_META_ENGINE_DURATION:
secstotimestr( psz_duration,
input_item_GetDuration( p_item->p_input ) / 1000000 );
strings.append( QString( psz_duration ) );
break;
case VLC_META_ENGINE_GENRE:
ADD_META( p_item, Genre );
break;
case VLC_META_ENGINE_COLLECTION:
ADD_META( p_item, Album );
break;
case VLC_META_ENGINE_SEQ_NUM:
ADD_META( p_item, TrackNum );
break;
case VLC_META_ENGINE_RATING:
ADD_META( p_item, Rating );
default:
break;
}
}
......@@ -250,8 +250,8 @@ void PLItem::update( playlist_item_t *p_item, bool iscurrent )
*************************************************************************/
PLModel::PLModel( playlist_t *_p_playlist, intf_thread_t *_p_intf,
playlist_item_t * p_root, int _i_depth, QObject *parent)
: QAbstractItemModel(parent)
playlist_item_t * p_root, int _i_depth, QObject *parent )
: QAbstractItemModel( parent )
{
i_depth = _i_depth;
assert( i_depth == 1 || i_depth == -1 );
......@@ -290,9 +290,9 @@ Qt::DropActions PLModel::supportedDropActions() const
return Qt::CopyAction;
}
Qt::ItemFlags PLModel::flags(const QModelIndex &index) const
Qt::ItemFlags PLModel::flags( const QModelIndex &index ) const
{
Qt::ItemFlags defaultFlags = QAbstractItemModel::flags(index);
Qt::ItemFlags defaultFlags = QAbstractItemModel::flags( index );
if( index.isValid() )
return Qt::ItemIsDragEnabled | Qt::ItemIsDropEnabled | defaultFlags;
else
......@@ -306,26 +306,26 @@ QStringList PLModel::mimeTypes() const
return types;
}
QMimeData *PLModel::mimeData(const QModelIndexList &indexes) const
QMimeData *PLModel::mimeData( const QModelIndexList &indexes ) const
{
QMimeData *mimeData = new QMimeData();
QByteArray encodedData;
QDataStream stream(&encodedData, QIODevice::WriteOnly);
QDataStream stream( &encodedData, QIODevice::WriteOnly );
foreach (QModelIndex index, indexes) {
if (index.isValid() && index.column() == 0 )
stream << itemId(index);
foreach( QModelIndex index, indexes ) {
if( index.isValid() && index.column() == 0 )
stream << itemId( index );
}
mimeData->setData("vlc/playlist-item-id", encodedData);
mimeData->setData( "vlc/playlist-item-id", encodedData );
return mimeData;
}
bool PLModel::dropMimeData(const QMimeData *data, Qt::DropAction action,
int row, int column, const QModelIndex &target)
bool PLModel::dropMimeData( const QMimeData *data, Qt::DropAction action,
int row, int column, const QModelIndex &target )
{
if ( data->hasFormat("vlc/playlist-item-id") )
if( data->hasFormat( "vlc/playlist-item-id" ) )
{
if (action == Qt::IgnoreAction)
if( action == Qt::IgnoreAction )
return true;
PLItem *targetItem;
......@@ -334,11 +334,11 @@ bool PLModel::dropMimeData(const QMimeData *data, Qt::DropAction action,
else
targetItem = rootItem;
QByteArray encodedData = data->data("vlc/playlist-item-id");
QDataStream stream(&encodedData, QIODevice::ReadOnly);
QByteArray encodedData = data->data( "vlc/playlist-item-id" );
QDataStream stream( &encodedData, QIODevice::ReadOnly );
PLItem *newParentItem;
while (!stream.atEnd())
while( !stream.atEnd() )
{
int i;
int srcId;
......@@ -456,9 +456,9 @@ void PLModel::activateItem( playlist_item_t *p_item )
}
/****************** Base model mandatory implementations *****************/
QVariant PLModel::data(const QModelIndex &index, int role) const
QVariant PLModel::data( const QModelIndex &index, int role ) const
{
if(!index.isValid() ) return QVariant();
if( !index.isValid() ) return QVariant();
PLItem *item = static_cast<PLItem*>(index.internalPointer());
if( role == Qt::DisplayRole )
{
......@@ -492,25 +492,25 @@ int PLModel::itemId( const QModelIndex &index ) const
}
QVariant PLModel::headerData( int section, Qt::Orientation orientation,
int role) const
int role ) const
{
if (orientation == Qt::Horizontal && role == Qt::DisplayRole)
return QVariant( rootItem->columnString( section ) );
return QVariant();
}
QModelIndex PLModel::index(int row, int column, const QModelIndex &parent)
QModelIndex PLModel::index( int row, int column, const QModelIndex &parent )
const
{
PLItem *parentItem;
if (!parent.isValid())
if( !parent.isValid() )
parentItem = rootItem;
else
parentItem = static_cast<PLItem*>(parent.internalPointer());
PLItem *childItem = parentItem->child(row);
if (childItem)
return createIndex(row, column, childItem);
PLItem *childItem = parentItem->child( row );
if( childItem )
return createIndex( row, column, childItem );
else
return QModelIndex();
}
......@@ -526,12 +526,12 @@ QModelIndex PLModel::index( PLItem *item, int column ) const
return QModelIndex();
}
QModelIndex PLModel::parent(const QModelIndex &index) const
QModelIndex PLModel::parent( const QModelIndex &index ) const
{
if( !index.isValid() ) return QModelIndex();
PLItem *childItem = static_cast<PLItem*>(index.internalPointer());
if( !childItem ) { msg_Err( p_playlist, "NULL CHILD \n" ); return QModelIndex(); }
if( !childItem ) { msg_Err( p_playlist, "NULL CHILD" ); return QModelIndex(); }
PLItem *parentItem = childItem->parent();
if( !parentItem || parentItem == rootItem ) return QModelIndex();
if( ! parentItem->parentItem )
......@@ -549,16 +549,16 @@ int PLModel::columnCount( const QModelIndex &i) const
return rootItem->strings.count();
}
int PLModel::childrenCount(const QModelIndex &parent) const
int PLModel::childrenCount( const QModelIndex &parent ) const
{
return rowCount( parent );
}
int PLModel::rowCount(const QModelIndex &parent) const
int PLModel::rowCount( const QModelIndex &parent ) const
{
PLItem *parentItem;
if (!parent.isValid())
if( !parent.isValid() )
parentItem = rootItem;
else
parentItem = static_cast<PLItem*>(parent.internalPointer());
......@@ -860,7 +860,7 @@ void PLModel::doDelete( QModelIndexList selected )
}
}
void PLModel::recurseDelete( QList<PLItem*> children, QModelIndexList *fullList)
void PLModel::recurseDelete( QList<PLItem*> children, QModelIndexList *fullList )
{
for( int i = children.size() - 1; i >= 0 ; i-- )
{
......@@ -978,32 +978,32 @@ void PLModel::viewchanged( int meta )
int index=0;
switch( meta )
{
case VLC_META_ENGINE_TITLE:
index=0;
break;
case VLC_META_ENGINE_DURATION:
index=1;
break;
case VLC_META_ENGINE_ARTIST:
index=2;
break;
case VLC_META_ENGINE_GENRE:
index=3;
break;
case VLC_META_ENGINE_COPYRIGHT:
index=4;
break;
case VLC_META_ENGINE_COLLECTION:
index=5;
break;
case VLC_META_ENGINE_SEQ_NUM:
index=6;
break;
case VLC_META_ENGINE_DESCRIPTION:
index=7;
break;
default:
break;
case VLC_META_ENGINE_TITLE:
index=0;
break;