forked from qt-creator/qt-creator
Beautifier: Format current file asynchronous
The formatting tool is now called asynchronous. Change-Id: I0415611655a584ba0275f4bccd065ea1182f83dc Reviewed-by: David Schulz <david.schulz@digia.com>
This commit is contained in:
@@ -59,8 +59,9 @@ namespace Beautifier {
|
|||||||
namespace Internal {
|
namespace Internal {
|
||||||
namespace ArtisticStyle {
|
namespace ArtisticStyle {
|
||||||
|
|
||||||
ArtisticStyle::ArtisticStyle(QObject *parent) :
|
ArtisticStyle::ArtisticStyle(BeautifierPlugin *parent) :
|
||||||
BeautifierAbstractTool(parent),
|
BeautifierAbstractTool(parent),
|
||||||
|
m_beautifierPlugin(parent),
|
||||||
m_settings(new ArtisticStyleSettings)
|
m_settings(new ArtisticStyleSettings)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@@ -151,7 +152,7 @@ void ArtisticStyle::formatFile()
|
|||||||
command.addOption(QLatin1String("%file"));
|
command.addOption(QLatin1String("%file"));
|
||||||
}
|
}
|
||||||
|
|
||||||
BeautifierPlugin::formatCurrentFile(command);
|
m_beautifierPlugin->formatCurrentFile(command);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -38,6 +38,9 @@ QT_FORWARD_DECLARE_CLASS(QAction)
|
|||||||
|
|
||||||
namespace Beautifier {
|
namespace Beautifier {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
|
class BeautifierPlugin;
|
||||||
|
|
||||||
namespace ArtisticStyle {
|
namespace ArtisticStyle {
|
||||||
|
|
||||||
class ArtisticStyleSettings;
|
class ArtisticStyleSettings;
|
||||||
@@ -47,7 +50,7 @@ class ArtisticStyle : public BeautifierAbstractTool
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit ArtisticStyle(QObject *parent = 0);
|
explicit ArtisticStyle(BeautifierPlugin *parent = 0);
|
||||||
virtual ~ArtisticStyle();
|
virtual ~ArtisticStyle();
|
||||||
bool initialize() QTC_OVERRIDE;
|
bool initialize() QTC_OVERRIDE;
|
||||||
void updateActions(Core::IEditor *editor) QTC_OVERRIDE;
|
void updateActions(Core::IEditor *editor) QTC_OVERRIDE;
|
||||||
@@ -57,6 +60,7 @@ private slots:
|
|||||||
void formatFile();
|
void formatFile();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
BeautifierPlugin *m_beautifierPlugin;
|
||||||
QAction *m_formatFile;
|
QAction *m_formatFile;
|
||||||
ArtisticStyleSettings *m_settings;
|
ArtisticStyleSettings *m_settings;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -30,7 +30,6 @@
|
|||||||
#include "beautifierplugin.h"
|
#include "beautifierplugin.h"
|
||||||
|
|
||||||
#include "beautifierconstants.h"
|
#include "beautifierconstants.h"
|
||||||
#include "command.h"
|
|
||||||
|
|
||||||
#include "artisticstyle/artisticstyle.h"
|
#include "artisticstyle/artisticstyle.h"
|
||||||
#include "clangformat/clangformat.h"
|
#include "clangformat/clangformat.h"
|
||||||
@@ -51,10 +50,12 @@
|
|||||||
#include <texteditor/basetexteditor.h>
|
#include <texteditor/basetexteditor.h>
|
||||||
#include <texteditor/texteditorconstants.h>
|
#include <texteditor/texteditorconstants.h>
|
||||||
#include <utils/fileutils.h>
|
#include <utils/fileutils.h>
|
||||||
|
#include <utils/QtConcurrentTools>
|
||||||
|
|
||||||
#include <QAction>
|
#include <QAction>
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QFileInfo>
|
#include <QFileInfo>
|
||||||
|
#include <QFutureWatcher>
|
||||||
#include <QPlainTextEdit>
|
#include <QPlainTextEdit>
|
||||||
#include <QProcess>
|
#include <QProcess>
|
||||||
#include <QScrollBar>
|
#include <QScrollBar>
|
||||||
@@ -65,12 +66,17 @@
|
|||||||
namespace Beautifier {
|
namespace Beautifier {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
BeautifierPlugin::BeautifierPlugin()
|
BeautifierPlugin::BeautifierPlugin() :
|
||||||
|
m_asyncFormatMapper(new QSignalMapper)
|
||||||
{
|
{
|
||||||
|
connect(m_asyncFormatMapper, SIGNAL(mapped(QObject *)),
|
||||||
|
this, SLOT(formatCurrentFileContinue(QObject*)));
|
||||||
|
connect(this, SIGNAL(pipeError(QString)), this, SLOT(showError(QString)));
|
||||||
}
|
}
|
||||||
|
|
||||||
BeautifierPlugin::~BeautifierPlugin()
|
BeautifierPlugin::~BeautifierPlugin()
|
||||||
{
|
{
|
||||||
|
m_asyncFormatMapper->deleteLater();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BeautifierPlugin::initialize(const QStringList &arguments, QString *errorString)
|
bool BeautifierPlugin::initialize(const QStringList &arguments, QString *errorString)
|
||||||
@@ -119,7 +125,9 @@ void BeautifierPlugin::updateActions(Core::IEditor *editor)
|
|||||||
m_tools.at(i)->updateActions(editor);
|
m_tools.at(i)->updateActions(editor);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString BeautifierPlugin::format(const QString &text, const Command &command, const QString &fileName)
|
// Use pipeError() instead of calling showError() because this function may run in another thread.
|
||||||
|
QString BeautifierPlugin::format(const QString &text, const Command &command,
|
||||||
|
const QString &fileName, bool *timeout)
|
||||||
{
|
{
|
||||||
const QString executable = command.executable();
|
const QString executable = command.executable();
|
||||||
if (executable.isEmpty())
|
if (executable.isEmpty())
|
||||||
@@ -134,7 +142,7 @@ QString BeautifierPlugin::format(const QString &text, const Command &command, co
|
|||||||
sourceFile.setAutoRemove(true);
|
sourceFile.setAutoRemove(true);
|
||||||
sourceFile.write(text.toUtf8());
|
sourceFile.write(text.toUtf8());
|
||||||
if (!sourceFile.finalize()) {
|
if (!sourceFile.finalize()) {
|
||||||
showError(tr("Cannot create temporary file \"%1\": %2.")
|
emit pipeError(tr("Cannot create temporary file \"%1\": %2.")
|
||||||
.arg(sourceFile.fileName()).arg(sourceFile.errorString()));
|
.arg(sourceFile.fileName()).arg(sourceFile.errorString()));
|
||||||
return QString();
|
return QString();
|
||||||
}
|
}
|
||||||
@@ -144,18 +152,21 @@ QString BeautifierPlugin::format(const QString &text, const Command &command, co
|
|||||||
QStringList options = command.options();
|
QStringList options = command.options();
|
||||||
options.replaceInStrings(QLatin1String("%file"), sourceFile.fileName());
|
options.replaceInStrings(QLatin1String("%file"), sourceFile.fileName());
|
||||||
process.start(executable, options);
|
process.start(executable, options);
|
||||||
if (!process.waitForFinished()) {
|
if (!process.waitForFinished(5000)) {
|
||||||
showError(tr("Cannot call %1 or some other error occurred.").arg(executable));
|
if (timeout)
|
||||||
|
*timeout = true;
|
||||||
|
process.kill();
|
||||||
|
emit pipeError(tr("Cannot call %1 or some other error occurred.").arg(executable));
|
||||||
return QString();
|
return QString();
|
||||||
}
|
}
|
||||||
const QByteArray output = process.readAllStandardError();
|
const QByteArray output = process.readAllStandardError();
|
||||||
if (!output.isEmpty())
|
if (!output.isEmpty())
|
||||||
showError(executable + QLatin1String(": ") + QString::fromUtf8(output));
|
emit pipeError(executable + QLatin1String(": ") + QString::fromUtf8(output));
|
||||||
|
|
||||||
// Read text back
|
// Read text back
|
||||||
Utils::FileReader reader;
|
Utils::FileReader reader;
|
||||||
if (!reader.fetch(sourceFile.fileName(), QIODevice::Text)) {
|
if (!reader.fetch(sourceFile.fileName(), QIODevice::Text)) {
|
||||||
showError(tr("Cannot read file \"%1\": %2.")
|
emit pipeError(tr("Cannot read file \"%1\": %2.")
|
||||||
.arg(sourceFile.fileName()).arg(reader.errorString()));
|
.arg(sourceFile.fileName()).arg(reader.errorString()));
|
||||||
return QString();
|
return QString();
|
||||||
}
|
}
|
||||||
@@ -167,19 +178,23 @@ QString BeautifierPlugin::format(const QString &text, const Command &command, co
|
|||||||
QStringList options = command.options();
|
QStringList options = command.options();
|
||||||
options.replaceInStrings(QLatin1String("%file"), fileName);
|
options.replaceInStrings(QLatin1String("%file"), fileName);
|
||||||
process.start(executable, options);
|
process.start(executable, options);
|
||||||
if (!process.waitForStarted()) {
|
if (!process.waitForStarted(3000)) {
|
||||||
showError(tr("Cannot call %1 or some other error occurred.").arg(executable));
|
emit pipeError(tr("Cannot call %1 or some other error occurred.").arg(executable));
|
||||||
return QString();
|
return QString();
|
||||||
}
|
}
|
||||||
process.write(text.toUtf8());
|
process.write(text.toUtf8());
|
||||||
process.closeWriteChannel();
|
process.closeWriteChannel();
|
||||||
if (!process.waitForFinished()) {
|
if (!process.waitForFinished(5000)) {
|
||||||
showError(tr("Cannot call %1 or some other error occurred.").arg(executable));
|
if (timeout)
|
||||||
|
*timeout = true;
|
||||||
|
process.kill();
|
||||||
|
emit pipeError(tr("Cannot call %1 or some other error occurred.").arg(executable));
|
||||||
return QString();
|
return QString();
|
||||||
}
|
}
|
||||||
const QByteArray error = process.readAllStandardError();
|
const QByteArray errorText = process.readAllStandardError();
|
||||||
if (!error.isEmpty()) {
|
if (!errorText.isEmpty()) {
|
||||||
showError(executable + QLatin1String(": ") + QString::fromUtf8(error));
|
emit pipeError(QString::fromLatin1("%1: %2").arg(executable)
|
||||||
|
.arg(QString::fromUtf8(errorText)));
|
||||||
return QString();
|
return QString();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -198,9 +213,12 @@ QString BeautifierPlugin::format(const QString &text, const Command &command, co
|
|||||||
void BeautifierPlugin::formatCurrentFile(const Command &command)
|
void BeautifierPlugin::formatCurrentFile(const Command &command)
|
||||||
{
|
{
|
||||||
QPlainTextEdit *textEditor = 0;
|
QPlainTextEdit *textEditor = 0;
|
||||||
|
QString filePath;
|
||||||
if (TextEditor::BaseTextEditor *editor
|
if (TextEditor::BaseTextEditor *editor
|
||||||
= qobject_cast<TextEditor::BaseTextEditor *>(Core::EditorManager::currentEditor()))
|
= qobject_cast<TextEditor::BaseTextEditor *>(Core::EditorManager::currentEditor())) {
|
||||||
textEditor = qobject_cast<QPlainTextEdit *>(editor->editorWidget());
|
textEditor = qobject_cast<QPlainTextEdit *>(editor->editorWidget());
|
||||||
|
filePath = editor->document()->filePath();
|
||||||
|
}
|
||||||
if (!textEditor)
|
if (!textEditor)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -208,8 +226,51 @@ void BeautifierPlugin::formatCurrentFile(const Command &command)
|
|||||||
if (sourceData.isEmpty())
|
if (sourceData.isEmpty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const QString formattedData = format(sourceData, command,
|
QFutureWatcher<FormatTask> *watcher = new QFutureWatcher<FormatTask>;
|
||||||
Core::EditorManager::currentDocument()->filePath());
|
connect(textEditor->document(), SIGNAL(contentsChanged()), watcher, SLOT(cancel()));
|
||||||
|
connect(watcher, SIGNAL(finished()), m_asyncFormatMapper, SLOT(map()));
|
||||||
|
m_asyncFormatMapper->setMapping(watcher, watcher);
|
||||||
|
watcher->setFuture(QtConcurrent::run(&BeautifierPlugin::formatAsync, this,
|
||||||
|
FormatTask(textEditor, filePath, sourceData, command)));
|
||||||
|
}
|
||||||
|
|
||||||
|
void BeautifierPlugin::formatAsync(QFutureInterface<FormatTask> &future, FormatTask task)
|
||||||
|
{
|
||||||
|
task.formattedData = format(task.sourceData, task.command, task.filePath, &task.timeout);
|
||||||
|
future.reportResult(task);
|
||||||
|
}
|
||||||
|
|
||||||
|
void BeautifierPlugin::formatCurrentFileContinue(QObject *watcher)
|
||||||
|
{
|
||||||
|
QFutureWatcher<FormatTask> *futureWatcher = static_cast<QFutureWatcher<FormatTask>*>(watcher);
|
||||||
|
if (!futureWatcher) {
|
||||||
|
if (watcher)
|
||||||
|
watcher->deleteLater();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (futureWatcher->isCanceled()) {
|
||||||
|
showError(tr("File was modified."));
|
||||||
|
futureWatcher->deleteLater();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const FormatTask task = futureWatcher->result();
|
||||||
|
futureWatcher->deleteLater();
|
||||||
|
|
||||||
|
if (task.timeout) {
|
||||||
|
showError(tr("Time out reached while formatting file %1.").arg(task.filePath));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
QPlainTextEdit *textEditor = task.editor;
|
||||||
|
if (!textEditor) {
|
||||||
|
showError(tr("File %1 was closed.").arg(task.filePath));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const QString sourceData = textEditor->toPlainText();
|
||||||
|
const QString formattedData = task.formattedData;
|
||||||
if ((sourceData == formattedData) || formattedData.isEmpty())
|
if ((sourceData == formattedData) || formattedData.isEmpty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|||||||
@@ -30,16 +30,39 @@
|
|||||||
#ifndef BEAUTIFIER_BEAUTIFIER_H
|
#ifndef BEAUTIFIER_BEAUTIFIER_H
|
||||||
#define BEAUTIFIER_BEAUTIFIER_H
|
#define BEAUTIFIER_BEAUTIFIER_H
|
||||||
|
|
||||||
|
#include "command.h"
|
||||||
|
|
||||||
#include <extensionsystem/iplugin.h>
|
#include <extensionsystem/iplugin.h>
|
||||||
#include <utils/qtcoverride.h>
|
#include <utils/qtcoverride.h>
|
||||||
|
|
||||||
|
#include <QFutureInterface>
|
||||||
|
#include <QPlainTextEdit>
|
||||||
|
#include <QSignalMapper>
|
||||||
|
|
||||||
namespace Core { class IEditor; }
|
namespace Core { class IEditor; }
|
||||||
|
|
||||||
namespace Beautifier {
|
namespace Beautifier {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
class BeautifierAbstractTool;
|
class BeautifierAbstractTool;
|
||||||
class Command;
|
|
||||||
|
struct FormatTask
|
||||||
|
{
|
||||||
|
FormatTask(QPlainTextEdit *_editor, const QString &_filePath, const QString &_sourceData,
|
||||||
|
const Command &_command) :
|
||||||
|
editor(_editor),
|
||||||
|
filePath(_filePath),
|
||||||
|
sourceData(_sourceData),
|
||||||
|
command(_command),
|
||||||
|
timeout(false) {}
|
||||||
|
|
||||||
|
QPointer<QPlainTextEdit> editor;
|
||||||
|
QString filePath;
|
||||||
|
QString sourceData;
|
||||||
|
Command command;
|
||||||
|
QString formattedData;
|
||||||
|
bool timeout;
|
||||||
|
};
|
||||||
|
|
||||||
class BeautifierPlugin : public ExtensionSystem::IPlugin
|
class BeautifierPlugin : public ExtensionSystem::IPlugin
|
||||||
{
|
{
|
||||||
@@ -53,20 +76,29 @@ public:
|
|||||||
void extensionsInitialized() QTC_OVERRIDE;
|
void extensionsInitialized() QTC_OVERRIDE;
|
||||||
ShutdownFlag aboutToShutdown() QTC_OVERRIDE;
|
ShutdownFlag aboutToShutdown() QTC_OVERRIDE;
|
||||||
|
|
||||||
static QString format(const QString &text, const Command &command, const QString &fileName);
|
QString format(const QString &text, const Command &command, const QString &fileName,
|
||||||
static void formatCurrentFile(const Command &command);
|
bool *timeout = 0);
|
||||||
static void showError(const QString &error);
|
void formatCurrentFile(const Command &command);
|
||||||
|
void formatAsync(QFutureInterface<FormatTask> &future, FormatTask task);
|
||||||
|
|
||||||
static QString msgCannotGetConfigurationFile(const QString &command);
|
static QString msgCannotGetConfigurationFile(const QString &command);
|
||||||
static QString msgFormatCurrentFile();
|
static QString msgFormatCurrentFile();
|
||||||
static QString msgFormatSelectedText();
|
static QString msgFormatSelectedText();
|
||||||
static QString msgCommandPromptDialogTitle(const QString &command);
|
static QString msgCommandPromptDialogTitle(const QString &command);
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
static void showError(const QString &error);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void updateActions(Core::IEditor *editor = 0);
|
void updateActions(Core::IEditor *editor = 0);
|
||||||
|
void formatCurrentFileContinue(QObject *watcher = 0);
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void pipeError(QString);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QList<BeautifierAbstractTool *> m_tools;
|
QList<BeautifierAbstractTool *> m_tools;
|
||||||
|
QSignalMapper *m_asyncFormatMapper;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
|||||||
@@ -56,8 +56,9 @@ namespace Beautifier {
|
|||||||
namespace Internal {
|
namespace Internal {
|
||||||
namespace ClangFormat {
|
namespace ClangFormat {
|
||||||
|
|
||||||
ClangFormat::ClangFormat(QObject *parent) :
|
ClangFormat::ClangFormat(BeautifierPlugin *parent) :
|
||||||
BeautifierAbstractTool(parent),
|
BeautifierAbstractTool(parent),
|
||||||
|
m_beautifierPlugin(parent),
|
||||||
m_settings(new ClangFormatSettings)
|
m_settings(new ClangFormatSettings)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@@ -107,7 +108,7 @@ QList<QObject *> ClangFormat::autoReleaseObjects()
|
|||||||
|
|
||||||
void ClangFormat::formatFile()
|
void ClangFormat::formatFile()
|
||||||
{
|
{
|
||||||
BeautifierPlugin::formatCurrentFile(command());
|
m_beautifierPlugin->formatCurrentFile(command());
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClangFormat::formatSelectedText()
|
void ClangFormat::formatSelectedText()
|
||||||
@@ -121,7 +122,7 @@ void ClangFormat::formatSelectedText()
|
|||||||
if (tc.hasSelection()) {
|
if (tc.hasSelection()) {
|
||||||
const int offset = tc.selectionStart();
|
const int offset = tc.selectionStart();
|
||||||
const int length = tc.selectionEnd() - offset;
|
const int length = tc.selectionEnd() - offset;
|
||||||
BeautifierPlugin::formatCurrentFile(command(offset, length));
|
m_beautifierPlugin->formatCurrentFile(command(offset, length));
|
||||||
} else if (m_settings->formatEntireFileFallback()) {
|
} else if (m_settings->formatEntireFileFallback()) {
|
||||||
formatFile();
|
formatFile();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,6 +39,9 @@ QT_FORWARD_DECLARE_CLASS(QAction)
|
|||||||
|
|
||||||
namespace Beautifier {
|
namespace Beautifier {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
|
class BeautifierPlugin;
|
||||||
|
|
||||||
namespace ClangFormat {
|
namespace ClangFormat {
|
||||||
|
|
||||||
class ClangFormatSettings;
|
class ClangFormatSettings;
|
||||||
@@ -48,7 +51,7 @@ class ClangFormat : public BeautifierAbstractTool
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit ClangFormat(QObject *parent = 0);
|
explicit ClangFormat(BeautifierPlugin *parent = 0);
|
||||||
virtual ~ClangFormat();
|
virtual ~ClangFormat();
|
||||||
bool initialize() QTC_OVERRIDE;
|
bool initialize() QTC_OVERRIDE;
|
||||||
void updateActions(Core::IEditor *editor) QTC_OVERRIDE;
|
void updateActions(Core::IEditor *editor) QTC_OVERRIDE;
|
||||||
@@ -59,6 +62,7 @@ private slots:
|
|||||||
void formatSelectedText();
|
void formatSelectedText();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
BeautifierPlugin *m_beautifierPlugin;
|
||||||
QAction *m_formatFile;
|
QAction *m_formatFile;
|
||||||
QAction *m_formatRange;
|
QAction *m_formatRange;
|
||||||
ClangFormatSettings *m_settings;
|
ClangFormatSettings *m_settings;
|
||||||
|
|||||||
@@ -59,8 +59,9 @@ namespace Beautifier {
|
|||||||
namespace Internal {
|
namespace Internal {
|
||||||
namespace Uncrustify {
|
namespace Uncrustify {
|
||||||
|
|
||||||
Uncrustify::Uncrustify(QObject *parent) :
|
Uncrustify::Uncrustify(BeautifierPlugin *parent) :
|
||||||
BeautifierAbstractTool(parent),
|
BeautifierAbstractTool(parent),
|
||||||
|
m_beautifierPlugin(parent),
|
||||||
m_settings(new UncrustifySettings)
|
m_settings(new UncrustifySettings)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@@ -142,7 +143,7 @@ void Uncrustify::formatFile()
|
|||||||
command.addOption(QLatin1String("1-2"));
|
command.addOption(QLatin1String("1-2"));
|
||||||
command.addOption(QLatin1String("-c"));
|
command.addOption(QLatin1String("-c"));
|
||||||
command.addOption(cfgFileName);
|
command.addOption(cfgFileName);
|
||||||
BeautifierPlugin::formatCurrentFile(command);
|
m_beautifierPlugin->formatCurrentFile(command);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -38,6 +38,9 @@ QT_FORWARD_DECLARE_CLASS(QAction)
|
|||||||
|
|
||||||
namespace Beautifier {
|
namespace Beautifier {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
|
class BeautifierPlugin;
|
||||||
|
|
||||||
namespace Uncrustify {
|
namespace Uncrustify {
|
||||||
|
|
||||||
class UncrustifySettings;
|
class UncrustifySettings;
|
||||||
@@ -47,7 +50,7 @@ class Uncrustify : public BeautifierAbstractTool
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit Uncrustify(QObject *parent = 0);
|
explicit Uncrustify(BeautifierPlugin *parent = 0);
|
||||||
virtual ~Uncrustify();
|
virtual ~Uncrustify();
|
||||||
bool initialize() QTC_OVERRIDE;
|
bool initialize() QTC_OVERRIDE;
|
||||||
void updateActions(Core::IEditor *editor) QTC_OVERRIDE;
|
void updateActions(Core::IEditor *editor) QTC_OVERRIDE;
|
||||||
@@ -57,6 +60,7 @@ private slots:
|
|||||||
void formatFile();
|
void formatFile();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
BeautifierPlugin *m_beautifierPlugin;
|
||||||
QAction *m_formatFile;
|
QAction *m_formatFile;
|
||||||
UncrustifySettings *m_settings;
|
UncrustifySettings *m_settings;
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user