generatordata.cpp 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. #include <QFileInfo>
  2. #include <QDir>
  3. #include <QDebug>
  4. #include "defines.h"
  5. #include "generatordata.h"
  6. #include "symbian/symbiandefines.h" // TODO remove eventually
  7. #include "maemo5/maemo5defines.h" // TODO remove eventually
  8. GeneratorData::GeneratorData()
  9. {
  10. m_isRemotelyCompiled = false;
  11. }
  12. void GeneratorData::clearAll()
  13. {
  14. m_configXmlData.clear();
  15. m_infoPlistData.clear();
  16. m_widgetSrcFiles.clear();
  17. m_pluginSrcFiles.clear();
  18. m_environmentVariables.clear();
  19. m_basePath.clear();
  20. }
  21. QString GeneratorData::infoPlistValue(const QString &key) const
  22. {
  23. return m_infoPlistData.value(key);
  24. }
  25. QString GeneratorData::configXmlValue(const QString &key) const
  26. {
  27. return m_configXmlData.value(key);
  28. }
  29. void GeneratorData::initPaths(QString projectFile,
  30. QString platformName)
  31. {
  32. QFileInfo targetInfo(projectFile);
  33. QString fileName = targetInfo.fileName().replace(QRegExp("\\s"), "_");
  34. m_buildDirectory = QString("/hag_build_");
  35. m_buildDirectory += platformName;
  36. m_buildDirectory += "/";
  37. /* OBS
  38. m_projectDirectory = QString("/hag_build/%1/").arg(fileName);
  39. m_widgetDirectory = QString("/hag_build/%1/widget/").arg(fileName);
  40. m_fwDirectory = QString("/hag_build/%1/fw/").arg(fileName);
  41. m_mwDirectory = QString("/hag_build/%1/mw/").arg(fileName);
  42. */
  43. m_projectDirectory = m_buildDirectory + QString("%1/").arg(fileName);
  44. if (platformName == SYMBIAN_PLATFORMNAME)
  45. {
  46. m_srcDirectory = m_projectDirectory;
  47. m_widgetDirectory = m_projectDirectory + QString("widget/");
  48. }
  49. else if (platformName == MAEMO5_PLATFORMNAME)
  50. {
  51. m_srcDirectory = m_projectDirectory + QString("src/");
  52. m_widgetDirectory = m_srcDirectory + QString("widget/");
  53. }
  54. else
  55. {
  56. ; // TODO this kind of code should not be here
  57. // TODO GeneratorData eventually should also be platform
  58. // specific
  59. }
  60. m_fwDirectory = m_projectDirectory + QString("fw/");
  61. m_mwDirectory = m_projectDirectory + QString("mw/");
  62. m_m5DataDirectory = m_projectDirectory + QString("data/");
  63. m_m5DebianDirectory = m_projectDirectory + QString("debian/");
  64. m_widgetFileName = fileName;
  65. if (targetInfo.canonicalPath().contains(QRegExp("\\s")))
  66. {
  67. // Widget path contains spaces -- use temp dir to make abld work
  68. m_basePath = QDir::tempPath() + HAG_TEMP_DIR;
  69. }
  70. else
  71. {
  72. // No spaces, use widget path
  73. m_basePath = targetInfo.canonicalPath();
  74. }
  75. }
  76. QString GeneratorData::basePath() const
  77. {
  78. return m_basePath;
  79. }
  80. QString GeneratorData::widgetFileName() const
  81. {
  82. return m_widgetFileName;
  83. }
  84. QString GeneratorData::buildDirectory() const
  85. {
  86. return m_basePath + m_buildDirectory;
  87. }
  88. QString GeneratorData::projectDirectory() const
  89. {
  90. return m_basePath + m_projectDirectory;
  91. }
  92. QString GeneratorData::widgetDirectory() const
  93. {
  94. return m_basePath + m_widgetDirectory;
  95. }
  96. QString GeneratorData::fwDirectory() const
  97. {
  98. return m_basePath + m_fwDirectory;
  99. }
  100. QString GeneratorData::mwDirectory() const
  101. {
  102. return m_basePath + m_mwDirectory;
  103. }
  104. QString GeneratorData::srcDirectory() const
  105. {
  106. return m_basePath + m_srcDirectory;
  107. }
  108. QString GeneratorData::m5DataDirectory() const
  109. {
  110. return m_basePath + m_m5DataDirectory;
  111. }
  112. QString GeneratorData::m5DebianDirectory() const
  113. {
  114. return m_basePath + m_m5DebianDirectory;
  115. }
  116. bool GeneratorData::isRemotelyCompiled() const
  117. {
  118. return m_isRemotelyCompiled;
  119. }
  120. void GeneratorData::setRemotelyCompiled(bool remotelyCompiled)
  121. {
  122. m_isRemotelyCompiled = remotelyCompiled;
  123. }