Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Open sidebar
VideoLAN
VLMC
Commits
c34d8b9c
Commit
c34d8b9c
authored
Dec 04, 2009
by
Hugo Beauzee-Luyssen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Project can now be loaded once, and overwritten afterward.
parent
3a1bccaa
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
57 additions
and
47 deletions
+57
-47
src/GUI/MainWindow.cpp
src/GUI/MainWindow.cpp
+2
-29
src/GUI/UndoStack.cpp
src/GUI/UndoStack.cpp
+1
-0
src/GUI/UndoStack.h
src/GUI/UndoStack.h
+4
-0
src/GUI/wizard/ProjectWizard.cpp
src/GUI/wizard/ProjectWizard.cpp
+1
-10
src/Project/ProjectManager.cpp
src/Project/ProjectManager.cpp
+38
-4
src/Project/ProjectManager.h
src/Project/ProjectManager.h
+11
-4
No files found.
src/GUI/MainWindow.cpp
View file @
c34d8b9c
...
...
@@ -138,39 +138,12 @@ void MainWindow::setupLibrary()
void
MainWindow
::
on_actionSave_triggered
()
{
QString
outputFileName
=
QFileDialog
::
getSaveFileName
(
NULL
,
"Enter the output file name"
,
QString
(),
"VLMC project file(*.vlmc)"
);
if
(
outputFileName
.
length
()
==
0
)
return
;
else
{
//Project manager will destroy itself.
QStringList
list
=
outputFileName
.
split
(
"."
);
if
(
list
.
at
(
list
.
size
()
-
1
)
!=
"vlmc"
)
{
list
.
append
(
"vlmc"
);
outputFileName
=
list
.
join
(
"."
);
}
ProjectManager
*
pm
=
new
ProjectManager
(
outputFileName
);
pm
->
saveProject
();
}
ProjectManager
::
getInstance
()
->
saveProject
();
}
void
MainWindow
::
on_actionLoad_Project_triggered
()
{
QString
outputFileName
=
QFileDialog
::
getOpenFileName
(
NULL
,
"Enter the output file name"
,
QString
(),
"VLMC project file(*.vlmc)"
);
if
(
outputFileName
.
length
()
==
0
)
return
;
else
{
//Project manager will destroy itself.
ProjectManager
*
pm
=
new
ProjectManager
(
outputFileName
);
pm
->
loadProject
();
}
ProjectManager
::
getInstance
()
->
loadProject
();
}
void
MainWindow
::
createStatusBar
()
...
...
src/GUI/UndoStack.cpp
View file @
c34d8b9c
...
...
@@ -28,6 +28,7 @@ UndoStack::UndoStack( QWidget* parent ) : QUndoView( parent )
m_undoStack
=
new
QUndoStack
(
this
);
setStack
(
m_undoStack
);
connect
(
m_undoStack
,
SIGNAL
(
cleanChanged
(
bool
)
),
this
,
SIGNAL
(
cleanChanged
()
)
);
m_undoShortcut
=
new
QShortcut
(
QKeySequence
(
tr
(
"Ctrl+z"
,
"Undo"
)
),
this
);
m_redoShortcut
=
new
QShortcut
(
QKeySequence
(
tr
(
"Ctrl+Shift+z"
,
"Redo"
)
),
this
);
...
...
src/GUI/UndoStack.h
View file @
c34d8b9c
...
...
@@ -43,6 +43,10 @@ class UndoStack : public QUndoView, public QSingleton<UndoStack>
QUndoStack
*
m_undoStack
;
QShortcut
*
m_undoShortcut
;
QShortcut
*
m_redoShortcut
;
signals:
void
cleanChanged
();
friend
class
QSingleton
<
UndoStack
>
;
};
...
...
src/GUI/wizard/ProjectWizard.cpp
View file @
c34d8b9c
...
...
@@ -69,16 +69,7 @@ void ProjectWizard::reject()
void
ProjectWizard
::
loadProject
()
{
QString
outputFileName
=
QFileDialog
::
getOpenFileName
(
NULL
,
"Enter the output file name"
,
QString
(),
"VLMC project file(*.vlmc)"
);
if
(
outputFileName
.
length
()
==
0
)
return
;
else
{
ProjectManager
*
pm
=
new
ProjectManager
(
outputFileName
);
pm
->
loadProject
();
}
ProjectManager
::
getInstance
()
->
loadProject
();
restart
();
QDialog
::
accept
();
}
src/Project/ProjectManager.cpp
View file @
c34d8b9c
...
...
@@ -20,29 +20,33 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#include <QFileDialog>
#include "ProjectManager.h"
#include "Library.h"
#include "MainWorkflow.h"
#include "SettingsManager.h"
ProjectManager
::
ProjectManager
(
const
QString
&
filePath
)
ProjectManager
::
ProjectManager
(
)
:
m_projectFile
(
NULL
)
{
m_projectFile
=
new
QFile
(
filePath
,
this
);
}
ProjectManager
::~
ProjectManager
()
{
if
(
m_projectFile
!=
NULL
)
delete
m_projectFile
;
}
void
ProjectManager
::
loadTimeline
()
{
QDomElement
root
=
m_domDocument
->
documentElement
();
MainWorkflow
::
getInstance
()
->
loadProject
(
root
.
firstChildElement
(
"timeline"
)
);
deleteLater
();
}
void
ProjectManager
::
loadProject
()
{
if
(
loadProjectFile
()
==
false
)
return
;
m_domDocument
=
new
QDomDocument
;
m_projectFile
->
open
(
QFile
::
ReadOnly
);
m_domDocument
->
setContent
(
m_projectFile
);
...
...
@@ -55,8 +59,39 @@ void ProjectManager::loadProject()
SettingsManager
::
getInstance
()
->
loadSettings
(
"project"
,
root
.
firstChildElement
(
"project"
)
);
}
bool
ProjectManager
::
loadProjectFile
()
{
QString
fileName
=
QFileDialog
::
getOpenFileName
(
NULL
,
"Enter the output file name"
,
QString
(),
"VLMC project file(*.vlmc)"
);
if
(
fileName
.
length
()
==
0
)
return
false
;
if
(
m_projectFile
!=
NULL
)
delete
m_projectFile
;
m_projectFile
=
new
QFile
(
fileName
);
return
true
;
}
bool
ProjectManager
::
checkProjectOpen
()
{
if
(
m_projectFile
==
NULL
)
{
QString
outputFileName
=
QFileDialog
::
getSaveFileName
(
NULL
,
"Enter the output file name"
,
QString
(),
"VLMC project file(*.vlmc)"
);
if
(
outputFileName
.
length
()
==
0
)
return
false
;
if
(
m_projectFile
!=
NULL
)
delete
m_projectFile
;
m_projectFile
=
new
QFile
(
outputFileName
);
}
return
true
;
}
void
ProjectManager
::
saveProject
()
{
if
(
checkProjectOpen
()
==
false
)
return
;
QDomImplementation
implem
=
QDomDocument
().
implementation
();
//FIXME: Think about naming the project...
QString
name
=
"VLMCProject"
;
...
...
@@ -75,5 +110,4 @@ void ProjectManager::saveProject()
m_projectFile
->
open
(
QFile
::
WriteOnly
);
m_projectFile
->
write
(
doc
.
toString
().
toAscii
()
);
m_projectFile
->
close
();
deleteLater
();
}
src/Project/ProjectManager.h
View file @
c34d8b9c
...
...
@@ -27,21 +27,28 @@
#include <QObject>
#include <QDomDocument>
class
ProjectManager
:
public
QObject
#include "Singleton.hpp"
class
ProjectManager
:
public
QObject
,
public
Singleton
<
ProjectManager
>
{
Q_OBJECT
Q_DISABLE_COPY
(
ProjectManager
);
public:
ProjectManager
(
const
QString
&
filePath
);
~
ProjectManager
();
void
loadProject
();
void
saveProject
();
private:
ProjectManager
();
~
ProjectManager
();
bool
checkProjectOpen
();
bool
loadProjectFile
();
private:
QFile
*
m_projectFile
;
QDomDocument
*
m_domDocument
;
friend
class
Singleton
<
ProjectManager
>
;
private
slots
:
void
loadTimeline
();
...
...
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