Skip to content
GitLab
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
60991499
Commit
60991499
authored
May 19, 2010
by
ck
Browse files
Maemo: Give more information to user about Qemu state.
Reviewed-by: kh1
parent
04840b0e
Changes
6
Hide whitespace changes
Inline
Side-by-side
src/plugins/qt4projectmanager/qt-maemo/maemoconstants.h
View file @
60991499
...
...
@@ -34,8 +34,12 @@
#ifndef MAEMOCONSTANTS_H
#define MAEMOCONSTANTS_H
#include
<QLatin1String>
namespace
Qt4ProjectManager
{
namespace
Internal
{
namespace
Internal
{
enum
QemuStatus
{
QemuStarting
,
QemuFailedToStart
,
QemuFinished
,
QemuCrashed
};
#define PREFIX "Qt4ProjectManager.MaemoRunConfiguration"
...
...
@@ -49,7 +53,7 @@ static const QLatin1String LastDeployedKey(PREFIX ".LastDeployed");
static
const
QLatin1String
DebuggingHelpersLastDeployedKey
(
PREFIX
".DebuggingHelpersLastDeployed"
);
static
const
QLatin1String
ProFileKey
(
".ProFile"
);
}
// namespace Internal
}
// namespace Internal
}
// namespace Qt4ProjectManager
#endif // MAEMOCONSTANTS_H
src/plugins/qt4projectmanager/qt-maemo/maemomanager.cpp
View file @
60991499
...
...
@@ -51,6 +51,7 @@
#include
<QtCore/QTextStream>
#include
<QtGui/QAction>
#include
<QtGui/QMessageBox>
namespace
Qt4ProjectManager
{
namespace
Internal
{
...
...
@@ -187,20 +188,55 @@ MaemoManager::triggered()
}
void
MaemoManager
::
updateQemuSimulatorStarter
(
bool
running
)
MaemoManager
::
qemuStatusChanged
(
QemuStatus
status
,
const
QString
&
error
)
{
if
(
m_qemuAction
)
{
QIcon
::
State
state
=
QIcon
::
Off
;
QString
toolTip
(
tr
(
"Start Maemo Emulator"
));
if
(
running
)
{
state
=
QIcon
::
On
;
toolTip
=
tr
(
"Stop Maemo Emulator"
);
}
if
(
!
m_qemuAction
)
return
;
m_qemuAction
->
setToolTip
(
toolTip
);
m_qemuAction
->
setIcon
(
icon
.
pixmap
(
iconSize
,
QIcon
::
Normal
,
state
));
bool
running
;
QString
message
;
switch
(
status
)
{
case
QemuStarting
:
running
=
true
;
break
;
case
QemuFailedToStart
:
running
=
false
;
message
=
tr
(
"Qemu failed to start: %1"
).
arg
(
error
);
break
;
case
QemuCrashed
:
running
=
false
;
message
=
tr
(
"Qemu crashed"
);
break
;
case
QemuFinished
:
running
=
false
;
break
;
default:
Q_ASSERT
(
!
"Missing handling of Qemu status"
);
}
if
(
!
message
.
isEmpty
())
QMessageBox
::
warning
(
0
,
tr
(
"Qemu error"
),
message
);
updateQemuIcon
(
running
);
}
void
MaemoManager
::
updateQemuIcon
(
bool
running
)
{
if
(
!
m_qemuAction
)
return
;
QIcon
::
State
state
;
QString
toolTip
;
if
(
running
)
{
state
=
QIcon
::
On
;
toolTip
=
tr
(
"Stop Maemo Emulator"
);
}
else
{
state
=
QIcon
::
Off
;
toolTip
=
tr
(
"Start Maemo Emulator"
);
}
m_qemuAction
->
setToolTip
(
toolTip
);
m_qemuAction
->
setIcon
(
icon
.
pixmap
(
iconSize
,
QIcon
::
Normal
,
state
));
}
}
// namespace Internal
}
// namespace Internal
}
// namespace Qt4ProjectManager
src/plugins/qt4projectmanager/qt-maemo/maemomanager.h
View file @
60991499
...
...
@@ -30,6 +30,8 @@
#ifndef MAEMOMANAGER_H
#define MAEMOMANAGER_H
#include
"maemoconstants.h"
#include
<QtCore/QObject>
#include
<QtCore/QSet>
...
...
@@ -69,12 +71,13 @@ public:
void
removeQemuSimulatorStarter
(
Project
*
project
);
void
setQemuSimulatorStarterEnabled
(
bool
state
);
void
updateQemuIcon
(
bool
running
);
MaemoSettingsPage
*
settingsPage
()
const
{
return
m_settingsPage
;
}
public
slots
:
void
triggered
();
void
updateQemuSimulatorStarter
(
bool
running
);
void
qemuStatusChanged
(
QemuStatus
status
,
const
QString
&
error
);
signals:
void
startStopQemu
();
...
...
src/plugins/qt4projectmanager/qt-maemo/maemorunconfiguration.cpp
View file @
60991499
...
...
@@ -100,13 +100,16 @@ void MaemoRunConfiguration::init()
this
,
SLOT
(
proFileUpdate
(
Qt4ProjectManager
::
Internal
::
Qt4ProFileNode
*
)));
qemu
=
new
QProcess
(
this
);
connect
(
qemu
,
SIGNAL
(
error
(
QProcess
::
ProcessError
)),
this
,
SLOT
(
qemuProcessError
(
QProcess
::
ProcessError
)));
connect
(
qemu
,
SIGNAL
(
finished
(
int
,
QProcess
::
ExitStatus
)),
this
,
SLOT
(
qemuProcessFinished
()));
connect
(
&
MaemoManager
::
instance
(),
SIGNAL
(
startStopQemu
()),
this
,
SLOT
(
startStopQemu
()));
connect
(
this
,
SIGNAL
(
qemuProcessStatus
(
bool
)),
&
MaemoManager
::
instance
(),
SLOT
(
updateQemuSimulatorStarter
(
bool
)));
connect
(
this
,
SIGNAL
(
qemuProcessStatus
(
QemuStatus
,
QString
)),
&
MaemoManager
::
instance
(),
SLOT
(
qemuStatusChanged
(
QemuStatus
,
QString
)));
}
MaemoRunConfiguration
::~
MaemoRunConfiguration
()
...
...
@@ -475,7 +478,6 @@ void MaemoRunConfiguration::startStopQemu()
if
(
qemu
->
state
()
==
QProcess
::
Running
)
{
qemu
->
terminate
();
qemu
->
kill
();
emit
qemuProcessStatus
(
false
);
}
return
;
}
...
...
@@ -505,12 +507,20 @@ void MaemoRunConfiguration::startStopQemu()
;
// keep
qemu
->
start
(
app
%
QLatin1Char
(
' '
)
%
simulatorArgs
(),
QIODevice
::
ReadWrite
);
emit
qemuProcessStatus
(
q
emu
->
waitFor
Start
ed
()
);
emit
qemuProcessStatus
(
Q
emuStart
ing
);
}
void
MaemoRunConfiguration
::
qemuProcessFinished
()
{
emit
qemuProcessStatus
(
false
);
const
QemuStatus
status
=
qemu
->
exitStatus
()
==
QProcess
::
CrashExit
?
QemuCrashed
:
QemuFinished
;
emit
qemuProcessStatus
(
status
);
}
void
MaemoRunConfiguration
::
qemuProcessError
(
QProcess
::
ProcessError
error
)
{
if
(
error
==
QProcess
::
FailedToStart
)
emit
qemuProcessStatus
(
QemuFailedToStart
,
qemu
->
errorString
());
}
void
MaemoRunConfiguration
::
updateDeviceConfigurations
()
...
...
src/plugins/qt4projectmanager/qt-maemo/maemorunconfiguration.h
View file @
60991499
...
...
@@ -30,11 +30,13 @@
#ifndef MAEMORUNCONFIGURATION_H
#define MAEMORUNCONFIGURATION_H
#include
"maemoconstants.h"
#include
"maemodeviceconfigurations.h"
#include
<projectexplorer/runconfiguration.h>
#include
<QtCore/QDateTime>
#include
<QtCore/QProcess>
#include
<QtCore/QStringList>
QT_FORWARD_DECLARE_CLASS
(
QProcess
)
...
...
@@ -108,7 +110,7 @@ signals:
void
deviceConfigurationChanged
(
ProjectExplorer
::
Target
*
target
);
void
targetInformationChanged
()
const
;
void
cachedSimulatorInformationChanged
()
const
;
void
qemuProcessStatus
(
bool
runn
ing
);
void
qemuProcessStatus
(
QemuStatus
,
const
QString
&
error
=
QStr
ing
()
);
protected:
MaemoRunConfiguration
(
Qt4Target
*
parent
,
MaemoRunConfiguration
*
source
);
...
...
@@ -120,6 +122,7 @@ private slots:
void
startStopQemu
();
void
qemuProcessFinished
();
void
qemuProcessError
(
QProcess
::
ProcessError
error
);
private:
void
init
();
...
...
src/plugins/qt4projectmanager/qt-maemo/maemorunfactories.cpp
View file @
60991499
...
...
@@ -243,7 +243,7 @@ void MaemoRunConfigurationFactory::updateMaemoEmulatorStarter(Target *target) co
}
}
MaemoManager
::
instance
().
updateQemu
SimulatorStarter
(
isRunning
);
MaemoManager
::
instance
().
updateQemu
Icon
(
isRunning
);
MaemoManager
::
instance
().
setQemuSimulatorStarterEnabled
(
enable
);
}
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment