1 /**************************************************************************
3 ** This file is part of Qt Creator
5 ** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
7 ** Contact: Nokia Corporation (info@qt.nokia.com)
10 ** GNU Lesser General Public License Usage
12 ** This file may be used under the terms of the GNU Lesser General Public
13 ** License version 2.1 as published by the Free Software Foundation and
14 ** appearing in the file LICENSE.LGPL included in the packaging of this file.
15 ** Please review the following information to ensure the GNU Lesser General
16 ** Public License version 2.1 requirements will be met:
17 ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
19 ** In addition, as a special exception, Nokia gives you certain additional
20 ** rights. These rights are described in the Nokia Qt LGPL Exception
21 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
25 ** Alternatively, this file may be used in accordance with the terms and
26 ** conditions contained in a signed written agreement between you and Nokia.
28 ** If you have questions regarding the use of this file, please contact
29 ** Nokia at qt-info@nokia.com.
31 **************************************************************************/
33 #ifndef QEMURUNTIMEMANAGER_H
34 #define QEMURUNTIMEMANAGER_H
36 #include "maemoconstants.h"
37 #include "maemoqemuruntime.h"
39 #include <QtCore/QMap>
40 #include <QtCore/QObject>
41 #include <QtCore/QProcess>
43 #include <QtGui/QIcon>
45 QT_FORWARD_DECLARE_CLASS(QAction)
46 QT_FORWARD_DECLARE_CLASS(QFileSystemWatcher)
47 QT_FORWARD_DECLARE_CLASS(QStringList)
49 namespace ProjectExplorer {
50 class BuildConfiguration;
52 class RunConfiguration;
56 namespace Qt4ProjectManager {
59 class MaemoRunConfiguration;
62 class MaemoQemuManager : public QObject
67 static MaemoQemuManager& instance(QObject *parent = 0);
69 bool runtimeForQtVersion(int uniqueId, MaemoQemuRuntime *rt) const;
70 bool qemuIsRunning() const;
71 Q_SLOT void startRuntime();
74 void qemuProcessStatus(QemuStatus, const QString &error = QString());
77 void qtVersionsChanged(const QList<int> &uniqueIds);
79 void projectAdded(ProjectExplorer::Project *project);
80 void projectRemoved(ProjectExplorer::Project *project);
81 void projectChanged(ProjectExplorer::Project *project);
83 void targetAdded(ProjectExplorer::Target *target);
84 void targetRemoved(ProjectExplorer::Target *target);
85 void targetChanged(ProjectExplorer::Target *target);
87 void runConfigurationAdded(ProjectExplorer::RunConfiguration *rc);
88 void runConfigurationRemoved(ProjectExplorer::RunConfiguration *rc);
89 void runConfigurationChanged(ProjectExplorer::RunConfiguration *rc);
91 void buildConfigurationAdded(ProjectExplorer::BuildConfiguration *bc);
92 void buildConfigurationRemoved(ProjectExplorer::BuildConfiguration *bc);
93 void buildConfigurationChanged(ProjectExplorer::BuildConfiguration *bc);
95 void environmentChanged(); // needed to check for qt version
96 void deviceConfigurationChanged(ProjectExplorer::Target *target);
98 void terminateRuntime();
100 void qemuProcessFinished();
101 void qemuProcessError(QProcess::ProcessError error);
102 void qemuStatusChanged(QemuStatus status, const QString &error);
105 void runtimeRootChanged(const QString &directory);
106 void runtimeFolderChanged(const QString &directory);
109 MaemoQemuManager(QObject *parent);
112 bool sessionHasMaemoTarget() const;
114 void updateStarterIcon(bool running);
115 void toggleStarterButton(ProjectExplorer::Target *target);
116 bool targetUsesMatchingRuntimeConfig(ProjectExplorer::Target *target,
117 QtVersion **qtVersion = 0);
119 void notify(const QList<int> uniqueIds);
120 void toggleDeviceConnections(MaemoRunConfiguration *mrc, bool connect);
121 void showOrHideQemuButton();
124 QAction *m_qemuAction;
125 QProcess *m_qemuProcess;
128 bool m_userTerminated;
129 QIcon m_qemuStarterIcon;
130 QMap<int, MaemoQemuRuntime> m_runtimes;
131 static MaemoQemuManager *m_instance;
132 QFileSystemWatcher *m_runtimeRootWatcher;
133 QFileSystemWatcher *m_runtimeFolderWatcher;
136 } // namespace Internal
137 } // namespace Qt4ProjectManager
139 #endif // QEMURUNTIMEMANAGER_H