Commit 6d550d5f authored by Hugo Beauzee-Luyssen's avatar Hugo Beauzee-Luyssen

Merge branch 'master' of git@github.com:VLMC/vlmc

Conflicts:
	vlmc.pro
parents 62d32a70 af2dbf44
......@@ -44,7 +44,7 @@ class DockWidgetManager : public QObject
private:
explicit DockWidgetManager();
~DockWidgetManager() {}
virtual ~DockWidgetManager() { delete m_instance; }
DockWidgetManager(const DockWidgetManager &);
DockWidgetManager & operator = ( const DockWidgetManager & );
QMainWindow *m_mainWin;
......
......@@ -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 */
......@@ -50,6 +50,7 @@ void MainWindow::changeEvent( QEvent *e )
void MainWindow::m_initializeDockWidgets( void )
{
Timeline* timeline = new Timeline( this );
timeline->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding );
timeline->show();
setCentralWidget( timeline );
......
......@@ -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;
......
/*****************************************************************************
* Timeline.cpp: Widget that handle the tracks
*****************************************************************************
* Copyright (C) 2008-2009 the VLMC team
*
* Authors: Ludovic Fauvet <etix@l0cal.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* 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.
*****************************************************************************/
#include <QHBoxLayout>
#include "Timeline.h"
#include "TracksView.h"
#include "TracksScene.h"
Timeline::Timeline( QWidget *parent ) :
QWidget( parent )
{
m_ui.setupUi( this );
m_tracksScene = new TracksScene( this );
m_tracksView = new TracksView( m_tracksScene, m_ui.tracksFrame );
m_tracksView->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding );
m_tracksView->scale(1, 1);
m_tracksView->setAlignment( Qt::AlignLeft | Qt::AlignTop );
QHBoxLayout* tracksLayout = new QHBoxLayout();
tracksLayout->setContentsMargins( 0, 0, 0, 0 );
m_ui.tracksFrame->setLayout( tracksLayout );
tracksLayout->addWidget( m_tracksView );
}
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;
......
/*****************************************************************************
* Timeline.h: Widget that handle the tracks
*****************************************************************************
* Copyright (C) 2008-2009 the VLMC team
*
* Authors: Ludovic Fauvet <etix@l0cal.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* 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.
*****************************************************************************/
#ifndef TIMELINE_H
#define TIMELINE_H
#include "ui_Timeline.h"
#include "TracksView.h"
#include "TracksScene.h"
class Timeline : public QWidget
{
......@@ -9,12 +33,16 @@ class Timeline : public QWidget
Q_DISABLE_COPY( Timeline )
public:
explicit Timeline( QWidget *parent = 0 );
TracksView* tracksView() { return m_tracksView; }
TracksScene* tracksScene() { return m_tracksScene; }
protected:
virtual void changeEvent( QEvent *e );
private:
Ui::Timeline m_ui;
TracksView* m_tracksView;
TracksScene* m_tracksScene;
};
......
/*****************************************************************************
* TracksScene.cpp: QGraphicsScene that contains the tracks
*****************************************************************************
* Copyright (C) 2008-2009 the VLMC team
*
* Authors: Ludovic Fauvet <etix@l0cal.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* 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.
*****************************************************************************/
#include "TracksScene.h"
TracksScene::TracksScene( QObject* parent ) : QGraphicsScene( parent )
{
}
/*****************************************************************************
* TracksScene.h: QGraphicsScene that contains the tracks
*****************************************************************************
* Copyright (C) 2008-2009 the VLMC team
*
* Authors: Ludovic Fauvet <etix@l0cal.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* 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.
*****************************************************************************/
#ifndef TRACKSSCENE_H
#define TRACKSSCENE_H
#include <QGraphicsScene>
class TracksScene : public QGraphicsScene
{
Q_OBJECT
public:
TracksScene( QObject* parent = 0 );
};
#endif // TRACKSSCENE_H
/*****************************************************************************
* TracksView.cpp: QGraphicsView that contains the TracksScene
*****************************************************************************
* Copyright (C) 2008-2009 the VLMC team
*
* Authors: Ludovic Fauvet <etix@l0cal.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* 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.
*****************************************************************************/
#include <QScrollBar>
#include "TracksView.h"
TracksView::TracksView( QGraphicsScene* scene, QWidget* parent )
: QGraphicsView( scene, parent ), m_scene( scene )
{
//TODO should be defined by the settings
m_tracksHeight = 50;
//TODO should be dynamic
m_tracksCount = 5;
setDuration( 800 );
setMouseTracking( true );
setAcceptDrops( true );
setContentsMargins( 0, 0, 0, 0 );
const int maxHeight = m_tracksHeight * m_tracksCount;
setSceneRect( 0, 0, sceneRect().width(), maxHeight );
}
void TracksView::setDuration( int duration )
{
int diff = qAbs( duration - sceneRect().width() );
if ( diff * matrix().m11() > -50 )
{
if ( matrix().m11() < 0.4 )
setSceneRect( 0, 0, ( duration + 100 / matrix().m11() ), sceneRect().height() );
else
setSceneRect( 0, 0, ( duration + 300 ), sceneRect().height() );
}
m_projectDuration = duration;
}
void TracksView::resizeEvent( QResizeEvent* event )
{
QGraphicsView::resizeEvent( event );
}
void TracksView::drawBackground( QPainter* painter, const QRectF& rect )
{
QColor base = palette().button().color();
QRectF r = rect;
r.setWidth( r.width() + 1 );
painter->setClipRect( r );
painter->drawLine( r.left(), 0, r.right(), 0 );
uint tracks = m_tracksCount;
for ( uint i = 0; i < tracks; ++i )
painter->drawLine( r.left(), m_tracksHeight * ( i + 1 ), r.right(), m_tracksHeight * ( i + 1 ) );
int lowerLimit = m_tracksHeight * m_tracksCount + 1;
if ( height() > lowerLimit )
painter->fillRect( QRectF ( r.left(), lowerLimit, r.width(), height() - lowerLimit ), QBrush( base ) );
}
/*****************************************************************************
* TracksView.h: QGraphicsView that contains the TracksScene
*****************************************************************************
* Copyright (C) 2008-2009 the VLMC team
*
* Authors: Ludovic Fauvet <etix@l0cal.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* 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.
*****************************************************************************/
#ifndef TRACKSVIEW_H
#define TRACKSVIEW_H
#include <QGraphicsView>
class TracksView : public QGraphicsView
{
Q_OBJECT
public:
TracksView( QGraphicsScene* scene, QWidget* parent = 0 );
void setDuration( int duration );
int duration() { return m_projectDuration; }
protected:
virtual void resizeEvent( QResizeEvent* event );
virtual void drawBackground( QPainter* painter, const QRectF& rect );
private:
QGraphicsScene* m_scene;
int m_tracksHeight;
int m_tracksCount;
int m_projectDuration;
};
#endif // TRACKSVIEW_H
......@@ -6,10 +6,16 @@
<rect>
<x>0</x>
<y>0</y>
<width>429</width>
<height>167</height>
<width>400</width>
<height>150</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>400</width>
<height>150</height>
</size>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
......
......@@ -19,7 +19,9 @@ SOURCES += src/main.cpp \
src/LibVLCpp/VlmMedia.cpp \
src/gui/Timeline.cpp \
src/LibVLCpp/VLCMediaPlayer.cpp \
src/LibVLCpp/VLCMedia.cpp
src/LibVLCpp/VLCMedia.cpp \
src/gui/TracksView.cpp \
src/gui/TracksScene.cpp
HEADERS += src/gui/MainWindow.h \
src/gui/DockWidgetManager.h \
src/gui/LibraryWidget.h \
......@@ -30,8 +32,9 @@ HEADERS += src/gui/MainWindow.h \
src/LibVLCpp/VlmMedia.h \
src/gui/Timeline.h \
src/LibVLCpp/VLCMediaPlayer.h \
src/LibVLCpp/VLCMedia.h
src/LibVLCpp/VLCMedia.h \
src/gui/TracksView.h \
src/gui/TracksScene.h
FORMS += src/gui/ui/MainWindow.ui \
src/gui/ui/Timeline.ui \
src/gui/ui/LibraryWidget.ui
......
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