Skip to content
GitLab
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
00f2c00c
Commit
00f2c00c
authored
Nov 19, 2010
by
Oswald Buddenhagen
Browse files
cleaner approach to propagating need for target build config update
parent
14be9546
Changes
5
Hide whitespace changes
Inline
Side-by-side
src/plugins/projectexplorer/project.cpp
View file @
00f2c00c
...
...
@@ -260,9 +260,6 @@ bool Project::fromMap(const QVariantMap &map)
d
->
m_editorConfiguration
->
fromMap
(
values
);
}
int
previousFileVersion
=
map
.
value
(
QLatin1String
(
Constants
::
USERFILE_PREVIOUS_VERSION_KEY
),
std
::
numeric_limits
<
int
>::
max
()).
toInt
();
bool
ok
;
int
maxI
(
map
.
value
(
QLatin1String
(
TARGET_COUNT_KEY
),
0
).
toInt
(
&
ok
));
if
(
!
ok
||
maxI
<
0
)
...
...
@@ -279,9 +276,7 @@ bool Project::fromMap(const QVariantMap &map)
qWarning
()
<<
key
<<
"was not found in data."
;
return
false
;
}
QVariantMap
targetMap
=
map
.
value
(
key
).
toMap
();
targetMap
.
insert
(
Constants
::
USERFILE_PREVIOUS_VERSION_KEY
,
previousFileVersion
);
Target
*
t
(
targetFactory
()
->
restore
(
this
,
targetMap
));
Target
*
t
(
targetFactory
()
->
restore
(
this
,
map
.
value
(
key
).
toMap
()));
if
(
!
t
)
{
qWarning
()
<<
"Restoration of a target failed! (Continuing)"
;
continue
;
...
...
src/plugins/projectexplorer/projectexplorerconstants.h
View file @
00f2c00c
...
...
@@ -215,10 +215,6 @@ const char * const BUILDSTEPS_CLEAN = "ProjectExplorer.BuildSteps.Clean";
const
char
*
const
BUILDSTEPS_BUILD
=
"ProjectExplorer.BuildSteps.Build"
;
const
char
*
const
BUILDSTEPS_DEPLOY
=
"ProjectExplorer.BuildSteps.Deploy"
;
// .user file accessor keys:
const
char
*
const
USERFILE_PREVIOUS_VERSION_KEY
=
"ProjectExplorer.Project.Updater.PreviousVersion"
;
const
char
*
const
USERFILE_VERSION_KEY
=
"ProjectExplorer.Project.Updater.FileVersion"
;
// Deploy Configuration id:
const
char
*
const
DEFAULT_DEPLOYCONFIGURATION_ID
=
"ProjectExplorer.DefaultDeployConfiguration"
;
...
...
src/plugins/projectexplorer/target.cpp
View file @
00f2c00c
...
...
@@ -378,9 +378,6 @@ bool Target::fromMap(const QVariantMap &map)
if
(
!
ProjectConfiguration
::
fromMap
(
map
))
return
false
;
int
fileVersion
=
map
.
value
(
Constants
::
USERFILE_PREVIOUS_VERSION_KEY
,
std
::
numeric_limits
<
int
>::
max
()).
toInt
();
bool
ok
;
int
bcCount
(
map
.
value
(
QLatin1String
(
BC_COUNT_KEY
),
0
).
toInt
(
&
ok
));
if
(
!
ok
||
bcCount
<
0
)
...
...
@@ -395,9 +392,7 @@ bool Target::fromMap(const QVariantMap &map)
const
QString
key
(
QString
::
fromLatin1
(
BC_KEY_PREFIX
)
+
QString
::
number
(
i
));
if
(
!
map
.
contains
(
key
))
return
false
;
QVariantMap
targetMap
=
map
.
value
(
key
).
toMap
();
targetMap
.
insert
(
Constants
::
USERFILE_PREVIOUS_VERSION_KEY
,
fileVersion
);
BuildConfiguration
*
bc
(
buildConfigurationFactory
()
->
restore
(
this
,
targetMap
));
BuildConfiguration
*
bc
(
buildConfigurationFactory
()
->
restore
(
this
,
map
.
value
(
key
).
toMap
()));
if
(
!
bc
)
continue
;
addBuildConfiguration
(
bc
);
...
...
src/plugins/projectexplorer/userfileaccessor.cpp
View file @
00f2c00c
...
...
@@ -52,6 +52,7 @@
using
namespace
ProjectExplorer
;
namespace
{
const
char
*
const
USERFILE_VERSION_KEY
=
"ProjectExplorer.Project.Updater.FileVersion"
;
const
char
*
const
USERFILE_ENVIRONMENT_ID_KEY
=
"ProjectExplorer.Project.Updater.EnvironmentId"
;
const
char
*
const
PROJECT_FILE_POSTFIX
(
".user"
);
...
...
@@ -388,7 +389,7 @@ QVariantMap UserFileAccessor::restoreSettings(Project *project)
QVariantMap
map
(
reader
.
restoreValues
());
// Get and verify file version:
const
int
fileVersion
=
map
.
value
(
QLatin1String
(
Constants
::
USERFILE_VERSION_KEY
),
0
).
toInt
();
const
int
fileVersion
=
map
.
value
(
QLatin1String
(
USERFILE_VERSION_KEY
),
0
).
toInt
();
if
(
fileVersion
<
m_firstVersion
||
fileVersion
>
m_lastVersion
+
1
)
{
qWarning
()
<<
"File version"
<<
fileVersion
<<
"is not supported."
;
return
QVariantMap
();
...
...
@@ -425,14 +426,11 @@ QVariantMap UserFileAccessor::restoreSettings(Project *project)
QFile
::
remove
(
backupFileName
);
// Remove because copy doesn't overwrite
QFile
::
copy
(
fileName
,
backupFileName
);
}
map
.
insert
(
QLatin1String
(
Constants
::
USERFILE_PREVIOUS_VERSION_KEY
),
fileVersion
);
// Update:
for
(
int
i
=
fileVersion
;
i
<=
m_lastVersion
;
++
i
)
map
=
m_handlers
.
value
(
i
)
->
update
(
project
,
map
);
map
.
insert
(
QLatin1String
(
Constants
::
USERFILE_VERSION_KEY
),
m_lastVersion
+
1
);
return
map
;
}
...
...
@@ -446,7 +444,7 @@ bool UserFileAccessor::saveSettings(Project *project, const QVariantMap &map)
for
(
QVariantMap
::
const_iterator
i
=
map
.
constBegin
();
i
!=
map
.
constEnd
();
++
i
)
writer
.
saveValue
(
i
.
key
(),
i
.
value
());
writer
.
saveValue
(
QLatin1String
(
Constants
::
USERFILE_VERSION_KEY
),
m_lastVersion
+
1
);
writer
.
saveValue
(
QLatin1String
(
USERFILE_VERSION_KEY
),
m_lastVersion
+
1
);
writer
.
saveValue
(
QLatin1String
(
USERFILE_ENVIRONMENT_ID_KEY
),
ProjectExplorerPlugin
::
instance
()
->
projectExplorerSettings
().
environmentId
.
toString
());
...
...
@@ -495,15 +493,17 @@ QVariantMap Version0Handler::convertBuildConfigurations(Project *project, const
// Find a valid Id to use:
QString
id
;
if
(
project
->
id
()
==
QLatin1String
(
"GenericProjectManager.GenericProject"
))
if
(
project
->
id
()
==
QLatin1String
(
"GenericProjectManager.GenericProject"
))
{
id
=
QLatin1String
(
"GenericProjectManager.GenericBuildConfiguration"
);
else
if
(
project
->
id
()
==
QLatin1String
(
"CMakeProjectManager.CMakeProject"
))
}
else
if
(
project
->
id
()
==
QLatin1String
(
"CMakeProjectManager.CMakeProject"
))
{
id
=
QLatin1String
(
"CMakeProjectManager.CMakeBuildConfiguration"
);
else
if
(
project
->
id
()
==
QLatin1String
(
"Qt4ProjectManager.Qt4Project"
))
}
else
if
(
project
->
id
()
==
QLatin1String
(
"Qt4ProjectManager.Qt4Project"
))
{
result
.
insert
(
QLatin1String
(
"Qt4ProjectManager.Qt4BuildConfiguration.NeedsV0Update"
),
QVariant
());
id
=
QLatin1String
(
"Qt4ProjectManager.Qt4BuildConfiguration"
);
else
}
else
{
return
QVariantMap
();
// QmlProjects do not(/no longer) have BuildConfigurations,
// or we do not know how to handle this.
}
result
.
insert
(
QLatin1String
(
"ProjectExplorer.ProjectConfiguration.Id"
),
id
);
for
(
QVariantMap
::
const_iterator
i
=
map
.
constBegin
();
i
!=
map
.
constEnd
();
++
i
)
{
...
...
src/plugins/qt4projectmanager/qt4buildconfiguration.cpp
View file @
00f2c00c
...
...
@@ -119,8 +119,6 @@ bool Qt4BuildConfiguration::fromMap(const QVariantMap &map)
if
(
!
BuildConfiguration
::
fromMap
(
map
))
return
false
;
int
fileVersion
=
map
.
value
(
ProjectExplorer
::
Constants
::
USERFILE_PREVIOUS_VERSION_KEY
,
std
::
numeric_limits
<
int
>::
max
()).
toInt
();
m_shadowBuild
=
map
.
value
(
QLatin1String
(
USE_SHADOW_BUILD_KEY
),
true
).
toBool
();
m_buildDirectory
=
map
.
value
(
QLatin1String
(
BUILD_DIRECTORY_KEY
),
qt4Target
()
->
defaultBuildDirectory
()).
toString
();
m_qtVersionId
=
map
.
value
(
QLatin1String
(
QT_VERSION_ID_KEY
)).
toInt
();
...
...
@@ -143,7 +141,7 @@ bool Qt4BuildConfiguration::fromMap(const QVariantMap &map)
}
QtVersion
*
version
=
qtVersion
();
if
(
fileVersion
>=
1
)
{
// we are not upgrading from pre-targets!
if
(
!
map
.
contains
(
QLatin1String
(
"Qt4ProjectManager.Qt4BuildConfiguration.NeedsV0Update"
))
)
{
// we are not upgrading from pre-targets!
if
(
version
->
isValid
()
&&
!
version
->
supportedTargetIds
().
contains
(
target
()
->
id
()))
{
qWarning
()
<<
"Buildconfiguration"
<<
displayName
()
<<
": Qt"
<<
version
->
displayName
()
<<
"not supported by target"
<<
target
()
->
id
();
return
false
;
...
...
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