androidplugin.cpp 4.36 KB
Newer Older
1
/****************************************************************************
BogDan Vatra's avatar
BogDan Vatra committed
2
**
3 4
** Copyright (C) 2016 BogDan Vatra <bog_dan_ro@yahoo.com>
** Contact: https://www.qt.io/licensing/
BogDan Vatra's avatar
BogDan Vatra committed
5
**
hjk's avatar
hjk committed
6
** This file is part of Qt Creator.
BogDan Vatra's avatar
BogDan Vatra committed
7
**
hjk's avatar
hjk committed
8 9 10 11
** 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
12 13 14
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
BogDan Vatra's avatar
BogDan Vatra committed
15
**
16 17 18 19 20 21 22
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 as published by the Free Software
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
BogDan Vatra's avatar
BogDan Vatra committed
23
**
hjk's avatar
hjk committed
24
****************************************************************************/
BogDan Vatra's avatar
BogDan Vatra committed
25 26 27 28

#include "androidplugin.h"

#include "androidconfigurations.h"
29 30 31
#include "androidconstants.h"
#include "androiddebugsupport.h"
#include "androiddeployconfiguration.h"
32
#include "androiddeployqtstep.h"
33
#include "androiddevice.h"
BogDan Vatra's avatar
BogDan Vatra committed
34
#include "androiddevicefactory.h"
35
#include "androidgdbserverkitinformation.h"
36
#include "androidmanager.h"
37
#include "androidmanifesteditorfactory.h"
38
#include "androidpackageinstallationstep.h"
39
#include "androidpotentialkit.h"
40
#include "androidqmltoolingsupport.h"
41 42 43 44 45
#include "androidqtversionfactory.h"
#include "androidrunconfiguration.h"
#include "androidruncontrol.h"
#include "androidsettingspage.h"
#include "androidtoolchain.h"
hjk's avatar
hjk committed
46
#include "javaeditor.h"
47

48 49 50
#ifdef HAVE_QBS
#  include "androidqbspropertyprovider.h"
#endif
51 52

#include <coreplugin/icore.h>
hjk's avatar
hjk committed
53 54

#include <projectexplorer/devicesupport/devicemanager.h>
55
#include <projectexplorer/kitmanager.h>
hjk's avatar
hjk committed
56

Daniel Teske's avatar
Daniel Teske committed
57
#include <qtsupport/qtversionmanager.h>
hjk's avatar
hjk committed
58

BogDan Vatra's avatar
BogDan Vatra committed
59 60
#include <QtPlugin>

hjk's avatar
hjk committed
61
using namespace ProjectExplorer;
62 63
using namespace ProjectExplorer::Constants;
using namespace Android::Internal;
64

Tobias Hunger's avatar
Tobias Hunger committed
65
namespace Android {
BogDan Vatra's avatar
BogDan Vatra committed
66 67

AndroidPlugin::AndroidPlugin()
Tobias Hunger's avatar
Tobias Hunger committed
68
{ }
BogDan Vatra's avatar
BogDan Vatra committed
69

hjk's avatar
hjk committed
70
bool AndroidPlugin::initialize(const QStringList &arguments, QString *errorMessage)
BogDan Vatra's avatar
BogDan Vatra committed
71
{
Tobias Hunger's avatar
Tobias Hunger committed
72
    Q_UNUSED(arguments);
hjk's avatar
hjk committed
73
    Q_UNUSED(errorMessage);
BogDan Vatra's avatar
BogDan Vatra committed
74

75 76
    RunControl::registerWorker<AndroidRunConfiguration, AndroidRunSupport>(NORMAL_RUN_MODE);
    RunControl::registerWorker<AndroidRunConfiguration, AndroidDebugSupport>(DEBUG_RUN_MODE);
77 78 79 80
    RunControl::registerWorker<AndroidRunConfiguration, AndroidQmlToolingSupport>(
                QML_PROFILER_RUN_MODE);
    RunControl::registerWorker<AndroidRunConfiguration, AndroidQmlToolingSupport>(
                QML_PREVIEW_RUN_MODE);
81

82
    new AndroidConfigurations(this);
BogDan Vatra's avatar
BogDan Vatra committed
83

84
    addAutoReleasedObject(new Internal::AndroidDeployQtStepFactory);
Tobias Hunger's avatar
Tobias Hunger committed
85 86 87 88
    addAutoReleasedObject(new Internal::AndroidSettingsPage);
    addAutoReleasedObject(new Internal::AndroidQtVersionFactory);
    addAutoReleasedObject(new Internal::AndroidToolChainFactory);
    addAutoReleasedObject(new Internal::AndroidDeployConfigurationFactory);
BogDan Vatra's avatar
BogDan Vatra committed
89
    addAutoReleasedObject(new Internal::AndroidDeviceFactory);
90
    addAutoReleasedObject(new Internal::AndroidPotentialKit);
91
    addAutoReleasedObject(new Internal::JavaEditorFactory);
Oliver Wolff's avatar
Oliver Wolff committed
92
    addAutoReleasedObject(new Internal::AndroidPackageInstallationFactory);
hjk's avatar
hjk committed
93
    KitManager::registerKitInformation(new Internal::AndroidGdbServerKitInformation);
94

Eike Ziller's avatar
Eike Ziller committed
95
    addAutoReleasedObject(new Internal::AndroidManifestEditorFactory);
96

hjk's avatar
hjk committed
97 98
    connect(KitManager::instance(), &KitManager::kitsLoaded,
            this, &AndroidPlugin::kitsRestored);
99

hjk's avatar
hjk committed
100 101
    connect(DeviceManager::instance(), &DeviceManager::devicesLoaded,
            this, &AndroidPlugin::updateDevice);
102
    return true;
103 104 105 106
}

void AndroidPlugin::kitsRestored()
{
107
    AndroidConfigurations::updateAutomaticKitList();
hjk's avatar
hjk committed
108 109 110 111
    connect(QtSupport::QtVersionManager::instance(), &QtSupport::QtVersionManager::qtVersionsChanged,
            AndroidConfigurations::instance(), &AndroidConfigurations::updateAutomaticKitList);
    disconnect(KitManager::instance(), &KitManager::kitsChanged,
               this, &AndroidPlugin::kitsRestored);
112
}
Tobias Hunger's avatar
Tobias Hunger committed
113

114 115
void AndroidPlugin::updateDevice()
{
116
    AndroidConfigurations::updateAndroidDevice();
117 118
}

Tobias Hunger's avatar
Tobias Hunger committed
119
} // namespace Android