| 
									
										
										
										
											2012-04-18 20:30:57 +03:00
										 |  |  | /**************************************************************************
 | 
					
						
							|  |  |  | ** | 
					
						
							| 
									
										
										
										
											2014-01-07 13:27:11 +01:00
										 |  |  | ** Copyright (c) 2014 BogDan Vatra <bog_dan_ro@yahoo.com> | 
					
						
							| 
									
										
										
										
											2012-10-02 09:12:39 +02:00
										 |  |  | ** Contact: http://www.qt-project.org/legal
 | 
					
						
							| 
									
										
										
										
											2012-04-18 20:30:57 +03:00
										 |  |  | ** | 
					
						
							| 
									
										
										
										
											2012-10-02 09:12:39 +02:00
										 |  |  | ** This file is part of Qt Creator. | 
					
						
							| 
									
										
										
										
											2012-04-18 20:30:57 +03:00
										 |  |  | ** | 
					
						
							| 
									
										
										
										
											2012-10-02 09:12:39 +02:00
										 |  |  | ** Commercial License Usage | 
					
						
							|  |  |  | ** Licensees holding valid commercial Qt licenses may use this file in | 
					
						
							|  |  |  | ** accordance with the commercial license agreement provided with the | 
					
						
							|  |  |  | ** Software or, alternatively, in accordance with the terms contained in | 
					
						
							|  |  |  | ** a written agreement between you and Digia.  For licensing terms and | 
					
						
							|  |  |  | ** conditions see http://qt.digia.com/licensing.  For further information
 | 
					
						
							|  |  |  | ** use the contact form at http://qt.digia.com/contact-us.
 | 
					
						
							| 
									
										
										
										
											2012-04-18 20:30:57 +03:00
										 |  |  | ** | 
					
						
							|  |  |  | ** GNU Lesser General Public License Usage | 
					
						
							| 
									
										
										
										
											2012-10-02 09:12:39 +02:00
										 |  |  | ** Alternatively, 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.
 | 
					
						
							|  |  |  | ** | 
					
						
							|  |  |  | ** In addition, as a special exception, Digia gives you certain additional | 
					
						
							|  |  |  | ** rights.  These rights are described in the Digia Qt LGPL Exception | 
					
						
							| 
									
										
										
										
											2012-04-18 20:30:57 +03:00
										 |  |  | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. | 
					
						
							|  |  |  | ** | 
					
						
							| 
									
										
										
										
											2012-10-02 09:12:39 +02:00
										 |  |  | ****************************************************************************/ | 
					
						
							| 
									
										
										
										
											2012-04-18 20:30:57 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | #include "androidplugin.h"
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #include "androidconstants.h"
 | 
					
						
							|  |  |  | #include "androidconfigurations.h"
 | 
					
						
							|  |  |  | #include "androiddeploystepfactory.h"
 | 
					
						
							| 
									
										
										
										
											2013-09-17 18:24:57 +02:00
										 |  |  | #include "androiddeployqtstep.h"
 | 
					
						
							| 
									
										
										
										
											2012-07-03 16:57:44 +03:00
										 |  |  | #include "androiddevice.h"
 | 
					
						
							| 
									
										
										
										
											2012-06-23 12:24:44 +03:00
										 |  |  | #include "androiddevicefactory.h"
 | 
					
						
							| 
									
										
										
										
											2012-04-24 15:49:09 +02:00
										 |  |  | #include "androidmanager.h"
 | 
					
						
							| 
									
										
										
										
											2012-04-18 20:30:57 +03:00
										 |  |  | #include "androidpackagecreationfactory.h"
 | 
					
						
							|  |  |  | #include "androidpackageinstallationfactory.h"
 | 
					
						
							|  |  |  | #include "androidrunfactories.h"
 | 
					
						
							|  |  |  | #include "androidsettingspage.h"
 | 
					
						
							|  |  |  | #include "androidtoolchain.h"
 | 
					
						
							|  |  |  | #include "androidqtversionfactory.h"
 | 
					
						
							|  |  |  | #include "androiddeployconfiguration.h"
 | 
					
						
							| 
									
										
										
										
											2013-01-25 16:49:22 +01:00
										 |  |  | #include "androidgdbserverkitinformation.h"
 | 
					
						
							| 
									
										
										
										
											2013-05-08 17:52:01 +02:00
										 |  |  | #include "androidmanifesteditorfactory.h"
 | 
					
						
							| 
									
										
										
										
											2013-09-30 15:24:18 +02:00
										 |  |  | #include "androidpotentialkit.h"
 | 
					
						
							| 
									
										
										
										
											2014-01-15 16:58:52 +01:00
										 |  |  | #include "javaeditorfactory.h"
 | 
					
						
							|  |  |  | #include "javacompletionassistprovider.h"
 | 
					
						
							| 
									
										
										
										
											2014-01-20 15:38:50 +01:00
										 |  |  | #include "javafilewizard.h"
 | 
					
						
							| 
									
										
										
										
											2013-08-21 13:28:03 +02:00
										 |  |  | #ifdef HAVE_QBS
 | 
					
						
							|  |  |  | #  include "androidqbspropertyprovider.h"
 | 
					
						
							|  |  |  | #endif
 | 
					
						
							| 
									
										
										
										
											2013-05-08 17:52:01 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | #include <coreplugin/mimedatabase.h>
 | 
					
						
							|  |  |  | #include <coreplugin/icore.h>
 | 
					
						
							| 
									
										
										
										
											2013-02-25 13:25:32 +01:00
										 |  |  | #include <projectexplorer/kitmanager.h>
 | 
					
						
							| 
									
										
										
										
											2013-02-14 15:51:59 +01:00
										 |  |  | #include <qtsupport/qtversionmanager.h>
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-04-18 20:30:57 +03:00
										 |  |  | #include <QtPlugin>
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-07-03 16:57:44 +03:00
										 |  |  | #include <projectexplorer/devicesupport/devicemanager.h>
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-04-24 15:49:09 +02:00
										 |  |  | namespace Android { | 
					
						
							| 
									
										
										
										
											2012-04-18 20:30:57 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | AndroidPlugin::AndroidPlugin() | 
					
						
							| 
									
										
										
										
											2012-04-24 15:49:09 +02:00
										 |  |  | { } | 
					
						
							| 
									
										
										
										
											2012-04-18 20:30:57 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-08-09 01:56:51 +02:00
										 |  |  | bool AndroidPlugin::initialize(const QStringList &arguments, QString *errorMessage) | 
					
						
							| 
									
										
										
										
											2012-04-18 20:30:57 +03:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2012-04-24 15:49:09 +02:00
										 |  |  |     Q_UNUSED(arguments); | 
					
						
							| 
									
										
										
										
											2012-08-09 01:56:51 +02:00
										 |  |  |     Q_UNUSED(errorMessage); | 
					
						
							| 
									
										
										
										
											2012-04-18 20:30:57 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-12-16 20:19:07 +01:00
										 |  |  |     new Internal::AndroidConfigurations(this); | 
					
						
							| 
									
										
										
										
											2012-04-18 20:30:57 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-04-24 15:49:09 +02:00
										 |  |  |     addAutoReleasedObject(new Internal::AndroidRunControlFactory); | 
					
						
							|  |  |  |     addAutoReleasedObject(new Internal::AndroidRunConfigurationFactory); | 
					
						
							|  |  |  |     addAutoReleasedObject(new Internal::AndroidPackageInstallationFactory); | 
					
						
							|  |  |  |     addAutoReleasedObject(new Internal::AndroidPackageCreationFactory); | 
					
						
							|  |  |  |     addAutoReleasedObject(new Internal::AndroidDeployStepFactory); | 
					
						
							| 
									
										
										
										
											2013-09-17 18:24:57 +02:00
										 |  |  |     addAutoReleasedObject(new Internal::AndroidDeployQtStepFactory); | 
					
						
							| 
									
										
										
										
											2012-04-24 15:49:09 +02:00
										 |  |  |     addAutoReleasedObject(new Internal::AndroidSettingsPage); | 
					
						
							|  |  |  |     addAutoReleasedObject(new Internal::AndroidQtVersionFactory); | 
					
						
							|  |  |  |     addAutoReleasedObject(new Internal::AndroidToolChainFactory); | 
					
						
							|  |  |  |     addAutoReleasedObject(new Internal::AndroidDeployConfigurationFactory); | 
					
						
							| 
									
										
										
										
											2012-06-23 12:24:44 +03:00
										 |  |  |     addAutoReleasedObject(new Internal::AndroidDeviceFactory); | 
					
						
							| 
									
										
										
										
											2013-09-30 15:24:18 +02:00
										 |  |  |     addAutoReleasedObject(new Internal::AndroidPotentialKit); | 
					
						
							| 
									
										
										
										
											2014-01-15 16:58:52 +01:00
										 |  |  |     addAutoReleasedObject(new Internal::JavaEditorFactory); | 
					
						
							|  |  |  |     addAutoReleasedObject(new Internal::JavaCompletionAssistProvider); | 
					
						
							| 
									
										
										
										
											2014-01-20 15:38:50 +01:00
										 |  |  |     addAutoReleasedObject(new Internal::JavaFileWizard); | 
					
						
							| 
									
										
										
										
											2013-08-21 12:48:46 +02:00
										 |  |  |     ProjectExplorer::KitManager::registerKitInformation(new Internal::AndroidGdbServerKitInformation); | 
					
						
							| 
									
										
										
										
											2013-02-28 14:06:17 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-05-08 17:52:01 +02:00
										 |  |  |     // AndroidManifest.xml editor
 | 
					
						
							|  |  |  |     Core::MimeGlobPattern androidManifestGlobPattern(QLatin1String("AndroidManifest.xml"), Core::MimeGlobPattern::MaxWeight); | 
					
						
							|  |  |  |     Core::MimeType androidManifestMimeType; | 
					
						
							|  |  |  |     androidManifestMimeType.setType(QLatin1String(Constants::ANDROID_MANIFEST_MIME_TYPE)); | 
					
						
							|  |  |  |     androidManifestMimeType.setComment(tr("Android Manifest file")); | 
					
						
							|  |  |  |     androidManifestMimeType.setGlobPatterns(QList<Core::MimeGlobPattern>() << androidManifestGlobPattern); | 
					
						
							|  |  |  |     androidManifestMimeType.setSubClassesOf(QStringList() << QLatin1String("application/xml")); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-08-30 16:38:57 +02:00
										 |  |  |     if (!Core::MimeDatabase::addMimeType(androidManifestMimeType)) { | 
					
						
							| 
									
										
										
										
											2013-05-08 17:52:01 +02:00
										 |  |  |         *errorMessage = tr("Could not add mime-type for AndroidManifest.xml editor."); | 
					
						
							|  |  |  |         return false; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     addAutoReleasedObject(new Internal::AndroidManifestEditorFactory); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-01-15 16:58:52 +01:00
										 |  |  |     if (!Core::MimeDatabase::addMimeTypes(QLatin1String(":android/Java.mimetypes.xml"), errorMessage)) | 
					
						
							|  |  |  |         return false; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-02-28 15:07:01 +01:00
										 |  |  |     connect(ProjectExplorer::KitManager::instance(), SIGNAL(kitsLoaded()), | 
					
						
							| 
									
										
										
										
											2013-02-25 13:25:32 +01:00
										 |  |  |             this, SLOT(kitsRestored())); | 
					
						
							| 
									
										
										
										
											2013-02-28 15:07:01 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-04-10 12:40:35 +02:00
										 |  |  |     connect(ProjectExplorer::DeviceManager::instance(), SIGNAL(devicesLoaded()), | 
					
						
							|  |  |  |             this, SLOT(updateDevice())); | 
					
						
							| 
									
										
										
										
											2013-02-28 15:07:01 +01:00
										 |  |  |     return true; | 
					
						
							| 
									
										
										
										
											2013-02-25 13:25:32 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void AndroidPlugin::kitsRestored() | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2013-12-16 20:19:07 +01:00
										 |  |  |     Internal::AndroidConfigurations::updateAutomaticKitList(); | 
					
						
							| 
									
										
										
										
											2013-02-14 15:51:59 +01:00
										 |  |  |     connect(QtSupport::QtVersionManager::instance(), SIGNAL(qtVersionsChanged(QList<int>,QList<int>,QList<int>)), | 
					
						
							| 
									
										
										
										
											2013-12-16 20:19:07 +01:00
										 |  |  |             Internal::AndroidConfigurations::instance(), SLOT(updateAutomaticKitList())); | 
					
						
							| 
									
										
										
										
											2013-02-25 13:25:32 +01:00
										 |  |  |     disconnect(ProjectExplorer::KitManager::instance(), SIGNAL(kitsChanged()), | 
					
						
							|  |  |  |                this, SLOT(kitsRestored())); | 
					
						
							| 
									
										
										
										
											2012-09-06 12:07:29 +02:00
										 |  |  | } | 
					
						
							| 
									
										
										
										
											2012-04-24 15:49:09 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-04-10 12:40:35 +02:00
										 |  |  | void AndroidPlugin::updateDevice() | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2013-12-16 20:19:07 +01:00
										 |  |  |     Internal::AndroidConfigurations::updateAndroidDevice(); | 
					
						
							| 
									
										
										
										
											2013-04-10 12:40:35 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-04-24 15:49:09 +02:00
										 |  |  | } // namespace Android
 | 
					
						
							| 
									
										
										
										
											2012-04-18 20:30:57 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | Q_EXPORT_PLUGIN(Android::AndroidPlugin) |