diff --git a/doc/qtdesignstudio/src/qtbridge/qtbridge-overview.qdoc b/doc/qtdesignstudio/src/qtbridge/qtbridge-overview.qdoc index 60a521726e7..9a912f573a3 100644 --- a/doc/qtdesignstudio/src/qtbridge/qtbridge-overview.qdoc +++ b/doc/qtdesignstudio/src/qtbridge/qtbridge-overview.qdoc @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2019 The Qt Company Ltd. +** Copyright (C) 2020 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the Qt Design Studio documentation. @@ -49,17 +49,11 @@ You can use the \QBSK export tool in Sketch to convert artwork into Qt Quick files that you can import to projects in \QDS. - \li \l{Exporting from Maya} - - You can export 3D graphics from Maya in the FBX format. - The necessary plugin is usually enabled by default. - - \omit \li \l{Exporting 3D Assets} You can import files you created using 3D graphics applications and stored in several widely-used formats, such as .blend, .dae, .fbx, .glb, .gltf, .obj, .uia, or .uip. - \endomit + \endlist */ diff --git a/doc/qtdesignstudio/src/qtbridge/qtbridge-sketch-using.qdoc b/doc/qtdesignstudio/src/qtbridge/qtbridge-sketch-using.qdoc index 871b9c44915..2e76d6c59e0 100644 --- a/doc/qtdesignstudio/src/qtbridge/qtbridge-sketch-using.qdoc +++ b/doc/qtdesignstudio/src/qtbridge/qtbridge-sketch-using.qdoc @@ -27,7 +27,7 @@ \contentspage {Qt Design Studio Manual} \previouspage qtbridge-sketch-setup.html \page qtbridge-sketch-using.html - \nextpage exporting-from-maya.html + \nextpage exporting-3d-assets.html \title Using \QBSK diff --git a/doc/qtdesignstudio/src/qtquick3d-editor/exporting-3d/exporting-3d-assets.qdoc b/doc/qtdesignstudio/src/qtquick3d-editor/exporting-3d/exporting-3d-assets.qdoc new file mode 100644 index 00000000000..e0cc8e09337 --- /dev/null +++ b/doc/qtdesignstudio/src/qtquick3d-editor/exporting-3d/exporting-3d-assets.qdoc @@ -0,0 +1,196 @@ +/**************************************************************************** +** +** Copyright (C) 1993-2009 NVIDIA Corporation. +** Copyright (C) 2020 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Design Studio. +** +** $QT_BEGIN_LICENSE:FDL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU Free Documentation License Usage +** Alternatively, this file may be used under the terms of the GNU Free +** Documentation License version 1.3 as published by the Free Software +** Foundation and appearing in the file included in the packaging of +** this file. Please review the following information to ensure +** the GNU Free Documentation License version 1.3 requirements +** will be met: https://www.gnu.org/licenses/fdl-1.3.html. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \contentspage {Qt Design Studio} + \page exporting-3d-assets.html + \previouspage qtbridge-sketch-using.html + \nextpage exporting-from-blender.html + + \title Exporting 3D Assets + + You can import files you created using 3D graphics applications and exported + to several widely-used formats, such as .blend, .dae, .fbx, .glb, .gltf, + .obj, .uia, or .uip. For a list of formats supported by each \l{Qt Quick 3D} + version, see the module documentation. + + Depending on the 3D graphics tool, you might need to install export plugins + to be able to export files to a particular format. + + To get the best results when exporting 3D assets and importing them to + \QDS, follow the general guidelines in the following sections. For more + information about using the export plugins for a particular tool, see + \l{Exporting from Different Tools}. + + \section1 Geometry + + \QDS supports geometry exported as triangles, quads, and pentagons. For + basic geometry, you mostly need to pay attention to pivot points and + transformation. + + \section2 Pivot Points + + In \QDS, there is only one pivot per component. It is used as the origin + for scaling and rotation. Adjust the position of a 3D model's pivot as + needed. + + However, extreme edits to pivots in 3D modeling tools can cause problems + when importing to \QDS, especially if animated. This difference is often + manifested as a difference in the position or orientation of a component. + You can prevent these kinds of problems by only making simple edits to + your pivot points. Keep your pivot points to the default (world) alignment, + don't scale them, and make sure that if you have multiple pivots (Maya) + that they are all at the same location in space. + + \section2 Transformation + + You can import full 3D transform information including position, rotation, + scale, and pivot. \QDS can import left and right-handed coordinate systems, + y-up or z-up, and rotations applied in any order. The principal limitation + in this area are pivot points. As discussed above, only simple edits to + pivot points are supported. + + Most 3D graphics tools enable you to apply transformation to components and + vertices. We highly recommend doing so before importing mesh data into \QDS. + This ensures that the mesh coming into \QDS has clean transform data and no + arbitrary transform values which can be confusing or an impediment to your + work. + + \note After applying transformations, you may have to reposition the pivot + point in some 3D graphics tools. + + \section1 Animations + + Animations are supported on any imported property. Position, rotation, + scale, and pivot can all be animated. For example, a hierarchy of items, + rotated simultaneously on arbitrary axes in arbitrary axis order can be + imported. \QDS also supports importing bezier tangent value tweaked into + animations. + + \section2 Time-based Animations + + In many 3D modeling tools, when you create keyframes you associate them with + frame numbers. This is great in the film industry where frame rates are + constant, but poses problems in applications where the frame rate may or + may not be rock solid. If you were to specify that the logo animation will + play for 180 frames, it might play for 3 seconds at 60 FPS, but if the speed + drops to 30 fps, the animation will also get much slower. + + Luckily, accounting for this is relatively simple. Many 3D modeling tools + default to a setting of 24 frames per second, so your keyframes will + be translated at that ratio. If you want a keyframe at one second, put + it on frame 24. For two seconds, use frame 48, and so on. + + Usually, configurable frame rates are offered, and the frame rate setting + should be respected upon import. + + Some tools, such as Maya, start at frame 1, by default. If you have a + keyframe at frame 1, the time for that keyframe will be 1/24, or 0.041 + seconds. Edit your Maya animation settings to start your animations at + frame 0, or 0/24 = 0 seconds. + + In \QDS, you can specify the duration of the animation in addition to its + start and end frame. + + \section2 Deform Animations + + \e {Deform animations}, such as lattice and bend, are not supported by \QDS. + However, you can work around this limitation by converting deform animations + into \e {blend shape} animations that are supported in FBX format. Before + exporting the animations, you need to bake the actions in them into key + frames. + + \section2 Baking Actions for Animations + + You need to bake actions to export animations that are using custom curves + or object constraints to control the animation. + + \e Actions are data-blocks containing animation data. If you are exporting + animations, you need to bake actions. + + \section2 Animation Systems + + 3D modeling tools offer highly complex and specialized animation systems. + We recommend using the \QDS \uicontrol Timeline view whenever practical. + This helps keep mesh information on import clean and reduces conflicts + between imported mesh animation and \QDS's animation. + + The animation system in \QDS is a full implementation of bezier + keys, and the full complement of bezier animation that you can create + with 3D modeling tools and export are represented in \QDS. The more + extreme differences between the various animation systems are mitigated + by the limitations imposed by the supported formats. + + \section1 Materials and Textures + + Create and assign material slots in the 3D graphics tool before you export + 3D graphics. If you add several material slots, the first one is assigned + to the object. Only material slots that have a material and that are + assigned to a mesh on the exported object are imported into \QDS. + + If no material slots are assigned to an object, a default material is + attached to the component that is created when you import the assets to + \QDS. + + UV-unwrapping your model will create a UV layout. Without a UV layout, you + will not be able to render any textures on your model in \QDS. + + There are many different ways and techniques to unwrap 3D meshes, depending + on the 3D graphics tool. + + \section1 Lights + + Lights are imported to \QDS. Position, rotation, scale, brightness, + light color, and the cast shadows property values are preserved. + + If the light type is not supported by Qt Quick 3D, it is converted into + one of the supported types. + + \section1 Cameras + + Perspective and orthographic cameras are imported to \QDS. Position, + rotation, and scale property values, as well as start and end clipping + values are preserved. For perspective cameras, field of view values + are also preserved. + + \section1 Node Hierarchy + + \QDS supports importing hierarchical information. Hierarchies of arbitrary + depth are supported, including grouped nodes. Hierarchical transforms are + applied as expected. + + \section1 Exporting from Different Tools + + The following sections provide additional information about exporting + 3D assets from a particular tool: + + \list + \li \l{Exporting from Blender}{Blender} + \li \l{Exporting from Maya}{Maya} + \endlist +*/ diff --git a/doc/qtdesignstudio/src/qtquick3d-editor/exporting-3d/exporting-from-blender.qdoc b/doc/qtdesignstudio/src/qtquick3d-editor/exporting-3d/exporting-from-blender.qdoc new file mode 100644 index 00000000000..ff22f15c6b7 --- /dev/null +++ b/doc/qtdesignstudio/src/qtquick3d-editor/exporting-3d/exporting-from-blender.qdoc @@ -0,0 +1,47 @@ +/**************************************************************************** +** +** Copyright (C) 2020 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Design Studio. +** +** $QT_BEGIN_LICENSE:FDL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU Free Documentation License Usage +** Alternatively, this file may be used under the terms of the GNU Free +** Documentation License version 1.3 as published by the Free Software +** Foundation and appearing in the file included in the packaging of +** this file. Please review the following information to ensure +** the GNU Free Documentation License version 1.3 requirements +** will be met: https://www.gnu.org/licenses/fdl-1.3.html. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \contentspage {Qt Design Studio Manual} + \page exporting-from-blender.html + \previouspage exporting-3d-assets.html + \nextpage exporting-from-maya.html + + \title Exporting from Blender + + You can export meshes, lights, cameras, transformations (scale, rotation, + or location), UV layouts, pivot points, object hierarchy, and material + slots from Blender to \QDS. + + When you import 3D graphics to \QDS, the scenegraph is converted into + Qt Quick 3D types. + + For best results, export 3D graphics to the GL Transmission Format (qlTF2), + as instructed in the + \l{https://docs.blender.org/manual/en/2.81/addons/import_export/io_scene_gltf2.html} + {qlTF2} section of the Blender documentation. +*/ diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioTheme/Constants.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioTheme/Constants.qml index 421dabf7577..e79b399ede4 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioTheme/Constants.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioTheme/Constants.qml @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2019 The Qt Company Ltd. +** Copyright (C) 2020 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of Qt Creator. @@ -52,36 +52,39 @@ QtObject { readonly property string anchorLeft: "\u002E" readonly property string anchorRight: "\u002F" readonly property string anchorTop: "\u0030" - readonly property string centerHorizontal: "\u0031" - readonly property string centerVertical: "\u0032" - readonly property string closeCross: "\u0033" - readonly property string distributeBottom: "\u0034" - readonly property string distributeCenterHorizontal: "\u0035" - readonly property string distributeCenterVertical: "\u0036" - readonly property string distributeLeft: "\u0037" - readonly property string distributeOriginBottomRight: "\u0038" - readonly property string distributeOriginCenter: "\u0039" - readonly property string distributeOriginNone: "\u003A" - readonly property string distributeOriginTopLeft: "\u003B" - readonly property string distributeRight: "\u003C" - readonly property string distributeSpacingHorizontal: "\u003D" - readonly property string distributeSpacingVertical: "\u003E" - readonly property string distributeTop: "\u003F" - readonly property string fontStyleBold: "\u0040" - readonly property string fontStyleItalic: "\u0041" - readonly property string fontStyleStrikethrough: "\u0042" - readonly property string fontStyleUnderline: "\u0043" - readonly property string testIcon: "\u0044" - readonly property string textAlignBottom: "\u0045" - readonly property string textAlignCenter: "\u0046" - readonly property string textAlignLeft: "\u0047" - readonly property string textAlignMiddle: "\u0048" - readonly property string textAlignRight: "\u0049" - readonly property string textAlignTop: "\u004A" - readonly property string tickIcon: "\u004B" - readonly property string triState: "\u004C" - readonly property string upDownIcon: "\u004D" - readonly property string upDownSquare2: "\u004E" + readonly property string annotationBubble: "\u0031" + readonly property string annotationDecal: "\u0032" + readonly property string centerHorizontal: "\u0033" + readonly property string centerVertical: "\u0034" + readonly property string closeCross: "\u0035" + readonly property string distributeBottom: "\u0036" + readonly property string distributeCenterHorizontal: "\u0037" + readonly property string distributeCenterVertical: "\u0038" + readonly property string distributeLeft: "\u0039" + readonly property string distributeOriginBottomRight: "\u003A" + readonly property string distributeOriginCenter: "\u003B" + readonly property string distributeOriginNone: "\u003C" + readonly property string distributeOriginTopLeft: "\u003D" + readonly property string distributeRight: "\u003E" + readonly property string distributeSpacingHorizontal: "\u003F" + readonly property string distributeSpacingVertical: "\u0040" + readonly property string distributeTop: "\u0041" + readonly property string edit: "\u0042" + readonly property string fontStyleBold: "\u0043" + readonly property string fontStyleItalic: "\u0044" + readonly property string fontStyleStrikethrough: "\u0045" + readonly property string fontStyleUnderline: "\u0046" + readonly property string testIcon: "\u0047" + readonly property string textAlignBottom: "\u0048" + readonly property string textAlignCenter: "\u0049" + readonly property string textAlignLeft: "\u004A" + readonly property string textAlignMiddle: "\u004B" + readonly property string textAlignRight: "\u004C" + readonly property string textAlignTop: "\u004D" + readonly property string tickIcon: "\u004E" + readonly property string triState: "\u004F" + readonly property string upDownIcon: "\u0050" + readonly property string upDownSquare2: "\u0051" readonly property font iconFont: Qt.font({ "family": controlIcons.name, diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioTheme/icons.ttf b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioTheme/icons.ttf index 289326b3a52..28840afacf6 100644 Binary files a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioTheme/icons.ttf and b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioTheme/icons.ttf differ diff --git a/src/app/main.cpp b/src/app/main.cpp index 59ad381b838..0cd77cee29d 100644 --- a/src/app/main.cpp +++ b/src/app/main.cpp @@ -190,8 +190,7 @@ static inline int askMsgSendFailed() } // taken from utils/fileutils.cpp. We cannot use utils here since that depends app_version.h. -static bool copyRecursively(const QString &srcFilePath, - const QString &tgtFilePath) +static bool copyRecursively(const QString &srcFilePath, const QString &tgtFilePath) { QFileInfo srcFileInfo(srcFilePath); if (srcFileInfo.isDir()) { @@ -200,12 +199,11 @@ static bool copyRecursively(const QString &srcFilePath, if (!targetDir.mkdir(Utils::FilePath::fromString(tgtFilePath).fileName())) return false; QDir sourceDir(srcFilePath); - QStringList fileNames = sourceDir.entryList(QDir::Files | QDir::Dirs | QDir::NoDotAndDotDot | QDir::Hidden | QDir::System); - foreach (const QString &fileName, fileNames) { - const QString newSrcFilePath - = srcFilePath + QLatin1Char('/') + fileName; - const QString newTgtFilePath - = tgtFilePath + QLatin1Char('/') + fileName; + const QStringList fileNames = sourceDir.entryList + (QDir::Files | QDir::Dirs | QDir::NoDotAndDotDot | QDir::Hidden | QDir::System); + for (const QString &fileName : fileNames) { + const QString newSrcFilePath = srcFilePath + '/' + fileName; + const QString newTgtFilePath = tgtFilePath + '/' + fileName; if (!copyRecursively(newSrcFilePath, newTgtFilePath)) return false; } @@ -300,8 +298,8 @@ static inline QSettings *userSettings() if (srcDir == destDir) // Nothing to copy and no settings yet return settings; - QStringList entries = srcDir.entryList(); - foreach (const QString &file, entries) { + const QStringList entries = srcDir.entryList(); + for (const QString &file : entries) { const QString lowerFile = file.toLower(); if (lowerFile.startsWith(QLatin1String("profiles.xml")) || lowerFile.startsWith(QLatin1String("toolchains.xml")) @@ -349,7 +347,8 @@ void loadFonts() { const QDir dir(resourcePath() + "/fonts/"); - foreach (const QFileInfo &fileInfo, dir.entryInfoList(QStringList("*.ttf"), QDir::Files)) + const QFileInfoList fonts = dir.entryInfoList(QStringList("*.ttf"), QDir::Files); + for (const QFileInfo &fileInfo : fonts) QFontDatabase::addApplicationFont(fileInfo.absoluteFilePath()); } @@ -555,13 +554,12 @@ int main(int argc, char **argv) QTranslator translator; QTranslator qtTranslator; - QStringList uiLanguages; - uiLanguages = QLocale::system().uiLanguages(); + QStringList uiLanguages = QLocale::system().uiLanguages(); QString overrideLanguage = settings->value(QLatin1String("General/OverrideLanguage")).toString(); if (!overrideLanguage.isEmpty()) uiLanguages.prepend(overrideLanguage); const QString &creatorTrPath = resourcePath() + "/translations"; - foreach (QString locale, uiLanguages) { + for (QString locale : qAsConst(uiLanguages)) { locale = QLocale(locale).name(); if (translator.load("qtcreator_" + locale, creatorTrPath)) { const QString &qtTrPath = QLibraryInfo::location(QLibraryInfo::TranslationsPath); @@ -614,7 +612,7 @@ int main(int argc, char **argv) const PluginSpecSet plugins = PluginManager::plugins(); PluginSpec *coreplugin = nullptr; - foreach (PluginSpec *spec, plugins) { + for (PluginSpec *spec : plugins) { if (spec->name() == QLatin1String(corePluginNameC)) { coreplugin = spec; break; diff --git a/src/libs/aggregation/aggregate.cpp b/src/libs/aggregation/aggregate.cpp index a1547842320..3c2ea217b13 100644 --- a/src/libs/aggregation/aggregate.cpp +++ b/src/libs/aggregation/aggregate.cpp @@ -207,7 +207,7 @@ Aggregate::~Aggregate() QList components; { QWriteLocker locker(&lock()); - foreach (QObject *component, m_components) { + for (QObject *component : qAsConst(m_components)) { disconnect(component, &QObject::destroyed, this, &Aggregate::deleteSelf); aggregateMap().remove(component); } diff --git a/src/libs/aggregation/aggregate.h b/src/libs/aggregation/aggregate.h index 8c3332bf81f..2036007b300 100644 --- a/src/libs/aggregation/aggregate.h +++ b/src/libs/aggregation/aggregate.h @@ -48,7 +48,7 @@ public: template T *component() { QReadLocker locker(&lock()); - foreach (QObject *component, m_components) { + for (QObject *component : qAsConst(m_components)) { if (T *result = qobject_cast(component)) return result; } @@ -58,7 +58,7 @@ public: template QList components() { QReadLocker locker(&lock()); QList results; - foreach (QObject *component, m_components) { + for (QObject *component : qAsConst(m_components)) { if (T *result = qobject_cast(component)) { results << result; } diff --git a/src/libs/extensionsystem/optionsparser.cpp b/src/libs/extensionsystem/optionsparser.cpp index 6b960600426..ecac59e5bf1 100644 --- a/src/libs/extensionsystem/optionsparser.cpp +++ b/src/libs/extensionsystem/optionsparser.cpp @@ -170,7 +170,7 @@ bool OptionsParser::checkForLoadOption() return false; if (nextToken(RequiredToken)) { if (m_currentArg == QLatin1String("all")) { - foreach (PluginSpec *spec, m_pmPrivate->pluginSpecs) + for (PluginSpec *spec : qAsConst(m_pmPrivate->pluginSpecs)) spec->d->setForceEnabled(true); m_isDependencyRefreshNeeded = true; } else { @@ -197,7 +197,7 @@ bool OptionsParser::checkForNoLoadOption() return false; if (nextToken(RequiredToken)) { if (m_currentArg == QLatin1String("all")) { - foreach (PluginSpec *spec, m_pmPrivate->pluginSpecs) + for (PluginSpec *spec : qAsConst(m_pmPrivate->pluginSpecs)) spec->d->setForceDisabled(true); m_isDependencyRefreshNeeded = true; } else { @@ -210,7 +210,7 @@ bool OptionsParser::checkForNoLoadOption() } else { spec->d->setForceDisabled(true); // recursively disable all plugins that require this plugin - foreach (PluginSpec *dependantSpec, PluginManager::pluginsRequiringPlugin(spec)) + for (PluginSpec *dependantSpec : PluginManager::pluginsRequiringPlugin(spec)) dependantSpec->d->setForceDisabled(true); m_isDependencyRefreshNeeded = true; } diff --git a/src/libs/extensionsystem/pluginerroroverview.cpp b/src/libs/extensionsystem/pluginerroroverview.cpp index ff4f3bcd5c3..acf4d6f25b5 100644 --- a/src/libs/extensionsystem/pluginerroroverview.cpp +++ b/src/libs/extensionsystem/pluginerroroverview.cpp @@ -46,7 +46,7 @@ PluginErrorOverview::PluginErrorOverview(QWidget *parent) : m_ui->setupUi(this); m_ui->buttonBox->addButton(tr("Continue"), QDialogButtonBox::AcceptRole); - foreach (PluginSpec *spec, PluginManager::plugins()) { + for (PluginSpec *spec : PluginManager::plugins()) { // only show errors on startup if plugin is enabled. if (spec->hasError() && spec->isEffectivelyEnabled()) { QListWidgetItem *item = new QListWidgetItem(spec->name()); diff --git a/src/libs/extensionsystem/pluginmanager.cpp b/src/libs/extensionsystem/pluginmanager.cpp index 9db5161aa21..bec97e69a7c 100644 --- a/src/libs/extensionsystem/pluginmanager.cpp +++ b/src/libs/extensionsystem/pluginmanager.cpp @@ -359,11 +359,11 @@ const QStringList PluginManager::allErrors() /*! Returns all plugins that require \a spec to be loaded. Recurses into dependencies. */ -QSet PluginManager::pluginsRequiringPlugin(PluginSpec *spec) +const QSet PluginManager::pluginsRequiringPlugin(PluginSpec *spec) { QSet dependingPlugins({spec}); // recursively add plugins that depend on plugins that.... that depend on spec - foreach (PluginSpec *spec, d->loadQueue()) { + for (PluginSpec *spec : d->loadQueue()) { if (spec->requiresAny(dependingPlugins)) dependingPlugins.insert(spec); } @@ -374,7 +374,7 @@ QSet PluginManager::pluginsRequiringPlugin(PluginSpec *spec) /*! Returns all plugins that \a spec requires to be loaded. Recurses into dependencies. */ -QSet PluginManager::pluginsRequiredByPlugin(PluginSpec *spec) +const QSet PluginManager::pluginsRequiredByPlugin(PluginSpec *spec) { QSet recursiveDependencies; recursiveDependencies.insert(spec); @@ -576,7 +576,7 @@ QString PluginManager::serializedArguments() { const QChar separator = QLatin1Char('|'); QString rc; - foreach (const PluginSpec *ps, plugins()) { + for (const PluginSpec *ps : plugins()) { if (!ps->arguments().isEmpty()) { if (!rc.isEmpty()) rc += separator; @@ -593,7 +593,7 @@ QString PluginManager::serializedArguments() if (!rc.isEmpty()) rc += separator; rc += QLatin1String(argumentKeywordC); - foreach (const QString &argument, d->arguments) + for (const QString &argument : qAsConst(d->arguments)) rc += separator + argument; } return rc; @@ -633,7 +633,7 @@ void PluginManager::remoteArguments(const QString &serializedArgument, QObject * const QStringList pwdValue = subList(serializedArguments, QLatin1String(pwdKeywordC)); const QString workingDirectory = pwdValue.isEmpty() ? QString() : pwdValue.first(); const QStringList arguments = subList(serializedArguments, QLatin1String(argumentKeywordC)); - foreach (const PluginSpec *ps, plugins()) { + for (const PluginSpec *ps : plugins()) { if (ps->state() == PluginSpec::Running) { const QStringList pluginOptions = subList(serializedArguments, QLatin1Char(':') + ps->name()); QObject *socketParent = ps->plugin()->remoteCommand(pluginOptions, workingDirectory, @@ -747,11 +747,11 @@ void PluginManager::formatOptions(QTextStream &str, int optionIndentation, int d void PluginManager::formatPluginOptions(QTextStream &str, int optionIndentation, int descriptionIndentation) { // Check plugins for options - foreach (PluginSpec *ps, d->pluginSpecs) { + for (PluginSpec *ps : qAsConst(d->pluginSpecs)) { const PluginSpec::PluginArgumentDescriptions pargs = ps->argumentDescriptions(); if (!pargs.empty()) { str << "\nPlugin: " << ps->name() << '\n'; - foreach (PluginArgumentDescription pad, pargs) + for (const PluginArgumentDescription &pad : pargs) formatOption(str, pad.name, pad.parameter, pad.description, optionIndentation, descriptionIndentation); } } @@ -762,7 +762,7 @@ void PluginManager::formatPluginOptions(QTextStream &str, int optionIndentation, */ void PluginManager::formatPluginVersions(QTextStream &str) { - foreach (PluginSpec *ps, d->pluginSpecs) + for (PluginSpec *ps : qAsConst(d->pluginSpecs)) str << " " << ps->name() << ' ' << ps->version() << ' ' << ps->description() << '\n'; } @@ -887,7 +887,7 @@ void PluginManagerPrivate::writeSettings() return; QStringList tempDisabledPlugins; QStringList tempForceEnabledPlugins; - foreach (PluginSpec *spec, pluginSpecs) { + for (PluginSpec *spec : qAsConst(pluginSpecs)) { if (spec->isEnabledByDefault() && !spec->isEnabledBySettings()) tempDisabledPlugins.append(spec->name()); if (!spec->isEnabledByDefault() && spec->isEnabledBySettings()) @@ -923,10 +923,10 @@ void PluginManagerPrivate::stopAll() delete delayedInitializeTimer; delayedInitializeTimer = nullptr; } - QVector queue = loadQueue(); - foreach (PluginSpec *spec, queue) { + + const QVector queue = loadQueue(); + for (PluginSpec *spec : queue) loadPlugin(spec, PluginSpec::Stopped); - } } /*! @@ -1001,7 +1001,7 @@ static QStringList matchingTestFunctions(const QStringList &testFunctions, const QRegExp regExp(testFunctionName, Qt::CaseSensitive, QRegExp::Wildcard); QStringList matchingFunctions; - foreach (const QString &testFunction, testFunctions) { + for (const QString &testFunction : testFunctions) { if (regExp.exactMatch(testFunction)) { // If the specified test data is invalid, the QTest framework will // print a reasonable error message for us. @@ -1058,7 +1058,7 @@ static TestPlan generateCompleteTestPlan(IPlugin *plugin, const QVectormetaObject())); - foreach (QObject *testObject, testObjects) { + for (QObject *testObject : testObjects) { const QStringList allFunctions = testFunctions(testObject->metaObject()); testPlan.insert(testObject, allFunctions); } @@ -1096,7 +1096,7 @@ static TestPlan generateCustomTestPlan(IPlugin *plugin, } else { // Add all matching test functions of all remaining test objects - foreach (QObject *testObject, remainingTestObjectsOfPlugin) { + for (QObject *testObject : qAsConst(remainingTestObjectsOfPlugin)) { const QStringList allFunctions = testFunctions(testObject->metaObject()); const QStringList matchingFunctions = matchingTestFunctions(allFunctions, matchText); @@ -1119,7 +1119,7 @@ static TestPlan generateCustomTestPlan(IPlugin *plugin, out << "No test function or class matches \"" << matchText << "\" in plugin \"" << plugin->metaObject()->className() << "\".\nAvailable functions:\n"; - foreach (const QString &f, testFunctionsOfPluginObject) + for (const QString &f : testFunctionsOfPluginObject) out << " " << f << '\n'; out << endl; } @@ -1143,7 +1143,7 @@ void PluginManagerPrivate::startTests() } int failedTests = 0; - foreach (const PluginManagerPrivate::TestSpec &testSpec, testSpecs) { + for (const TestSpec &testSpec : qAsConst(testSpecs)) { IPlugin *plugin = testSpec.pluginSpec->plugin(); if (!plugin) continue; // plugin not loaded @@ -1227,15 +1227,15 @@ void PluginManagerPrivate::removeObject(QObject *obj) */ void PluginManagerPrivate::loadPlugins() { - QVector queue = loadQueue(); + const QVector queue = loadQueue(); Utils::setMimeStartupPhase(MimeStartupPhase::PluginsLoading); - foreach (PluginSpec *spec, queue) { + for (PluginSpec *spec : queue) loadPlugin(spec, PluginSpec::Loaded); - } + Utils::setMimeStartupPhase(MimeStartupPhase::PluginsInitializing); - foreach (PluginSpec *spec, queue) { + for (PluginSpec *spec : queue) loadPlugin(spec, PluginSpec::Initialized); - } + Utils::setMimeStartupPhase(MimeStartupPhase::PluginsDelayedInitializing); Utils::reverseForeach(queue, [this](PluginSpec *spec) { loadPlugin(spec, PluginSpec::Running); @@ -1291,10 +1291,10 @@ void PluginManagerPrivate::asyncShutdownFinished() /*! \internal */ -QVector PluginManagerPrivate::loadQueue() +const QVector PluginManagerPrivate::loadQueue() { QVector queue; - foreach (PluginSpec *spec, pluginSpecs) { + for (PluginSpec *spec : qAsConst(pluginSpecs)) { QVector circularityCheckQueue; loadQueue(spec, queue, circularityCheckQueue); } @@ -1526,7 +1526,7 @@ void PluginManagerPrivate::setPluginPaths(const QStringList &paths) readPluginPaths(); } -static QStringList pluginFiles(const QStringList &pluginPaths) +static const QStringList pluginFiles(const QStringList &pluginPaths) { QStringList pluginFiles; QStringList searchPaths = pluginPaths; @@ -1553,7 +1553,7 @@ void PluginManagerPrivate::readPluginPaths() // default pluginCategories.insert(QString(), QVector()); - foreach (const QString &pluginFile, pluginFiles(pluginPaths)) { + for (const QString &pluginFile : pluginFiles(pluginPaths)) { auto *spec = new PluginSpec; if (!spec->d->read(pluginFile)) { // not a Qt Creator plugin delete spec; @@ -1586,13 +1586,13 @@ void PluginManagerPrivate::readPluginPaths() void PluginManagerPrivate::resolveDependencies() { - foreach (PluginSpec *spec, pluginSpecs) + for (PluginSpec *spec : qAsConst(pluginSpecs)) spec->d->resolveDependencies(pluginSpecs); } void PluginManagerPrivate::enableDependenciesIndirectly() { - foreach (PluginSpec *spec, pluginSpecs) + for (PluginSpec *spec : qAsConst(pluginSpecs)) spec->d->enabledIndirectly = false; // cannot use reverse loadQueue here, because test dependencies can introduce circles QVector queue = Utils::filtered(pluginSpecs, &PluginSpec::isEffectivelyEnabled); @@ -1607,7 +1607,7 @@ PluginSpec *PluginManagerPrivate::pluginForOption(const QString &option, bool *r { // Look in the plugins for an option *requiresArgument = false; - foreach (PluginSpec *spec, pluginSpecs) { + for (PluginSpec *spec : qAsConst(pluginSpecs)) { PluginArgumentDescription match = Utils::findOrDefault(spec->argumentDescriptions(), [option](PluginArgumentDescription pad) { return pad.name == option; diff --git a/src/libs/extensionsystem/pluginmanager.h b/src/libs/extensionsystem/pluginmanager.h index cc1a4615368..1bd621a1bcc 100644 --- a/src/libs/extensionsystem/pluginmanager.h +++ b/src/libs/extensionsystem/pluginmanager.h @@ -62,8 +62,8 @@ public: template static T *getObject() { QReadLocker lock(listLock()); - QVector all = allObjects(); - foreach (QObject *obj, all) { + const QVector all = allObjects(); + for (QObject *obj : all) { if (T *result = qobject_cast(obj)) return result; } @@ -72,8 +72,8 @@ public: template static T *getObject(Predicate predicate) { QReadLocker lock(listLock()); - QVector all = allObjects(); - foreach (QObject *obj, all) { + const QVector all = allObjects(); + for (QObject *obj : all) { if (T *result = qobject_cast(obj)) if (predicate(result)) return result; @@ -94,8 +94,8 @@ public: static QHash> pluginCollections(); static bool hasError(); static const QStringList allErrors(); - static QSet pluginsRequiringPlugin(PluginSpec *spec); - static QSet pluginsRequiredByPlugin(PluginSpec *spec); + static const QSet pluginsRequiringPlugin(PluginSpec *spec); + static const QSet pluginsRequiredByPlugin(PluginSpec *spec); static void checkForProblematicPlugins(); // Settings diff --git a/src/libs/extensionsystem/pluginmanager_p.h b/src/libs/extensionsystem/pluginmanager_p.h index 08c1eaa1edd..bafddf9d446 100644 --- a/src/libs/extensionsystem/pluginmanager_p.h +++ b/src/libs/extensionsystem/pluginmanager_p.h @@ -69,7 +69,7 @@ public: void loadPlugins(); void shutdown(); void setPluginPaths(const QStringList &paths); - QVector loadQueue(); + const QVector loadQueue(); void loadPlugin(PluginSpec *spec, PluginSpec::State destState); void resolveDependencies(); void enableDependenciesIndirectly(); diff --git a/src/libs/extensionsystem/pluginspec.cpp b/src/libs/extensionsystem/pluginspec.cpp index 696a5ec19fe..06d2b5979c6 100644 --- a/src/libs/extensionsystem/pluginspec.cpp +++ b/src/libs/extensionsystem/pluginspec.cpp @@ -803,8 +803,8 @@ bool PluginSpecPrivate::readMetaData(const QJsonObject &pluginMetaData) if (!value.isUndefined() && !value.isArray()) return reportError(msgValueIsNotAObjectArray(DEPENDENCIES)); if (!value.isUndefined()) { - QJsonArray array = value.toArray(); - foreach (const QJsonValue &v, array) { + const QJsonArray array = value.toArray(); + for (const QJsonValue &v : array) { if (!v.isObject()) return reportError(msgValueIsNotAObjectArray(DEPENDENCIES)); QJsonObject dependencyObject = v.toObject(); @@ -850,8 +850,8 @@ bool PluginSpecPrivate::readMetaData(const QJsonObject &pluginMetaData) if (!value.isUndefined() && !value.isArray()) return reportError(msgValueIsNotAObjectArray(ARGUMENTS)); if (!value.isUndefined()) { - QJsonArray array = value.toArray(); - foreach (const QJsonValue &v, array) { + const QJsonArray array = value.toArray(); + for (const QJsonValue &v : array) { if (!v.isObject()) return reportError(msgValueIsNotAObjectArray(ARGUMENTS)); QJsonObject argumentObject = v.toObject(); @@ -946,7 +946,7 @@ bool PluginSpecPrivate::resolveDependencies(const QVector &specs) return false; } QHash resolvedDependencies; - foreach (const PluginDependency &dependency, dependencies) { + for (const PluginDependency &dependency : qAsConst(dependencies)) { PluginSpec * const found = Utils::findOrDefault(specs, [&dependency](PluginSpec *spec) { return spec->provides(dependency.name, dependency.version); }); diff --git a/src/libs/extensionsystem/pluginview.cpp b/src/libs/extensionsystem/pluginview.cpp index a5763e2067d..09103676315 100644 --- a/src/libs/extensionsystem/pluginview.cpp +++ b/src/libs/extensionsystem/pluginview.cpp @@ -218,12 +218,12 @@ public: class CollectionItem : public TreeItem { public: - CollectionItem(const QString &name, QVector plugins, PluginView *view) + CollectionItem(const QString &name, const QVector &plugins, PluginView *view) : m_name(name) , m_plugins(plugins) , m_view(view) { - foreach (PluginSpec *spec, plugins) + for (PluginSpec *spec : plugins) appendChild(new PluginItem(spec, view)); } @@ -243,7 +243,7 @@ public: return PluginView::tr("Load on Startup"); if (role == Qt::CheckStateRole || role == SortRole) { int checkedCount = 0; - foreach (PluginSpec *spec, m_plugins) { + for (PluginSpec *spec : m_plugins) { if (spec->isEnabledBySettings()) ++checkedCount; } @@ -284,7 +284,7 @@ public: public: QString m_name; - QVector m_plugins; + const QVector m_plugins; PluginView *m_view; // Not owned. }; @@ -437,7 +437,7 @@ void PluginView::updatePlugins() } Utils::sort(collections, &CollectionItem::m_name); - foreach (CollectionItem *collection, collections) + for (CollectionItem *collection : qAsConst(collections)) m_model->rootItem()->appendChild(collection); emit m_model->layoutChanged(); @@ -455,8 +455,8 @@ bool PluginView::setPluginsEnabled(const QSet &plugins, bool enabl { QSet additionalPlugins; if (enable) { - foreach (PluginSpec *spec, plugins) { - foreach (PluginSpec *other, PluginManager::pluginsRequiredByPlugin(spec)) { + for (PluginSpec *spec : plugins) { + for (PluginSpec *other : PluginManager::pluginsRequiredByPlugin(spec)) { if (!other->isEnabledBySettings()) additionalPlugins.insert(other); } @@ -472,8 +472,8 @@ bool PluginView::setPluginsEnabled(const QSet &plugins, bool enabl return false; } } else { - foreach (PluginSpec *spec, plugins) { - foreach (PluginSpec *other, PluginManager::pluginsRequiringPlugin(spec)) { + for (PluginSpec *spec : plugins) { + for (PluginSpec *other : PluginManager::pluginsRequiringPlugin(spec)) { if (other->isEnabledBySettings()) additionalPlugins.insert(other); } @@ -490,8 +490,8 @@ bool PluginView::setPluginsEnabled(const QSet &plugins, bool enabl } } - QSet affectedPlugins = plugins + additionalPlugins; - foreach (PluginSpec *spec, affectedPlugins) { + const QSet affectedPlugins = plugins + additionalPlugins; + for (PluginSpec *spec : affectedPlugins) { PluginItem *item = m_model->findItemAtLevel<2>([spec](PluginItem *item) { return item->m_spec == spec; }); diff --git a/src/plugins/android/androidsdkmanager.cpp b/src/plugins/android/androidsdkmanager.cpp index cc5959a369f..1987a284ffb 100644 --- a/src/plugins/android/androidsdkmanager.cpp +++ b/src/plugins/android/androidsdkmanager.cpp @@ -488,6 +488,10 @@ void SdkManagerOutputParser::parsePackageListing(const QString &output) if (outputLine.startsWith(" ")) continue; + // We don't need to parse this because they would still be listed on available packages + if (m_currentSection == AvailableUpdatesMarker) + continue; + MarkerTag marker = parseMarkers(outputLine.trimmed()); if (marker & SectionMarkers) { // Section marker found. Update the current section being parsed. diff --git a/src/plugins/android/javaeditor.cpp b/src/plugins/android/javaeditor.cpp index 85ea22442b9..b280977c89f 100644 --- a/src/plugins/android/javaeditor.cpp +++ b/src/plugins/android/javaeditor.cpp @@ -68,7 +68,7 @@ JavaEditorFactory::JavaEditorFactory() "transient", "try", "void", "volatile", "while" }; setId(Constants::JAVA_EDITOR_ID); - setDisplayName(tr("Java Editor")); + setDisplayName(QCoreApplication::translate("OpenWith::Editors", "Java Editor")); addMimeType(Constants::JAVA_MIMETYPE); setDocumentCreator(createJavaDocument); diff --git a/src/plugins/android/javaeditor.h b/src/plugins/android/javaeditor.h index c442484dafd..23a3e00b7c6 100644 --- a/src/plugins/android/javaeditor.h +++ b/src/plugins/android/javaeditor.h @@ -32,8 +32,6 @@ namespace Internal { class JavaEditorFactory : public TextEditor::TextEditorFactory { - Q_OBJECT - public: JavaEditorFactory(); }; diff --git a/src/plugins/baremetal/CMakeLists.txt b/src/plugins/baremetal/CMakeLists.txt index 12b6d605cb9..7783e91ec8c 100644 --- a/src/plugins/baremetal/CMakeLists.txt +++ b/src/plugins/baremetal/CMakeLists.txt @@ -3,7 +3,6 @@ add_qtc_plugin(BareMetal SOURCES baremetal.qrc baremetalconstants.h - baremetalcustomrunconfiguration.cpp baremetalcustomrunconfiguration.h baremetaldebugsupport.cpp baremetaldebugsupport.h baremetaldevice.cpp baremetaldevice.h baremetaldeviceconfigurationwidget.cpp baremetaldeviceconfigurationwidget.h diff --git a/src/plugins/baremetal/baremetal.pro b/src/plugins/baremetal/baremetal.pro index f471347566d..8a97feaffd6 100644 --- a/src/plugins/baremetal/baremetal.pro +++ b/src/plugins/baremetal/baremetal.pro @@ -9,7 +9,6 @@ include(debugservers/uvsc/uvscservers.pri) # BareMetal files SOURCES += \ - baremetalcustomrunconfiguration.cpp\ baremetaldebugsupport.cpp \ baremetaldevice.cpp \ baremetaldeviceconfigurationwidget.cpp \ @@ -30,7 +29,6 @@ SOURCES += \ HEADERS += \ baremetalconstants.h \ - baremetalcustomrunconfiguration.h \ baremetaldebugsupport.h \ baremetaldevice.h \ baremetaldeviceconfigurationwidget.h \ diff --git a/src/plugins/baremetal/baremetal.qbs b/src/plugins/baremetal/baremetal.qbs index ac73586a524..c5fc6985976 100644 --- a/src/plugins/baremetal/baremetal.qbs +++ b/src/plugins/baremetal/baremetal.qbs @@ -17,7 +17,6 @@ QtcPlugin { files: [ "baremetal.qrc", "baremetalconstants.h", - "baremetalcustomrunconfiguration.cpp", "baremetalcustomrunconfiguration.h", "baremetaldebugsupport.cpp", "baremetaldebugsupport.h", "baremetaldevice.cpp", "baremetaldevice.h", "baremetaldeviceconfigurationwidget.cpp", "baremetaldeviceconfigurationwidget.h", diff --git a/src/plugins/baremetal/baremetalcustomrunconfiguration.cpp b/src/plugins/baremetal/baremetalcustomrunconfiguration.cpp deleted file mode 100644 index b4734d46518..00000000000 --- a/src/plugins/baremetal/baremetalcustomrunconfiguration.cpp +++ /dev/null @@ -1,78 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 Tim Sander -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt Creator. -** -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -****************************************************************************/ - -#include "baremetalcustomrunconfiguration.h" -#include "baremetalconstants.h" - -#include -#include - -#include - -using namespace Utils; -using namespace ProjectExplorer; - -namespace BareMetal { -namespace Internal { - -// BareMetalCustomRunConfiguration - -BareMetalCustomRunConfiguration::BareMetalCustomRunConfiguration(Target *target, Core::Id id) - : RunConfiguration(target, id) -{ - const auto exeAspect = addAspect(); - exeAspect->setSettingsKey("BareMetal.CustomRunConfig.Executable"); - exeAspect->setPlaceHolderText(tr("Unknown")); - exeAspect->setDisplayStyle(BaseStringAspect::PathChooserDisplay); - exeAspect->setHistoryCompleter("BareMetal.CustomRunConfig.History"); - exeAspect->setExpectedKind(PathChooser::Any); - - addAspect(); - addAspect(); - - setDefaultDisplayName(RunConfigurationFactory::decoratedTargetName(tr("Custom Executable"), target)); -} - -Tasks BareMetalCustomRunConfiguration::checkForIssues() const -{ - Tasks tasks; - if (aspect()->executable().isEmpty()) { - tasks << createConfigurationIssue(tr("The remote executable must be set in order to run " - "a custom remote run configuration.")); - } - return tasks; -} - -// BareMetalCustomRunConfigurationFactory - -BareMetalCustomRunConfigurationFactory::BareMetalCustomRunConfigurationFactory() - : FixedRunConfigurationFactory(BareMetalCustomRunConfiguration::tr("Custom Executable"), true) -{ - registerRunConfiguration("BareMetal"); - addSupportedTargetDeviceType(BareMetal::Constants::BareMetalOsType); -} - -} // namespace Internal -} // namespace BareMetal diff --git a/src/plugins/baremetal/baremetalcustomrunconfiguration.h b/src/plugins/baremetal/baremetalcustomrunconfiguration.h deleted file mode 100644 index 94b032114a1..00000000000 --- a/src/plugins/baremetal/baremetalcustomrunconfiguration.h +++ /dev/null @@ -1,57 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 Tim Sander -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt Creator. -** -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -****************************************************************************/ - -#pragma once - -#include - -namespace BareMetal { -namespace Internal { - -// BareMetalCustomRunConfiguration - -class BareMetalCustomRunConfiguration final - : public ProjectExplorer::RunConfiguration -{ - Q_OBJECT - -public: - explicit BareMetalCustomRunConfiguration(ProjectExplorer::Target *target, Core::Id id); - -public: - ProjectExplorer::Tasks checkForIssues() const final; -}; - -// BareMetalCustomRunConfigurationFactory - -class BareMetalCustomRunConfigurationFactory final - : public ProjectExplorer::FixedRunConfigurationFactory -{ -public: - explicit BareMetalCustomRunConfigurationFactory(); -}; - -} // namespace Internal -} // namespace BareMetal diff --git a/src/plugins/baremetal/baremetalplugin.cpp b/src/plugins/baremetal/baremetalplugin.cpp index 1848724d548..e39790f80c3 100644 --- a/src/plugins/baremetal/baremetalplugin.cpp +++ b/src/plugins/baremetal/baremetalplugin.cpp @@ -25,7 +25,6 @@ ****************************************************************************/ #include "baremetalconstants.h" -#include "baremetalcustomrunconfiguration.h" #include "baremetaldebugsupport.h" #include "baremetaldevice.h" #include "baremetalplugin.h" diff --git a/src/plugins/baremetal/baremetalrunconfiguration.cpp b/src/plugins/baremetal/baremetalrunconfiguration.cpp index d0cab4e3a52..646691ff2c3 100644 --- a/src/plugins/baremetal/baremetalrunconfiguration.cpp +++ b/src/plugins/baremetal/baremetalrunconfiguration.cpp @@ -38,24 +38,65 @@ using namespace Utils; namespace BareMetal { namespace Internal { -// BareMetalRunConfiguration +// RunConfigurations -BareMetalRunConfiguration::BareMetalRunConfiguration(Target *target, Core::Id id) - : RunConfiguration(target, id) +class BareMetalRunConfiguration final : public RunConfiguration { - const auto exeAspect = addAspect(); - exeAspect->setDisplayStyle(BaseStringAspect::LabelDisplay); - exeAspect->setPlaceHolderText(tr("Unknown")); + Q_DECLARE_TR_FUNCTIONS(BareMetal::Internal::BareMetalRunConfiguration) - addAspect(); - addAspect(); +public: + explicit BareMetalRunConfiguration(Target *target, Core::Id id) + : RunConfiguration(target, id) + { + const auto exeAspect = addAspect(); + exeAspect->setDisplayStyle(BaseStringAspect::LabelDisplay); + exeAspect->setPlaceHolderText(tr("Unknown")); - setUpdater([this, exeAspect] { - const BuildTargetInfo bti = buildTargetInfo(); - exeAspect->setExecutable(bti.targetFilePath); - }); + addAspect(); + addAspect(); - connect(target, &Target::buildSystemUpdated, this, &RunConfiguration::update); + setUpdater([this, exeAspect] { + const BuildTargetInfo bti = buildTargetInfo(); + exeAspect->setExecutable(bti.targetFilePath); + }); + + connect(target, &Target::buildSystemUpdated, this, &RunConfiguration::update); + } +}; + +class BareMetalCustomRunConfiguration final : public RunConfiguration +{ + Q_DECLARE_TR_FUNCTIONS(BareMetal::Internal::BareMetalCustomRunConfiguration) + +public: + explicit BareMetalCustomRunConfiguration(Target *target, Core::Id id) + : RunConfiguration(target, id) + { + const auto exeAspect = addAspect(); + exeAspect->setSettingsKey("BareMetal.CustomRunConfig.Executable"); + exeAspect->setPlaceHolderText(tr("Unknown")); + exeAspect->setDisplayStyle(BaseStringAspect::PathChooserDisplay); + exeAspect->setHistoryCompleter("BareMetal.CustomRunConfig.History"); + exeAspect->setExpectedKind(PathChooser::Any); + + addAspect(); + addAspect(); + + setDefaultDisplayName(RunConfigurationFactory::decoratedTargetName(tr("Custom Executable"), target)); + } + +public: + Tasks checkForIssues() const final; +}; + +Tasks BareMetalCustomRunConfiguration::checkForIssues() const +{ + Tasks tasks; + if (aspect()->executable().isEmpty()) { + tasks << createConfigurationIssue(tr("The remote executable must be set in order to run " + "a custom remote run configuration.")); + } + return tasks; } // BareMetalRunConfigurationFactory @@ -67,6 +108,15 @@ BareMetalRunConfigurationFactory::BareMetalRunConfigurationFactory() addSupportedTargetDeviceType(BareMetal::Constants::BareMetalOsType); } +// BaseMetalCustomRunConfigurationFactory + +BareMetalCustomRunConfigurationFactory::BareMetalCustomRunConfigurationFactory() + : FixedRunConfigurationFactory(BareMetalCustomRunConfiguration::tr("Custom Executable"), true) +{ + registerRunConfiguration("BareMetal"); + addSupportedTargetDeviceType(BareMetal::Constants::BareMetalOsType); +} + } // namespace Internal } // namespace BareMetal diff --git a/src/plugins/baremetal/baremetalrunconfiguration.h b/src/plugins/baremetal/baremetalrunconfiguration.h index 2132882a5b7..433369e2203 100644 --- a/src/plugins/baremetal/baremetalrunconfiguration.h +++ b/src/plugins/baremetal/baremetalrunconfiguration.h @@ -30,23 +30,18 @@ namespace BareMetal { namespace Internal { -// BareMetalRunConfiguration - -class BareMetalRunConfiguration final : public ProjectExplorer::RunConfiguration -{ - Q_OBJECT - -public: - explicit BareMetalRunConfiguration(ProjectExplorer::Target *target, Core::Id id); -}; - -// BareMetalRunConfigurationFactory - class BareMetalRunConfigurationFactory final : public ProjectExplorer::RunConfigurationFactory { public: - explicit BareMetalRunConfigurationFactory(); + BareMetalRunConfigurationFactory(); +}; + +class BareMetalCustomRunConfigurationFactory final + : public ProjectExplorer::FixedRunConfigurationFactory +{ +public: + BareMetalCustomRunConfigurationFactory(); }; } // namespace Internal diff --git a/src/plugins/cmakeprojectmanager/cmakeeditor.cpp b/src/plugins/cmakeprojectmanager/cmakeeditor.cpp index b4d7fdc4329..7ec99a52540 100644 --- a/src/plugins/cmakeprojectmanager/cmakeeditor.cpp +++ b/src/plugins/cmakeprojectmanager/cmakeeditor.cpp @@ -223,7 +223,7 @@ static TextDocument *createCMakeDocument() CMakeEditorFactory::CMakeEditorFactory() { setId(Constants::CMAKE_EDITOR_ID); - setDisplayName(tr(Constants::CMAKE_EDITOR_DISPLAY_NAME)); + setDisplayName(QCoreApplication::translate("OpenWith::Editors", "CMake Editor")); addMimeType(Constants::CMAKEMIMETYPE); addMimeType(Constants::CMAKEPROJECTMIMETYPE); diff --git a/src/plugins/cmakeprojectmanager/cmakeeditor.h b/src/plugins/cmakeprojectmanager/cmakeeditor.h index 91123792a5f..2eab78ed83d 100644 --- a/src/plugins/cmakeprojectmanager/cmakeeditor.h +++ b/src/plugins/cmakeprojectmanager/cmakeeditor.h @@ -45,8 +45,6 @@ public: class CMakeEditorFactory : public TextEditor::TextEditorFactory { - Q_OBJECT - public: CMakeEditorFactory(); }; diff --git a/src/plugins/cmakeprojectmanager/cmakeprojectconstants.h b/src/plugins/cmakeprojectmanager/cmakeprojectconstants.h index 8714f04111a..acd66a7bacf 100644 --- a/src/plugins/cmakeprojectmanager/cmakeprojectconstants.h +++ b/src/plugins/cmakeprojectmanager/cmakeprojectconstants.h @@ -33,7 +33,6 @@ namespace Constants { const char CMAKEMIMETYPE[] = "text/x-cmake"; const char CMAKEPROJECTMIMETYPE[] = "text/x-cmake-project"; const char CMAKE_EDITOR_ID[] = "CMakeProject.CMakeEditor"; -const char CMAKE_EDITOR_DISPLAY_NAME[] = QT_TRANSLATE_NOOP("CMakeProjectManager::Internal::CMakeEditorFactory", "CMake Editor"); const char RUNCMAKE[] = "CMakeProject.RunCMake"; const char CLEARCMAKECACHE[] = "CMakeProject.ClearCache"; const char RESCANPROJECT[] = "CMakeProject.RescanProject"; diff --git a/src/plugins/compilationdatabaseprojectmanager/compilationdatabaseproject.cpp b/src/plugins/compilationdatabaseprojectmanager/compilationdatabaseproject.cpp index 41bd6c4c244..1f60fd0fe36 100644 --- a/src/plugins/compilationdatabaseprojectmanager/compilationdatabaseproject.cpp +++ b/src/plugins/compilationdatabaseprojectmanager/compilationdatabaseproject.cpp @@ -510,7 +510,7 @@ static TextEditor::TextDocument *createCompilationDatabaseDocument() CompilationDatabaseEditorFactory::CompilationDatabaseEditorFactory() { setId(Constants::COMPILATIONDATABASEPROJECT_ID); - setDisplayName("Compilation Database"); + setDisplayName(QCoreApplication::translate("OpenWith::Editors", "Compilation Database")); addMimeType(Constants::COMPILATIONDATABASEMIMETYPE); setEditorCreator([]() { return new TextEditor::BaseTextEditor; }); diff --git a/src/plugins/compilationdatabaseprojectmanager/compilationdatabaseproject.h b/src/plugins/compilationdatabaseprojectmanager/compilationdatabaseproject.h index f2aa9e6dbdb..40ed930366d 100644 --- a/src/plugins/compilationdatabaseprojectmanager/compilationdatabaseproject.h +++ b/src/plugins/compilationdatabaseprojectmanager/compilationdatabaseproject.h @@ -88,8 +88,6 @@ public: class CompilationDatabaseEditorFactory : public TextEditor::TextEditorFactory { - Q_OBJECT - public: CompilationDatabaseEditorFactory(); }; diff --git a/src/plugins/coreplugin/actionmanager/actioncontainer.cpp b/src/plugins/coreplugin/actionmanager/actioncontainer.cpp index 04a515b88d4..7737128f46e 100644 --- a/src/plugins/coreplugin/actionmanager/actioncontainer.cpp +++ b/src/plugins/coreplugin/actionmanager/actioncontainer.cpp @@ -42,13 +42,13 @@ Q_DECLARE_METATYPE(Core::Internal::MenuActionContainer*) using namespace Utils; namespace Core { -namespace Internal { /*! - \class ActionContainer - \mainclass + \class Core::ActionContainer + \ingroup mainclasses + \inmodule QtCreator - \brief The ActionContainer class represents a menu or menu bar in Qt Creator. + \brief The ActionContainer class represents a menu or menu bar in \QC. You don't create instances of this class directly, but instead use the \l{ActionManager::createMenu()}, \l{ActionManager::createMenuBar()} and @@ -58,23 +58,25 @@ namespace Internal { Within a menu or menu bar you can group menus and items together by defining groups (the order of the groups is defined by the order of the \l{ActionContainer::appendGroup()} calls), and - adding menus/actions to these groups. If no custom groups are defined, an action container + adding menus or actions to these groups. If no custom groups are defined, an action container has three default groups \c{Core::Constants::G_DEFAULT_ONE}, \c{Core::Constants::G_DEFAULT_TWO} and \c{Core::Constants::G_DEFAULT_THREE}. - You can define if the menu represented by this action container should automatically disable - or hide whenever it only contains disabled items and submenus by setting the corresponding + You can specify whether the menu represented by this action container should + be automatically disabled or hidden whenever it only contains disabled items + and submenus by setting the corresponding \l{ActionContainer::setOnAllDisabledBehavior()}{OnAllDisabledBehavior}. The default is ActionContainer::Disable for menus, and ActionContainer::Show for menu bars. */ /*! \enum ActionContainer::OnAllDisabledBehavior - Defines what happens when the represented menu is empty or contains only disabled/invisible items. + Defines what happens when the represented menu is empty or contains only + disabled or invisible items. \value Disable The menu will be visible but disabled. \value Hide - The menu will not be visible until the state of the subitems change. + The menu will not be visible until the state of the subitems changes. \value Show The menu will still be visible and active. */ @@ -90,7 +92,7 @@ namespace Internal { /*! \fn ActionContainer::onAllDisabledBehavior() const - Returns the \a behavior of the menu represented by this action container for the case + Returns the behavior of the menu represented by this action container for the case whenever it only contains disabled items and submenus. The default is ActionContainer::Disable for menus, and ActionContainer::Show for menu bars. \sa ActionContainer::OnAllDisabledBehavior @@ -122,9 +124,10 @@ namespace Internal { /*! \fn void ActionContainer::appendGroup(Id group) - Adds a group with the given \a identifier to the action container. Using groups - you can segment your action container into logical parts and add actions and - menus directly to these parts. + Adds \a group to the action container. + + Use groups to segment your action container into logical parts. You can add + actions and menus directly into groups. \sa addAction() \sa addMenu() */ @@ -145,6 +148,45 @@ namespace Internal { \sa addAction() */ +/*! + \fn void ActionContainer::addMenu(ActionContainer *before, ActionContainer *menu) + Add \a menu as a submenu to this action container before the menu specified + by \a before. + \sa appendGroup() + \sa addAction() +*/ + +/*! + \fn ActionContainer::clear() + + Clears this menu and submenus from all actions and submenus. However, does + does not destroy the submenus and commands, just removes them from their + parents. +*/ + +/*! + \fn ActionContainer::insertGroup(Id before, Id group) + + Inserts \a group to the action container before the group specified by + \a before. +*/ + +/*! + \fn virtual Utils::TouchBar *ActionContainer::touchBar() const + + Returns the touch bar that is represented by this action container. +*/ + +/*! + \fn ActionContainer::addSeparator(const Context &context, Id group, QAction **outSeparator) + + Adds a separator to the end of the given \a group to the action container, + which is enabled for a given \a context. Returns the created separator + action, \a outSeparator. +*/ + +namespace Internal { + // ---------- ActionContainerPrivate ------------ /*! @@ -293,15 +335,6 @@ void ActionContainerPrivate::addMenu(ActionContainer *before, ActionContainer *m scheduleUpdate(); } -/*! - * Adds a separator to the end of the given \a group to the action container, which is enabled - * for a given \a context. The created separator action is returned through \a outSeparator. - * - * Returns the created Command for the separator. - */ -/*! \a context \a group \a outSeparator - * \internal - */ Command *ActionContainerPrivate::addSeparator(const Context &context, Id group, QAction **outSeparator) { static int separatorIdCount = 0; @@ -648,6 +681,11 @@ bool TouchBarActionContainer::updateInternal() } // namespace Internal +/*! + Adds a separator to the end of \a group to the action container. + + Returns the created separator. +*/ Command *ActionContainer::addSeparator(Id group) { static const Context context(Constants::C_GLOBAL); diff --git a/src/plugins/coreplugin/actionmanager/actionmanager.cpp b/src/plugins/coreplugin/actionmanager/actionmanager.cpp index d430ce47947..0f25fc4a192 100644 --- a/src/plugins/coreplugin/actionmanager/actionmanager.cpp +++ b/src/plugins/coreplugin/actionmanager/actionmanager.cpp @@ -52,18 +52,18 @@ using namespace Core::Internal; /*! \class Core::ActionManager - \mainclass - \inmodule Qt Creator + \ingroup mainclasses + \inmodule QtCreator \brief The ActionManager class is responsible for registration of menus and menu items and keyboard shortcuts. The ActionManager is the central bookkeeper of actions and their shortcuts and layout. It is a singleton containing mostly static functions. If you need access to the instance, - e.g. for connecting to signals, is its ActionManager::instance() function. + e.g. for connecting to signals, call its ActionManager::instance() function. - The main reasons for the need of this class is to provide a central place where the user - can specify all his keyboard shortcuts, and to provide a solution for actions that should + The main reasons for the need of this class is to provide a central place where the users + can specify all their keyboard shortcuts, and to provide a solution for actions that should behave differently in different contexts (like the copy/replace/undo/redo actions). \section1 Contexts @@ -147,7 +147,7 @@ using namespace Core::Internal; */ /*! - \fn void ActionManager::commandAdded(const QString &id) + \fn void ActionManager::commandAdded(Core::Id id) Emitted when a command (with the \a id) is added. */ @@ -262,7 +262,7 @@ ActionContainer *ActionManager::createTouchBar(Id id, const QIcon &icon, const Q for the currently active context. If the optional \a context argument is not specified, the global context will be assumed. - A scriptable action can be called from a script without the need for the user + A \a scriptable action can be called from a script without the need for the user to interact with it. */ Command *ActionManager::registerAction(QAction *action, Id id, const Context &context, bool scriptable) @@ -356,7 +356,7 @@ void ActionManager::unregisterAction(QAction *action, Id id) /*! Handles the display of the used shortcuts in the presentation mode. The presentation mode is - enabled when starting \QC with the command line argument \c{-presentationMode}. In the + \a enabled when starting \QC with the command line argument \c{-presentationMode}. In the presentation mode, \QC displays any pressed shortcut in a grey box. */ void ActionManager::setPresentationModeEnabled(bool enabled) @@ -377,11 +377,19 @@ void ActionManager::setPresentationModeEnabled(bool enabled) d->m_presentationModeEnabled = enabled; } +/*! + Returns whether presentation mode is enabled. + + \sa setPresentationModeEnabled +*/ bool ActionManager::isPresentationModeEnabled() { return d->m_presentationModeEnabled; } +/*! + \internal +*/ QString ActionManager::withNumberAccelerator(const QString &text, const int number) { if (Utils::HostOsInfo::isMacHost() || number > 9) diff --git a/src/plugins/coreplugin/actionmanager/command.cpp b/src/plugins/coreplugin/actionmanager/command.cpp index 21ac5c2987f..2d2eba652db 100644 --- a/src/plugins/coreplugin/actionmanager/command.cpp +++ b/src/plugins/coreplugin/actionmanager/command.cpp @@ -40,9 +40,11 @@ /*! \class Core::Command - \mainclass + \inmodule QtCreator + \ingroup mainclasses \brief The Command class represents an action, such as a menu item, tool button, or shortcut. + You do not create Command objects directly, but use \l{ActionManager::registerAction()} to register an action and retrieve a Command. The Command object represents the user visible action and its properties. If multiple actions are registered with the same ID (but @@ -69,13 +71,12 @@ This enum defines how the user visible action is updated when the active action changes. The default is to update the enabled and visible state, and to disable the user visible action when there is no active action. - \omitvalue CA_Mask \value CA_UpdateText Also update the actions text. \value CA_UpdateIcon Also update the actions icon. \value CA_Hide - When there is no active action, hide the user "visible" action, instead of just + When there is no active action, hide the user-visible action, instead of just disabling it. \value CA_NonConfigurable Flag to indicate that the keyboard shortcut of this Command should not be @@ -150,6 +151,12 @@ no active action for the current context. */ +/*! + \fn Context Command::context() const + + Returns the context for this command. +*/ + /*! \fn void Command::setAttribute(CommandAttribute attribute) Adds \a attribute to the attributes of this Command. @@ -187,18 +194,48 @@ /*! \fn bool Command::isScriptable(const Context &) const - Returns whether the Command is scriptable for the given context. - A scriptable command can be called from a script without the need for the user to - interact with it. + \internal + + Returns whether the Command is scriptable. +*/ + +/*! + \fn void Command::activeStateChanged() + + This signal is emitted when the active state of the command changes. +*/ + +/*! + \fn virtual void Command::setTouchBarText(const QString &text) + + Sets the text for the action on the touch bar to \a text. +*/ + +/*! + \fn virtual QString Command::touchBarText() const + + Returns the text for the action on the touch bar. +*/ + +/*! + \fn virtual void Command::setTouchBarIcon(const QIcon &icon) + + Sets the icon for the action on the touch bar to \a icon. +*/ + +/*! \fn virtual QIcon Command::touchBarIcon() const + + Returns the icon for the action on the touch bar. +*/ + +/*! \fn virtual QAction *Command::touchBarAction() const + + Adds an action to the touch bar. */ namespace Core { namespace Internal { -/*! - \class Action - \internal -*/ Action::Action(Id id) : m_attributes({}), m_id(id), @@ -453,6 +490,10 @@ QAction *Action::touchBarAction() const } // namespace Internal +/*! + Appends the keyboard shortcut that is currently assigned to the action \a a + to its tool tip. +*/ void Command::augmentActionWithShortcutToolTip(QAction *a) const { a->setToolTip(stringWithAppendedShortcut(a->text())); @@ -464,6 +505,11 @@ void Command::augmentActionWithShortcutToolTip(QAction *a) const }); } +/*! + Returns a tool button for \a action. + + Appends the keyboard shortcut \a cmd to the tool tip of the action. +*/ QToolButton *Command::toolButtonWithAppendedShortcut(QAction *action, Command *cmd) { auto button = new QToolButton; diff --git a/src/plugins/coreplugin/actionmanager/commandbutton.cpp b/src/plugins/coreplugin/actionmanager/commandbutton.cpp index 3f4f5b7a130..7e2ef31c159 100644 --- a/src/plugins/coreplugin/actionmanager/commandbutton.cpp +++ b/src/plugins/coreplugin/actionmanager/commandbutton.cpp @@ -34,6 +34,7 @@ using namespace Core; /*! \class Core::CommandButton + \inmodule QtCreator \brief The CommandButton class is a tool button associated with one of the registered Command objects. @@ -42,12 +43,23 @@ using namespace Core; key sequence which is automatically updated when user changes it. */ +/*! + \property CommandButton::toolTipBase + \brief The tool tip base for the command button. +*/ + +/*! + \internal +*/ CommandButton::CommandButton(QWidget *parent) : QToolButton(parent) , m_command(nullptr) { } +/*! + \internal +*/ CommandButton::CommandButton(Id id, QWidget *parent) : QToolButton(parent) , m_command(nullptr) @@ -55,6 +67,9 @@ CommandButton::CommandButton(Id id, QWidget *parent) setCommandId(id); } +/*! + Sets the ID of the command associated with this tool button to \a id. +*/ void CommandButton::setCommandId(Id id) { if (m_command) diff --git a/src/plugins/coreplugin/actionmanager/commandmappings.cpp b/src/plugins/coreplugin/actionmanager/commandmappings.cpp index 7febf11b29a..0280217dab4 100644 --- a/src/plugins/coreplugin/actionmanager/commandmappings.cpp +++ b/src/plugins/coreplugin/actionmanager/commandmappings.cpp @@ -123,6 +123,12 @@ public: } // namespace Internal +/*! + \class Core::CommandMappings + \inmodule QtCreator + \internal +*/ + CommandMappings::CommandMappings(QWidget *parent) : QWidget(parent), d(new Internal::CommandMappingsPrivate(this)) { diff --git a/src/plugins/coreplugin/actionmanager/commandsfile.cpp b/src/plugins/coreplugin/actionmanager/commandsfile.cpp index d6bbd7f2cbb..faeed00e07e 100644 --- a/src/plugins/coreplugin/actionmanager/commandsfile.cpp +++ b/src/plugins/coreplugin/actionmanager/commandsfile.cpp @@ -64,13 +64,15 @@ Context::Context() : } /*! - \class CommandsFile + \class Core::Internal::CommandsFile + \internal + \inmodule QtCreator \brief The CommandsFile class provides a collection of import and export commands. \inheaderfile commandsfile.h */ /*! - ... + \internal */ CommandsFile::CommandsFile(const QString &filename) : m_filename(filename) @@ -79,7 +81,7 @@ CommandsFile::CommandsFile(const QString &filename) } /*! - ... + \internal */ QMap CommandsFile::importCommands() const { @@ -123,7 +125,7 @@ QMap CommandsFile::importCommands() const } /*! - ... + \internal */ bool CommandsFile::exportCommands(const QList &items) diff --git a/src/plugins/coreplugin/locator/basefilefilter.cpp b/src/plugins/coreplugin/locator/basefilefilter.cpp index 0bcf12e3f95..ade74bbb920 100644 --- a/src/plugins/coreplugin/locator/basefilefilter.cpp +++ b/src/plugins/coreplugin/locator/basefilefilter.cpp @@ -64,8 +64,30 @@ public: } // Internal +/*! + \class Core::BaseFileFilter + \inmodule QtCreator + + \brief The BaseFileFilter class is a base class for locator filter classes. +*/ + +/*! + \class Core::BaseFileFilter::Iterator + \inmodule QtCreator + \internal +*/ + +/*! + \class Core::BaseFileFilter::ListIterator + \inmodule QtCreator + \internal +*/ + BaseFileFilter::Iterator::~Iterator() = default; +/*! + \internal +*/ BaseFileFilter::BaseFileFilter() : d(new Internal::BaseFileFilterPrivate) { @@ -73,11 +95,17 @@ BaseFileFilter::BaseFileFilter() setFileIterator(new ListIterator({})); } +/*! + \internal +*/ BaseFileFilter::~BaseFileFilter() { delete d; } +/*! + \reimp +*/ void BaseFileFilter::prepareSearch(const QString &entry) { Q_UNUSED(entry) @@ -104,6 +132,9 @@ ILocatorFilter::MatchLevel BaseFileFilter::matchLevelFor(const QRegularExpressio return MatchLevel::Normal; } +/*! + \reimp +*/ QList BaseFileFilter::matchesFor(QFutureInterface &future, const QString &origEntry) { QList entries[int(MatchLevel::Count)]; @@ -184,6 +215,9 @@ QList BaseFileFilter::matchesFor(QFutureInterface()); } +/*! + \reimp +*/ void BaseFileFilter::accept(LocatorFilterEntry selection, QString *newText, int *selectionStart, int *selectionLength) const { @@ -206,6 +240,9 @@ void BaseFileFilter::setFileIterator(BaseFileFilter::Iterator *iterator) d->m_data.iterator.reset(iterator); } +/*! + Returns the file iterator. +*/ QSharedPointer BaseFileFilter::fileIterator() { return d->m_data.iterator; diff --git a/src/plugins/coreplugin/locator/commandlocator.cpp b/src/plugins/coreplugin/locator/commandlocator.cpp index 7546d0f9b06..5053bd92909 100644 --- a/src/plugins/coreplugin/locator/commandlocator.cpp +++ b/src/plugins/coreplugin/locator/commandlocator.cpp @@ -40,6 +40,12 @@ struct CommandLocatorPrivate QList commands; }; +/*! + \class Core::CommandLocator + \inmodule QtCreator + \internal +*/ + CommandLocator::CommandLocator(Id id, const QString &displayName, const QString &shortCutString, diff --git a/src/plugins/coreplugin/locator/directoryfilter.cpp b/src/plugins/coreplugin/locator/directoryfilter.cpp index c6212571f64..718039c5ce5 100644 --- a/src/plugins/coreplugin/locator/directoryfilter.cpp +++ b/src/plugins/coreplugin/locator/directoryfilter.cpp @@ -37,6 +37,12 @@ namespace Core { +/*! + \class Core::DirectoryFilter + \inmodule QtCreator + \internal +*/ + DirectoryFilter::DirectoryFilter(Id id) : m_filters({"*.h", "*.cpp", "*.ui", "*.qrc"}), m_exclusionFilters({"*/.git/*", "*/.cvs/*", "*/.svn/*"}) diff --git a/src/plugins/coreplugin/locator/ilocatorfilter.cpp b/src/plugins/coreplugin/locator/ilocatorfilter.cpp index df49721d3f7..1d1b8213f8d 100644 --- a/src/plugins/coreplugin/locator/ilocatorfilter.cpp +++ b/src/plugins/coreplugin/locator/ilocatorfilter.cpp @@ -41,13 +41,25 @@ using namespace Core; /*! \class Core::ILocatorFilter - \inmodule Qt Creator + \inmodule QtCreator \brief The ILocatorFilter class adds a locator filter. The filter is added to \uicontrol Tools > \uicontrol Locate. */ +/*! + \class Core::LocatorFilterEntry + \inmodule QtCreator + \internal +*/ + +/*! + \class Core::LocatorFilterEntry::HighlightInfo + \inmodule QtCreator + \internal +*/ + static QList g_locatorFilters; /*! @@ -64,6 +76,9 @@ ILocatorFilter::~ILocatorFilter() g_locatorFilters.removeOne(this); } +/*! + Returns the list of all locator filters. +*/ const QList ILocatorFilter::allLocatorFilters() { return g_locatorFilters; @@ -207,11 +222,19 @@ Qt::CaseSensitivity ILocatorFilter::caseSensitivity(const QString &str) return str == str.toLower() ? Qt::CaseInsensitive : Qt::CaseSensitive; } +/*! + Creates the search term \a text as a regular expression with case + sensitivity set to \a caseSensitivity. +*/ QRegularExpression ILocatorFilter::createRegExp(const QString &text, Qt::CaseSensitivity caseSensitivity) { return FuzzyMatcher::createRegExp(text, caseSensitivity); } +/*! + Returns information for highlighting the results of matching the regular + expression, specified by \a match, for the data of the type \a dataType. +*/ LocatorFilterEntry::HighlightInfo ILocatorFilter::highlightInfo( const QRegularExpressionMatch &match, LocatorFilterEntry::HighlightInfo::DataType dataType) { @@ -288,7 +311,9 @@ bool ILocatorFilter::isIncludedByDefault() const } /*! - Sets whether using the shortcut string is required to use this filter. + Sets whether using the shortcut string is required to use this filter + to \a includedByDefault. + Call from the constructor of subclasses to change the default. \sa isIncludedByDefault() @@ -312,8 +337,8 @@ bool ILocatorFilter::isHidden() const } /*! - Hides the filter in the \uicontrol {Locator filters} filter, - menus, and locator settings. Call in the constructor of subclasses. + Sets the filter in the \uicontrol {Locator filters} filter, menus, and + locator settings to \a hidden. Call in the constructor of subclasses. */ void ILocatorFilter::setHidden(bool hidden) { @@ -344,6 +369,9 @@ Id ILocatorFilter::id() const return m_id; } +/*! + Returns the filter's action ID. +*/ Id ILocatorFilter::actionId() const { return m_id.withPrefix("Locator."); @@ -373,7 +401,7 @@ ILocatorFilter::Priority ILocatorFilter::priority() const } /*! - Sets whether the filter is currently available. + Sets whether the filter is currently available to \a enabled. \sa isEnabled() */ @@ -383,7 +411,7 @@ void ILocatorFilter::setEnabled(bool enabled) } /*! - Sets the filter's unique ID. + Sets the filter's unique \a id. Subclasses must set the ID in their constructor. \sa id() @@ -394,7 +422,7 @@ void ILocatorFilter::setId(Id id) } /*! - Sets the priority of results of this filter in the result list. + Sets the \a priority of results of this filter in the result list. \sa priority() */ @@ -404,7 +432,7 @@ void ILocatorFilter::setPriority(Priority priority) } /*! - Sets the translated display name of this filter. + Sets the translated display name of this filter to \a displayString. Subclasses must set the display name in their constructor. @@ -416,7 +444,7 @@ void ILocatorFilter::setDisplayName(const QString &displayString) } /*! - Sets whether the filter provides a configuration dialog. + Sets whether the filter provides a configuration dialog to \a configurable. Most filters should at least provide the default dialog. \sa isConfigurable() @@ -475,3 +503,19 @@ void ILocatorFilter::setConfigurable(bool configurable) The results for this filter are placed below the results for filters that have other priorities. */ + +/*! + \enum ILocatorFilter::MatchLevel + + This enum value holds the level for ordering the results based on how well + they match the search criteria. + + \value Best + The result is the best match for the regular expression. + \value Better + \value Good + \value Normal + \value Count + The result has the highest number of matches for the regular + expression. +*/ diff --git a/src/plugins/coreplugin/locator/locatorfiltertest.cpp b/src/plugins/coreplugin/locator/locatorfiltertest.cpp index b859c317506..03362eda39e 100644 --- a/src/plugins/coreplugin/locator/locatorfiltertest.cpp +++ b/src/plugins/coreplugin/locator/locatorfiltertest.cpp @@ -37,6 +37,23 @@ using namespace Core; using namespace Core::Tests; +/*! + \class Core::Tests::BasicLocatorFilterTest + \inmodule QtCreator + \internal +*/ + +/*! + \class Core::Tests::TestDataDir + \inmodule QtCreator + \internal +*/ + +/*! + \namespace Core::Tests + \inmodule QtCreator + \internal +*/ BasicLocatorFilterTest::BasicLocatorFilterTest(ILocatorFilter *filter) : m_filter(filter) { } @@ -54,6 +71,11 @@ QList BasicLocatorFilterTest::matchesFor(const QString &sear return locatorSearch.results(); } +/*! + \class Core::Tests::ResultData + \inmodule QtCreator + \internal +*/ ResultData::ResultData() = default; ResultData::ResultData(const QString &textColumn1, const QString &textColumn2, diff --git a/src/plugins/coreplugin/locator/locatormanager.cpp b/src/plugins/coreplugin/locator/locatormanager.cpp index 0ff25b02cdf..6506f3b74b8 100644 --- a/src/plugins/coreplugin/locator/locatormanager.cpp +++ b/src/plugins/coreplugin/locator/locatormanager.cpp @@ -40,6 +40,12 @@ using namespace Core::Internal; namespace Core { +/*! + \class Core::LocatorManager + \inmodule QtCreator + \internal +*/ + LocatorManager::LocatorManager() { } diff --git a/src/plugins/coreplugin/locator/urllocatorfilter.cpp b/src/plugins/coreplugin/locator/urllocatorfilter.cpp index 153a1503fff..c567e810d76 100644 --- a/src/plugins/coreplugin/locator/urllocatorfilter.cpp +++ b/src/plugins/coreplugin/locator/urllocatorfilter.cpp @@ -119,6 +119,12 @@ void UrlFilterOptions::updateActionButtons() // -- UrlLocatorFilter +/*! + \class Core::UrlLocatorFilter + \inmodule QtCreator + \internal +*/ + UrlLocatorFilter::UrlLocatorFilter(Id id) : UrlLocatorFilter(tr("URL Template"), id) {} diff --git a/src/plugins/glsleditor/glsleditor.h b/src/plugins/glsleditor/glsleditor.h index 99411bfe8be..95bf9a1a918 100644 --- a/src/plugins/glsleditor/glsleditor.h +++ b/src/plugins/glsleditor/glsleditor.h @@ -34,8 +34,6 @@ int languageVariant(const QString &mimeType); class GlslEditorFactory : public TextEditor::TextEditorFactory { - Q_OBJECT - public: GlslEditorFactory(); }; diff --git a/src/plugins/nim/editor/nimeditorfactory.cpp b/src/plugins/nim/editor/nimeditorfactory.cpp index 51d6c22f4ba..513a5d7969e 100644 --- a/src/plugins/nim/editor/nimeditorfactory.cpp +++ b/src/plugins/nim/editor/nimeditorfactory.cpp @@ -45,7 +45,7 @@ namespace Nim { NimEditorFactory::NimEditorFactory() { setId(Constants::C_NIMEDITOR_ID); - setDisplayName(tr(Nim::Constants::C_EDITOR_DISPLAY_NAME)); + setDisplayName(QCoreApplication::translate("OpenWith::Editors", "Nim Editor")); addMimeType(QLatin1String(Nim::Constants::C_NIM_MIMETYPE)); addMimeType(QLatin1String(Nim::Constants::C_NIM_SCRIPT_MIMETYPE)); diff --git a/src/plugins/nim/editor/nimeditorfactory.h b/src/plugins/nim/editor/nimeditorfactory.h index ac60a3593da..30ccbc15428 100644 --- a/src/plugins/nim/editor/nimeditorfactory.h +++ b/src/plugins/nim/editor/nimeditorfactory.h @@ -29,14 +29,12 @@ namespace Nim { -class NimEditorFactory : public TextEditor::TextEditorFactory +class NimEditorFactory final : public TextEditor::TextEditorFactory { - Q_OBJECT - public: NimEditorFactory(); static void decorateEditor(TextEditor::TextEditorWidget *editor); }; -} +} // Nim diff --git a/src/plugins/nim/nimconstants.h b/src/plugins/nim/nimconstants.h index a8c3863ca8f..c6b6dbe023c 100644 --- a/src/plugins/nim/nimconstants.h +++ b/src/plugins/nim/nimconstants.h @@ -34,7 +34,6 @@ namespace Constants { const char C_NIMPROJECT_ID[] = "Nim.NimProject"; const char C_NIMBLEPROJECT_ID[] = "Nim.NimbleProject"; const char C_NIMEDITOR_ID[] = "Nim.NimEditor"; -const char C_EDITOR_DISPLAY_NAME[] = QT_TRANSLATE_NOOP("OpenWith::Editors", "Nim Editor"); // NimToolChain const char C_NIMTOOLCHAIN_TYPEID[] = "Nim.NimToolChain"; diff --git a/src/plugins/projectexplorer/desktoprunconfiguration.cpp b/src/plugins/projectexplorer/desktoprunconfiguration.cpp index d534c297315..b30e4b5c8d5 100644 --- a/src/plugins/projectexplorer/desktoprunconfiguration.cpp +++ b/src/plugins/projectexplorer/desktoprunconfiguration.cpp @@ -47,6 +47,23 @@ using namespace Utils; namespace ProjectExplorer { namespace Internal { +class DesktopRunConfiguration : public RunConfiguration +{ + Q_DECLARE_TR_FUNCTIONS(ProjectExplorer::Internal::DesktopRunConfiguration) + +protected: + enum Kind { Qmake, Qbs, CMake }; // FIXME: Remove + + DesktopRunConfiguration(Target *target, Core::Id id, Kind kind); + +private: + void updateTargetInformation(); + + Utils::FilePath executableToRun(const BuildTargetInfo &targetInfo) const; + + const Kind m_kind; +}; + DesktopRunConfiguration::DesktopRunConfiguration(Target *target, Core::Id id, Kind kind) : RunConfiguration(target, id), m_kind(kind) { @@ -148,7 +165,7 @@ Utils::FilePath DesktopRunConfiguration::executableToRun(const BuildTargetInfo & // Factory -class DesktopQmakeRunConfiguration : public DesktopRunConfiguration +class DesktopQmakeRunConfiguration final : public DesktopRunConfiguration { public: DesktopQmakeRunConfiguration(Target *target, Core::Id id) @@ -156,7 +173,7 @@ public: {} }; -class QbsRunConfiguration : public DesktopRunConfiguration +class QbsRunConfiguration final : public DesktopRunConfiguration { public: QbsRunConfiguration(Target *target, Core::Id id) @@ -164,7 +181,7 @@ public: {} }; -class CMakeRunConfiguration : public DesktopRunConfiguration +class CMakeRunConfiguration final : public DesktopRunConfiguration { public: CMakeRunConfiguration(Target *target, Core::Id id) diff --git a/src/plugins/projectexplorer/desktoprunconfiguration.h b/src/plugins/projectexplorer/desktoprunconfiguration.h index 07459ac4ebe..446186e8035 100644 --- a/src/plugins/projectexplorer/desktoprunconfiguration.h +++ b/src/plugins/projectexplorer/desktoprunconfiguration.h @@ -31,36 +31,19 @@ namespace ProjectExplorer { namespace Internal { -class DesktopRunConfiguration : public RunConfiguration -{ - Q_OBJECT - -protected: - enum Kind { Qmake, Qbs, CMake }; // FIXME: Remove - - DesktopRunConfiguration(Target *target, Core::Id id, Kind kind); - -private: - void updateTargetInformation(); - - Utils::FilePath executableToRun(const BuildTargetInfo &targetInfo) const; - - const Kind m_kind; -}; - -class DesktopQmakeRunConfigurationFactory : public RunConfigurationFactory +class DesktopQmakeRunConfigurationFactory final : public RunConfigurationFactory { public: DesktopQmakeRunConfigurationFactory(); }; -class QbsRunConfigurationFactory : public RunConfigurationFactory +class QbsRunConfigurationFactory final : public RunConfigurationFactory { public: QbsRunConfigurationFactory(); }; -class CMakeRunConfigurationFactory : public RunConfigurationFactory +class CMakeRunConfigurationFactory final : public RunConfigurationFactory { public: CMakeRunConfigurationFactory(); diff --git a/src/plugins/projectexplorer/projectexplorer.cpp b/src/plugins/projectexplorer/projectexplorer.cpp index b8d25f61229..959f80f93e1 100644 --- a/src/plugins/projectexplorer/projectexplorer.cpp +++ b/src/plugins/projectexplorer/projectexplorer.cpp @@ -2738,6 +2738,28 @@ static bool hasBuildSettings(const Project *pro) }); } +static QPair subprojectEnabledState(const Project *pro) +{ + QPair result; + result.first = true; + + const QList &projects = SessionManager::projectOrder(pro); + foreach (Project *project, projects) { + if (project && project->activeTarget() + && project->activeTarget()->activeBuildConfiguration() + && !project->activeTarget()->activeBuildConfiguration()->isEnabled()) { + result.first = false; + result.second + += QCoreApplication::translate("ProjectExplorerPluginPrivate", + "Building \"%1\" is disabled: %2
") + .arg(project->displayName(), + project->activeTarget()->activeBuildConfiguration()->disabledReason()); + } + } + + return result; +} + QPair ProjectExplorerPluginPrivate::buildSettingsEnabled(const Project *pro) { QPair result; @@ -2755,18 +2777,7 @@ QPair ProjectExplorerPluginPrivate::buildSettingsEnabled(const Pr result.first = false; result.second = tr("Project has no build settings."); } else { - const QList & projects = SessionManager::projectOrder(pro); - foreach (Project *project, projects) { - if (project - && project->activeTarget() - && project->activeTarget()->activeBuildConfiguration() - && !project->activeTarget()->activeBuildConfiguration()->isEnabled()) { - result.first = false; - result.second += tr("Building \"%1\" is disabled: %2
") - .arg(project->displayName(), - project->activeTarget()->activeBuildConfiguration()->disabledReason()); - } - } + result = subprojectEnabledState(pro); } return result; } @@ -2785,18 +2796,7 @@ QPair ProjectExplorerPluginPrivate::buildSettingsEnabledForSessio result.first = false; result.second = tr("Project has no build settings."); } else { - foreach (Project *project, SessionManager::projectOrder(nullptr)) { - if (project - && project->activeTarget() - && project->activeTarget()->activeBuildConfiguration() - && !project->activeTarget()->activeBuildConfiguration()->isEnabled()) { - result.first = false; - result.second += tr("Building \"%1\" is disabled: %2") - .arg(project->displayName(), - project->activeTarget()->activeBuildConfiguration()->disabledReason()); - result.second += QLatin1Char('\n'); - } - } + result = subprojectEnabledState(nullptr); } return result; } diff --git a/src/plugins/qmakeprojectmanager/profileeditor.h b/src/plugins/qmakeprojectmanager/profileeditor.h index 048a0f0b13d..e469c707562 100644 --- a/src/plugins/qmakeprojectmanager/profileeditor.h +++ b/src/plugins/qmakeprojectmanager/profileeditor.h @@ -32,8 +32,6 @@ namespace Internal { class ProFileEditorFactory : public TextEditor::TextEditorFactory { - Q_OBJECT - public: ProFileEditorFactory(); }; diff --git a/src/plugins/qmljseditor/qmljseditor.h b/src/plugins/qmljseditor/qmljseditor.h index e0a68b9a02d..2e160527f00 100644 --- a/src/plugins/qmljseditor/qmljseditor.h +++ b/src/plugins/qmljseditor/qmljseditor.h @@ -142,8 +142,6 @@ public: class QMLJSEDITOR_EXPORT QmlJSEditorFactory : public TextEditor::TextEditorFactory { - Q_OBJECT - public: QmlJSEditorFactory(); QmlJSEditorFactory(Core::Id id); diff --git a/src/plugins/qtsupport/exampleslistmodel.cpp b/src/plugins/qtsupport/exampleslistmodel.cpp index c82dae0f170..a5bf950bf5f 100644 --- a/src/plugins/qtsupport/exampleslistmodel.cpp +++ b/src/plugins/qtsupport/exampleslistmodel.cpp @@ -24,7 +24,6 @@ ****************************************************************************/ #include "exampleslistmodel.h" - #include "screenshotcropper.h" #include @@ -34,6 +33,8 @@ #include #include +#include +#include #include #include @@ -216,6 +217,11 @@ int ExampleSetModel::getQtId(int i) const return variant.toInt(); } +bool ExampleSetModel::selectedQtSupports(const Core::Id &target) const +{ + return m_selectedQtTypes.contains(target); +} + int ExampleSetModel::getExtraExampleSetIndex(int i) const { QTC_ASSERT(i >= 0, return -1); @@ -651,6 +657,10 @@ void ExampleSetModel::selectExampleSet(int index) if (index != m_selectedExampleSetIndex) { m_selectedExampleSetIndex = index; writeCurrentIdToSettings(m_selectedExampleSetIndex); + if (getType(m_selectedExampleSetIndex) == ExampleSetModel::QtExampleSet) { + BaseQtVersion *selectedQtVersion = QtVersionManager::version(getQtId(m_selectedExampleSetIndex)); + m_selectedQtTypes = selectedQtVersion->targetDeviceTypes(); + } emit selectedExampleSetChanged(m_selectedExampleSetIndex); } } @@ -690,7 +700,8 @@ void ExampleSetModel::tryToInitialize() ExamplesListModelFilter::ExamplesListModelFilter(ExamplesListModel *sourceModel, bool showTutorialsOnly, QObject *parent) : Core::ListModelFilter(sourceModel, parent), - m_showTutorialsOnly(showTutorialsOnly) + m_showTutorialsOnly(showTutorialsOnly), + m_examplesListModel(sourceModel) { } @@ -699,16 +710,30 @@ bool ExamplesListModelFilter::leaveFilterAcceptsRowBeforeFiltering(const Core::L { QTC_ASSERT(earlyExitResult, return false); - const ExampleItem *exampleItem = static_cast(item); - if (m_showTutorialsOnly && exampleItem->type != Tutorial) { + const bool isTutorial = static_cast(item)->type == Tutorial; + + if (m_showTutorialsOnly) { + *earlyExitResult = isTutorial; + return !isTutorial; + } + + if (isTutorial) { *earlyExitResult = false; return true; } - if (!m_showTutorialsOnly && exampleItem->type != Example && exampleItem->type != Demo) { + if (m_examplesListModel->exampleSetModel()->selectedQtSupports(Android::Constants::ANDROID_DEVICE_TYPE) + && !item->tags.contains("android")) { *earlyExitResult = false; return true; } + + if (m_examplesListModel->exampleSetModel()->selectedQtSupports(Ios::Constants::IOS_DEVICE_TYPE) + && !item->tags.contains("ios")) { + *earlyExitResult = false; + return true; + } + return false; } diff --git a/src/plugins/qtsupport/exampleslistmodel.h b/src/plugins/qtsupport/exampleslistmodel.h index 80b0a8fe333..ad86b12e665 100644 --- a/src/plugins/qtsupport/exampleslistmodel.h +++ b/src/plugins/qtsupport/exampleslistmodel.h @@ -50,6 +50,7 @@ public: int selectedExampleSet() const { return m_selectedExampleSetIndex; } void selectExampleSet(int index); QStringList exampleSources(QString *examplesInstallPath, QString *demosInstallPath); + bool selectedQtSupports(const Core::Id &target) const; signals: void selectedExampleSetChanged(int); @@ -89,6 +90,7 @@ private: QList m_extraExampleSets; QList m_qtVersions; int m_selectedExampleSetIndex = -1; + QSet m_selectedQtTypes; bool m_qtVersionManagerInitialized = false; bool m_helpManagerInitialized = false; @@ -158,6 +160,7 @@ protected: bool *earlyExitResult) const override; private: const bool m_showTutorialsOnly; + ExamplesListModel *m_examplesListModel = nullptr; }; } // namespace Internal diff --git a/src/plugins/scxmleditor/scxmleditordata.cpp b/src/plugins/scxmleditor/scxmleditordata.cpp index 394b00533c3..14d9c26e18b 100644 --- a/src/plugins/scxmleditor/scxmleditordata.cpp +++ b/src/plugins/scxmleditor/scxmleditordata.cpp @@ -87,8 +87,7 @@ public: } }; -ScxmlEditorData::ScxmlEditorData(QObject *parent) - : QObject(parent) +ScxmlEditorData::ScxmlEditorData() { m_contexts.add(ScxmlEditor::Constants::C_SCXMLEDITOR); diff --git a/src/plugins/scxmleditor/scxmleditordata.h b/src/plugins/scxmleditor/scxmleditordata.h index 25054ecb3ab..0cd4bf71192 100644 --- a/src/plugins/scxmleditor/scxmleditordata.h +++ b/src/plugins/scxmleditor/scxmleditordata.h @@ -46,7 +46,7 @@ class ScxmlEditorData : public QObject { Q_OBJECT public: - ScxmlEditorData(QObject *parent = nullptr); + ScxmlEditorData(); ~ScxmlEditorData() override; void fullInit(); diff --git a/src/plugins/scxmleditor/scxmleditorfactory.cpp b/src/plugins/scxmleditor/scxmleditorfactory.cpp index a18132f9846..56d707173e8 100644 --- a/src/plugins/scxmleditor/scxmleditorfactory.cpp +++ b/src/plugins/scxmleditor/scxmleditorfactory.cpp @@ -48,7 +48,7 @@ ScxmlEditorFactory::ScxmlEditorFactory() setEditorCreator([this] { if (!m_editorData) { - m_editorData = new ScxmlEditorData(this); + m_editorData = new ScxmlEditorData; QGuiApplication::setOverrideCursor(Qt::WaitCursor); m_editorData->fullInit(); QGuiApplication::restoreOverrideCursor(); @@ -56,3 +56,8 @@ ScxmlEditorFactory::ScxmlEditorFactory() return m_editorData->createEditor(); }); } + +ScxmlEditorFactory::~ScxmlEditorFactory() +{ + delete m_editorData; +} diff --git a/src/plugins/scxmleditor/scxmleditorfactory.h b/src/plugins/scxmleditor/scxmleditorfactory.h index f4424f613c7..7dd3393da5f 100644 --- a/src/plugins/scxmleditor/scxmleditorfactory.h +++ b/src/plugins/scxmleditor/scxmleditorfactory.h @@ -36,6 +36,7 @@ class ScxmlEditorFactory final : public Core::IEditorFactory { public: ScxmlEditorFactory(); + ~ScxmlEditorFactory(); private: ScxmlEditorData* m_editorData = nullptr; diff --git a/src/plugins/texteditor/displaysettingspage.cpp b/src/plugins/texteditor/displaysettingspage.cpp index 81423c84005..1894f511374 100644 --- a/src/plugins/texteditor/displaysettingspage.cpp +++ b/src/plugins/texteditor/displaysettingspage.cpp @@ -33,58 +33,49 @@ #include -#include - namespace TextEditor { -struct DisplaySettingsPage::DisplaySettingsPagePrivate +class DisplaySettingsPagePrivate { +public: DisplaySettingsPagePrivate(); - QPointer m_widget; - Internal::Ui::DisplaySettingsPage *m_page = nullptr; DisplaySettings m_displaySettings; MarginSettings m_marginSettings; QString m_settingsPrefix; }; -DisplaySettingsPage::DisplaySettingsPagePrivate::DisplaySettingsPagePrivate() +DisplaySettingsPagePrivate::DisplaySettingsPagePrivate() { m_settingsPrefix = QLatin1String("text"); m_displaySettings.fromSettings(m_settingsPrefix, Core::ICore::settings()); m_marginSettings.fromSettings(m_settingsPrefix, Core::ICore::settings()); } -DisplaySettingsPage::DisplaySettingsPage() - : d(new DisplaySettingsPagePrivate) +class DisplaySettingsWidget final : public Core::IOptionsPageWidget { - setId(Constants::TEXT_EDITOR_DISPLAY_SETTINGS); - setDisplayName(tr("Display")); - setCategory(TextEditor::Constants::TEXT_EDITOR_SETTINGS_CATEGORY); - setDisplayCategory(QCoreApplication::translate("TextEditor", "Text Editor")); - setCategoryIconPath(TextEditor::Constants::TEXT_EDITOR_SETTINGS_CATEGORY_ICON_PATH); -} + Q_DECLARE_TR_FUNCTIONS(TextEditor::DisplaySettingsPage) -DisplaySettingsPage::~DisplaySettingsPage() -{ - delete d; -} - -QWidget *DisplaySettingsPage::widget() -{ - if (!d->m_widget) { - d->m_widget = new QWidget; - d->m_page = new Internal::Ui::DisplaySettingsPage; - d->m_page->setupUi(d->m_widget); +public: + DisplaySettingsWidget(DisplaySettingsPagePrivate *data) + : m_data(data) + { + m_ui.setupUi(this); settingsToUI(); } - return d->m_widget; -} -void DisplaySettingsPage::apply() + void apply() final; + + void settingsFromUI(DisplaySettings &displaySettings, MarginSettings &marginSettings) const; + void settingsToUI(); + void setDisplaySettings(const DisplaySettings &, const MarginSettings &newMarginSettings); + + DisplaySettingsPagePrivate *m_data = nullptr; + Internal::Ui::DisplaySettingsPage m_ui; +}; + +void DisplaySettingsWidget::apply() { - if (!d->m_page) // page was never shown - return; DisplaySettings newDisplaySettings; MarginSettings newMarginSettings; @@ -92,73 +83,64 @@ void DisplaySettingsPage::apply() setDisplaySettings(newDisplaySettings, newMarginSettings); } -void DisplaySettingsPage::finish() +void DisplaySettingsWidget::settingsFromUI(DisplaySettings &displaySettings, + MarginSettings &marginSettings) const { - delete d->m_widget; - if (!d->m_page) // page was never shown - return; - delete d->m_page; - d->m_page = nullptr; -} - -void DisplaySettingsPage::settingsFromUI(DisplaySettings &displaySettings, - MarginSettings &marginSettings) const -{ - displaySettings.m_displayLineNumbers = d->m_page->displayLineNumbers->isChecked(); - displaySettings.m_textWrapping = d->m_page->enableTextWrapping->isChecked(); - marginSettings.m_showMargin = d->m_page->showWrapColumn->isChecked(); - marginSettings.m_marginColumn = d->m_page->wrapColumn->value(); - displaySettings.m_visualizeWhitespace = d->m_page->visualizeWhitespace->isChecked(); - displaySettings.m_displayFoldingMarkers = d->m_page->displayFoldingMarkers->isChecked(); - displaySettings.m_highlightCurrentLine = d->m_page->highlightCurrentLine->isChecked(); - displaySettings.m_highlightBlocks = d->m_page->highlightBlocks->isChecked(); - displaySettings.m_animateMatchingParentheses = d->m_page->animateMatchingParentheses->isChecked(); - displaySettings.m_highlightMatchingParentheses = d->m_page->highlightMatchingParentheses->isChecked(); - displaySettings.m_markTextChanges = d->m_page->markTextChanges->isChecked(); - displaySettings.m_autoFoldFirstComment = d->m_page->autoFoldFirstComment->isChecked(); - displaySettings.m_centerCursorOnScroll = d->m_page->centerOnScroll->isChecked(); - displaySettings.m_openLinksInNextSplit = d->m_page->openLinksInNextSplit->isChecked(); - displaySettings.m_displayFileEncoding = d->m_page->displayFileEncoding->isChecked(); - displaySettings.m_scrollBarHighlights = d->m_page->scrollBarHighlights->isChecked(); - displaySettings.m_animateNavigationWithinFile = d->m_page->animateNavigationWithinFile->isChecked(); - displaySettings.m_displayAnnotations = d->m_page->displayAnnotations->isChecked(); - if (d->m_page->leftAligned->isChecked()) + displaySettings.m_displayLineNumbers = m_ui.displayLineNumbers->isChecked(); + displaySettings.m_textWrapping = m_ui.enableTextWrapping->isChecked(); + marginSettings.m_showMargin = m_ui.showWrapColumn->isChecked(); + marginSettings.m_marginColumn = m_ui.wrapColumn->value(); + displaySettings.m_visualizeWhitespace = m_ui.visualizeWhitespace->isChecked(); + displaySettings.m_displayFoldingMarkers = m_ui.displayFoldingMarkers->isChecked(); + displaySettings.m_highlightCurrentLine = m_ui.highlightCurrentLine->isChecked(); + displaySettings.m_highlightBlocks = m_ui.highlightBlocks->isChecked(); + displaySettings.m_animateMatchingParentheses = m_ui.animateMatchingParentheses->isChecked(); + displaySettings.m_highlightMatchingParentheses = m_ui.highlightMatchingParentheses->isChecked(); + displaySettings.m_markTextChanges = m_ui.markTextChanges->isChecked(); + displaySettings.m_autoFoldFirstComment = m_ui.autoFoldFirstComment->isChecked(); + displaySettings.m_centerCursorOnScroll = m_ui.centerOnScroll->isChecked(); + displaySettings.m_openLinksInNextSplit = m_ui.openLinksInNextSplit->isChecked(); + displaySettings.m_displayFileEncoding = m_ui.displayFileEncoding->isChecked(); + displaySettings.m_scrollBarHighlights = m_ui.scrollBarHighlights->isChecked(); + displaySettings.m_animateNavigationWithinFile = m_ui.animateNavigationWithinFile->isChecked(); + displaySettings.m_displayAnnotations = m_ui.displayAnnotations->isChecked(); + if (m_ui.leftAligned->isChecked()) displaySettings.m_annotationAlignment = AnnotationAlignment::NextToContent; - else if (d->m_page->atMargin->isChecked()) + else if (m_ui.atMargin->isChecked()) displaySettings.m_annotationAlignment = AnnotationAlignment::NextToMargin; - else if (d->m_page->rightAligned->isChecked()) + else if (m_ui.rightAligned->isChecked()) displaySettings.m_annotationAlignment = AnnotationAlignment::RightSide; - else if (d->m_page->betweenLines->isChecked()) + else if (m_ui.betweenLines->isChecked()) displaySettings.m_annotationAlignment = AnnotationAlignment::BetweenLines; } -void DisplaySettingsPage::settingsToUI() +void DisplaySettingsWidget::settingsToUI() { - const DisplaySettings &displaySettings = d->m_displaySettings; - const MarginSettings &marginSettings = d->m_marginSettings; - d->m_page->displayLineNumbers->setChecked(displaySettings.m_displayLineNumbers); - d->m_page->enableTextWrapping->setChecked(displaySettings.m_textWrapping); - d->m_page->showWrapColumn->setChecked(marginSettings.m_showMargin); - d->m_page->wrapColumn->setValue(marginSettings.m_marginColumn); - d->m_page->visualizeWhitespace->setChecked(displaySettings.m_visualizeWhitespace); - d->m_page->displayFoldingMarkers->setChecked(displaySettings.m_displayFoldingMarkers); - d->m_page->highlightCurrentLine->setChecked(displaySettings.m_highlightCurrentLine); - d->m_page->highlightBlocks->setChecked(displaySettings.m_highlightBlocks); - d->m_page->animateMatchingParentheses->setChecked(displaySettings.m_animateMatchingParentheses); - d->m_page->highlightMatchingParentheses->setChecked(displaySettings.m_highlightMatchingParentheses); - d->m_page->markTextChanges->setChecked(displaySettings.m_markTextChanges); - d->m_page->autoFoldFirstComment->setChecked(displaySettings.m_autoFoldFirstComment); - d->m_page->centerOnScroll->setChecked(displaySettings.m_centerCursorOnScroll); - d->m_page->openLinksInNextSplit->setChecked(displaySettings.m_openLinksInNextSplit); - d->m_page->displayFileEncoding->setChecked(displaySettings.m_displayFileEncoding); - d->m_page->scrollBarHighlights->setChecked(displaySettings.m_scrollBarHighlights); - d->m_page->animateNavigationWithinFile->setChecked(displaySettings.m_animateNavigationWithinFile); - d->m_page->displayAnnotations->setChecked(displaySettings.m_displayAnnotations); + const DisplaySettings &displaySettings = m_data->m_displaySettings; + const MarginSettings &marginSettings = m_data->m_marginSettings; + m_ui.displayLineNumbers->setChecked(displaySettings.m_displayLineNumbers); + m_ui.enableTextWrapping->setChecked(displaySettings.m_textWrapping); + m_ui.showWrapColumn->setChecked(marginSettings.m_showMargin); + m_ui.wrapColumn->setValue(marginSettings.m_marginColumn); + m_ui.visualizeWhitespace->setChecked(displaySettings.m_visualizeWhitespace); + m_ui.displayFoldingMarkers->setChecked(displaySettings.m_displayFoldingMarkers); + m_ui.highlightCurrentLine->setChecked(displaySettings.m_highlightCurrentLine); + m_ui.highlightBlocks->setChecked(displaySettings.m_highlightBlocks); + m_ui.animateMatchingParentheses->setChecked(displaySettings.m_animateMatchingParentheses); + m_ui.highlightMatchingParentheses->setChecked(displaySettings.m_highlightMatchingParentheses); + m_ui.markTextChanges->setChecked(displaySettings.m_markTextChanges); + m_ui.autoFoldFirstComment->setChecked(displaySettings.m_autoFoldFirstComment); + m_ui.centerOnScroll->setChecked(displaySettings.m_centerCursorOnScroll); + m_ui.openLinksInNextSplit->setChecked(displaySettings.m_openLinksInNextSplit); + m_ui.displayFileEncoding->setChecked(displaySettings.m_displayFileEncoding); + m_ui.scrollBarHighlights->setChecked(displaySettings.m_scrollBarHighlights); + m_ui.animateNavigationWithinFile->setChecked(displaySettings.m_animateNavigationWithinFile); + m_ui.displayAnnotations->setChecked(displaySettings.m_displayAnnotations); switch (displaySettings.m_annotationAlignment) { - case AnnotationAlignment::NextToContent: d->m_page->leftAligned->setChecked(true); break; - case AnnotationAlignment::NextToMargin: d->m_page->atMargin->setChecked(true); break; - case AnnotationAlignment::RightSide: d->m_page->rightAligned->setChecked(true); break; - case AnnotationAlignment::BetweenLines: d->m_page->betweenLines->setChecked(true); break; + case AnnotationAlignment::NextToContent: m_ui.leftAligned->setChecked(true); break; + case AnnotationAlignment::NextToMargin: m_ui.atMargin->setChecked(true); break; + case AnnotationAlignment::RightSide: m_ui.rightAligned->setChecked(true); break; + case AnnotationAlignment::BetweenLines: m_ui.betweenLines->setChecked(true); break; } } @@ -172,22 +154,38 @@ const MarginSettings &DisplaySettingsPage::marginSettings() const return d->m_marginSettings; } -void DisplaySettingsPage::setDisplaySettings(const DisplaySettings &newDisplaySettings, - const MarginSettings &newMarginSettings) +void DisplaySettingsWidget::setDisplaySettings(const DisplaySettings &newDisplaySettings, + const MarginSettings &newMarginSettings) { - if (newDisplaySettings != d->m_displaySettings) { - d->m_displaySettings = newDisplaySettings; - d->m_displaySettings.toSettings(d->m_settingsPrefix, Core::ICore::settings()); + if (newDisplaySettings != m_data->m_displaySettings) { + m_data->m_displaySettings = newDisplaySettings; + m_data->m_displaySettings.toSettings(m_data->m_settingsPrefix, Core::ICore::settings()); emit TextEditorSettings::instance()->displaySettingsChanged(newDisplaySettings); } - if (newMarginSettings != d->m_marginSettings) { - d->m_marginSettings = newMarginSettings; - d->m_marginSettings.toSettings(d->m_settingsPrefix, Core::ICore::settings()); + if (newMarginSettings != m_data->m_marginSettings) { + m_data->m_marginSettings = newMarginSettings; + m_data->m_marginSettings.toSettings(m_data->m_settingsPrefix, Core::ICore::settings()); emit TextEditorSettings::instance()->marginSettingsChanged(newMarginSettings); } } +DisplaySettingsPage::DisplaySettingsPage() + : d(new DisplaySettingsPagePrivate) +{ + setId(Constants::TEXT_EDITOR_DISPLAY_SETTINGS); + setDisplayName(DisplaySettingsWidget::tr("Display")); + setCategory(TextEditor::Constants::TEXT_EDITOR_SETTINGS_CATEGORY); + setDisplayCategory(QCoreApplication::translate("TextEditor", "Text Editor")); + setCategoryIconPath(TextEditor::Constants::TEXT_EDITOR_SETTINGS_CATEGORY_ICON_PATH); + setWidgetCreator([this] { return new DisplaySettingsWidget(d); }); +} + +DisplaySettingsPage::~DisplaySettingsPage() +{ + delete d; +} + } // TextEditor diff --git a/src/plugins/texteditor/displaysettingspage.h b/src/plugins/texteditor/displaysettingspage.h index 7c1f91c4bc9..144cfe76c73 100644 --- a/src/plugins/texteditor/displaysettingspage.h +++ b/src/plugins/texteditor/displaysettingspage.h @@ -25,37 +25,24 @@ #pragma once -#include "texteditor_global.h" - #include namespace TextEditor { class DisplaySettings; class MarginSettings; +class DisplaySettingsPagePrivate; class DisplaySettingsPage : public Core::IOptionsPage { - Q_OBJECT - public: DisplaySettingsPage(); ~DisplaySettingsPage() override; - // IOptionsPage - QWidget *widget() override; - void apply() override; - void finish() override; - const DisplaySettings &displaySettings() const; const MarginSettings &marginSettings() const; private: - void settingsFromUI(DisplaySettings &displaySettings, MarginSettings &marginSettings) const; - void settingsToUI(); - void setDisplaySettings(const DisplaySettings &, const MarginSettings &newMarginSettings); - - struct DisplaySettingsPagePrivate; DisplaySettingsPagePrivate *d; }; diff --git a/src/plugins/texteditor/plaintexteditorfactory.h b/src/plugins/texteditor/plaintexteditorfactory.h index 38b0194895c..40f637b8569 100644 --- a/src/plugins/texteditor/plaintexteditorfactory.h +++ b/src/plugins/texteditor/plaintexteditorfactory.h @@ -31,8 +31,6 @@ namespace TextEditor { class TEXTEDITOR_EXPORT PlainTextEditorFactory : public TextEditor::TextEditorFactory { - Q_OBJECT - public: PlainTextEditorFactory(); static PlainTextEditorFactory *instance(); diff --git a/src/plugins/texteditor/texteditor.h b/src/plugins/texteditor/texteditor.h index 403d2f2b6f5..9421fc2cf54 100644 --- a/src/plugins/texteditor/texteditor.h +++ b/src/plugins/texteditor/texteditor.h @@ -634,7 +634,6 @@ private: class TEXTEDITOR_EXPORT TextEditorFactory : public Core::IEditorFactory { - Q_OBJECT public: TextEditorFactory(); diff --git a/src/plugins/vcsbase/vcsbaseclient.cpp b/src/plugins/vcsbase/vcsbaseclient.cpp index 40e5cd85641..cfffd2003ba 100644 --- a/src/plugins/vcsbase/vcsbaseclient.cpp +++ b/src/plugins/vcsbase/vcsbaseclient.cpp @@ -252,10 +252,6 @@ void VcsBaseClientImpl::saveSettings() settings().writeSettings(Core::ICore::settings()); } -VcsBaseClient::StatusItem::StatusItem(const QString &s, const QString &f) : - flags(s), file(f) -{ } - VcsBaseClient::VcsBaseClient(VcsBaseClientSettings *settings) : VcsBaseClientImpl(settings) { diff --git a/src/plugins/vcsbase/vcsbaseclient.h b/src/plugins/vcsbase/vcsbaseclient.h index de2db735491..3f2f9b13d59 100644 --- a/src/plugins/vcsbase/vcsbaseclient.h +++ b/src/plugins/vcsbase/vcsbaseclient.h @@ -140,7 +140,6 @@ public: { public: StatusItem() = default; - StatusItem(const QString &s, const QString &f); QString flags; QString file; }; diff --git a/tests/auto/extensionsystem/pluginmanager/correctplugins1/plugin1/plugin1.cpp b/tests/auto/extensionsystem/pluginmanager/correctplugins1/plugin1/plugin1.cpp index 0bb1fc88429..c0ab11a9605 100644 --- a/tests/auto/extensionsystem/pluginmanager/correctplugins1/plugin1/plugin1.cpp +++ b/tests/auto/extensionsystem/pluginmanager/correctplugins1/plugin1/plugin1.cpp @@ -44,7 +44,7 @@ bool MyPlugin1::initialize(const QStringList & /*arguments*/, QString *errorStri bool found2 = false; bool found3 = false; - foreach (QObject *object, ExtensionSystem::PluginManager::allObjects()) { + for (QObject *object : ExtensionSystem::PluginManager::allObjects()) { if (object->objectName() == QLatin1String("MyPlugin2")) found2 = true; else if (object->objectName() == QLatin1String("MyPlugin3")) diff --git a/tests/auto/extensionsystem/pluginmanager/correctplugins1/plugin3/plugin3.cpp b/tests/auto/extensionsystem/pluginmanager/correctplugins1/plugin3/plugin3.cpp index a75ee58241e..76701ccbfe0 100644 --- a/tests/auto/extensionsystem/pluginmanager/correctplugins1/plugin3/plugin3.cpp +++ b/tests/auto/extensionsystem/pluginmanager/correctplugins1/plugin3/plugin3.cpp @@ -43,7 +43,7 @@ bool MyPlugin3::initialize(const QStringList & /*arguments*/, QString *errorStri ExtensionSystem::PluginManager::addObject(object1); bool found2 = false; - foreach (QObject *object, ExtensionSystem::PluginManager::allObjects()) { + for (QObject *object : ExtensionSystem::PluginManager::allObjects()) { if (object->objectName() == QLatin1String("MyPlugin2")) found2 = true; }