Commit 87d3dcd8 authored by Ludovic Fauvet's avatar Ludovic Fauvet

Code cleanup

parent 4c1b6feb
......@@ -20,6 +20,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#include <QDir>
#include "LibraryWidget.h"
LibraryWidget::LibraryWidget( QWidget *parent ) : QWidget( parent )
......@@ -35,39 +36,51 @@ void LibraryWidget::on_pushButtonAddMedia_clicked()
switch( m_ui.LibraryTabs->currentIndex() )
{
case 0:
fileInfo = new QFileInfo( QFileDialog::getOpenFileName( this, tr( "Open Audios" ), "/home/kri5", tr( "Audio Files (*.mp3 *.oga *.flac *.aac *.wav)" )) );
m_ui.listWidgetAudio->addItem(new ListViewMediaItem( fileInfo ));
fileInfo = new QFileInfo( QFileDialog::getOpenFileName(
this,
tr( "Open Audios" ),
QDir::homePath(),
tr( "Audio Files (*.mp3 *.oga *.flac *.aac *.wav)" ) ) );
m_ui.listWidgetAudio->addItem( new ListViewMediaItem( fileInfo ) );
break;
case 1:
fileInfo = new QFileInfo( QFileDialog::getOpenFileName( this, tr( "Open Videos" ), "/home/kri5", tr( "Video Files (*.mov *.avi *.mkv)" )) );
m_ui.listWidgetVideo->addItem(new ListViewMediaItem( fileInfo ));
fileInfo = new QFileInfo( QFileDialog::getOpenFileName(
this,
tr( "Open Videos" ),
QDir::homePath(),
tr( "Video Files (*.mov *.avi *.mkv)" ) ) );
m_ui.listWidgetVideo->addItem( new ListViewMediaItem( fileInfo ) );
break;
case 2:
fileInfo = new QFileInfo( QFileDialog::getOpenFileName( this, tr( "Open Images" ), "/home/kri5", tr( "Video Files (*.gif *.png *.jpg)" )) );
m_ui.listWidgetImage->addItem(new ListViewMediaItem( fileInfo ));
fileInfo = new QFileInfo( QFileDialog::getOpenFileName(
this,
tr( "Open Images" ),
QDir::homePath(),
tr( "Video Files (*.gif *.png *.jpg)" ) ) );
m_ui.listWidgetImage->addItem( new ListViewMediaItem( fileInfo ) );
break;
default:
break;
}
m_ui.listWidgetAll->addItem(new ListViewMediaItem( fileInfo ));
m_ui.listWidgetAll->addItem( new ListViewMediaItem( fileInfo ) );
}
void LibraryWidget::on_LibraryTabs_currentChanged(int index)
void LibraryWidget::on_LibraryTabs_currentChanged( int index )
{
if (index == 3)
if ( index == 3 )
{
m_ui.pushButtonAddMedia->setEnabled(false);
m_ui.pushButtonRemoveMedia->setEnabled(false);
m_ui.pushButtonAddMedia->setEnabled( false );
m_ui.pushButtonRemoveMedia->setEnabled( false );
}
else
{
m_ui.pushButtonAddMedia->setEnabled(true);
m_ui.pushButtonRemoveMedia->setEnabled(true);
m_ui.pushButtonAddMedia->setEnabled( true );
m_ui.pushButtonRemoveMedia->setEnabled( true );
}
}
ListViewMediaItem::ListViewMediaItem( QFileInfo* fInfo, QListWidget* parent, int type ) : QListWidgetItem( parent, type )
{
fileInfo = fInfo;
setText(fileInfo->baseName());
setText( fileInfo->baseName() );
}
......@@ -36,11 +36,11 @@ class LibraryWidget : public QWidget
{
Q_OBJECT
public:
explicit LibraryWidget( QWidget *parent = 0 );
private:
QFileInfoList videoList;
Ui::LibraryWidget m_ui;
public:
explicit LibraryWidget( QWidget *parent = 0 );
private:
QFileInfoList videoList;
Ui::LibraryWidget m_ui;
private slots:
void on_LibraryTabs_currentChanged( int index );
......@@ -49,10 +49,10 @@ private slots:
class ListViewMediaItem : public QListWidgetItem
{
public:
ListViewMediaItem( QFileInfo* fileInfo, QListWidget* parent = 0, int type = Type);
public:
ListViewMediaItem( QFileInfo* fileInfo, QListWidget* parent = 0, int type = Type);
QFileInfo* fileInfo;
QFileInfo* fileInfo;
};
#endif /* !LIBRARYWIDGET_H */
......@@ -31,7 +31,7 @@
class MainWindow : public QMainWindow
{
Q_OBJECT
Q_DISABLE_COPY(MainWindow)
Q_DISABLE_COPY( MainWindow )
public:
explicit MainWindow( QWidget *parent = 0 );
......@@ -40,7 +40,7 @@ protected:
virtual void changeEvent( QEvent *e );
private:
void m_initializeDockWidgets( void );
void m_initializeDockWidgets( void );
Ui::MainWindow m_ui;
......
......@@ -30,9 +30,10 @@ Timeline::Timeline( QWidget *parent ) :
void Timeline::changeEvent( QEvent *e )
{
switch ( e->type() ) {
switch ( e->type() )
{
case QEvent::LanguageChange:
m_ui.retranslateUi(this);
m_ui.retranslateUi( this );
break;
default:
break;
......
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