aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/clangformat/clangformatconfigwidget.cpp
diff options
context:
space:
mode:
authorIvan Donchevskii <ivan.donchevskii@qt.io>2018-11-13 09:29:09 +0100
committerIvan Donchevskii <ivan.donchevskii@qt.io>2018-11-13 09:21:30 +0000
commitcc118a16e69df7ee7edac08d239197fb9a6efca9 (patch)
tree230f03a09e59ee839a8698d28342936a816f4d80 /src/plugins/clangformat/clangformatconfigwidget.cpp
parent0ee07ae2adcd0691f68637910259c086c320b62c (diff)
ClangFormat: Use the constant for the configuration filename
It is unlikely that this name changes but let's follow good coding practices. Change-Id: I12adbf155f26b1b3a02d07092fcc113e0c5157e6 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
Diffstat (limited to 'src/plugins/clangformat/clangformatconfigwidget.cpp')
-rw-r--r--src/plugins/clangformat/clangformatconfigwidget.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/plugins/clangformat/clangformatconfigwidget.cpp b/src/plugins/clangformat/clangformatconfigwidget.cpp
index 213fd88a1a..ea439a0f43 100644
--- a/src/plugins/clangformat/clangformatconfigwidget.cpp
+++ b/src/plugins/clangformat/clangformatconfigwidget.cpp
@@ -26,6 +26,7 @@
#include "clangformatconfigwidget.h"
+#include "clangformatconstants.h"
#include "clangformatutils.h"
#include "ui_clangformatconfigwidget.h"
@@ -131,7 +132,7 @@ void ClangFormatConfigWidget::initialize()
m_ui->clangFormatOptionsTable->show();
m_ui->applyButton->show();
- if (m_project && !m_project->projectDirectory().appendPath(".clang-format").exists()) {
+ if (m_project && !m_project->projectDirectory().appendPath(SETTINGS_FILE_NAME).exists()) {
m_ui->projectHasClangFormat->setText(tr("No .clang-format file for the project."));
m_ui->clangFormatOptionsTable->hide();
m_ui->applyButton->hide();
@@ -152,7 +153,7 @@ void ClangFormatConfigWidget::initialize()
} else {
const Project *currentProject = SessionManager::startupProject();
if (!currentProject
- || !currentProject->projectDirectory().appendPath(".clang-format").exists()) {
+ || !currentProject->projectDirectory().appendPath(SETTINGS_FILE_NAME).exists()) {
m_ui->projectHasClangFormat->hide();
} else {
m_ui->projectHasClangFormat->setText(
@@ -184,9 +185,9 @@ void ClangFormatConfigWidget::apply()
const QByteArray text = tableToYAML(m_ui->clangFormatOptionsTable);
QString filePath;
if (m_project)
- filePath = m_project->projectDirectory().appendPath(".clang-format").toString();
+ filePath = m_project->projectDirectory().appendPath(SETTINGS_FILE_NAME).toString();
else
- filePath = Core::ICore::userResourcePath() + "/.clang-format";
+ filePath = Core::ICore::userResourcePath() + "/" + SETTINGS_FILE_NAME;
QFile file(filePath);
if (!file.open(QFile::WriteOnly))
return;