Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Open sidebar
luyikei
VLMC
Commits
9461620f
Commit
9461620f
authored
Mar 13, 2010
by
Hugo Beauzee-Luyssen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Timeline: Project loading is functionnal again.
parent
0d987e7c
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
42 additions
and
75 deletions
+42
-75
src/Project/ProjectManager.cpp
src/Project/ProjectManager.cpp
+10
-9
src/Project/ProjectManager.h
src/Project/ProjectManager.h
+3
-1
src/Workflow/MainWorkflow.cpp
src/Workflow/MainWorkflow.cpp
+29
-65
No files found.
src/Project/ProjectManager.cpp
View file @
9461620f
...
...
@@ -133,10 +133,12 @@ void ProjectManager::cleanChanged( bool val )
void
ProjectManager
::
loadTimeline
()
{
// QDomElement root = m_domDocument->documentElement();
//
// MainWorkflow::getInstance()->loadProject( root.firstChildElement( "timeline" ) );
// emit projectUpdated( projectName(), true );
QDomElement
root
=
m_domDocument
->
documentElement
();
MainWorkflow
::
getInstance
()
->
loadProject
(
root
);
emit
projectUpdated
(
projectName
(),
true
);
// SettingsManager::getInstance()->load( root.firstChildElement( "project" ) );
delete
m_domDocument
;
}
void
ProjectManager
::
loadProject
(
const
QString
&
fileName
)
...
...
@@ -151,8 +153,8 @@ void ProjectManager::loadProject( const QString& fileName )
m_projectFile
->
open
(
QFile
::
ReadOnly
);
m_projectFile
->
close
();
QD
omDocument
doc
;
doc
.
setContent
(
m_projectFile
);
m_d
omDocument
=
new
QDomDocument
;
m_domDocument
->
setContent
(
m_projectFile
);
m_needSave
=
false
;
if
(
ProjectManager
::
isBackupFile
(
fileName
)
==
false
)
...
...
@@ -165,11 +167,10 @@ void ProjectManager::loadProject( const QString& fileName )
m_projectFile
=
NULL
;
}
QDomElement
root
=
doc
.
documentElement
();
QDomElement
root
=
m_domDocument
->
documentElement
();
//
connect( Library::getInstance(), SIGNAL( projectLoaded() ), this, SLOT( loadTimeline() ) );
connect
(
Library
::
getInstance
(),
SIGNAL
(
projectLoaded
()
),
this
,
SLOT
(
loadTimeline
()
)
);
Library
::
getInstance
()
->
loadProject
(
root
);
// SettingsManager::getInstance()->load( root.firstChildElement( "project" ) );
}
QString
ProjectManager
::
acquireProjectFileName
()
...
...
src/Project/ProjectManager.h
View file @
9461620f
...
...
@@ -30,7 +30,8 @@
#include "Singleton.hpp"
class
QFile
;
class
QFile
;
class
QDomDocument
;
class
ProjectManager
:
public
QObject
,
public
Singleton
<
ProjectManager
>
{
...
...
@@ -95,6 +96,7 @@ private:
QString
m_projectName
;
QString
m_projectDescription
;
QTimer
*
m_timer
;
QDomDocument
*
m_domDocument
;
friend
class
Singleton
<
ProjectManager
>
;
...
...
src/Workflow/MainWorkflow.cpp
View file @
9461620f
...
...
@@ -284,13 +284,11 @@ MainWorkflow::getClip( const QUuid &uuid, unsigned int trackId,
* \warning The mainworkflow is expected to be already cleared by the ProjectManager
*/
void
MainWorkflow
::
loadProject
(
const
QDomElement
&
p
ro
jec
t
)
MainWorkflow
::
loadProject
(
const
QDomElement
&
ro
o
t
)
{
if
(
project
.
isNull
()
==
true
||
project
.
tagName
()
!=
"timeline"
)
{
qWarning
()
<<
"Invalid timeline node ("
<<
project
.
tagName
()
<<
')'
;
QDomElement
project
=
root
.
firstChildElement
(
"timeline"
);
if
(
project
.
isNull
()
==
true
)
return
;
}
QDomElement
elem
=
project
.
firstChild
().
toElement
();
...
...
@@ -298,81 +296,47 @@ MainWorkflow::loadProject( const QDomElement &project )
{
bool
ok
;
Q_ASSERT
(
elem
.
tagName
()
==
"track"
);
unsigned
int
trackId
=
elem
.
attribute
(
"id"
).
toUInt
(
&
ok
);
if
(
ok
==
false
)
{
qWarning
()
<<
"Invalid track number in project file"
;
return
;
}
MainWorkflow
::
TrackType
type
;
int
utype
=
elem
.
attribute
(
"type"
).
toInt
(
&
ok
);
if
(
ok
==
false
||
(
utype
<
0
&&
utype
>=
MainWorkflow
::
NbTrackType
)
)
{
qWarning
()
<<
"Invalid track type"
;
return
;
}
type
=
static_cast
<
MainWorkflow
::
TrackType
>
(
utype
);
QDomElement
clip
=
elem
.
firstChild
().
toElement
();
while
(
clip
.
isNull
()
==
false
)
{
//Iterate over clip fields:
QDomElement
clipProperty
=
clip
.
firstChild
().
toElement
();
QUuid
parentUuid
;
qint64
begin
;
qint64
end
;
qint64
startPos
;
MainWorkflow
::
TrackType
trackType
=
MainWorkflow
::
VideoTrack
;
while
(
clipProperty
.
isNull
()
==
false
)
QString
uuid
;
QString
begin
;
QString
end
;
QString
startFrame
;
uuid
=
clip
.
attribute
(
"uuid"
);
begin
=
clip
.
attribute
(
"begin"
);
end
=
clip
.
attribute
(
"end"
);
startFrame
=
clip
.
attribute
(
"startFrame"
);
if
(
uuid
.
isEmpty
()
==
true
||
startFrame
.
isEmpty
()
==
true
)
{
QString
tagName
=
clipProperty
.
tagName
();
bool
ok
;
if
(
tagName
==
"parent"
)
parentUuid
=
QUuid
(
clipProperty
.
text
()
);
else
if
(
tagName
==
"begin"
)
{
begin
=
clipProperty
.
text
().
toLongLong
(
&
ok
);
if
(
ok
==
false
)
{
qWarning
()
<<
"Invalid clip begin"
;
return
;
}
}
else
if
(
tagName
==
"end"
)
{
end
=
clipProperty
.
text
().
toLongLong
(
&
ok
);
if
(
ok
==
false
)
{
qWarning
()
<<
"Invalid clip end"
;
return
;
}
}
else
if
(
tagName
==
"startFrame"
)
{
startPos
=
clipProperty
.
text
().
toLongLong
(
&
ok
);
if
(
ok
==
false
)
{
qWarning
()
<<
"Invalid clip starting frame"
;
return
;
}
}
else
if
(
tagName
==
"trackType"
)
{
trackType
=
static_cast
<
MainWorkflow
::
TrackType
>
(
clipProperty
.
text
().
toUInt
(
&
ok
)
);
if
(
ok
==
false
)
{
qWarning
()
<<
"Invalid track type starting frame"
;
return
;
}
}
else
qDebug
()
<<
"Unknown field"
<<
clipProperty
.
tagName
();
clipProperty
=
clipProperty
.
nextSibling
().
toElement
();
qWarning
()
<<
"Invalid clip node"
;
return
;
}
if
(
Library
::
getInstance
()
->
clip
(
parentUuid
)
!=
NULL
)
Clip
*
c
=
Library
::
getInstance
()
->
clip
(
uuid
);
if
(
c
!=
NULL
)
{
Clip
*
c
=
new
Clip
(
Library
::
getInstance
()
->
clip
(
parentUuid
),
begin
,
end
,
parentUuid
.
toString
()
);
addClip
(
c
,
trackId
,
startPos
,
trackType
);
addClip
(
new
Clip
(
c
,
begin
.
toLongLong
(),
end
.
toLongLong
()
),
trackId
,
startFrame
.
toLongLong
(),
type
);
}
clip
=
clip
.
nextSibling
().
toElement
();
}
elem
=
elem
.
nextSibling
().
toElement
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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