diff --git a/.gitignore b/.gitignore index 6cbeb2503d5..7c56e80373d 100644 --- a/.gitignore +++ b/.gitignore @@ -56,6 +56,7 @@ CMakeLists.txt.user* /share/qtcreator/qmldesigner/QtProject/ /src/app/Info.plist /src/plugins/**/*.json +!/src/plugins/**/wizard.json /src/plugins/coreplugin/ide_version.h /src/libs/qt-breakpad/bin /.cmake/ diff --git a/src/plugins/compilerexplorer/CMakeLists.txt b/src/plugins/compilerexplorer/CMakeLists.txt index 4df45f95f30..55368044706 100644 --- a/src/plugins/compilerexplorer/CMakeLists.txt +++ b/src/plugins/compilerexplorer/CMakeLists.txt @@ -1,5 +1,5 @@ add_qtc_plugin(CompilerExplorer - PLUGIN_DEPENDS Core TextEditor + PLUGIN_DEPENDS Core ProjectExplorer TextEditor DEPENDS Qt::Network TerminalLib Spinner SOURCES api/config.h @@ -14,6 +14,8 @@ add_qtc_plugin(CompilerExplorer api/library.h api/request.h + compilerexplorer.qrc + compilerexploreraspects.cpp compilerexploreraspects.h compilerexplorerplugin.cpp diff --git a/src/plugins/compilerexplorer/compilerexplorer.qbs b/src/plugins/compilerexplorer/compilerexplorer.qbs index 88fda3bf616..47eb03f9e46 100644 --- a/src/plugins/compilerexplorer/compilerexplorer.qbs +++ b/src/plugins/compilerexplorer/compilerexplorer.qbs @@ -4,6 +4,7 @@ QtcPlugin { name: "CompilerExplorer" Depends { name: "Core" } + Depends { name: "ProjectExplorer" } Depends { name: "Spinner" } Depends { name: "TerminalLib" } Depends { name: "TextEditor" } @@ -22,6 +23,8 @@ QtcPlugin { "api/library.h", "api/request.h", + "compilerexplorer.qrc", + "compilerexploreraspects.cpp", "compilerexploreraspects.h", "compilerexplorerconstants.h", diff --git a/src/plugins/compilerexplorer/compilerexplorer.qrc b/src/plugins/compilerexplorer/compilerexplorer.qrc new file mode 100644 index 00000000000..592a92d463a --- /dev/null +++ b/src/plugins/compilerexplorer/compilerexplorer.qrc @@ -0,0 +1,6 @@ + + + wizard/cpp/wizard.json + wizard/cpp/file.qtce + + diff --git a/src/plugins/compilerexplorer/compilerexplorereditor.cpp b/src/plugins/compilerexplorer/compilerexplorereditor.cpp index b02b3585ace..633ac3622be 100644 --- a/src/plugins/compilerexplorer/compilerexplorereditor.cpp +++ b/src/plugins/compilerexplorer/compilerexplorereditor.cpp @@ -136,6 +136,8 @@ Core::IDocument::OpenResult JsonSettingsDocument::open(QString *errorString, return OpenResult::ReadError; } + setFilePath(filePath); + m_ceSettings.fromMap(*result); emit settingsChanged(); return OpenResult::Success; @@ -171,6 +173,7 @@ bool JsonSettingsDocument::saveImpl(QString *errorString, const FilePath &newFil return false; } + emit changed(); return true; } diff --git a/src/plugins/compilerexplorer/compilerexplorerplugin.cpp b/src/plugins/compilerexplorer/compilerexplorerplugin.cpp index 5845aa7dea2..4063814e6ca 100644 --- a/src/plugins/compilerexplorer/compilerexplorerplugin.cpp +++ b/src/plugins/compilerexplorer/compilerexplorerplugin.cpp @@ -14,10 +14,12 @@ #include -#include - #include +#include + +#include + using namespace Core; namespace CompilerExplorer::Internal { @@ -40,6 +42,8 @@ public: settings().defaultDocument().toUtf8()); }); + ProjectExplorer::JsonWizardFactory::addWizardPath(":/compilerexplorer/wizard/"); + ActionContainer *mtools = ActionManager::actionContainer(Core::Constants::M_TOOLS); ActionContainer *mCompilerExplorer = ActionManager::createMenu("Tools.CompilerExplorer"); QMenu *menu = mCompilerExplorer->menu(); diff --git a/src/plugins/compilerexplorer/wizard/cpp/file.qtce b/src/plugins/compilerexplorer/wizard/cpp/file.qtce new file mode 100644 index 00000000000..903d5187165 --- /dev/null +++ b/src/plugins/compilerexplorer/wizard/cpp/file.qtce @@ -0,0 +1,10 @@ +{ + "Sources": [{ + "LanguageId": "c++", + "Source": "int main() {\n return 0;\n}", + "Compilers": [{ + "Id": "clang_trunk", + "Options": "-O3" + }] + }] +} diff --git a/src/plugins/compilerexplorer/wizard/cpp/wizard.json b/src/plugins/compilerexplorer/wizard/cpp/wizard.json new file mode 100644 index 00000000000..b736551b69e --- /dev/null +++ b/src/plugins/compilerexplorer/wizard/cpp/wizard.json @@ -0,0 +1,37 @@ +{ + "version": 1, + "supportedProjectTypes": [], + "id": "QTCE.CppSource", + "category": "U.CompilerExplorer", + "trDescription": "Creates an example CompilerExplorer setup for C++.", + "trDisplayName": "Compiler Explorer C++ Source", + "trDisplayCategory": "Compiler Explorer", + "icon": "", + "iconKind": "Plain", + "options": { + "key": "DefaultSuffix", + "value": "%{JS: Util.preferredSuffix('application/compiler-explorer')}" + }, + "pages": [ + { + "trDisplayName": "Location", + "trShortTitle": "Location", + "typeId": "File" + }, + { + "trDisplayName": "Project Management", + "trShortTitle": "Summary", + "typeId": "Summary" + } + ], + "generators": [ + { + "typeId": "File", + "data": { + "source": "file.qtce", + "target": "%{JS: Util.fileName(value('TargetPath'), value('DefaultSuffix'))}", + "openInEditor": true + } + } + ] +}