forked from qt-creator/qt-creator
CppEditor: Proliferate FilePath use a bit
Change-Id: I7e2669c3adf5de39804da2bf06d99f5ae03447dd Reviewed-by: Alessandro Portale <alessandro.portale@qt.io> Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
@@ -1321,7 +1321,7 @@ void CppEditorWidget::abortDeclDefLink()
|
||||
|
||||
void CppEditorWidget::showPreProcessorWidget()
|
||||
{
|
||||
const QString filePath = textDocument()->filePath().toString();
|
||||
const FilePath filePath = textDocument()->filePath();
|
||||
|
||||
CppPreProcessorDialog dialog(filePath, this);
|
||||
if (dialog.exec() == QDialog::Accepted) {
|
||||
|
@@ -3,7 +3,6 @@
|
||||
|
||||
#include "cpppreprocessordialog.h"
|
||||
|
||||
#include "cppeditorwidget.h"
|
||||
#include "cppeditorconstants.h"
|
||||
#include "cpptoolsreuse.h"
|
||||
|
||||
@@ -19,14 +18,14 @@ using namespace Utils;
|
||||
|
||||
namespace CppEditor::Internal {
|
||||
|
||||
CppPreProcessorDialog::CppPreProcessorDialog(const QString &filePath, QWidget *parent)
|
||||
CppPreProcessorDialog::CppPreProcessorDialog(const FilePath &filePath, QWidget *parent)
|
||||
: QDialog(parent)
|
||||
, m_filePath(filePath)
|
||||
{
|
||||
resize(400, 300);
|
||||
setWindowTitle(tr("Additional C++ Preprocessor Directives"));
|
||||
|
||||
const QString key = Constants::EXTRA_PREPROCESSOR_DIRECTIVES + m_filePath;
|
||||
const QString key = Constants::EXTRA_PREPROCESSOR_DIRECTIVES + m_filePath.toString();
|
||||
const QString directives = ProjectExplorer::SessionManager::value(key).toString();
|
||||
|
||||
m_editWidget = new TextEditor::SnippetEditorWidget;
|
||||
@@ -39,8 +38,7 @@ CppPreProcessorDialog::CppPreProcessorDialog(const QString &filePath, QWidget *p
|
||||
using namespace Layouting;
|
||||
|
||||
Column {
|
||||
tr("Additional C++ Preprocessor Directives for %1:")
|
||||
.arg(Utils::FilePath::fromString(m_filePath).fileName()),
|
||||
tr("Additional C++ Preprocessor Directives for %1:").arg(m_filePath.fileName()),
|
||||
m_editWidget,
|
||||
buttonBox,
|
||||
}.attachTo(this);
|
||||
@@ -56,7 +54,7 @@ int CppPreProcessorDialog::exec()
|
||||
if (QDialog::exec() == Rejected)
|
||||
return Rejected;
|
||||
|
||||
const QString key = Constants::EXTRA_PREPROCESSOR_DIRECTIVES + m_filePath;
|
||||
const QString key = Constants::EXTRA_PREPROCESSOR_DIRECTIVES + m_filePath.toString();
|
||||
ProjectExplorer::SessionManager::setValue(key, extraPreprocessorDirectives());
|
||||
|
||||
return Accepted;
|
||||
|
@@ -3,6 +3,8 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <utils/filepath.h>
|
||||
|
||||
#include <QDialog>
|
||||
#include <QString>
|
||||
|
||||
@@ -15,7 +17,7 @@ class CppPreProcessorDialog : public QDialog
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit CppPreProcessorDialog(const QString &filePath, QWidget *parent);
|
||||
CppPreProcessorDialog(const Utils::FilePath &filePath, QWidget *parent);
|
||||
~CppPreProcessorDialog() override;
|
||||
|
||||
int exec() override;
|
||||
@@ -23,7 +25,7 @@ public:
|
||||
QString extraPreprocessorDirectives() const;
|
||||
|
||||
private:
|
||||
const QString m_filePath;
|
||||
const Utils::FilePath m_filePath;
|
||||
const QString m_projectPartId;
|
||||
|
||||
TextEditor::SnippetEditorWidget *m_editWidget;
|
||||
|
Reference in New Issue
Block a user