Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Tobias Hunger
qt-creator
Commits
272e7640
Commit
272e7640
authored
Mar 18, 2010
by
dt
Browse files
Make default virgin session check more robust.
Task-Nr: QTCREATORBUG-572
parent
336cb970
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/plugins/projectexplorer/session.cpp
View file @
272e7640
...
...
@@ -370,7 +370,8 @@ SessionManager::SessionManager(QObject *parent)
m_core
(
Core
::
ICore
::
instance
()),
m_file
(
new
SessionFile
),
m_sessionNode
(
new
Internal
::
SessionNodeImpl
(
this
)),
m_currentEditor
(
0
)
m_currentEditor
(
0
),
m_defaultVirginSession
(
true
)
{
// Create qtcreator dir if it doesn't yet exist
QString
configDir
=
QFileInfo
(
m_core
->
settings
()
->
fileName
()).
path
();
...
...
@@ -424,9 +425,7 @@ SessionManager::~SessionManager()
bool
SessionManager
::
isDefaultVirgin
()
const
{
return
isDefaultSession
(
m_sessionName
)
&&
projects
().
isEmpty
()
&&
m_core
->
editorManager
()
->
openedEditors
().
isEmpty
();
return
m_defaultVirginSession
;
}
bool
SessionManager
::
isDefaultSession
(
const
QString
&
session
)
const
...
...
@@ -564,6 +563,7 @@ void SessionManager::addProject(Project *project)
void
SessionManager
::
addProjects
(
const
QList
<
Project
*>
&
projects
)
{
m_defaultVirginSession
=
false
;
QList
<
Project
*>
clearedList
;
foreach
(
Project
*
pro
,
projects
)
{
if
(
!
m_file
->
m_projects
.
contains
(
pro
))
{
...
...
@@ -594,6 +594,7 @@ void SessionManager::addProjects(const QList<Project*> &projects)
void
SessionManager
::
removeProject
(
Project
*
project
)
{
m_defaultVirginSession
=
false
;
if
(
project
==
0
)
{
qDebug
()
<<
"SessionManager::removeProject(0) ... THIS SHOULD NOT HAPPEN"
;
return
;
...
...
@@ -623,6 +624,8 @@ bool SessionManager::createImpl(const QString &fileName)
setStartupProject
(
defaultStartupProject
());
}
m_defaultVirginSession
=
false
;
if
(
debug
)
qDebug
()
<<
"SessionManager - creating new session returns "
<<
success
;
...
...
@@ -642,7 +645,6 @@ bool SessionManager::loadImpl(const QString &fileName)
bool
success
=
true
;
if
(
!
m_file
->
fileName
().
isEmpty
())
{
if
(
isDefaultVirgin
())
{
// do not save initial and virgin default session
}
else
if
(
!
save
()
||
!
clear
())
{
...
...
@@ -650,6 +652,8 @@ bool SessionManager::loadImpl(const QString &fileName)
}
}
m_defaultVirginSession
=
false
;
if
(
success
)
{
emit
aboutToUnloadSession
();
delete
m_file
;
...
...
@@ -1008,7 +1012,7 @@ void SessionManager::setValue(const QString &name, const QVariant &value)
if
(
m_file
->
m_values
.
value
(
name
)
==
value
)
return
;
m_file
->
m_values
.
insert
(
name
,
value
);
markSessionFileDirty
();
markSessionFileDirty
(
false
);
}
QVariant
SessionManager
::
value
(
const
QString
&
name
)
...
...
@@ -1135,10 +1139,12 @@ void SessionManager::reportProjectLoadingProgress()
m_file
->
sessionLoadingProgress
();
}
void
SessionManager
::
markSessionFileDirty
()
void
SessionManager
::
markSessionFileDirty
(
bool
makeDefaultVirginDirty
)
{
if
(
m_file
&&
!
m_file
->
fileName
().
isEmpty
())
m_autoSaveSessionTimer
->
start
();
if
(
makeDefaultVirginDirty
)
m_defaultVirginSession
=
false
;
}
#include "session.moc"
src/plugins/projectexplorer/session.h
View file @
272e7640
...
...
@@ -173,7 +173,7 @@ private slots:
void
handleCurrentEditorChange
(
Core
::
IEditor
*
editor
);
void
updateWindowTitle
();
void
markSessionFileDirty
();
void
markSessionFileDirty
(
bool
makeDefaultVirginDirty
=
true
);
private:
bool
loadImpl
(
const
QString
&
fileName
);
...
...
@@ -195,6 +195,7 @@ private:
QPointer
<
Core
::
IEditor
>
m_currentEditor
;
QString
m_displayName
;
QString
m_sessionName
;
bool
m_defaultVirginSession
;
mutable
QStringList
m_sessions
;
...
...
Write
Preview
Supports
Markdown
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