tizenqtversionfactory.cpp 3.4 KB

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