Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Kdenlive
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
261
Issues
261
List
Boards
Labels
Service Desk
Milestones
Merge Requests
16
Merge Requests
16
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Multimedia
Kdenlive
Commits
0a21eb6d
Commit
0a21eb6d
authored
Feb 16, 2008
by
Jean-Baptiste Mardelle
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implement clipmanager
svn path=/branches/KDE4/; revision=1849
parent
82f9f273
Changes
19
Hide whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
471 additions
and
111 deletions
+471
-111
src/CMakeLists.txt
src/CMakeLists.txt
+1
-0
src/addclipcommand.cpp
src/addclipcommand.cpp
+6
-8
src/addclipcommand.h
src/addclipcommand.h
+4
-7
src/clipitem.cpp
src/clipitem.cpp
+48
-7
src/clipitem.h
src/clipitem.h
+4
-1
src/clipmanager.cpp
src/clipmanager.cpp
+101
-0
src/clipmanager.h
src/clipmanager.h
+64
-0
src/customtrackview.cpp
src/customtrackview.cpp
+17
-1
src/customtrackview.h
src/customtrackview.h
+1
-0
src/docclipbase.cpp
src/docclipbase.cpp
+77
-11
src/docclipbase.h
src/docclipbase.h
+37
-24
src/kdenlivedoc.cpp
src/kdenlivedoc.cpp
+41
-1
src/kdenlivedoc.h
src/kdenlivedoc.h
+11
-0
src/mainwindow.cpp
src/mainwindow.cpp
+3
-0
src/projectitem.cpp
src/projectitem.cpp
+27
-7
src/projectitem.h
src/projectitem.h
+3
-0
src/projectlist.cpp
src/projectlist.cpp
+21
-42
src/projectlist.h
src/projectlist.h
+2
-0
src/projectlistview.cpp
src/projectlistview.cpp
+3
-2
No files found.
src/CMakeLists.txt
View file @
0a21eb6d
...
...
@@ -57,6 +57,7 @@ set(kdenlive_SRCS
resizeclipcommand.cpp
addtimelineclipcommand.cpp
kthumb.cpp
clipmanager.cpp
)
kde4_add_kcfg_files
(
kdenlive_SRCS GENERATE_MOC kdenlivesettings.kcfgc
)
...
...
src/addclipcommand.cpp
View file @
0a21eb6d
...
...
@@ -21,8 +21,8 @@
#include "addclipcommand.h"
AddClipCommand
::
AddClipCommand
(
ProjectList
*
list
,
const
QStringList
&
names
,
const
QDomElement
&
xml
,
const
int
id
,
const
KUrl
&
url
,
const
QString
&
group
,
bool
doIt
)
:
m_
list
(
list
),
m_names
(
names
),
m_xml
(
xml
),
m_id
(
id
),
m_url
(
url
),
m_group
(
group
),
m_doIt
(
doIt
)
{
AddClipCommand
::
AddClipCommand
(
KdenliveDoc
*
doc
,
const
QDomElement
&
xml
,
const
uint
id
,
bool
doIt
)
:
m_
doc
(
doc
),
m_xml
(
xml
),
m_id
(
id
),
m_doIt
(
doIt
)
{
if
(
doIt
)
setText
(
i18n
(
"Add clip"
));
else
setText
(
i18n
(
"Delete clip"
));
}
...
...
@@ -31,18 +31,16 @@ AddClipCommand::AddClipCommand(ProjectList *list, const QStringList &names, cons
// virtual
void
AddClipCommand
::
undo
()
{
if
(
!
m_list
)
kDebug
()
<<
"---- ERROR, NO LIST FOR undoing action"
;
kDebug
()
<<
"---- undoing action"
;
if
(
m_doIt
)
m_
list
->
deleteClip
(
m_id
);
else
m_
list
->
addClip
(
m_names
,
m_xml
,
m_id
,
m_url
,
m_group
);
if
(
m_doIt
)
m_
doc
->
deleteClip
(
m_id
);
else
m_
doc
->
addClip
(
m_xml
,
m_id
);
}
// virtual
void
AddClipCommand
::
redo
()
{
if
(
!
m_list
)
kDebug
()
<<
"---- ERROR, NO LIST FOR redoing action"
;
kDebug
()
<<
"---- redoing action"
;
if
(
m_doIt
)
m_
list
->
addClip
(
m_names
,
m_xml
,
m_id
,
m_url
,
m_group
);
else
m_
list
->
deleteClip
(
m_id
);
if
(
m_doIt
)
m_
doc
->
addClip
(
m_xml
,
m_id
);
else
m_
doc
->
deleteClip
(
m_id
);
}
#include "addclipcommand.moc"
src/addclipcommand.h
View file @
0a21eb6d
...
...
@@ -24,24 +24,21 @@
#include <QUndoCommand>
#include <KDebug>
#include "
projectlist
.h"
#include "
kdenlivedoc
.h"
class
AddClipCommand
:
public
QUndoCommand
{
public:
AddClipCommand
(
ProjectList
*
list
,
const
QStringList
&
names
,
const
QDomElement
&
xml
,
const
int
id
,
const
KUrl
&
url
,
const
QString
&
group
,
bool
doIt
);
AddClipCommand
(
KdenliveDoc
*
list
,
const
QDomElement
&
xml
,
const
uint
id
,
bool
doIt
);
virtual
void
undo
();
virtual
void
redo
();
private:
ProjectList
*
m_list
;
QStringList
m_names
;
KdenliveDoc
*
m_doc
;
QDomElement
m_xml
;
int
m_id
;
KUrl
m_url
;
uint
m_id
;
bool
m_doIt
;
QString
m_group
;
};
#endif
...
...
src/clipitem.cpp
View file @
0a21eb6d
...
...
@@ -34,7 +34,7 @@
#include "kdenlivesettings.h"
ClipItem
::
ClipItem
(
QDomElement
xml
,
int
track
,
int
startpos
,
const
QRectF
&
rect
,
int
duration
)
:
QGraphicsRectItem
(
rect
),
m_xml
(
xml
),
m_resizeMode
(
NONE
),
m_grabPoint
(
0
),
m_maxTrack
(
0
),
m_track
(
track
),
m_startPos
(
startpos
),
m_
thumbProd
(
NULL
),
startThumbTimer
(
NULL
),
endThumbTimer
(
NULL
),
m_startFade
(
0
),
m_endFade
(
0
)
:
QGraphicsRectItem
(
rect
),
m_xml
(
xml
),
m_resizeMode
(
NONE
),
m_grabPoint
(
0
),
m_maxTrack
(
0
),
m_track
(
track
),
m_startPos
(
startpos
),
m_
hasThumbs
(
false
),
startThumbTimer
(
NULL
),
endThumbTimer
(
NULL
),
m_startFade
(
0
),
m_endFade
(
0
)
{
//setToolTip(name);
...
...
@@ -56,9 +56,9 @@ ClipItem::ClipItem(QDomElement xml, int track, int startpos, const QRectF & rect
setBrush
(
QColor
(
100
,
100
,
150
));
if
(
m_clipType
==
VIDEO
||
m_clipType
==
AV
)
{
m_
thumbProd
=
new
KThumb
(
KUrl
(
xml
.
attribute
(
"resource"
)),
KdenliveSettings
::
track_height
()
*
KdenliveSettings
::
project_display_ratio
(),
KdenliveSettings
::
track_height
())
;
connect
(
this
,
SIGNAL
(
getThumb
(
int
,
int
)),
m_thumbProd
,
SLOT
(
extractImage
(
int
,
int
)));
connect
(
m_thumbProd
,
SIGNAL
(
thumbReady
(
int
,
QPixmap
)),
this
,
SLOT
(
slotThumbReady
(
int
,
QPixmap
)));
m_
hasThumbs
=
true
;
//connect(this, SIGNAL(getThumb(int, int)), clip->thumbProducer()
, SLOT(extractImage(int, int)));
//connect(clip->thumbProducer()
, SIGNAL(thumbReady(int, QPixmap)), this, SLOT(slotThumbReady(int, QPixmap)));
QTimer
::
singleShot
(
300
,
this
,
SLOT
(
slotFetchThumbs
()));
startThumbTimer
=
new
QTimer
(
this
);
...
...
@@ -79,11 +79,52 @@ ClipItem::ClipItem(QDomElement xml, int track, int startpos, const QRectF & rect
}
}
ClipItem
::
ClipItem
(
DocClipBase
*
clip
,
int
track
,
int
startpos
,
const
QRectF
&
rect
,
int
duration
)
:
QGraphicsRectItem
(
rect
),
m_clip
(
clip
),
m_resizeMode
(
NONE
),
m_grabPoint
(
0
),
m_maxTrack
(
0
),
m_track
(
track
),
m_startPos
(
startpos
),
m_hasThumbs
(
false
),
startThumbTimer
(
NULL
),
endThumbTimer
(
NULL
),
m_startFade
(
0
),
m_endFade
(
0
)
{
//setToolTip(name);
kDebug
()
<<
"******* CREATING NEW TML CLIP, DUR: "
<<
duration
;
m_xml
=
clip
->
toXML
();
m_clipName
=
clip
->
name
();
m_producer
=
clip
->
getId
();
m_clipType
=
clip
->
clipType
();
m_cropStart
=
0
;
m_maxDuration
=
duration
;
if
(
duration
!=
-
1
)
m_cropDuration
=
duration
;
else
m_cropDuration
=
m_maxDuration
;
setFlags
(
QGraphicsItem
::
ItemClipsToShape
|
QGraphicsItem
::
ItemClipsChildrenToShape
|
QGraphicsItem
::
ItemIsMovable
|
QGraphicsItem
::
ItemIsSelectable
);
setBrush
(
QColor
(
100
,
100
,
150
));
if
(
m_clipType
==
VIDEO
||
m_clipType
==
AV
)
{
m_hasThumbs
=
true
;
connect
(
this
,
SIGNAL
(
getThumb
(
int
,
int
)),
clip
->
thumbProducer
(),
SLOT
(
extractImage
(
int
,
int
)));
connect
(
clip
->
thumbProducer
(),
SIGNAL
(
thumbReady
(
int
,
QPixmap
)),
this
,
SLOT
(
slotThumbReady
(
int
,
QPixmap
)));
QTimer
::
singleShot
(
300
,
this
,
SLOT
(
slotFetchThumbs
()));
startThumbTimer
=
new
QTimer
(
this
);
startThumbTimer
->
setSingleShot
(
true
);
connect
(
startThumbTimer
,
SIGNAL
(
timeout
()),
this
,
SLOT
(
slotGetStartThumb
()));
endThumbTimer
=
new
QTimer
(
this
);
endThumbTimer
->
setSingleShot
(
true
);
connect
(
endThumbTimer
,
SIGNAL
(
timeout
()),
this
,
SLOT
(
slotGetEndThumb
()));
}
else
if
(
m_clipType
==
COLOR
)
{
QString
colour
=
m_xml
.
attribute
(
"colour"
);
colour
=
colour
.
replace
(
0
,
2
,
"#"
);
setBrush
(
QColor
(
colour
.
left
(
7
)));
}
else
if
(
m_clipType
==
IMAGE
)
{
m_startPix
=
KThumb
::
getImage
(
KUrl
(
m_xml
.
attribute
(
"resource"
)),
50
*
KdenliveSettings
::
project_display_ratio
(),
50
);
}
}
ClipItem
::~
ClipItem
()
{
if
(
startThumbTimer
)
delete
startThumbTimer
;
if
(
endThumbTimer
)
delete
endThumbTimer
;
if
(
m_thumbProd
)
delete
m_thumbProd
;
}
void
ClipItem
::
slotFetchThumbs
()
...
...
@@ -394,7 +435,7 @@ void ClipItem::resizeStart(int posx, double scale)
break
;
}
}
if
(
m_
thumbProd
)
startThumbTimer
->
start
(
100
);
if
(
m_
hasThumbs
)
startThumbTimer
->
start
(
100
);
}
void
ClipItem
::
resizeEnd
(
int
posx
,
double
scale
)
...
...
@@ -421,7 +462,7 @@ void ClipItem::resizeEnd(int posx, double scale)
break
;
}
}
if
(
m_
thumbProd
)
endThumbTimer
->
start
(
100
);
if
(
m_
hasThumbs
)
endThumbTimer
->
start
(
100
);
}
// virtual
...
...
src/clipitem.h
View file @
0a21eb6d
...
...
@@ -27,6 +27,7 @@
#include "definitions.h"
#include "gentime.h"
#include "docclipbase.h"
#include "kthumb.h"
...
...
@@ -36,6 +37,7 @@ class ClipItem : public QObject, public QGraphicsRectItem
public:
ClipItem
(
QDomElement
xml
,
int
track
,
int
startpos
,
const
QRectF
&
rect
,
int
duration
=
-
1
);
ClipItem
(
DocClipBase
*
clip
,
int
track
,
int
startpos
,
const
QRectF
&
rect
,
int
duration
);
virtual
~
ClipItem
();
virtual
void
paint
(
QPainter
*
painter
,
const
QStyleOptionGraphicsItem
*
option
,
...
...
@@ -67,6 +69,7 @@ class ClipItem : public QObject, public QGraphicsRectItem
private:
QDomElement
m_xml
;
DocClipBase
*
m_clip
;
int
m_textWidth
;
OPERATIONTYPE
m_resizeMode
;
int
m_grabPoint
;
...
...
@@ -81,7 +84,7 @@ class ClipItem : public QObject, public QGraphicsRectItem
int
m_startPos
;
QPixmap
m_startPix
;
QPixmap
m_endPix
;
KThumb
*
m_thumbProd
;
bool
m_hasThumbs
;
QTimer
*
startThumbTimer
;
QTimer
*
endThumbTimer
;
uint
m_startFade
;
...
...
src/clipmanager.cpp
0 → 100644
View file @
0a21eb6d
/***************************************************************************
* Copyright (C) 2008 by Jean-Baptiste Mardelle (jb@kdenlive.org) *
* *
* 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 <KDebug>
#include <KFileDialog>
#include "addclipcommand.h"
#include "kdenlivesettings.h"
#include "clipmanager.h"
ClipManager
::
ClipManager
(
KdenliveDoc
*
doc
)
:
m_doc
(
doc
)
{
m_clipIdCounter
=
1
;
}
ClipManager
::~
ClipManager
()
{
}
void
ClipManager
::
addClip
(
DocClipBase
*
clip
)
{
m_clipList
.
append
(
clip
);
}
void
ClipManager
::
deleteClip
(
uint
clipId
)
{
for
(
int
i
=
0
;
i
<
m_clipList
.
count
();
i
++
)
{
if
(
m_clipList
.
at
(
i
)
->
getId
()
==
clipId
)
m_clipList
.
removeAt
(
i
);
}
}
DocClipBase
*
ClipManager
::
getClipAt
(
int
pos
)
{
return
m_clipList
.
at
(
pos
);
}
DocClipBase
*
ClipManager
::
getClipById
(
int
clipId
)
{
kDebug
()
<<
"++++ CLIP MAN, LOOKING FOR CLIP ID: "
<<
clipId
;
for
(
int
i
=
0
;
i
<
m_clipList
.
count
();
i
++
)
{
if
(
m_clipList
.
at
(
i
)
->
getId
()
==
clipId
)
{
kDebug
()
<<
"++++ CLIP MAN, FOUND FOR CLIP ID: "
<<
clipId
;
return
m_clipList
.
at
(
i
);
}
}
return
NULL
;
}
void
ClipManager
::
slotAddClipFile
(
const
KUrl
url
,
const
QString
group
)
{
kDebug
()
<<
"///// CLIP MANAGER, ADDING CLIP: "
<<
url
;
QDomDocument
doc
;
QDomElement
prod
=
doc
.
createElement
(
"producer"
);
prod
.
setAttribute
(
"resource"
,
url
.
path
());
uint
id
=
m_clipIdCounter
++
;
prod
.
setAttribute
(
"id"
,
QString
::
number
(
id
));
if
(
!
group
.
isEmpty
())
prod
.
setAttribute
(
"group"
,
group
);
KMimeType
::
Ptr
type
=
KMimeType
::
findByUrl
(
url
);
if
(
type
->
name
().
startsWith
(
"image/"
))
{
prod
.
setAttribute
(
"type"
,
(
int
)
IMAGE
);
prod
.
setAttribute
(
"in"
,
"0"
);
prod
.
setAttribute
(
"out"
,
m_doc
->
getFramePos
(
KdenliveSettings
::
image_duration
()));
}
AddClipCommand
*
command
=
new
AddClipCommand
(
m_doc
,
prod
,
id
,
true
);
m_doc
->
commandStack
()
->
push
(
command
);
}
void
ClipManager
::
slotAddColorClipFile
(
const
QString
name
,
const
QString
color
,
QString
duration
,
const
QString
group
)
{
QDomDocument
doc
;
QDomElement
prod
=
doc
.
createElement
(
"producer"
);
prod
.
setAttribute
(
"mlt_service"
,
"colour"
);
prod
.
setAttribute
(
"colour"
,
color
);
prod
.
setAttribute
(
"type"
,
(
int
)
COLOR
);
uint
id
=
m_clipIdCounter
++
;
prod
.
setAttribute
(
"id"
,
QString
::
number
(
id
));
prod
.
setAttribute
(
"in"
,
"0"
);
prod
.
setAttribute
(
"out"
,
m_doc
->
getFramePos
(
duration
));
prod
.
setAttribute
(
"name"
,
name
);
AddClipCommand
*
command
=
new
AddClipCommand
(
m_doc
,
prod
,
id
,
true
);
m_doc
->
commandStack
()
->
push
(
command
);
}
src/clipmanager.h
0 → 100644
View file @
0a21eb6d
/***************************************************************************
* Copyright (C) 2008 by Jean-Baptiste Mardelle (jb@kdenlive.org) *
* *
* 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 CLIPMANAGER_H
#define CLIPMANAGER_H
/**ClipManager manages the list of clips in a document
*@author Jean-Baptiste Mardelle
*/
#include <qdom.h>
#include <QPixmap>
#include <QObject>
#include <KUrl>
#include <KUndoStack>
#include <klocale.h>
#include "gentime.h"
#include "definitions.h"
#include "docclipbase.h"
class
KdenliveDoc
;
class
ClipManager
:
public
QObject
{
Q_OBJECT
public
:
ClipManager
(
KdenliveDoc
*
doc
);
virtual
~
ClipManager
();
void
addClip
(
DocClipBase
*
clip
);
DocClipBase
*
getClipAt
(
int
pos
);
void
deleteClip
(
uint
clipId
);
void
slotAddClipFile
(
const
KUrl
url
,
const
QString
group
);
void
slotAddColorClipFile
(
const
QString
name
,
const
QString
color
,
QString
duration
,
const
QString
group
);
DocClipBase
*
getClipById
(
int
clipId
);
private:
// Private attributes
/** the list of clips in the document */
QList
<
DocClipBase
*>
m_clipList
;
/** the document undo stack*/
KdenliveDoc
*
m_doc
;
int
m_clipIdCounter
;
};
#endif
src/customtrackview.cpp
View file @
0a21eb6d
...
...
@@ -303,12 +303,28 @@ void CustomTrackView::mousePressEvent ( QMouseEvent * event )
void
CustomTrackView
::
dragEnterEvent
(
QDragEnterEvent
*
event
)
{
if
(
event
->
mimeData
()
->
hasText
())
{
QString
clip
=
event
->
mimeData
()
->
text
();
kDebug
()
<<
"/////////////// DRAG ENTERED, TEXT: "
<<
event
->
mimeData
()
->
text
();
QStringList
ids
=
QString
(
event
->
mimeData
()
->
text
()).
split
(
";"
);
//TODO: drop of several clips
for
(
int
i
=
0
;
i
<
ids
.
size
();
++
i
)
{
}
DocClipBase
*
clip
=
m_document
->
getBaseClip
(
ids
.
at
(
0
).
toInt
());
if
(
clip
==
NULL
)
kDebug
()
<<
" WARNING))))))))) CLIP NOT FOUND : "
<<
ids
.
at
(
0
).
toInt
();
addItem
(
clip
,
event
->
pos
());
event
->
acceptProposedAction
();
}
}
void
CustomTrackView
::
addItem
(
DocClipBase
*
clip
,
QPoint
pos
)
{
int
in
=
0
;
int
out
=
clip
->
duration
().
frames
(
m_document
->
fps
());
//kdDebug()<<"- - - -CREATING CLIP, duration = "<<out<<", URL: "<<clip->fileURL();
int
trackTop
=
((
int
)
mapToScene
(
pos
).
y
()
/
50
)
*
50
+
1
;
m_dropItem
=
new
ClipItem
(
clip
,
((
int
)
mapToScene
(
pos
).
y
()
/
50
),
in
,
QRectF
(
mapToScene
(
pos
).
x
()
*
m_scale
,
trackTop
,
out
*
m_scale
,
49
),
out
);
scene
()
->
addItem
(
m_dropItem
);
}
void
CustomTrackView
::
addItem
(
QString
producer
,
QPoint
pos
)
{
...
...
src/customtrackview.h
View file @
0a21eb6d
...
...
@@ -72,6 +72,7 @@ class CustomTrackView : public QGraphicsView
ClipItem
*
m_dropItem
;
KdenliveDoc
*
m_document
;
void
addItem
(
QString
producer
,
QPoint
pos
);
void
addItem
(
DocClipBase
*
clip
,
QPoint
pos
);
QGraphicsLineItem
*
m_cursorLine
;
QPointF
m_startPos
;
OPERATIONTYPE
m_operationMode
;
...
...
src/docclipbase.cpp
View file @
0a21eb6d
...
...
@@ -17,21 +17,52 @@
#include <KDebug>
#include "kdenlivesettings.h"
#include "docclipbase.h"
/*#include "docclipavfile.h"
#include "doccliptextfile.h"
#include "docclipproject.h"
#include "doctrackbase.h"*/
DocClipBase
::
DocClipBase
()
:
m_
description
(
""
),
m_refcount
(
0
),
m_projectThumbFrame
(
0
),
audioThumbCreated
(
false
)
DocClipBase
::
DocClipBase
(
QDomElement
xml
,
uint
id
)
:
m_
xml
(
xml
),
m_id
(
id
),
m_description
(
""
),
m_refcount
(
0
),
m_projectThumbFrame
(
0
),
audioThumbCreated
(
false
),
m_duration
(
GenTime
()),
m_thumbProd
(
NULL
)
{
//thumbCreator = 0;
int
type
=
xml
.
attribute
(
"type"
).
toInt
();
m_clipType
=
(
CLIPTYPE
)
type
;
m_name
=
xml
.
attribute
(
"name"
);
m_xml
.
setAttribute
(
"id"
,
QString
::
number
(
id
));
KUrl
url
=
KUrl
(
xml
.
attribute
(
"resource"
));
int
out
=
xml
.
attribute
(
"out"
).
toInt
();
if
(
out
!=
0
)
setDuration
(
GenTime
(
out
,
25
));
if
(
m_name
.
isEmpty
())
m_name
=
url
.
fileName
();
if
(
!
url
.
isEmpty
())
m_thumbProd
=
new
KThumb
(
url
,
KdenliveSettings
::
track_height
()
*
KdenliveSettings
::
project_display_ratio
(),
KdenliveSettings
::
track_height
());
}
DocClipBase
::
DocClipBase
(
const
DocClipBase
&
clip
)
{
m_xml
=
clip
.
toXML
();
m_id
=
clip
.
getId
();
m_clipType
=
clip
.
clipType
();
m_name
=
clip
.
name
();
m_duration
=
clip
.
duration
();
}
DocClipBase
&
DocClipBase
::
operator
=
(
const
DocClipBase
&
clip
)
{
DocClipBase
::
operator
=
(
clip
);
m_xml
=
clip
.
toXML
();
m_id
=
clip
.
getId
();
m_clipType
=
clip
.
clipType
();
m_name
=
clip
.
name
();
m_duration
=
clip
.
duration
();
return
*
this
;
}
DocClipBase
::~
DocClipBase
()
{
//delete thumbCreator;
//if (m_thumbProd) delete m_thumbProd;
}
KThumb
*
DocClipBase
::
thumbProducer
()
{
return
m_thumbProd
;
}
void
DocClipBase
::
setName
(
const
QString
name
)
...
...
@@ -41,6 +72,7 @@ void DocClipBase::setName(const QString name)
const
QString
&
DocClipBase
::
name
()
const
{
return
m_name
;
}
...
...
@@ -54,6 +86,23 @@ void DocClipBase::setId( const uint &newId)
m_id
=
newId
;
}
const
CLIPTYPE
&
DocClipBase
::
clipType
()
const
{
return
m_clipType
;
}
void
DocClipBase
::
setClipType
(
CLIPTYPE
type
)
{
m_clipType
=
type
;
}
const
KUrl
&
DocClipBase
::
fileURL
()
const
{
QString
res
=
m_xml
.
attribute
(
"resource"
);
if
(
m_clipType
!=
COLOR
&&
!
res
.
isEmpty
())
return
KUrl
(
res
);
return
KUrl
();
}
void
DocClipBase
::
setProjectThumbFrame
(
const
uint
&
ix
)
{
m_projectThumbFrame
=
ix
;
...
...
@@ -74,17 +123,34 @@ const QString & DocClipBase::description() const
return
m_description
;
}
void
DocClipBase
::
setDuration
(
GenTime
dur
)
{
m_duration
=
dur
;
}
const
GenTime
&
DocClipBase
::
duration
()
const
{
return
m_duration
;
}
bool
DocClipBase
::
hasFileSize
()
const
{
return
true
;
}
// virtual
QDom
Docu
ment
DocClipBase
::
toXML
()
const
QDom
Ele
ment
DocClipBase
::
toXML
()
const
{
/*
QDomDocument doc;
QDomElement clip = doc.createElement("kdenliveclip");
QDomText text = doc.createTextNode(description());
clip.appendChild(text);
doc.appendChild(clip);
return
doc
;
*/
return
m_xml
;
}
DocClipBase
*
DocClipBase
::
...
...
src/docclipbase.h
View file @
0a21eb6d
...
...
@@ -23,14 +23,15 @@
*/
#include <qdom.h>
#include <
qobject.h
>
#include <
qpixmap.h
>
#include <
QPixmap
>
#include <
QObject
>
#include <
kurl.h
>
#include <
KUrl
>
#include <klocale.h>
#include "gentime.h"
// #include "kthumb.h"
#include "definitions.h"
#include "kthumb.h"
/*
class DocTrackBase;
...
...
@@ -63,10 +64,10 @@ class DocClipBase:public QObject {
* - e.g. if you can have audio and video seperately, it should be possible to combin the two, as is
* done here. If a new clip type is added then it should be possible to combine it with both audio
* and video. */
enum
CLIPTYPE
{
NONE
=
0
,
AUDIO
=
1
,
VIDEO
=
2
,
AV
=
3
,
COLOR
=
4
,
IMAGE
=
5
,
TEXT
=
6
,
SLIDESHOW
=
7
,
VIRTUAL
=
8
,
PLAYLIST
=
9
};
DocClipBase
();
DocClipBase
(
QDomElement
xml
,
uint
id
);
DocClipBase
(
const
DocClipBase
&
clip
);
DocClipBase
&
operator
=
(
const
DocClipBase
&
clip
);
virtual
~
DocClipBase
();
/** sets the name of this clip. */
...
...
@@ -89,25 +90,29 @@ class DocClipBase:public QObject {
bool
audioThumbCreated
;
/** returns the duration of this clip */
virtual
const
GenTime
&
duration
()
const
=
0
;
const
GenTime
&
duration
()
const
;
/** returns the duration of this clip */
void
setDuration
(
GenTime
dur
);
/** returns clip type (audio, text, image,...) */
virtual
const
DocClipBase
::
CLIPTYPE
&
clipType
()
const
=
0
;
const
CLIPTYPE
&
clipType
()
const
;
/** set clip type (audio, text, image,...) */
void
setClipType
(
CLIPTYPE
type
);
/** remove tmp file if the clip has one (for example text clips) */
v
irtual
void
removeTmpFile
()
const
=
0
;
v
oid
removeTmpFile
()
const
;
/** Returns a url to a file describing this clip. Exactly what this url is,
whether it is temporary or not, and whether it provokes a render will
depend entirely on what the clip consists of. */
virtual
const
KUrl
&
fileURL
()
const
=
0
;
const
KUrl
&
fileURL
()
const
;
/** Returns true if the clip duration is known, false otherwise. */
virtual
bool
durationKnown
()
const
=
0
;
bool
durationKnown
()
const
;
// Returns the number of frames per second that this clip should play at.
virtual
double
framesPerSecond
()
const
=
0
;
double
framesPerSecond
()
const
;
virtual
bool
isDocClipAVFile
()
const
{
bool
isDocClipAVFile
()
const
{
return
false
;
}
...
...
@@ -133,7 +138,7 @@ class DocClipBase:public QObject {
/** Returns true if this clip is a project clip, false otherwise. Overridden in DocClipProject,
* where it returns true. */
virtual
bool
isProjectClip
()
const
{
bool
isProjectClip
()
const
{
return
false
;
}