forked from qt-creator/qt-creator
Beautifier: Minor cleanup
* Use initializer list and Utils::transform * Remove unneeded override Change-Id: I36ff9b9900fa6169ed1529bbbbdba13075353332 Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
committed by
Orgad Shaneh
parent
6b0d9f7047
commit
e49ccd0747
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user