Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
VLMC
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
21
Issues
21
List
Boards
Labels
Service Desk
Milestones
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
VideoLAN
VLMC
Commits
96a69981
Commit
96a69981
authored
Jun 23, 2010
by
Hugo Beauzée-Luyssen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ProjectManager: Handle change of workspace when saving as.
The Workspace part isn't fully fonctionnal yet.
parent
0cd238f3
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
79 additions
and
12 deletions
+79
-12
src/Gui/project/GuiProjectManager.cpp
src/Gui/project/GuiProjectManager.cpp
+37
-5
src/Gui/project/GuiProjectManager.h
src/Gui/project/GuiProjectManager.h
+1
-0
src/Library/Library.h
src/Library/Library.h
+1
-0
src/Project/Workspace.cpp
src/Project/Workspace.cpp
+29
-3
src/Project/Workspace.h
src/Project/Workspace.h
+11
-4
No files found.
src/Gui/project/GuiProjectManager.cpp
View file @
96a69981
...
...
@@ -22,15 +22,16 @@
#include "GuiProjectManager.h"
#include <QDateTime>
#include <QFileDialog>
#include <QMessageBox>
#include <QTimer>
#include "Library.h"
#include "MainWorkflow.h"
#include "SettingsManager.h"
#include "Timeline.h"
#include "Workspace.h"
#include <QDateTime>
#include <QFileDialog>
#include <QMessageBox>
#include <QTimer>
GUIProjectManager
::
GUIProjectManager
()
{
...
...
@@ -90,23 +91,54 @@ GUIProjectManager::askForSaveIfModified()
return
true
;
}
bool
GUIProjectManager
::
confirmRelocate
()
const
{
QMessageBox
msgBox
;
msgBox
.
setText
(
tr
(
"You are about to relocate the project. Every video will be copied to your new workspace."
)
);
msgBox
.
setInformativeText
(
tr
(
"Do you want to proceed?"
)
);
msgBox
.
setStandardButtons
(
QMessageBox
::
Ok
|
QMessageBox
::
No
);
msgBox
.
setDefaultButton
(
QMessageBox
::
Ok
);
int
ret
=
msgBox
.
exec
();
switch
(
ret
)
{
case
QMessageBox
::
Ok
:
return
true
;
case
QMessageBox
::
No
:
return
false
;
default:
return
false
;
}
}
bool
GUIProjectManager
::
createNewProjectFile
(
bool
saveAs
)
{
if
(
m_projectFile
==
NULL
||
saveAs
==
true
)
{
bool
relocate
=
false
;
QString
outputFileName
=
QFileDialog
::
getSaveFileName
(
NULL
,
"Enter the output file name"
,
VLMC_PROJECT_GET_STRING
(
"general/Workspace"
),
"VLMC project file(*.vlmc)"
);
if
(
outputFileName
.
length
()
==
0
)
return
false
;
if
(
Workspace
::
isInProjectDir
(
outputFileName
)
==
false
)
{
if
(
confirmRelocate
()
==
false
)
return
false
;
relocate
=
true
;
}
if
(
m_projectFile
!=
NULL
)
delete
m_projectFile
;
if
(
outputFileName
.
endsWith
(
".vlmc"
)
==
false
)
outputFileName
+=
".vlmc"
;
m_projectFile
=
new
QFile
(
outputFileName
);
appendToRecentProject
(
outputFileName
);
if
(
relocate
==
true
)
Workspace
::
getInstance
()
->
copyAllToWorkspace
();
emit
projectUpdated
(
projectName
(),
true
);
}
return
true
;
...
...
src/Gui/project/GuiProjectManager.h
View file @
96a69981
...
...
@@ -72,6 +72,7 @@ protected:
private:
bool
createNewProjectFile
(
bool
saveAs
);
bool
confirmRelocate
()
const
;
private:
QTimer
*
m_timer
;
...
...
src/Library/Library.h
View file @
96a69981
...
...
@@ -78,6 +78,7 @@ signals:
void
projectLoaded
();
friend
class
Singleton
<
Library
>
;
friend
class
Workspace
;
};
#endif // LIBRARY_H
src/Project/Workspace.cpp
View file @
96a69981
...
...
@@ -71,11 +71,25 @@ Workspace::copyTerminated( Media *media, QString dest )
}
bool
Workspace
::
isInProjectDir
(
const
Media
*
media
)
Workspace
::
isInProjectDir
(
const
QFileInfo
&
fInfo
)
{
const
QString
projectDir
=
VLMC_PROJECT_GET_STRING
(
"general/ProjectDir"
);
const
QString
projectDir
=
VLMC_PROJECT_GET_STRING
(
"general/ProjectDir"
);
return
(
fInfo
.
absolutePath
().
startsWith
(
projectDir
)
);
}
bool
Workspace
::
isInProjectDir
(
const
QString
&
path
)
{
QFileInfo
fInfo
(
path
);
return
isInProjectDir
(
fInfo
);
}
return
(
media
->
fileInfo
()
->
absoluteFilePath
().
startsWith
(
projectDir
)
);
bool
Workspace
::
isInProjectDir
(
const
Media
*
media
)
{
return
isInProjectDir
(
*
(
media
->
fileInfo
()
)
);
}
QString
...
...
@@ -86,3 +100,15 @@ Workspace::pathInProjectDir( const Media *media )
return
(
media
->
fileInfo
()
->
absoluteFilePath
().
mid
(
projectDir
.
length
()
)
);
}
void
Workspace
::
copyAllToWorkspace
()
{
QHash
<
QString
,
Media
*>::
iterator
it
=
Library
::
getInstance
()
->
m_medias
.
begin
();
QHash
<
QString
,
Media
*>::
iterator
ite
=
Library
::
getInstance
()
->
m_medias
.
end
();
while
(
it
!=
ite
)
{
//FIXME
++
it
;
}
}
src/Project/Workspace.h
View file @
96a69981
...
...
@@ -25,10 +25,14 @@
#include <QObject>
#include <QQueue>
#include "Singleton.hpp"
class
Clip
;
class
Media
;
class
QFileInfo
;
class
Workspace
:
public
QObject
,
public
Singleton
<
Workspace
>
{
Q_OBJECT
...
...
@@ -36,18 +40,21 @@ class Workspace : public QObject, public Singleton<Workspace>
public:
static
const
QString
workspacePrefix
;
static
bool
isInProjectDir
(
const
Media
*
media
);
static
bool
isInProjectDir
(
const
QString
&
path
);
static
bool
isInProjectDir
(
const
QFileInfo
&
fInfo
);
static
bool
isInProjectDir
(
const
Media
*
media
);
static
QString
pathInProjectDir
(
const
Media
*
media
);
void
copyToWorkspace
(
Media
*
media
);
void
copyToWorkspace
(
Media
*
media
);
void
copyAllToWorkspace
();
private:
Workspace
();
~
Workspace
(){}
public
slots
:
void
clipLoaded
(
Clip
*
clip
);
void
clipLoaded
(
Clip
*
clip
);
private
slots
:
void
copyTerminated
(
Media
*
media
,
QString
dest
);
void
copyTerminated
(
Media
*
media
,
QString
dest
);
friend
class
Singleton
<
Workspace
>
;
};
...
...
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