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
4e571068
Commit
4e571068
authored
Dec 10, 2009
by
Hugo Beauzee-Luyssen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Project name is now used when a project is loaded.
parent
4b515f7e
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
39 additions
and
10 deletions
+39
-10
src/GUI/MainWindow.cpp
src/GUI/MainWindow.cpp
+3
-3
src/GUI/MainWindow.h
src/GUI/MainWindow.h
+1
-1
src/Project/ProjectManager.cpp
src/Project/ProjectManager.cpp
+24
-5
src/Project/ProjectManager.h
src/Project/ProjectManager.h
+11
-1
No files found.
src/GUI/MainWindow.cpp
View file @
4e571068
...
...
@@ -99,8 +99,8 @@ MainWindow::MainWindow( QWidget *parent ) :
connect
(
this
,
SIGNAL
(
toolChanged
(
ToolButtons
)
),
m_timeline
,
SLOT
(
setTool
(
ToolButtons
)
)
);
connect
(
ProjectManager
::
getInstance
(),
SIGNAL
(
project
Chang
ed
(
const
QString
&
,
bool
)
),
this
,
SLOT
(
project
Chang
ed
(
const
QString
&
,
bool
)
)
);
connect
(
ProjectManager
::
getInstance
(),
SIGNAL
(
project
Updat
ed
(
const
QString
&
,
bool
)
),
this
,
SLOT
(
project
Updat
ed
(
const
QString
&
,
bool
)
)
);
QSettings
s
;
// Restore the geometry
...
...
@@ -427,7 +427,7 @@ void MainWindow::closeEvent( QCloseEvent* e )
e
->
ignore
();
}
void
MainWindow
::
project
Chang
ed
(
const
QString
&
projectName
,
bool
savedStatus
)
void
MainWindow
::
project
Updat
ed
(
const
QString
&
projectName
,
bool
savedStatus
)
{
QString
title
=
tr
(
"VideoLAN Movie Creator"
);
title
+=
" - "
;
...
...
src/GUI/MainWindow.h
View file @
4e571068
...
...
@@ -96,7 +96,7 @@ private slots:
void
on_actionProject_Preferences_triggered
();
void
on_actionClose_Project_triggered
();
void
toolButtonClicked
(
int
id
);
void
project
Chang
ed
(
const
QString
&
projectName
,
bool
savedStatus
);
void
project
Updat
ed
(
const
QString
&
projectName
,
bool
savedStatus
);
void
keyboardShortcutChanged
(
const
QString
&
,
const
QString
&
);
signals:
...
...
src/Project/ProjectManager.cpp
View file @
4e571068
...
...
@@ -36,6 +36,9 @@ ProjectManager::ProjectManager() : m_projectFile( NULL ), m_needSave( false )
m_recentsProjects
=
s
.
value
(
"RecentsProjects"
).
toStringList
();
connect
(
this
,
SIGNAL
(
projectClosed
()
),
Library
::
getInstance
(),
SLOT
(
clear
()
)
);
connect
(
this
,
SIGNAL
(
projectClosed
()
),
MainWorkflow
::
getInstance
(),
SLOT
(
clear
()
)
);
const
SettingValue
*
val
=
SettingsManager
::
getInstance
()
->
getValue
(
"project"
,
"ProjectName"
);
connect
(
val
,
SIGNAL
(
changed
(
QVariant
)
),
this
,
SLOT
(
nameChanged
(
QVariant
)
)
);
m_projectName
=
tr
(
"<Unsaved project>"
);
}
ProjectManager
::~
ProjectManager
()
...
...
@@ -64,10 +67,8 @@ void ProjectManager::cleanChanged( bool val )
if
(
m_projectFile
!=
NULL
)
{
QFileInfo
fInfo
(
*
m_projectFile
);
emit
projectChanged
(
fInfo
.
fileName
(),
val
);
}
else
emit
projectChanged
(
tr
(
"<Unsaved project>"
),
val
);
emit
projectUpdated
(
m_projectName
,
val
);
}
void
ProjectManager
::
loadTimeline
()
...
...
@@ -76,7 +77,13 @@ void ProjectManager::loadTimeline()
QFileInfo
fInfo
(
*
m_projectFile
);
MainWorkflow
::
getInstance
()
->
loadProject
(
root
.
firstChildElement
(
"timeline"
)
);
emit
projectChanged
(
fInfo
.
fileName
(),
true
);
emit
projectUpdated
(
m_projectName
,
true
);
}
void
ProjectManager
::
parseProjectNode
(
const
QDomElement
&
node
)
{
QDomElement
projectNameNode
=
node
.
firstChildElement
(
"ProjectName"
);
m_projectName
=
projectNameNode
.
attribute
(
"value"
,
tr
(
"<Unnamed project>"
)
);
}
void
ProjectManager
::
loadProject
(
const
QString
&
fileName
)
...
...
@@ -104,6 +111,7 @@ void ProjectManager::loadProject( const QString& fileName )
QDomElement
root
=
m_domDocument
->
documentElement
();
parseProjectNode
(
root
.
firstChildElement
(
"project"
)
);
connect
(
Library
::
getInstance
(),
SIGNAL
(
projectLoaded
()
),
this
,
SLOT
(
loadTimeline
()
)
);
Library
::
getInstance
()
->
loadProject
(
root
.
firstChildElement
(
"medias"
)
);
SettingsManager
::
getInstance
()
->
loadSettings
(
"project"
,
root
.
firstChildElement
(
"project"
)
);
...
...
@@ -161,11 +169,17 @@ void ProjectManager::saveProject( bool saveAs /*= true*/ )
if
(
saveAs
==
true
)
{
QFileInfo
fInfo
(
*
m_projectFile
);
emit
project
Chang
ed
(
fInfo
.
fileName
(),
true
);
emit
project
Updat
ed
(
fInfo
.
fileName
(),
true
);
}
emit
projectSaved
();
}
//void ProjectManager::newProject( const QString &projectName )
//{
// if ( closeProject()
// m_fi
//}
void
ProjectManager
::
closeProject
()
{
if
(
askForSaveIfModified
()
==
false
)
...
...
@@ -203,3 +217,8 @@ bool ProjectManager::askForSaveIfModified()
}
return
true
;
}
void
ProjectManager
::
nameChanged
(
const
QVariant
&
name
)
{
m_projectName
=
name
.
toString
();
}
src/Project/ProjectManager.h
View file @
4e571068
...
...
@@ -36,6 +36,7 @@ class ProjectManager : public QObject, public Singleton<ProjectManager>
Q_DISABLE_COPY
(
ProjectManager
);
public:
void
loadProject
(
const
QString
&
fileName
);
void
newProject
(
const
QString
&
projectName
);
QString
loadProjectFile
();
void
saveProject
(
bool
saveAs
=
true
);
bool
needSave
()
const
;
...
...
@@ -44,6 +45,7 @@ public:
bool
askForSaveIfModified
();
private:
void
parseProjectNode
(
const
QDomElement
&
node
);
ProjectManager
();
~
ProjectManager
();
...
...
@@ -54,15 +56,23 @@ private:
QDomDocument
*
m_domDocument
;
bool
m_needSave
;
QStringList
m_recentsProjects
;
QString
m_projectName
;
friend
class
Singleton
<
ProjectManager
>
;
private
slots
:
void
loadTimeline
();
void
cleanChanged
(
bool
val
);
void
nameChanged
(
const
QVariant
&
name
);
signals:
void
projectChanged
(
const
QString
&
projectName
,
bool
savedState
);
/**
* This signal is emitted when :
* - The project name has changed
* - The clean state has changed
* - The revision (if activated) has changed
*/
void
projectUpdated
(
const
QString
&
projectName
,
bool
savedState
);
void
projectSaved
();
void
projectClosed
();
};
...
...
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