Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
VideoLAN
VLMC
Commits
2a92b898
Commit
2a92b898
authored
Sep 10, 2009
by
Hugo Beauzee-Luyssen
Browse files
Forgotten files
parent
19bbe9e9
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/Project/ProjectManager.cpp
0 → 100644
View file @
2a92b898
/*****************************************************************************
* ProjectManager.cpp: Manager the project loading and saving.
*****************************************************************************
* Copyright (C) 2008-2009 the VLMC team
*
* Authors: Hugo Beauzee-Luyssen <hugo@vlmc.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
"ProjectManager.h"
#include
"Library.h"
#include
"MainWorkflow.h"
ProjectManager
::
ProjectManager
(
const
QString
&
filePath
)
{
m_projectFile
=
new
QFile
(
filePath
);
}
ProjectManager
::~
ProjectManager
()
{
delete
m_projectFile
;
}
void
ProjectManager
::
loadTimeline
()
{
QDomElement
root
=
m_domDocument
->
documentElement
();
MainWorkflow
::
getInstance
()
->
loadProject
(
root
.
firstChildElement
(
"timeline"
)
);
deleteLater
();
}
void
ProjectManager
::
loadProject
()
{
m_domDocument
=
new
QDomDocument
;
m_projectFile
->
open
(
QFile
::
ReadOnly
);
m_domDocument
->
setContent
(
m_projectFile
);
m_projectFile
->
close
();
QDomElement
root
=
m_domDocument
->
documentElement
();
connect
(
Library
::
getInstance
(),
SIGNAL
(
projectLoaded
()
),
this
,
SLOT
(
loadTimeline
()
)
);
Library
::
getInstance
()
->
loadProject
(
root
.
firstChildElement
(
"medias"
)
);
}
void
ProjectManager
::
saveProject
()
{
QDomImplementation
implem
=
QDomDocument
().
implementation
();
//FIXME: Think about naming the project...
QString
name
=
"VLMCProject"
;
QString
publicId
=
"-//XADECK//DTD Stone 1.0 //EN"
;
QString
systemId
=
"http://www-imagis.imag.fr/DTD/stone1.dtd"
;
QDomDocument
doc
(
implem
.
createDocumentType
(
name
,
publicId
,
systemId
)
);
QDomElement
rootNode
=
doc
.
createElement
(
"vlmc"
);
Library
::
getInstance
()
->
saveProject
(
doc
,
rootNode
);
MainWorkflow
::
getInstance
()
->
saveProject
(
doc
,
rootNode
);
doc
.
appendChild
(
rootNode
);
m_projectFile
->
open
(
QFile
::
WriteOnly
);
m_projectFile
->
write
(
doc
.
toString
().
toAscii
()
);
m_projectFile
->
close
();
deleteLater
();
}
src/Project/ProjectManager.h
0 → 100644
View file @
2a92b898
/*****************************************************************************
* ProjectManager.h: Manager the project loading and saving.
*****************************************************************************
* Copyright (C) 2008-2009 the VLMC team
*
* Authors: Hugo Beauzee-Luyssen <hugo@vlmc.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 PROJECTMANAGER_H
#define PROJECTMANAGER_H
#include
<QFile>
#include
<QObject>
#include
<QDomDocument>
class
ProjectManager
:
public
QObject
{
Q_OBJECT
Q_DISABLE_COPY
(
ProjectManager
);
public:
ProjectManager
(
const
QString
&
filePath
);
~
ProjectManager
();
void
loadProject
();
void
saveProject
();
private:
QFile
*
m_projectFile
;
QDomDocument
*
m_domDocument
;
private
slots
:
void
loadTimeline
();
};
#endif // PROJECTMANAGER_H
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