CompilerExplorer: Add wizard template

Also include "src/plugins/**/wizard.json" into .gitignore.

Change-Id: Ib0576df15af4c112a4a27101d337522db6c19f25
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
Marcus Tillmanns
2023-09-26 09:20:26 +02:00
parent 9e241add5f
commit b60a4705d0
8 changed files with 69 additions and 3 deletions

1
.gitignore vendored
View File

@@ -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/

View File

@@ -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

View File

@@ -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",

View File

@@ -0,0 +1,6 @@
<RCC>
<qresource prefix="/compilerexplorer/wizard/">
<file>wizard/cpp/wizard.json</file>
<file>wizard/cpp/file.qtce</file>
</qresource>
</RCC>

View File

@@ -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;
}

View File

@@ -14,10 +14,12 @@
#include <cppeditor/cppeditorconstants.h>
#include <QMenu>
#include <extensionsystem/iplugin.h>
#include <projectexplorer/jsonwizard/jsonwizardfactory.h>
#include <QMenu>
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();

View File

@@ -0,0 +1,10 @@
{
"Sources": [{
"LanguageId": "c++",
"Source": "int main() {\n return 0;\n}",
"Compilers": [{
"Id": "clang_trunk",
"Options": "-O3"
}]
}]
}

View File

@@ -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
}
}
]
}