Commit 1d96db5b authored by Ludovic Fauvet's avatar Ludovic Fauvet

Add a left panel for controlling the tracks

Currently contains the track name and a button to disable the whole
track.
parent 53796b7d
......@@ -23,6 +23,10 @@
<file alias="mouse">images/mouse.png</file>
<file alias="zoomin">images/zoom_in.png</file>
<file alias="zoomout">images/zoom_out.png</file>
<file alias="trackon">images/trackon.png</file>
<file alias="trackoff">images/trackoff.png</file>
<file alias="hpon">images/hpon.png</file>
<file alias="hpoff">images/hpoff.png</file>
<file>images/audio.png</file>
<file>images/video.png</file>
</qresource>
......
......@@ -43,6 +43,7 @@ public:
{
m_type = type;
m_trackNumber = trackNumber;
m_enabled = true;
setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed );
setContentsMargins( 0, 0, 0, 0 );
......@@ -61,11 +62,26 @@ public:
return preferredHeight();
}
void setTrackEnabled( bool enabled )
{
m_enabled = enabled;
}
bool trackEnabled()
{
return m_enabled;
}
quint32 trackNumber()
{
return m_trackNumber;
}
MediaType mediaType()
{
return m_type;
}
virtual int type() const { return Type; }
protected:
......@@ -101,6 +117,7 @@ protected:
private:
MediaType m_type;
quint32 m_trackNumber;
bool m_enabled;
};
#endif // GRAPHICSTRACK_HPP
......@@ -54,14 +54,31 @@ Timeline::Timeline( QWidget *parent ) :
m_ui.rulerFrame->setLayout( tracksRulerLayout );
tracksRulerLayout->addWidget( m_tracksRuler );
m_tracksControls = new TracksControls( this );
QHBoxLayout* tracksControlsLayout = new QHBoxLayout();
tracksControlsLayout->setContentsMargins( 0, 0, 0, 0 );
m_ui.controlsFrame->setLayout( tracksControlsLayout );
tracksControlsLayout->addWidget( m_tracksControls );
changeZoom( 10 );
setDuration( 0 );
connect( m_tracksView->horizontalScrollBar(), SIGNAL( valueChanged( int ) ), m_tracksRuler, SLOT( moveRuler( int ) ) );
connect( m_tracksView->horizontalScrollBar(), SIGNAL( valueChanged(int) ),
m_tracksRuler, SLOT( moveRuler(int) ) );
connect( m_tracksView->verticalScrollBar(), SIGNAL( valueChanged(int) ),
m_tracksControls->verticalScrollBar(), SLOT( setValue(int) ) );
connect( m_tracksView, SIGNAL( durationChanged(int) ), this, SLOT( setDuration(int) ) );
connect( m_mainWorkflow, SIGNAL( clipAdded(Clip*,uint,qint64,MainWorkflow::TrackType ) ), this, SLOT( actionAddClip(Clip*,uint,qint64,MainWorkflow::TrackType ) ) );
connect( m_mainWorkflow, SIGNAL( clipMoved(QUuid, uint, qint64,MainWorkflow::TrackType ) ), this, SLOT( actionMoveClip(QUuid,uint,qint64,MainWorkflow::TrackType ) ) );
connect( m_mainWorkflow, SIGNAL( clipRemoved(QUuid,uint,MainWorkflow::TrackType ) ), this, SLOT( actionRemoveClip(QUuid,uint,MainWorkflow::TrackType )) );
connect( m_mainWorkflow, SIGNAL( cleared() ), tracksView(), SLOT( clear() ) );
connect( m_tracksView, SIGNAL( videoTrackAdded(GraphicsTrack*) ),
m_tracksControls, SLOT( addVideoTrack(GraphicsTrack*) ) );
connect( m_tracksView, SIGNAL( audioTrackAdded(GraphicsTrack*) ),
m_tracksControls, SLOT( addAudioTrack(GraphicsTrack*) ) );
m_tracksView->createLayout();
}
Timeline::~Timeline()
......
......@@ -26,6 +26,7 @@
#include "vlmc.h"
#include "ui_Timeline.h"
#include "TracksRuler.h"
#include "TracksControls.h"
#include "Workflow/MainWorkflow.h"
class TracksScene;
......@@ -59,6 +60,7 @@ private:
TracksView* m_tracksView;
TracksScene* m_tracksScene;
TracksRuler* m_tracksRuler;
TracksControls* m_tracksControls;
double m_scale;
MainWorkflow* m_mainWorkflow;
static Timeline* m_instance;
......
/*****************************************************************************
* TracksControls.cpp: Left panel of the timeline
*****************************************************************************
* 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 <QLabel>
#include "TracksControls.h"
TracksControls::TracksControls( QWidget* parent )
: QScrollArea( parent )
{
// Never show the scrollbars
setHorizontalScrollBarPolicy( Qt::ScrollBarAlwaysOff );
setVerticalScrollBarPolicy( Qt::ScrollBarAlwaysOff );
setContentsMargins( 0, 0, 0, 0 );
setFrameStyle( QFrame::NoFrame );
m_centralWidget = new QWidget();
m_centralWidget->setSizePolicy( QSizePolicy::Minimum, QSizePolicy::Minimum );
m_layout = new QVBoxLayout;
m_layout->setSizeConstraint( QLayout::SetMinimumSize );
m_layout->setContentsMargins( 0, 0, 0, 0 );
m_layout->setSpacing( 0 );
QWidget* separator = new QWidget;
separator->setSizePolicy( QSizePolicy::Minimum, QSizePolicy::Fixed );
separator->setMinimumHeight( 20 );
separator->setMaximumHeight( 20 );
m_layout->addWidget( separator );
m_centralWidget->setLayout( m_layout );
setWidget( m_centralWidget );
}
void TracksControls::addVideoTrack( GraphicsTrack* track )
{
TrackControls* item = new TrackControls( track, m_centralWidget );
item->setMinimumWidth( 108 );
item->setMinimumHeight( 25 );
item->setContentsMargins( 0, 0, 0, 0 );
m_layout->insertWidget( 0, item );
}
void TracksControls::addAudioTrack( GraphicsTrack* track )
{
TrackControls* item = new TrackControls( track, m_centralWidget );
item->setMinimumWidth( 108 );
item->setMinimumHeight( 25 );
item->setContentsMargins( 0, 0, 0, 0 );
m_layout->insertWidget( -1, item );
}
/*****************************************************************************
* TracksControls.cpp: Left panel of the timeline
*****************************************************************************
* 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 TRACKSCONTROLS_H
#define TRACKSCONTROLS_H
#include <QScrollArea>
#include <QVBoxLayout>
#include "GraphicsTrack.hpp"
#include "TrackControls.h"
class TracksControls : public QScrollArea
{
Q_OBJECT
public:
TracksControls( QWidget* parent = 0 );
public slots:
void addVideoTrack( GraphicsTrack* track );
void addAudioTrack( GraphicsTrack* track );
private:
QWidget* m_centralWidget;
QVBoxLayout* m_layout;
};
#endif // TRACKSCONTROLS_H
......@@ -61,8 +61,6 @@ TracksView::TracksView( QGraphicsScene* scene, MainWorkflow* mainWorkflow, QWidg
m_scene->addItem( m_cursorLine );
createLayout();
connect( m_cursorLine, SIGNAL( cursorPositionChanged(qint64) ),
this, SLOT( ensureCursorVisible() ) );
}
......@@ -110,6 +108,7 @@ void TracksView::addVideoTrack()
m_cursorLine->setHeight( m_layout->contentsRect().height() );
m_scene->invalidate(); // Redraw the background
m_numVideoTrack++;
emit videoTrackAdded( track );
}
void TracksView::addAudioTrack()
......@@ -121,6 +120,7 @@ void TracksView::addAudioTrack()
m_cursorLine->setHeight( m_layout->contentsRect().height() );
m_scene->invalidate(); // Redraw the background
m_numAudioTrack++;
emit audioTrackAdded( track );
}
void TracksView::clear()
......
......@@ -114,6 +114,8 @@ signals:
void zoomIn();
void zoomOut();
void durationChanged( int duration );
void videoTrackAdded( GraphicsTrack* );
void audioTrackAdded( GraphicsTrack* );
friend class Timeline;
friend class TracksScene;
......
......@@ -29,28 +29,6 @@
<property name="spacing">
<number>0</number>
</property>
<item row="0" column="0">
<widget class="QWidget" name="widget" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>25</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>50</width>
<height>24</height>
</size>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QFrame" name="rulerFrame">
<property name="sizePolicy">
......@@ -73,8 +51,8 @@
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QFrame" name="headersContainer">
<item row="1" column="1" rowspan="2">
<widget class="QFrame" name="tracksFrame">
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
......@@ -83,28 +61,49 @@
</property>
</widget>
</item>
<item row="1" column="1" rowspan="2">
<widget class="QFrame" name="tracksFrame">
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
<item row="0" column="0">
<widget class="QWidget" name="widget" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
<property name="minimumSize">
<size>
<width>25</width>
<height>0</height>
</size>
</property>
</widget>
</item>
<item row="2" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
<item row="1" column="0" rowspan="2">
<widget class="QFrame" name="controlsFrame">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="sizeHint" stdset="0">
<property name="minimumSize">
<size>
<width>108</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>20</width>
<height>144</height>
<width>108</width>
<height>16777215</height>
</size>
</property>
</spacer>
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
</widget>
</item>
</layout>
</widget>
......
/*****************************************************************************
* TrackControls.cpp: Widget used to configure a track
*****************************************************************************
* 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 <QIcon>
#include "TrackControls.h"
#include "ui_TrackControls.h"
TrackControls::TrackControls( GraphicsTrack* track, QWidget *parent ) :
QWidget( parent ), m_ui( new Ui::TrackControls ), m_track( track )
{
m_ui->setupUi( this );
setTrackDisabled( !m_track->trackEnabled() );
connect( m_ui->disableButton, SIGNAL( clicked(bool) ),
this, SLOT( setTrackDisabled(bool) ) );
if ( m_track->mediaType() == GraphicsTrack::Video )
m_ui->trackLabel->setText( "Video #" + QString::number( m_track->trackNumber() ) );
else if ( m_track->mediaType() == GraphicsTrack::Audio )
m_ui->trackLabel->setText( "Audio #" + QString::number( m_track->trackNumber() ) );
}
TrackControls::~TrackControls()
{
delete m_ui;
}
void TrackControls::changeEvent( QEvent *e )
{
QWidget::changeEvent( e );
switch ( e->type() ) {
case QEvent::LanguageChange:
m_ui->retranslateUi( this );
break;
default:
break;
}
}
void TrackControls::setTrackDisabled( bool disable )
{
m_track->setTrackEnabled( !disable );
if ( !disable )
{
if ( m_track->mediaType() == GraphicsTrack::Video )
m_ui->disableButton->setIcon( QIcon( ":/images/trackon" ) );
else if ( m_track->mediaType() == GraphicsTrack::Audio )
m_ui->disableButton->setIcon( QIcon( ":/images/hpon" ) );
}
else
{
if ( m_track->mediaType() == GraphicsTrack::Video )
m_ui->disableButton->setIcon( QIcon( ":/images/trackoff" ) );
else if ( m_track->mediaType() == GraphicsTrack::Audio )
m_ui->disableButton->setIcon( QIcon( ":/images/hpoff" ) );
}
}
/*****************************************************************************
* TrackControls.h: Widget used to configure a track
*****************************************************************************
* 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 TRACKCONTROLS_H
#define TRACKCONTROLS_H
#include <QtGui/QWidget>
#include "GraphicsTrack.hpp"
namespace Ui {
class TrackControls;
}
class TrackControls : public QWidget
{
Q_OBJECT
public:
TrackControls( GraphicsTrack* track, QWidget *parent = 0 );
~TrackControls();
protected:
void changeEvent( QEvent *e );
private slots:
void setTrackDisabled( bool disable );
private:
Ui::TrackControls *m_ui;
GraphicsTrack* m_track;
};
#endif // TRACKCONTROLS_H
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>TrackControls</class>
<widget class="QWidget" name="TrackControls">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>104</width>
<height>19</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="spacing">
<number>1</number>
</property>
<property name="margin">
<number>0</number>
</property>
<item>
<widget class="QPushButton" name="disableButton">
<property name="maximumSize">
<size>
<width>22</width>
<height>22</height>
</size>
</property>
<property name="text">
<string/>
</property>
<property name="iconSize">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="flat">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="trackLabel">
<property name="text">
<string>TextLabel</string>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>
......@@ -83,7 +83,9 @@ SOURCES += src/main.cpp \
src/EffectsEngine/MixerEffect.cpp \
src/GUI/LCDTimecode.cpp \
src/Configuration/VLMCSettingsDefault.cpp \
src/Configuration/ProjectSettingsDefault.cpp
src/Configuration/ProjectSettingsDefault.cpp \
src/GUI/TracksControls.cpp \
src/GUI/widgets/TrackControls.cpp
HEADERS += src/GUI/MainWindow.h \
src/GUI/DockWidgetManager.h \
src/GUI/LibraryWidget.h \
......@@ -162,7 +164,9 @@ HEADERS += src/GUI/MainWindow.h \
src/GUI/LCDTimecode.h \
src/Configuration/VLMCSettingsDefault.h \
src/Configuration/ProjectSettingsDefault.h \
src/GUI/PreferenceWidget.h
src/GUI/PreferenceWidget.h \
src/GUI/TracksControls.h \
src/GUI/widgets/TrackControls.h
FORMS += src/GUI/ui/MainWindow.ui \
src/GUI/ui/PreviewWidget.ui \
src/GUI/ui/LanguagePreferences.ui \
......@@ -179,13 +183,15 @@ FORMS += src/GUI/ui/MainWindow.ui \
src/GUI/ui/TagWidget.ui \
src/GUI/Library/ui/StackViewNavController.ui \
src/GUI/Library/ui/MediaCellView.ui \
src/GUI/Import/ui/ImportController.ui
src/GUI/Import/ui/ImportController.ui \
src/GUI/widgets/TrackControls.ui
TRANSLATIONS = ts/vlmc_es.ts \
ts/vlmc_fr.ts \
ts/vlmc_sv.ts
RESOURCES += ressources.qrc
INCLUDEPATH += src/LibVLCpp \
src/GUI \
src/GUI/widgets \
src/GUI/Library \
src/GUI/Import \
src/Tools \
......
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