Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Multimedia
Kdenlive
Commits
1cc0db05
Commit
1cc0db05
authored
May 15, 2018
by
Jean-Baptiste Mardelle
Browse files
Save & restore active and target tracks
Fix ruler & timeline position sometimes broken on project opening
parent
f1276ca0
Changes
9
Hide whitespace changes
Inline
Side-by-side
src/bin/bin.cpp
View file @
1cc0db05
...
...
@@ -1119,10 +1119,6 @@ int Bin::lastClipId() const
void
Bin
::
setDocument
(
KdenliveDoc
*
project
)
{
// Remove clip from Bin's monitor
if
(
m_doc
)
{
emit
openClip
(
std
::
shared_ptr
<
ProjectClip
>
());
}
m_infoMessage
->
hide
();
blockSignals
(
true
);
m_proxyModel
->
selectionModel
()
->
blockSignals
(
true
);
...
...
src/doc/kdenlivedoc.cpp
View file @
1cc0db05
...
...
@@ -108,6 +108,9 @@ KdenliveDoc::KdenliveDoc(const QUrl &url, const QString &projectFolder, QUndoGro
m_documentProperties
[
QStringLiteral
(
"proxyimagesize"
)]
=
QString
::
number
(
KdenliveSettings
::
proxyimagesize
());
m_documentProperties
[
QStringLiteral
(
"resizepreview"
)]
=
QString
::
number
((
int
)
KdenliveSettings
::
resizepreview
());
m_documentProperties
[
QStringLiteral
(
"previewheight"
)]
=
QString
::
number
(
KdenliveSettings
::
previewheight
());
m_documentProperties
[
QStringLiteral
(
"videoTarget"
)]
=
QString
::
number
(
tracks
.
y
());
m_documentProperties
[
QStringLiteral
(
"audioTarget"
)]
=
QString
::
number
(
tracks
.
y
()
-
1
);
m_documentProperties
[
QStringLiteral
(
"activeTrack"
)]
=
QString
::
number
(
tracks
.
y
());
// Load properties
QMapIterator
<
QString
,
QString
>
i
(
properties
);
...
...
@@ -454,6 +457,11 @@ QPoint KdenliveDoc::zone() const
return
QPoint
(
m_documentProperties
.
value
(
QStringLiteral
(
"zonein"
)).
toInt
(),
m_documentProperties
.
value
(
QStringLiteral
(
"zoneout"
)).
toInt
());
}
QPair
<
int
,
int
>
KdenliveDoc
::
targetTracks
()
const
{
return
{
m_documentProperties
.
value
(
QStringLiteral
(
"videoTarget"
)).
toInt
(),
m_documentProperties
.
value
(
QStringLiteral
(
"audioTarget"
)).
toInt
()};
}
QDomDocument
KdenliveDoc
::
xmlSceneList
(
const
QString
&
scene
)
{
QDomDocument
sceneList
;
...
...
@@ -1208,8 +1216,7 @@ QMap<QString, QString> KdenliveDoc::documentProperties()
m_documentProperties
.
insert
(
QStringLiteral
(
"storagefolder"
),
m_projectFolder
+
QLatin1Char
(
'/'
)
+
m_documentProperties
.
value
(
QStringLiteral
(
"documentid"
)));
}
m_documentProperties
.
insert
(
QStringLiteral
(
"profile"
),
pCore
->
getCurrentProfile
()
->
path
());
m_documentProperties
.
insert
(
QStringLiteral
(
"position"
),
QString
::
number
(
pCore
->
monitorManager
()
->
projectMonitor
()
->
position
()));
m_documentProperties
.
insert
(
QStringLiteral
(
"profile"
),
pCore
->
getCurrentProfile
()
->
path
());;
if
(
!
m_documentProperties
.
contains
(
QStringLiteral
(
"decimalPoint"
)))
{
m_documentProperties
.
insert
(
QStringLiteral
(
"decimalPoint"
),
QLocale
().
decimalPoint
());
}
...
...
src/doc/kdenlivedoc.h
View file @
1cc0db05
...
...
@@ -105,6 +105,8 @@ public:
void
setProjectFolder
(
const
QUrl
&
url
);
void
setZone
(
int
start
,
int
end
);
QPoint
zone
()
const
;
/** @brief Returns target tracks (video, audio). */
QPair
<
int
,
int
>
targetTracks
()
const
;
void
setDocumentProperty
(
const
QString
&
name
,
const
QString
&
value
);
const
QString
getDocumentProperty
(
const
QString
&
name
,
const
QString
&
defaultValue
=
QString
())
const
;
...
...
src/monitor/glwidget.cpp
View file @
1cc0db05
...
...
@@ -864,6 +864,7 @@ int GLWidget::setProducer(Mlt::Producer *producer, bool isActive, int position)
m_producer
->
set_speed
(
0
);
if
(
m_consumer
)
{
consumerPosition
=
m_consumer
->
position
();
m_consumer
->
stop
();
if
(
!
m_consumer
->
is_stopped
())
{
m_consumer
->
stop
();
}
...
...
src/project/projectmanager.cpp
View file @
1cc0db05
...
...
@@ -217,6 +217,7 @@ void ProjectManager::newFile(bool showProjectSettings, bool force)
pCore->window()->slotPreferences(6);
return;
}*/
pCore
->
monitorManager
()
->
activateMonitor
(
Kdenlive
::
ProjectMonitor
);
pCore
->
window
()
->
connectDocument
();
bool
disabled
=
m_project
->
getDocumentProperty
(
QStringLiteral
(
"disabletimelineeffects"
))
==
QLatin1String
(
"1"
);
QAction
*
disableEffects
=
pCore
->
window
()
->
actionCollection
()
->
action
(
QStringLiteral
(
"disable_timeline_effects"
));
...
...
@@ -228,10 +229,7 @@ void ProjectManager::newFile(bool showProjectSettings, bool force)
}
}
emit
docOpened
(
m_project
);
// pCore->monitorManager()->activateMonitor(Kdenlive::ClipMonitor);
m_lastSave
.
start
();
pCore
->
monitorManager
()
->
activateMonitor
(
Kdenlive
::
ClipMonitor
);
pCore
->
getMonitor
(
Kdenlive
::
ClipMonitor
)
->
start
();
}
bool
ProjectManager
::
closeCurrentDocument
(
bool
saveChanges
,
bool
quit
)
...
...
@@ -514,6 +512,7 @@ void ProjectManager::doOpenFile(const QUrl &url, KAutoSaveFile *stale)
delete
m_progressDialog
;
pCore
->
monitorManager
()
->
resetDisplay
();
pCore
->
monitorManager
()
->
activateMonitor
(
Kdenlive
::
ProjectMonitor
);
m_progressDialog
=
new
QProgressDialog
(
pCore
->
window
());
m_progressDialog
->
setWindowTitle
(
i18n
(
"Loading project"
));
m_progressDialog
->
setCancelButton
(
nullptr
);
...
...
@@ -549,31 +548,11 @@ void ProjectManager::doOpenFile(const QUrl &url, KAutoSaveFile *stale)
rulerActions
<<
pCore
->
window
()
->
actionCollection
()
->
action
(
QStringLiteral
(
"set_render_timeline_zone"
));
rulerActions
<<
pCore
->
window
()
->
actionCollection
()
->
action
(
QStringLiteral
(
"unset_render_timeline_zone"
));
rulerActions
<<
pCore
->
window
()
->
actionCollection
()
->
action
(
QStringLiteral
(
"clear_render_timeline_zone"
));
/*bool ok;
m_trackView = new Timeline(doc, pCore->window()->kdenliveCategoryMap.value(QStringLiteral("timeline"))->actions(), rulerActions, &ok, pCore->window());
connect(m_trackView, &Timeline::startLoadingBin, m_progressDialog, &QProgressDialog::setMaximum, Qt::DirectConnection);
connect(m_trackView, &Timeline::resetUsageCount, pCore->bin(), &Bin::resetUsageCount, Qt::DirectConnection);
connect(m_trackView, &Timeline::loadingBin, m_progressDialog, &QProgressDialog::setValue, Qt::DirectConnection);*/
// Set default target tracks to upper audio / lower video tracks
m_project
=
doc
;
/*m_trackView->audioTarget = doc->getDocumentProperty(QStringLiteral("audiotargettrack"), QStringLiteral("-1")).toInt();
m_trackView->videoTarget = doc->getDocumentProperty(QStringLiteral("videotargettrack"), QStringLiteral("-1")).toInt();
m_trackView->loadTimeline();
m_trackView->loadGuides(pCore->binController()->takeGuidesData());
connect(m_trackView->projectView(), SIGNAL(importPlaylistClips(ItemInfo, QString, QUndoCommand *)), pCore->bin(), SLOT(slotExpandUrl(ItemInfo, QString,
QUndoCommand *)), Qt::DirectConnection);
bool disabled = m_project->getDocumentProperty(QStringLiteral("disabletimelineeffects")) == QLatin1String("1");
QAction *disableEffects = pCore->window()->actionCollection()->action(QStringLiteral("disable_timeline_effects"));
if (disableEffects) {
if (disabled != disableEffects->isChecked()) {
disableEffects->blockSignals(true);
disableEffects->setChecked(disabled);
disableEffects->blockSignals(false);
}
}*/
updateTimeline
(
m_project
->
getDocumentProperty
(
"position"
).
toInt
());
updateTimeline
(
m_project
->
getDocumentProperty
(
QStringLiteral
(
"position"
)
)
.
toInt
());
pCore
->
window
()
->
connectDocument
();
QDateTime
documentDate
=
QFileInfo
(
m_project
->
url
().
toLocalFile
()).
lastModified
();
pCore
->
window
()
->
getMainTimeline
()
->
controller
()
->
loadPreview
(
m_project
->
getDocumentProperty
(
QStringLiteral
(
"previewchunks"
)),
...
...
@@ -582,17 +561,6 @@ void ProjectManager::doOpenFile(const QUrl &url, KAutoSaveFile *stale)
emit
docOpened
(
m_project
);
/*pCore->window()->m_timelineArea->setCurrentIndex(pCore->window()->m_timelineArea->addTab(m_trackView, QIcon::fromTheme(QStringLiteral("kdenlive")),
m_project->description()));
if (!ok) {
pCore->window()->m_timelineArea->setEnabled(false);
KMessageBox::sorry(pCore->window(), i18n("Cannot open file %1.\nProject is corrupted.", url.toLocalFile()));
pCore->window()->slotGotProgressInfo(QString(), 100);
newFile(false, true);
return;
}
m_trackView->setDuration(m_trackView->duration());*/
pCore
->
window
()
->
slotGotProgressInfo
(
QString
(),
100
);
if
(
openBackup
)
{
slotOpenBackup
(
url
);
...
...
@@ -600,8 +568,6 @@ void ProjectManager::doOpenFile(const QUrl &url, KAutoSaveFile *stale)
m_lastSave
.
start
();
delete
m_progressDialog
;
m_progressDialog
=
nullptr
;
pCore
->
monitorManager
()
->
activateMonitor
(
Kdenlive
::
ProjectMonitor
);
pCore
->
getMonitor
(
Kdenlive
::
ClipMonitor
)
->
start
();
}
void
ProjectManager
::
slotRevert
()
...
...
@@ -873,6 +839,11 @@ void ProjectManager::updateTimeline(int pos)
pCore
->
window
()
->
getMainTimeline
()
->
setModel
(
m_mainTimelineModel
);
pCore
->
monitorManager
()
->
projectMonitor
()
->
adjustRulerSize
(
m_mainTimelineModel
->
duration
()
-
1
,
m_project
->
getGuideModel
());
pCore
->
window
()
->
getMainTimeline
()
->
controller
()
->
setZone
(
m_project
->
zone
());
pCore
->
window
()
->
getMainTimeline
()
->
controller
()
->
setTargetTracks
(
m_project
->
targetTracks
());
int
activeTrackPosition
=
m_project
->
getDocumentProperty
(
QStringLiteral
(
"activeTrack"
)).
toInt
();
if
(
activeTrackPosition
>
-
1
)
{
pCore
->
window
()
->
getMainTimeline
()
->
controller
()
->
setActiveTrack
(
m_mainTimelineModel
->
getTrackIndexFromPosition
(
activeTrackPosition
));
}
m_mainTimelineModel
->
setUndoStack
(
m_project
->
commandStack
());
}
...
...
src/timeline2/view/qml/timeline.qml
View file @
1cc0db05
...
...
@@ -715,6 +715,8 @@ Rectangle {
clip
:
true
Ruler
{
id
:
ruler
y
:
0
x
:
0
width
:
Math
.
max
(
root
.
width
-
headerWidth
,
timeline
.
duration
*
timeScale
+
root
.
projectMargin
)
Rectangle
{
id
:
seekCursor
...
...
src/timeline2/view/timelinecontroller.cpp
View file @
1cc0db05
...
...
@@ -83,6 +83,13 @@ void TimelineController::setModel(std::shared_ptr<TimelineItemModel> model)
connect
(
m_model
.
get
(),
&
TimelineModel
::
durationUpdated
,
this
,
&
TimelineController
::
checkDuration
);
}
void
TimelineController
::
setTargetTracks
(
QPair
<
int
,
int
>
targets
)
{
setVideoTarget
(
targets
.
first
>=
0
?
m_model
->
getTrackIndexFromPosition
(
targets
.
first
)
:
-
1
);
setAudioTarget
(
targets
.
second
>=
0
?
m_model
->
getTrackIndexFromPosition
(
targets
.
second
)
:
-
1
);
}
std
::
shared_ptr
<
TimelineItemModel
>
TimelineController
::
getModel
()
const
{
return
m_model
;
...
...
@@ -1240,9 +1247,13 @@ void TimelineController::loadPreview(QString chunks, QString dirty, const QDateT
QMap
<
QString
,
QString
>
TimelineController
::
documentProperties
()
{
QMap
<
QString
,
QString
>
props
=
pCore
->
currentDoc
()
->
documentProperties
();
// TODO
// props.insert(QStringLiteral("audiotargettrack"), QString::number(audioTarget));
// props.insert(QStringLiteral("videotargettrack"), QString::number(videoTarget));
int
audioTarget
=
m_model
->
m_audioTarget
==
-
1
?
-
1
:
m_model
->
getTrackPosition
(
m_model
->
m_audioTarget
);
int
videoTarget
=
m_model
->
m_videoTarget
==
-
1
?
-
1
:
m_model
->
getTrackPosition
(
m_model
->
m_videoTarget
);
int
activeTrack
=
m_activeTrack
==
-
1
?
-
1
:
m_model
->
getTrackPosition
(
m_activeTrack
);
props
.
insert
(
QStringLiteral
(
"audioTarget"
),
QString
::
number
(
audioTarget
));
props
.
insert
(
QStringLiteral
(
"videoTarget"
),
QString
::
number
(
videoTarget
));
props
.
insert
(
QStringLiteral
(
"activeTrack"
),
QString
::
number
(
activeTrack
));
props
.
insert
(
QStringLiteral
(
"position"
),
QString
::
number
(
timelinePosition
()));
if
(
m_timelinePreview
)
{
QPair
<
QStringList
,
QStringList
>
chunks
=
m_timelinePreview
->
previewChunks
();
props
.
insert
(
QStringLiteral
(
"previewchunks"
),
chunks
.
first
.
join
(
QLatin1Char
(
','
)));
...
...
src/timeline2/view/timelinecontroller.h
View file @
1cc0db05
...
...
@@ -362,6 +362,8 @@ public:
void
resetPreview
();
/** @brief Select the clip in active track under cursor */
void
selectCurrentItem
(
ObjectType
type
,
bool
select
,
bool
addToCurrent
=
false
);
/** @brief Set target tracks (video, audio) */
void
setTargetTracks
(
QPair
<
int
,
int
>
targets
);
public
slots
:
void
selectMultitrack
();
...
...
src/timeline2/view/timelinewidget.cpp
View file @
1cc0db05
...
...
@@ -92,8 +92,8 @@ void TimelineWidget::setModel(std::shared_ptr<TimelineItemModel> model)
m_proxy
->
setRoot
(
rootObject
());
setVisible
(
true
);
loading
=
false
;
m_proxy
->
setActiveTrack
(
model
->
getFirstVideoTrackIndex
());
m_proxy
->
checkDuration
();
m_proxy
->
positionChanged
();
}
void
TimelineWidget
::
mousePressEvent
(
QMouseEvent
*
event
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment