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()
|
void BeautifierPlugin::extensionsInitialized()
|
||||||
{
|
{
|
||||||
m_tools << new ArtisticStyle::ArtisticStyle(this);
|
m_tools = {
|
||||||
m_tools << new ClangFormat::ClangFormat(this);
|
new ArtisticStyle::ArtisticStyle(this),
|
||||||
m_tools << new Uncrustify::Uncrustify(this);
|
new ClangFormat::ClangFormat(this),
|
||||||
|
new Uncrustify::Uncrustify(this)
|
||||||
|
};
|
||||||
|
|
||||||
QStringList toolIds;
|
QStringList toolIds;
|
||||||
toolIds.reserve(m_tools.count());
|
toolIds.reserve(m_tools.count());
|
||||||
@@ -228,11 +230,6 @@ void BeautifierPlugin::extensionsInitialized()
|
|||||||
this, &BeautifierPlugin::autoFormatOnSave);
|
this, &BeautifierPlugin::autoFormatOnSave);
|
||||||
}
|
}
|
||||||
|
|
||||||
ExtensionSystem::IPlugin::ShutdownFlag BeautifierPlugin::aboutToShutdown()
|
|
||||||
{
|
|
||||||
return SynchronousShutdown;
|
|
||||||
}
|
|
||||||
|
|
||||||
void BeautifierPlugin::updateActions(Core::IEditor *editor)
|
void BeautifierPlugin::updateActions(Core::IEditor *editor)
|
||||||
{
|
{
|
||||||
for (BeautifierAbstractTool *tool : m_tools)
|
for (BeautifierAbstractTool *tool : m_tools)
|
||||||
|
|||||||
@@ -74,7 +74,6 @@ class BeautifierPlugin : public ExtensionSystem::IPlugin
|
|||||||
public:
|
public:
|
||||||
bool initialize(const QStringList &arguments, QString *errorString) override;
|
bool initialize(const QStringList &arguments, QString *errorString) override;
|
||||||
void extensionsInitialized() override;
|
void extensionsInitialized() override;
|
||||||
ShutdownFlag aboutToShutdown() override;
|
|
||||||
|
|
||||||
void formatCurrentFile(const Command &command, int startPos = -1, int endPos = 0);
|
void formatCurrentFile(const Command &command, int startPos = -1, int endPos = 0);
|
||||||
|
|
||||||
|
|||||||
@@ -28,6 +28,7 @@
|
|||||||
#include "beautifierconstants.h"
|
#include "beautifierconstants.h"
|
||||||
|
|
||||||
#include <coreplugin/icore.h>
|
#include <coreplugin/icore.h>
|
||||||
|
#include <utils/algorithm.h>
|
||||||
#include <utils/mimetypes/mimedatabase.h>
|
#include <utils/mimetypes/mimedatabase.h>
|
||||||
|
|
||||||
namespace Beautifier {
|
namespace Beautifier {
|
||||||
@@ -99,11 +100,7 @@ QList<Utils::MimeType> GeneralSettings::autoFormatMime() const
|
|||||||
|
|
||||||
QString GeneralSettings::autoFormatMimeAsString() const
|
QString GeneralSettings::autoFormatMimeAsString() const
|
||||||
{
|
{
|
||||||
QStringList types;
|
return Utils::transform(m_autoFormatMime, &Utils::MimeType::name).join("; ");
|
||||||
types.reserve(m_autoFormatMime.count());
|
|
||||||
for (auto t : m_autoFormatMime)
|
|
||||||
types << t.name();
|
|
||||||
return types.join("; ");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GeneralSettings::setAutoFormatMime(const QList<Utils::MimeType> &autoFormatMime)
|
void GeneralSettings::setAutoFormatMime(const QList<Utils::MimeType> &autoFormatMime)
|
||||||
|
|||||||
Reference in New Issue
Block a user