forked from qt-creator/qt-creator
CppTools: Export CppCodeModelSettings
Needed for the ClangCodeModel tests, where we need to activate the clang code model. Change-Id: I368b840875ca2a46da4535338bf55967cbcdf5ea Reviewed-by: Marco Bubke <marco.bubke@theqtcompany.com>
This commit is contained in:
@@ -33,7 +33,6 @@
|
||||
#include "cpptoolsconstants.h"
|
||||
|
||||
using namespace CppTools;
|
||||
using namespace CppTools::Internal;
|
||||
|
||||
static QLatin1String cppHeaderMimeType(Constants::CPP_HEADER_MIMETYPE);
|
||||
static QLatin1String cHeaderMimeType(Constants::C_HEADER_MIMETYPE);
|
||||
@@ -42,11 +41,10 @@ void CppCodeModelSettings::fromSettings(QSettings *s)
|
||||
{
|
||||
s->beginGroup(QLatin1String(Constants::CPPTOOLS_SETTINGSGROUP));
|
||||
QVariant supporters = s->value(QLatin1String(Constants::CPPTOOLS_MODEL_MANAGER_SUPPORTERS_KEY));
|
||||
setIdForMimeType(supporters, QLatin1String(Constants::C_SOURCE_MIMETYPE));
|
||||
setIdForMimeType(supporters, QLatin1String(Constants::CPP_SOURCE_MIMETYPE));
|
||||
setIdForMimeType(supporters, QLatin1String(Constants::OBJECTIVE_C_SOURCE_MIMETYPE));
|
||||
setIdForMimeType(supporters, QLatin1String(Constants::OBJECTIVE_CPP_SOURCE_MIMETYPE));
|
||||
setIdForMimeType(supporters, QLatin1String(Constants::CPP_HEADER_MIMETYPE));
|
||||
|
||||
foreach (const QString &mimeType, supportedMimeTypes())
|
||||
setIdForMimeType(supporters, mimeType);
|
||||
|
||||
QVariant v = s->value(QLatin1String(Constants::CPPTOOLS_MODEL_MANAGER_PCH_USAGE), PchUse_None);
|
||||
setPCHUsage(static_cast<PCHUsage>(v.toInt()));
|
||||
s->endGroup();
|
||||
@@ -63,6 +61,17 @@ void CppCodeModelSettings::toSettings(QSettings *s)
|
||||
s->endGroup();
|
||||
}
|
||||
|
||||
QStringList CppCodeModelSettings::supportedMimeTypes()
|
||||
{
|
||||
return QStringList({
|
||||
QLatin1String(Constants::C_SOURCE_MIMETYPE),
|
||||
QLatin1String(Constants::CPP_SOURCE_MIMETYPE),
|
||||
QLatin1String(Constants::OBJECTIVE_C_SOURCE_MIMETYPE),
|
||||
QLatin1String(Constants::OBJECTIVE_CPP_SOURCE_MIMETYPE),
|
||||
QLatin1String(Constants::CPP_HEADER_MIMETYPE)
|
||||
});
|
||||
}
|
||||
|
||||
void CppCodeModelSettings::setModelManagerSupports(const QList<ModelManagerSupport *> &supporters)
|
||||
{
|
||||
m_availableModelManagerSupportersByName.clear();
|
||||
|
@@ -28,8 +28,10 @@
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef CPPTOOLS_INTERNAL_CPPCODEMODELSETTINGS_H
|
||||
#define CPPTOOLS_INTERNAL_CPPCODEMODELSETTINGS_H
|
||||
#ifndef CPPTOOLS_CPPCODEMODELSETTINGS_H
|
||||
#define CPPTOOLS_CPPCODEMODELSETTINGS_H
|
||||
|
||||
#include "cpptools_global.h"
|
||||
|
||||
#include <QHash>
|
||||
#include <QList>
|
||||
@@ -40,9 +42,7 @@ namespace CppTools {
|
||||
|
||||
class ModelManagerSupport;
|
||||
|
||||
namespace Internal {
|
||||
|
||||
class CppCodeModelSettings
|
||||
class CPPTOOLS_EXPORT CppCodeModelSettings
|
||||
{
|
||||
public:
|
||||
enum PCHUsage {
|
||||
@@ -73,6 +73,8 @@ public:
|
||||
PCHUsage pchUsage() const { return m_pchUsage; }
|
||||
void setPCHUsage(PCHUsage pchUsage) { m_pchUsage = pchUsage; }
|
||||
|
||||
static QStringList supportedMimeTypes();
|
||||
|
||||
private:
|
||||
void setIdForMimeType(const QVariant &var, const QString &mimeType);
|
||||
|
||||
@@ -83,7 +85,6 @@ private:
|
||||
PCHUsage m_pchUsage;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace CppTools
|
||||
|
||||
#endif // CPPTOOLS_INTERNAL_CPPCODEMODELSETTINGS_H
|
||||
#endif // CPPTOOLS_CPPCODEMODELSETTINGS_H
|
||||
|
@@ -48,11 +48,11 @@ namespace Utils { class FileName; }
|
||||
namespace CppTools {
|
||||
|
||||
class CppToolsSettings;
|
||||
class CppCodeModelSettings;
|
||||
|
||||
namespace Internal {
|
||||
|
||||
struct CppFileSettings;
|
||||
class CppCodeModelSettings;
|
||||
|
||||
class CppToolsPlugin : public ExtensionSystem::IPlugin
|
||||
{
|
||||
|
@@ -30,6 +30,8 @@
|
||||
|
||||
#include "cpptoolsreuse.h"
|
||||
|
||||
#include "cpptoolsplugin.h"
|
||||
|
||||
#include <coreplugin/editormanager/editormanager.h>
|
||||
#include <coreplugin/idocument.h>
|
||||
#include <texteditor/convenience.h>
|
||||
@@ -251,6 +253,11 @@ TextEditor::TextEditorWidget::Link linkToSymbol(Symbol *symbol)
|
||||
return Link(filename, line, column);
|
||||
}
|
||||
|
||||
QSharedPointer<CppCodeModelSettings> codeModelSettings()
|
||||
{
|
||||
return CppTools::Internal::CppToolsPlugin::instance()->codeModelSettings();
|
||||
}
|
||||
|
||||
int fileSizeLimit()
|
||||
{
|
||||
static const QByteArray fileSizeLimitAsByteArray = qgetenv("QTC_CPP_FILE_SIZE_LIMIT_MB");
|
||||
|
@@ -75,6 +75,9 @@ const CPlusPlus::Macro CPPTOOLS_EXPORT *findCanonicalMacro(const QTextCursor &cu
|
||||
QString CPPTOOLS_EXPORT correspondingHeaderOrSource(const QString &fileName, bool *wasHeader = 0);
|
||||
void CPPTOOLS_EXPORT switchHeaderSource();
|
||||
|
||||
class CppCodeModelSettings;
|
||||
QSharedPointer<CppCodeModelSettings> CPPTOOLS_EXPORT codeModelSettings();
|
||||
|
||||
int fileSizeLimit();
|
||||
bool skipFileDueToSizeLimit(const QFileInfo &fileInfo, int limitInMB = fileSizeLimit());
|
||||
|
||||
|
Reference in New Issue
Block a user