forked from qt-creator/qt-creator
QmlDesigner: Refactor QmlProjectManager tests
Task-number: QDS-9743 Change-Id: Ia5e788fcebacef59ba12226e2c873f5cbf8954ba Reviewed-by: Marco Bubke <marco.bubke@qt.io>
This commit is contained in:
@@ -6,7 +6,6 @@ add_qtc_plugin(QmlProjectManager
|
||||
SOURCES
|
||||
qmlprojectgen/qmlprojectgenerator.cpp qmlprojectgen/qmlprojectgenerator.h
|
||||
qmlprojectgen/templates.qrc
|
||||
|
||||
projectfilecontenttools.cpp projectfilecontenttools.h
|
||||
qdslandingpage.cpp qdslandingpage.h
|
||||
qdslandingpagetheme.cpp qdslandingpagetheme.h
|
||||
@@ -53,3 +52,17 @@ extend_qtc_plugin(QmlProjectManager
|
||||
generatecmakelistsconstants.h
|
||||
boilerplate.qrc
|
||||
)
|
||||
|
||||
add_qtc_library(QmlProjectManagerLib OBJECT
|
||||
CONDITION Qt6_VERSION VERSION_GREATER_EQUAL 6.4.3
|
||||
EXCLUDE_FROM_INSTALL
|
||||
DEPENDS
|
||||
QmlJS Utils
|
||||
INCLUDES
|
||||
${CMAKE_CURRENT_LIST_DIR}
|
||||
SOURCES_PREFIX ${CMAKE_CURRENT_LIST_DIR}/buildsystem
|
||||
SOURCES
|
||||
projectitem/filefilteritems.cpp projectitem/filefilteritems.h
|
||||
projectitem/qmlprojectitem.cpp projectitem/qmlprojectitem.h
|
||||
projectitem/converters.cpp projectitem/converters.h
|
||||
)
|
||||
|
||||
@@ -337,7 +337,7 @@ QJsonObject qmlProjectTojson(const Utils::FilePath &projectFile)
|
||||
targetObject.insert("files", files);
|
||||
fileGroupsObject.insert(propsPair.first, targetObject);
|
||||
} else if (childNode->name().contains("shadertool", Qt::CaseInsensitive)) {
|
||||
QStringList quotedArgs = childNode->property("args").value.toString().split('\"');
|
||||
QStringList quotedArgs = childNode->property("args").value.toString().split('\"', Qt::SkipEmptyParts);
|
||||
QStringList args;
|
||||
for (int i = 0; i < quotedArgs.size(); ++i) {
|
||||
// Each odd arg in this list is a single quoted argument, which we should
|
||||
|
||||
@@ -18,8 +18,9 @@ namespace QmlProjectManager {
|
||||
|
||||
//#define REWRITE_PROJECT_FILE_IN_JSON_FORMAT
|
||||
|
||||
QmlProjectItem::QmlProjectItem(const Utils::FilePath &filePath)
|
||||
QmlProjectItem::QmlProjectItem(const Utils::FilePath &filePath, const bool skipRewrite)
|
||||
: m_projectFile(filePath)
|
||||
, m_skipRewrite(skipRewrite)
|
||||
{
|
||||
if (initProjectObject())
|
||||
setupFileFilters();
|
||||
@@ -394,9 +395,8 @@ void QmlProjectItem::addShaderToolFile(const QString &file)
|
||||
void QmlProjectItem::insertAndUpdateProjectFile(const QString &key, const QJsonValue &value)
|
||||
{
|
||||
m_project[key] = value;
|
||||
#ifndef TESTS_ENABLED_QMLPROJECTITEM
|
||||
m_projectFile.writeFileContents(Converters::jsonToQmlProject(m_project).toUtf8());
|
||||
#endif
|
||||
if (!m_skipRewrite)
|
||||
m_projectFile.writeFileContents(Converters::jsonToQmlProject(m_project).toUtf8());
|
||||
}
|
||||
|
||||
} // namespace QmlProjectManager
|
||||
|
||||
@@ -26,7 +26,7 @@ class QmlProjectItem : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit QmlProjectItem(const Utils::FilePath &filePath);
|
||||
explicit QmlProjectItem(const Utils::FilePath &filePath, const bool skipRewrite = false);
|
||||
|
||||
bool isQt4McuProject() const;
|
||||
|
||||
@@ -103,6 +103,7 @@ private:
|
||||
// runtime variables
|
||||
Utils::FilePath m_projectFile; // design studio project file
|
||||
QJsonObject m_project; // root project object
|
||||
const bool m_skipRewrite;
|
||||
|
||||
// initializing functions
|
||||
bool initProjectObject();
|
||||
|
||||
Reference in New Issue
Block a user