Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Marco Bubke
flatpak-qt-creator
Commits
761bef0a
Commit
761bef0a
authored
Jan 13, 2012
by
hjk
Committed by
hjk
Jan 16, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
autotools: style, more 'using', less typing.
Change-Id: I27e8843d5278d1b1a33bd7bdce2f0e721adbd725 Reviewed-by:
hjk
<
qthjk@ovi.com
>
parent
21dcecee
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
123 additions
and
123 deletions
+123
-123
src/plugins/autotoolsprojectmanager/autogenstep.cpp
src/plugins/autotoolsprojectmanager/autogenstep.cpp
+7
-7
src/plugins/autotoolsprojectmanager/autoreconfstep.cpp
src/plugins/autotoolsprojectmanager/autoreconfstep.cpp
+7
-7
src/plugins/autotoolsprojectmanager/autotoolsbuildconfiguration.cpp
...s/autotoolsprojectmanager/autotoolsbuildconfiguration.cpp
+26
-23
src/plugins/autotoolsprojectmanager/autotoolsmanager.cpp
src/plugins/autotoolsprojectmanager/autotoolsmanager.cpp
+5
-3
src/plugins/autotoolsprojectmanager/autotoolsproject.cpp
src/plugins/autotoolsprojectmanager/autotoolsproject.cpp
+36
-45
src/plugins/autotoolsprojectmanager/autotoolsprojectnode.cpp
src/plugins/autotoolsprojectmanager/autotoolsprojectnode.cpp
+10
-9
src/plugins/autotoolsprojectmanager/autotoolstarget.cpp
src/plugins/autotoolsprojectmanager/autotoolstarget.cpp
+11
-10
src/plugins/autotoolsprojectmanager/configurestep.cpp
src/plugins/autotoolsprojectmanager/configurestep.cpp
+7
-7
src/plugins/autotoolsprojectmanager/makestep.cpp
src/plugins/autotoolsprojectmanager/makestep.cpp
+14
-12
No files found.
src/plugins/autotoolsprojectmanager/autogenstep.cpp
View file @
761bef0a
...
...
@@ -61,7 +61,7 @@ const char AUTOGEN_STEP_ID[] = "AutotoolsProjectManager.AutogenStep";
// AutogenStepFactory class
/////////////////////////////
AutogenStepFactory
::
AutogenStepFactory
(
QObject
*
parent
)
:
ProjectExplorer
::
IBuildStepFactory
(
parent
)
IBuildStepFactory
(
parent
)
{
}
...
...
@@ -109,9 +109,9 @@ BuildStep *AutogenStepFactory::clone(BuildStepList *parent, BuildStep *source)
return
new
AutogenStep
(
parent
,
static_cast
<
AutogenStep
*>
(
source
));
}
bool
AutogenStepFactory
::
canRestore
(
ProjectExplorer
::
BuildStepList
*
parent
,
const
QVariantMap
&
map
)
const
bool
AutogenStepFactory
::
canRestore
(
BuildStepList
*
parent
,
const
QVariantMap
&
map
)
const
{
QString
id
(
ProjectExplorer
::
idFromMap
(
map
)
)
;
QString
id
=
idFromMap
(
map
);
return
canCreate
(
parent
,
id
);
}
...
...
@@ -129,20 +129,20 @@ BuildStep *AutogenStepFactory::restore(BuildStepList *parent, const QVariantMap
////////////////////////
// AutogenStep class
////////////////////////
AutogenStep
::
AutogenStep
(
ProjectExplorer
::
BuildStepList
*
bsl
)
:
AutogenStep
::
AutogenStep
(
BuildStepList
*
bsl
)
:
AbstractProcessStep
(
bsl
,
QLatin1String
(
AUTOGEN_STEP_ID
)),
m_runAutogen
(
false
)
{
ctor
();
}
AutogenStep
::
AutogenStep
(
ProjectExplorer
::
BuildStepList
*
bsl
,
const
QString
&
id
)
:
AutogenStep
::
AutogenStep
(
BuildStepList
*
bsl
,
const
QString
&
id
)
:
AbstractProcessStep
(
bsl
,
id
)
{
ctor
();
}
AutogenStep
::
AutogenStep
(
ProjectExplorer
::
BuildStepList
*
bsl
,
AutogenStep
*
bs
)
:
AutogenStep
::
AutogenStep
(
BuildStepList
*
bsl
,
AutogenStep
*
bs
)
:
AbstractProcessStep
(
bsl
,
bs
),
m_additionalArguments
(
bs
->
additionalArguments
())
{
...
...
@@ -200,7 +200,7 @@ void AutogenStep::run(QFutureInterface<bool> &interface)
AbstractProcessStep
::
run
(
interface
);
}
ProjectExplorer
::
BuildStepConfigWidget
*
AutogenStep
::
createConfigWidget
()
BuildStepConfigWidget
*
AutogenStep
::
createConfigWidget
()
{
return
new
AutogenStepConfigWidget
(
this
);
}
...
...
src/plugins/autotoolsprojectmanager/autoreconfstep.cpp
View file @
761bef0a
...
...
@@ -60,7 +60,7 @@ const char AUTORECONF_ADDITIONAL_ARGUMENTS_KEY[] = "AutotoolsProjectManager.Auto
// AutoreconfStepFactory class
////////////////////////////////
AutoreconfStepFactory
::
AutoreconfStepFactory
(
QObject
*
parent
)
:
ProjectExplorer
::
IBuildStepFactory
(
parent
)
IBuildStepFactory
(
parent
)
{
}
...
...
@@ -108,9 +108,9 @@ BuildStep *AutoreconfStepFactory::clone(BuildStepList *parent, BuildStep *source
return
new
AutoreconfStep
(
parent
,
static_cast
<
AutoreconfStep
*>
(
source
));
}
bool
AutoreconfStepFactory
::
canRestore
(
ProjectExplorer
::
BuildStepList
*
parent
,
const
QVariantMap
&
map
)
const
bool
AutoreconfStepFactory
::
canRestore
(
BuildStepList
*
parent
,
const
QVariantMap
&
map
)
const
{
QString
id
(
ProjectExplorer
::
idFromMap
(
map
)
)
;
QString
id
=
idFromMap
(
map
);
return
canCreate
(
parent
,
id
);
}
...
...
@@ -128,20 +128,20 @@ BuildStep *AutoreconfStepFactory::restore(BuildStepList *parent, const QVariantM
/////////////////////////
// AutoreconfStep class
/////////////////////////
AutoreconfStep
::
AutoreconfStep
(
ProjectExplorer
::
BuildStepList
*
bsl
)
:
AutoreconfStep
::
AutoreconfStep
(
BuildStepList
*
bsl
)
:
AbstractProcessStep
(
bsl
,
QLatin1String
(
AUTORECONF_STEP_ID
)),
m_runAutoreconf
(
false
)
{
ctor
();
}
AutoreconfStep
::
AutoreconfStep
(
ProjectExplorer
::
BuildStepList
*
bsl
,
const
QString
&
id
)
:
AutoreconfStep
::
AutoreconfStep
(
BuildStepList
*
bsl
,
const
QString
&
id
)
:
AbstractProcessStep
(
bsl
,
id
)
{
ctor
();
}
AutoreconfStep
::
AutoreconfStep
(
ProjectExplorer
::
BuildStepList
*
bsl
,
AutoreconfStep
*
bs
)
:
AutoreconfStep
::
AutoreconfStep
(
BuildStepList
*
bsl
,
AutoreconfStep
*
bs
)
:
AbstractProcessStep
(
bsl
,
bs
),
m_additionalArguments
(
bs
->
additionalArguments
())
{
...
...
@@ -194,7 +194,7 @@ void AutoreconfStep::run(QFutureInterface<bool> &interface)
AbstractProcessStep
::
run
(
interface
);
}
ProjectExplorer
::
BuildStepConfigWidget
*
AutoreconfStep
::
createConfigWidget
()
BuildStepConfigWidget
*
AutoreconfStep
::
createConfigWidget
()
{
return
new
AutoreconfStepConfigWidget
(
this
);
}
...
...
src/plugins/autotoolsprojectmanager/autotoolsbuildconfiguration.cpp
View file @
761bef0a
...
...
@@ -50,13 +50,16 @@
#include <QtGui/QInputDialog>
using
namespace
AutotoolsProjectManager
;
using
namespace
AutotoolsProjectManager
::
Constants
;
using
namespace
Internal
;
using
namespace
ProjectExplorer
;
using
namespace
ProjectExplorer
::
Constants
;
//////////////////////////////////////
// AutotoolsBuildConfiguration class
//////////////////////////////////////
AutotoolsBuildConfiguration
::
AutotoolsBuildConfiguration
(
AutotoolsTarget
*
parent
)
:
BuildConfiguration
(
parent
,
QLatin1String
(
Constants
::
AUTOTOOLS_BC_ID
))
:
BuildConfiguration
(
parent
,
QLatin1String
(
AUTOTOOLS_BC_ID
))
{
m_buildDirectory
=
autotoolsTarget
()
->
defaultBuildDirectory
();
}
...
...
@@ -75,8 +78,8 @@ AutotoolsBuildConfiguration::AutotoolsBuildConfiguration(AutotoolsTarget *parent
QVariantMap
AutotoolsBuildConfiguration
::
toMap
()
const
{
QVariantMap
map
=
ProjectExplorer
::
BuildConfiguration
::
toMap
();
map
.
insert
(
QLatin1String
(
Constants
::
BUILD_DIRECTORY_KEY
),
m_buildDirectory
);
QVariantMap
map
=
BuildConfiguration
::
toMap
();
map
.
insert
(
QLatin1String
(
BUILD_DIRECTORY_KEY
),
m_buildDirectory
);
return
map
;
}
...
...
@@ -85,7 +88,7 @@ bool AutotoolsBuildConfiguration::fromMap(const QVariantMap &map)
if
(
!
BuildConfiguration
::
fromMap
(
map
))
return
false
;
m_buildDirectory
=
map
.
value
(
QLatin1String
(
Constants
::
BUILD_DIRECTORY_KEY
),
autotoolsTarget
()
->
defaultBuildDirectory
()).
toString
();
m_buildDirectory
=
map
.
value
(
QLatin1String
(
BUILD_DIRECTORY_KEY
),
autotoolsTarget
()
->
defaultBuildDirectory
()).
toString
();
return
true
;
}
...
...
@@ -107,9 +110,9 @@ AutotoolsTarget *AutotoolsBuildConfiguration::autotoolsTarget() const
return
static_cast
<
AutotoolsTarget
*>
(
target
());
}
ProjectExplorer
::
IOutputParser
*
AutotoolsBuildConfiguration
::
createOutputParser
()
const
IOutputParser
*
AutotoolsBuildConfiguration
::
createOutputParser
()
const
{
ProjectExplorer
::
ToolChain
*
tc
=
autotoolsTarget
()
->
autotoolsProject
()
->
toolChain
();
ToolChain
*
tc
=
autotoolsTarget
()
->
autotoolsProject
()
->
toolChain
();
if
(
tc
)
return
tc
->
outputParser
();
return
0
;
...
...
@@ -119,34 +122,34 @@ ProjectExplorer::IOutputParser *AutotoolsBuildConfiguration::createOutputParser(
// AutotoolsBuildConfiguration class
//////////////////////////////////////
AutotoolsBuildConfigurationFactory
::
AutotoolsBuildConfigurationFactory
(
QObject
*
parent
)
:
ProjectExplorer
::
IBuildConfigurationFactory
(
parent
)
IBuildConfigurationFactory
(
parent
)
{
}
QStringList
AutotoolsBuildConfigurationFactory
::
availableCreationIds
(
ProjectExplorer
::
Target
*
parent
)
const
QStringList
AutotoolsBuildConfigurationFactory
::
availableCreationIds
(
Target
*
parent
)
const
{
if
(
!
qobject_cast
<
AutotoolsTarget
*>
(
parent
))
return
QStringList
();
return
QStringList
()
<<
QLatin1String
(
Constants
::
AUTOTOOLS_BC_ID
);
return
QStringList
()
<<
QLatin1String
(
AUTOTOOLS_BC_ID
);
}
QString
AutotoolsBuildConfigurationFactory
::
displayNameForId
(
const
QString
&
id
)
const
{
if
(
id
==
QLatin1String
(
Constants
::
AUTOTOOLS_BC_ID
))
if
(
id
==
QLatin1String
(
AUTOTOOLS_BC_ID
))
return
tr
(
"Build"
);
return
QString
();
}
bool
AutotoolsBuildConfigurationFactory
::
canCreate
(
ProjectExplorer
::
Target
*
parent
,
const
QString
&
id
)
const
bool
AutotoolsBuildConfigurationFactory
::
canCreate
(
Target
*
parent
,
const
QString
&
id
)
const
{
if
(
!
qobject_cast
<
AutotoolsTarget
*>
(
parent
))
return
false
;
if
(
id
==
QLatin1String
(
Constants
::
AUTOTOOLS_BC_ID
))
if
(
id
==
QLatin1String
(
AUTOTOOLS_BC_ID
))
return
true
;
return
false
;
}
AutotoolsBuildConfiguration
*
AutotoolsBuildConfigurationFactory
::
create
(
ProjectExplorer
::
Target
*
parent
,
const
QString
&
id
)
AutotoolsBuildConfiguration
*
AutotoolsBuildConfigurationFactory
::
create
(
Target
*
parent
,
const
QString
&
id
)
{
if
(
!
canCreate
(
parent
,
id
))
return
0
;
...
...
@@ -167,10 +170,10 @@ AutotoolsBuildConfiguration *AutotoolsBuildConfigurationFactory::create(ProjectE
bc
->
setDisplayName
(
buildConfigurationName
);
t
->
addBuildConfiguration
(
bc
);
t
->
addDeployConfiguration
(
t
->
createDeployConfiguration
(
ProjectExplorer
::
Constants
::
DEFAULT_DEPLOYCONFIGURATION_ID
));
t
->
addDeployConfiguration
(
t
->
createDeployConfiguration
(
DEFAULT_DEPLOYCONFIGURATION_ID
));
// User needs to choose where the executable file is.
// TODO: Parse the file in *Anjuta style* to be able to add custom RunConfigurations.
t
->
addRunConfiguration
(
new
ProjectExplorer
::
CustomExecutableRunConfiguration
(
t
));
t
->
addRunConfiguration
(
new
CustomExecutableRunConfiguration
(
t
));
return
bc
;
}
...
...
@@ -178,7 +181,7 @@ AutotoolsBuildConfiguration *AutotoolsBuildConfigurationFactory::create(ProjectE
AutotoolsBuildConfiguration
*
AutotoolsBuildConfigurationFactory
::
createDefaultConfiguration
(
AutotoolsTarget
*
target
)
const
{
AutotoolsBuildConfiguration
*
bc
=
new
AutotoolsBuildConfiguration
(
target
);
ProjectExplorer
::
BuildStepList
*
buildSteps
=
bc
->
stepList
(
ProjectExplorer
::
Constants
::
BUILDSTEPS_BUILD
);
BuildStepList
*
buildSteps
=
bc
->
stepList
(
BUILDSTEPS_BUILD
);
// ### Build Steps Build ###
// autogen.sh or autoreconf
...
...
@@ -202,7 +205,7 @@ AutotoolsBuildConfiguration *AutotoolsBuildConfigurationFactory::createDefaultCo
makeStep
->
setBuildTarget
(
QLatin1String
(
"all"
),
/*on =*/
true
);
// ### Build Steps Clean ###
ProjectExplorer
::
BuildStepList
*
cleanSteps
=
bc
->
stepList
(
ProjectExplorer
::
Constants
::
BUILDSTEPS_CLEAN
);
BuildStepList
*
cleanSteps
=
bc
->
stepList
(
BUILDSTEPS_CLEAN
);
MakeStep
*
cleanMakeStep
=
new
MakeStep
(
cleanSteps
);
cleanMakeStep
->
setAdditionalArguments
(
QLatin1String
(
"clean"
));
cleanMakeStep
->
setClean
(
true
);
...
...
@@ -211,12 +214,12 @@ AutotoolsBuildConfiguration *AutotoolsBuildConfigurationFactory::createDefaultCo
return
bc
;
}
bool
AutotoolsBuildConfigurationFactory
::
canClone
(
ProjectExplorer
::
Target
*
parent
,
ProjectExplorer
::
BuildConfiguration
*
source
)
const
bool
AutotoolsBuildConfigurationFactory
::
canClone
(
Target
*
parent
,
BuildConfiguration
*
source
)
const
{
return
canCreate
(
parent
,
source
->
id
());
}
AutotoolsBuildConfiguration
*
AutotoolsBuildConfigurationFactory
::
clone
(
ProjectExplorer
::
Target
*
parent
,
ProjectExplorer
::
BuildConfiguration
*
source
)
AutotoolsBuildConfiguration
*
AutotoolsBuildConfigurationFactory
::
clone
(
Target
*
parent
,
BuildConfiguration
*
source
)
{
if
(
!
canClone
(
parent
,
source
))
return
0
;
...
...
@@ -226,13 +229,13 @@ AutotoolsBuildConfiguration *AutotoolsBuildConfigurationFactory::clone(ProjectEx
return
new
AutotoolsBuildConfiguration
(
target
,
origin
);
}
bool
AutotoolsBuildConfigurationFactory
::
canRestore
(
ProjectExplorer
::
Target
*
parent
,
const
QVariantMap
&
map
)
const
bool
AutotoolsBuildConfigurationFactory
::
canRestore
(
Target
*
parent
,
const
QVariantMap
&
map
)
const
{
QString
id
(
ProjectExplorer
::
idFromMap
(
map
)
)
;
QString
id
=
idFromMap
(
map
);
return
canCreate
(
parent
,
id
);
}
AutotoolsBuildConfiguration
*
AutotoolsBuildConfigurationFactory
::
restore
(
ProjectExplorer
::
Target
*
parent
,
const
QVariantMap
&
map
)
AutotoolsBuildConfiguration
*
AutotoolsBuildConfigurationFactory
::
restore
(
Target
*
parent
,
const
QVariantMap
&
map
)
{
if
(
!
canRestore
(
parent
,
map
))
return
0
;
...
...
@@ -244,7 +247,7 @@ AutotoolsBuildConfiguration *AutotoolsBuildConfigurationFactory::restore(Project
return
0
;
}
ProjectExplorer
::
BuildConfiguration
::
BuildType
AutotoolsBuildConfiguration
::
buildType
()
const
BuildConfiguration
::
BuildType
AutotoolsBuildConfiguration
::
buildType
()
const
{
// TODO: Should I return something different from Unknown?
return
Unknown
;
...
...
src/plugins/autotoolsprojectmanager/autotoolsmanager.cpp
View file @
761bef0a
...
...
@@ -43,10 +43,12 @@
#include <projectexplorer/projectexplorer.h>
#include <projectexplorer/session.h>
using
namespace
ProjectExplorer
;
namespace
AutotoolsProjectManager
{
namespace
Internal
{
ProjectExplorer
::
Project
*
AutotoolsManager
::
openProject
(
const
QString
&
fileName
,
QString
*
errorString
)
Project
*
AutotoolsManager
::
openProject
(
const
QString
&
fileName
,
QString
*
errorString
)
{
QString
canonicalFilePath
=
QFileInfo
(
fileName
).
canonicalFilePath
();
...
...
@@ -58,8 +60,8 @@ ProjectExplorer::Project *AutotoolsManager::openProject(const QString &fileName,
}
// Check whether the project is already open or not.
ProjectExplorer
::
ProjectExplorerPlugin
*
projectExplorer
=
ProjectExplorer
::
ProjectExplorerPlugin
::
instance
();
foreach
(
Project
Explorer
::
Project
*
pi
,
projectExplorer
->
session
()
->
projects
())
{
ProjectExplorerPlugin
*
projectExplorer
=
ProjectExplorerPlugin
::
instance
();
foreach
(
Project
*
pi
,
projectExplorer
->
session
()
->
projects
())
{
if
(
canonicalFilePath
==
pi
->
file
()
->
fileName
())
{
*
errorString
=
tr
(
"Failed opening project '%1': Project already open"
)
.
arg
(
QDir
::
toNativeSeparators
(
canonicalFilePath
));
...
...
src/plugins/autotoolsprojectmanager/autotoolsproject.cpp
View file @
761bef0a
...
...
@@ -138,7 +138,7 @@ Core::IFile *AutotoolsProject::file() const
return
m_file
;
}
ProjectExplorer
::
IProjectManager
*
AutotoolsProject
::
projectManager
()
const
IProjectManager
*
AutotoolsProject
::
projectManager
()
const
{
return
m_manager
;
}
...
...
@@ -148,7 +148,7 @@ AutotoolsTarget *AutotoolsProject::activeTarget() const
return
static_cast
<
AutotoolsTarget
*>
(
Project
::
activeTarget
());
}
QList
<
Project
Explorer
::
Project
*>
AutotoolsProject
::
dependsOn
()
QList
<
Project
*>
AutotoolsProject
::
dependsOn
()
{
return
QList
<
Project
*>
();
}
...
...
@@ -158,14 +158,12 @@ QString AutotoolsProject::defaultBuildDirectory() const
return
sourceDirectory
();
}
QList
<
ProjectExplorer
::
BuildConfigWidget
*>
AutotoolsProject
::
subConfigWidgets
()
QList
<
BuildConfigWidget
*>
AutotoolsProject
::
subConfigWidgets
()
{
QList
<
ProjectExplorer
::
BuildConfigWidget
*>
list
;
list
<<
new
BuildEnvironmentWidget
;
return
list
;
return
QList
<
BuildConfigWidget
*>
()
<<
new
BuildEnvironmentWidget
;
}
ProjectExplorer
::
ProjectNode
*
AutotoolsProject
::
rootProjectNode
()
const
ProjectNode
*
AutotoolsProject
::
rootProjectNode
()
const
{
return
m_rootNode
;
}
...
...
@@ -229,10 +227,8 @@ bool AutotoolsProject::fromMap(const QVariantMap &map)
if
(
!
id
.
isNull
())
{
setToolChain
(
toolChainManager
->
findToolChain
(
id
));
}
else
{
ProjectExplorer
::
Abi
abi
=
ProjectExplorer
::
Abi
::
hostAbi
();
abi
=
ProjectExplorer
::
Abi
(
abi
.
architecture
(),
abi
.
os
(),
ProjectExplorer
::
Abi
::
UnknownFlavor
,
Abi
abi
=
Abi
::
hostAbi
();
abi
=
Abi
(
abi
.
architecture
(),
abi
.
os
(),
Abi
::
UnknownFlavor
,
abi
.
binaryFormat
(),
abi
.
wordWidth
()
==
32
?
32
:
0
);
QList
<
ToolChain
*>
tcs
=
toolChainManager
->
findToolChains
(
abi
);
if
(
tcs
.
isEmpty
())
...
...
@@ -364,17 +360,17 @@ void AutotoolsProject::buildFileNodeTree(const QDir &directory,
// Get all existing nodes and remember them in a hash table.
// This allows to reuse existing nodes and to remove obsolete
// nodes later.
QHash
<
QString
,
ProjectExplorer
::
Node
*>
nodeHash
;
foreach
(
ProjectExplorer
::
Node
*
node
,
nodes
(
m_rootNode
))
QHash
<
QString
,
Node
*>
nodeHash
;
foreach
(
Node
*
node
,
nodes
(
m_rootNode
))
nodeHash
.
insert
(
node
->
path
(),
node
);
// Add the sources to the filenode project tree. Sources
// inside the same directory are grouped into a folder-node.
const
QString
baseDir
=
directory
.
absolutePath
();
QList
<
ProjectExplorer
::
FileNode
*>
fileNodes
;
ProjectExplorer
::
FolderNode
*
parentFolder
=
0
;
ProjectExplorer
::
FolderNode
*
oldParentFolder
=
0
;
QList
<
FileNode
*>
fileNodes
;
FolderNode
*
parentFolder
=
0
;
FolderNode
*
oldParentFolder
=
0
;
foreach
(
const
QString
&
file
,
files
)
{
if
(
file
.
contains
(
QLatin1String
(
".moc"
)))
...
...
@@ -392,8 +388,8 @@ void AutotoolsProject::buildFileNodeTree(const QDir &directory,
oldParentFolder
=
parentFolder
;
parentFolder
=
0
;
if
(
nodeHash
.
contains
(
subDir
))
{
QTC_ASSERT
(
nodeHash
[
subDir
]
->
nodeType
()
==
ProjectExplorer
::
FolderNodeType
,
return
);
parentFolder
=
static_cast
<
ProjectExplorer
::
FolderNode
*>
(
nodeHash
[
subDir
]);
QTC_ASSERT
(
nodeHash
[
subDir
]
->
nodeType
()
==
FolderNodeType
,
return
);
parentFolder
=
static_cast
<
FolderNode
*>
(
nodeHash
[
subDir
]);
}
else
{
parentFolder
=
insertFolderNode
(
QDir
(
subDir
),
nodeHash
);
if
(
parentFolder
==
0
)
{
...
...
@@ -415,11 +411,7 @@ void AutotoolsProject::buildFileNodeTree(const QDir &directory,
if
(
nodeHash
.
contains
(
filePath
))
{
nodeHash
.
remove
(
filePath
);
}
else
{
ProjectExplorer
::
FileNode
*
node
=
new
ProjectExplorer
::
FileNode
(
filePath
,
ProjectExplorer
::
ResourceType
,
false
);
fileNodes
.
append
(
node
);
fileNodes
.
append
(
new
FileNode
(
filePath
,
ResourceType
,
false
));
}
}
...
...
@@ -427,17 +419,17 @@ void AutotoolsProject::buildFileNodeTree(const QDir &directory,
m_rootNode
->
addFileNodes
(
fileNodes
,
parentFolder
);
// Remove unused file nodes and empty folder nodes
QHash
<
QString
,
ProjectExplorer
::
Node
*>::
const_iterator
it
=
nodeHash
.
constBegin
();
QHash
<
QString
,
Node
*>::
const_iterator
it
=
nodeHash
.
constBegin
();
while
(
it
!=
nodeHash
.
constEnd
())
{
if
((
*
it
)
->
nodeType
()
==
ProjectExplorer
::
FileNodeType
)
{
ProjectExplorer
::
FileNode
*
fileNode
=
static_cast
<
ProjectExplorer
::
FileNode
*>
(
*
it
);
ProjectExplorer
::
FolderNode
*
parent
=
fileNode
->
parentFolderNode
();
m_rootNode
->
removeFileNodes
(
QList
<
ProjectExplorer
::
FileNode
*>
()
<<
fileNode
,
parent
);
if
((
*
it
)
->
nodeType
()
==
FileNodeType
)
{
FileNode
*
fileNode
=
static_cast
<
FileNode
*>
(
*
it
);
FolderNode
*
parent
=
fileNode
->
parentFolderNode
();
m_rootNode
->
removeFileNodes
(
QList
<
FileNode
*>
()
<<
fileNode
,
parent
);
// Remove all empty parent folders
while
(
parent
->
subFolderNodes
().
isEmpty
()
&&
parent
->
fileNodes
().
isEmpty
())
{
ProjectExplorer
::
FolderNode
*
grandParent
=
parent
->
parentFolderNode
();
m_rootNode
->
removeFolderNodes
(
QList
<
ProjectExplorer
::
FolderNode
*>
()
<<
parent
,
grandParent
);
FolderNode
*
grandParent
=
parent
->
parentFolderNode
();
m_rootNode
->
removeFolderNodes
(
QList
<
FolderNode
*>
()
<<
parent
,
grandParent
);
parent
=
grandParent
;
if
(
parent
==
m_rootNode
)
break
;
...
...
@@ -447,8 +439,7 @@ void AutotoolsProject::buildFileNodeTree(const QDir &directory,
}
}
ProjectExplorer
::
FolderNode
*
AutotoolsProject
::
insertFolderNode
(
const
QDir
&
nodeDir
,
QHash
<
QString
,
ProjectExplorer
::
Node
*>
&
nodes
)
FolderNode
*
AutotoolsProject
::
insertFolderNode
(
const
QDir
&
nodeDir
,
QHash
<
QString
,
Node
*>
&
nodes
)
{
const
QString
nodePath
=
nodeDir
.
absolutePath
();
QFileInfo
rootInfo
(
m_rootNode
->
path
());
...
...
@@ -458,41 +449,41 @@ ProjectExplorer::FolderNode *AutotoolsProject::insertFolderNode(const QDir &node
if
(
rootPath
==
nodePath
)
return
0
;
ProjectExplorer
::
FolderNode
*
folder
=
new
ProjectExplorer
::
FolderNode
(
nodePath
);
FolderNode
*
folder
=
new
FolderNode
(
nodePath
);
QDir
dir
(
nodeDir
);
folder
->
setDisplayName
(
dir
.
dirName
());
// Get parent-folder. If it does not exist, create it recursively.
// Take care that the m_rootNode is considered as top folder.
ProjectExplorer
::
FolderNode
*
parentFolder
=
m_rootNode
;
FolderNode
*
parentFolder
=
m_rootNode
;
if
((
rootPath
!=
folder
->
path
())
&&
dir
.
cdUp
())
{
const
QString
parentDir
=
dir
.
absolutePath
();
if
(
!
nodes
.
contains
(
parentDir
))
{
ProjectExplorer
::
FolderNode
*
insertedFolder
=
insertFolderNode
(
parentDir
,
nodes
);
FolderNode
*
insertedFolder
=
insertFolderNode
(
parentDir
,
nodes
);
if
(
insertedFolder
!=
0
)
parentFolder
=
insertedFolder
;
}
else
{
QTC_ASSERT
(
nodes
[
parentDir
]
->
nodeType
()
==
ProjectExplorer
::
FolderNodeType
,
return
0
);
parentFolder
=
static_cast
<
ProjectExplorer
::
FolderNode
*>
(
nodes
[
parentDir
]);
QTC_ASSERT
(
nodes
[
parentDir
]
->
nodeType
()
==
FolderNodeType
,
return
0
);
parentFolder
=
static_cast
<
FolderNode
*>
(
nodes
[
parentDir
]);
}
}
m_rootNode
->
addFolderNodes
(
QList
<
ProjectExplorer
::
FolderNode
*>
()
<<
folder
,
parentFolder
);
m_rootNode
->
addFolderNodes
(
QList
<
FolderNode
*>
()
<<
folder
,
parentFolder
);
nodes
.
insert
(
nodePath
,
folder
);
return
folder
;
}
QList
<
ProjectExplorer
::
Node
*>
AutotoolsProject
::
nodes
(
ProjectExplorer
::
FolderNode
*
parent
)
const
QList
<
Node
*>
AutotoolsProject
::
nodes
(
FolderNode
*
parent
)
const
{
QList
<
ProjectExplorer
::
Node
*>
list
;
QList
<
Node
*>
list
;
QTC_ASSERT
(
parent
!=
0
,
return
list
);
foreach
(
ProjectExplorer
::
FolderNode
*
folder
,
parent
->
subFolderNodes
())
{
foreach
(
FolderNode
*
folder
,
parent
->
subFolderNodes
())
{
list
.
append
(
nodes
(
folder
));
list
.
append
(
folder
);
}
foreach
(
ProjectExplorer
::
FileNode
*
file
,
parent
->
fileNodes
())
foreach
(
FileNode
*
file
,
parent
->
fileNodes
())
list
.
append
(
file
);
return
list
;
...
...
@@ -510,9 +501,9 @@ void AutotoolsProject::updateCppCodeModel()
QStringList
allFrameworkPaths
;
if
(
m_toolChain
)
{
const
QList
<
ProjectExplorer
::
HeaderPath
>
allHeaderPaths
=
m_toolChain
->
systemHeaderPaths
();
foreach
(
const
ProjectExplorer
::
HeaderPath
&
headerPath
,
allHeaderPaths
)
{
if
(
headerPath
.
kind
()
==
ProjectExplorer
::
HeaderPath
::
FrameworkHeaderPath
)
{
const
QList
<
HeaderPath
>
allHeaderPaths
=
m_toolChain
->
systemHeaderPaths
();
foreach
(
const
HeaderPath
&
headerPath
,
allHeaderPaths
)
{
if
(
headerPath
.
kind
()
==
HeaderPath
::
FrameworkHeaderPath
)
{
allFrameworkPaths
.
append
(
headerPath
.
path
());
}
else
{
allIncludePaths
.
append
(
headerPath
.
path
());
...
...
src/plugins/autotoolsprojectmanager/autotoolsprojectnode.cpp
View file @
761bef0a
...
...
@@ -37,9 +37,10 @@
using
namespace
AutotoolsProjectManager
;
using
namespace
AutotoolsProjectManager
::
Internal
;
using
namespace
ProjectExplorer
;
AutotoolsProjectNode
::
AutotoolsProjectNode
(
AutotoolsProject
*
project
,
Core
::
IFile
*
projectFile
)
:
ProjectExplorer
::
ProjectNode
(
projectFile
->
fileName
()),
ProjectNode
(
projectFile
->
fileName
()),
m_project
(
project
),
m_projectFile
(
projectFile
)
{
...
...
@@ -50,10 +51,10 @@ bool AutotoolsProjectNode::hasBuildTargets() const
return
true
;
}
QList
<
ProjectExplorer
::
ProjectNode
::
ProjectAction
>
AutotoolsProjectNode
::
supportedActions
(
Node
*
node
)
const
QList
<
ProjectNode
::
ProjectAction
>
AutotoolsProjectNode
::
supportedActions
(
Node
*
node
)
const
{
Q_UNUSED
(
node
);
return
QList
<
ProjectExplorer
::
ProjectNode
::
ProjectAction
>
();
return
QList
<
ProjectNode
::
ProjectAction
>
();
}
bool
AutotoolsProjectNode
::
canAddSubProject
(
const
QString
&
proFilePath
)
const
...
...
@@ -74,7 +75,7 @@ bool AutotoolsProjectNode::removeSubProjects(const QStringList &proFilePaths)
return
false
;
}
bool
AutotoolsProjectNode
::
addFiles
(
const
ProjectExplorer
::
FileType
fileType
,
bool
AutotoolsProjectNode
::
addFiles
(
const
FileType
fileType
,
const
QStringList
&
filePaths
,
QStringList
*
notAdded
)
{
...
...
@@ -84,7 +85,7 @@ bool AutotoolsProjectNode::addFiles(const ProjectExplorer::FileType fileType,
return
false
;
}
bool
AutotoolsProjectNode
::
removeFiles
(
const
ProjectExplorer
::
FileType
fileType
,
bool
AutotoolsProjectNode
::
removeFiles
(
const
FileType
fileType
,
const
QStringList
&
filePaths
,
QStringList
*
notRemoved
)
{
...
...
@@ -94,7 +95,7 @@ bool AutotoolsProjectNode::removeFiles(const ProjectExplorer::FileType fileType,
return
false
;
}
bool
AutotoolsProjectNode
::
deleteFiles
(
const
ProjectExplorer
::
FileType
fileType
,
bool
AutotoolsProjectNode
::
deleteFiles
(
const
FileType
fileType
,
const
QStringList
&
filePaths
)
{
Q_UNUSED
(
fileType
);
...
...
@@ -102,7 +103,7 @@ bool AutotoolsProjectNode::deleteFiles(const ProjectExplorer::FileType fileType,
return
false
;
}
bool
AutotoolsProjectNode
::
renameFile
(
const
ProjectExplorer
::
FileType
fileType
,
bool
AutotoolsProjectNode
::
renameFile
(
const
FileType
fileType
,
const
QString
&
filePath
,
const
QString
&
newFilePath
)
{
...
...
@@ -112,8 +113,8 @@ bool AutotoolsProjectNode::renameFile(const ProjectExplorer::FileType fileType,
return
false
;
}
QList
<
ProjectExplorer
::
RunConfiguration
*>
AutotoolsProjectNode
::
runConfigurationsFor
(
Node
*
node
)
QList
<
RunConfiguration
*>
AutotoolsProjectNode
::
runConfigurationsFor
(
Node
*
node
)
{
Q_UNUSED
(
node
);
return
QList
<
ProjectExplorer
::
RunConfiguration
*>
();
return
QList
<
RunConfiguration
*>
();
}
src/plugins/autotoolsprojectmanager/autotoolstarget.cpp
View file @
761bef0a
...
...
@@ -52,10 +52,11 @@
using
namespace
AutotoolsProjectManager
;
using
namespace
AutotoolsProjectManager
::
Internal
;
using
namespace
ProjectExplorer
;
static
QString
displayNameForId
(
const
QString
&
id
)
{
if
(
id
==
QLatin1String
(
Constants
::
DEFAULT_AUTOTOOLS_TARGET_ID
))
if
(
id
==
QLatin1String
(
AutotoolsProjectManager
::
Constants
::
DEFAULT_AUTOTOOLS_TARGET_ID
))
return
QApplication
::
translate
(
"AutotoolsProjectManager::Internal::AutotoolsTarget"
,
"Desktop"
,
"Autotools Default target display name"
);
return
QString
();
...
...
@@ -66,14 +67,14 @@ static QString displayNameForId(const QString &id)
//////////////////////////
AutotoolsTarget
::
AutotoolsTarget
(
AutotoolsProject
*
parent
)
:
ProjectExplorer
::
Target
(
parent
,
QLatin1String
(
Constants
::
DEFAULT_AUTOTOOLS_TARGET_ID
)),
Target
(
parent
,
QLatin1String
(
Constants
::
DEFAULT_AUTOTOOLS_TARGET_ID
)),
m_buildConfigurationFactory
(
new
AutotoolsBuildConfigurationFactory
(
this
))
{
setDefaultDisplayName
(
displayNameForId
(
id
()));
setIcon
(
qApp
->
style
()
->
standardIcon
(
QStyle
::
SP_ComputerIcon
));
}
ProjectExplorer
::
BuildConfigWidget
*
AutotoolsTarget
::
createConfigWidget
()
BuildConfigWidget
*
AutotoolsTarget
::
createConfigWidget
()
{
return
new
AutotoolsBuildSettingsWidget
(
this
);
}
...
...
@@ -117,7 +118,7 @@ bool AutotoolsTargetFactory::supportsTargetId(const QString &id) const
return
id
==
QLatin1String
(
Constants
::
DEFAULT_AUTOTOOLS_TARGET_ID
);