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
Marco Bubke
flatpak-qt-creator
Commits
1cefde9e
Commit
1cefde9e
authored
Aug 26, 2010
by
Jarek Kobus
Browse files
Implement adding new project into opened subdirs project
Reviewed-by:
dt
<
qtc-committer@nokia.com
>
parent
fc1be8b4
Changes
30
Hide whitespace changes
Inline
Side-by-side
src/plugins/cmakeprojectmanager/cmakeprojectnodes.cpp
View file @
1cefde9e
...
...
@@ -49,6 +49,12 @@ QList<ProjectExplorer::ProjectNode::ProjectAction> CMakeProjectNode::supportedAc
return
QList
<
ProjectAction
>
();
}
bool
CMakeProjectNode
::
canAddSubProject
(
const
QString
&
proFilePath
)
const
{
Q_UNUSED
(
proFilePath
)
return
false
;
}
bool
CMakeProjectNode
::
addSubProjects
(
const
QStringList
&
proFilePaths
)
{
Q_UNUSED
(
proFilePaths
)
...
...
src/plugins/cmakeprojectmanager/cmakeprojectnodes.h
View file @
1cefde9e
...
...
@@ -43,6 +43,9 @@ public:
CMakeProjectNode
(
const
QString
&
fileName
);
virtual
bool
hasBuildTargets
()
const
;
virtual
QList
<
ProjectExplorer
::
ProjectNode
::
ProjectAction
>
supportedActions
(
Node
*
node
)
const
;
virtual
bool
canAddSubProject
(
const
QString
&
proFilePath
)
const
;
virtual
bool
addSubProjects
(
const
QStringList
&
proFilePaths
);
virtual
bool
removeSubProjects
(
const
QStringList
&
proFilePaths
);
virtual
bool
addFiles
(
const
ProjectExplorer
::
FileType
fileType
,
...
...
src/plugins/coreplugin/basefilewizard.cpp
View file @
1cefde9e
...
...
@@ -530,7 +530,7 @@ QStringList BaseFileWizard::runWizard(const QString &path, QWidget *parent)
}
if
(
firstExtensionPageHit
)
foreach
(
IFileWizardExtension
*
ex
,
extensions
)
ex
->
firstExtensionPageShown
(
files
);
ex
->
firstExtensionPageShown
(
files
,
generatedProjectFilePath
(
wizard
.
data
())
);
if
(
accepted
)
break
;
}
...
...
@@ -558,12 +558,23 @@ QStringList BaseFileWizard::runWizard(const QString &path, QWidget *parent)
return
QStringList
();
}
}
bool
removeOpenProjectAttribute
=
false
;
// Run the extensions
foreach
(
IFileWizardExtension
*
ex
,
extensions
)
if
(
!
ex
->
process
(
files
,
&
errorMessage
))
{
foreach
(
IFileWizardExtension
*
ex
,
extensions
)
{
bool
remove
;
if
(
!
ex
->
process
(
files
,
generatedProjectFilePath
(
wizard
.
data
()),
&
remove
,
&
errorMessage
))
{
QMessageBox
::
critical
(
parent
,
tr
(
"File Generation Failure"
),
errorMessage
);
return
QStringList
();
}
removeOpenProjectAttribute
|=
remove
;
}
if
(
removeOpenProjectAttribute
)
{
for
(
int
i
=
0
;
i
<
files
.
count
();
i
++
)
{
if
(
files
[
i
].
attributes
()
&
Core
::
GeneratedFile
::
OpenProjectAttribute
)
files
[
i
].
setAttributes
(
Core
::
GeneratedFile
::
OpenEditorAttribute
);
}
}
// Post generation handler
if
(
!
postGenerateFiles
(
wizard
.
data
(),
files
,
&
errorMessage
))
{
...
...
@@ -596,6 +607,12 @@ void BaseFileWizard::applyExtensionPageShortTitle(Utils::Wizard *wizard, int pag
item
->
setTitle
(
shortTitle
);
}
QString
BaseFileWizard
::
generatedProjectFilePath
(
const
QWizard
*
wizard
)
const
{
Q_UNUSED
(
wizard
)
return
QString
();
}
bool
BaseFileWizard
::
postGenerateFiles
(
const
QWizard
*
,
const
GeneratedFiles
&
l
,
QString
*
errorMessage
)
{
return
BaseFileWizard
::
postGenerateOpenEditors
(
l
,
errorMessage
);
...
...
src/plugins/coreplugin/basefilewizard.h
View file @
1cefde9e
...
...
@@ -200,6 +200,9 @@ protected:
virtual
GeneratedFiles
generateFiles
(
const
QWizard
*
w
,
QString
*
errorMessage
)
const
=
0
;
// Overwrite for ProjectWizard kind and return the path to the generated project file
virtual
QString
generatedProjectFilePath
(
const
QWizard
*
wizard
)
const
;
/* Overwrite to perform steps to be done after files are actually created.
* The default implementation opens editors with the newly generated files. */
virtual
bool
postGenerateFiles
(
const
QWizard
*
w
,
const
GeneratedFiles
&
l
,
QString
*
errorMessage
);
...
...
src/plugins/coreplugin/ifilewizardextension.h
View file @
1cefde9e
...
...
@@ -57,11 +57,18 @@ public:
virtual
QList
<
QWizardPage
*>
extensionPages
(
const
IWizard
*
wizard
)
=
0
;
/* Process the files using the extension parameters */
virtual
bool
process
(
const
QList
<
GeneratedFile
>
&
files
,
QString
*
errorMessage
)
=
0
;
virtual
bool
process
(
const
QList
<
GeneratedFile
>
&
files
,
const
QString
&
generatedProjectFilePath
,
bool
*
removeOpenProjectAttribute
,
QString
*
errorMessage
)
=
0
;
public
slots
:
/* Notification about the first extension page being shown. */
virtual
void
firstExtensionPageShown
(
const
QList
<
GeneratedFile
>
&
)
{}
virtual
void
firstExtensionPageShown
(
const
QList
<
GeneratedFile
>
&
files
,
const
QString
&
generatedProjectFilePath
)
{
Q_UNUSED
(
files
)
Q_UNUSED
(
generatedProjectFilePath
)
}
};
}
// namespace Core
...
...
src/plugins/genericprojectmanager/genericprojectnodes.cpp
View file @
1cefde9e
...
...
@@ -179,6 +179,12 @@ QList<ProjectExplorer::ProjectNode::ProjectAction> GenericProjectNode::supported
<<
RemoveFile
;
}
bool
GenericProjectNode
::
canAddSubProject
(
const
QString
&
proFilePath
)
const
{
Q_UNUSED
(
proFilePath
)
return
false
;
}
bool
GenericProjectNode
::
addSubProjects
(
const
QStringList
&
proFilePaths
)
{
Q_UNUSED
(
proFilePaths
)
...
...
src/plugins/genericprojectmanager/genericprojectnodes.h
View file @
1cefde9e
...
...
@@ -57,6 +57,8 @@ public:
virtual
QList
<
ProjectExplorer
::
ProjectNode
::
ProjectAction
>
supportedActions
(
Node
*
node
)
const
;
virtual
bool
canAddSubProject
(
const
QString
&
proFilePath
)
const
;
virtual
bool
addSubProjects
(
const
QStringList
&
proFilePaths
);
virtual
bool
removeSubProjects
(
const
QStringList
&
proFilePaths
);
...
...
src/plugins/genericprojectmanager/genericprojectwizard.cpp
View file @
1cefde9e
...
...
@@ -231,6 +231,17 @@ Core::GeneratedFiles GenericProjectWizard::generateFiles(const QWizard *w,
return
files
;
}
QString
GenericProjectWizard
::
generatedProjectFilePath
(
const
QWizard
*
w
)
const
{
const
GenericProjectWizardDialog
*
wizard
=
qobject_cast
<
const
GenericProjectWizardDialog
*>
(
w
);
const
QString
projectPath
=
wizard
->
path
();
const
QDir
dir
(
projectPath
);
const
QString
projectName
=
wizard
->
projectName
();
const
QString
creatorFileName
=
QFileInfo
(
dir
,
projectName
+
QLatin1String
(
".creator"
)).
absoluteFilePath
();
return
creatorFileName
;
}
bool
GenericProjectWizard
::
postGenerateFiles
(
const
QWizard
*
w
,
const
Core
::
GeneratedFiles
&
l
,
QString
*
errorMessage
)
{
Q_UNUSED
(
w
);
...
...
src/plugins/genericprojectmanager/genericprojectwizard.h
View file @
1cefde9e
...
...
@@ -81,6 +81,8 @@ protected:
virtual
Core
::
GeneratedFiles
generateFiles
(
const
QWizard
*
w
,
QString
*
errorMessage
)
const
;
virtual
QString
generatedProjectFilePath
(
const
QWizard
*
w
)
const
;
virtual
bool
postGenerateFiles
(
const
QWizard
*
w
,
const
Core
::
GeneratedFiles
&
l
,
QString
*
errorMessage
);
bool
isValidDir
(
const
QFileInfo
&
fileInfo
)
const
;
...
...
src/plugins/projectexplorer/customwizard/customwizard.cpp
View file @
1cefde9e
...
...
@@ -451,6 +451,25 @@ bool CustomProjectWizard::postGenerateOpen(const Core::GeneratedFiles &l, QStrin
return
BaseFileWizard
::
postGenerateOpenEditors
(
l
,
errorMessage
);
}
QString
CustomProjectWizard
::
generatedProjectFilePath
(
const
QWizard
*
wizard
)
const
{
const
BaseProjectWizardDialog
*
dialog
=
qobject_cast
<
const
BaseProjectWizardDialog
*>
(
wizard
);
QTC_ASSERT
(
dialog
,
return
QString
())
const
QString
targetPath
=
dialog
->
path
()
+
QLatin1Char
(
'/'
)
+
dialog
->
projectName
();
const
QChar
slash
=
QLatin1Char
(
'/'
);
// take the first from parameters()->files list which have cwFile.openProject set
foreach
(
const
Internal
::
CustomWizardFile
&
file
,
parameters
()
->
files
)
{
if
(
file
.
openProject
)
{
FieldReplacementMap
fieldReplacementMap
=
replacementMap
(
dialog
);
fieldReplacementMap
.
insert
(
QLatin1String
(
"ProjectName"
),
dialog
->
projectName
());
QString
target
=
file
.
target
;
Internal
::
CustomWizardContext
::
replaceFields
(
fieldReplacementMap
,
&
target
);
return
QDir
::
toNativeSeparators
(
targetPath
+
slash
+
target
);
}
}
return
QString
();
}
bool
CustomProjectWizard
::
postGenerateFiles
(
const
QWizard
*
,
const
Core
::
GeneratedFiles
&
l
,
QString
*
errorMessage
)
{
if
(
CustomWizardPrivate
::
verbose
)
...
...
src/plugins/projectexplorer/customwizard/customwizard.h
View file @
1cefde9e
...
...
@@ -162,6 +162,7 @@ signals:
void
projectLocationChanged
(
const
QString
&
path
);
protected:
QString
generatedProjectFilePath
(
const
QWizard
*
wizard
)
const
;
virtual
bool
postGenerateFiles
(
const
QWizard
*
w
,
const
Core
::
GeneratedFiles
&
l
,
QString
*
errorMessage
);
void
initProjectWizardDialog
(
BaseProjectWizardDialog
*
w
,
const
QString
&
defaultPath
,
...
...
src/plugins/projectexplorer/projectfilewizardextension.cpp
View file @
1cefde9e
...
...
@@ -38,7 +38,6 @@
#include <utils/stringutils.h>
#include <coreplugin/basefilewizard.h>
#include <coreplugin/dialogs/iwizard.h>
#include <coreplugin/filemanager.h>
#include <coreplugin/icore.h>
#include <coreplugin/iversioncontrol.h>
...
...
@@ -156,11 +155,13 @@ struct ProjectWizardContext
ProjectWizardPage
*
page
;
bool
repositoryExists
;
// Is VCS 'add' sufficient, or should a repository be created?
QString
commonDirectory
;
const
Core
::
IWizard
*
wizard
;
};
ProjectWizardContext
::
ProjectWizardContext
()
:
page
(
0
),
repositoryExists
(
false
)
repositoryExists
(
false
),
wizard
(
0
)
{
}
...
...
@@ -171,6 +172,7 @@ void ProjectWizardContext::clear()
commonDirectory
.
clear
();
page
=
0
;
repositoryExists
=
false
;
wizard
=
0
;
}
// ---- ProjectFileWizardExtension
...
...
@@ -222,8 +224,12 @@ static int findMatchingProject(const QList<ProjectEntry> &projects,
return
bestMatch
;
}
void
ProjectFileWizardExtension
::
firstExtensionPageShown
(
const
QList
<
Core
::
GeneratedFile
>
&
files
)
void
ProjectFileWizardExtension
::
firstExtensionPageShown
(
const
QList
<
Core
::
GeneratedFile
>
&
files
,
const
QString
&
generatedProjectFilePath
)
{
initProjectChoices
(
generatedProjectFilePath
);
if
(
debugExtension
)
qDebug
()
<<
Q_FUNC_INFO
<<
files
.
size
();
// Parametrize wizard page: find best project to add to, set up files display and
...
...
@@ -307,13 +313,11 @@ QList<QWizardPage *> ProjectFileWizardExtension::extensionPages(const Core::IWiz
}
// Init context with page and projects
m_context
->
page
=
new
ProjectWizardPage
;
// Project list remains the same over duration of wizard execution
// Note that projects cannot be added to projects.
initProjectChoices
(
wizard
->
kind
()
!=
Core
::
IWizard
::
ProjectWizard
);
m_context
->
wizard
=
wizard
;
return
QList
<
QWizardPage
*>
()
<<
m_context
->
page
;
}
void
ProjectFileWizardExtension
::
initProjectChoices
(
bool
enabled
)
void
ProjectFileWizardExtension
::
initProjectChoices
(
const
QString
&
generatedProjectFilePath
)
{
// Set up project list which remains the same over duration of wizard execution
// As tooltip, set the directory for disambiguation (should someone have
...
...
@@ -321,56 +325,84 @@ void ProjectFileWizardExtension::initProjectChoices(bool enabled)
//: No project selected
QStringList
projectChoices
(
tr
(
"<None>"
));
QStringList
projectToolTips
((
QString
()));
if
(
enabled
)
{
typedef
QMap
<
ProjectEntry
,
bool
>
ProjectEntryMap
;
// Sort by base name and purge duplicated entries (resulting from dependencies)
// via Map.
ProjectEntryMap
entryMap
;
foreach
(
ProjectNode
*
n
,
AllProjectNodesVisitor
::
allProjects
(
ProjectNode
::
AddNewFile
))
typedef
QMap
<
ProjectEntry
,
bool
>
ProjectEntryMap
;
// Sort by base name and purge duplicated entries (resulting from dependencies)
// via Map.
ProjectEntryMap
entryMap
;
ProjectNode
::
ProjectAction
projectAction
=
m_context
->
wizard
->
kind
()
==
Core
::
IWizard
::
ProjectWizard
?
ProjectNode
::
AddSubProject
:
ProjectNode
::
AddNewFile
;
foreach
(
ProjectNode
*
n
,
AllProjectNodesVisitor
::
allProjects
(
projectAction
))
{
if
(
projectAction
==
ProjectNode
::
AddNewFile
||
(
projectAction
==
ProjectNode
::
AddSubProject
&&
n
->
canAddSubProject
(
generatedProjectFilePath
)))
entryMap
.
insert
(
ProjectEntry
(
n
),
true
);
// Collect names
const
ProjectEntryMap
::
const_iterator
cend
=
entryMap
.
constEnd
();
for
(
ProjectEntryMap
::
const_iterator
it
=
entryMap
.
constBegin
();
it
!=
cend
;
++
it
)
{
m_context
->
projects
.
push_back
(
it
.
key
());
projectChoices
.
push_back
(
it
.
key
().
fileName
);
projectToolTips
.
push_back
(
it
.
key
().
nativeDirectory
);
}
}
m_context
->
projects
.
clear
();
// Collect names
const
ProjectEntryMap
::
const_iterator
cend
=
entryMap
.
constEnd
();
for
(
ProjectEntryMap
::
const_iterator
it
=
entryMap
.
constBegin
();
it
!=
cend
;
++
it
)
{
m_context
->
projects
.
push_back
(
it
.
key
());
projectChoices
.
push_back
(
it
.
key
().
fileName
);
projectToolTips
.
push_back
(
it
.
key
().
nativeDirectory
);
}
m_context
->
page
->
setProjects
(
projectChoices
);
m_context
->
page
->
setProjectToolTips
(
projectToolTips
);
}
bool
ProjectFileWizardExtension
::
process
(
const
QList
<
Core
::
GeneratedFile
>
&
files
,
QString
*
errorMessage
)
bool
ProjectFileWizardExtension
::
process
(
const
QList
<
Core
::
GeneratedFile
>
&
files
,
const
QString
&
generatedProjectFilePath
,
bool
*
removeOpenProjectAttribute
,
QString
*
errorMessage
)
{
return
processProject
(
files
,
errorMessage
)
&&
return
processProject
(
files
,
generatedProjectFilePath
,
removeOpenProjectAttribute
,
errorMessage
)
&&
processVersionControl
(
files
,
errorMessage
);
}
// Add files to project && version control
bool
ProjectFileWizardExtension
::
processProject
(
const
QList
<
Core
::
GeneratedFile
>
&
files
,
QString
*
errorMessage
)
bool
ProjectFileWizardExtension
::
processProject
(
const
QList
<
Core
::
GeneratedFile
>
&
files
,
const
QString
&
generatedProjectFilePath
,
bool
*
removeOpenProjectAttribute
,
QString
*
errorMessage
)
{
typedef
QMultiMap
<
FileType
,
QString
>
TypeFileMap
;
*
removeOpenProjectAttribute
=
false
;
// Add files to project (Entry at 0 is 'None').
const
int
projectIndex
=
m_context
->
page
->
currentProjectIndex
()
-
1
;
if
(
projectIndex
<
0
||
projectIndex
>=
m_context
->
projects
.
size
())
return
true
;
ProjectNode
*
project
=
m_context
->
projects
.
at
(
projectIndex
).
node
;
// Split into lists by file type and bulk-add them.
TypeFileMap
typeFileMap
;
const
Core
::
MimeDatabase
*
mdb
=
Core
::
ICore
::
instance
()
->
mimeDatabase
();
foreach
(
const
Core
::
GeneratedFile
&
generatedFile
,
files
)
{
const
QString
path
=
generatedFile
.
path
();
typeFileMap
.
insert
(
typeForFileName
(
mdb
,
path
),
path
);
}
foreach
(
FileType
type
,
typeFileMap
.
uniqueKeys
())
{
const
QStringList
typeFiles
=
typeFileMap
.
values
(
type
);
if
(
!
project
->
addFiles
(
type
,
typeFiles
))
{
*
errorMessage
=
tr
(
"Failed to add one or more files to project
\n
'%1' (%2)."
).
arg
(
project
->
path
(),
typeFiles
.
join
(
QString
(
QLatin1Char
(
','
))));
if
(
m_context
->
wizard
->
kind
()
==
Core
::
IWizard
::
ProjectWizard
)
{
if
(
!
project
->
addSubProjects
(
QStringList
(
generatedProjectFilePath
)))
{
*
errorMessage
=
tr
(
"Failed to add subproject '%1'
\n
to project '%2'."
)
.
arg
(
generatedProjectFilePath
).
arg
(
project
->
path
());
return
false
;
}
*
removeOpenProjectAttribute
=
true
;
}
else
{
// Split into lists by file type and bulk-add them.
TypeFileMap
typeFileMap
;
const
Core
::
MimeDatabase
*
mdb
=
Core
::
ICore
::
instance
()
->
mimeDatabase
();
foreach
(
const
Core
::
GeneratedFile
&
generatedFile
,
files
)
{
const
QString
path
=
generatedFile
.
path
();
typeFileMap
.
insert
(
typeForFileName
(
mdb
,
path
),
path
);
}
foreach
(
FileType
type
,
typeFileMap
.
uniqueKeys
())
{
const
QStringList
typeFiles
=
typeFileMap
.
values
(
type
);
if
(
!
project
->
addFiles
(
type
,
typeFiles
))
{
*
errorMessage
=
tr
(
"Failed to add one or more files to project
\n
'%1' (%2)."
).
arg
(
project
->
path
(),
typeFiles
.
join
(
QString
(
QLatin1Char
(
','
))));
return
false
;
}
}
}
return
true
;
}
...
...
src/plugins/projectexplorer/projectfilewizardextension.h
View file @
1cefde9e
...
...
@@ -50,15 +50,20 @@ public:
virtual
~
ProjectFileWizardExtension
();
virtual
QList
<
QWizardPage
*>
extensionPages
(
const
Core
::
IWizard
*
wizard
);
virtual
bool
process
(
const
QList
<
Core
::
GeneratedFile
>
&
files
,
QString
*
errorMessage
);
virtual
bool
process
(
const
QList
<
Core
::
GeneratedFile
>
&
files
,
const
QString
&
generatedProjectFilePath
,
bool
*
removeOpenProjectAttribute
,
QString
*
errorMessage
);
public
slots
:
virtual
void
firstExtensionPageShown
(
const
QList
<
Core
::
GeneratedFile
>
&
);
virtual
void
firstExtensionPageShown
(
const
QList
<
Core
::
GeneratedFile
>
&
files
,
const
QString
&
generatedProjectFilePath
);
private:
void
initProjectChoices
(
bool
enabled
);
void
initProjectChoices
(
const
QString
&
generatedProjectFilePath
);
void
initializeVersionControlChoices
();
bool
processProject
(
const
QList
<
Core
::
GeneratedFile
>
&
files
,
QString
*
errorMessage
);
bool
processProject
(
const
QList
<
Core
::
GeneratedFile
>
&
files
,
const
QString
&
generatedProjectFilePath
,
bool
*
removeOpenProjectAttribute
,
QString
*
errorMessage
);
bool
processVersionControl
(
const
QList
<
Core
::
GeneratedFile
>
&
files
,
QString
*
errorMessage
);
ProjectWizardContext
*
m_context
;
...
...
src/plugins/projectexplorer/projectnodes.h
View file @
1cefde9e
...
...
@@ -182,6 +182,8 @@ public:
virtual
QList
<
ProjectAction
>
supportedActions
(
Node
*
node
)
const
=
0
;
virtual
bool
canAddSubProject
(
const
QString
&
proFilePath
)
const
=
0
;
virtual
bool
addSubProjects
(
const
QStringList
&
proFilePaths
)
=
0
;
virtual
bool
removeSubProjects
(
const
QStringList
&
proFilePaths
)
=
0
;
...
...
src/plugins/qmlprojectmanager/qmlprojectnodes.cpp
View file @
1cefde9e
...
...
@@ -180,6 +180,12 @@ QList<ProjectExplorer::ProjectNode::ProjectAction> QmlProjectNode::supportedActi
return
actions
;
}
bool
QmlProjectNode
::
canAddSubProject
(
const
QString
&
proFilePath
)
const
{
Q_UNUSED
(
proFilePath
)
return
false
;
}
bool
QmlProjectNode
::
addSubProjects
(
const
QStringList
&
proFilePaths
)
{
Q_UNUSED
(
proFilePaths
)
...
...
src/plugins/qmlprojectmanager/qmlprojectnodes.h
View file @
1cefde9e
...
...
@@ -58,6 +58,8 @@ public:
virtual
QList
<
ProjectExplorer
::
ProjectNode
::
ProjectAction
>
supportedActions
(
Node
*
node
)
const
;
virtual
bool
canAddSubProject
(
const
QString
&
proFilePath
)
const
;
virtual
bool
addSubProjects
(
const
QStringList
&
proFilePaths
);
virtual
bool
removeSubProjects
(
const
QStringList
&
proFilePaths
);
...
...
src/plugins/qt4projectmanager/customwidgetwizard/customwidgetwizard.cpp
View file @
1cefde9e
...
...
@@ -75,5 +75,16 @@ Core::GeneratedFiles CustomWidgetWizard::generateFiles(const QWizard *w,
return
PluginGenerator
::
generatePlugin
(
p
,
*
(
cw
->
pluginOptions
()),
errorMessage
);
}
QString
CustomWidgetWizard
::
generatedProjectFilePath
(
const
QWizard
*
w
)
const
{
const
CustomWidgetWizardDialog
*
cw
=
qobject_cast
<
const
CustomWidgetWizardDialog
*>
(
w
);
const
QChar
slash
=
QLatin1Char
(
'/'
);
QString
baseDir
=
cw
->
path
();
baseDir
+=
slash
;
baseDir
+=
cw
->
projectName
();
baseDir
+=
slash
;
return
baseDir
+
cw
->
projectName
()
+
QLatin1String
(
".pro"
);
}
}
// namespace Internal
}
// namespace Qt4ProjectManager
src/plugins/qt4projectmanager/customwidgetwizard/customwidgetwizard.h
View file @
1cefde9e
...
...
@@ -49,6 +49,8 @@ protected:
virtual
Core
::
GeneratedFiles
generateFiles
(
const
QWizard
*
w
,
QString
*
errorMessage
)
const
;
virtual
QString
generatedProjectFilePath
(
const
QWizard
*
w
)
const
;
};
}
// namespace Internal
...
...
src/plugins/qt4projectmanager/qt4nodes.cpp
View file @
1cefde9e
...
...
@@ -771,10 +771,39 @@ QList<ProjectNode::ProjectAction> Qt4PriFileNode::supportedActions(Node *node) c
return
actions
;
}
bool
Qt4PriFileNode
::
canAddSubProject
(
const
QString
&
proFilePath
)
const
{
QFileInfo
fi
(
proFilePath
);
if
(
fi
.
suffix
()
==
QLatin1String
(
"pro"
)
||
fi
.
suffix
()
==
QLatin1String
(
"pri"
))
return
true
;
return
false
;
}
bool
Qt4PriFileNode
::
addSubProjects
(
const
QStringList
&
proFilePaths
)
{
Q_UNUSED
(
proFilePaths
)
return
false
;
//changeIncludes(m_includeFile, proFilePaths, AddToProFile);
ProjectExplorer
::
FindAllFilesVisitor
visitor
;
accept
(
&
visitor
);
const
QStringList
&
allFiles
=
visitor
.
filePaths
();
QStringList
uniqueProFilePaths
;
foreach
(
const
QString
&
proFile
,
proFilePaths
)
{
if
(
!
allFiles
.
contains
(
proFile
))
{
// if proFilePath is like: _path_/projectName/projectName.pro
// we simplify it to: _path_/projectName
QString
proFilePath
=
proFile
;
QFileInfo
fi
(
proFile
);
QFileInfo
parentFi
(
fi
.
absolutePath
());
if
(
parentFi
.
fileName
()
==
fi
.
baseName
())
proFilePath
=
parentFi
.
absoluteFilePath
();
uniqueProFilePaths
.
append
(
proFilePath
);
}
}
QStringList
failedFiles
;
changeFiles
(
ProjectExplorer
::
ProjectFileType
,
uniqueProFilePaths
,
&
failedFiles
,
AddToProFile
);
return
failedFiles
.
isEmpty
();
}
bool
Qt4PriFileNode
::
removeSubProjects
(
const
QStringList
&
proFilePaths
)
...
...
@@ -1085,6 +1114,9 @@ QStringList Qt4PriFileNode::varNames(ProjectExplorer::FileType type)
case
ProjectExplorer
::
FormType
:
vars
<<
QLatin1String
(
"FORMS"
);
break
;
case
ProjectExplorer
::
ProjectFileType
:
vars
<<
QLatin1String
(
"SUBDIRS"
);
break
;
case
ProjectExplorer
::
QMLType
:
break
;
default:
...
...
src/plugins/qt4projectmanager/qt4nodes.h
View file @
1cefde9e
...
...
@@ -140,6 +140,8 @@ public:
bool
hasBuildTargets
()
const
{
return
false
;
}
bool
canAddSubProject
(
const
QString
&
proFilePath
)
const
;
bool
addSubProjects
(
const
QStringList
&
proFilePaths
);
bool
removeSubProjects
(
const
QStringList
&
proFilePaths
);
...
...
Prev
1
2
Next
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