maemoqemumanager.cpp 18.4 KB
Newer Older
1
2
3
4
/**************************************************************************
**
** This file is part of Qt Creator
**
hjk's avatar
hjk committed
5
** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies).
6
**
Eike Ziller's avatar
Eike Ziller committed
7
** Contact: http://www.qt-project.org/
8
9
10
11
**
**
** GNU Lesser General Public License Usage
**
hjk's avatar
hjk committed
12
13
14
15
16
17
** This file may be used under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation and
** appearing in the file LICENSE.LGPL included in the packaging of this file.
** Please review the following information to ensure the GNU Lesser General
** Public License version 2.1 requirements will be met:
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
18
**
con's avatar
con committed
19
** In addition, as a special exception, Nokia gives you certain additional
hjk's avatar
hjk committed
20
** rights. These rights are described in the Nokia Qt LGPL Exception
con's avatar
con committed
21
22
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
hjk's avatar
hjk committed
23
24
25
26
27
** Other Usage
**
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
28
29
30
**
**************************************************************************/

ck's avatar
ck committed
31
#include "maemoqemumanager.h"
32

33
#include "maemoglobal.h"
34
#include "maemoqemuruntimeparser.h"
35
#include "maemosettingspages.h"
dt's avatar
dt committed
36
#include "maemoqtversion.h"
37
38
39

#include <coreplugin/actionmanager/actionmanager.h>
#include <coreplugin/actionmanager/command.h>
40
#include <coreplugin/id.h>
41
42
#include <coreplugin/coreconstants.h>
#include <coreplugin/icore.h>
43
#include <coreplugin/icontext.h>
44
45
#include <coreplugin/modemanager.h>

Tobias Hunger's avatar
Tobias Hunger committed
46
#include <projectexplorer/buildconfiguration.h>
47
#include <projectexplorer/projectexplorer.h>
48
#include <projectexplorer/project.h>
49
#include <projectexplorer/session.h>
Tobias Hunger's avatar
Tobias Hunger committed
50
51
#include <projectexplorer/target.h>
#include <qtsupport/qtprofileinformation.h>
52
#include <qtsupport/qtversionmanager.h>
53
#include <qt4projectmanager/qt4buildconfiguration.h>
54
#include <remotelinux/linuxdeviceconfiguration.h>
55
#include <remotelinux/remotelinuxrunconfiguration.h>
56
#include <utils/filesystemwatcher.h>
57

58
59
60
61
62
#include <QDebug>
#include <QDir>
#include <QList>
#include <QSet>
#include <QStringBuilder>
63

64
65
66
#include <QAction>
#include <QDesktopServices>
#include <QMessageBox>
67

68
69
#include <limits.h>

70
71
using namespace ProjectExplorer;
using namespace Qt4ProjectManager;
72
using namespace RemoteLinux;
73
74
75

namespace Madde {
namespace Internal {
76

ck's avatar
ck committed
77
MaemoQemuManager *MaemoQemuManager::m_instance = 0;
78
79
80

const QSize iconSize = QSize(24, 20);

ck's avatar
ck committed
81
MaemoQemuManager::MaemoQemuManager(QObject *parent)
82
83
84
    : QObject(parent)
    , m_qemuAction(0)
    , m_qemuProcess(new QProcess(this))
85
    , m_runningQtId(INT_MIN)
86
    , m_userTerminated(false)
87
88
    , m_runtimeRootWatcher(0)
    , m_runtimeFolderWatcher(0)
89
90
91
92
93
{
    m_qemuStarterIcon.addFile(":/qt-maemo/images/qemu-run.png", iconSize);
    m_qemuStarterIcon.addFile(":/qt-maemo/images/qemu-stop.png", iconSize,
        QIcon::Normal, QIcon::On);

94
    m_qemuAction = new QAction("MeeGo Emulator", this);
95
    m_qemuAction->setIcon(m_qemuStarterIcon.pixmap(iconSize));
96
    m_qemuAction->setToolTip(tr("Start MeeGo Emulator"));
97
98
    connect(m_qemuAction, SIGNAL(triggered()), this, SLOT(startRuntime()));

Eike Ziller's avatar
Eike Ziller committed
99
    Core::Command *qemuCommand = Core::ActionManager::registerAction(m_qemuAction,
100
        "MaemoEmulator", Core::Context(Core::Constants::C_GLOBAL));
101
102
103
    qemuCommand->setAttribute(Core::Command::CA_UpdateText);
    qemuCommand->setAttribute(Core::Command::CA_UpdateIcon);

104
    Core::ModeManager::addAction(qemuCommand->action(), 1);
105
106
    m_qemuAction->setEnabled(false);
    m_qemuAction->setVisible(false);
107
108

    // listen to qt version changes to update the start button
109
110
    connect(QtSupport::QtVersionManager::instance(), SIGNAL(qtVersionsChanged(QList<int>,QList<int>,QList<int>)),
        this, SLOT(qtVersionsChanged(QList<int>,QList<int>,QList<int>)));
111
112
113
114
115
116
117
118
119
120
121
122

    // listen to project add, remove and startup changes to udate start button
    SessionManager *session = ProjectExplorerPlugin::instance()->session();
    connect(session, SIGNAL(projectAdded(ProjectExplorer::Project*)), this,
        SLOT(projectAdded(ProjectExplorer::Project*)));
    connect(session, SIGNAL(projectRemoved(ProjectExplorer::Project*)), this,
        SLOT(projectRemoved(ProjectExplorer::Project*)));
    connect(session, SIGNAL(startupProjectChanged(ProjectExplorer::Project*)),
        this, SLOT(projectChanged(ProjectExplorer::Project*)));

    connect(m_qemuProcess, SIGNAL(error(QProcess::ProcessError)), this,
        SLOT(qemuProcessError(QProcess::ProcessError)));
Robert Loehning's avatar
Robert Loehning committed
123
    connect(m_qemuProcess, SIGNAL(finished(int,QProcess::ExitStatus)), this,
124
        SLOT(qemuProcessFinished()));
ck's avatar
ck committed
125
126
127
128
    connect(m_qemuProcess, SIGNAL(readyReadStandardOutput()), this,
        SLOT(qemuOutput()));
    connect(m_qemuProcess, SIGNAL(readyReadStandardError()), this,
        SLOT(qemuOutput()));
Robert Loehning's avatar
Robert Loehning committed
129
130
    connect(this, SIGNAL(qemuProcessStatus(QemuStatus,QString)),
        this, SLOT(qemuStatusChanged(QemuStatus,QString)));
131
}
132

133
Utils::FileSystemWatcher *MaemoQemuManager::runtimeRootWatcher()
134
135
{
    if (!m_runtimeRootWatcher) {
136
137
        m_runtimeRootWatcher = new Utils::FileSystemWatcher(this);
        m_runtimeRootWatcher->setObjectName(QLatin1String("MaemoQemuRuntimeRootWatcher"));
138
139
140
141
142
143
        connect(m_runtimeRootWatcher, SIGNAL(directoryChanged(QString)), this,
            SLOT(runtimeRootChanged(QString)));
    }
    return m_runtimeRootWatcher;
}

144
Utils::FileSystemWatcher *MaemoQemuManager::runtimeFolderWatcher()
145
146
{
    if (!m_runtimeFolderWatcher) {
147
148
        m_runtimeFolderWatcher = new Utils::FileSystemWatcher(this);
        m_runtimeFolderWatcher->setObjectName(QLatin1String("MaemoQemuRuntimeFolderWatcher"));
149
150
151
152
        connect(m_runtimeFolderWatcher, SIGNAL(directoryChanged(QString)), this,
            SLOT(runtimeFolderChanged(QString)));
    }
    return m_runtimeFolderWatcher;
153
154
}

ck's avatar
ck committed
155
MaemoQemuManager::~MaemoQemuManager()
156
157
{
    terminateRuntime();
158
    m_instance = 0;
159
160
}

ck's avatar
ck committed
161
MaemoQemuManager &MaemoQemuManager::instance(QObject *parent)
162
{
163
    if (m_instance == 0)
ck's avatar
ck committed
164
        m_instance = new MaemoQemuManager(parent);
165
166
167
    return *m_instance;
}

168
bool MaemoQemuManager::runtimeForQtVersion(int uniqueId, MaemoQemuRuntime *rt) const
169
{
170
    *rt = m_runtimes.value(uniqueId, MaemoQemuRuntime());
171
    return rt->isValid();
172
173
}

174
175
176
177
178
bool MaemoQemuManager::qemuIsRunning() const
{
    return m_runningQtId != INT_MIN;
}

179
void MaemoQemuManager::qtVersionsChanged(const QList<int> &added, const QList<int> &removed, const QList<int> &changed)
180
{
181
182
    QList<int> uniqueIds;
    uniqueIds << added << removed << changed;
183
    QtSupport::QtVersionManager *manager = QtSupport::QtVersionManager::instance();
184
185
    foreach (int uniqueId, uniqueIds) {
        if (manager->isValidId(uniqueId)) {
dt's avatar
dt committed
186
187
188
            MaemoQtVersion *version = dynamic_cast<MaemoQtVersion *>(manager->version(uniqueId));

            if (version) {
189
190
                MaemoQemuRuntime runtime
                    = MaemoQemuRuntimeParser::parseRuntime(version);
191
                if (runtime.isValid()) {
192
                    m_runtimes.insert(uniqueId, runtime);
193
194
195
                    if (!runtimeRootWatcher()->watchesDirectory(runtime.m_watchPath))
                        runtimeRootWatcher()->addDirectory(runtime.m_watchPath,
                                                           Utils::FileSystemWatcher::WatchAllChanges);
196
197
198
                } else {
                    m_runtimes.remove(uniqueId);
                }
199
200
201
202
203
204
205
206
207
208
209
210
            }
        } else {
            // this qt version has been removed from the settings
            m_runtimes.remove(uniqueId);
            if (uniqueId == m_runningQtId) {
                terminateRuntime();
                emit qemuProcessStatus(QemuUserReason, tr("Qemu has been shut "
                    "down, because you removed the corresponding Qt version."));
            }
        }
    }

211
    showOrHideQemuButton();
212
213
}

ck's avatar
ck committed
214
void MaemoQemuManager::projectAdded(ProjectExplorer::Project *project)
215
216
217
218
219
220
221
222
223
224
225
226
227
{
    // handle all target related changes, add, remove, etc...
    connect(project, SIGNAL(addedTarget(ProjectExplorer::Target*)), this,
        SLOT(targetAdded(ProjectExplorer::Target*)));
    connect(project, SIGNAL(removedTarget(ProjectExplorer::Target*)), this,
        SLOT(targetRemoved(ProjectExplorer::Target*)));
    connect(project, SIGNAL(activeTargetChanged(ProjectExplorer::Target*)),
        this, SLOT(targetChanged(ProjectExplorer::Target*)));

    foreach (Target *target, project->targets())
        targetAdded(target);
}

ck's avatar
ck committed
228
void MaemoQemuManager::projectRemoved(ProjectExplorer::Project *project)
229
230
231
232
233
234
235
236
237
238
{
    disconnect(project, SIGNAL(addedTarget(ProjectExplorer::Target*)), this,
        SLOT(targetAdded(ProjectExplorer::Target*)));
    disconnect(project, SIGNAL(removedTarget(ProjectExplorer::Target*)), this,
        SLOT(targetRemoved(ProjectExplorer::Target*)));
    disconnect(project, SIGNAL(activeTargetChanged(ProjectExplorer::Target*)),
        this, SLOT(targetChanged(ProjectExplorer::Target*)));

    foreach (Target *target, project->targets())
        targetRemoved(target);
239
    showOrHideQemuButton();
240
241
}

ck's avatar
ck committed
242
void MaemoQemuManager::projectChanged(ProjectExplorer::Project *project)
243
{
244
    if (project) {
245
        toggleStarterButton(project->activeTarget());
246
247
        deviceConfigurationChanged(project->activeTarget());
    }
248
249
}

ck's avatar
ck committed
250
void MaemoQemuManager::targetAdded(ProjectExplorer::Target *target)
251
{
Tobias Hunger's avatar
Tobias Hunger committed
252
    if (!target || !MaemoGlobal::hasMaemoDevice(target->profile()))
253
254
255
256
        return;

    // handle the qt version changes the build configuration uses
    connect(target, SIGNAL(environmentChanged()), this, SLOT(environmentChanged()));
Tobias Hunger's avatar
Tobias Hunger committed
257
    connect(target, SIGNAL(profileChanged()), this, SLOT(systemChanged()));
258

259
    toggleStarterButton(target);
260
261
}

ck's avatar
ck committed
262
void MaemoQemuManager::targetRemoved(ProjectExplorer::Target *target)
263
{
Tobias Hunger's avatar
Tobias Hunger committed
264
    if (!target || !MaemoGlobal::hasMaemoDevice(target->profile()))
265
266
267
        return;

    disconnect(target, SIGNAL(environmentChanged()), this, SLOT(environmentChanged()));
Tobias Hunger's avatar
Tobias Hunger committed
268
    disconnect(target, SIGNAL(profileChanged()), this, SLOT(systemChanged()));
269

270
    showOrHideQemuButton();
271
272
}

ck's avatar
ck committed
273
void MaemoQemuManager::targetChanged(ProjectExplorer::Target *target)
274
{
275
    if (target) {
276
        toggleStarterButton(target);
277
278
        deviceConfigurationChanged(target);
    }
279
280
}

Tobias Hunger's avatar
Tobias Hunger committed
281
void MaemoQemuManager::systemChanged()
282
{
Tobias Hunger's avatar
Tobias Hunger committed
283
284
    Target *t = qobject_cast<Target *>(sender());
    targetChanged(t);
285
286
}

ck's avatar
ck committed
287
void MaemoQemuManager::environmentChanged()
288
289
290
291
{
    // likely to happen when the qt version changes the build config is using
    if (ProjectExplorerPlugin *explorer = ProjectExplorerPlugin::instance()) {
        if (Project *project = explorer->session()->startupProject())
292
            toggleStarterButton(project->activeTarget());
293
294
295
    }
}

ck's avatar
ck committed
296
void MaemoQemuManager::deviceConfigurationChanged(ProjectExplorer::Target *target)
297
{
ck's avatar
ck committed
298
    m_qemuAction->setEnabled(targetUsesMatchingRuntimeConfig(target));
299
300
}

ck's avatar
ck committed
301
void MaemoQemuManager::startRuntime()
302
303
304
305
306
{
    m_userTerminated = false;
    Project *p = ProjectExplorerPlugin::instance()->session()->startupProject();
    if (!p)
        return;
307
    QtSupport::BaseQtVersion *version;
ck's avatar
ck committed
308
309
    if (!targetUsesMatchingRuntimeConfig(p->activeTarget(), &version)) {
        qWarning("Strange: Qemu button was enabled, but target does not match.");
310
        return;
ck's avatar
ck committed
311
    }
312

ck's avatar
ck committed
313
    m_runningQtId = version->uniqueId();
314
    const MaemoQemuRuntime rt = m_runtimes.value(version->uniqueId());
315
    m_qemuProcess->setProcessEnvironment(rt.environment());
ck's avatar
ck committed
316
    m_qemuProcess->setWorkingDirectory(rt.m_root);
317
    m_qemuProcess->start(rt.m_bin % QLatin1Char(' ') % rt.m_args);
ck's avatar
ck committed
318
319
    if (!m_qemuProcess->waitForStarted())
        return;
320

ck's avatar
ck committed
321
322
323
    emit qemuProcessStatus(QemuStarting);
    connect(m_qemuAction, SIGNAL(triggered()), this, SLOT(terminateRuntime()));
    disconnect(m_qemuAction, SIGNAL(triggered()), this, SLOT(startRuntime()));
324
325
}

ck's avatar
ck committed
326
void MaemoQemuManager::terminateRuntime()
327
328
329
330
331
332
333
334
335
336
337
338
{
    m_userTerminated = true;

    if (m_qemuProcess->state() != QProcess::NotRunning) {
        m_qemuProcess->terminate();
        m_qemuProcess->kill();
    }

    connect(m_qemuAction, SIGNAL(triggered()), this, SLOT(startRuntime()));
    disconnect(m_qemuAction, SIGNAL(triggered()), this, SLOT(terminateRuntime()));
}

ck's avatar
ck committed
339
void MaemoQemuManager::qemuProcessFinished()
340
{
341
    m_runningQtId = INT_MIN;
342
    QemuStatus status = QemuFinished;
ck's avatar
ck committed
343
    QString error;
344
345

    if (!m_userTerminated) {
ck's avatar
ck committed
346
347
348
349
350
351
352
        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());
        }
353
354
355
    }

    m_userTerminated = false;
ck's avatar
ck committed
356
    emit qemuProcessStatus(status, error);
357
358
}

ck's avatar
ck committed
359
void MaemoQemuManager::qemuProcessError(QProcess::ProcessError error)
360
361
362
363
364
{
    if (error == QProcess::FailedToStart)
        emit qemuProcessStatus(QemuFailedToStart, m_qemuProcess->errorString());
}

ck's avatar
ck committed
365
void MaemoQemuManager::qemuStatusChanged(QemuStatus status, const QString &error)
366
367
368
369
370
371
372
{
    bool running = false;
    switch (status) {
        case QemuStarting:
            running = true;
            break;
        case QemuFailedToStart:
373
374
            QMessageBox::warning(0, tr("Qemu error"),
                tr("Qemu failed to start: %1"));
375
            break;
376
        case QemuCrashed:
377
            MaemoQemuSettingsPage::showQemuCrashDialog();
378
379
380
            break;
        case QemuFinished:
        case QemuUserReason:
381
382
            if (!error.isEmpty())
                QMessageBox::warning(0, tr("Qemu error"), error);
383
384
385
386
387
388
389
390
            break;
        default:
            Q_ASSERT(!"Missing handling of Qemu status");
    }

    updateStarterIcon(running);
}

ck's avatar
ck committed
391
void MaemoQemuManager::qemuOutput()
ck's avatar
ck committed
392
393
394
395
396
{
    qDebug("%s", m_qemuProcess->readAllStandardOutput().data());
    qDebug("%s", m_qemuProcess->readAllStandardError().data());
}

397
398
399
void MaemoQemuManager::runtimeRootChanged(const QString &directory)
{
    QList<int> uniqueIds;
400
    QMap<int, MaemoQemuRuntime>::const_iterator it;
401
402
403
404
405
406
    for (it = m_runtimes.constBegin(); it != m_runtimes.constEnd(); ++it) {
        if (QDir(it.value().m_watchPath) == QDir(directory))
            uniqueIds.append(it.key());
    }

    foreach (int uniqueId, uniqueIds) {
407
        MaemoQemuRuntime runtime = m_runtimes.value(uniqueId, MaemoQemuRuntime());
408
409
410
411
412
413
414
415
416
417
        if (runtime.isValid()) {
            if (QFile::exists(runtime.m_root)) {
                // nothing changed, so we can remove it
                uniqueIds.removeAll(uniqueId);
            }
        } else {
            if (QFile::exists(runtime.m_root)) {
                if (!QFile::exists(runtime.m_root + QLatin1String("/information"))) {
                    // install might be still in progress
                    uniqueIds.removeAll(uniqueId);
418
419
                    runtimeFolderWatcher()->addDirectory(runtime.m_root,
                                                         Utils::FileSystemWatcher::WatchAllChanges);
420
421
422
423
424
425
426
427
428
429
430
                }
            }
        }
    }
    notify(uniqueIds);
}

void MaemoQemuManager::runtimeFolderChanged(const QString &directory)
{
    if (QFile::exists(directory + QLatin1String("/information"))) {
        QList<int> uniqueIds;
431
        QMap<int, MaemoQemuRuntime>::const_iterator it;
432
433
434
435
436
        for (it = m_runtimes.constBegin(); it != m_runtimes.constEnd(); ++it) {
            if (QDir(it.value().m_root) == QDir(directory))
                uniqueIds.append(it.key());
        }
        notify(uniqueIds);
437
        if (m_runtimeFolderWatcher)
438
            m_runtimeFolderWatcher->removeDirectory(directory);
439
440
441
    }
}

442
443
// -- private

ck's avatar
ck committed
444
void MaemoQemuManager::updateStarterIcon(bool running)
445
446
447
448
449
{
    QIcon::State state;
    QString toolTip;
    if (running) {
        state = QIcon::On;
450
        toolTip = tr("Stop MeeGo Emulator");
451
452
    } else {
        state = QIcon::Off;
453
        toolTip = tr("Start MeeGo Emulator");
454
455
456
457
458
459
460
    }

    m_qemuAction->setToolTip(toolTip);
    m_qemuAction->setIcon(m_qemuStarterIcon.pixmap(iconSize, QIcon::Normal,
        state));
}

ck's avatar
ck committed
461
void MaemoQemuManager::toggleStarterButton(Target *target)
462
463
464
{
    int uniqueId = -1;
    if (target) {
Tobias Hunger's avatar
Tobias Hunger committed
465
466
467
        QtSupport::BaseQtVersion *version = QtSupport::QtProfileInformation::qtVersion(target->profile());
        if (version)
            uniqueId = version->uniqueId();
468
469
    }

470
    if (uniqueId >= 0 && (m_runtimes.isEmpty() || !m_runtimes.contains(uniqueId)))
471
        qtVersionsChanged(QList<int>(), QList<int>(), QList<int>() << uniqueId);
472

473
474
475
476
    bool isRunning = m_qemuProcess->state() != QProcess::NotRunning;
    if (m_runningQtId == uniqueId)
        isRunning = false;

477
478
479
    const Project * const p
        = ProjectExplorerPlugin::instance()->session()->startupProject();
    const bool qemuButtonEnabled
Tobias Hunger's avatar
Tobias Hunger committed
480
        = p && p->activeTarget() && MaemoGlobal::hasMaemoDevice(target->profile())
481
482
483
484
            && m_runtimes.value(uniqueId, MaemoQemuRuntime()).isValid()
            && targetUsesMatchingRuntimeConfig(target) && !isRunning;
    m_qemuAction->setEnabled(qemuButtonEnabled);
    showOrHideQemuButton();
485
486
}

ck's avatar
ck committed
487
bool MaemoQemuManager::sessionHasMaemoTarget() const
488
489
490
{
    ProjectExplorerPlugin *explorer = ProjectExplorerPlugin::instance();
    const QList<Project*> &projects = explorer->session()->projects();
491
492
    foreach (const Project *p, projects) {
        foreach (const Target * const target, p->targets()) {
Tobias Hunger's avatar
Tobias Hunger committed
493
            if (MaemoGlobal::hasMaemoDevice(target->profile()))
494
495
496
497
                return true;
        }
    }
    return false;
498
499
}

ck's avatar
ck committed
500
bool MaemoQemuManager::targetUsesMatchingRuntimeConfig(Target *target,
501
    QtSupport::BaseQtVersion **qtVersion)
502
503
504
{
    if (!target)
        return false;
505
506
    if (target != target->project()->activeTarget())
        return false;
507

508
509
    RemoteLinuxRunConfiguration *mrc =
        qobject_cast<RemoteLinuxRunConfiguration *> (target->activeRunConfiguration());
ck's avatar
ck committed
510
511
    if (!mrc)
        return false;
Tobias Hunger's avatar
Tobias Hunger committed
512
513

    QtSupport::BaseQtVersion *version = QtSupport::QtProfileInformation::qtVersion(target->profile());
514
    if (!version || !m_runtimes.value(version->uniqueId(), MaemoQemuRuntime()).isValid())
ck's avatar
ck committed
515
516
        return false;

ck's avatar
ck committed
517
518
    if (qtVersion)
        *qtVersion = version;
Tobias Hunger's avatar
Tobias Hunger committed
519
520
521
522
    const LinuxDeviceConfiguration::ConstPtr &config
            = ProjectExplorer::DeviceProfileInformation::device(target->profile())
            .dynamicCast<const LinuxDeviceConfiguration>();
    return !config.isNull() && config->machineType() == LinuxDeviceConfiguration::Emulator;
523
524
}

525
526
void MaemoQemuManager::notify(const QList<int> uniqueIds)
{
527
    qtVersionsChanged(QList<int>(), QList<int>(), uniqueIds);
528
529
530
    environmentChanged();   // to toggle the start button
}

531
532
533
534
535
536
537
void MaemoQemuManager::showOrHideQemuButton()
{
    const bool showButton = !m_runtimes.isEmpty() && sessionHasMaemoTarget();
    if (!showButton)
        terminateRuntime();
    m_qemuAction->setVisible(showButton);
}
538
539
540

}   // namespace Internal
}   // namespace Madde