OSDN Git Service

It's 2011 now.
[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 (qt-info@nokia.com)
8 **
9 ** No Commercial Usage
10 **
11 ** This file contains pre-release code and may not be distributed.
12 ** You may use this file in accordance with the terms and conditions
13 ** contained in the Technology Preview License Agreement accompanying
14 ** this package.
15 **
16 ** GNU Lesser General Public License Usage
17 **
18 ** Alternatively, this file may be used under the terms of the GNU Lesser
19 ** General Public License version 2.1 as published by the Free Software
20 ** Foundation and appearing in the file LICENSE.LGPL included in the
21 ** packaging of this file.  Please review the following information to
22 ** ensure the GNU Lesser General Public License version 2.1 requirements
23 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
24 **
25 ** In addition, as a special exception, Nokia gives you certain additional
26 ** rights.  These rights are described in the Nokia Qt LGPL Exception
27 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
28 **
29 ** If you have questions regarding the use of this file, please contact
30 ** Nokia at qt-info@nokia.com.
31 **
32 **************************************************************************/
33
34 #ifndef QEMURUNTIMEMANAGER_H
35 #define QEMURUNTIMEMANAGER_H
36
37 #include "maemoconstants.h"
38 #include "maemoqemuruntime.h"
39
40 #include <QtCore/QMap>
41 #include <QtCore/QObject>
42 #include <QtCore/QProcess>
43
44 #include <QtGui/QIcon>
45
46 QT_FORWARD_DECLARE_CLASS(QAction)
47 QT_FORWARD_DECLARE_CLASS(QFileSystemWatcher)
48 QT_FORWARD_DECLARE_CLASS(QStringList)
49
50 namespace ProjectExplorer {
51     class BuildConfiguration;
52     class Project;
53     class RunConfiguration;
54     class Target;
55 }
56
57 namespace Qt4ProjectManager {
58     class QtVersion;
59     namespace Internal {
60     class MaemoRunConfiguration;
61
62
63 class MaemoQemuManager : public QObject
64 {
65     Q_OBJECT
66
67 public:
68     static MaemoQemuManager& instance(QObject *parent = 0);
69
70     bool runtimeForQtVersion(int uniqueId, MaemoQemuRuntime *rt) const;
71
72 signals:
73     void qemuProcessStatus(QemuStatus, const QString &error = QString());
74
75 private slots:
76     void qtVersionsChanged(const QList<int> &uniqueIds);
77
78     void projectAdded(ProjectExplorer::Project *project);
79     void projectRemoved(ProjectExplorer::Project *project);
80     void projectChanged(ProjectExplorer::Project *project);
81
82     void targetAdded(ProjectExplorer::Target *target);
83     void targetRemoved(ProjectExplorer::Target *target);
84     void targetChanged(ProjectExplorer::Target *target);
85
86     void runConfigurationAdded(ProjectExplorer::RunConfiguration *rc);
87     void runConfigurationRemoved(ProjectExplorer::RunConfiguration *rc);
88     void runConfigurationChanged(ProjectExplorer::RunConfiguration *rc);
89
90     void buildConfigurationAdded(ProjectExplorer::BuildConfiguration *bc);
91     void buildConfigurationRemoved(ProjectExplorer::BuildConfiguration *bc);
92     void buildConfigurationChanged(ProjectExplorer::BuildConfiguration *bc);
93
94     void environmentChanged();  // needed to check for qt version
95     void deviceConfigurationChanged(ProjectExplorer::Target *target);
96
97     void startRuntime();
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
122 private:
123     QAction *m_qemuAction;
124     QProcess *m_qemuProcess;
125
126     int m_runningQtId;
127     bool m_userTerminated;
128     QIcon m_qemuStarterIcon;
129     QMap<int, MaemoQemuRuntime> m_runtimes;
130     static MaemoQemuManager *m_instance;
131     QFileSystemWatcher *m_runtimeRootWatcher;
132     QFileSystemWatcher *m_runtimeFolderWatcher;
133 };
134
135 }   // namespace Internal
136 }   // namespace Qt4ProjectManager
137
138 #endif  // QEMURUNTIMEMANAGER_H