tizenplugin.cpp 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. /****************************************************************************
  2. **
  3. ** Copyright (C) 2013 Jarek Pelczar <jpelczar@gmail.com>
  4. ** Copyright (C) 2014 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 <QLoggingCategory>
  30. #include "tizendebug.h"
  31. #include "tizenplugin.h"
  32. #include "tizenconfigurations.h"
  33. #include "tizenconstants.h"
  34. #include "tizenmanifesteditorfactory.h"
  35. #include "tizensettingspage.h"
  36. #include "tizentoolchain.h"
  37. #include "tizenqtversionfactory.h"
  38. #include "tizendevicefactory.h"
  39. #include "tizendevicemonitor.h"
  40. #include "sdbconnector.h"
  41. #include "tizendeploydirectorycreationfactory.h"
  42. #include "tizendeploypackagecreationfactory.h"
  43. #include "tizendeploypackageinstallationfactory.h"
  44. #include "tizendeployconfiguration.h"
  45. #include "botan/botan.h"
  46. #include <coreplugin/mimedatabase.h>
  47. #include <coreplugin/icore.h>
  48. #include <projectexplorer/kitmanager.h>
  49. #include <qtsupport/qtversionmanager.h>
  50. namespace Tizen {
  51. TizenPlugin::TizenPlugin()
  52. {
  53. if (!qgetenv("QTCREATOR_PLUGIN_TIZEN_DEBUG").isEmpty()) {
  54. QTC_TIZEN().setEnabled(QtDebugMsg, true);
  55. }
  56. if (!qgetenv("QTCREATOR_PLUGIN_TIZEN_SBDCONNECTOR_DEBUG").isEmpty()) {
  57. QTC_TIZEN_SDBCONNECTOR().setEnabled(QtDebugMsg, true);
  58. }
  59. QTC_TIZEN().setEnabled(QtDebugMsg, true);
  60. QTC_TIZEN_SDBCONNECTOR().setEnabled(QtDebugMsg, true);
  61. Botan::LibraryInitializer::initialize("thread_safe=true");
  62. }
  63. TizenPlugin::~TizenPlugin()
  64. {
  65. Botan::LibraryInitializer::deinitialize();
  66. }
  67. bool TizenPlugin::initialize(const QStringList &arguments, QString *errorString)
  68. {
  69. Q_UNUSED(arguments);
  70. Q_UNUSED(errorString);
  71. new Internal::TizenConfigurations(this);
  72. addAutoReleasedObject(new Internal::TizenSettingsPage);
  73. addAutoReleasedObject(new Internal::TizenToolChainFactory);
  74. addAutoReleasedObject(new Internal::TizenQtVersionFactory);
  75. addAutoReleasedObject(new Internal::TizenDeviceFactory);
  76. addAutoReleasedObject(new Internal::TizenDeployDirectoryCreationFactory);
  77. addAutoReleasedObject(new Internal::TizenDeployPackageCreationFactory);
  78. addAutoReleasedObject(new Internal::TizenDeployPackageInstallationFactory);
  79. addAutoReleasedObject(new Internal::TizenDeployConfigurationFactory);
  80. Core::MimeGlobPattern tizenManifestGlobPattern(QLatin1String("manifest.xml"), Core::MimeGlobPattern::MaxWeight);
  81. Core::MimeType tizenManifestMimeType;
  82. tizenManifestMimeType.setType(QLatin1String(Constants::TIZEN_MANIFEST_MIME_TYPE));
  83. tizenManifestMimeType.setComment(tr("Tizen Manifest file"));
  84. tizenManifestMimeType.setGlobPatterns(QList<Core::MimeGlobPattern>() << tizenManifestGlobPattern);
  85. tizenManifestMimeType.setSubClassesOf(QStringList() << QLatin1String("application/xml"));
  86. if(!Core::MimeDatabase::addMimeType(tizenManifestMimeType)) {
  87. *errorString = tr("Could not register MIME type for Tizen's manifest.xml");
  88. return false;
  89. }
  90. addAutoReleasedObject(new Internal::TizenManifestEditorFactory);
  91. // connect(ProjectExplorer::DeviceManager::instance(), SIGNAL(devicesLoaded()), SLOT(updateDevices()));
  92. connect(ProjectExplorer::KitManager::instance(), SIGNAL(kitsLoaded()), SLOT(kitsRestored()));
  93. return true;
  94. }
  95. void TizenPlugin::extensionsInitialized()
  96. {
  97. }
  98. void TizenPlugin::kitsRestored()
  99. {
  100. qCDebug(QTC_TIZEN);
  101. Internal::TizenConfigurations::updateAutomaticKitList();
  102. disconnect(ProjectExplorer::KitManager::instance(), SIGNAL(kitsLoaded()),
  103. this, SLOT(kitsRestored()));
  104. connect(QtSupport::QtVersionManager::instance(), SIGNAL(qtVersionsChanged(QList<int>,QList<int>,QList<int>)),
  105. Internal::TizenConfigurations::instance(), SLOT(updateAutomaticKitList()));
  106. m_deviceMonitor = new Internal::TizenDeviceMonitor(this);
  107. }
  108. void TizenPlugin::updateDevices()
  109. {
  110. // m_configurations->updateDevices();
  111. }
  112. } // namespace Tizen
  113. Q_EXPORT_PLUGIN(Tizen::TizenPlugin)