tizenplugin.cpp 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. /****************************************************************************
  2. **
  3. ** Copyright (C) 2013 Jarek Pelczar <jpelczar@gmail.com>
  4. ** Copyright (C) 2013 Tomasz Olszak <olszak.tomasz@gmail.com>
  5. **
  6. ** This file is part of Qt Creator.
  7. **
  8. ** Commercial License Usage
  9. ** Licensees holding valid commercial Qt licenses may use this file in
  10. ** accordance with the commercial license agreement provided with the
  11. ** Software or, alternatively, in accordance with the terms contained in
  12. ** a written agreement between you and Digia. For licensing terms and
  13. ** conditions see http://qt.digia.com/licensing. For further information
  14. ** use the contact form at http://qt.digia.com/contact-us.
  15. **
  16. ** GNU Lesser General Public License Usage
  17. ** Alternatively, this file may be used under the terms of the GNU Lesser
  18. ** General Public License version 2.1 as published by the Free Software
  19. ** Foundation and appearing in the file LICENSE.LGPL included in the
  20. ** packaging of this file. Please review the following information to
  21. ** ensure the GNU Lesser General Public License version 2.1 requirements
  22. ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
  23. **
  24. ** In addition, as a special exception, Digia gives you certain additional
  25. ** rights. These rights are described in the Digia Qt LGPL Exception
  26. ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
  27. **
  28. ****************************************************************************/
  29. #include "tizenplugin.h"
  30. #include "tizendevicefactory.h"
  31. #include "tizenconfigurations.h"
  32. #include "tizendevicemonitor.h"
  33. #include "tizenqtversionfactory.h"
  34. #include "tizentoolchain.h"
  35. #include "tizensettingspage.h"
  36. #include "tizenmanifesteditorfactory.h"
  37. #include "tizenconstants.h"
  38. #include "botan/botan.h"
  39. #include "tizendeployconfiguration.h"
  40. #include "tizendeploydirectorycreationfactory.h"
  41. #include "tizendeploypackagecreationfactory.h"
  42. #include "tizendeploypackageinstallationfactory.h"
  43. #include <QtPlugin>
  44. #include <projectexplorer/devicesupport/devicemanager.h>
  45. #include <projectexplorer/kitmanager.h>
  46. #include <qtsupport/qtversionmanager.h>
  47. #include <coreplugin/mimedatabase.h>
  48. #include <coreplugin/icore.h>
  49. namespace Tizen {
  50. TizenPlugin::TizenPlugin() :
  51. m_configurations(NULL)
  52. {
  53. Botan::LibraryInitializer::initialize("thread_safe=true");
  54. }
  55. TizenPlugin::~TizenPlugin()
  56. {
  57. delete m_configurations;
  58. Botan::LibraryInitializer::deinitialize();
  59. }
  60. bool TizenPlugin::initialize(const QStringList &arguments, QString *errorString)
  61. {
  62. Q_UNUSED(arguments);
  63. Q_UNUSED(errorString);
  64. m_configurations = new TizenConfigurations(this);
  65. addAutoReleasedObject(new Internal::TizenDeployDirectoryCreationFactory);
  66. addAutoReleasedObject(new Internal::TizenDeployPackageCreationFactory);
  67. addAutoReleasedObject(new Internal::TizenDeployPackageInstallationFactory);
  68. addAutoReleasedObject(new TizenSettingsPage);
  69. addAutoReleasedObject(new Internal::TizenQtVersionFactory);
  70. addAutoReleasedObject(new TizenToolchainFactory);
  71. addAutoReleasedObject(new Internal::TizenDeployConfigurationFactory);
  72. addAutoReleasedObject(new TizenDeviceFactory);
  73. Core::MimeGlobPattern tizenManifestGlobPattern(QLatin1String("manifest.xml"), Core::MimeGlobPattern::MaxWeight);
  74. Core::MimeType tizenManifestMimeType;
  75. tizenManifestMimeType.setType(QLatin1String(Constants::TIZEN_MANIFEST_MIME_TYPE));
  76. tizenManifestMimeType.setComment(tr("Tizen Manifest file"));
  77. tizenManifestMimeType.setGlobPatterns(QList<Core::MimeGlobPattern>() << tizenManifestGlobPattern);
  78. tizenManifestMimeType.setSubClassesOf(QStringList() << QLatin1String("application/xml"));
  79. if(!Core::ICore::mimeDatabase()->addMimeType(tizenManifestMimeType)) {
  80. *errorString = tr("Could not register MIME type for manifest.xml");
  81. return false;
  82. }
  83. addAutoReleasedObject(new TizenManifestEditorFactory);
  84. connect(ProjectExplorer::DeviceManager::instance(), SIGNAL(devicesLoaded()), SLOT(updateDevices()));
  85. connect(ProjectExplorer::KitManager::instance(), SIGNAL(kitsLoaded()), SLOT(updateKits()));
  86. m_connector = new Tizen::SdbConnector(this);
  87. m_connector->setServerPort(m_configurations->tizenConfig().m_sdbPort);
  88. m_connector->setSdbPath(m_configurations->tizenConfig().m_sdbLocation.toString());
  89. return true;
  90. }
  91. void TizenPlugin::extensionsInitialized()
  92. {
  93. }
  94. void TizenPlugin::updateKits()
  95. {
  96. m_configurations->updateAutomaticKitList();
  97. disconnect(ProjectExplorer::KitManager::instance(), SIGNAL(kitsLoaded()), this, SLOT(updateKits()));
  98. connect(QtSupport::QtVersionManager::instance(), SIGNAL(qtVersionsChanged(QList<int>,QList<int>,QList<int>)),
  99. m_configurations, SLOT(updateAutomaticKitList()));
  100. m_connector->startConnector();
  101. m_deviceMonitor = new TizenDeviceMonitor(m_connector, this);
  102. }
  103. void TizenPlugin::updateDevices()
  104. {
  105. m_configurations->updateDevices();
  106. }
  107. } // namespace Tizen
  108. Q_EXPORT_PLUGIN(Tizen::TizenPlugin)