summaryrefslogtreecommitdiff
path: root/src/plugins/beautifier/clangformat
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/beautifier/clangformat')
-rw-r--r--src/plugins/beautifier/clangformat/clangformat.cpp7
-rw-r--r--src/plugins/beautifier/clangformat/clangformat.h6
2 files changed, 9 insertions, 4 deletions
diff --git a/src/plugins/beautifier/clangformat/clangformat.cpp b/src/plugins/beautifier/clangformat/clangformat.cpp
index dc980559f5..c1a90d2fe1 100644
--- a/src/plugins/beautifier/clangformat/clangformat.cpp
+++ b/src/plugins/beautifier/clangformat/clangformat.cpp
@@ -56,8 +56,9 @@ namespace Beautifier {
namespace Internal {
namespace ClangFormat {
-ClangFormat::ClangFormat(QObject *parent) :
+ClangFormat::ClangFormat(BeautifierPlugin *parent) :
BeautifierAbstractTool(parent),
+ m_beautifierPlugin(parent),
m_settings(new ClangFormatSettings)
{
}
@@ -107,7 +108,7 @@ QList<QObject *> ClangFormat::autoReleaseObjects()
void ClangFormat::formatFile()
{
- BeautifierPlugin::formatCurrentFile(command());
+ m_beautifierPlugin->formatCurrentFile(command());
}
void ClangFormat::formatSelectedText()
@@ -121,7 +122,7 @@ void ClangFormat::formatSelectedText()
if (tc.hasSelection()) {
const int offset = tc.selectionStart();
const int length = tc.selectionEnd() - offset;
- BeautifierPlugin::formatCurrentFile(command(offset, length));
+ m_beautifierPlugin->formatCurrentFile(command(offset, length));
} else if (m_settings->formatEntireFileFallback()) {
formatFile();
}
diff --git a/src/plugins/beautifier/clangformat/clangformat.h b/src/plugins/beautifier/clangformat/clangformat.h
index 6806cd7d08..e92d52cfdd 100644
--- a/src/plugins/beautifier/clangformat/clangformat.h
+++ b/src/plugins/beautifier/clangformat/clangformat.h
@@ -39,6 +39,9 @@ QT_FORWARD_DECLARE_CLASS(QAction)
namespace Beautifier {
namespace Internal {
+
+class BeautifierPlugin;
+
namespace ClangFormat {
class ClangFormatSettings;
@@ -48,7 +51,7 @@ class ClangFormat : public BeautifierAbstractTool
Q_OBJECT
public:
- explicit ClangFormat(QObject *parent = 0);
+ explicit ClangFormat(BeautifierPlugin *parent = 0);
virtual ~ClangFormat();
bool initialize() QTC_OVERRIDE;
void updateActions(Core::IEditor *editor) QTC_OVERRIDE;
@@ -59,6 +62,7 @@ private slots:
void formatSelectedText();
private:
+ BeautifierPlugin *m_beautifierPlugin;
QAction *m_formatFile;
QAction *m_formatRange;
ClangFormatSettings *m_settings;