diff --git a/src/libs/extensionsystem/pluginspec.cpp b/src/libs/extensionsystem/pluginspec.cpp index 19be010c4de..cde1903099f 100644 --- a/src/libs/extensionsystem/pluginspec.cpp +++ b/src/libs/extensionsystem/pluginspec.cpp @@ -31,6 +31,7 @@ #include "pluginmanager.h" #include +#include #include #include @@ -630,12 +631,9 @@ static inline QString msgInvalidFormat(const char *key, const QString &content) .arg(QLatin1String(key), content); } -static inline bool readMultiLineString(const QJsonValue &value, QString *out) +bool PluginSpec::readMultiLineString(const QJsonValue &value, QString *out) { - if (!out) { - qCWarning(pluginLog) << Q_FUNC_INFO << "missing output parameter"; - return false; - } + QTC_ASSERT(out, return false); if (value.isString()) { *out = value.toString(); } else if (value.isArray()) { @@ -737,7 +735,7 @@ bool PluginSpecPrivate::readMetaData(const QJsonObject &pluginMetaData) copyright = value.toString(); value = metaData.value(QLatin1String(DESCRIPTION)); - if (!value.isUndefined() && !readMultiLineString(value, &description)) + if (!value.isUndefined() && !PluginSpec::readMultiLineString(value, &description)) return reportError(msgValueIsNotAString(DESCRIPTION)); value = metaData.value(QLatin1String(URL)); @@ -751,7 +749,7 @@ bool PluginSpecPrivate::readMetaData(const QJsonObject &pluginMetaData) category = value.toString(); value = metaData.value(QLatin1String(LICENSE)); - if (!value.isUndefined() && !readMultiLineString(value, &license)) + if (!value.isUndefined() && !PluginSpec::readMultiLineString(value, &license)) return reportError(msgValueIsNotAMultilineString(LICENSE)); value = metaData.value(QLatin1String(PLATFORM)); diff --git a/src/libs/extensionsystem/pluginspec.h b/src/libs/extensionsystem/pluginspec.h index 0462acddefe..da89ff6029f 100644 --- a/src/libs/extensionsystem/pluginspec.h +++ b/src/libs/extensionsystem/pluginspec.h @@ -131,6 +131,8 @@ public: bool hasError() const; QString errorString() const; + static bool readMultiLineString(const QJsonValue &value, QString *out); + private: PluginSpec(); diff --git a/src/plugins/android/Android.json.in b/src/plugins/android/Android.json.in index 43268da1c2b..eda39dd3a24 100644 --- a/src/plugins/android/Android.json.in +++ b/src/plugins/android/Android.json.in @@ -17,14 +17,14 @@ \"Url\" : \"http://necessitas.kde.org\", $$dependencyList, - \"Mimetypes\" : \" - - - - Android manifest file - - - - - \" + \"Mimetypes\" : [ + \"\", + \"\", + \" \", + \" Android manifest file\", + \" \", + \" \", + \" \", + \"\" + ] } diff --git a/src/plugins/clearcase/ClearCase.json.in b/src/plugins/clearcase/ClearCase.json.in index b9153225d75..24384b8ab66 100644 --- a/src/plugins/clearcase/ClearCase.json.in +++ b/src/plugins/clearcase/ClearCase.json.in @@ -19,13 +19,13 @@ \"Url\" : \"http://www.qt.io\", $$dependencyList, - \"Mimetypes\" : \" - - - - ClearCase submit template - - - - \" + \"Mimetypes\" : [ + \"\", + \"\", + \" \", + \" ClearCase submit template\", + \" \", + \" \", + \"\" + ] } diff --git a/src/plugins/cmakeprojectmanager/CMakeProjectManager.json.in b/src/plugins/cmakeprojectmanager/CMakeProjectManager.json.in index 5d75c622a8d..5bf0dc4ad5c 100644 --- a/src/plugins/cmakeprojectmanager/CMakeProjectManager.json.in +++ b/src/plugins/cmakeprojectmanager/CMakeProjectManager.json.in @@ -17,19 +17,19 @@ \"Url\" : \"http://www.qt.io\", $$dependencyList, - \"Mimetypes\" : \" - - - - - CMake Project file - - - - - CMake Project file - - - - \" + \"Mimetypes\" : [ + \"\", + \"\", + \" \", + \" \", + \" CMake Project file\", + \" \", + \" \", + \" \", + \" \", + \" CMake Project file\", + \" \", + \" \", + \"\" + ] } diff --git a/src/plugins/coreplugin/coreplugin.cpp b/src/plugins/coreplugin/coreplugin.cpp index fed19490ca6..a51d418a6c7 100644 --- a/src/plugins/coreplugin/coreplugin.cpp +++ b/src/plugins/coreplugin/coreplugin.cpp @@ -131,8 +131,9 @@ bool CorePlugin::initialize(const QStringList &arguments, QString *errorMessage) continue; const QJsonObject metaData = plugin->metaData(); const QJsonValue mimetypes = metaData.value("Mimetypes"); - if (mimetypes.isString()) - Utils::addMimeTypes(plugin->name() + ".mimetypes", mimetypes.toString().trimmed().toUtf8()); + QString mimetypeString; + if (ExtensionSystem::PluginSpec::readMultiLineString(mimetypes, &mimetypeString)) + Utils::addMimeTypes(plugin->name() + ".mimetypes", mimetypeString.trimmed().toUtf8()); } if (ThemeEntry::availableThemes().isEmpty()) { diff --git a/src/plugins/cpptools/CppTools.json.in b/src/plugins/cpptools/CppTools.json.in index a9af2e54d6d..c95a262683f 100644 --- a/src/plugins/cpptools/CppTools.json.in +++ b/src/plugins/cpptools/CppTools.json.in @@ -18,101 +18,101 @@ \"Url\" : \"http://www.qt.io\", $$dependencyList, - \"Mimetypes\" : \" - - - - C source code - - - - + \"Mimetypes\" : [ + \"\", + \"\", + \" \", + \" C source code\", + \" \", + \" \", + \" \", + \" \", - - - NVIDIA CUDA C source code - - + \" \", + \" \", + \" NVIDIA CUDA C source code\", + \" \", + \" \", - - C header - - - - + \" \", + \" C header\", + \" \", + \" \", + \" \", + \" \", - - - - C++ header - - - - - - - - - - - - - - - + \" \", + \" \", + \" \", + \" C++ header\", + \" \", + \" \", + \" \", + \" \", + \" \", + \" \", + \" \", + \" \", + \" \", + \" \", + \" \", + \" \", + \" \", + \" \", + \" \", - - C++ source code - - - - - - - - - - - - - - - - - + \" \", + \" C++ source code\", + \" \", + \" \", + \" \", + \" \", + \" \", + \" \", + \" \", + \" \", + \" \", + \" \", + \" \", + \" \", + \" \", + \" \", + \" \", + \" \", + \" \", - - Qt documentation file - - - + \" \", + \" Qt documentation file\", + \" \", + \" \", + \" \", - - Qt MOC file - - - - + \" \", + \" Qt MOC file\", + \" \", + \" \", + \" \", + \" \", - - Objective-C++ source code - - - - + \" \", + \" Objective-C++ source code\", + \" \", + \" \", + \" \", + \" \", - - Objective-C source code - - - - - - + \" \", + \" Objective-C source code\", + \" \", + \" \", + \" \", + \" \", + \" \", + \" \", - - \" + \"\" + ] } diff --git a/src/plugins/cvs/CVS.json.in b/src/plugins/cvs/CVS.json.in index d18e228f1de..1efdd73d48d 100644 --- a/src/plugins/cvs/CVS.json.in +++ b/src/plugins/cvs/CVS.json.in @@ -17,13 +17,13 @@ \"Url\" : \"http://www.qt.io\", $$dependencyList, - \"Mimetypes\" : \" - - - - CVS submit template - - - - \" + \"Mimetypes\" : [ + \"\", + \"\", + \" \", + \" CVS submit template\", + \" \", + \" \", + \"\" + ] } diff --git a/src/plugins/debugger/Debugger.json.in b/src/plugins/debugger/Debugger.json.in index 458d1a84564..c4ed7f18e3f 100644 --- a/src/plugins/debugger/Debugger.json.in +++ b/src/plugins/debugger/Debugger.json.in @@ -41,20 +41,20 @@ ], $$dependencyList, - \"Mimetypes\" : \" - - - - - Assembler - - - - - - Qt Creator Generic Assembler - - - - \" + \"Mimetypes\" : [ + \"\", + \"\", + \" \", + \" \", + \" Assembler\", + \" \", + \" \", + \" \", + \" \", + \" \", + \" Qt Creator Generic Assembler\", + \" \", + \" \", + \"\" + ] } diff --git a/src/plugins/genericprojectmanager/GenericProjectManager.json.in b/src/plugins/genericprojectmanager/GenericProjectManager.json.in index cc9ce119d4b..306d2fcaa48 100644 --- a/src/plugins/genericprojectmanager/GenericProjectManager.json.in +++ b/src/plugins/genericprojectmanager/GenericProjectManager.json.in @@ -17,34 +17,34 @@ \"Url\" : \"http://www.qt.io\", $$dependencyList, - \"Mimetypes\" : \" - + \"Mimetypes\" : [ + \"\", - - - - Generic Qt Creator Project file - - + \"\", + \" \", + \" \", + \" Generic Qt Creator Project file\", + \" \", + \" \", - - - Generic Project Files - - + \" \", + \" \", + \" Generic Project Files\", + \" \", + \" \", - - - Generic Project Include Paths - - + \" \", + \" \", + \" Generic Project Include Paths\", + \" \", + \" \", - - - Generic Project Configuration File - - + \" \", + \" \", + \" Generic Project Configuration File\", + \" \", + \" \", - - \" + \"\" + ] } diff --git a/src/plugins/git/Git.json.in b/src/plugins/git/Git.json.in index c2680577baf..ebbee5d4096 100644 --- a/src/plugins/git/Git.json.in +++ b/src/plugins/git/Git.json.in @@ -17,20 +17,20 @@ \"Url\" : \"http://www.qt.io\", $$dependencyList, - \"Mimetypes\" : \" - - - - - Git Commit File - - - - - - Git Commit File - - - - \" + \"Mimetypes\" : [ + \"\", + \"\", + \" \", + \" \", + \" Git Commit File\", + \" \", + \" \", + \" \", + \" \", + \" \", + \" Git Commit File\", + \" \", + \" \", + \"\" + ] } diff --git a/src/plugins/glsleditor/GLSLEditor.json.in b/src/plugins/glsleditor/GLSLEditor.json.in index 915ae7ae029..09814901a26 100644 --- a/src/plugins/glsleditor/GLSLEditor.json.in +++ b/src/plugins/glsleditor/GLSLEditor.json.in @@ -17,48 +17,48 @@ \"Url\" : \"http://www.qt.io\", $$dependencyList, - \"Mimetypes\" : \" - - + \"Mimetypes\" : [ + \"\", + \"\", - - - - GLSL Shader file - - - + \" \", + \" \", + \" \", + \" GLSL Shader file\", + \" \", + \" \", + \" \", - - - GLSL Fragment Shader file - - + \" \", + \" \", + \" GLSL Fragment Shader file\", + \" \", + \" \", - - - GLSL/ES Fragment Shader file - - + \" \", + \" \", + \" GLSL/ES Fragment Shader file\", + \" \", + \" \", - - - GLSL Vertex Shader file - - + \" \", + \" \", + \" GLSL Vertex Shader file\", + \" \", + \" \", - - - GLSL/ES Vertex Shader file - - + \" \", + \" \", + \" GLSL/ES Vertex Shader file\", + \" \", + \" \", - - - GLSL/ES Geometry Shader file - - + \" \", + \" \", + \" GLSL/ES Geometry Shader file\", + \" \", + \" \", - - \" + \"\" + ] } diff --git a/src/plugins/imageviewer/ImageViewer.json.in b/src/plugins/imageviewer/ImageViewer.json.in index 685dff9a9f1..59fa5f72826 100644 --- a/src/plugins/imageviewer/ImageViewer.json.in +++ b/src/plugins/imageviewer/ImageViewer.json.in @@ -17,15 +17,15 @@ \"Url\" : \"http://www.qt.io\", $$dependencyList, - \"Mimetypes\" : \" - - + \"Mimetypes\" : [ + \"\", + \"\", - - WebP Image file - - + \" \", + \" WebP Image file\", + \" \", + \" \", - - \" + \"\" + ] } diff --git a/src/plugins/modeleditor/ModelEditor.json.in b/src/plugins/modeleditor/ModelEditor.json.in index 44558589be4..8fc6c019cb0 100644 --- a/src/plugins/modeleditor/ModelEditor.json.in +++ b/src/plugins/modeleditor/ModelEditor.json.in @@ -18,14 +18,14 @@ \"Experimental\" : true, $$dependencyList, - \"Mimetypes\" : \" - - - - - Qt Creator Model File - - - - \" + \"Mimetypes\" : [ + \"\", + \"\", + \" \", + \" \", + \" Qt Creator Model File\", + \" \", + \" \", + \"\" + ] } diff --git a/src/plugins/nim/Nim.json.in b/src/plugins/nim/Nim.json.in index 3fc6a651350..9f44b2ce45c 100644 --- a/src/plugins/nim/Nim.json.in +++ b/src/plugins/nim/Nim.json.in @@ -18,27 +18,27 @@ \"Experimental\" : true, $$dependencyList, - \"Mimetypes\" : \" - - + \"Mimetypes\" : [ + \"\", + \"\", - - - Nim project file - - + \" \", + \" \", + \" Nim project file\", + \" \", + \" \", - - - Nim source file - - + \" \", + \" \", + \" Nim source file \", + \" \", + \" \", - - - Nim script file - - - - \" + \" \", + \" \", + \" Nim script file \", + \" \", + \" \", + \"\" + ] } diff --git a/src/plugins/perforce/Perforce.json.in b/src/plugins/perforce/Perforce.json.in index 7d408c00e4d..cb92d2542d0 100644 --- a/src/plugins/perforce/Perforce.json.in +++ b/src/plugins/perforce/Perforce.json.in @@ -17,16 +17,16 @@ \"Url\" : \"http://www.qt.io\", $$dependencyList, - \"Mimetypes\" : \" - - - - Perforce submit template - - - - - - - \" + \"Mimetypes\" : [ + \"\", + \"\", + \" \", + \" Perforce submit template\", + \" \", + \" \", + \" \", + \" \", + \" \", + \"\" + ] } diff --git a/src/plugins/pythoneditor/PythonEditor.json.in b/src/plugins/pythoneditor/PythonEditor.json.in index 5f3709887d9..5416dbfa63c 100644 --- a/src/plugins/pythoneditor/PythonEditor.json.in +++ b/src/plugins/pythoneditor/PythonEditor.json.in @@ -17,19 +17,19 @@ \"Url\" : \"http://www.qt.io\", $$dependencyList, - \"Mimetypes\" : \" - - - - - Python source file without console - - - - - Qt Creator Python project file - - - - \" + \"Mimetypes\" : [ + \"\", + \"\", + \" \", + \" \", + \" Python source file without console\", + \" \", + \" \", + \" \", + \" \", + \" Qt Creator Python project file\", + \" \", + \" \", + \"\" + ] } diff --git a/src/plugins/qmakeprojectmanager/QmakeProjectManager.json.in b/src/plugins/qmakeprojectmanager/QmakeProjectManager.json.in index ae3d11d8c0e..6f4826ed55d 100644 --- a/src/plugins/qmakeprojectmanager/QmakeProjectManager.json.in +++ b/src/plugins/qmakeprojectmanager/QmakeProjectManager.json.in @@ -17,39 +17,39 @@ \"Url\" : \"http://www.qt.io\", $$dependencyList, - \"Mimetypes\" : \" - - - - - Qt Project file - - - - - Qt Project include file - - - - - Qt Project feature file - - - - - Qt Project configuration file - - - - - Qt Project cache file - - - - - Qt Project stash file - - - - \" + \"Mimetypes\" : [ + \"\", + \"\", + \" \", + \" \", + \" Qt Project file\", + \" \", + \" \", + \" \", + \" \", + \" Qt Project include file\", + \" \", + \" \", + \" \", + \" \", + \" Qt Project feature file\", + \" \", + \" \", + \" \", + \" \", + \" Qt Project configuration file\", + \" \", + \" \", + \" \", + \" \", + \" Qt Project cache file\", + \" \", + \" \", + \" \", + \" \", + \" Qt Project stash file\", + \" \", + \" \", + \"\" + ] } diff --git a/src/plugins/qmljstools/QmlJSTools.json.in b/src/plugins/qmljstools/QmlJSTools.json.in index 1d50eae3c48..1861e87513e 100644 --- a/src/plugins/qmljstools/QmlJSTools.json.in +++ b/src/plugins/qmljstools/QmlJSTools.json.in @@ -18,45 +18,45 @@ \"Url\" : \"http://www.qt.io\", $$dependencyList, - \"Mimetypes\" : \" - - - - - - - QML file - - - - - - Qt Build Suite file - - - - - - QtQuick Designer ui file - - - - - - Qt Creator Qt UI project file - - - - - - QML file - - - - - JSON file - - - - \" + \"Mimetypes\" : [ + \"\", + \"\", + \" \", + \" \", + \" \", + \" \", + \" QML file\", + \" \", + \" \", + \" \", + \" \", + \" \", + \" Qt Build Suite file\", + \" \", + \" \", + \" \", + \" \", + \" \", + \" QtQuick Designer ui file\", + \" \", + \" \", + \" \", + \" \", + \" \", + \" Qt Creator Qt UI project file\", + \" \", + \" \", + \" \", + \" \", + \" \", + \" QML file\", + \" \", + \" \", + \" \", + \" \", + \" JSON file\", + \" \", + \" \", + \"\" + ] } diff --git a/src/plugins/qmlprojectmanager/QmlProjectManager.json.in b/src/plugins/qmlprojectmanager/QmlProjectManager.json.in index fcd607a2287..329e4b603db 100644 --- a/src/plugins/qmlprojectmanager/QmlProjectManager.json.in +++ b/src/plugins/qmlprojectmanager/QmlProjectManager.json.in @@ -17,15 +17,15 @@ \"Url\" : \"http://www.qt.io\", $$dependencyList, - \"Mimetypes\" : \" - + \"Mimetypes\" : [ + \"\", - - - - QML Project file - - - - \" + \"\", + \" \", + \" \", + \" QML Project file\", + \" \", + \" \", + \"\" + ] } diff --git a/src/plugins/qtsupport/QtSupport.json.in b/src/plugins/qtsupport/QtSupport.json.in index b62bb1b29d5..1447c9c14b2 100644 --- a/src/plugins/qtsupport/QtSupport.json.in +++ b/src/plugins/qtsupport/QtSupport.json.in @@ -18,25 +18,25 @@ \"Url\" : \"http://www.qt.io\", $$dependencyList, - \"Mimetypes\" : \" - - - - Linguist compiled translations - - - - Linguist source translations - - - - - - - SCXML State Chart - - - - - \" + \"Mimetypes\" : [ + \"\", + \"\", + \" \", + \" Linguist compiled translations\", + \" \", + \" \", + \" \", + \" Linguist source translations\", + \" \", + \" \", + \" \", + \" \", + \" \", + \" \", + \" SCXML State Chart\", + \" \", + \" \", + \" \", + \"\" + ] } diff --git a/src/plugins/resourceeditor/ResourceEditor.json.in b/src/plugins/resourceeditor/ResourceEditor.json.in index 6bf2776a0c1..dc0a5c8822a 100644 --- a/src/plugins/resourceeditor/ResourceEditor.json.in +++ b/src/plugins/resourceeditor/ResourceEditor.json.in @@ -17,14 +17,14 @@ \"Url\" : \"http://www.qt.io\", $$dependencyList, - \"Mimetypes\" : \" - - - - - Qt Resource file - - - - \" + \"Mimetypes\" : [ + \"\", + \"\", + \" \", + \" \", + \" Qt Resource file\", + \" \", + \" \", + \"\" + ] } diff --git a/src/plugins/scxmleditor/ScxmlEditor.json.in b/src/plugins/scxmleditor/ScxmlEditor.json.in index 1e48677f5fb..1218f4129b4 100644 --- a/src/plugins/scxmleditor/ScxmlEditor.json.in +++ b/src/plugins/scxmleditor/ScxmlEditor.json.in @@ -18,14 +18,14 @@ \"Experimental\" : true, $$dependencyList, - \"Mimetypes\" : \" - - - - - SCXML file - - - - \" + \"Mimetypes\" : [ + \"\", + \"\", + \" \", + \" \", + \" SCXML file\", + \" \", + \" \", + \"\" + ] } diff --git a/src/plugins/subversion/Subversion.json.in b/src/plugins/subversion/Subversion.json.in index a31c9dd38b8..8196061d642 100644 --- a/src/plugins/subversion/Subversion.json.in +++ b/src/plugins/subversion/Subversion.json.in @@ -17,13 +17,13 @@ \"Url\" : \"http://www.qt.io\", $$dependencyList, - \"Mimetypes\" : \" - - - - Subversion submit template - - - - \" + \"Mimetypes\" : [ + \"\", + \"\", + \" \", + \" Subversion submit template\", + \" \", + \" \", + \"\" + ] } diff --git a/src/plugins/tasklist/TaskList.json.in b/src/plugins/tasklist/TaskList.json.in index 202bf41b2a7..7c1f6f4ee2e 100644 --- a/src/plugins/tasklist/TaskList.json.in +++ b/src/plugins/tasklist/TaskList.json.in @@ -16,15 +16,15 @@ \"Url\" : \"http://www.qt.io\", $$dependencyList, - \"Mimetypes\" : \" - - - - - Qt Creator task list file - - - - - \" + \"Mimetypes\" : [ + \"\", + \"\", + \" \", + \" \", + \" Qt Creator task list file\", + \" \", + \" \", + \" \", + \"\" + ] }