Commit e49ccd07 authored by Orgad Shaneh's avatar Orgad Shaneh Committed by Orgad Shaneh

Beautifier: Minor cleanup

* Use initializer list and Utils::transform
* Remove unneeded override

Change-Id: I36ff9b9900fa6169ed1529bbbbdba13075353332
Reviewed-by: Eike Ziller's avatarEike Ziller <eike.ziller@qt.io>
parent 6b0d9f70
......@@ -201,9 +201,11 @@ bool BeautifierPlugin::initialize(const QStringList &arguments, QString *errorSt
void BeautifierPlugin::extensionsInitialized()
{
m_tools << new ArtisticStyle::ArtisticStyle(this);
m_tools << new ClangFormat::ClangFormat(this);
m_tools << new Uncrustify::Uncrustify(this);
m_tools = {
new ArtisticStyle::ArtisticStyle(this),
new ClangFormat::ClangFormat(this),
new Uncrustify::Uncrustify(this)
};
QStringList toolIds;
toolIds.reserve(m_tools.count());
......@@ -228,11 +230,6 @@ void BeautifierPlugin::extensionsInitialized()
this, &BeautifierPlugin::autoFormatOnSave);
}
ExtensionSystem::IPlugin::ShutdownFlag BeautifierPlugin::aboutToShutdown()
{
return SynchronousShutdown;
}
void BeautifierPlugin::updateActions(Core::IEditor *editor)
{
for (BeautifierAbstractTool *tool : m_tools)
......
......@@ -74,7 +74,6 @@ class BeautifierPlugin : public ExtensionSystem::IPlugin
public:
bool initialize(const QStringList &arguments, QString *errorString) override;
void extensionsInitialized() override;
ShutdownFlag aboutToShutdown() override;
void formatCurrentFile(const Command &command, int startPos = -1, int endPos = 0);
......
......@@ -28,6 +28,7 @@
#include "beautifierconstants.h"
#include <coreplugin/icore.h>
#include <utils/algorithm.h>
#include <utils/mimetypes/mimedatabase.h>
namespace Beautifier {
......@@ -99,11 +100,7 @@ QList<Utils::MimeType> GeneralSettings::autoFormatMime() const
QString GeneralSettings::autoFormatMimeAsString() const
{
QStringList types;
types.reserve(m_autoFormatMime.count());
for (auto t : m_autoFormatMime)
types << t.name();
return types.join("; ");
return Utils::transform(m_autoFormatMime, &Utils::MimeType::name).join("; ");
}
void GeneralSettings::setAutoFormatMime(const QList<Utils::MimeType> &autoFormatMime)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment