diff --git a/src/plugins/qmlprojectmanager/cmakegen/boilerplate.qrc b/src/plugins/qmlprojectmanager/cmakegen/boilerplate.qrc index b997114b2f0..a48666d883e 100644 --- a/src/plugins/qmlprojectmanager/cmakegen/boilerplate.qrc +++ b/src/plugins/qmlprojectmanager/cmakegen/boilerplate.qrc @@ -9,6 +9,7 @@ templates/qmlcomponents.tpl templates/environment_h.tpl templates/import_qml_components_h.tpl + templates/qtquickcontrols2_conf.tpl diff --git a/src/plugins/qmlprojectmanager/cmakegen/cmakegenerator.cpp b/src/plugins/qmlprojectmanager/cmakegen/cmakegenerator.cpp index abd812832c7..6a3f4afda03 100644 --- a/src/plugins/qmlprojectmanager/cmakegen/cmakegenerator.cpp +++ b/src/plugins/qmlprojectmanager/cmakegen/cmakegenerator.cpp @@ -9,6 +9,7 @@ #include "projectexplorer/projectmanager.h" #include "projectexplorer/projectnodes.h" +#include "projectexplorer/taskhub.h" #include "utils/filenamevalidatinglineedit.h" @@ -60,10 +61,11 @@ void CMakeGenerator::createMenuAction(QObject *parent) }); } -void CMakeGenerator::logIssue(const QString &text) +void CMakeGenerator::logIssue(ProjectExplorer::Task::TaskType type, const QString &text, const Utils::FilePath &file) { - // TODO: Use Issues panel as soon as it is usable in DS. - qDebug() << text; + ProjectExplorer::BuildSystemTask task(type, text, file); + ProjectExplorer::TaskHub::addTask(task); + ProjectExplorer::TaskHub::requestPopup(); } void CMakeGenerator::updateMenuAction() @@ -173,8 +175,8 @@ void CMakeGenerator::update(const QSet &added, const QSet &rem if (auto module = findModuleFor(node)) dirtyModules.insert(module); } else { - QString text("Failed to find Folder for file: %1"); - logIssue(text.arg(add)); + QString text("Failed to find Folder for file"); + logIssue(ProjectExplorer::Task::Error, text, path); } } @@ -338,10 +340,8 @@ bool CMakeGenerator::findFile(const NodePtr &node, const Utils::FilePath &file) void CMakeGenerator::insertFile(NodePtr &node, const Utils::FilePath &path) const { QString error; - if (!Utils::FileNameValidatingLineEdit::validateFileName(path.fileName(), false, &error)) { - QString text(path.path() + error); - logIssue(error); - } + if (!Utils::FileNameValidatingLineEdit::validateFileName(path.fileName(), false, &error)) + logIssue(ProjectExplorer::Task::Error, error, path); if (path.fileName() == "qmldir") { readQmlDir(path, node); @@ -485,9 +485,9 @@ void CMakeGenerator::compareWithFileSystem(const NodePtr &node) const files.push_back(next); } - const QString text("File %1 is not part of the project"); - for (const auto& file : files) - logIssue(text.arg(file.path())); + const QString text("File is not part of the project"); + for (const auto &file : files) + logIssue(ProjectExplorer::Task::Warning, text, file); } } // namespace GenerateCmake diff --git a/src/plugins/qmlprojectmanager/cmakegen/cmakegenerator.h b/src/plugins/qmlprojectmanager/cmakegen/cmakegenerator.h index e9e87da1412..fd7b7dfd5be 100644 --- a/src/plugins/qmlprojectmanager/cmakegen/cmakegenerator.h +++ b/src/plugins/qmlprojectmanager/cmakegen/cmakegenerator.h @@ -5,6 +5,7 @@ #include "cmakewriter.h" #include "utils/filepath.h" +#include "projectexplorer/task.h" #include @@ -25,7 +26,7 @@ class CMakeGenerator : public QObject public: static void createMenuAction(QObject *parent); - static void logIssue(const QString &text); + static void logIssue(ProjectExplorer::Task::TaskType type, const QString &text, const Utils::FilePath &file); CMakeGenerator(QmlBuildSystem *bs, QObject *parent = nullptr); diff --git a/src/plugins/qmlprojectmanager/cmakegen/cmakewriter.cpp b/src/plugins/qmlprojectmanager/cmakegen/cmakewriter.cpp index 65d4a8c6924..80ea56dfb9d 100644 --- a/src/plugins/qmlprojectmanager/cmakegen/cmakewriter.cpp +++ b/src/plugins/qmlprojectmanager/cmakegen/cmakewriter.cpp @@ -240,8 +240,8 @@ void CMakeWriter::writeFile(const Utils::FilePath &path, const QString &content) QTextStream stream(&fileHandle); stream << content; } else { - QString text("Failed to write file: %1"); - CMakeGenerator::logIssue(text.arg(path.path())); + QString text("Failed to write"); + CMakeGenerator::logIssue(ProjectExplorer::Task::Error, text, path); } fileHandle.close(); } diff --git a/src/plugins/qmlprojectmanager/cmakegen/cmakewriterv0.cpp b/src/plugins/qmlprojectmanager/cmakegen/cmakewriterv0.cpp index 71b6dbc4b0c..feac91f5873 100644 --- a/src/plugins/qmlprojectmanager/cmakegen/cmakewriterv0.cpp +++ b/src/plugins/qmlprojectmanager/cmakegen/cmakewriterv0.cpp @@ -21,13 +21,10 @@ CMakeWriterV0::CMakeWriterV0(CMakeGenerator *parent) bool CMakeWriterV0::isPlugin(const NodePtr &node) const { - if (CMakeWriter::isPlugin(node)) - return true; - if (node->type == Node::Type::App) return !node->files.empty() || !node->singletons.empty() || !node->resources.empty(); - return false; + return CMakeWriter::isPlugin(node); } void CMakeWriterV0::transformNode(NodePtr &node) const @@ -41,8 +38,8 @@ void CMakeWriterV0::transformNode(NodePtr &node) const } else if (node->type == Node::Type::App) { Utils::FilePath path = node->dir.pathAppended("main.qml"); if (!path.exists()) { - QString text("Expected File %1 not found."); - CMakeGenerator::logIssue(text.arg(path.path())); + QString text("Expected File not found."); + CMakeGenerator::logIssue(ProjectExplorer::Task::Error, text, path); return; } if (!parent()->findFile(path)) @@ -54,6 +51,12 @@ void CMakeWriterV0::writeRootCMakeFile(const NodePtr &node) const { QTC_ASSERT(parent(), return); + const Utils::FilePath quickControlsPath = node->dir.pathAppended("qtquickcontrols2.conf"); + if (!quickControlsPath.exists()) { + const QString quickControlsTemplate = readTemplate(":/templates/qtquickcontrols_conf"); + writeFile(quickControlsPath, quickControlsTemplate); + } + const Utils::FilePath insightPath = node->dir.pathAppended("insight"); if (!insightPath.exists()) { const QString insightTemplate = readTemplate(":/templates/insight"); diff --git a/src/plugins/qmlprojectmanager/cmakegen/templates/qtquickcontrols2_conf.tpl b/src/plugins/qmlprojectmanager/cmakegen/templates/qtquickcontrols2_conf.tpl new file mode 100644 index 00000000000..eb1f825a388 --- /dev/null +++ b/src/plugins/qmlprojectmanager/cmakegen/templates/qtquickcontrols2_conf.tpl @@ -0,0 +1,7 @@ +; This file can be edited to change the style of the application +; Read "Qt Quick Controls 2 Configuration File" for details: +; http://doc.qt.io/qt-5/qtquickcontrols2-configuration.html + +[Controls] +Style=Basic +