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
42cb5ddc
Commit
42cb5ddc
authored
Mar 31, 2009
by
Christian Hoenig
Committed by
Thorbjørn Lindeijer
May 13, 2009
Browse files
Implement "Build Project Only" submenu and build project dependencies
parent
d2ada829
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/plugins/projectexplorer/projectexplorer.cpp
View file @
42cb5ddc
...
...
@@ -501,7 +501,6 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
// build action
m_buildAction
=
new
QAction
(
tr
(
"Build Project"
),
this
);
cmd
=
am
->
registerAction
(
m_buildAction
,
Constants
::
BUILD
,
globalcontext
);
cmd
->
setAttribute
(
Core
::
Command
::
CA_UpdateText
);
cmd
->
setDefaultKeySequence
(
QKeySequence
(
tr
(
"Ctrl+B"
)));
mbuild
->
addAction
(
cmd
,
Constants
::
G_BUILD_PROJECT
);
mproject
->
addAction
(
cmd
,
Constants
::
G_PROJECT_BUILD
);
...
...
@@ -518,6 +517,31 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
mbuild
->
addAction
(
cmd
,
Constants
::
G_BUILD_PROJECT
);
mproject
->
addAction
(
cmd
,
Constants
::
G_PROJECT_BUILD
);
// build project only menu
Core
::
ActionContainer
*
mpo
=
am
->
createMenu
(
Constants
::
BUILDPRJONLYMENU
);
m_buildPrjOnlyMenu
=
mpo
->
menu
();
m_buildPrjOnlyMenu
->
setTitle
(
tr
(
"Project Only"
));
mbuild
->
addMenu
(
mpo
,
Constants
::
G_BUILD_PROJECT
);
mproject
->
addMenu
(
mpo
,
Constants
::
G_PROJECT_BUILD
);
// build action
m_buildPrjOnlyAction
=
new
QAction
(
tr
(
"Build Project Only"
),
this
);
cmd
=
am
->
registerAction
(
m_buildPrjOnlyAction
,
Constants
::
BUILDPRJONLY
,
globalcontext
);
cmd
->
setAttribute
(
Core
::
Command
::
CA_UpdateText
);
mpo
->
addAction
(
cmd
,
""
);
// rebuild action
m_rebuildPrjOnlyAction
=
new
QAction
(
tr
(
"Rebuild Project only"
),
this
);
cmd
=
am
->
registerAction
(
m_rebuildPrjOnlyAction
,
Constants
::
REBUILDPRJONLY
,
globalcontext
);
cmd
->
setAttribute
(
Core
::
Command
::
CA_UpdateText
);
mpo
->
addAction
(
cmd
,
""
);
// clean action
m_cleanPrjOnlyAction
=
new
QAction
(
tr
(
"Clean Project only"
),
this
);
cmd
=
am
->
registerAction
(
m_cleanPrjOnlyAction
,
Constants
::
CLEANPRJONLY
,
globalcontext
);
cmd
->
setAttribute
(
Core
::
Command
::
CA_UpdateText
);
mpo
->
addAction
(
cmd
,
""
);
// Add Set Build Configuration to menu
mbuild
->
addMenu
(
mbc
,
Constants
::
G_BUILD_PROJECT
);
mproject
->
addMenu
(
mbc
,
Constants
::
G_PROJECT_CONFIG
);
...
...
@@ -644,10 +668,13 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
#if 0
connect(m_loadAction, SIGNAL(triggered()), this, SLOT(loadAction()));
#endif
connect
(
m_buildPrjOnlyAction
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
buildProjectOnly
()));
connect
(
m_buildAction
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
buildProject
()));
connect
(
m_buildSessionAction
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
buildSession
()));
connect
(
m_rebuildPrjOnlyAction
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
rebuildProjectOnly
()));
connect
(
m_rebuildAction
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
rebuildProject
()));
connect
(
m_rebuildSessionAction
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
rebuildSession
()));
connect
(
m_cleanPrjOnlyAction
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
cleanProjectOnly
()));
connect
(
m_cleanAction
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
cleanProject
()));
connect
(
m_cleanSessionAction
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
cleanSession
()));
connect
(
m_runAction
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
runProject
()));
...
...
@@ -1247,15 +1274,27 @@ void ProjectExplorerPlugin::updateActions()
m_unloadAction
->
setEnabled
(
m_currentProject
!=
0
);
if
(
m_currentProject
==
0
)
{
m_unloadAction
->
setText
(
tr
(
"Close Project"
));
m_buildAction
->
setText
(
tr
(
"Build Project"
));
m_buildPrjOnlyMenu
->
setTitle
(
tr
(
"Project only"
));
m_buildPrjOnlyAction
->
setText
(
tr
(
"Build Project only"
));
m_rebuildPrjOnlyAction
->
setText
(
tr
(
"Rebuild Project only"
));
m_cleanPrjOnlyAction
->
setText
(
tr
(
"Clean Project only"
));
}
else
{
m_unloadAction
->
setText
(
tr
(
"Close Project
\"
%1
\"
"
).
arg
(
m_currentProject
->
name
()));
m_buildAction
->
setText
(
tr
(
"Build Project
\"
%1
\"
"
).
arg
(
m_currentProject
->
name
()));
m_buildPrjOnlyMenu
->
setTitle
(
tr
(
"Project
\"
%1
\"
only"
).
arg
(
m_currentProject
->
name
()));
m_buildPrjOnlyAction
->
setText
(
tr
(
"Build Project
\"
%1
\"
only"
).
arg
(
m_currentProject
->
name
()));
m_rebuildPrjOnlyAction
->
setText
(
tr
(
"Rebuild Project
\"
%1
\"
only"
).
arg
(
m_currentProject
->
name
()));
m_cleanPrjOnlyAction
->
setText
(
tr
(
"Clean Project
\"
%1
\"
only"
).
arg
(
m_currentProject
->
name
()));
}
m_buildAction
->
setEnabled
(
enableBuildActions
);
m_rebuildAction
->
setEnabled
(
enableBuildActions
);
m_cleanAction
->
setEnabled
(
enableBuildActions
);
m_buildPrjOnlyMenu
->
setEnabled
(
enableBuildActions
);
m_buildPrjOnlyAction
->
setEnabled
(
enableBuildActions
);
m_rebuildPrjOnlyAction
->
setEnabled
(
enableBuildActions
);
m_cleanPrjOnlyAction
->
setEnabled
(
enableBuildActions
);
m_clearSession
->
setEnabled
(
hasProjects
&&
!
building
);
m_buildSessionAction
->
setEnabled
(
hasProjects
&&
!
building
);
m_rebuildSessionAction
->
setEnabled
(
hasProjects
&&
!
building
);
...
...
@@ -1312,15 +1351,30 @@ bool ProjectExplorerPlugin::saveModifiedFiles(const QList<Project *> & projects)
//NBS handle case where there is no activeBuildConfiguration
// because someone delete all build configurations
void
ProjectExplorerPlugin
::
buildProject
()
void
ProjectExplorerPlugin
::
buildProject
Only
()
{
if
(
debug
)
qDebug
()
<<
"ProjectExplorerPlugin::buildProject"
;
qDebug
()
<<
"ProjectExplorerPlugin::buildProject
Only
"
;
if
(
saveModifiedFiles
(
QList
<
Project
*>
()
<<
m_currentProject
))
buildManager
()
->
buildProject
(
m_currentProject
,
m_currentProject
->
activeBuildConfiguration
());
}
void
ProjectExplorerPlugin
::
buildProject
()
{
if
(
debug
)
qDebug
()
<<
"ProjectExplorerPlugin::buildProject"
;
const
QList
<
Project
*>
&
projects
=
m_session
->
projectOrder
(
m_currentProject
);
if
(
saveModifiedFiles
(
projects
))
{
QStringList
configurations
;
foreach
(
const
Project
*
pro
,
projects
)
configurations
<<
pro
->
activeBuildConfiguration
();
m_buildManager
->
buildProjects
(
projects
,
configurations
);
}
}
void
ProjectExplorerPlugin
::
buildSession
()
{
if
(
debug
)
...
...
@@ -1336,10 +1390,10 @@ void ProjectExplorerPlugin::buildSession()
}
}
void
ProjectExplorerPlugin
::
rebuildProject
()
void
ProjectExplorerPlugin
::
rebuildProject
Only
()
{
if
(
debug
)
qDebug
()
<<
"ProjectExplorerPlugin::rebuildProject"
;
qDebug
()
<<
"ProjectExplorerPlugin::rebuildProject
Only
"
;
if
(
saveModifiedFiles
(
QList
<
Project
*>
()
<<
m_currentProject
))
{
m_buildManager
->
cleanProject
(
m_currentProject
,
m_currentProject
->
activeBuildConfiguration
());
...
...
@@ -1347,6 +1401,22 @@ void ProjectExplorerPlugin::rebuildProject()
}
}
void
ProjectExplorerPlugin
::
rebuildProject
()
{
if
(
debug
)
qDebug
()
<<
"ProjectExplorerPlugin::rebuildProject"
;
const
QList
<
Project
*>
&
projects
=
m_session
->
projectOrder
(
m_currentProject
);
if
(
saveModifiedFiles
(
projects
))
{
QStringList
configurations
;
foreach
(
const
Project
*
pro
,
projects
)
configurations
<<
pro
->
activeBuildConfiguration
();
m_buildManager
->
cleanProjects
(
projects
,
configurations
);
m_buildManager
->
buildProjects
(
projects
,
configurations
);
}
}
void
ProjectExplorerPlugin
::
rebuildSession
()
{
if
(
debug
)
...
...
@@ -1363,15 +1433,30 @@ void ProjectExplorerPlugin::rebuildSession()
}
}
void
ProjectExplorerPlugin
::
cleanProject
()
void
ProjectExplorerPlugin
::
cleanProject
Only
()
{
if
(
debug
)
qDebug
()
<<
"ProjectExplorerPlugin::cleanProject"
;
qDebug
()
<<
"ProjectExplorerPlugin::cleanProject
Only
"
;
if
(
saveModifiedFiles
(
QList
<
Project
*>
()
<<
m_currentProject
))
m_buildManager
->
cleanProject
(
m_currentProject
,
m_currentProject
->
activeBuildConfiguration
());
}
void
ProjectExplorerPlugin
::
cleanProject
()
{
if
(
debug
)
qDebug
()
<<
"ProjectExplorerPlugin::cleanProject"
;
const
QList
<
Project
*>
&
projects
=
m_session
->
projectOrder
(
m_currentProject
);
if
(
saveModifiedFiles
(
projects
))
{
QStringList
configurations
;
foreach
(
const
Project
*
pro
,
projects
)
configurations
<<
pro
->
activeBuildConfiguration
();
m_buildManager
->
cleanProjects
(
projects
,
configurations
);
}
}
void
ProjectExplorerPlugin
::
cleanSession
()
{
if
(
debug
)
...
...
@@ -1407,8 +1492,12 @@ void ProjectExplorerPlugin::runProjectImpl(Project *pro)
m_runMode
=
ProjectExplorer
::
Constants
::
RUNMODE
;
m_delayedRunConfiguration
=
pro
->
activeRunConfiguration
();
//NBS TODO make the build project step take into account project dependencies
m_buildManager
->
buildProject
(
pro
,
pro
->
activeBuildConfiguration
());
const
QList
<
Project
*>
&
projects
=
m_session
->
projectOrder
(
pro
);
QStringList
configurations
;
foreach
(
const
Project
*
prj
,
projects
)
configurations
<<
prj
->
activeBuildConfiguration
();
m_buildManager
->
buildProjects
(
projects
,
configurations
);
}
}
else
{
executeRunConfiguration
(
pro
->
activeRunConfiguration
(),
ProjectExplorer
::
Constants
::
RUNMODE
);
...
...
@@ -1425,8 +1514,14 @@ void ProjectExplorerPlugin::debugProject()
if
(
saveModifiedFiles
(
QList
<
Project
*>
()
<<
pro
))
{
m_runMode
=
ProjectExplorer
::
Constants
::
DEBUGMODE
;
m_delayedRunConfiguration
=
pro
->
activeRunConfiguration
();
//NBS TODO make the build project step take into account project dependencies
m_buildManager
->
buildProject
(
pro
,
pro
->
activeBuildConfiguration
());
const
QList
<
Project
*>
&
projects
=
m_session
->
projectOrder
(
pro
);
QStringList
configurations
;
foreach
(
const
Project
*
prj
,
projects
)
configurations
<<
prj
->
activeBuildConfiguration
();
m_buildManager
->
buildProjects
(
projects
,
configurations
);
updateRunAction
();
}
}
else
{
...
...
src/plugins/projectexplorer/projectexplorer.h
View file @
42cb5ddc
...
...
@@ -133,10 +133,13 @@ signals:
private
slots
:
void
buildStateChanged
(
ProjectExplorer
::
Project
*
pro
);
void
buildQueueFinished
(
bool
success
);
void
buildProjectOnly
();
void
buildProject
();
void
buildSession
();
void
rebuildProjectOnly
();
void
rebuildProject
();
void
rebuildSession
();
void
cleanProjectOnly
();
void
cleanProject
();
void
cleanSession
();
void
cancelBuild
();
...
...
@@ -224,10 +227,13 @@ private:
#endif
QAction
*
m_unloadAction
;
QAction
*
m_clearSession
;
QAction
*
m_buildPrjOnlyAction
;
QAction
*
m_buildAction
;
QAction
*
m_buildSessionAction
;
QAction
*
m_rebuildPrjOnlyAction
;
QAction
*
m_rebuildAction
;
QAction
*
m_rebuildSessionAction
;
QAction
*
m_cleanPrjOnlyAction
;
QAction
*
m_cleanAction
;
QAction
*
m_cleanSessionAction
;
QAction
*
m_runAction
;
...
...
@@ -244,6 +250,7 @@ private:
QAction
*
m_removeFileAction
;
QAction
*
m_renameFileAction
;
QMenu
*
m_buildPrjOnlyMenu
;
QMenu
*
m_buildConfigurationMenu
;
QActionGroup
*
m_buildConfigurationActionGroup
;
QMenu
*
m_runConfigurationMenu
;
...
...
src/plugins/projectexplorer/projectexplorerconstants.h
View file @
42cb5ddc
...
...
@@ -43,12 +43,16 @@ const char * const NEWPROJECT = "ProjectExplorer.NewProject";
const
char
*
const
LOAD
=
"ProjectExplorer.Load"
;
const
char
*
const
UNLOAD
=
"ProjectExplorer.Unload"
;
const
char
*
const
CLEARSESSION
=
"ProjectExplorer.ClearSession"
;
const
char
*
const
BUILDPRJONLY
=
"ProjectExplorer.BuildProjectOnly"
;
const
char
*
const
BUILD
=
"ProjectExplorer.Build"
;
const
char
*
const
BUILDSESSION
=
"ProjectExplorer.BuildSession"
;
const
char
*
const
REBUILDPRJONLY
=
"ProjectExplorer.RebuildProjectOnly"
;
const
char
*
const
REBUILD
=
"ProjectExplorer.Rebuild"
;
const
char
*
const
REBUILDSESSION
=
"ProjectExplorer.RebuildSession"
;
const
char
*
const
CLEANPRJONLY
=
"ProjectExplorer.CleanProjectOnly"
;
const
char
*
const
CLEAN
=
"ProjectExplorer.Clean"
;
const
char
*
const
CLEANSESSION
=
"ProjectExplorer.CleanSession"
;
const
char
*
const
BUILDPRJONLYMENU
=
"ProjectExplorer.BuildProjectOnlyMenu"
;
const
char
*
const
BUILDCONFIGURATIONMENU
=
"ProjectExplorer.BuildConfigurationMenu"
;
const
char
*
const
CANCELBUILD
=
"ProjectExplorer.CancelBuild"
;
const
char
*
const
RUNCONFIGURATIONMENU
=
"ProjectExplorer.RunConfigurationMenu"
;
...
...
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