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
cead4f39
Commit
cead4f39
authored
Nov 30, 2010
by
Christian Kandeler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Maemo: Set Qemu environment once instead of at every start.
Reviewed-by: kh1
parent
233081aa
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
30 additions
and
36 deletions
+30
-36
src/plugins/qt4projectmanager/qt-maemo/maemoqemumanager.cpp
src/plugins/qt4projectmanager/qt-maemo/maemoqemumanager.cpp
+1
-15
src/plugins/qt4projectmanager/qt-maemo/maemoqemuruntime.h
src/plugins/qt4projectmanager/qt-maemo/maemoqemuruntime.h
+2
-2
src/plugins/qt4projectmanager/qt-maemo/maemoqemuruntimeparser.cpp
...ins/qt4projectmanager/qt-maemo/maemoqemuruntimeparser.cpp
+24
-14
src/plugins/qt4projectmanager/qt-maemo/maemoqemuruntimeparser.h
...ugins/qt4projectmanager/qt-maemo/maemoqemuruntimeparser.h
+3
-5
No files found.
src/plugins/qt4projectmanager/qt-maemo/maemoqemumanager.cpp
View file @
cead4f39
...
...
@@ -353,22 +353,8 @@ void MaemoQemuManager::startRuntime()
m_runningQtId
=
version
->
uniqueId
();
const
MaemoQemuRuntime
rt
=
m_runtimes
.
value
(
version
->
uniqueId
());
QProcessEnvironment
env
=
QProcessEnvironment
::
systemEnvironment
();
#ifdef Q_OS_WIN
const
QString
root
=
QDir
::
toNativeSeparators
(
MaemoGlobal
::
maddeRoot
(
version
->
qmakeCommand
())
+
QLatin1Char
(
'/'
));
const
QLatin1Char
colon
(
';'
);
const
QLatin1String
key
(
"PATH"
);
env
.
insert
(
key
,
root
%
QLatin1String
(
"bin"
)
%
colon
%
env
.
value
(
key
));
env
.
insert
(
key
,
root
%
QLatin1String
(
"madlib"
)
%
colon
%
env
.
value
(
key
));
#endif
for
(
QHash
<
QString
,
QString
>::
ConstIterator
it
=
rt
.
m_environment
.
constBegin
();
it
!=
rt
.
m_environment
.
constEnd
();
++
it
)
env
.
insert
(
it
.
key
(),
it
.
value
());
m_qemuProcess
->
setProcessEnvironment
(
env
);
m_qemuProcess
->
setProcessEnvironment
(
rt
.
m_environment
);
m_qemuProcess
->
setWorkingDirectory
(
rt
.
m_root
);
m_qemuProcess
->
start
(
rt
.
m_bin
%
QLatin1Char
(
' '
)
%
rt
.
m_args
);
if
(
!
m_qemuProcess
->
waitForStarted
())
return
;
...
...
src/plugins/qt4projectmanager/qt-maemo/maemoqemuruntime.h
View file @
cead4f39
...
...
@@ -31,7 +31,7 @@
#include "maemodeviceconfigurations.h"
#include <QtCore/Q
Hash
>
#include <QtCore/Q
ProcessEnvironment
>
#include <QtCore/QString>
namespace
Qt4ProjectManager
{
...
...
@@ -59,7 +59,7 @@ struct MaemoQemuRuntime
QString
m_args
;
QString
m_sshPort
;
QString
m_watchPath
;
Q
Hash
<
QString
,
QString
>
m_environment
;
Q
ProcessEnvironment
m_environment
;
MaemoPortList
m_freePorts
;
};
...
...
src/plugins/qt4projectmanager/qt-maemo/maemoqemuruntimeparser.cpp
View file @
cead4f39
...
...
@@ -50,29 +50,29 @@ public:
private:
void
fillRuntimeInformation
(
MaemoQemuRuntime
*
runtime
)
const
;
void
setEnvironment
(
MaemoQemuRuntime
*
runTime
,
const
QString
&
envSpec
)
const
;
const
QString
m_maddeRoot
;
};
class
MaemoQemuRuntimeParserV2
:
public
MaemoQemuRuntimeParser
{
public:
MaemoQemuRuntimeParserV2
(
const
QString
&
madInfoOutput
,
const
QString
&
targetName
);
const
QString
&
targetName
,
const
QString
&
maddeRoot
);
MaemoQemuRuntime
parseRuntime
();
private:
void
handleTargetTag
(
QString
&
runtimeName
);
MaemoQemuRuntime
handleRuntimeTag
();
Q
Hash
<
QString
,
QString
>
handleEnvironmentTag
();
Q
ProcessEnvironment
handleEnvironmentTag
();
QPair
<
QString
,
QString
>
handleVariableTag
();
MaemoPortList
handleTcpPortListTag
();
int
handlePortTag
();
};
MaemoQemuRuntimeParser
::
MaemoQemuRuntimeParser
(
const
QString
&
madInfoOutput
,
const
QString
&
targetName
)
:
m_madInfoReader
(
madInfoOutput
),
m_targetName
(
targetName
)
const
QString
&
targetName
,
const
QString
&
maddeRoot
)
:
m_targetName
(
targetName
),
m_maddeRoot
(
maddeRoot
),
m_madInfoReader
(
madInfoOutput
)
{
}
...
...
@@ -92,7 +92,8 @@ MaemoQemuRuntime MaemoQemuRuntimeParser::parseRuntime(const QtVersion *qtVersion
const
QByteArray
&
madInfoOutput
=
madProc
.
readAllStandardOutput
();
const
QString
&
targetName
=
MaemoGlobal
::
targetName
(
qtVersion
->
qmakeCommand
());
runtime
=
MaemoQemuRuntimeParserV2
(
madInfoOutput
,
targetName
).
parseRuntime
();
runtime
=
MaemoQemuRuntimeParserV2
(
madInfoOutput
,
targetName
,
maddeRootPath
)
.
parseRuntime
();
if
(
!
runtime
.
m_name
.
isEmpty
())
{
runtime
.
m_root
=
maddeRootPath
+
QLatin1String
(
"/runtimes/"
)
+
runtime
.
m_name
;
...
...
@@ -111,7 +112,7 @@ MaemoQemuRuntime MaemoQemuRuntimeParser::parseRuntime(const QtVersion *qtVersion
MaemoQemuRuntimeParserV1
::
MaemoQemuRuntimeParserV1
(
const
QString
&
madInfoOutput
,
const
QString
&
targetName
,
const
QString
&
maddeRoot
)
:
MaemoQemuRuntimeParser
(
madInfoOutput
,
targetName
)
,
m_maddeRoot
(
maddeRoot
)
:
MaemoQemuRuntimeParser
(
madInfoOutput
,
targetName
,
maddeRoot
)
{
}
...
...
@@ -124,7 +125,7 @@ MaemoQemuRuntime MaemoQemuRuntimeParserV1::parseRuntime()
if
(
targetRuntime
.
isEmpty
()
&&
m_madInfoReader
.
name
()
==
QLatin1String
(
"target"
))
{
const
QXmlStreamAttributes
&
attrs
=
m_madInfoReader
.
attributes
();
if
(
attrs
.
value
(
QLatin1String
(
"target_id"
))
==
targetName
()
)
if
(
attrs
.
value
(
QLatin1String
(
"target_id"
))
==
m_
targetName
)
targetRuntime
=
attrs
.
value
(
"runtime_id"
).
toString
();
}
else
if
(
m_madInfoReader
.
name
()
==
QLatin1String
(
"runtime"
))
{
const
QXmlStreamAttributes
attrs
=
m_madInfoReader
.
attributes
();
...
...
@@ -216,6 +217,7 @@ void MaemoQemuRuntimeParserV1::setEnvironment(MaemoQemuRuntime *runTime,
{
QString
remainingEnvSpec
=
envSpec
;
QString
currentKey
;
runTime
->
m_environment
=
QProcessEnvironment
::
systemEnvironment
();
while
(
true
)
{
const
int
nextEqualsSignPos
=
remainingEnvSpec
.
indexOf
(
QLatin1Char
(
'='
));
...
...
@@ -242,8 +244,8 @@ void MaemoQemuRuntimeParserV1::setEnvironment(MaemoQemuRuntime *runTime,
MaemoQemuRuntimeParserV2
::
MaemoQemuRuntimeParserV2
(
const
QString
&
madInfoOutput
,
const
QString
&
targetName
)
:
MaemoQemuRuntimeParser
(
madInfoOutput
,
targetName
)
const
QString
&
targetName
,
const
QString
&
maddeRoot
)
:
MaemoQemuRuntimeParser
(
madInfoOutput
,
targetName
,
maddeRoot
)
{
}
...
...
@@ -282,7 +284,7 @@ void MaemoQemuRuntimeParserV2::handleTargetTag(QString &runtimeName)
{
const
QXmlStreamAttributes
&
attrs
=
m_madInfoReader
.
attributes
();
if
(
m_madInfoReader
.
name
()
==
QLatin1String
(
"target"
)
&&
runtimeName
.
isEmpty
()
&&
attrs
.
value
(
QLatin1String
(
"name"
))
==
targetName
()
&&
attrs
.
value
(
QLatin1String
(
"name"
))
==
m_
targetName
&&
attrs
.
value
(
QLatin1String
(
"installed"
))
==
QLatin1String
(
"true"
))
{
while
(
m_madInfoReader
.
readNextStartElement
())
{
if
(
m_madInfoReader
.
name
()
==
QLatin1String
(
"runtime"
))
...
...
@@ -321,14 +323,22 @@ MaemoQemuRuntime MaemoQemuRuntimeParserV2::handleRuntimeTag()
return
runtime
;
}
Q
Hash
<
QString
,
QString
>
MaemoQemuRuntimeParserV2
::
handleEnvironmentTag
()
Q
ProcessEnvironment
MaemoQemuRuntimeParserV2
::
handleEnvironmentTag
()
{
Q
Hash
<
QString
,
QString
>
env
;
Q
ProcessEnvironment
env
=
QProcessEnvironment
::
systemEnvironment
()
;
while
(
m_madInfoReader
.
readNextStartElement
())
{
const
QPair
<
QString
,
QString
>
&
var
=
handleVariableTag
();
if
(
!
var
.
first
.
isEmpty
())
env
.
insert
(
var
.
first
,
var
.
second
);
}
#ifdef Q_OS_WIN
const
QString
root
=
QDir
::
toNativeSeparators
(
m_maddeRoot
)
+
QLatin1Char
(
'/'
);
const
QLatin1Char
colon
(
';'
);
const
QLatin1String
key
(
"PATH"
);
env
.
insert
(
key
,
root
+
QLatin1String
(
"bin"
)
+
colon
+
env
.
value
(
key
));
env
.
insert
(
key
,
root
+
QLatin1String
(
"madlib"
)
+
colon
+
env
.
value
(
key
));
#endif
return
env
;
}
...
...
src/plugins/qt4projectmanager/qt-maemo/maemoqemuruntimeparser.h
View file @
cead4f39
...
...
@@ -45,13 +45,11 @@ public:
protected:
MaemoQemuRuntimeParser
(
const
QString
&
madInfoOutput
,
const
QString
&
targetName
);
const
QString
&
targetName
()
const
{
return
m_targetName
;
}
const
QString
&
targetName
,
const
QString
&
maddeRoot
);
QXmlStreamReader
m_madInfoReader
;
private:
const
QString
m_targetName
;
const
QString
m_maddeRoot
;
QXmlStreamReader
m_madInfoReader
;
};
}
// namespace Internal
...
...
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