OSDN Git Service

Update license.
[qt-creator-jp/qt-creator-jp.git] / src / plugins / qt4projectmanager / qt-maemo / maemoqemumanager.h
1 /**************************************************************************
2 **
3 ** This file is part of Qt Creator
4 **
5 ** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
6 **
7 ** Contact: Nokia Corporation (info@qt.nokia.com)
8 **
9 **
10 ** GNU Lesser General Public License Usage
11 **
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.
18 **
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.
22 **
23 ** Other Usage
24 **
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.
27 **
28 ** If you have questions regarding the use of this file, please contact
29 ** Nokia at qt-info@nokia.com.
30 **
31 **************************************************************************/
32
33 #ifndef QEMURUNTIMEMANAGER_H
34 #define QEMURUNTIMEMANAGER_H
35
36 #include "maemoconstants.h"
37 #include "maemoqemuruntime.h"
38
39 #include <QtCore/QMap>
40 #include <QtCore/QObject>
41 #include <QtCore/QProcess>
42
43 #include <QtGui/QIcon>
44
45 QT_FORWARD_DECLARE_CLASS(QAction)
46 QT_FORWARD_DECLARE_CLASS(QFileSystemWatcher)
47 QT_FORWARD_DECLARE_CLASS(QStringList)
48
49 namespace ProjectExplorer {
50     class BuildConfiguration;
51     class Project;
52     class RunConfiguration;
53     class Target;
54 }
55
56 namespace Qt4ProjectManager {
57     class QtVersion;
58     namespace Internal {
59     class MaemoRunConfiguration;
60
61
62 class MaemoQemuManager : public QObject
63 {
64     Q_OBJECT
65
66 public:
67     static MaemoQemuManager& instance(QObject *parent = 0);
68
69     bool runtimeForQtVersion(int uniqueId, MaemoQemuRuntime *rt) const;
70     bool qemuIsRunning() const;
71     Q_SLOT void startRuntime();
72
73 signals:
74     void qemuProcessStatus(QemuStatus, const QString &error = QString());
75
76 private slots:
77     void qtVersionsChanged(const QList<int> &uniqueIds);
78
79     void projectAdded(ProjectExplorer::Project *project);
80     void projectRemoved(ProjectExplorer::Project *project);
81     void projectChanged(ProjectExplorer::Project *project);
82
83     void targetAdded(ProjectExplorer::Target *target);
84     void targetRemoved(ProjectExplorer::Target *target);
85     void targetChanged(ProjectExplorer::Target *target);
86
87     void runConfigurationAdded(ProjectExplorer::RunConfiguration *rc);
88     void runConfigurationRemoved(ProjectExplorer::RunConfiguration *rc);
89     void runConfigurationChanged(ProjectExplorer::RunConfiguration *rc);
90
91     void buildConfigurationAdded(ProjectExplorer::BuildConfiguration *bc);
92     void buildConfigurationRemoved(ProjectExplorer::BuildConfiguration *bc);
93     void buildConfigurationChanged(ProjectExplorer::BuildConfiguration *bc);
94
95     void environmentChanged();  // needed to check for qt version
96     void deviceConfigurationChanged(ProjectExplorer::Target *target);
97
98     void terminateRuntime();
99
100     void qemuProcessFinished();
101     void qemuProcessError(QProcess::ProcessError error);
102     void qemuStatusChanged(QemuStatus status, const QString &error);
103     void qemuOutput();
104
105     void runtimeRootChanged(const QString &directory);
106     void runtimeFolderChanged(const QString &directory);
107
108 private:
109     MaemoQemuManager(QObject *parent);
110     ~MaemoQemuManager();
111
112     bool sessionHasMaemoTarget() const;
113
114     void updateStarterIcon(bool running);
115     void toggleStarterButton(ProjectExplorer::Target *target);
116     bool targetUsesMatchingRuntimeConfig(ProjectExplorer::Target *target,
117         QtVersion **qtVersion = 0);
118
119     void notify(const QList<int> uniqueIds);
120     void toggleDeviceConnections(MaemoRunConfiguration *mrc, bool connect);
121     void showOrHideQemuButton();
122
123 private:
124     QAction *m_qemuAction;
125     QProcess *m_qemuProcess;
126
127     int m_runningQtId;
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;
134 };
135
136 }   // namespace Internal
137 }   // namespace Qt4ProjectManager
138
139 #endif  // QEMURUNTIMEMANAGER_H