Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Q
qt-creator
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Tobias Hunger
qt-creator
Commits
08ddd9f9
Commit
08ddd9f9
authored
Nov 16, 2010
by
Daniel Molkentin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move Qt QML projects to pro-based projects
Reviewed-by: dt
parent
7ea4d2bb
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
45 additions
and
21 deletions
+45
-21
src/plugins/qt4projectmanager/gettingstartedwelcomepagewidget.cpp
...ins/qt4projectmanager/gettingstartedwelcomepagewidget.cpp
+45
-21
No files found.
src/plugins/qt4projectmanager/gettingstartedwelcomepagewidget.cpp
View file @
08ddd9f9
...
...
@@ -66,6 +66,7 @@ namespace Internal {
const
char
ExamplePathPropertyName
[]
=
"__qt_ExamplePath"
;
const
char
HelpPathPropertyName
[]
=
"__qt_HelpPath"
;
const
char
QmlMainFileName
[]
=
"__qt_QmlMainFileName"
;
void
PixmapDownloader
::
populatePixmap
(
QNetworkReply
*
reply
)
{
QImage
image
;
...
...
@@ -192,21 +193,32 @@ void GettingStartedWelcomePageWidget::parseXmlFile(QFile *file, QMenuHash &cppSu
const
QString
name
=
reader
.
attributes
().
value
(
QLatin1String
(
"name"
)).
toString
();
const
bool
isQml
=
reader
.
attributes
().
value
(
QLatin1String
(
"qml"
)).
toString
()
==
"true"
;
const
QString
localDir
=
reader
.
attributes
().
value
(
QLatin1String
(
"filename"
)).
toString
();
const
QString
extension
=
isQml
?
QLatin1String
(
".qmlproject"
)
:
QLatin1String
(
".pro"
);
const
QString
fileName
=
localDir
.
section
(
','
,
-
1
);
const
QString
relativeProPath
=
slash
+
dirName
+
slash
+
localDir
+
slash
+
fileName
+
extension
;
const
QString
fileName
=
localDir
.
section
(
'/'
,
-
1
);
QString
replacedFileName
=
fileName
;
replacedFileName
.
replace
(
QLatin1Char
(
'-'
),
QString
());
QString
relativeProPath
=
slash
+
dirName
+
slash
+
localDir
+
slash
+
replacedFileName
;
QString
finaleFileName
=
examplePath
+
relativeProPath
;
if
(
!
QFile
::
exists
(
finaleFileName
))
finaleFileName
=
sourcePath
+
QLatin1String
(
"/examples"
)
+
relativeProPath
;
QString
finalFileName
=
examplePath
+
relativeProPath
+
QLatin1String
(
".pro"
);
if
(
!
QFile
::
exists
(
finaleFileName
))
if
(
!
QFile
::
exists
(
finalFileName
))
finalFileName
=
sourcePath
+
QLatin1String
(
"/examples"
)
+
relativeProPath
+
QLatin1String
(
".pro"
);
if
(
isQml
&&
!
QFile
::
exists
(
finalFileName
))
{
// maybe it's an old-style QML project?
relativeProPath
=
slash
+
dirName
+
slash
+
localDir
+
slash
+
fileName
;
finalFileName
=
examplePath
+
relativeProPath
+
QLatin1String
(
".qmlproject"
);
if
(
!
QFile
::
exists
(
finalFileName
))
finalFileName
=
sourcePath
+
QLatin1String
(
"/examples"
)
+
relativeProPath
+
QLatin1String
(
".qmlproject"
);;
}
if
(
!
QFile
::
exists
(
finalFileName
))
break
;
QString
dirName
1
=
dirName
;
dirName
1
.
replace
(
slash
,
QLatin1Char
(
'-'
));
QString
dirName
forHelp
=
dirName
;
dirName
forHelp
.
replace
(
slash
,
QLatin1Char
(
'-'
));
QString
helpPath
=
QLatin1String
(
"qthelp://com.trolltech.qt/qdoc/"
)
+
dirName
1
+
dirName
forHelp
+
QLatin1Char
(
'-'
)
+
fileName
+
QLatin1String
(
".html"
);
QAction
*
exampleAction
=
0
;
...
...
@@ -231,8 +243,10 @@ void GettingStartedWelcomePageWidget::parseXmlFile(QFile *file, QMenuHash &cppSu
exampleAction
=
new
QAction
(
name
,
subMenu
);
subMenu
->
insertAction
(
beforeAction
,
exampleAction
);
connect
(
exampleAction
,
SIGNAL
(
triggered
()),
SLOT
(
slotOpenExample
()));
exampleAction
->
setProperty
(
ExamplePathPropertyName
,
final
e
FileName
);
exampleAction
->
setProperty
(
ExamplePathPropertyName
,
finalFileName
);
exampleAction
->
setProperty
(
HelpPathPropertyName
,
helpPath
);
if
(
isQml
)
exampleAction
->
setProperty
(
QmlMainFileName
,
fileName
);
}
}
break
;
...
...
@@ -339,6 +353,12 @@ void GettingStartedWelcomePageWidget::slotOpenExample()
QString
helpFile
=
action
->
property
(
HelpPathPropertyName
).
toString
();
QString
proFile
=
action
->
property
(
ExamplePathPropertyName
).
toString
();
QString
qmlMainFileName
;
bool
isQmlProject
=
false
;
if
(
action
->
dynamicPropertyNames
().
contains
(
QmlMainFileName
))
{
qmlMainFileName
=
action
->
property
(
QmlMainFileName
).
toString
();
isQmlProject
=
true
;
}
QStringList
files
;
QFileInfo
proFileInfo
(
proFile
);
...
...
@@ -399,18 +419,22 @@ void GettingStartedWelcomePageWidget::slotOpenExample()
}
}
QString
tryFile
=
proFileInfo
.
path
()
+
"/main.cpp"
;
QString
tryFile
;
files
<<
proFile
;
if
(
!
QFile
::
exists
(
tryFile
))
tryFile
=
proFileInfo
.
path
()
+
'/'
+
proFileInfo
.
baseName
()
+
".cpp"
;
// maybe it's a QML project?
if
(
!
QFile
::
exists
(
tryFile
))
if
(
isQmlProject
)
{
tryFile
=
proFileInfo
.
path
()
+
'/'
+
"/main.qml"
;
if
(
!
QFile
::
exists
(
tryFile
))
tryFile
=
proFileInfo
.
path
()
+
'/'
+
proFileInfo
.
baseName
()
+
".qml"
;
if
(
QFile
::
exists
(
tryFile
))
files
<<
tryFile
;
if
(
!
QFile
::
exists
(
tryFile
))
tryFile
=
proFileInfo
.
path
()
+
"/qml/"
+
qmlMainFileName
+
".qml"
;
// legacy qmlproject case
if
(
!
QFile
::
exists
(
tryFile
))
tryFile
=
proFileInfo
.
path
()
+
'/'
+
qmlMainFileName
+
".qml"
;
if
(
QFile
::
exists
(
tryFile
))
files
<<
tryFile
;
}
else
{
tryFile
=
proFileInfo
.
path
()
+
"/main.cpp"
;
if
(
!
QFile
::
exists
(
tryFile
))
tryFile
=
proFileInfo
.
path
()
+
'/'
+
proFileInfo
.
baseName
()
+
".cpp"
;
}
Core
::
ICore
::
instance
()
->
openFiles
(
files
,
Core
::
ICore
::
SwitchMode
);
if
(
!
helpFile
.
isEmpty
())
slotOpenContextHelpPage
(
helpFile
);
...
...
Write
Preview
Markdown
is supported
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