forked from qt-creator/qt-creator
CppTools: Move CppFilesSettingsPage closer to new setup
Including some drive-by cosmetics. Change-Id: Id9cdba68545907b099a70944c83fe17ad3c0b2a0 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
@@ -50,14 +50,17 @@
|
|||||||
#include <QTextStream>
|
#include <QTextStream>
|
||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
|
|
||||||
static const char headerPrefixesKeyC[] = "HeaderPrefixes";
|
namespace CppTools {
|
||||||
static const char sourcePrefixesKeyC[] = "SourcePrefixes";
|
namespace Internal {
|
||||||
static const char headerSuffixKeyC[] = "HeaderSuffix";
|
|
||||||
static const char sourceSuffixKeyC[] = "SourceSuffix";
|
const char headerPrefixesKeyC[] = "HeaderPrefixes";
|
||||||
static const char headerSearchPathsKeyC[] = "HeaderSearchPaths";
|
const char sourcePrefixesKeyC[] = "SourcePrefixes";
|
||||||
static const char sourceSearchPathsKeyC[] = "SourceSearchPaths";
|
const char headerSuffixKeyC[] = "HeaderSuffix";
|
||||||
static const char headerPragmaOnceC[] = "HeaderPragmaOnce";
|
const char sourceSuffixKeyC[] = "SourceSuffix";
|
||||||
static const char licenseTemplatePathKeyC[] = "LicenseTemplate";
|
const char headerSearchPathsKeyC[] = "HeaderSearchPaths";
|
||||||
|
const char sourceSearchPathsKeyC[] = "SourceSearchPaths";
|
||||||
|
const char headerPragmaOnceC[] = "HeaderPragmaOnce";
|
||||||
|
const char licenseTemplatePathKeyC[] = "LicenseTemplate";
|
||||||
|
|
||||||
const char *licenseTemplateTemplate = QT_TRANSLATE_NOOP("CppTools::Internal::CppFileSettingsWidget",
|
const char *licenseTemplateTemplate = QT_TRANSLATE_NOOP("CppTools::Internal::CppFileSettingsWidget",
|
||||||
"/**************************************************************************\n"
|
"/**************************************************************************\n"
|
||||||
@@ -67,9 +70,6 @@ const char *licenseTemplateTemplate = QT_TRANSLATE_NOOP("CppTools::Internal::Cpp
|
|||||||
"** To protect a percent sign, use '%%'.\n"
|
"** To protect a percent sign, use '%%'.\n"
|
||||||
"**************************************************************************/\n");
|
"**************************************************************************/\n");
|
||||||
|
|
||||||
namespace CppTools {
|
|
||||||
namespace Internal {
|
|
||||||
|
|
||||||
void CppFileSettings::toSettings(QSettings *s) const
|
void CppFileSettings::toSettings(QSettings *s) const
|
||||||
{
|
{
|
||||||
s->beginGroup(QLatin1String(Constants::CPPTOOLS_SETTINGSGROUP));
|
s->beginGroup(QLatin1String(Constants::CPPTOOLS_SETTINGSGROUP));
|
||||||
@@ -252,40 +252,57 @@ QString CppFileSettings::licenseTemplate()
|
|||||||
|
|
||||||
// ------------------ CppFileSettingsWidget
|
// ------------------ CppFileSettingsWidget
|
||||||
|
|
||||||
CppFileSettingsWidget::CppFileSettingsWidget() :
|
class CppFileSettingsWidget final : public Core::IOptionsPageWidget
|
||||||
m_ui(new Internal::Ui::CppFileSettingsPage)
|
|
||||||
{
|
{
|
||||||
m_ui->setupUi(this);
|
Q_DECLARE_TR_FUNCTIONS(CppTools::Internal::CppFileSettingsWidget)
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit CppFileSettingsWidget(CppFileSettings *settings);
|
||||||
|
|
||||||
|
void apply() final;
|
||||||
|
|
||||||
|
void setSettings(const CppFileSettings &s);
|
||||||
|
|
||||||
|
private:
|
||||||
|
void slotEdit();
|
||||||
|
QString licenseTemplatePath() const;
|
||||||
|
void setLicenseTemplatePath(const QString &);
|
||||||
|
|
||||||
|
Ui::CppFileSettingsPage m_ui;
|
||||||
|
CppFileSettings *m_settings = nullptr;
|
||||||
|
};
|
||||||
|
|
||||||
|
CppFileSettingsWidget::CppFileSettingsWidget(CppFileSettings *settings)
|
||||||
|
: m_settings(settings)
|
||||||
|
{
|
||||||
|
m_ui.setupUi(this);
|
||||||
// populate suffix combos
|
// populate suffix combos
|
||||||
const Utils::MimeType sourceMt = Utils::mimeTypeForName(QLatin1String(CppTools::Constants::CPP_SOURCE_MIMETYPE));
|
const Utils::MimeType sourceMt = Utils::mimeTypeForName(QLatin1String(CppTools::Constants::CPP_SOURCE_MIMETYPE));
|
||||||
if (sourceMt.isValid()) {
|
if (sourceMt.isValid()) {
|
||||||
foreach (const QString &suffix, sourceMt.suffixes())
|
foreach (const QString &suffix, sourceMt.suffixes())
|
||||||
m_ui->sourceSuffixComboBox->addItem(suffix);
|
m_ui.sourceSuffixComboBox->addItem(suffix);
|
||||||
}
|
}
|
||||||
|
|
||||||
const Utils::MimeType headerMt = Utils::mimeTypeForName(QLatin1String(CppTools::Constants::CPP_HEADER_MIMETYPE));
|
const Utils::MimeType headerMt = Utils::mimeTypeForName(QLatin1String(CppTools::Constants::CPP_HEADER_MIMETYPE));
|
||||||
if (headerMt.isValid()) {
|
if (headerMt.isValid()) {
|
||||||
foreach (const QString &suffix, headerMt.suffixes())
|
foreach (const QString &suffix, headerMt.suffixes())
|
||||||
m_ui->headerSuffixComboBox->addItem(suffix);
|
m_ui.headerSuffixComboBox->addItem(suffix);
|
||||||
}
|
|
||||||
m_ui->licenseTemplatePathChooser->setExpectedKind(Utils::PathChooser::File);
|
|
||||||
m_ui->licenseTemplatePathChooser->setHistoryCompleter(QLatin1String("Cpp.LicenseTemplate.History"));
|
|
||||||
m_ui->licenseTemplatePathChooser->addButton(tr("Edit..."), this, [this] { slotEdit(); });
|
|
||||||
}
|
}
|
||||||
|
m_ui.licenseTemplatePathChooser->setExpectedKind(Utils::PathChooser::File);
|
||||||
|
m_ui.licenseTemplatePathChooser->setHistoryCompleter(QLatin1String("Cpp.LicenseTemplate.History"));
|
||||||
|
m_ui.licenseTemplatePathChooser->addButton(tr("Edit..."), this, [this] { slotEdit(); });
|
||||||
|
|
||||||
CppFileSettingsWidget::~CppFileSettingsWidget()
|
setSettings(*m_settings);
|
||||||
{
|
|
||||||
delete m_ui;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QString CppFileSettingsWidget::licenseTemplatePath() const
|
QString CppFileSettingsWidget::licenseTemplatePath() const
|
||||||
{
|
{
|
||||||
return m_ui->licenseTemplatePathChooser->path();
|
return m_ui.licenseTemplatePathChooser->path();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CppFileSettingsWidget::setLicenseTemplatePath(const QString &lp)
|
void CppFileSettingsWidget::setLicenseTemplatePath(const QString &lp)
|
||||||
{
|
{
|
||||||
m_ui->licenseTemplatePathChooser->setPath(lp);
|
m_ui.licenseTemplatePathChooser->setPath(lp);
|
||||||
}
|
}
|
||||||
|
|
||||||
static QStringList trimmedPaths(const QString &paths)
|
static QStringList trimmedPaths(const QString &paths)
|
||||||
@@ -296,19 +313,25 @@ static QStringList trimmedPaths(const QString &paths)
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
CppFileSettings CppFileSettingsWidget::settings() const
|
void CppFileSettingsWidget::apply()
|
||||||
{
|
{
|
||||||
CppFileSettings rc;
|
CppFileSettings rc;
|
||||||
rc.lowerCaseFiles = m_ui->lowerCaseFileNamesCheckBox->isChecked();
|
rc.lowerCaseFiles = m_ui.lowerCaseFileNamesCheckBox->isChecked();
|
||||||
rc.headerPragmaOnce = m_ui->headerPragmaOnceCheckBox->isChecked();
|
rc.headerPragmaOnce = m_ui.headerPragmaOnceCheckBox->isChecked();
|
||||||
rc.headerPrefixes = trimmedPaths(m_ui->headerPrefixesEdit->text());
|
rc.headerPrefixes = trimmedPaths(m_ui.headerPrefixesEdit->text());
|
||||||
rc.sourcePrefixes = trimmedPaths(m_ui->sourcePrefixesEdit->text());
|
rc.sourcePrefixes = trimmedPaths(m_ui.sourcePrefixesEdit->text());
|
||||||
rc.headerSuffix = m_ui->headerSuffixComboBox->currentText();
|
rc.headerSuffix = m_ui.headerSuffixComboBox->currentText();
|
||||||
rc.sourceSuffix = m_ui->sourceSuffixComboBox->currentText();
|
rc.sourceSuffix = m_ui.sourceSuffixComboBox->currentText();
|
||||||
rc.headerSearchPaths = trimmedPaths(m_ui->headerSearchPathsEdit->text());
|
rc.headerSearchPaths = trimmedPaths(m_ui.headerSearchPathsEdit->text());
|
||||||
rc.sourceSearchPaths = trimmedPaths(m_ui->sourceSearchPathsEdit->text());
|
rc.sourceSearchPaths = trimmedPaths(m_ui.sourceSearchPathsEdit->text());
|
||||||
rc.licenseTemplatePath = licenseTemplatePath();
|
|
||||||
return rc;
|
if (rc == *m_settings)
|
||||||
|
return;
|
||||||
|
|
||||||
|
*m_settings = rc;
|
||||||
|
m_settings->toSettings(Core::ICore::settings());
|
||||||
|
m_settings->applySuffixesToMimeDB();
|
||||||
|
CppToolsPlugin::clearHeaderSourceCache();
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void setComboText(QComboBox *cb, const QString &text, int defaultIndex = 0)
|
static inline void setComboText(QComboBox *cb, const QString &text, int defaultIndex = 0)
|
||||||
@@ -320,14 +343,14 @@ static inline void setComboText(QComboBox *cb, const QString &text, int defaultI
|
|||||||
void CppFileSettingsWidget::setSettings(const CppFileSettings &s)
|
void CppFileSettingsWidget::setSettings(const CppFileSettings &s)
|
||||||
{
|
{
|
||||||
const QChar comma = QLatin1Char(',');
|
const QChar comma = QLatin1Char(',');
|
||||||
m_ui->lowerCaseFileNamesCheckBox->setChecked(s.lowerCaseFiles);
|
m_ui.lowerCaseFileNamesCheckBox->setChecked(s.lowerCaseFiles);
|
||||||
m_ui->headerPragmaOnceCheckBox->setChecked(s.headerPragmaOnce);
|
m_ui.headerPragmaOnceCheckBox->setChecked(s.headerPragmaOnce);
|
||||||
m_ui->headerPrefixesEdit->setText(s.headerPrefixes.join(comma));
|
m_ui.headerPrefixesEdit->setText(s.headerPrefixes.join(comma));
|
||||||
m_ui->sourcePrefixesEdit->setText(s.sourcePrefixes.join(comma));
|
m_ui.sourcePrefixesEdit->setText(s.sourcePrefixes.join(comma));
|
||||||
setComboText(m_ui->headerSuffixComboBox, s.headerSuffix);
|
setComboText(m_ui.headerSuffixComboBox, s.headerSuffix);
|
||||||
setComboText(m_ui->sourceSuffixComboBox, s.sourceSuffix);
|
setComboText(m_ui.sourceSuffixComboBox, s.sourceSuffix);
|
||||||
m_ui->headerSearchPathsEdit->setText(s.headerSearchPaths.join(comma));
|
m_ui.headerSearchPathsEdit->setText(s.headerSearchPaths.join(comma));
|
||||||
m_ui->sourceSearchPathsEdit->setText(s.sourceSearchPaths.join(comma));
|
m_ui.sourceSearchPathsEdit->setText(s.sourceSearchPaths.join(comma));
|
||||||
setLicenseTemplatePath(s.licenseTemplatePath);
|
setLicenseTemplatePath(s.licenseTemplatePath);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -350,39 +373,13 @@ void CppFileSettingsWidget::slotEdit()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// --------------- CppFileSettingsPage
|
// --------------- CppFileSettingsPage
|
||||||
CppFileSettingsPage::CppFileSettingsPage(QSharedPointer<CppFileSettings> &settings) :
|
|
||||||
m_settings(settings)
|
CppFileSettingsPage::CppFileSettingsPage(CppFileSettings *settings)
|
||||||
{
|
{
|
||||||
setId(Constants::CPP_FILE_SETTINGS_ID);
|
setId(Constants::CPP_FILE_SETTINGS_ID);
|
||||||
setDisplayName(QCoreApplication::translate("CppTools", Constants::CPP_FILE_SETTINGS_NAME));
|
setDisplayName(QCoreApplication::translate("CppTools", Constants::CPP_FILE_SETTINGS_NAME));
|
||||||
setCategory(Constants::CPP_SETTINGS_CATEGORY);
|
setCategory(Constants::CPP_SETTINGS_CATEGORY);
|
||||||
}
|
setWidgetCreator([settings] { return new CppFileSettingsWidget(settings); });
|
||||||
|
|
||||||
QWidget *CppFileSettingsPage::widget()
|
|
||||||
{
|
|
||||||
if (!m_widget) {
|
|
||||||
m_widget = new CppFileSettingsWidget;
|
|
||||||
m_widget->setSettings(*m_settings);
|
|
||||||
}
|
|
||||||
return m_widget;
|
|
||||||
}
|
|
||||||
|
|
||||||
void CppFileSettingsPage::apply()
|
|
||||||
{
|
|
||||||
if (m_widget) {
|
|
||||||
const CppFileSettings newSettings = m_widget->settings();
|
|
||||||
if (newSettings != *m_settings) {
|
|
||||||
*m_settings = newSettings;
|
|
||||||
m_settings->toSettings(Core::ICore::settings());
|
|
||||||
m_settings->applySuffixesToMimeDB();
|
|
||||||
CppToolsPlugin::clearHeaderSourceCache();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void CppFileSettingsPage::finish()
|
|
||||||
{
|
|
||||||
delete m_widget;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
@@ -27,10 +27,6 @@
|
|||||||
|
|
||||||
#include <coreplugin/dialogs/ioptionspage.h>
|
#include <coreplugin/dialogs/ioptionspage.h>
|
||||||
|
|
||||||
#include <QPointer>
|
|
||||||
#include <QSharedPointer>
|
|
||||||
#include <QWidget>
|
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
class QSettings;
|
class QSettings;
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
@@ -38,8 +34,6 @@ QT_END_NAMESPACE
|
|||||||
namespace CppTools {
|
namespace CppTools {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
namespace Ui { class CppFileSettingsPage; }
|
|
||||||
|
|
||||||
struct CppFileSettings
|
struct CppFileSettings
|
||||||
{
|
{
|
||||||
QStringList headerPrefixes;
|
QStringList headerPrefixes;
|
||||||
@@ -65,37 +59,10 @@ struct CppFileSettings
|
|||||||
bool operator!=(const CppFileSettings &s) const { return !equals(s); }
|
bool operator!=(const CppFileSettings &s) const { return !equals(s); }
|
||||||
};
|
};
|
||||||
|
|
||||||
class CppFileSettingsWidget : public QWidget
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
|
||||||
CppFileSettingsWidget();
|
|
||||||
~CppFileSettingsWidget() override;
|
|
||||||
|
|
||||||
CppFileSettings settings() const;
|
|
||||||
void setSettings(const CppFileSettings &s);
|
|
||||||
|
|
||||||
private:
|
|
||||||
void slotEdit();
|
|
||||||
QString licenseTemplatePath() const;
|
|
||||||
void setLicenseTemplatePath(const QString &);
|
|
||||||
|
|
||||||
Ui::CppFileSettingsPage *m_ui;
|
|
||||||
};
|
|
||||||
|
|
||||||
class CppFileSettingsPage : public Core::IOptionsPage
|
class CppFileSettingsPage : public Core::IOptionsPage
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit CppFileSettingsPage(QSharedPointer<CppFileSettings> &settings);
|
explicit CppFileSettingsPage(CppFileSettings *settings);
|
||||||
|
|
||||||
QWidget *widget() override;
|
|
||||||
void apply() override;
|
|
||||||
void finish() override;
|
|
||||||
|
|
||||||
private:
|
|
||||||
const QSharedPointer<CppFileSettings> m_settings;
|
|
||||||
QPointer<CppFileSettingsWidget> m_widget;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
@@ -89,23 +89,25 @@ void CppToolsPlugin::test_headersource_data()
|
|||||||
void CppToolsPlugin::initTestCase()
|
void CppToolsPlugin::initTestCase()
|
||||||
{
|
{
|
||||||
QDir(baseTestDir()).mkpath(_("."));
|
QDir(baseTestDir()).mkpath(_("."));
|
||||||
m_fileSettings->headerSearchPaths.append(QLatin1String("include"));
|
CppFileSettings *fs = fileSettings();
|
||||||
m_fileSettings->headerSearchPaths.append(QLatin1String("../include"));
|
fs->headerSearchPaths.append(QLatin1String("include"));
|
||||||
m_fileSettings->sourceSearchPaths.append(QLatin1String("src"));
|
fs->headerSearchPaths.append(QLatin1String("../include"));
|
||||||
m_fileSettings->sourceSearchPaths.append(QLatin1String("../src"));
|
fs->sourceSearchPaths.append(QLatin1String("src"));
|
||||||
m_fileSettings->headerPrefixes.append(QLatin1String("testh_"));
|
fs->sourceSearchPaths.append(QLatin1String("../src"));
|
||||||
m_fileSettings->sourcePrefixes.append(QLatin1String("testc_"));
|
fs->headerPrefixes.append(QLatin1String("testh_"));
|
||||||
|
fs->sourcePrefixes.append(QLatin1String("testc_"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void CppToolsPlugin::cleanupTestCase()
|
void CppToolsPlugin::cleanupTestCase()
|
||||||
{
|
{
|
||||||
Utils::FileUtils::removeRecursively(Utils::FilePath::fromString(baseTestDir()));
|
Utils::FileUtils::removeRecursively(Utils::FilePath::fromString(baseTestDir()));
|
||||||
m_fileSettings->headerSearchPaths.removeLast();
|
CppFileSettings *fs = fileSettings();
|
||||||
m_fileSettings->headerSearchPaths.removeLast();
|
fs->headerSearchPaths.removeLast();
|
||||||
m_fileSettings->sourceSearchPaths.removeLast();
|
fs->headerSearchPaths.removeLast();
|
||||||
m_fileSettings->sourceSearchPaths.removeLast();
|
fs->sourceSearchPaths.removeLast();
|
||||||
m_fileSettings->headerPrefixes.removeLast();
|
fs->sourceSearchPaths.removeLast();
|
||||||
m_fileSettings->sourcePrefixes.removeLast();
|
fs->headerPrefixes.removeLast();
|
||||||
|
fs->sourcePrefixes.removeLast();
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
@@ -86,14 +86,12 @@ public:
|
|||||||
CppModelManager::createCppModelManager(m_instance);
|
CppModelManager::createCppModelManager(m_instance);
|
||||||
m_settings = new CppToolsSettings(m_instance); // force registration of cpp tools settings
|
m_settings = new CppToolsSettings(m_instance); // force registration of cpp tools settings
|
||||||
m_codeModelSettings.fromSettings(ICore::settings());
|
m_codeModelSettings.fromSettings(ICore::settings());
|
||||||
m_cppFileSettingsPage = new CppFileSettingsPage(m_instance->m_fileSettings);
|
|
||||||
m_cppCodeStyleSettingsPage = new CppCodeStyleSettingsPage;
|
m_cppCodeStyleSettingsPage = new CppCodeStyleSettingsPage;
|
||||||
}
|
}
|
||||||
|
|
||||||
~CppToolsPluginPrivate()
|
~CppToolsPluginPrivate()
|
||||||
{
|
{
|
||||||
StringTable::destroy();
|
StringTable::destroy();
|
||||||
delete m_cppFileSettingsPage;
|
|
||||||
if (m_cppCodeStyleSettingsPage)
|
if (m_cppCodeStyleSettingsPage)
|
||||||
delete m_cppCodeStyleSettingsPage;
|
delete m_cppCodeStyleSettingsPage;
|
||||||
ExtensionSystem::PluginManager::removeObject(&m_cppProjectUpdaterFactory);
|
ExtensionSystem::PluginManager::removeObject(&m_cppProjectUpdaterFactory);
|
||||||
@@ -101,14 +99,14 @@ public:
|
|||||||
|
|
||||||
CppCodeModelSettings m_codeModelSettings;
|
CppCodeModelSettings m_codeModelSettings;
|
||||||
CppToolsSettings *m_settings = nullptr;
|
CppToolsSettings *m_settings = nullptr;
|
||||||
CppFileSettingsPage *m_cppFileSettingsPage = nullptr;
|
CppFileSettings m_fileSettings;
|
||||||
|
CppFileSettingsPage m_cppFileSettingsPage{&m_fileSettings};
|
||||||
CppCodeModelSettingsPage m_cppCodeModelSettingsPage{&m_codeModelSettings};
|
CppCodeModelSettingsPage m_cppCodeModelSettingsPage{&m_codeModelSettings};
|
||||||
QPointer<CppCodeStyleSettingsPage> m_cppCodeStyleSettingsPage = nullptr;
|
QPointer<CppCodeStyleSettingsPage> m_cppCodeStyleSettingsPage = nullptr;
|
||||||
CppProjectUpdaterFactory m_cppProjectUpdaterFactory;
|
CppProjectUpdaterFactory m_cppProjectUpdaterFactory;
|
||||||
};
|
};
|
||||||
|
|
||||||
CppToolsPlugin::CppToolsPlugin()
|
CppToolsPlugin::CppToolsPlugin()
|
||||||
: m_fileSettings(new CppFileSettings)
|
|
||||||
{
|
{
|
||||||
m_instance = this;
|
m_instance = this;
|
||||||
CppToolsBridge::setCppToolsBridgeImplementation(std::make_unique<CppToolsBridgeQtCreatorImplementation>());
|
CppToolsBridge::setCppToolsBridgeImplementation(std::make_unique<CppToolsBridgeQtCreatorImplementation>());
|
||||||
@@ -133,37 +131,37 @@ void CppToolsPlugin::clearHeaderSourceCache()
|
|||||||
|
|
||||||
Utils::FilePath CppToolsPlugin::licenseTemplatePath()
|
Utils::FilePath CppToolsPlugin::licenseTemplatePath()
|
||||||
{
|
{
|
||||||
return Utils::FilePath::fromString(m_instance->m_fileSettings->licenseTemplatePath);
|
return Utils::FilePath::fromString(m_instance->d->m_fileSettings.licenseTemplatePath);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString CppToolsPlugin::licenseTemplate()
|
QString CppToolsPlugin::licenseTemplate()
|
||||||
{
|
{
|
||||||
return m_instance->m_fileSettings->licenseTemplate();
|
return m_instance->d->m_fileSettings.licenseTemplate();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CppToolsPlugin::usePragmaOnce()
|
bool CppToolsPlugin::usePragmaOnce()
|
||||||
{
|
{
|
||||||
return m_instance->m_fileSettings->headerPragmaOnce;
|
return m_instance->d->m_fileSettings.headerPragmaOnce;
|
||||||
}
|
}
|
||||||
|
|
||||||
const QStringList &CppToolsPlugin::headerSearchPaths()
|
const QStringList &CppToolsPlugin::headerSearchPaths()
|
||||||
{
|
{
|
||||||
return m_instance->m_fileSettings->headerSearchPaths;
|
return m_instance->d->m_fileSettings.headerSearchPaths;
|
||||||
}
|
}
|
||||||
|
|
||||||
const QStringList &CppToolsPlugin::sourceSearchPaths()
|
const QStringList &CppToolsPlugin::sourceSearchPaths()
|
||||||
{
|
{
|
||||||
return m_instance->m_fileSettings->sourceSearchPaths;
|
return m_instance->d->m_fileSettings.sourceSearchPaths;
|
||||||
}
|
}
|
||||||
|
|
||||||
const QStringList &CppToolsPlugin::headerPrefixes()
|
const QStringList &CppToolsPlugin::headerPrefixes()
|
||||||
{
|
{
|
||||||
return m_instance->m_fileSettings->headerPrefixes;
|
return m_instance->d->m_fileSettings.headerPrefixes;
|
||||||
}
|
}
|
||||||
|
|
||||||
const QStringList &CppToolsPlugin::sourcePrefixes()
|
const QStringList &CppToolsPlugin::sourcePrefixes()
|
||||||
{
|
{
|
||||||
return m_instance->m_fileSettings->sourcePrefixes;
|
return m_instance->d->m_fileSettings.sourcePrefixes;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CppToolsPlugin::initialize(const QStringList &arguments, QString *error)
|
bool CppToolsPlugin::initialize(const QStringList &arguments, QString *error)
|
||||||
@@ -223,8 +221,8 @@ void CppToolsPlugin::extensionsInitialized()
|
|||||||
{
|
{
|
||||||
// The Cpp editor plugin, which is loaded later on, registers the Cpp mime types,
|
// The Cpp editor plugin, which is loaded later on, registers the Cpp mime types,
|
||||||
// so, apply settings here
|
// so, apply settings here
|
||||||
m_instance->m_fileSettings->fromSettings(ICore::settings());
|
d->m_fileSettings.fromSettings(ICore::settings());
|
||||||
if (!m_instance->m_fileSettings->applySuffixesToMimeDB())
|
if (!d->m_fileSettings.applySuffixesToMimeDB())
|
||||||
qWarning("Unable to apply cpp suffixes to mime database (cpp mime types not found).\n");
|
qWarning("Unable to apply cpp suffixes to mime database (cpp mime types not found).\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -233,6 +231,11 @@ CppCodeModelSettings *CppToolsPlugin::codeModelSettings()
|
|||||||
return &d->m_codeModelSettings;
|
return &d->m_codeModelSettings;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CppFileSettings *CppToolsPlugin::fileSettings()
|
||||||
|
{
|
||||||
|
return &d->m_fileSettings;
|
||||||
|
}
|
||||||
|
|
||||||
void CppToolsPlugin::switchHeaderSource()
|
void CppToolsPlugin::switchHeaderSource()
|
||||||
{
|
{
|
||||||
CppTools::switchHeaderSource();
|
CppTools::switchHeaderSource();
|
||||||
|
@@ -29,24 +29,15 @@
|
|||||||
|
|
||||||
#include <projectexplorer/projectexplorer.h>
|
#include <projectexplorer/projectexplorer.h>
|
||||||
|
|
||||||
#include <QSharedPointer>
|
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
|
||||||
class QFileInfo;
|
|
||||||
class QDir;
|
|
||||||
QT_END_NAMESPACE
|
|
||||||
|
|
||||||
namespace Utils { class FilePath; }
|
namespace Utils { class FilePath; }
|
||||||
|
|
||||||
namespace CppTools {
|
namespace CppTools {
|
||||||
|
|
||||||
class CppToolsSettings;
|
|
||||||
class CppCodeModelSettings;
|
class CppCodeModelSettings;
|
||||||
|
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
struct CppFileSettings;
|
struct CppFileSettings;
|
||||||
class CppToolsPluginPrivate;
|
|
||||||
|
|
||||||
class CppToolsPlugin final : public ExtensionSystem::IPlugin
|
class CppToolsPlugin final : public ExtensionSystem::IPlugin
|
||||||
{
|
{
|
||||||
@@ -180,9 +171,8 @@ private slots:
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
private:
|
private:
|
||||||
friend class CppToolsPluginPrivate;
|
CppFileSettings *fileSettings();
|
||||||
CppToolsPluginPrivate *d = nullptr;
|
class CppToolsPluginPrivate *d = nullptr;
|
||||||
QSharedPointer<CppFileSettings> m_fileSettings;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
Reference in New Issue
Block a user