Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
flatpak-qt-creator
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Marco Bubke
flatpak-qt-creator
Commits
99272496
Commit
99272496
authored
14 years ago
by
ck
Browse files
Options
Downloads
Patches
Plain Diff
Maemo: Qemu improvements.
Get rid of redundancy, add sanity check, better status reporting.
parent
c95d83d6
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/plugins/qt4projectmanager/qt-maemo/qemuruntimemanager.cpp
+54
-40
54 additions, 40 deletions
...plugins/qt4projectmanager/qt-maemo/qemuruntimemanager.cpp
src/plugins/qt4projectmanager/qt-maemo/qemuruntimemanager.h
+3
-1
3 additions, 1 deletion
src/plugins/qt4projectmanager/qt-maemo/qemuruntimemanager.h
with
57 additions
and
41 deletions
src/plugins/qt4projectmanager/qt-maemo/qemuruntimemanager.cpp
+
54
−
40
View file @
99272496
...
...
@@ -110,6 +110,10 @@ QemuRuntimeManager::QemuRuntimeManager(QObject *parent)
SLOT
(
qemuProcessError
(
QProcess
::
ProcessError
)));
connect
(
m_qemuProcess
,
SIGNAL
(
finished
(
int
,
QProcess
::
ExitStatus
)),
this
,
SLOT
(
qemuProcessFinished
()));
connect
(
m_qemuProcess
,
SIGNAL
(
readyReadStandardOutput
()),
this
,
SLOT
(
qemuOutput
()));
connect
(
m_qemuProcess
,
SIGNAL
(
readyReadStandardError
()),
this
,
SLOT
(
qemuOutput
()));
connect
(
this
,
SIGNAL
(
qemuProcessStatus
(
QemuStatus
,
QString
)),
this
,
SLOT
(
qemuStatusChanged
(
QemuStatus
,
QString
)));
}
...
...
@@ -285,7 +289,7 @@ void QemuRuntimeManager::runConfigurationRemoved(ProjectExplorer::RunConfigurati
void
QemuRuntimeManager
::
runConfigurationChanged
(
ProjectExplorer
::
RunConfiguration
*
rc
)
{
if
(
rc
)
m_qemuAction
->
setEnabled
(
targetUsesRuntimeConfig
(
rc
->
target
()));
m_qemuAction
->
setEnabled
(
targetUses
Matching
RuntimeConfig
(
rc
->
target
()));
}
void
QemuRuntimeManager
::
buildConfigurationAdded
(
ProjectExplorer
::
BuildConfiguration
*
bc
)
...
...
@@ -321,7 +325,7 @@ void QemuRuntimeManager::environmentChanged()
void
QemuRuntimeManager
::
deviceConfigurationChanged
(
ProjectExplorer
::
Target
*
target
)
{
m_qemuAction
->
setEnabled
(
targetUsesRuntimeConfig
(
target
));
m_qemuAction
->
setEnabled
(
targetUses
Matching
RuntimeConfig
(
target
));
}
void
QemuRuntimeManager
::
startRuntime
()
...
...
@@ -330,38 +334,33 @@ void QemuRuntimeManager::startRuntime()
Project
*
p
=
ProjectExplorerPlugin
::
instance
()
->
session
()
->
startupProject
();
if
(
!
p
)
return
;
Qt4Target
*
qt4Target
=
qobject_cast
<
Qt4Target
*>
(
p
->
activeTarget
());
if
(
!
qt4Target
)
return
;
Qt4BuildConfiguration
*
bc
=
qt4Target
->
activeBuildConfiguration
();
if
(
!
bc
)
QtVersion
*
version
;
if
(
!
targetUsesMatchingRuntimeConfig
(
p
->
activeTarget
(),
&
version
))
{
qWarning
(
"Strange: Qemu button was enabled, but target does not match."
);
return
;
}
QtVersion
*
version
=
bc
->
qtVersion
();
if
(
version
&&
m_runtimes
.
contains
(
version
->
uniqueId
()))
{
m_runningQtId
=
version
->
uniqueId
();
const
QString
root
=
QDir
::
toNativeSeparators
(
maddeRoot
(
version
->
qmakeCommand
())
m_runningQtId
=
version
->
uniqueId
();
const
QString
root
=
QDir
::
toNativeSeparators
(
maddeRoot
(
version
->
qmakeCommand
())
+
QLatin1Char
(
'/'
));
const
Runtime
rt
=
m_runtimes
.
value
(
version
->
uniqueId
());
QProcessEnvironment
env
=
QProcessEnvironment
::
systemEnvironment
();
const
Runtime
rt
=
m_runtimes
.
value
(
version
->
uniqueId
());
QProcessEnvironment
env
=
QProcessEnvironment
::
systemEnvironment
();
#ifdef Q_OS_WIN
const
QLatin1Char
colon
(
';'
);
const
QLatin1String
key
(
"PATH"
);
env
.
insert
(
key
,
env
.
value
(
key
)
%
colon
%
root
%
QLatin1String
(
"bin"
));
env
.
insert
(
key
,
env
.
value
(
key
)
%
colon
%
root
%
QLatin1String
(
"madlib"
));
const
QLatin1Char
colon
(
';'
);
const
QLatin1String
key
(
"PATH"
);
env
.
insert
(
key
,
env
.
value
(
key
)
%
colon
%
root
%
QLatin1String
(
"bin"
));
env
.
insert
(
key
,
env
.
value
(
key
)
%
colon
%
root
%
QLatin1String
(
"madlib"
));
#elif defined(Q_OS_UNIX)
const
QLatin1String
key
(
"LD_LIBRARY_PATH"
);
env
.
insert
(
key
,
env
.
value
(
key
)
%
QLatin1Char
(
':'
)
%
rt
.
m_libPath
);
const
QLatin1String
key
(
"LD_LIBRARY_PATH"
);
env
.
insert
(
key
,
env
.
value
(
key
)
%
QLatin1Char
(
':'
)
%
rt
.
m_libPath
);
#endif
m_qemuProcess
->
setProcessEnvironment
(
env
);
m_qemuProcess
->
setWorkingDirectory
(
rt
.
m_root
);
m_qemuProcess
->
setProcessEnvironment
(
env
);
m_qemuProcess
->
setWorkingDirectory
(
rt
.
m_root
);
// This is complex because of extreme MADDE weirdness.
const
bool
pathIsRelative
=
QFileInfo
(
rt
.
m_bin
).
isRelative
();
const
QString
app
=
// This is complex because of extreme MADDE weirdness.
const
bool
pathIsRelative
=
QFileInfo
(
rt
.
m_bin
).
isRelative
();
const
QString
app
=
#ifdef Q_OS_WIN
root
%
(
pathIsRelative
?
QLatin1String
(
"madlib/"
)
%
rt
.
m_bin
// Fremantle.
...
...
@@ -373,15 +372,14 @@ void QemuRuntimeManager::startRuntime()
:
rt
.
m_bin
;
// Haramattan.
#endif
m_qemuProcess
->
start
(
app
%
QLatin1Char
(
' '
)
%
rt
.
m_args
,
QIODevice
::
ReadWrite
);
if
(
!
m_qemuProcess
->
waitForStarted
())
return
;
m_qemuProcess
->
start
(
app
%
QLatin1Char
(
' '
)
%
rt
.
m_args
,
QIODevice
::
ReadWrite
);
if
(
!
m_qemuProcess
->
waitForStarted
())
return
;
emit
qemuProcessStatus
(
QemuStarting
);
connect
(
m_qemuAction
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
terminateRuntime
()));
disconnect
(
m_qemuAction
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
startRuntime
()));
}
emit
qemuProcessStatus
(
QemuStarting
);
connect
(
m_qemuAction
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
terminateRuntime
()));
disconnect
(
m_qemuAction
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
startRuntime
()));
}
void
QemuRuntimeManager
::
terminateRuntime
()
...
...
@@ -401,14 +399,20 @@ void QemuRuntimeManager::qemuProcessFinished()
{
m_runningQtId
=
-
1
;
QemuStatus
status
=
QemuFinished
;
QString
error
;
if
(
!
m_userTerminated
)
{
status
=
m_qemuProcess
->
exitStatus
()
==
QProcess
::
CrashExit
?
QemuCrashed
:
QemuFinished
;
if
(
m_qemuProcess
->
exitStatus
()
==
QProcess
::
CrashExit
)
{
status
=
QemuCrashed
;
error
=
m_qemuProcess
->
errorString
();
}
else
if
(
m_qemuProcess
->
exitCode
()
!=
0
)
{
error
=
tr
(
"Qemu finished with error: Exit code was %1."
)
.
arg
(
m_qemuProcess
->
exitCode
());
}
}
m_userTerminated
=
false
;
emit
qemuProcessStatus
(
status
);
emit
qemuProcessStatus
(
status
,
error
);
}
void
QemuRuntimeManager
::
qemuProcessError
(
QProcess
::
ProcessError
error
)
...
...
@@ -433,6 +437,7 @@ void QemuRuntimeManager::qemuStatusChanged(QemuStatus status, const QString &err
message
=
tr
(
"Qemu crashed"
);
break
;
case
QemuFinished
:
message
=
error
;
break
;
case
QemuUserReason
:
message
=
error
;
...
...
@@ -446,6 +451,12 @@ void QemuRuntimeManager::qemuStatusChanged(QemuStatus status, const QString &err
updateStarterIcon
(
running
);
}
void
QemuRuntimeManager
::
qemuOutput
()
{
qDebug
(
"%s"
,
m_qemuProcess
->
readAllStandardOutput
().
data
());
qDebug
(
"%s"
,
m_qemuProcess
->
readAllStandardError
().
data
());
}
// -- private
void
QemuRuntimeManager
::
setupRuntimes
()
...
...
@@ -498,7 +509,7 @@ void QemuRuntimeManager::toggleStarterButton(Target *target)
isRunning
=
false
;
m_qemuAction
->
setEnabled
(
m_runtimes
.
contains
(
uniqueId
)
&&
targetUsesRuntimeConfig
(
target
)
&&
!
isRunning
);
&&
targetUses
Matching
RuntimeConfig
(
target
)
&&
!
isRunning
);
}
bool
QemuRuntimeManager
::
sessionHasMaemoTarget
()
const
...
...
@@ -511,7 +522,8 @@ bool QemuRuntimeManager::sessionHasMaemoTarget() const
return
result
;
}
bool
QemuRuntimeManager
::
targetUsesRuntimeConfig
(
Target
*
target
)
bool
QemuRuntimeManager
::
targetUsesMatchingRuntimeConfig
(
Target
*
target
,
QtVersion
**
qtVersion
)
{
if
(
!
target
)
return
false
;
...
...
@@ -528,6 +540,8 @@ bool QemuRuntimeManager::targetUsesRuntimeConfig(Target *target)
if
(
!
version
||
!
m_runtimes
.
contains
(
version
->
uniqueId
()))
return
false
;
if
(
qtVersion
)
*
qtVersion
=
version
;
const
MaemoDeviceConfig
&
config
=
mrc
->
deviceConfig
();
return
config
.
isValid
()
&&
config
.
type
==
MaemoDeviceConfig
::
Simulator
;
}
...
...
This diff is collapsed.
Click to expand it.
src/plugins/qt4projectmanager/qt-maemo/qemuruntimemanager.h
+
3
−
1
View file @
99272496
...
...
@@ -110,6 +110,7 @@ private slots:
void
qemuProcessFinished
();
void
qemuProcessError
(
QProcess
::
ProcessError
error
);
void
qemuStatusChanged
(
QemuStatus
status
,
const
QString
&
error
);
void
qemuOutput
();
private:
void
setupRuntimes
();
...
...
@@ -117,7 +118,8 @@ private:
void
updateStarterIcon
(
bool
running
);
void
toggleStarterButton
(
ProjectExplorer
::
Target
*
target
);
bool
targetUsesRuntimeConfig
(
ProjectExplorer
::
Target
*
target
);
bool
targetUsesMatchingRuntimeConfig
(
ProjectExplorer
::
Target
*
target
,
QtVersion
**
qtVersion
=
0
);
QString
maddeRoot
(
const
QString
&
qmake
)
const
;
QString
targetRoot
(
const
QString
&
qmake
)
const
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment