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
ea400057
Commit
ea400057
authored
Dec 07, 2009
by
Ludovic Fauvet
Browse files
ProjectManager: keep a list of recently opened projects
parent
505d69ce
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/Project/ProjectManager.cpp
View file @
ea400057
...
...
@@ -22,6 +22,7 @@
#include
<QFileDialog>
#include
<QtDebug>
#include
<QSettings>
#include
"ProjectManager.h"
#include
"Library.h"
...
...
@@ -30,11 +31,16 @@
ProjectManager
::
ProjectManager
()
:
m_projectFile
(
NULL
),
m_needSave
(
false
)
{
QSettings
s
;
m_recentsProjects
=
s
.
value
(
"RecentsProjects"
).
toStringList
();
}
ProjectManager
::~
ProjectManager
()
{
// Write uncommited change to the disk
QSettings
s
;
s
.
sync
();
if
(
m_projectFile
!=
NULL
)
delete
m_projectFile
;
}
...
...
@@ -44,6 +50,11 @@ bool ProjectManager::needSave() const
return
m_needSave
;
}
QStringList
ProjectManager
::
recentsProjects
()
const
{
return
m_recentsProjects
;
}
void
ProjectManager
::
cleanChanged
(
bool
val
)
{
m_needSave
=
!
val
;
...
...
@@ -70,6 +81,16 @@ void ProjectManager::loadProject( const QString& fileName )
if
(
fileName
.
length
()
==
0
)
return
;
// Append the item to the recents list
m_recentsProjects
.
removeAll
(
fileName
);
m_recentsProjects
.
prepend
(
fileName
);
while
(
m_recentsProjects
.
count
()
>
15
)
m_recentsProjects
.
removeLast
();
QSettings
s
;
s
.
setValue
(
"RecentsProjects"
,
m_recentsProjects
);
if
(
!
m_projectFile
)
delete
m_projectFile
;
m_projectFile
=
new
QFile
(
fileName
);
...
...
src/Project/ProjectManager.h
View file @
ea400057
...
...
@@ -26,6 +26,7 @@
#include
<QFile>
#include
<QObject>
#include
<QDomDocument>
#include
<QStringList>
#include
"Singleton.hpp"
...
...
@@ -38,6 +39,7 @@ public:
QString
loadProjectFile
();
void
saveProject
(
bool
saveAs
=
true
);
bool
needSave
()
const
;
QStringList
recentsProjects
()
const
;
private:
ProjectManager
();
...
...
@@ -49,6 +51,7 @@ private:
QFile
*
m_projectFile
;
QDomDocument
*
m_domDocument
;
bool
m_needSave
;
QStringList
m_recentsProjects
;
friend
class
Singleton
<
ProjectManager
>
;
...
...
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