tizenqtversionfactory.cpp 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  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 "tizendebug.h"
  30. #include "tizenqtversionfactory.h"
  31. #include "tizenqtversion.h"
  32. #include "tizenconstants.h"
  33. #include "tizenconfigurations.h"
  34. #include <proparser/profileevaluator.h>
  35. #include <utils/qtcassert.h>
  36. #include <QFileInfo>
  37. using namespace QtSupport;
  38. namespace Tizen {
  39. namespace Internal {
  40. TizenQtVersionFactory::TizenQtVersionFactory(QObject * parent) :
  41. QtVersionFactory(parent)
  42. {
  43. }
  44. bool TizenQtVersionFactory::canRestore(const QString &type)
  45. {
  46. return type == QLatin1String(Constants::TIZEN_QT);
  47. }
  48. QtSupport::BaseQtVersion *TizenQtVersionFactory::restore(const QString &type,
  49. const QVariantMap &data)
  50. {
  51. QTC_ASSERT(canRestore(type), return 0);
  52. TizenQtVersion * q = new TizenQtVersion();
  53. q->fromMap(data);
  54. return q;
  55. }
  56. int TizenQtVersionFactory::priority() const
  57. {
  58. return 90;
  59. }
  60. QtSupport::BaseQtVersion * TizenQtVersionFactory::create(const Utils::FileName &qmakePath, ProFileEvaluator *evaluator,
  61. bool isAutoDetected, const QString &autoDetectionSource)
  62. {
  63. QFileInfo fi = qmakePath.toFileInfo();
  64. if(!fi.exists() || !fi.isExecutable() || !fi.isFile())
  65. return 0;
  66. if (evaluator->value(QLatin1String("QMAKE_PLATFORM")) != QLatin1String("tizen"))
  67. return 0;
  68. QString profile = evaluator->resolvedMkSpec();
  69. profile = profile.remove(0,profile.lastIndexOf(QLatin1Char('-')) + 1);
  70. qCDebug(QTC_TIZEN) << "autodetectionSource:" << autoDetectionSource
  71. << " resolveMkSpec:" << evaluator->resolvedMkSpec();
  72. TizenQtVersion * ret = new TizenQtVersion(qmakePath, isAutoDetected, autoDetectionSource);
  73. QString displayName;
  74. if (qmakePath.toString().endsWith(QStringLiteral("qmake-gbs-host"))) {
  75. displayName = QString(QLatin1String("Qt %1 (Tizen %2 GBS)")).arg(ret->qtVersionString()).arg(profile);
  76. } else {
  77. displayName = QString(QLatin1String("Qt %1 (Tizen %2)")).arg(ret->qtVersionString()).arg(profile);
  78. }
  79. ret->setDisplayName(displayName);
  80. return ret;
  81. }
  82. } //Internal
  83. } // namespace Tizen