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
f3cf0c36
Commit
f3cf0c36
authored
Jan 26, 2010
by
Kai Koehne
Browse files
Adjust .qmlproject files generated by wizards to new format
parent
5c16f706
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/plugins/qmlprojectmanager/qmlnewprojectwizard.cpp
View file @
f3cf0c36
...
...
@@ -103,26 +103,40 @@ Core::GeneratedFiles QmlNewProjectWizard::generateFiles(const QWizard *w,
QLatin1String
(
"qml"
));
QString
contents
;
QTextStream
out
(
&
contents
);
out
<<
"import Qt 4.6"
<<
endl
<<
endl
<<
"Rectangle {"
<<
endl
<<
" width: 200"
<<
endl
<<
" height: 200"
<<
endl
<<
" Text {"
<<
endl
<<
" x: 66"
<<
endl
<<
" y: 93"
<<
endl
<<
" text:
\"
Hello World
\"
"
<<
endl
<<
" }"
<<
endl
<<
"}"
<<
endl
;
{
QTextStream
out
(
&
contents
);
out
<<
"import Qt 4.6"
<<
endl
<<
endl
<<
"Rectangle {"
<<
endl
<<
" width: 200"
<<
endl
<<
" height: 200"
<<
endl
<<
" Text {"
<<
endl
<<
" x: 66"
<<
endl
<<
" y: 93"
<<
endl
<<
" text:
\"
Hello World
\"
"
<<
endl
<<
" }"
<<
endl
<<
"}"
<<
endl
;
}
Core
::
GeneratedFile
generatedMainFile
(
mainFileName
);
generatedMainFile
.
setContents
(
contents
);
QString
projectContents
;
{
QTextStream
out
(
&
projectContents
);
out
<<
"import QmlProject 1.0"
<<
endl
<<
"Project {"
<<
endl
<<
" QmlFiles {"
<<
endl
<<
" directory:
\"
.
\"
"
<<
endl
<<
" }"
<<
endl
<<
"}"
<<
endl
;
}
Core
::
GeneratedFile
generatedCreatorFile
(
creatorFileName
);
generatedCreatorFile
.
setContents
(
projectName
+
QLatin1String
(
".qml
\n
"
));
generatedCreatorFile
.
setContents
(
projectContents
);
Core
::
GeneratedFiles
files
;
files
.
append
(
generatedMainFile
);
...
...
src/plugins/qmlprojectmanager/qmlprojectwizard.cpp
View file @
f3cf0c36
...
...
@@ -117,48 +117,6 @@ QWizard *QmlProjectWizard::createWizardDialog(QWidget *parent,
return
wizard
;
}
void
QmlProjectWizard
::
getFileList
(
const
QDir
&
dir
,
const
QString
&
projectRoot
,
const
QStringList
&
suffixes
,
QStringList
*
files
,
QStringList
*
paths
)
const
{
const
QFileInfoList
fileInfoList
=
dir
.
entryInfoList
(
QDir
::
Files
|
QDir
::
Dirs
|
QDir
::
NoDotAndDotDot
|
QDir
::
NoSymLinks
);
foreach
(
const
QFileInfo
&
fileInfo
,
fileInfoList
)
{
QString
filePath
=
fileInfo
.
absoluteFilePath
();
filePath
=
filePath
.
mid
(
projectRoot
.
length
()
+
1
);
if
(
fileInfo
.
isDir
()
&&
isValidDir
(
fileInfo
))
{
getFileList
(
QDir
(
fileInfo
.
absoluteFilePath
()),
projectRoot
,
suffixes
,
files
,
paths
);
if
(
!
paths
->
contains
(
filePath
))
paths
->
append
(
filePath
);
}
else
if
(
suffixes
.
contains
(
fileInfo
.
suffix
()))
files
->
append
(
filePath
);
}
}
bool
QmlProjectWizard
::
isValidDir
(
const
QFileInfo
&
fileInfo
)
const
{
const
QString
fileName
=
fileInfo
.
fileName
();
const
QString
suffix
=
fileInfo
.
suffix
();
if
(
fileName
.
startsWith
(
QLatin1Char
(
'.'
)))
return
false
;
else
if
(
fileName
==
QLatin1String
(
"CVS"
))
return
false
;
// ### user include/exclude
return
true
;
}
Core
::
GeneratedFiles
QmlProjectWizard
::
generateFiles
(
const
QWizard
*
w
,
QString
*
errorMessage
)
const
{
...
...
@@ -170,16 +128,21 @@ Core::GeneratedFiles QmlProjectWizard::generateFiles(const QWizard *w,
const
QString
projectName
=
wizard
->
projectName
();
const
QString
creatorFileName
=
QFileInfo
(
dir
,
projectName
+
QLatin1String
(
".qmlproject"
)).
absoluteFilePath
();
Core
::
ICore
*
core
=
Core
::
ICore
::
instance
();
Core
::
MimeDatabase
*
mimeDatabase
=
core
->
mimeDatabase
();
const
QStringList
suffixes
=
mimeDatabase
->
suffixes
();
QStringList
sources
,
paths
;
getFileList
(
dir
,
projectPath
,
suffixes
,
&
sources
,
&
paths
);
QString
projectContents
;
{
QTextStream
out
(
&
projectContents
);
out
<<
"import QmlProject 1.0"
<<
endl
<<
"Project {"
<<
endl
<<
" QmlFiles {"
<<
endl
<<
" directory:
\"
.
\"
"
<<
endl
<<
" recursive: true"
<<
endl
<<
" }"
<<
endl
<<
"}"
<<
endl
;
}
Core
::
GeneratedFile
generatedCreatorFile
(
creatorFileName
);
generatedCreatorFile
.
setContents
(
sources
.
join
(
QLatin1String
(
"
\n
"
))
);
generatedCreatorFile
.
setContents
(
projectContents
);
Core
::
GeneratedFiles
files
;
files
.
append
(
generatedCreatorFile
);
...
...
src/plugins/qmlprojectmanager/qmlprojectwizard.h
View file @
f3cf0c36
...
...
@@ -84,13 +84,6 @@ protected:
QString
*
errorMessage
)
const
;
virtual
bool
postGenerateFiles
(
const
Core
::
GeneratedFiles
&
l
,
QString
*
errorMessage
);
bool
isValidDir
(
const
QFileInfo
&
fileInfo
)
const
;
void
getFileList
(
const
QDir
&
dir
,
const
QString
&
projectRoot
,
const
QStringList
&
suffixes
,
QStringList
*
files
,
QStringList
*
paths
)
const
;
};
}
// end of namespace Internal
...
...
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