Merge remote-tracking branch 'origin/4.0'

Conflicts:
	qtcreator.pri
	qtcreator.qbs
	src/plugins/debugger/debuggerruncontrol.cpp

Change-Id: I81b43480a1369e3d7be60ae26e812dda6b962b0b
This commit is contained in:
Oswald Buddenhagen
2016-04-01 17:31:39 +02:00
143 changed files with 6586 additions and 2764 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 46 KiB

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 22 KiB

View File

@@ -109,8 +109,6 @@
items with names consisting of plain characters, numbers, items with names consisting of plain characters, numbers,
underscores, and hyphens. underscores, and hyphens.
\li Creating new CMake projects with \QC is not supported.
\li If error messages displayed in the \uicontrol {Compile Output} pane contain \li If error messages displayed in the \uicontrol {Compile Output} pane contain
paths where slashes are missing (for example, C:QtSDK), paths where slashes are missing (for example, C:QtSDK),
check your PATH variable. For more information, see check your PATH variable. For more information, see

View File

@@ -43,38 +43,81 @@
native build configurations and workspaces that you can use in the compiler native build configurations and workspaces that you can use in the compiler
environment of your choice. environment of your choice.
Since \QC 1.1, CMake configuration files are supported. Since \QC 1.3, the
Microsoft tool chain is supported if the CMake version is at least 2.8.
\QC automatically detects the CMake executable specified in the \c PATH. \QC automatically detects the CMake executable specified in the \c PATH.
You can add paths to other CMake executables and use them in different You can add paths to other CMake executables and use them in different
build and run \l{glossary-buildandrun-kit}{kits}. build and run \l{glossary-buildandrun-kit}{kits}.
\section1 Adding CMake Tools \section1 Adding CMake Tools
To specify paths to CMake executables, select \uicontrol Tools > \QC supports CMake version 2.9, or later.
\uicontrol Options > \uicontrol {Build & Run} > \uicontrol CMake >
\uicontrol Add.
\image qtcreator-cmakeexecutable.png To specify paths to CMake executables and to add them to kits:
\list 1
\li Select \uicontrol Tools > \uicontrol Options >
\uicontrol {Build & Run} > \uicontrol CMake > \uicontrol Add.
\image qtcreator-cmakeexecutable.png
\li In the \uicontrol Name field, specify a name for the tool.
\li In the \uicontrol Path field, specify the path to the CMake
executable.
\li Select \uicontrol Apply to save your changes.
\li Select the \uicontrol Kits tab to add the CMake tool to a build and
run kit. The kit also specifies the CMake Generator that is used for
producing project files for \QC and the configuration variables that
are used:
\image qtcreator-kits.png
For more information, see \l {Adding Kits}.
\endlist
\section1 Creating CMake Projects
To create a CMake project:
\list 1
\li Select \uicontrol File > \uicontrol {New File or Project} >
\uicontrol {Non-Qt Project} > \uicontrol {Plain C Application} or
\uicontrol {Plain C++ Application} > \uicontrol Choose.
\li In the \uicontrol Name field, enter a name for the project.
\li In the \uicontrol {Create in} field, enter the path for the project
files, and then select \uicontrol Next (or \uicontrol Continue on
OS X).
\li In the \uicontrol {Build system} field, select \uicontrol CMake, and
then select \uicontrol Next.
\li Select CMake kits for the platforms that you want to build the
application for, and then select \uicontrol Next.
\li Review the project settings, and click \uicontrol{Finish} (or
\uicontrol Done on OS X).
\li Select \uicontrol {Run CMake} to generate a .cbp file.
\image qtcreator-cmake-run-cmake.png
Some projects require command line arguments to the initial CMake
call. CMake will remember the arguments during subsequent calls.
\endlist
\QC generates a \c {main.cpp} and \c {CMakeLists.txt} file that you can
modify in the \uicontrol Edit mode.
\section1 Opening CMake Projects \section1 Opening CMake Projects
\note Before you open a CMake project, you must modify the \c {PATH} To open an existing CMake project:
environment variable to include the bin folders of \c mingw and Qt.
For instance, if Qt 5.5 is installed in \c {C:\Qt}, you would use the
following command to set the environment variables in the command line
prompt:
\code
set PATH=C:\Qt\Tools\mingw<VERSION>\bin;C:\Qt\5.5\<TARGET>\bin;
\endcode
Then start \QC by typing:
\code
C:\Qt\Tools\QtCreator\qtcreator.exe
\endcode
To open a CMake project:
\list 1 \list 1
@@ -82,28 +125,22 @@
\li Select the \c {CMakeLists.txt} file from your CMake project. \li Select the \c {CMakeLists.txt} file from your CMake project.
\li Select a kit that is configured to use CMake for building the
project.
\li In \uicontrol Projects, right-click the project name to open the
context menu, and then select \uicontrol {Run CMake} to have the
project contents listed in the view.
\endlist \endlist
A wizard guides you through the rest of the process.
\note If the CMake project does not have an in-place build, \QC
lets you specify the directory in which the project is built
(\l{glossary-shadow-build}{shadow build}).
\image qtcreator-cmake-import-wizard1.png
The screenshot below shows how you can specify command line arguments to
CMake for your project.
\image qtcreator-cmake-import-wizard2.png
Normally, there is no need to pass any command line arguments for projects
that are already built, as CMake caches that information.
\section1 Editing CMake Configuration Files \section1 Editing CMake Configuration Files
You can open CMake configuration files in \QC for editing. The following To open a CMakeLists.txt file for editing, right-click it in the
features are supported: \uicontrol Projects view and select \uicontrol {Open with} >
\uicontrol {CMake Editor}.
The following features are supported:
\list \list
@@ -119,31 +156,55 @@
\section1 Building CMake Projects \section1 Building CMake Projects
\QC builds CMake projects by running \c make, \c mingw32-make, To build CMake projects, select \uicontrol {Build Project} or press
\c nmake, or \c ninja depending on your platform. The build errors and \key Ctrl+B (or \key Cmd+B on OS X).
warnings are parsed and displayed in the \uicontrol Issues output pane.
By default, \QC uses the \uicontrol All \l{glossary-build-config} \QC builds CMake projects by running \c make, \c mingw32-make, \c nmake, or
\c ninja depending on the selected kit.
By default, \QC uses the \uicontrol Default \l{glossary-build-config}
{build configuration}. You can select another build configuration in {build configuration}. You can select another build configuration in
\uicontrol Projects > \uicontrol {Edit build configuration}. In addition to \uicontrol Projects > \uicontrol {Build Settings} >
\uicontrol {Edit build configuration}. In addition to
debug and release build configurations, you can create a release build that debug and release build configurations, you can create a release build that
contains debug information or a release build with the smallest possible contains debug information or a release build with the smallest possible
size. size.
\image qtcreator-cmake-build-settings.png \image qtcreator-cmake-build-settings.png
You can change the build directory after the initial import. In the \uicontrol {Build directory} field, you can specify the directory in
which the project is built (\l{glossary-shadow-build}{shadow build}).
The build and run kit that you select determines which CMake tool is used To view all settings, select the \uicontrol Advanced check box.
for building. For more information, see \l {Adding Kits}.
To modify the value of a build setting, select it, and then select
\uicontrol Edit. The new value is displayed in italics until you save the
changes by selecting \uicontrol {Apply Configuration Changes}. Any
configuration change might trigger a follow-up configuration change, so keep
saving until no more values are displayed in italics.
You can add arguments and targets for the build command in
\uicontrol {Build Steps}.
\image qtcreator-cmake-build-steps.png
You can add arguments and targets for the clean command in
\uicontrol {Clean Steps}.
\image qtcreator-cmake-clean-steps.png
The build errors and warnings are parsed and displayed in the
\uicontrol Issues output pane.
\section1 Running CMake Projects \section1 Running CMake Projects
\QC automatically adds \uicontrol {Run Configurations} for all targets \QC automatically adds \uicontrol {Run Configurations} for all targets
specified in the CMake project file. specified in the CMake project file.
For more information about known issues for the current version, see \image qtcreator-cmake-run-settings.png
\l{Known Issues}.
To run CMake projects, select \uicontrol Run or press \key Ctrl+R (or
\key Cmd+R on OS X).
\section1 Deploying CMake Projects to Embedded Linux Devices \section1 Deploying CMake Projects to Embedded Linux Devices

View File

@@ -126,6 +126,16 @@
CMake tools to the list. For more information, see CMake tools to the list. For more information, see
\l{Adding CMake Tools}. \l{Adding CMake Tools}.
\li In the \uicontrol {CMake Generator} field, select the CMake
Generator to use for producing project files. Only the generators
with names beginning with the string \uicontrol CodeBlocks produce
all the necessary data for the \QC code model. \QC displays a
warning if you select a generator that is not supported.
\li In the \uicontrol {CMake configuration} field, select
\uicontrol Change to edit the variables of the CMake configuration
for the kit.
\endlist \endlist
*/ */

View File

@@ -426,7 +426,7 @@ def qdump__QFile(d, value):
if d.isWindowsTarget(): if d.isWindowsTarget():
offset = 164 if is32bit else 248 offset = 164 if is32bit else 248
else: else:
offset = 156 if is32bit else 248 offset = 164 if is32bit else 248
elif qtVersion >= 0x050400: elif qtVersion >= 0x050400:
if d.isWindowsTarget(): if d.isWindowsTarget():
offset = 188 if is32bit else 272 offset = 188 if is32bit else 272

File diff suppressed because it is too large Load Diff

View File

@@ -2277,6 +2277,14 @@ ImportInfo ImportInfo::implicitDirectoryImport(const QString &directory)
return info; return info;
} }
ImportInfo ImportInfo::qrcDirectoryImport(const QString &directory)
{
ImportInfo info;
info.m_type = ImportType::QrcDirectory;
info.m_path = directory;
return info;
}
bool ImportInfo::isValid() const bool ImportInfo::isValid() const
{ {
return m_type != ImportType::Invalid; return m_type != ImportType::Invalid;

View File

@@ -1001,6 +1001,7 @@ public:
const QString &as, AST::UiImport *ast = 0); const QString &as, AST::UiImport *ast = 0);
static ImportInfo invalidImport(AST::UiImport *ast = 0); static ImportInfo invalidImport(AST::UiImport *ast = 0);
static ImportInfo implicitDirectoryImport(const QString &directory); static ImportInfo implicitDirectoryImport(const QString &directory);
static ImportInfo qrcDirectoryImport(const QString &directory);
bool isValid() const; bool isValid() const;
ImportType::Enum type() const; ImportType::Enum type() const;

View File

@@ -575,16 +575,23 @@ void LinkPrivate::loadQmldirComponents(ObjectValue *import, ComponentVersion ver
void LinkPrivate::loadImplicitDirectoryImports(Imports *imports, Document::Ptr doc) void LinkPrivate::loadImplicitDirectoryImports(Imports *imports, Document::Ptr doc)
{ {
ImportInfo implcitDirectoryImportInfo = ImportInfo::implicitDirectoryImport(doc->path()); auto processImport = [this, imports, doc](const ImportInfo &importInfo){
Import directoryImport = importCache.value(ImportCacheKey(importInfo));
Import directoryImport = importCache.value(ImportCacheKey(implcitDirectoryImportInfo)); if (!directoryImport.object) {
if (!directoryImport.object) { directoryImport = importFileOrDirectory(doc, importInfo);
directoryImport = importFileOrDirectory(doc, implcitDirectoryImportInfo); if (directoryImport.object)
importCache.insert(ImportCacheKey(importInfo), directoryImport);
}
if (directoryImport.object) if (directoryImport.object)
importCache.insert(ImportCacheKey(implcitDirectoryImportInfo), directoryImport); imports->append(directoryImport);
};
processImport(ImportInfo::implicitDirectoryImport(doc->path()));
foreach (const QString &path,
ModelManagerInterface::instance()->qrcPathsForFile(doc->fileName())) {
processImport(ImportInfo::qrcDirectoryImport(
QrcParser::qrcDirectoryPathForQrcFilePath(path)));
} }
if (directoryImport.object)
imports->append(directoryImport);
} }
void LinkPrivate::loadImplicitDefaultImports(Imports *imports) void LinkPrivate::loadImplicitDefaultImports(Imports *imports)

View File

@@ -427,46 +427,10 @@ bool pInfoLessThanImports(const ModelManagerInterface::ProjectInfo &p1, const Mo
} }
QStringList ModelManagerInterface::filesAtQrcPath(const QString &path, const QLocale *locale, void ModelManagerInterface::iterateQrcFiles(ProjectExplorer::Project *project,
ProjectExplorer::Project *project, QrcResourceSelector resources,
QrcResourceSelector resources) std::function<void(QrcParser::ConstPtr)> callback)
{ {
QString normPath = QrcParser::normalizedQrcFilePath(path);
QList<ProjectInfo> pInfos;
if (project)
pInfos.append(projectInfo(project));
else
pInfos = projectInfos();
QStringList res;
QSet<QString> pathsChecked;
foreach (const ModelManagerInterface::ProjectInfo &pInfo, pInfos) {
QStringList qrcFilePaths;
if (resources == ActiveQrcResources)
qrcFilePaths = pInfo.activeResourceFiles;
else
qrcFilePaths = pInfo.allResourceFiles;
foreach (const QString &qrcFilePath, qrcFilePaths) {
if (pathsChecked.contains(qrcFilePath))
continue;
pathsChecked.insert(qrcFilePath);
QrcParser::ConstPtr qrcFile = m_qrcCache.parsedPath(qrcFilePath);
if (qrcFile.isNull())
continue;
qrcFile->collectFilesAtPath(normPath, &res, locale);
}
}
res.sort(); // make the result predictable
return res;
}
QMap<QString, QStringList> ModelManagerInterface::filesInQrcPath(const QString &path,
const QLocale *locale,
ProjectExplorer::Project *project,
bool addDirs,
QrcResourceSelector resources)
{
QString normPath = QrcParser::normalizedQrcDirectoryPath(path);
QList<ProjectInfo> pInfos; QList<ProjectInfo> pInfos;
if (project) { if (project) {
pInfos.append(projectInfo(project)); pInfos.append(projectInfo(project));
@@ -477,7 +441,7 @@ QMap<QString, QStringList> ModelManagerInterface::filesInQrcPath(const QString &
else else
qSort(pInfos.begin(), pInfos.end(), &pInfoLessThanAll); qSort(pInfos.begin(), pInfos.end(), &pInfoLessThanAll);
} }
QMap<QString, QStringList> res;
QSet<QString> pathsChecked; QSet<QString> pathsChecked;
foreach (const ModelManagerInterface::ProjectInfo &pInfo, pInfos) { foreach (const ModelManagerInterface::ProjectInfo &pInfo, pInfos) {
QStringList qrcFilePaths; QStringList qrcFilePaths;
@@ -490,12 +454,47 @@ QMap<QString, QStringList> ModelManagerInterface::filesInQrcPath(const QString &
continue; continue;
pathsChecked.insert(qrcFilePath); pathsChecked.insert(qrcFilePath);
QrcParser::ConstPtr qrcFile = m_qrcCache.parsedPath(qrcFilePath); QrcParser::ConstPtr qrcFile = m_qrcCache.parsedPath(qrcFilePath);
if (qrcFile.isNull()) if (qrcFile.isNull())
continue; continue;
qrcFile->collectFilesInPath(normPath, &res, addDirs, locale); callback(qrcFile);
} }
} }
}
QStringList ModelManagerInterface::qrcPathsForFile(const QString &file, const QLocale *locale,
ProjectExplorer::Project *project,
QrcResourceSelector resources)
{
QStringList res;
iterateQrcFiles(project, resources, [&](QrcParser::ConstPtr qrcFile) {
qrcFile->collectResourceFilesForSourceFile(file, &res, locale);
});
return res;
}
QStringList ModelManagerInterface::filesAtQrcPath(const QString &path, const QLocale *locale,
ProjectExplorer::Project *project,
QrcResourceSelector resources)
{
QString normPath = QrcParser::normalizedQrcFilePath(path);
QStringList res;
iterateQrcFiles(project, resources, [&](QrcParser::ConstPtr qrcFile) {
qrcFile->collectFilesAtPath(normPath, &res, locale);
});
return res;
}
QMap<QString, QStringList> ModelManagerInterface::filesInQrcPath(const QString &path,
const QLocale *locale,
ProjectExplorer::Project *project,
bool addDirs,
QrcResourceSelector resources)
{
QString normPath = QrcParser::normalizedQrcDirectoryPath(path);
QMap<QString, QStringList> res;
iterateQrcFiles(project, resources, [&](QrcParser::ConstPtr qrcFile) {
qrcFile->collectFilesInPath(normPath, &res, addDirs, locale);
});
return res; return res;
} }

View File

@@ -152,6 +152,9 @@ public:
bool emitDocumentOnDiskChanged); bool emitDocumentOnDiskChanged);
void fileChangedOnDisk(const QString &path); void fileChangedOnDisk(const QString &path);
void removeFiles(const QStringList &files); void removeFiles(const QStringList &files);
QStringList qrcPathsForFile(const QString &file, const QLocale *locale = 0,
ProjectExplorer::Project *project = 0,
QrcResourceSelector resources = AllQrcResources);
QStringList filesAtQrcPath(const QString &path, const QLocale *locale = 0, QStringList filesAtQrcPath(const QString &path, const QLocale *locale = 0,
ProjectExplorer::Project *project = 0, ProjectExplorer::Project *project = 0,
QrcResourceSelector resources = AllQrcResources); QrcResourceSelector resources = AllQrcResources);
@@ -249,6 +252,9 @@ protected:
private: private:
void cleanupFutures(); void cleanupFutures();
void iterateQrcFiles(ProjectExplorer::Project *project,
QrcResourceSelector resources,
std::function<void(QrcParser::ConstPtr)> callback);
mutable QMutex m_mutex; mutable QMutex m_mutex;
QmlJS::Snapshot m_validSnapshot; QmlJS::Snapshot m_validSnapshot;

View File

@@ -74,6 +74,9 @@ public:
bool hasDirAtPath(const QString &path, const QLocale *locale = 0) const; bool hasDirAtPath(const QString &path, const QLocale *locale = 0) const;
void collectFilesInPath(const QString &path, QMap<QString,QStringList> *res, bool addDirs = false, void collectFilesInPath(const QString &path, QMap<QString,QStringList> *res, bool addDirs = false,
const QLocale *locale = 0) const; const QLocale *locale = 0) const;
void collectResourceFilesForSourceFile(const QString &sourceFile, QStringList *res,
const QLocale *locale = 0) const;
QStringList errorMessages() const; QStringList errorMessages() const;
QStringList languages() const; QStringList languages() const;
private: private:
@@ -81,6 +84,7 @@ private:
QStringList allUiLanguages(const QLocale *locale) const; QStringList allUiLanguages(const QLocale *locale) const;
SMap m_resources; SMap m_resources;
SMap m_files;
QStringList m_languages; QStringList m_languages;
QStringList m_errorMessages; QStringList m_errorMessages;
}; };
@@ -130,6 +134,11 @@ QString QrcParser::normalizedQrcDirectoryPath(const QString &path) {
return normPath; return normPath;
} }
QString QrcParser::qrcDirectoryPathForQrcFilePath(const QString &file)
{
return file.left(file.lastIndexOf(QLatin1Char('/')));
}
QrcParser::QrcParser() QrcParser::QrcParser()
{ {
d = new Internal::QrcParserPrivate(this); d = new Internal::QrcParserPrivate(this);
@@ -181,6 +190,12 @@ void QrcParser::collectFilesInPath(const QString &path, QMap<QString,QStringList
d->collectFilesInPath(path, res, addDirs, locale); d->collectFilesInPath(path, res, addDirs, locale);
} }
void QrcParser::collectResourceFilesForSourceFile(const QString &sourceFile, QStringList *res,
const QLocale *locale) const
{
d->collectResourceFilesForSourceFile(sourceFile, res, locale);
}
/*! \brief returns the errors found while parsing /*! \brief returns the errors found while parsing
*/ */
QStringList QrcParser::errorMessages() const QStringList QrcParser::errorMessages() const
@@ -297,13 +312,12 @@ bool QrcParserPrivate::parseFile(const QString &path)
accessPath = language + prefix + alias; accessPath = language + prefix + alias;
else else
accessPath = language + prefix + fileName; accessPath = language + prefix + fileName;
if (m_resources.contains(accessPath)) { QStringList &resources = m_resources[accessPath];
QStringList &val = m_resources[accessPath]; if (!resources.contains(filePath))
if (!val.contains(filePath)) resources.append(filePath);
val.append(filePath); QStringList &files = m_files[filePath];
} else { if (!files.contains(accessPath))
m_resources.insert(accessPath, QStringList(filePath)); files.append(accessPath);
}
} }
} }
return true; return true;
@@ -388,6 +402,24 @@ void QrcParserPrivate::collectFilesInPath(const QString &path, QMap<QString,QStr
} }
} }
void QrcParserPrivate::collectResourceFilesForSourceFile(const QString &sourceFile,
QStringList *results,
const QLocale *locale) const
{
QTC_CHECK(sourceFile.startsWith(QLatin1Char('/')));
QTC_CHECK(!sourceFile.endsWith(QLatin1Char('/')));
QStringList langs = allUiLanguages(locale);
SMap::const_iterator file = m_files.find(sourceFile);
if (file == m_files.end())
return;
foreach (const QString &resource, file.value()) {
foreach (const QString &language, langs) {
if (resource.startsWith(language) && !results->contains(resource))
results->append(resource);
}
}
}
QStringList QrcParserPrivate::errorMessages() const QStringList QrcParserPrivate::errorMessages() const
{ {
return m_errorMessages; return m_errorMessages;

View File

@@ -52,6 +52,9 @@ public:
bool hasDirAtPath(const QString &path, const QLocale *locale = 0) const; bool hasDirAtPath(const QString &path, const QLocale *locale = 0) const;
void collectFilesInPath(const QString &path, QMap<QString,QStringList> *res, bool addDirs = false, void collectFilesInPath(const QString &path, QMap<QString,QStringList> *res, bool addDirs = false,
const QLocale *locale = 0) const; const QLocale *locale = 0) const;
void collectResourceFilesForSourceFile(const QString &sourceFile, QStringList *results,
const QLocale *locale = 0) const;
QStringList errorMessages() const; QStringList errorMessages() const;
QStringList languages() const; QStringList languages() const;
bool isValid() const; bool isValid() const;
@@ -59,6 +62,7 @@ public:
static Ptr parseQrcFile(const QString &path); static Ptr parseQrcFile(const QString &path);
static QString normalizedQrcFilePath(const QString &path); static QString normalizedQrcFilePath(const QString &path);
static QString normalizedQrcDirectoryPath(const QString &path); static QString normalizedQrcDirectoryPath(const QString &path);
static QString qrcDirectoryPathForQrcFilePath(const QString &file);
private: private:
QrcParser(); QrcParser();
QrcParser(const QrcParser &); QrcParser(const QrcParser &);

View File

@@ -275,7 +275,7 @@ extern "C" HRESULT CALLBACK pid(CIDebugClient *client, PCSTR args)
int token; int token;
commandTokens<StringList>(args, &token); commandTokens<StringList>(args, &token);
dprintf("Qt Creator CDB extension version 3.6 %d bit.\n", dprintf("Qt Creator CDB extension version 4.0 %d bit.\n",
sizeof(void *) * 8); sizeof(void *) * 8);
if (const ULONG pid = currentProcessId(client)) if (const ULONG pid = currentProcessId(client))
ExtensionContext::instance().report('R', token, 0, "pid", "%u", pid); ExtensionContext::instance().report('R', token, 0, "pid", "%u", pid);

View File

@@ -38,6 +38,9 @@
namespace Utils { namespace Utils {
static const qreal PunchEdgeWidth = 0.5;
static const qreal PunchEdgeIntensity = 0.6;
static QPixmap maskToColorAndAlpha(const QPixmap &mask, const QColor &color) static QPixmap maskToColorAndAlpha(const QPixmap &mask, const QColor &color)
{ {
QImage result(mask.toImage().convertToFormat(QImage::Format_ARGB32)); QImage result(mask.toImage().convertToFormat(QImage::Format_ARGB32));
@@ -95,9 +98,9 @@ static QPixmap combinedMask(const MasksAndColors &masks, Icon::IconStyleOptions
for (;maskImage != masks.constEnd(); ++maskImage) { for (;maskImage != masks.constEnd(); ++maskImage) {
if (style & Icon::PunchEdges) { if (style & Icon::PunchEdges) {
p.save(); p.save();
p.setOpacity(0.4); p.setOpacity(PunchEdgeIntensity);
p.setCompositionMode(QPainter::CompositionMode_Lighten); p.setCompositionMode(QPainter::CompositionMode_Lighten);
smearPixmap(&p, maskToColorAndAlpha((*maskImage).first, Qt::white), 0.5); smearPixmap(&p, maskToColorAndAlpha((*maskImage).first, Qt::white), PunchEdgeWidth);
p.restore(); p.restore();
} }
p.drawPixmap(0, 0, (*maskImage).first); p.drawPixmap(0, 0, (*maskImage).first);
@@ -118,9 +121,9 @@ static QPixmap masksToIcon(const MasksAndColors &masks, const QPixmap &combinedM
if (style & Icon::PunchEdges && maskImage != masks.constBegin()) { if (style & Icon::PunchEdges && maskImage != masks.constBegin()) {
// Punch a transparent outline around an overlay. // Punch a transparent outline around an overlay.
p.save(); p.save();
p.setOpacity(0.4); p.setOpacity(PunchEdgeIntensity);
p.setCompositionMode(QPainter::CompositionMode_DestinationOut); p.setCompositionMode(QPainter::CompositionMode_DestinationOut);
smearPixmap(&p, maskToColorAndAlpha((*maskImage).first, Qt::white), 0.5); smearPixmap(&p, maskToColorAndAlpha((*maskImage).first, Qt::white), PunchEdgeWidth);
p.restore(); p.restore();
} }
p.drawPixmap(0, 0, maskToColorAndAlpha((*maskImage).first, (*maskImage).second)); p.drawPixmap(0, 0, maskToColorAndAlpha((*maskImage).first, (*maskImage).second));

View File

@@ -46,13 +46,13 @@ inline void deallocate(char *memory)
#ifdef WIN32 #ifdef WIN32
_aligned_free(memory); _aligned_free(memory);
#else #else
#if defined(__GNUC__) && !defined(__clang__)
#pragma GCC diagnostic push #pragma GCC diagnostic push
#if defined(__GNUC__) && !defined(__clang__)
#pragma GCC diagnostic ignored "-Wfree-nonheap-object" #pragma GCC diagnostic ignored "-Wfree-nonheap-object"
#endif
std::free(memory); std::free(memory);
#pragma GCC diagnostic pop #pragma GCC diagnostic pop
#endif #endif
#endif
} }
inline char *reallocate(char *oldMemory, std::size_t newSize) inline char *reallocate(char *oldMemory, std::size_t newSize)

View File

@@ -286,20 +286,14 @@ void StyleHelper::drawArrow(QStyle::PrimitiveElement element, QPainter *painter,
return; return;
const qreal devicePixelRatio = painter->device()->devicePixelRatio(); const qreal devicePixelRatio = painter->device()->devicePixelRatio();
const bool enabled = option->state & QStyle::State_Enabled;
QRect r = option->rect; QRect r = option->rect;
int size = qMin(r.height(), r.width()); int size = qMin(r.height(), r.width());
QPixmap pixmap; QPixmap pixmap;
QString pixmapName; QString pixmapName;
pixmapName.sprintf("arrow-%s-%d-%d-%d-%lld-%f", pixmapName.sprintf("StyleHelper::drawArrow-%d-%d-%d-%f",
"$qt_ia", element, size, enabled, devicePixelRatio);
uint(option->state), element,
size, option->palette.cacheKey(),
devicePixelRatio);
if (!QPixmapCache::find(pixmapName, pixmap)) { if (!QPixmapCache::find(pixmapName, pixmap)) {
const QCommonStyle* const style = qobject_cast<QCommonStyle*>(QApplication::style());
if (!style)
return;
QImage image(size * devicePixelRatio, size * devicePixelRatio, QImage::Format_ARGB32_Premultiplied); QImage image(size * devicePixelRatio, size * devicePixelRatio, QImage::Format_ARGB32_Premultiplied);
image.fill(Qt::transparent); image.fill(Qt::transparent);
QPainter painter(&image); QPainter painter(&image);
@@ -307,20 +301,22 @@ void StyleHelper::drawArrow(QStyle::PrimitiveElement element, QPainter *painter,
QStyleOption tweakedOption(*option); QStyleOption tweakedOption(*option);
tweakedOption.state = QStyle::State_Enabled; tweakedOption.state = QStyle::State_Enabled;
if (!(option->state & QStyle::State_Enabled)) { auto drawCommonStyleArrow = [&tweakedOption, element, &painter](const QRect &rect, const QColor &color) -> void
tweakedOption.palette.setColor(QPalette::ButtonText, option->palette.mid().color()); {
tweakedOption.rect = image.rect(); static const QCommonStyle* const style = qobject_cast<QCommonStyle*>(QApplication::style());
style->QCommonStyle::drawPrimitive(element, &tweakedOption, &painter); if (!style)
} else { return;
tweakedOption.palette.setColor(QPalette::ButtonText, Qt::black); tweakedOption.palette.setColor(QPalette::ButtonText, color.rgb());
painter.setOpacity(0.2); tweakedOption.rect = rect;
tweakedOption.rect = image.rect().adjusted(0, devicePixelRatio, 0, devicePixelRatio); painter.setOpacity(color.alphaF());
style->QCommonStyle::drawPrimitive(element, &tweakedOption, &painter); style->QCommonStyle::drawPrimitive(element, &tweakedOption, &painter);
};
tweakedOption.palette.setColor(QPalette::ButtonText, QColor(220, 220, 220)); if (!enabled) {
painter.setOpacity(1); drawCommonStyleArrow(image.rect(), creatorTheme()->color(Theme::IconsDisabledColor));
tweakedOption.rect = image.rect(); } else {
style->QCommonStyle::drawPrimitive(element, &tweakedOption, &painter); drawCommonStyleArrow(image.rect().translated(0, devicePixelRatio), toolBarDropShadowColor());
drawCommonStyleArrow(image.rect(), creatorTheme()->color(Theme::IconsBaseColor));
} }
painter.end(); painter.end();
pixmap = QPixmap::fromImage(image); pixmap = QPixmap::fromImage(image);

View File

@@ -65,6 +65,8 @@ public:
static QColor sidebarHighlight() { return QColor(255, 255, 255, 40); } static QColor sidebarHighlight() { return QColor(255, 255, 255, 40); }
static QColor sidebarShadow() { return QColor(0, 0, 0, 40); } static QColor sidebarShadow() { return QColor(0, 0, 0, 40); }
static QColor toolBarDropShadowColor() { return QColor(0, 0, 0, 70); }
static QColor notTooBrightHighlightColor(); static QColor notTooBrightHighlightColor();
// Sets the base color and makes sure all top level widgets are updated // Sets the base color and makes sure all top level widgets are updated

View File

@@ -234,7 +234,7 @@ void AndroidToolChain::setSecondaryToolChain(bool b)
m_secondaryToolChain = b; m_secondaryToolChain = b;
} }
QList<Abi> AndroidToolChain::detectSupportedAbis() const GccToolChain::DetectedAbisResult AndroidToolChain::detectSupportedAbis() const
{ {
return QList<Abi>() << targetAbi(); return QList<Abi>() << targetAbi();
} }

View File

@@ -59,7 +59,7 @@ public:
void setSecondaryToolChain(bool b); void setSecondaryToolChain(bool b);
protected: protected:
QList<ProjectExplorer::Abi> detectSupportedAbis() const override; DetectedAbisResult detectSupportedAbis() const override;
private: private:
explicit AndroidToolChain(const ProjectExplorer::Abi &abi, const QString &ndkToolChainVersion, Detection d); explicit AndroidToolChain(const ProjectExplorer::Abi &abi, const QString &ndkToolChainVersion, Detection d);

View File

@@ -284,9 +284,10 @@ static QString quickTestSrcDir(const CppTools::CppModelManager *cppMM,
return QString(); return QString();
} }
static QString testClass(const CppTools::CppModelManager *modelManager, static QString testClass(const CppTools::CppModelManager *modelManager, const QString &fileName)
CPlusPlus::Document::Ptr &document)
{ {
const QByteArray &fileContent = getFileContent(fileName);
CPlusPlus::Document::Ptr document = modelManager->document(fileName);
const QList<CPlusPlus::Document::MacroUse> macros = document->macroUses(); const QList<CPlusPlus::Document::MacroUse> macros = document->macroUses();
foreach (const CPlusPlus::Document::MacroUse &macro, macros) { foreach (const CPlusPlus::Document::MacroUse &macro, macros) {
@@ -295,14 +296,13 @@ static QString testClass(const CppTools::CppModelManager *modelManager,
const QByteArray name = macro.macro().name(); const QByteArray name = macro.macro().name();
if (TestUtils::isQTestMacro(name)) { if (TestUtils::isQTestMacro(name)) {
const CPlusPlus::Document::Block arg = macro.arguments().at(0); const CPlusPlus::Document::Block arg = macro.arguments().at(0);
return QLatin1String(getFileContent(document->fileName()) return QLatin1String(fileContent.mid(arg.bytesBegin(),
.mid(arg.bytesBegin(), arg.bytesEnd() - arg.bytesBegin())); arg.bytesEnd() - arg.bytesBegin()));
} }
} }
// check if one has used a self-defined macro or QTest::qExec() directly // check if one has used a self-defined macro or QTest::qExec() directly
const CPlusPlus::Snapshot snapshot = modelManager->snapshot(); const CPlusPlus::Snapshot snapshot = modelManager->snapshot();
const QByteArray fileContent = getFileContent(document->fileName()); document = snapshot.preprocessedDocument(fileContent, fileName);
document = snapshot.preprocessedDocument(fileContent, document->fileName());
document->check(); document->check();
CPlusPlus::AST *ast = document->translationUnit()->ast(); CPlusPlus::AST *ast = document->translationUnit()->ast();
TestAstVisitor astVisitor(document); TestAstVisitor astVisitor(document);
@@ -523,7 +523,7 @@ static void checkDocumentForTestCode(QFutureInterface<TestParseResult> futureInt
} else if (testCaseNames.contains(fileName) // if we do a reparse } else if (testCaseNames.contains(fileName) // if we do a reparse
|| (includesQtTest(document, modelManager) || (includesQtTest(document, modelManager)
&& qtTestLibDefined(modelManager, fileName))) { && qtTestLibDefined(modelManager, fileName))) {
QString testCaseName(testClass(modelManager, document)); QString testCaseName(testClass(modelManager, fileName));
// we might be in a reparse without the original entry point with the QTest::qExec() // we might be in a reparse without the original entry point with the QTest::qExec()
if (testCaseName.isEmpty()) if (testCaseName.isEmpty())
testCaseName = testCaseNames.value(fileName); testCaseName = testCaseNames.value(fileName);
@@ -537,6 +537,10 @@ static void checkDocumentForTestCode(QFutureInterface<TestParseResult> futureInt
TestVisitor visitor(testCaseName); TestVisitor visitor(testCaseName);
visitor.accept(declaringDoc->globalNamespace()); visitor.accept(declaringDoc->globalNamespace());
if (!visitor.resultValid())
return;
const QMap<QString, TestCodeLocationAndType> testFunctions = visitor.privateSlots(); const QMap<QString, TestCodeLocationAndType> testFunctions = visitor.privateSlots();
QMap<QString, TestCodeLocationList> dataTags = QMap<QString, TestCodeLocationList> dataTags =

View File

@@ -77,7 +77,7 @@ TestNavigationWidget::TestNavigationWidget(QWidget *parent) :
m_progressTimer = new QTimer(this); m_progressTimer = new QTimer(this);
m_progressTimer->setSingleShot(true); m_progressTimer->setSingleShot(true);
m_progressTimer->setInterval(100); // don't display indicator if progress takes less than 100ms m_progressTimer->setInterval(1000); // don't display indicator if progress takes less than 1s
connect(m_model->parser(), &TestCodeParser::parsingStarted, connect(m_model->parser(), &TestCodeParser::parsingStarted,
this, &TestNavigationWidget::onParsingStarted); this, &TestNavigationWidget::onParsingStarted);

View File

@@ -47,7 +47,7 @@ static const int defaultTimeout = 60000;
TestSettings::TestSettings() TestSettings::TestSettings()
: timeout(defaultTimeout), metrics(Walltime), omitInternalMssg(true), omitRunConfigWarn(false), : timeout(defaultTimeout), metrics(Walltime), omitInternalMssg(true), omitRunConfigWarn(false),
limitResultOutput(true), autoScroll(true), alwaysParse(false) limitResultOutput(true), autoScroll(true), alwaysParse(true)
{ {
} }
@@ -96,7 +96,7 @@ void TestSettings::fromSettings(const QSettings *s)
omitRunConfigWarn = s->value(root + QLatin1String(omitRunConfigWarnKey), false).toBool(); omitRunConfigWarn = s->value(root + QLatin1String(omitRunConfigWarnKey), false).toBool();
limitResultOutput = s->value(root + QLatin1String(limitResultOutputKey), true).toBool(); limitResultOutput = s->value(root + QLatin1String(limitResultOutputKey), true).toBool();
autoScroll = s->value(root + QLatin1String(autoScrollKey), true).toBool(); autoScroll = s->value(root + QLatin1String(autoScrollKey), true).toBool();
alwaysParse = s->value(root + QLatin1String(alwaysParseKey), false).toBool(); alwaysParse = s->value(root + QLatin1String(alwaysParseKey), true).toBool();
gtestRunDisabled = s->value(root + QLatin1String(gtestRunDisabledKey), false).toBool(); gtestRunDisabled = s->value(root + QLatin1String(gtestRunDisabledKey), false).toBool();
gtestRepeat = s->value(root + QLatin1String(gtestRepeatKey), false).toBool(); gtestRepeat = s->value(root + QLatin1String(gtestRepeatKey), false).toBool();
gtestShuffle = s->value(root + QLatin1String(gtestShuffleKey), false).toBool(); gtestShuffle = s->value(root + QLatin1String(gtestShuffleKey), false).toBool();

View File

@@ -73,6 +73,8 @@ bool TestVisitor::visit(CPlusPlus::Class *symbol)
if (className != m_className) if (className != m_className)
continue; continue;
m_valid = true;
if (const auto func = type->asFunctionType()) { if (const auto func = type->asFunctionType()) {
if (func->isSlot() && member->isPrivate()) { if (func->isSlot() && member->isPrivate()) {
const QString name = o.prettyName(func->name()); const QString name = o.prettyName(func->name());

View File

@@ -51,6 +51,7 @@ public:
virtual ~TestVisitor(); virtual ~TestVisitor();
QMap<QString, TestCodeLocationAndType> privateSlots() const { return m_privSlots; } QMap<QString, TestCodeLocationAndType> privateSlots() const { return m_privSlots; }
bool resultValid() const { return m_valid; }
bool visit(CPlusPlus::Class *symbol); bool visit(CPlusPlus::Class *symbol);
@@ -58,6 +59,7 @@ private:
CppTools::SymbolFinder m_symbolFinder; CppTools::SymbolFinder m_symbolFinder;
QString m_className; QString m_className;
QMap<QString, TestCodeLocationAndType> m_privSlots; QMap<QString, TestCodeLocationAndType> m_privSlots;
bool m_valid = false;
}; };
class TestAstVisitor : public CPlusPlus::ASTVisitor class TestAstVisitor : public CPlusPlus::ASTVisitor

View File

@@ -59,7 +59,6 @@
#include <QProcess> #include <QProcess>
#include <QScrollBar> #include <QScrollBar>
#include <QTextBlock> #include <QTextBlock>
#include <QTimer>
#include <QtPlugin> #include <QtPlugin>
using namespace TextEditor; using namespace TextEditor;
@@ -179,6 +178,7 @@ bool BeautifierPlugin::initialize(const QStringList &arguments, QString *errorSt
Core::ActionContainer *menu = Core::ActionManager::createMenu(Constants::MENU_ID); Core::ActionContainer *menu = Core::ActionManager::createMenu(Constants::MENU_ID);
menu->menu()->setTitle(QCoreApplication::translate("Beautifier", Constants::OPTION_TR_CATEGORY)); menu->menu()->setTitle(QCoreApplication::translate("Beautifier", Constants::OPTION_TR_CATEGORY));
menu->setOnAllDisabledBehavior(Core::ActionContainer::Show);
Core::ActionManager::actionContainer(Core::Constants::M_TOOLS)->addMenu(menu); Core::ActionManager::actionContainer(Core::Constants::M_TOOLS)->addMenu(menu);
foreach (BeautifierAbstractTool *tool, m_tools) { foreach (BeautifierAbstractTool *tool, m_tools) {
@@ -188,9 +188,7 @@ bool BeautifierPlugin::initialize(const QStringList &arguments, QString *errorSt
addAutoReleasedObject(object); addAutoReleasedObject(object);
} }
// The single shot is needed, otherwise the menu will stay disabled even updateActions();
// when the submenu's actions get enabled later on.
QTimer::singleShot(0, this, SLOT(updateActions()));
return true; return true;
} }

View File

@@ -280,7 +280,6 @@ IAssistProposal *ClangCompletionAssistProcessor::startCompletionHelper()
return 0; return 0;
} }
// TODO: Extract duplicated logic from InternalCppCompletionAssistProcessor::startOfOperator
int ClangCompletionAssistProcessor::startOfOperator(int positionInDocument, int ClangCompletionAssistProcessor::startOfOperator(int positionInDocument,
unsigned *kind, unsigned *kind,
bool wantFunctionCall) const bool wantFunctionCall) const
@@ -291,96 +290,13 @@ int ClangCompletionAssistProcessor::startOfOperator(int positionInDocument,
wantFunctionCall); wantFunctionCall);
*kind = activationSequenceProcessor.completionKind(); *kind = activationSequenceProcessor.completionKind();
int start = activationSequenceProcessor.operatorStartPosition(); int start = activationSequenceProcessor.operatorStartPosition();
if (start != positionInDocument) {
QTextCursor tc(m_interface->textDocument());
tc.setPosition(positionInDocument);
// Include completion: make sure the quote character is the first one on the line CppCompletionAssistProcessor::startOfOperator(m_interface->textDocument(),
if (*kind == T_STRING_LITERAL) { positionInDocument,
QTextCursor s = tc; kind,
s.movePosition(QTextCursor::StartOfLine, QTextCursor::KeepAnchor); start,
QString sel = s.selectedText(); m_interface->languageFeatures());
if (sel.indexOf(QLatin1Char('"')) < sel.length() - 1) {
*kind = T_EOF_SYMBOL;
start = positionInDocument;
}
}
if (*kind == T_COMMA) {
ExpressionUnderCursor expressionUnderCursor(m_interface->languageFeatures());
if (expressionUnderCursor.startOfFunctionCall(tc) == -1) {
*kind = T_EOF_SYMBOL;
start = positionInDocument;
}
}
SimpleLexer tokenize;
tokenize.setLanguageFeatures(m_interface->languageFeatures());
tokenize.setSkipComments(false);
const Tokens &tokens = tokenize(tc.block().text(), BackwardsScanner::previousBlockState(tc.block()));
const int tokenIdx = SimpleLexer::tokenBefore(tokens, qMax(0, tc.positionInBlock() - 1)); // get the token at the left of the cursor
const Token tk = (tokenIdx == -1) ? Token() : tokens.at(tokenIdx);
if (*kind == T_DOXY_COMMENT && !(tk.is(T_DOXY_COMMENT) || tk.is(T_CPP_DOXY_COMMENT))) {
*kind = T_EOF_SYMBOL;
start = positionInDocument;
}
// Don't complete in comments or strings, but still check for include completion
else if (tk.is(T_COMMENT) || tk.is(T_CPP_COMMENT)
|| tk.is(T_CPP_DOXY_COMMENT) || tk.is(T_DOXY_COMMENT)
|| (tk.isLiteral() && (*kind != T_STRING_LITERAL
&& *kind != T_ANGLE_STRING_LITERAL
&& *kind != T_SLASH))) {
*kind = T_EOF_SYMBOL;
start = positionInDocument;
}
// Include completion: can be triggered by slash, but only in a string
else if (*kind == T_SLASH && (tk.isNot(T_STRING_LITERAL) && tk.isNot(T_ANGLE_STRING_LITERAL))) {
*kind = T_EOF_SYMBOL;
start = positionInDocument;
}
else if (*kind == T_LPAREN) {
if (tokenIdx > 0) {
const Token &previousToken = tokens.at(tokenIdx - 1); // look at the token at the left of T_LPAREN
switch (previousToken.kind()) {
case T_IDENTIFIER:
case T_GREATER:
case T_SIGNAL:
case T_SLOT:
break; // good
default:
// that's a bad token :)
*kind = T_EOF_SYMBOL;
start = positionInDocument;
}
}
}
// Check for include preprocessor directive
else if (*kind == T_STRING_LITERAL || *kind == T_ANGLE_STRING_LITERAL || *kind == T_SLASH) {
bool include = false;
if (tokens.size() >= 3) {
if (tokens.at(0).is(T_POUND) && tokens.at(1).is(T_IDENTIFIER) && (tokens.at(2).is(T_STRING_LITERAL) ||
tokens.at(2).is(T_ANGLE_STRING_LITERAL))) {
const Token &directiveToken = tokens.at(1);
QString directive = tc.block().text().mid(directiveToken.bytesBegin(),
directiveToken.bytes());
if (directive == QLatin1String("include") ||
directive == QLatin1String("include_next") ||
directive == QLatin1String("import")) {
include = true;
}
}
}
if (!include) {
*kind = T_EOF_SYMBOL;
start = positionInDocument;
}
}
}
return start; return start;
} }

View File

@@ -80,6 +80,7 @@ ClangStaticAnalyzerRunControl::ClangStaticAnalyzerRunControl(
BuildConfiguration *buildConfiguration = target->activeBuildConfiguration(); BuildConfiguration *buildConfiguration = target->activeBuildConfiguration();
QTC_ASSERT(buildConfiguration, return); QTC_ASSERT(buildConfiguration, return);
m_environment = buildConfiguration->environment(); m_environment = buildConfiguration->environment();
m_targetTriple = ToolChainKitInformation::toolChain(target->kit())->originalTargetTriple();
} }
static void prependWordWidthArgumentIfNotIncluded(QStringList *arguments, unsigned char wordWidth) static void prependWordWidthArgumentIfNotIncluded(QStringList *arguments, unsigned char wordWidth)
@@ -96,11 +97,29 @@ static void prependWordWidthArgumentIfNotIncluded(QStringList *arguments, unsign
QTC_CHECK(!arguments->contains(m32Argument) || !arguments->contains(m64Argument)); QTC_CHECK(!arguments->contains(m32Argument) || !arguments->contains(m64Argument));
} }
static void prependTargetTripleIfNotIncludedAndNotEmpty(QStringList *arguments,
const QString &targetTriple)
{
QTC_ASSERT(arguments, return);
if (targetTriple.isEmpty())
return;
const QString targetOption = QLatin1String("-target");
if (!arguments->contains(targetOption)) {
arguments->prepend(targetTriple);
arguments->prepend(targetOption);
}
}
// Removes (1) filePath (2) -o <somePath>. // Removes (1) filePath (2) -o <somePath>.
// Adds -m64/-m32 argument if not already included. // Prepends -m64/-m32 argument if not already included.
// Prepends -target if not already included.
static QStringList tweakedArguments(const QString &filePath, static QStringList tweakedArguments(const QString &filePath,
const QStringList &arguments, const QStringList &arguments,
unsigned char wordWidth) unsigned char wordWidth,
const QString &targetTriple)
{ {
QStringList newArguments; QStringList newArguments;
@@ -121,6 +140,7 @@ static QStringList tweakedArguments(const QString &filePath,
QTC_CHECK(skip == false); QTC_CHECK(skip == false);
prependWordWidthArgumentIfNotIncluded(&newArguments, wordWidth); prependWordWidthArgumentIfNotIncluded(&newArguments, wordWidth);
prependTargetTripleIfNotIncludedAndNotEmpty(&newArguments, targetTriple);
return newArguments; return newArguments;
} }
@@ -147,7 +167,8 @@ class ClangStaticAnalyzerOptionsBuilder : public CompilerOptionsBuilder
public: public:
static QStringList build(const CppTools::ProjectPart &projectPart, static QStringList build(const CppTools::ProjectPart &projectPart,
CppTools::ProjectFile::Kind fileKind, CppTools::ProjectFile::Kind fileKind,
unsigned char wordWidth) unsigned char wordWidth,
const QString &targetTriple)
{ {
ClangStaticAnalyzerOptionsBuilder optionsBuilder(projectPart); ClangStaticAnalyzerOptionsBuilder optionsBuilder(projectPart);
optionsBuilder.addLanguageOption(fileKind); optionsBuilder.addLanguageOption(fileKind);
@@ -172,6 +193,8 @@ public:
QStringList options = optionsBuilder.options(); QStringList options = optionsBuilder.options();
prependWordWidthArgumentIfNotIncluded(&options, wordWidth); prependWordWidthArgumentIfNotIncluded(&options, wordWidth);
prependTargetTripleIfNotIncludedAndNotEmpty(&options, targetTriple);
return options; return options;
} }
@@ -217,7 +240,8 @@ private:
static AnalyzeUnits unitsToAnalyzeFromCompilerCallData( static AnalyzeUnits unitsToAnalyzeFromCompilerCallData(
const ProjectInfo::CompilerCallData &compilerCallData, const ProjectInfo::CompilerCallData &compilerCallData,
unsigned char wordWidth) unsigned char wordWidth,
const QString &targetTriple)
{ {
qCDebug(LOG) << "Taking arguments for analyzing from CompilerCallData."; qCDebug(LOG) << "Taking arguments for analyzing from CompilerCallData.";
@@ -229,7 +253,7 @@ static AnalyzeUnits unitsToAnalyzeFromCompilerCallData(
const QString file = it.key(); const QString file = it.key();
const QList<QStringList> compilerCalls = it.value(); const QList<QStringList> compilerCalls = it.value();
foreach (const QStringList &options, compilerCalls) { foreach (const QStringList &options, compilerCalls) {
const QStringList arguments = tweakedArguments(file, options, wordWidth); const QStringList arguments = tweakedArguments(file, options, wordWidth, targetTriple);
unitsToAnalyze << AnalyzeUnit(file, arguments); unitsToAnalyze << AnalyzeUnit(file, arguments);
} }
} }
@@ -238,7 +262,8 @@ static AnalyzeUnits unitsToAnalyzeFromCompilerCallData(
} }
static AnalyzeUnits unitsToAnalyzeFromProjectParts(const QList<ProjectPart::Ptr> projectParts, static AnalyzeUnits unitsToAnalyzeFromProjectParts(const QList<ProjectPart::Ptr> projectParts,
unsigned char wordWidth) unsigned char wordWidth,
const QString &targetTriple)
{ {
qCDebug(LOG) << "Taking arguments for analyzing from ProjectParts."; qCDebug(LOG) << "Taking arguments for analyzing from ProjectParts.";
@@ -256,7 +281,8 @@ static AnalyzeUnits unitsToAnalyzeFromProjectParts(const QList<ProjectPart::Ptr>
const QStringList arguments const QStringList arguments
= ClangStaticAnalyzerOptionsBuilder::build(*projectPart.data(), = ClangStaticAnalyzerOptionsBuilder::build(*projectPart.data(),
file.kind, file.kind,
wordWidth); wordWidth,
targetTriple);
unitsToAnalyze << AnalyzeUnit(file.path, arguments); unitsToAnalyze << AnalyzeUnit(file.path, arguments);
} }
} }
@@ -273,9 +299,12 @@ AnalyzeUnits ClangStaticAnalyzerRunControl::sortedUnitsToAnalyze()
const ProjectInfo::CompilerCallData compilerCallData = m_projectInfo.compilerCallData(); const ProjectInfo::CompilerCallData compilerCallData = m_projectInfo.compilerCallData();
if (compilerCallData.isEmpty()) { if (compilerCallData.isEmpty()) {
units = unitsToAnalyzeFromProjectParts(m_projectInfo.projectParts(), units = unitsToAnalyzeFromProjectParts(m_projectInfo.projectParts(),
m_wordWidth); m_wordWidth,
m_targetTriple);
} else { } else {
units = unitsToAnalyzeFromCompilerCallData(compilerCallData, m_wordWidth); units = unitsToAnalyzeFromCompilerCallData(compilerCallData,
m_wordWidth,
m_targetTriple);
} }
Utils::sort(units, [](const AnalyzeUnit &a1, const AnalyzeUnit &a2) -> bool { Utils::sort(units, [](const AnalyzeUnit &a1, const AnalyzeUnit &a2) -> bool {

View File

@@ -82,6 +82,7 @@ private:
private: private:
const CppTools::ProjectInfo m_projectInfo; const CppTools::ProjectInfo m_projectInfo;
const unsigned char m_wordWidth; const unsigned char m_wordWidth;
QString m_targetTriple;
Utils::Environment m_environment; Utils::Environment m_environment;
QString m_clangExecutable; QString m_clangExecutable;

View File

@@ -280,7 +280,9 @@ CMakeConfig BuildDirManager::parsedConfiguration() const
CMakeConfig result = parseConfiguration(cacheFile, &errorMessage); CMakeConfig result = parseConfiguration(cacheFile, &errorMessage);
if (!errorMessage.isEmpty()) if (!errorMessage.isEmpty())
emit errorOccured(errorMessage); emit errorOccured(errorMessage);
if (CMakeConfigItem::valueOf("CMAKE_HOME_DIRECTORY", result) != sourceDirectory().toString().toUtf8()) const Utils::FileName sourceOfBuildDir
= Utils::FileName::fromUtf8(CMakeConfigItem::valueOf("CMAKE_HOME_DIRECTORY", result));
if (sourceOfBuildDir != sourceDirectory()) // Use case-insensitive compare where appropriate
emit errorOccured(tr("The build directory is not for %1").arg(sourceDirectory().toUserOutput())); emit errorOccured(tr("The build directory is not for %1").arg(sourceDirectory().toUserOutput()));
return result; return result;
@@ -605,8 +607,10 @@ void BuildDirManager::maybeForceReparse()
const QByteArray EXTRA_GENERATOR_KEY = "CMAKE_EXTRA_GENERATOR"; const QByteArray EXTRA_GENERATOR_KEY = "CMAKE_EXTRA_GENERATOR";
const QByteArray CMAKE_COMMAND_KEY = "CMAKE_COMMAND"; const QByteArray CMAKE_COMMAND_KEY = "CMAKE_COMMAND";
if (!m_hasData) if (!m_hasData) {
forceReparse();
return; return;
}
const CMakeConfig currentConfig = parsedConfiguration(); const CMakeConfig currentConfig = parsedConfiguration();

View File

@@ -63,33 +63,7 @@ const char CONFIGURATION_KEY[] = "CMake.Configuration";
CMakeBuildConfiguration::CMakeBuildConfiguration(ProjectExplorer::Target *parent) : CMakeBuildConfiguration::CMakeBuildConfiguration(ProjectExplorer::Target *parent) :
BuildConfiguration(parent, Core::Id(Constants::CMAKE_BC_ID)) BuildConfiguration(parent, Core::Id(Constants::CMAKE_BC_ID))
{ {
auto project = static_cast<CMakeProject *>(parent->project()); ctor();
setBuildDirectory(shadowBuildDirectory(project->projectFilePath(),
parent->kit(),
displayName(), BuildConfiguration::Unknown));
m_buildDirManager = new BuildDirManager(this);
connect(m_buildDirManager, &BuildDirManager::dataAvailable,
this, &CMakeBuildConfiguration::dataAvailable);
connect(m_buildDirManager, &BuildDirManager::errorOccured,
this, &CMakeBuildConfiguration::setError);
connect(m_buildDirManager, &BuildDirManager::configurationStarted,
this, [this]() { m_completeConfigurationCache.clear(); emit parsingStarted(); });
connect(this, &CMakeBuildConfiguration::environmentChanged,
m_buildDirManager, &BuildDirManager::forceReparse);
connect(this, &CMakeBuildConfiguration::buildDirectoryChanged,
m_buildDirManager, &BuildDirManager::forceReparse);
connect(target(), &Target::kitChanged, this, [this]() {
ProjectExplorer::Kit *k = target()->kit();
CMakeConfig config = cmakeConfiguration();
config.append(CMakeConfigurationKitInformation::configuration(k)); // last value wins...
setCMakeConfiguration(config);
m_buildDirManager->maybeForceReparse();
});
connect(this, &CMakeBuildConfiguration::parsingStarted, project, &CMakeProject::handleParsingStarted);
connect(this, &CMakeBuildConfiguration::dataAvailable, project, &CMakeProject::parseCMakeOutput);
} }
CMakeBuildConfiguration::~CMakeBuildConfiguration() CMakeBuildConfiguration::~CMakeBuildConfiguration()
@@ -112,7 +86,7 @@ CMakeBuildConfiguration::CMakeBuildConfiguration(ProjectExplorer::Target *parent
BuildConfiguration(parent, source), BuildConfiguration(parent, source),
m_configuration(source->m_configuration) m_configuration(source->m_configuration)
{ {
Q_ASSERT(parent); ctor();
cloneSteps(source); cloneSteps(source);
} }
@@ -155,6 +129,39 @@ bool CMakeBuildConfiguration::fromMap(const QVariantMap &map)
return true; return true;
} }
void CMakeBuildConfiguration::ctor()
{
auto project = static_cast<CMakeProject *>(target()->project());
setBuildDirectory(shadowBuildDirectory(project->projectFilePath(),
target()->kit(),
displayName(), BuildConfiguration::Unknown));
m_buildDirManager = new BuildDirManager(this);
connect(m_buildDirManager, &BuildDirManager::dataAvailable,
this, &CMakeBuildConfiguration::dataAvailable);
connect(m_buildDirManager, &BuildDirManager::errorOccured,
this, &CMakeBuildConfiguration::setError);
connect(m_buildDirManager, &BuildDirManager::configurationStarted,
this, [this]() { m_completeConfigurationCache.clear(); emit parsingStarted(); });
connect(this, &CMakeBuildConfiguration::environmentChanged,
m_buildDirManager, &BuildDirManager::forceReparse);
connect(this, &CMakeBuildConfiguration::buildDirectoryChanged,
m_buildDirManager, &BuildDirManager::forceReparse);
connect(this, &CMakeBuildConfiguration::parsingStarted, project, &CMakeProject::handleParsingStarted);
connect(this, &CMakeBuildConfiguration::dataAvailable, project, &CMakeProject::parseCMakeOutput);
}
void CMakeBuildConfiguration::maybeForceReparse()
{
ProjectExplorer::Kit *k = target()->kit();
CMakeConfig config = cmakeConfiguration();
config.append(CMakeConfigurationKitInformation::configuration(k)); // last value wins...
setCMakeConfiguration(config);
m_buildDirManager->maybeForceReparse();
}
BuildDirManager *CMakeBuildConfiguration::buildDirManager() const BuildDirManager *CMakeBuildConfiguration::buildDirManager() const
{ {
return m_buildDirManager; return m_buildDirManager;
@@ -165,11 +172,6 @@ bool CMakeBuildConfiguration::isParsing() const
return m_buildDirManager && m_buildDirManager->isParsing(); return m_buildDirManager && m_buildDirManager->isParsing();
} }
void CMakeBuildConfiguration::parse()
{
m_buildDirManager->parse();
}
void CMakeBuildConfiguration::resetData() void CMakeBuildConfiguration::resetData()
{ {
m_buildDirManager->resetData(); m_buildDirManager->resetData();
@@ -197,7 +199,7 @@ FileName CMakeBuildConfiguration::shadowBuildDirectory(const FileName &projectFi
QList<ConfigModel::DataItem> CMakeBuildConfiguration::completeCMakeConfiguration() const QList<ConfigModel::DataItem> CMakeBuildConfiguration::completeCMakeConfiguration() const
{ {
if (m_buildDirManager->isParsing()) if (!m_buildDirManager && m_buildDirManager->isParsing())
return QList<ConfigModel::DataItem>(); return QList<ConfigModel::DataItem>();
if (m_completeConfigurationCache.isEmpty()) if (m_completeConfigurationCache.isEmpty())
@@ -409,14 +411,14 @@ ProjectExplorer::BuildConfiguration *CMakeBuildConfigurationFactory::create(Proj
auto cleanStep = new CMakeBuildStep(cleanSteps); auto cleanStep = new CMakeBuildStep(cleanSteps);
cleanSteps->insertStep(0, cleanStep); cleanSteps->insertStep(0, cleanStep);
cleanStep->setBuildTarget(CMakeBuildStep::cleanTarget(), true); cleanStep->setBuildTarget(CMakeBuildStep::cleanTarget());
bc->setBuildDirectory(copy.buildDirectory); bc->setBuildDirectory(copy.buildDirectory);
bc->setCMakeConfiguration(copy.configuration); bc->setCMakeConfiguration(copy.configuration);
// Default to all // Default to all
if (project->hasBuildTarget(QLatin1String("all"))) if (project->hasBuildTarget(CMakeBuildStep::allTarget()))
buildStep->setBuildTarget(QLatin1String("all"), true); buildStep->setBuildTarget(CMakeBuildStep::allTarget());
return bc; return bc;
} }

View File

@@ -73,7 +73,7 @@ public:
bool isParsing() const; bool isParsing() const;
void parse(); void maybeForceReparse();
void resetData(); void resetData();
bool persistCMakeState(); bool persistCMakeState();
@@ -92,6 +92,7 @@ protected:
bool fromMap(const QVariantMap &map) override; bool fromMap(const QVariantMap &map) override;
private: private:
void ctor();
QList<ConfigModel::DataItem> completeCMakeConfiguration() const; QList<ConfigModel::DataItem> completeCMakeConfiguration() const;
void setCurrentCMakeConfiguration(const QList<ConfigModel::DataItem> &items); void setCurrentCMakeConfiguration(const QList<ConfigModel::DataItem> &items);

View File

@@ -82,9 +82,8 @@ CMakeBuildStep::CMakeBuildStep(BuildStepList *bsl, Core::Id id) : AbstractProces
CMakeBuildStep::CMakeBuildStep(BuildStepList *bsl, CMakeBuildStep *bs) : CMakeBuildStep::CMakeBuildStep(BuildStepList *bsl, CMakeBuildStep *bs) :
AbstractProcessStep(bsl, bs), AbstractProcessStep(bsl, bs),
m_buildTargets(bs->m_buildTargets), m_buildTarget(bs->m_buildTarget),
m_toolArguments(bs->m_toolArguments), m_toolArguments(bs->m_toolArguments)
m_addRunConfigurationArgument(bs->m_addRunConfigurationArgument)
{ {
ctor(bsl); ctor(bsl);
} }
@@ -125,31 +124,34 @@ CMakeRunConfiguration *CMakeBuildStep::targetsActiveRunConfiguration() const
void CMakeBuildStep::handleBuildTargetChanges() void CMakeBuildStep::handleBuildTargetChanges()
{ {
const QStringList filteredTargets if (static_cast<CMakeProject *>(project())->buildTargetTitles().contains(m_buildTarget))
= Utils::filtered(static_cast<CMakeProject *>(project())->buildTargetTitles(), setBuildTarget(m_buildTarget);
[this](const QString &s) { return m_buildTargets.contains(s); }); else
setBuildTargets(filteredTargets); setBuildTarget(CMakeBuildStep::allTarget());
emit buildTargetsChanged(); emit buildTargetsChanged();
} }
QVariantMap CMakeBuildStep::toMap() const QVariantMap CMakeBuildStep::toMap() const
{ {
QVariantMap map(AbstractProcessStep::toMap()); QVariantMap map(AbstractProcessStep::toMap());
map.insert(QLatin1String(BUILD_TARGETS_KEY), m_buildTargets); // Use QStringList for compatibility with old files
map.insert(QLatin1String(BUILD_TARGETS_KEY), QStringList(m_buildTarget));
map.insert(QLatin1String(TOOL_ARGUMENTS_KEY), m_toolArguments); map.insert(QLatin1String(TOOL_ARGUMENTS_KEY), m_toolArguments);
map.insert(QLatin1String(ADD_RUNCONFIGURATION_ARGUMENT_KEY), m_addRunConfigurationArgument);
return map; return map;
} }
bool CMakeBuildStep::fromMap(const QVariantMap &map) bool CMakeBuildStep::fromMap(const QVariantMap &map)
{ {
if (map.value(QLatin1String(CLEAN_KEY), false).toBool()) { if (map.value(QLatin1String(CLEAN_KEY), false).toBool()) {
m_buildTargets = QStringList(CMakeBuildStep::cleanTarget()); m_buildTarget = CMakeBuildStep::cleanTarget();
} else { } else {
m_buildTargets = map.value(QLatin1String(BUILD_TARGETS_KEY)).toStringList(); const QStringList targetList = map.value(QLatin1String(BUILD_TARGETS_KEY)).toStringList();
if (!targetList.isEmpty())
m_buildTarget = targetList.last();
m_toolArguments = map.value(QLatin1String(TOOL_ARGUMENTS_KEY)).toString(); m_toolArguments = map.value(QLatin1String(TOOL_ARGUMENTS_KEY)).toString();
} }
m_addRunConfigurationArgument = map.value(QLatin1String(ADD_RUNCONFIGURATION_ARGUMENT_KEY), false).toBool(); if (map.value(QLatin1String(ADD_RUNCONFIGURATION_ARGUMENT_KEY), false).toBool())
m_buildTarget = QLatin1String(ADD_RUNCONFIGURATION_TEXT);
return BuildStep::fromMap(map); return BuildStep::fromMap(map);
} }
@@ -178,7 +180,7 @@ bool CMakeBuildStep::init(QList<const BuildStep *> &earlierSteps)
} }
CMakeRunConfiguration *rc = targetsActiveRunConfiguration(); CMakeRunConfiguration *rc = targetsActiveRunConfiguration();
if (m_addRunConfigurationArgument && (!rc || rc->title().isEmpty())) { if ((m_buildTarget == QLatin1String(ADD_RUNCONFIGURATION_TEXT)) && (!rc || rc->title().isEmpty())) {
emit addTask(Task(Task::Error, emit addTask(Task(Task::Error,
QCoreApplication::translate("ProjectExplorer::Task", QCoreApplication::translate("ProjectExplorer::Task",
"You asked to build the current Run Configuration's build target only, " "You asked to build the current Run Configuration's build target only, "
@@ -196,7 +198,7 @@ bool CMakeBuildStep::init(QList<const BuildStep *> &earlierSteps)
QString arguments = allArguments(rc); QString arguments = allArguments(rc);
setIgnoreReturnValue(m_buildTargets.contains(CMakeBuildStep::cleanTarget())); setIgnoreReturnValue(m_buildTarget == CMakeBuildStep::cleanTarget());
ProcessParameters *pp = processParameters(); ProcessParameters *pp = processParameters();
pp->setMacroExpander(bc->macroExpander()); pp->setMacroExpander(bc->macroExpander());
@@ -292,44 +294,27 @@ void CMakeBuildStep::stdOutput(const QString &line)
AbstractProcessStep::stdOutput(line); AbstractProcessStep::stdOutput(line);
} }
QStringList CMakeBuildStep::buildTargets() const QString CMakeBuildStep::buildTarget() const
{ {
return m_buildTargets; return m_buildTarget;
} }
bool CMakeBuildStep::buildsBuildTarget(const QString &target) const bool CMakeBuildStep::buildsBuildTarget(const QString &target) const
{ {
if (target == tr(ADD_RUNCONFIGURATION_TEXT)) return target == m_buildTarget;
return addRunConfigurationArgument();
else
return m_buildTargets.contains(target);
} }
void CMakeBuildStep::setBuildTarget(const QString &buildTarget, bool on) void CMakeBuildStep::setBuildTarget(const QString &buildTarget)
{ {
if (buildTarget == tr(ADD_RUNCONFIGURATION_TEXT)) { if (m_buildTarget == buildTarget)
setAddRunConfigurationArgument(on); return;
} else { m_buildTarget = buildTarget;
QStringList old = m_buildTargets; emit targetToBuildChanged();
if (on && !old.contains(buildTarget))
old << buildTarget;
else if (!on && old.contains(buildTarget))
old.removeOne(buildTarget);
setBuildTargets(old);
}
}
void CMakeBuildStep::setBuildTargets(const QStringList &targets)
{
if (targets != m_buildTargets) {
m_buildTargets = targets;
emit targetsToBuildChanged();
}
} }
void CMakeBuildStep::clearBuildTargets() void CMakeBuildStep::clearBuildTargets()
{ {
m_buildTargets.clear(); m_buildTarget.clear();
} }
QString CMakeBuildStep::toolArguments() const QString CMakeBuildStep::toolArguments() const
@@ -349,18 +334,20 @@ QString CMakeBuildStep::allArguments(const CMakeRunConfiguration *rc) const
Utils::QtcProcess::addArg(&arguments, QLatin1String("--build")); Utils::QtcProcess::addArg(&arguments, QLatin1String("--build"));
Utils::QtcProcess::addArg(&arguments, QLatin1String(".")); Utils::QtcProcess::addArg(&arguments, QLatin1String("."));
if (m_addRunConfigurationArgument) { QString target;
Utils::QtcProcess::addArg(&arguments, QLatin1String("--target"));
if (m_buildTarget == QLatin1String(ADD_RUNCONFIGURATION_TEXT)) {
if (rc) if (rc)
Utils::QtcProcess::addArg(&arguments, rc->title()); target = rc->title();
else else
Utils::QtcProcess::addArg(&arguments, QLatin1String("<i>&lt;") + tr(ADD_RUNCONFIGURATION_TEXT) + QLatin1String("&gt;</i>")); target = QLatin1String("<i>&lt;") + tr(ADD_RUNCONFIGURATION_TEXT) + QLatin1String("&gt;</i>");
} } else {
foreach (const QString &t, m_buildTargets) { target = m_buildTarget;
Utils::QtcProcess::addArg(&arguments, QLatin1String("--target"));
Utils::QtcProcess::addArg(&arguments, t);
} }
Utils::QtcProcess::addArg(&arguments, QLatin1String("--target"));
Utils::QtcProcess::addArg(&arguments, target);
if (!m_toolArguments.isEmpty()) { if (!m_toolArguments.isEmpty()) {
Utils::QtcProcess::addArg(&arguments, QLatin1String("--")); Utils::QtcProcess::addArg(&arguments, QLatin1String("--"));
arguments += QLatin1Char(' ') + m_toolArguments; arguments += QLatin1Char(' ') + m_toolArguments;
@@ -369,16 +356,6 @@ QString CMakeBuildStep::allArguments(const CMakeRunConfiguration *rc) const
return arguments; return arguments;
} }
bool CMakeBuildStep::addRunConfigurationArgument() const
{
return m_addRunConfigurationArgument;
}
void CMakeBuildStep::setAddRunConfigurationArgument(bool add)
{
m_addRunConfigurationArgument = add;
}
QString CMakeBuildStep::cmakeCommand() const QString CMakeBuildStep::cmakeCommand() const
{ {
CMakeTool *tool = CMakeKitInformation::cmakeTool(target()->kit()); CMakeTool *tool = CMakeKitInformation::cmakeTool(target()->kit());
@@ -390,6 +367,11 @@ QString CMakeBuildStep::cleanTarget()
return QLatin1String("clean"); return QLatin1String("clean");
} }
QString CMakeBuildStep::allTarget()
{
return QLatin1String("all");
}
// //
// CMakeBuildStepConfigWidget // CMakeBuildStepConfigWidget
// //
@@ -407,7 +389,6 @@ CMakeBuildStepConfigWidget::CMakeBuildStepConfigWidget(CMakeBuildStep *buildStep
fl->addRow(tr("Tool arguments:"), m_toolArguments); fl->addRow(tr("Tool arguments:"), m_toolArguments);
m_toolArguments->setText(m_buildStep->toolArguments()); m_toolArguments->setText(m_buildStep->toolArguments());
m_buildTargetsList->setFrameStyle(QFrame::NoFrame); m_buildTargetsList->setFrameStyle(QFrame::NoFrame);
m_buildTargetsList->setMinimumHeight(200); m_buildTargetsList->setMinimumHeight(200);
@@ -420,22 +401,7 @@ CMakeBuildStepConfigWidget::CMakeBuildStepConfigWidget(CMakeBuildStep *buildStep
fl->addRow(tr("Targets:"), frame); fl->addRow(tr("Targets:"), frame);
auto itemAddRunConfigurationArgument = new QListWidgetItem(tr(ADD_RUNCONFIGURATION_TEXT), m_buildTargetsList); buildTargetsChanged();
itemAddRunConfigurationArgument->setFlags(itemAddRunConfigurationArgument->flags() | Qt::ItemIsUserCheckable);
itemAddRunConfigurationArgument->setCheckState(m_buildStep->addRunConfigurationArgument() ? Qt::Checked : Qt::Unchecked);
QFont f;
f.setItalic(true);
itemAddRunConfigurationArgument->setFont(f);
CMakeProject *pro = static_cast<CMakeProject *>(m_buildStep->project());
QStringList targetList = pro->buildTargetTitles();
targetList.sort();
foreach (const QString &buildTarget, targetList) {
auto item = new QListWidgetItem(buildTarget, m_buildTargetsList);
item->setFlags(item->flags() | Qt::ItemIsUserCheckable);
item->setCheckState(m_buildStep->buildsBuildTarget(item->text()) ? Qt::Checked : Qt::Unchecked);
}
updateDetails(); updateDetails();
connect(m_toolArguments, &QLineEdit::textEdited, this, &CMakeBuildStepConfigWidget::toolArgumentsEdited); connect(m_toolArguments, &QLineEdit::textEdited, this, &CMakeBuildStepConfigWidget::toolArgumentsEdited);
@@ -444,8 +410,9 @@ CMakeBuildStepConfigWidget::CMakeBuildStepConfigWidget(CMakeBuildStep *buildStep
this, &CMakeBuildStepConfigWidget::updateDetails); this, &CMakeBuildStepConfigWidget::updateDetails);
connect(m_buildStep, &CMakeBuildStep::buildTargetsChanged, this, &CMakeBuildStepConfigWidget::buildTargetsChanged); connect(m_buildStep, &CMakeBuildStep::buildTargetsChanged, this, &CMakeBuildStepConfigWidget::buildTargetsChanged);
connect(m_buildStep, &CMakeBuildStep::targetsToBuildChanged, this, &CMakeBuildStepConfigWidget::selectedBuildTargetsChanged); connect(m_buildStep, &CMakeBuildStep::targetToBuildChanged, this, &CMakeBuildStepConfigWidget::selectedBuildTargetsChanged);
connect(pro, &CMakeProject::environmentChanged, this, &CMakeBuildStepConfigWidget::updateDetails); connect(static_cast<CMakeProject *>(m_buildStep->project()), &CMakeProject::environmentChanged,
this, &CMakeBuildStepConfigWidget::updateDetails);
} }
void CMakeBuildStepConfigWidget::toolArgumentsEdited() void CMakeBuildStepConfigWidget::toolArgumentsEdited()
@@ -456,7 +423,9 @@ void CMakeBuildStepConfigWidget::toolArgumentsEdited()
void CMakeBuildStepConfigWidget::itemChanged(QListWidgetItem *item) void CMakeBuildStepConfigWidget::itemChanged(QListWidgetItem *item)
{ {
m_buildStep->setBuildTarget(item->text(), item->checkState() & Qt::Checked); const QString target =
(item->checkState() == Qt::Checked) ? item->data(Qt::UserRole).toString() : CMakeBuildStep::allTarget();
m_buildStep->setBuildTarget(target);
updateDetails(); updateDetails();
} }
@@ -467,30 +436,44 @@ QString CMakeBuildStepConfigWidget::displayName() const
void CMakeBuildStepConfigWidget::buildTargetsChanged() void CMakeBuildStepConfigWidget::buildTargetsChanged()
{ {
disconnect(m_buildTargetsList, &QListWidget::itemChanged, this, &CMakeBuildStepConfigWidget::itemChanged); const bool wasBlocked = m_buildTargetsList->blockSignals(true);
auto *addRunConfigurationArgumentItem = m_buildTargetsList->takeItem(0);
m_buildTargetsList->clear(); m_buildTargetsList->clear();
m_buildTargetsList->insertItem(0, addRunConfigurationArgumentItem);
CMakeProject *pro = static_cast<CMakeProject *>(m_buildStep->target()->project()); auto item = new QListWidgetItem(tr(ADD_RUNCONFIGURATION_TEXT), m_buildTargetsList);
foreach (const QString& buildTarget, pro->buildTargetTitles()) {
item->setData(Qt::UserRole, QString::fromLatin1(ADD_RUNCONFIGURATION_TEXT));
QFont f;
f.setItalic(true);
item->setFont(f);
CMakeProject *pro = static_cast<CMakeProject *>(m_buildStep->project());
QStringList targetList = pro->buildTargetTitles();
targetList.sort();
foreach (const QString &buildTarget, targetList) {
auto item = new QListWidgetItem(buildTarget, m_buildTargetsList); auto item = new QListWidgetItem(buildTarget, m_buildTargetsList);
item->setFlags(item->flags() | Qt::ItemIsUserCheckable); item->setData(Qt::UserRole, buildTarget);
item->setCheckState(m_buildStep->buildsBuildTarget(item->text()) ? Qt::Checked : Qt::Unchecked);
} }
connect(m_buildTargetsList, &QListWidget::itemChanged, this, &CMakeBuildStepConfigWidget::itemChanged);
for (int i = 0; i < m_buildTargetsList->count(); ++i) {
QListWidgetItem *item = m_buildTargetsList->item(i);
item->setFlags(item->flags() | Qt::ItemIsUserCheckable);
item->setCheckState(m_buildStep->buildsBuildTarget(item->data(Qt::UserRole).toString())
? Qt::Checked : Qt::Unchecked);
}
m_buildTargetsList->blockSignals(wasBlocked);
updateSummary(); updateSummary();
} }
void CMakeBuildStepConfigWidget::selectedBuildTargetsChanged() void CMakeBuildStepConfigWidget::selectedBuildTargetsChanged()
{ {
disconnect(m_buildTargetsList, &QListWidget::itemChanged, this, &CMakeBuildStepConfigWidget::itemChanged); const bool wasBlocked = m_buildTargetsList->blockSignals(true);
for (int y = 0; y < m_buildTargetsList->count(); ++y) { for (int y = 0; y < m_buildTargetsList->count(); ++y) {
QListWidgetItem *item = m_buildTargetsList->item(y); QListWidgetItem *item = m_buildTargetsList->item(y);
item->setCheckState(m_buildStep->buildsBuildTarget(item->text()) ? Qt::Checked : Qt::Unchecked); item->setCheckState(m_buildStep->buildsBuildTarget(item->data(Qt::UserRole).toString())
? Qt::Checked : Qt::Unchecked);
} }
connect(m_buildTargetsList, &QListWidget::itemChanged, this, &CMakeBuildStepConfigWidget::itemChanged); m_buildTargetsList->blockSignals(wasBlocked);
updateSummary(); updateSummary();
} }
@@ -541,7 +524,7 @@ BuildStep *CMakeBuildStepFactory::create(BuildStepList *parent, Core::Id id)
return 0; return 0;
auto step = new CMakeBuildStep(parent); auto step = new CMakeBuildStep(parent);
if (parent->id() == ProjectExplorer::Constants::BUILDSTEPS_CLEAN) if (parent->id() == ProjectExplorer::Constants::BUILDSTEPS_CLEAN)
step->setBuildTarget(CMakeBuildStep::cleanTarget(), true); step->setBuildTarget(CMakeBuildStep::cleanTarget());
return step; return step;
} }

View File

@@ -61,10 +61,9 @@ public:
ProjectExplorer::BuildStepConfigWidget *createConfigWidget() override; ProjectExplorer::BuildStepConfigWidget *createConfigWidget() override;
bool immutable() const override; bool immutable() const override;
QStringList buildTargets() const; QString buildTarget() const;
bool buildsBuildTarget(const QString &target) const; bool buildsBuildTarget(const QString &target) const;
void setBuildTarget(const QString &target, bool on); void setBuildTarget(const QString &target);
void setBuildTargets(const QStringList &targets);
void clearBuildTargets(); void clearBuildTargets();
QString toolArguments() const; QString toolArguments() const;
@@ -72,18 +71,16 @@ public:
QString allArguments(const CMakeRunConfiguration *rc) const; QString allArguments(const CMakeRunConfiguration *rc) const;
bool addRunConfigurationArgument() const;
void setAddRunConfigurationArgument(bool add);
QString cmakeCommand() const; QString cmakeCommand() const;
QVariantMap toMap() const override; QVariantMap toMap() const override;
static QString cleanTarget(); static QString cleanTarget();
static QString allTarget();
signals: signals:
void cmakeCommandChanged(); void cmakeCommandChanged();
void targetsToBuildChanged(); void targetToBuildChanged();
void buildTargetsChanged(); void buildTargetsChanged();
protected: protected:
@@ -112,9 +109,8 @@ private:
QRegExp m_percentProgress; QRegExp m_percentProgress;
QRegExp m_ninjaProgress; QRegExp m_ninjaProgress;
QString m_ninjaProgressString; QString m_ninjaProgressString;
QStringList m_buildTargets; QString m_buildTarget;
QString m_toolArguments; QString m_toolArguments;
bool m_addRunConfigurationArgument = false;
bool m_useNinja = false; bool m_useNinja = false;
}; };

View File

@@ -111,13 +111,13 @@ void CMakeLocatorFilter::accept(Core::LocatorFilterEntry selection) const
return; return;
// Change the make step to build only the given target // Change the make step to build only the given target
QStringList oldTargets = buildStep->buildTargets(); QString oldTarget = buildStep->buildTarget();
buildStep->clearBuildTargets(); buildStep->clearBuildTargets();
buildStep->setBuildTarget(selection.displayName, true); buildStep->setBuildTarget(selection.displayName);
// Build // Build
ProjectExplorerPlugin::buildProject(cmakeProject); ProjectExplorerPlugin::buildProject(cmakeProject);
buildStep->setBuildTargets(oldTargets); buildStep->setBuildTarget(oldTarget);
} }
void CMakeLocatorFilter::refresh(QFutureInterface<void> &future) void CMakeLocatorFilter::refresh(QFutureInterface<void> &future)

View File

@@ -92,6 +92,8 @@ CMakeProject::CMakeProject(CMakeManager *manager, const FileName &fileName)
setProjectLanguages(Core::Context(ProjectExplorer::Constants::LANG_CXX)); setProjectLanguages(Core::Context(ProjectExplorer::Constants::LANG_CXX));
rootProjectNode()->setDisplayName(fileName.parentDir().fileName()); rootProjectNode()->setDisplayName(fileName.parentDir().fileName());
connect(this, &CMakeProject::activeTargetChanged, this, &CMakeProject::handleActiveTargetChanged);
} }
CMakeProject::~CMakeProject() CMakeProject::~CMakeProject()
@@ -439,10 +441,6 @@ Project::RestoreResult CMakeProject::fromMap(const QVariantMap &map, QString *er
RestoreResult result = Project::fromMap(map, errorMessage); RestoreResult result = Project::fromMap(map, errorMessage);
if (result != RestoreResult::Ok) if (result != RestoreResult::Ok)
return result; return result;
handleActiveTargetChanged();
handleActiveBuildConfigurationChanged();
return RestoreResult::Ok; return RestoreResult::Ok;
} }
@@ -461,7 +459,8 @@ void CMakeProject::handleActiveTargetChanged()
if (m_connectedTarget) { if (m_connectedTarget) {
disconnect(m_connectedTarget, &Target::activeBuildConfigurationChanged, disconnect(m_connectedTarget, &Target::activeBuildConfigurationChanged,
this, &CMakeProject::handleActiveBuildConfigurationChanged); this, &CMakeProject::handleActiveBuildConfigurationChanged);
disconnect(m_connectedTarget, &Target::kitChanged,
this, &CMakeProject::handleActiveBuildConfigurationChanged);
} }
m_connectedTarget = activeTarget(); m_connectedTarget = activeTarget();
@@ -469,7 +468,11 @@ void CMakeProject::handleActiveTargetChanged()
if (m_connectedTarget) { if (m_connectedTarget) {
connect(m_connectedTarget, &Target::activeBuildConfigurationChanged, connect(m_connectedTarget, &Target::activeBuildConfigurationChanged,
this, &CMakeProject::handleActiveBuildConfigurationChanged); this, &CMakeProject::handleActiveBuildConfigurationChanged);
connect(m_connectedTarget, &Target::kitChanged,
this, &CMakeProject::handleActiveBuildConfigurationChanged);
} }
handleActiveBuildConfigurationChanged();
} }
void CMakeProject::handleActiveBuildConfigurationChanged() void CMakeProject::handleActiveBuildConfigurationChanged()
@@ -483,7 +486,7 @@ void CMakeProject::handleActiveBuildConfigurationChanged()
auto i = qobject_cast<CMakeBuildConfiguration *>(bc); auto i = qobject_cast<CMakeBuildConfiguration *>(bc);
QTC_ASSERT(i, continue); QTC_ASSERT(i, continue);
if (i == activeBc) if (i == activeBc)
i->parse(); i->maybeForceReparse();
else else
i->resetData(); i->resetData();
} }

View File

@@ -101,16 +101,6 @@
<file>images/dark_fileicon.png</file> <file>images/dark_fileicon.png</file>
<file>images/dark_foldericon.png</file> <file>images/dark_foldericon.png</file>
<file>images/Desktop.png</file> <file>images/Desktop.png</file>
<file>images/run_overlay_small.png</file>
<file>images/run_overlay_small@2x.png</file>
<file>images/stop_overlay_small.png</file>
<file>images/stop_overlay_small@2x.png</file>
<file>images/debugger_overlay_small.png</file>
<file>images/debugger_overlay_small@2x.png</file>
<file>images/interrupt_overlay_small.png</file>
<file>images/interrupt_overlay_small@2x.png</file>
<file>images/continue_overlay_small.png</file>
<file>images/continue_overlay_small@2x.png</file>
<file>images/zoom.png</file> <file>images/zoom.png</file>
<file>images/zoom@2x.png</file> <file>images/zoom@2x.png</file>
</qresource> </qresource>

View File

@@ -132,18 +132,6 @@ const Icon INFO_TOOLBAR({
{QLatin1String(":/core/images/info.png"), Theme::IconsInfoToolBarColor}}); {QLatin1String(":/core/images/info.png"), Theme::IconsInfoToolBarColor}});
const Icon EXPAND({ const Icon EXPAND({
{QLatin1String(":/find/images/expand.png"), Theme::IconsBaseColor}}); {QLatin1String(":/find/images/expand.png"), Theme::IconsBaseColor}});
const Icon DEBUG_START_SMALL({
{QLatin1String(":/core/images/debugger_overlay_small.png"), Theme::IconsDebugColor},
{QLatin1String(":/core/images/run_overlay_small.png"), Theme::IconsRunColor}});
const Icon DEBUG_EXIT_SMALL({
{QLatin1String(":/core/images/debugger_overlay_small.png"), Theme::IconsDebugColor},
{QLatin1String(":/core/images/stop_overlay_small.png"), Theme::IconsStopColor}});
const Icon DEBUG_INTERRUPT_SMALL({
{QLatin1String(":/core/images/debugger_overlay_small.png"), Theme::IconsDebugColor},
{QLatin1String(":/core/images/interrupt_overlay_small.png"), Theme::IconsInterruptColor}});
const Icon DEBUG_CONTINUE_SMALL({
{QLatin1String(":/core/images/debugger_overlay_small.png"), Theme::IconsDebugColor},
{QLatin1String(":/core/images/continue_overlay_small.png"), Theme::IconsRunColor}});
const Icon ZOOM({ const Icon ZOOM({
{QLatin1String(":/core/images/zoom.png"), Theme::IconsBaseColor}}); {QLatin1String(":/core/images/zoom.png"), Theme::IconsBaseColor}});
const Icon TOOLBAR_EXTENSION({ const Icon TOOLBAR_EXTENSION({

View File

@@ -82,10 +82,6 @@ CORE_EXPORT extern const Utils::Icon ERROR_TASKBAR;
CORE_EXPORT extern const Utils::Icon INFO; CORE_EXPORT extern const Utils::Icon INFO;
CORE_EXPORT extern const Utils::Icon INFO_TOOLBAR; CORE_EXPORT extern const Utils::Icon INFO_TOOLBAR;
CORE_EXPORT extern const Utils::Icon EXPAND; CORE_EXPORT extern const Utils::Icon EXPAND;
CORE_EXPORT extern const Utils::Icon DEBUG_START_SMALL;
CORE_EXPORT extern const Utils::Icon DEBUG_EXIT_SMALL;
CORE_EXPORT extern const Utils::Icon DEBUG_INTERRUPT_SMALL;
CORE_EXPORT extern const Utils::Icon DEBUG_CONTINUE_SMALL;
CORE_EXPORT extern const Utils::Icon ZOOM; CORE_EXPORT extern const Utils::Icon ZOOM;
CORE_EXPORT extern const Utils::Icon TOOLBAR_EXTENSION; CORE_EXPORT extern const Utils::Icon TOOLBAR_EXTENSION;

View File

@@ -666,11 +666,15 @@ void ManhattanStyle::drawControl(ControlElement element, const QStyleOption *opt
if (act) { if (act) {
// Fill| // Fill|
QColor baseColor = StyleHelper::baseColor(); if (creatorTheme()->flag(Theme::FlatMenuBar)) {
QLinearGradient grad(option->rect.topLeft(), option->rect.bottomLeft()); painter->fillRect(option->rect, creatorTheme()->color(Theme::FancyToolButtonHoverColor));
grad.setColorAt(0, baseColor.lighter(120)); } else {
grad.setColorAt(1, baseColor.lighter(130)); QColor baseColor = StyleHelper::baseColor();
painter->fillRect(option->rect, grad); QLinearGradient grad(option->rect.topLeft(), option->rect.bottomLeft());
grad.setColorAt(0, baseColor.lighter(120));
grad.setColorAt(1, baseColor.lighter(130));
painter->fillRect(option->rect, grad);
}
QPalette pal = mbi->palette; QPalette pal = mbi->palette;
uint alignment = Qt::AlignCenter | Qt::TextShowMnemonic | Qt::TextDontClip | Qt::TextSingleLine; uint alignment = Qt::AlignCenter | Qt::TextShowMnemonic | Qt::TextDontClip | Qt::TextSingleLine;
@@ -732,7 +736,7 @@ void ManhattanStyle::drawControl(ControlElement element, const QStyleOption *opt
if (creatorTheme()->flag(Theme::ComboBoxDrawTextShadow) if (creatorTheme()->flag(Theme::ComboBoxDrawTextShadow)
&& (option->state & State_Enabled)) && (option->state & State_Enabled))
{ {
painter->setPen(QColor(0, 0, 0, 70)); painter->setPen(StyleHelper::toolBarDropShadowColor());
painter->drawText(editRect.adjusted(1, 0, -1, 0), Qt::AlignLeft | Qt::AlignVCenter, text); painter->drawText(editRect.adjusted(1, 0, -1, 0), Qt::AlignLeft | Qt::AlignVCenter, text);
} }
if (!(option->state & State_Enabled)) if (!(option->state & State_Enabled))

View File

@@ -240,14 +240,17 @@ VariableChooserPrivate::VariableChooserPrivate(VariableChooser *parent)
: q(parent), : q(parent),
m_lineEdit(0), m_lineEdit(0),
m_textEdit(0), m_textEdit(0),
m_plainTextEdit(0) m_plainTextEdit(0),
m_iconButton(0),
m_variableTree(0),
m_variableDescription(0)
{ {
m_defaultDescription = VariableChooser::tr("Select a variable to insert."); m_defaultDescription = VariableChooser::tr("Select a variable to insert.");
m_variableTree = new VariableTreeView(q, this); m_variableTree = new VariableTreeView(q, this);
m_variableTree->setModel(&m_model);
m_variableDescription = new QLabel(q); m_variableDescription = new QLabel(q);
m_variableTree->setModel(&m_model);
m_variableDescription->setText(m_defaultDescription); m_variableDescription->setText(m_defaultDescription);
m_variableDescription->setMinimumSize(QSize(0, 60)); m_variableDescription->setMinimumSize(QSize(0, 60));
m_variableDescription->setAlignment(Qt::AlignLeft|Qt::AlignTop); m_variableDescription->setAlignment(Qt::AlignLeft|Qt::AlignTop);
@@ -403,7 +406,8 @@ void VariableChooser::addSupportForChildWidgets(QWidget *parent, MacroExpander *
*/ */
void VariableChooserPrivate::updateDescription(const QModelIndex &index) void VariableChooserPrivate::updateDescription(const QModelIndex &index)
{ {
m_variableDescription->setText(m_model.data(index, Qt::ToolTipRole).toString()); if (m_variableDescription)
m_variableDescription->setText(m_model.data(index, Qt::ToolTipRole).toString());
} }
/*! /*!

View File

@@ -35,8 +35,6 @@
#include <QList> #include <QList>
#include <QtTest> #include <QtTest>
Q_DECLARE_METATYPE(QList<QByteArray>)
using namespace CPlusPlus; using namespace CPlusPlus;
using namespace CppTools; using namespace CppTools;

View File

@@ -315,8 +315,6 @@ typedef QSharedPointer<CppQuickFixFactory> CppQuickFixFactoryPtr;
} // namespace CppEditor } // namespace CppEditor
Q_DECLARE_METATYPE(CppEditor::CppQuickFixFactoryPtr)
namespace CppEditor { namespace CppEditor {
namespace Internal { namespace Internal {

View File

@@ -89,7 +89,6 @@ public:
}; };
typedef QList<OverrideItem> OverrideItemList; typedef QList<OverrideItem> OverrideItemList;
Q_DECLARE_METATYPE(OverrideItem) Q_DECLARE_METATYPE(OverrideItem)
Q_DECLARE_METATYPE(OverrideItemList)
inline bool operator==(const OverrideItem &lhs, const OverrideItem &rhs) inline bool operator==(const OverrideItem &lhs, const OverrideItem &rhs)
{ {

View File

@@ -24,6 +24,7 @@
****************************************************************************/ ****************************************************************************/
#include "cppcompletionassist.h" #include "cppcompletionassist.h"
#include "cppdoxygen.h"
#include "cppmodelmanager.h" #include "cppmodelmanager.h"
#include "cpptoolsplugin.h" #include "cpptoolsplugin.h"
#include "cpptoolstestcase.h" #include "cpptoolstestcase.h"
@@ -110,6 +111,8 @@ public:
ExplicitlyInvoked, m_snapshot, ExplicitlyInvoked, m_snapshot,
ProjectPartHeaderPaths(), ProjectPartHeaderPaths(),
languageFeatures); languageFeatures);
ai->prepareForAsyncUse();
ai->recreateTextDocument();
InternalCppCompletionAssistProcessor processor; InternalCppCompletionAssistProcessor processor;
const Tests::IAssistProposalScopedPointer proposal(processor.perform(ai)); const Tests::IAssistProposalScopedPointer proposal(processor.perform(ai));
@@ -171,6 +174,17 @@ bool isProbablyGlobalCompletion(const QStringList &list)
&& list.contains(QLatin1String("bool")); && list.contains(QLatin1String("bool"));
} }
bool isDoxygenTagCompletion(const QStringList &list)
{
for (int i = 1; i < T_DOXY_LAST_TAG; ++i) {
const QString doxygenTag = QString::fromLatin1(doxygenTagSpell(i));
if (!list.contains(doxygenTag))
return false;
}
return true;
}
} // anonymous namespace } // anonymous namespace
void CppToolsPlugin::test_completion_basic_1() void CppToolsPlugin::test_completion_basic_1()
@@ -384,6 +398,34 @@ void CppToolsPlugin::test_global_completion()
QVERIFY(completions.toSet().contains(requiredCompletionItems.toSet())); QVERIFY(completions.toSet().contains(requiredCompletionItems.toSet()));
} }
void CppToolsPlugin::test_doxygen_tag_completion_data()
{
QTest::addColumn<QByteArray>("code");
QTest::newRow("C++ comment")
<< _("/// @");
QTest::newRow("C comment single line")
<< _("/*! @ */");
QTest::newRow("C comment multi line")
<< _("/*! text\n"
" * @\n"
" */\n");
}
void CppToolsPlugin::test_doxygen_tag_completion()
{
QFETCH(QByteArray, code);
const QByteArray prefix = "\\";
CompletionTestCase test(code, prefix);
QVERIFY(test.succeededSoFar());
const QStringList completions = test.getCompletions();
QVERIFY(isDoxygenTagCompletion(completions));
}
static void enumTestCase(const QByteArray &tag, const QByteArray &source, static void enumTestCase(const QByteArray &tag, const QByteArray &source,
const QByteArray &prefix = QByteArray()) const QByteArray &prefix = QByteArray())
{ {

View File

@@ -941,118 +941,35 @@ IAssistProposal *InternalCppCompletionAssistProcessor::createHintProposal(
return proposal; return proposal;
} }
int InternalCppCompletionAssistProcessor::startOfOperator(int pos, int InternalCppCompletionAssistProcessor::startOfOperator(int positionInDocument,
unsigned *kind, unsigned *kind,
bool wantFunctionCall) const bool wantFunctionCall) const
{ {
const QChar ch = pos > -1 ? m_interface->characterAt(pos - 1) : QChar(); const QChar ch = m_interface->characterAt(positionInDocument - 1);
const QChar ch2 = pos > 0 ? m_interface->characterAt(pos - 2) : QChar(); const QChar ch2 = m_interface->characterAt(positionInDocument - 2);
const QChar ch3 = pos > 1 ? m_interface->characterAt(pos - 3) : QChar(); const QChar ch3 = m_interface->characterAt(positionInDocument - 3);
int start = pos - CppCompletionAssistProvider::activationSequenceChar(ch, ch2, ch3, kind, int start = positionInDocument
wantFunctionCall, /*wantQt5SignalSlots*/ true); - CppCompletionAssistProvider::activationSequenceChar(ch, ch2, ch3, kind,
if (start != pos) { wantFunctionCall,
QTextCursor tc(m_interface->textDocument()); /*wantQt5SignalSlots*/ true);
tc.setPosition(pos);
// Include completion: make sure the quote character is the first one on the line const auto dotAtIncludeCompletionHandler = [this](int &start, unsigned *kind) {
if (*kind == T_STRING_LITERAL) { start = findStartOfName(start);
QTextCursor s = tc; const QChar ch4 = m_interface->characterAt(start - 1);
s.movePosition(QTextCursor::StartOfLine, QTextCursor::KeepAnchor); const QChar ch5 = m_interface->characterAt(start - 2);
QString sel = s.selectedText(); const QChar ch6 = m_interface->characterAt(start - 3);
if (sel.indexOf(QLatin1Char('"')) < sel.length() - 1) { start = start - CppCompletionAssistProvider::activationSequenceChar(
*kind = T_EOF_SYMBOL; ch4, ch5, ch6, kind, false, false);
start = pos; };
}
}
if (*kind == T_COMMA) {
ExpressionUnderCursor expressionUnderCursor(m_interface->languageFeatures());
if (expressionUnderCursor.startOfFunctionCall(tc) == -1) {
*kind = T_EOF_SYMBOL;
start = pos;
}
}
SimpleLexer tokenize;
tokenize.setLanguageFeatures(m_interface->languageFeatures());
tokenize.setSkipComments(false);
const Tokens &tokens = tokenize(tc.block().text(), BackwardsScanner::previousBlockState(tc.block()));
const int tokenIdx = SimpleLexer::tokenBefore(tokens, qMax(0, tc.positionInBlock() - 1)); // get the token at the left of the cursor
const Token tk = (tokenIdx == -1) ? Token() : tokens.at(tokenIdx);
if (*kind == T_AMPER && tokenIdx > 0) {
const Token &previousToken = tokens.at(tokenIdx - 1);
if (previousToken.kind() == T_COMMA)
start = pos - (tk.utf16charOffset - previousToken.utf16charOffset) - 1;
} else if (*kind == T_DOXY_COMMENT && !(tk.is(T_DOXY_COMMENT) || tk.is(T_CPP_DOXY_COMMENT))) {
*kind = T_EOF_SYMBOL;
start = pos;
}
// Don't complete in comments or strings, but still check for include completion
else if (tk.is(T_COMMENT) || tk.is(T_CPP_COMMENT)
|| tk.is(T_CPP_DOXY_COMMENT) || tk.is(T_DOXY_COMMENT)
|| (tk.isLiteral() && (*kind != T_STRING_LITERAL
&& *kind != T_ANGLE_STRING_LITERAL
&& *kind != T_SLASH
&& *kind != T_DOT))) {
*kind = T_EOF_SYMBOL;
start = pos;
// Include completion: can be triggered by slash, but only in a string
} else if (*kind == T_SLASH && (tk.isNot(T_STRING_LITERAL) && tk.isNot(T_ANGLE_STRING_LITERAL))) {
*kind = T_EOF_SYMBOL;
start = pos;
} else if (*kind == T_LPAREN) {
if (tokenIdx > 0) {
const Token &previousToken = tokens.at(tokenIdx - 1); // look at the token at the left of T_LPAREN
switch (previousToken.kind()) {
case T_IDENTIFIER:
case T_GREATER:
case T_SIGNAL:
case T_SLOT:
break; // good
default:
// that's a bad token :)
*kind = T_EOF_SYMBOL;
start = pos;
}
}
}
// Check for include preprocessor directive
else if (*kind == T_STRING_LITERAL || *kind == T_ANGLE_STRING_LITERAL|| *kind == T_SLASH
|| (*kind == T_DOT && (tk.is(T_STRING_LITERAL) || tk.is(T_ANGLE_STRING_LITERAL)))) {
bool include = false;
if (tokens.size() >= 3) {
if (tokens.at(0).is(T_POUND) && tokens.at(1).is(T_IDENTIFIER) && (tokens.at(2).is(T_STRING_LITERAL) ||
tokens.at(2).is(T_ANGLE_STRING_LITERAL))) {
const Token &directiveToken = tokens.at(1);
QString directive = tc.block().text().mid(directiveToken.utf16charsBegin(),
directiveToken.utf16chars());
if (directive == QLatin1String("include") ||
directive == QLatin1String("include_next") ||
directive == QLatin1String("import")) {
include = true;
}
}
}
if (!include) {
*kind = T_EOF_SYMBOL;
start = pos;
} else {
if (*kind == T_DOT) {
start = findStartOfName(start);
const QChar ch4 = start > -1 ? m_interface->characterAt(start - 1) : QChar();
const QChar ch5 = start > 0 ? m_interface->characterAt(start - 2) : QChar();
const QChar ch6 = start > 1 ? m_interface->characterAt(start - 3) : QChar();
start = start - CppCompletionAssistProvider::activationSequenceChar(
ch4, ch5, ch6, kind, wantFunctionCall, false);
}
}
}
}
CppCompletionAssistProcessor::startOfOperator(m_interface->textDocument(),
positionInDocument,
kind,
start,
m_interface->languageFeatures(),
/*adjustForQt5SignalSlotCompletion=*/ true,
dotAtIncludeCompletionHandler);
return start; return start;
} }

View File

@@ -105,7 +105,7 @@ private:
TextEditor::IAssistProposal *createHintProposal(QList<CPlusPlus::Function *> symbols) const; TextEditor::IAssistProposal *createHintProposal(QList<CPlusPlus::Function *> symbols) const;
bool accepts() const; bool accepts() const;
int startOfOperator(int pos, unsigned *kind, bool wantFunctionCall) const; int startOfOperator(int positionInDocument, unsigned *kind, bool wantFunctionCall) const;
int findStartOfName(int pos = -1) const; int findStartOfName(int pos = -1) const;
int startCompletionHelper(); int startCompletionHelper();
bool tryObjCCompletion(); bool tryObjCCompletion();

View File

@@ -27,6 +27,17 @@
#include <cppeditor/cppeditorconstants.h> #include <cppeditor/cppeditorconstants.h>
#include <cplusplus/BackwardsScanner.h>
#include <cplusplus/ExpressionUnderCursor.h>
#include <cplusplus/SimpleLexer.h>
#include <cplusplus/Token.h>
#include <QTextBlock>
#include <QTextCursor>
#include <QTextDocument>
using namespace CPlusPlus;
namespace CppTools { namespace CppTools {
CppCompletionAssistProcessor::CppCompletionAssistProcessor() CppCompletionAssistProcessor::CppCompletionAssistProcessor()
@@ -70,4 +81,118 @@ void CppCompletionAssistProcessor::addSnippets()
m_completions.append(m_snippetCollector.collect()); m_completions.append(m_snippetCollector.collect());
} }
static bool isDoxygenTagCompletionCharacter(const QChar &character)
{
return character == QLatin1Char('\\')
|| character == QLatin1Char('@') ;
}
void CppCompletionAssistProcessor::startOfOperator(QTextDocument *textDocument,
int positionInDocument,
unsigned *kind,
int &start,
const CPlusPlus::LanguageFeatures &languageFeatures,
bool adjustForQt5SignalSlotCompletion,
DotAtIncludeCompletionHandler dotAtIncludeCompletionHandler)
{
if (start != positionInDocument) {
QTextCursor tc(textDocument);
tc.setPosition(positionInDocument);
// Include completion: make sure the quote character is the first one on the line
if (*kind == T_STRING_LITERAL) {
QTextCursor s = tc;
s.movePosition(QTextCursor::StartOfLine, QTextCursor::KeepAnchor);
QString sel = s.selectedText();
if (sel.indexOf(QLatin1Char('"')) < sel.length() - 1) {
*kind = T_EOF_SYMBOL;
start = positionInDocument;
}
}
if (*kind == T_COMMA) {
ExpressionUnderCursor expressionUnderCursor(languageFeatures);
if (expressionUnderCursor.startOfFunctionCall(tc) == -1) {
*kind = T_EOF_SYMBOL;
start = positionInDocument;
}
}
SimpleLexer tokenize;
tokenize.setLanguageFeatures(languageFeatures);
tokenize.setSkipComments(false);
const Tokens &tokens = tokenize(tc.block().text(), BackwardsScanner::previousBlockState(tc.block()));
const int tokenIdx = SimpleLexer::tokenBefore(tokens, qMax(0, tc.positionInBlock() - 1)); // get the token at the left of the cursor
const Token tk = (tokenIdx == -1) ? Token() : tokens.at(tokenIdx);
const QChar characterBeforePositionInDocument
= textDocument->characterAt(positionInDocument - 1);
if (adjustForQt5SignalSlotCompletion && *kind == T_AMPER && tokenIdx > 0) {
const Token &previousToken = tokens.at(tokenIdx - 1);
if (previousToken.kind() == T_COMMA)
start = positionInDocument - (tk.utf16charOffset - previousToken.utf16charOffset) - 1;
} else if (*kind == T_DOXY_COMMENT && !(tk.is(T_DOXY_COMMENT) || tk.is(T_CPP_DOXY_COMMENT))) {
*kind = T_EOF_SYMBOL;
start = positionInDocument;
// Do not complete in comments, except in doxygen comments for doxygen commands.
// Do not complete in strings, except it is for include completion.
} else if (tk.is(T_COMMENT) || tk.is(T_CPP_COMMENT)
|| ((tk.is(T_CPP_DOXY_COMMENT) || tk.is(T_DOXY_COMMENT))
&& !isDoxygenTagCompletionCharacter(characterBeforePositionInDocument))
|| (tk.isLiteral() && (*kind != T_STRING_LITERAL
&& *kind != T_ANGLE_STRING_LITERAL
&& *kind != T_SLASH
&& *kind != T_DOT))) {
*kind = T_EOF_SYMBOL;
start = positionInDocument;
// Include completion: can be triggered by slash, but only in a string
} else if (*kind == T_SLASH && (tk.isNot(T_STRING_LITERAL) && tk.isNot(T_ANGLE_STRING_LITERAL))) {
*kind = T_EOF_SYMBOL;
start = positionInDocument;
} else if (*kind == T_LPAREN) {
if (tokenIdx > 0) {
const Token &previousToken = tokens.at(tokenIdx - 1); // look at the token at the left of T_LPAREN
switch (previousToken.kind()) {
case T_IDENTIFIER:
case T_GREATER:
case T_SIGNAL:
case T_SLOT:
break; // good
default:
// that's a bad token :)
*kind = T_EOF_SYMBOL;
start = positionInDocument;
}
}
}
// Check for include preprocessor directive
else if (*kind == T_STRING_LITERAL || *kind == T_ANGLE_STRING_LITERAL || *kind == T_SLASH
|| (*kind == T_DOT
&& (tk.is(T_STRING_LITERAL) || tk.is(T_ANGLE_STRING_LITERAL)))) {
bool include = false;
if (tokens.size() >= 3) {
if (tokens.at(0).is(T_POUND) && tokens.at(1).is(T_IDENTIFIER) && (tokens.at(2).is(T_STRING_LITERAL) ||
tokens.at(2).is(T_ANGLE_STRING_LITERAL))) {
const Token &directiveToken = tokens.at(1);
QString directive = tc.block().text().mid(directiveToken.utf16charsBegin(),
directiveToken.utf16chars());
if (directive == QLatin1String("include") ||
directive == QLatin1String("include_next") ||
directive == QLatin1String("import")) {
include = true;
}
}
}
if (!include) {
*kind = T_EOF_SYMBOL;
start = positionInDocument;
} else if (*kind == T_DOT && dotAtIncludeCompletionHandler){
dotAtIncludeCompletionHandler(start, kind);
}
}
}
}
} // namespace CppTools } // namespace CppTools

View File

@@ -32,6 +32,16 @@
#include <cplusplus/Icons.h> #include <cplusplus/Icons.h>
#include <functional>
QT_BEGIN_NAMESPACE
class QTextDocument;
QT_END_NAMESPACE
namespace CPlusPlus {
struct LanguageFeatures;
}
namespace CppTools { namespace CppTools {
class CPPTOOLS_EXPORT CppCompletionAssistProcessor : public TextEditor::IAssistProcessor class CPPTOOLS_EXPORT CppCompletionAssistProcessor : public TextEditor::IAssistProcessor
@@ -42,6 +52,16 @@ public:
protected: protected:
void addSnippets(); void addSnippets();
using DotAtIncludeCompletionHandler = std::function<void(int &startPosition, unsigned *kind)>;
static void startOfOperator(QTextDocument *textDocument,
int positionInDocument,
unsigned *kind,
int &start,
const CPlusPlus::LanguageFeatures &languageFeatures,
bool adjustForQt5SignalSlotCompletion = false,
DotAtIncludeCompletionHandler dotAtIncludeCompletionHandler
= DotAtIncludeCompletionHandler());
int m_positionForProposal; int m_positionForProposal;
QList<TextEditor::AssistProposalItemInterface *> m_completions; QList<TextEditor::AssistProposalItemInterface *> m_completions;
QStringList m_preprocessorCompletions; QStringList m_preprocessorCompletions;

File diff suppressed because it is too large Load Diff

View File

@@ -33,222 +33,287 @@ namespace CppTools {
enum DoxygenReservedWord { enum DoxygenReservedWord {
T_DOXY_IDENTIFIER, T_DOXY_IDENTIFIER,
T_DOXY_A,
T_DOXY_ABSTRACT,
T_DOXY_ADDINDEX,
T_DOXY_ADDTOGROUP,
T_DOXY_ANCHOR,
T_DOXY_ANNOTATEDLIST,
T_DOXY_ARG, T_DOXY_ARG,
T_DOXY_ATTENTION, T_DOXY_ATTENTION,
T_DOXY_AUTHOR, T_DOXY_AUTHOR,
T_DOXY_CALLGRAPH, T_DOXY_AUTHORS,
T_DOXY_CODE,
T_DOXY_DOT,
T_DOXY_ELSE,
T_DOXY_ENDCODE,
T_DOXY_ENDCOND,
T_DOXY_ENDDOT,
T_DOXY_ENDHTMLONLY,
T_DOXY_ENDIF,
T_DOXY_ENDLATEXONLY,
T_DOXY_ENDLINK,
T_DOXY_ENDMANONLY,
T_DOXY_ENDVERBATIM,
T_DOXY_ENDXMLONLY,
T_DOXY_HIDEINITIALIZER,
T_DOXY_HTMLONLY,
T_DOXY_INTERFACE,
T_DOXY_INTERNAL,
T_DOXY_INVARIANT,
T_DOXY_LATEXONLY,
T_DOXY_LI,
T_DOXY_MANONLY,
T_DOXY_N,
T_DOXY_NOSUBGROUPING,
T_DOXY_NOTE,
T_DOXY_ONLY,
T_DOXY_POST,
T_DOXY_PRE,
T_DOXY_REMARKS,
T_DOXY_RETURN,
T_DOXY_RETURNS,
T_DOXY_SA,
T_DOXY_SEE,
T_DOXY_SHOWINITIALIZER,
T_DOXY_SINCE,
T_DOXY_TEST,
T_DOXY_TODO,
T_DOXY_VERBATIM,
T_DOXY_WARNING,
T_DOXY_XMLONLY,
T_DOXY_A,
T_DOXY_ADDTOGROUP,
T_DOXY_ANCHOR,
T_DOXY_B, T_DOXY_B,
T_DOXY_C,
T_DOXY_CLASS,
T_DOXY_COND,
T_DOXY_COPYDOC,
T_DOXY_DEF,
T_DOXY_DONTINCLUDE,
T_DOXY_DOTFILE,
T_DOXY_E,
T_DOXY_ELSEIF,
T_DOXY_EM,
T_DOXY_ENUM,
T_DOXY_EXAMPLE,
T_DOXY_EXCEPTION,
T_DOXY_EXCEPTIONS,
T_DOXY_FILE,
T_DOXY_HTMLINCLUDE,
T_DOXY_IF,
T_DOXY_IFNOT,
T_DOXY_INCLUDE,
T_DOXY_LINK,
T_DOXY_NAMESPACE,
T_DOXY_P,
T_DOXY_PACKAGE,
T_DOXY_REF,
T_DOXY_RELATES,
T_DOXY_RELATESALSO,
T_DOXY_RETVAL,
T_DOXY_THROW,
T_DOXY_THROWS,
T_DOXY_VERBINCLUDE,
T_DOXY_VERSION,
T_DOXY_XREFITEM,
T_DOXY_PARAM,
T_DOXY_IMAGE,
T_DOXY_DEFGROUP,
T_DOXY_PAGE,
T_DOXY_PARAGRAPH,
T_DOXY_SECTION,
T_DOXY_STRUCT,
T_DOXY_SUBSECTION,
T_DOXY_SUBSUBSECTION,
T_DOXY_UNION,
T_DOXY_WEAKGROUP,
T_DOXY_ADDINDEX,
T_DOXY_BRIEF,
T_DOXY_BUG,
T_DOXY_DATE,
T_DOXY_DEPRECATED,
T_DOXY_FN,
T_DOXY_INGROUP,
T_DOXY_LINE,
T_DOXY_MAINPAGE,
T_DOXY_NAME,
T_DOXY_OVERLOAD,
T_DOXY_PAR,
T_DOXY_SHORT,
T_DOXY_SKIP,
T_DOXY_SKIPLINE,
T_DOXY_TYPEDEF,
T_DOXY_UNTIL,
T_DOXY_VAR,
T_FIRST_QDOC_TAG,
T_DOXY_ABSTRACT = T_FIRST_QDOC_TAG,
T_DOXY_BADCODE, T_DOXY_BADCODE,
T_DOXY_BASENAME, T_DOXY_BASENAME,
T_DOXY_BOLD, T_DOXY_BOLD,
T_DOXY_BRIEF,
T_DOXY_BUG,
T_DOXY_C,
T_DOXY_CALLERGRAPH,
T_DOXY_CALLGRAPH,
T_DOXY_CAPTION, T_DOXY_CAPTION,
T_DOXY_CATEGORY,
T_DOXY_CHAPTER, T_DOXY_CHAPTER,
T_DOXY_CITE,
T_DOXY_CLASS,
T_DOXY_CODE,
T_DOXY_CODELINE, T_DOXY_CODELINE,
T_DOXY_COMPAT,
T_DOXY_COND,
T_DOXY_CONTENTSPAGE,
T_DOXY_COPYBRIEF,
T_DOXY_COPYDETAILS,
T_DOXY_COPYDOC,
T_DOXY_COPYRIGHT,
T_DOXY_CORELIB,
T_DOXY_DATE,
T_DOXY_DEF,
T_DOXY_DEFAULT,
T_DOXY_DEFGROUP,
T_DOXY_DEPRECATED,
T_DOXY_DETAILS,
T_DOXY_DIAFILE,
T_DOXY_DIR,
T_DOXY_DIV,
T_DOXY_DOCBOOKONLY,
T_DOXY_DONTINCLUDE,
T_DOXY_DOT,
T_DOXY_DOTFILE,
T_DOXY_DOTS, T_DOXY_DOTS,
T_DOXY_E,
T_DOXY_ELSE,
T_DOXY_ELSEIF,
T_DOXY_EM,
T_DOXY_ENDABSTRACT, T_DOXY_ENDABSTRACT,
T_DOXY_ENDCHAPTER, T_DOXY_ENDCHAPTER,
T_DOXY_ENDCODE,
T_DOXY_ENDCOND,
T_DOXY_ENDDOCBOOKONLY,
T_DOXY_ENDDOT,
T_DOXY_ENDFOOTNOTE, T_DOXY_ENDFOOTNOTE,
T_DOXY_ENDHTMLONLY,
T_DOXY_ENDIF,
T_DOXY_ENDINTERNAL,
T_DOXY_ENDLATEXONLY,
T_DOXY_ENDLEGALESE, T_DOXY_ENDLEGALESE,
T_DOXY_ENDLINK,
T_DOXY_ENDLIST, T_DOXY_ENDLIST,
T_DOXY_ENDMANONLY,
T_DOXY_ENDMSC,
T_DOXY_ENDOMIT, T_DOXY_ENDOMIT,
T_DOXY_ENDPARBLOCK,
T_DOXY_ENDPART, T_DOXY_ENDPART,
T_DOXY_ENDQUOTATION, T_DOXY_ENDQUOTATION,
T_DOXY_ENDRAW, T_DOXY_ENDRAW,
T_DOXY_ENDRTFONLY,
T_DOXY_ENDSECREFLIST,
T_DOXY_ENDSECTION1, T_DOXY_ENDSECTION1,
T_DOXY_ENDSECTION2, T_DOXY_ENDSECTION2,
T_DOXY_ENDSECTION3, T_DOXY_ENDSECTION3,
T_DOXY_ENDSECTION4, T_DOXY_ENDSECTION4,
T_DOXY_ENDSIDEBAR, T_DOXY_ENDSIDEBAR,
T_DOXY_ENDTABLE, T_DOXY_ENDTABLE,
T_DOXY_ENDUML,
T_DOXY_ENDVERBATIM,
T_DOXY_ENDXMLONLY,
T_DOXY_ENUM,
T_DOXY_EXAMPLE,
T_DOXY_EXCEPTION,
T_DOXY_EXCEPTIONS,
T_DOXY_EXPIRE, T_DOXY_EXPIRE,
T_DOXY_EXTENDS,
T_DOXY_EXTERNALPAGE,
T_DOXY_FILE,
T_DOXY_FN,
T_DOXY_FOOTNOTE, T_DOXY_FOOTNOTE,
T_DOXY_GENERATELIST, T_DOXY_GENERATELIST,
T_DOXY_GRANULARITY, T_DOXY_GRANULARITY,
T_DOXY_GROUP,
T_DOXY_GUI,
T_DOXY_HEADER, T_DOXY_HEADER,
T_DOXY_HEADERFILE,
T_DOXY_HIDECALLERGRAPH,
T_DOXY_HIDECALLGRAPH,
T_DOXY_HIDEINITIALIZER,
T_DOXY_HTMLINCLUDE,
T_DOXY_HTMLONLY,
T_DOXY_I, T_DOXY_I,
T_DOXY_IDLEXCEPT,
T_DOXY_IF,
T_DOXY_IFNOT,
T_DOXY_IMAGE,
T_DOXY_IMPLEMENTS,
T_DOXY_INCLUDE,
T_DOXY_INCLUDELINENO,
T_DOXY_INDEX, T_DOXY_INDEX,
T_DOXY_INDEXPAGE,
T_DOXY_INGROUP,
T_DOXY_INHEADERFILE,
T_DOXY_INHERITS,
T_DOXY_INLINEIMAGE, T_DOXY_INLINEIMAGE,
T_DOXY_INMODULE,
T_DOXY_INPUBLICGROUP,
T_DOXY_INQMLMODULE,
T_DOXY_INSTANTIATES,
T_DOXY_INTERFACE,
T_DOXY_INTERNAL,
T_DOXY_INVARIANT,
T_DOXY_KEYWORD, T_DOXY_KEYWORD,
T_DOXY_L, T_DOXY_L,
T_DOXY_LATEXINCLUDE,
T_DOXY_LATEXONLY,
T_DOXY_LEGALESE, T_DOXY_LEGALESE,
T_DOXY_LI,
T_DOXY_LINE,
T_DOXY_LINK,
T_DOXY_LIST, T_DOXY_LIST,
T_DOXY_MACRO,
T_DOXY_MAINCLASS,
T_DOXY_MAINPAGE,
T_DOXY_MANONLY,
T_DOXY_MEMBEROF,
T_DOXY_META, T_DOXY_META,
T_DOXY_MODULE,
T_DOXY_MSC,
T_DOXY_MSCFILE,
T_DOXY_N,
T_DOXY_NAME,
T_DOXY_NAMESPACE,
T_DOXY_NETWORK,
T_DOXY_NEWCODE, T_DOXY_NEWCODE,
T_DOXY_NEXTPAGE,
T_DOXY_NOAUTOLIST,
T_DOXY_NONREENTRANT,
T_DOXY_NOSUBGROUPING,
T_DOXY_NOTE,
T_DOXY_O, T_DOXY_O,
T_DOXY_OBSOLETE,
T_DOXY_OLDCODE, T_DOXY_OLDCODE,
T_DOXY_OMIT, T_DOXY_OMIT,
T_DOXY_OMITVALUE, T_DOXY_OMITVALUE,
T_DOXY_ONLY,
T_DOXY_OPENGL,
T_DOXY_OVERLOAD,
T_DOXY_P,
T_DOXY_PACKAGE,
T_DOXY_PAGE,
T_DOXY_PAR,
T_DOXY_PARAGRAPH,
T_DOXY_PARAM,
T_DOXY_PARBLOCK,
T_DOXY_PART, T_DOXY_PART,
T_DOXY_POST,
T_DOXY_PRE,
T_DOXY_PRELIMINARY,
T_DOXY_PREVIOUSPAGE,
T_DOXY_PRINTLINE, T_DOXY_PRINTLINE,
T_DOXY_PRINTTO, T_DOXY_PRINTTO,
T_DOXY_PRINTUNTIL, T_DOXY_PRINTUNTIL,
T_DOXY_PRIVATE,
T_DOXY_PRIVATESECTION,
T_DOXY_PROPERTY,
T_DOXY_PROTECTED,
T_DOXY_PROTECTEDSECTION,
T_DOXY_PROTOCOL,
T_DOXY_PUBLIC,
T_DOXY_PUBLICSECTION,
T_DOXY_PURE,
T_DOXY_QMLABSTRACT,
T_DOXY_QMLATTACHEDPROPERTY,
T_DOXY_QMLATTACHEDSIGNAL,
T_DOXY_QMLBASICTYPE,
T_DOXY_QMLCLASS,
T_DOXY_QMLMETHOD,
T_DOXY_QMLMODULE,
T_DOXY_QMLPROPERTY,
T_DOXY_QMLSIGNAL,
T_DOXY_QMLTYPE,
T_DOXY_QT3SUPPORT,
T_DOXY_QTESTLIB,
T_DOXY_QUOTATION, T_DOXY_QUOTATION,
T_DOXY_QUOTEFILE, T_DOXY_QUOTEFILE,
T_DOXY_QUOTEFROMFILE, T_DOXY_QUOTEFROMFILE,
T_DOXY_QUOTEFUNCTION, T_DOXY_QUOTEFUNCTION,
T_DOXY_RAW, T_DOXY_RAW,
T_DOXY_REENTRANT,
T_DOXY_REF,
T_DOXY_REFITEM,
T_DOXY_REIMP,
T_DOXY_RELATED,
T_DOXY_RELATEDALSO,
T_DOXY_RELATES,
T_DOXY_RELATESALSO,
T_DOXY_REMARK,
T_DOXY_REMARKS,
T_DOXY_RESULT,
T_DOXY_RETURN,
T_DOXY_RETURNS,
T_DOXY_RETVAL,
T_DOXY_ROW, T_DOXY_ROW,
T_DOXY_RTFONLY,
T_DOXY_SA,
T_DOXY_SECREFLIST,
T_DOXY_SECTION,
T_DOXY_SECTION1, T_DOXY_SECTION1,
T_DOXY_SECTION2, T_DOXY_SECTION2,
T_DOXY_SECTION3, T_DOXY_SECTION3,
T_DOXY_SECTION4, T_DOXY_SECTION4,
T_DOXY_SEE,
T_DOXY_SERVICE,
T_DOXY_SHORT,
T_DOXY_SHOWINITIALIZER,
T_DOXY_SIDEBAR, T_DOXY_SIDEBAR,
T_DOXY_SINCE,
T_DOXY_SKIP,
T_DOXY_SKIPLINE,
T_DOXY_SKIPTO, T_DOXY_SKIPTO,
T_DOXY_SKIPUNTIL, T_DOXY_SKIPUNTIL,
T_DOXY_SNIPPET, T_DOXY_SNIPPET,
T_DOXY_SPAN,
T_DOXY_SQL,
T_DOXY_STARTPAGE,
T_DOXY_STARTUML,
T_DOXY_STRUCT,
T_DOXY_SUB, T_DOXY_SUB,
T_DOXY_SUBPAGE,
T_DOXY_SUBSECTION,
T_DOXY_SUBSUBSECTION,
T_DOXY_SUBTITLE,
T_DOXY_SUP, T_DOXY_SUP,
T_DOXY_SVG,
T_DOXY_TABLE, T_DOXY_TABLE,
T_DOXY_TABLEOFCONTENTS, T_DOXY_TABLEOFCONTENTS,
T_DOXY_TARGET, T_DOXY_TARGET,
T_DOXY_TEST,
T_DOXY_THREADSAFE,
T_DOXY_THROW,
T_DOXY_THROWS,
T_DOXY_TITLE,
T_DOXY_TODO,
T_DOXY_TPARAM,
T_DOXY_TT, T_DOXY_TT,
T_DOXY_TYPEDEF,
T_DOXY_UICONTROL,
T_DOXY_UITOOLS,
T_DOXY_UNDERLINE, T_DOXY_UNDERLINE,
T_DOXY_UNICODE, T_DOXY_UNICODE,
T_DOXY_UNION,
T_DOXY_UNTIL,
T_DOXY_VALUE, T_DOXY_VALUE,
T_DOXY_CONTENTSPAGE, T_DOXY_VAR,
T_DOXY_EXTERNALPAGE,
T_DOXY_GROUP,
T_DOXY_HEADERFILE,
T_DOXY_INDEXPAGE,
T_DOXY_INHEADERFILE,
T_DOXY_MACRO,
T_DOXY_MODULE,
T_DOXY_NEXTPAGE,
T_DOXY_PREVIOUSPAGE,
T_DOXY_PROPERTY,
T_DOXY_REIMP,
T_DOXY_SERVICE,
T_DOXY_STARTPAGE,
T_DOXY_VARIABLE, T_DOXY_VARIABLE,
T_DOXY_COMPAT, T_DOXY_VERBATIM,
T_DOXY_INMODULE, T_DOXY_VERBINCLUDE,
T_DOXY_MAINCLASS, T_DOXY_VERSION,
T_DOXY_NONREENTRANT, T_DOXY_VHDLFLOW,
T_DOXY_OBSOLETE, T_DOXY_WARNING,
T_DOXY_PRELIMINARY, T_DOXY_WEAKGROUP,
T_DOXY_INPUBLICGROUP,
T_DOXY_REENTRANT,
T_DOXY_SUBTITLE,
T_DOXY_THREADSAFE,
T_DOXY_TITLE,
T_DOXY_CORELIB,
T_DOXY_UITOOLS,
T_DOXY_GUI,
T_DOXY_NETWORK,
T_DOXY_OPENGL,
T_DOXY_QT3SUPPORT,
T_DOXY_SVG,
T_DOXY_SQL,
T_DOXY_QTESTLIB,
T_DOXY_WEBKIT, T_DOXY_WEBKIT,
T_DOXY_XML, T_DOXY_XML,
T_DOXY_XMLONLY,
T_DOXY_XREFITEM,
T_DOXY_LAST_TAG T_DOXY_LAST_TAG
}; };

View File

@@ -0,0 +1,286 @@
%token-prefix=T_DOXY_
%toupper
%char-type=QChar
%unicode-function=.unicode()
%%
a
abstract
addindex
addtogroup
anchor
annotatedlist
arg
attention
author
authors
b
badcode
basename
bold
brief
bug
c
callergraph
callgraph
caption
category
chapter
cite
class
code
codeline
compat
cond
contentspage
copybrief
copydetails
copydoc
copyright
corelib
date
def
default
defgroup
deprecated
details
diafile
dir
div
docbookonly
dontinclude
dot
dotfile
dots
e
else
elseif
em
endabstract
endchapter
endcode
endcond
enddocbookonly
enddot
endfootnote
endhtmlonly
endif
endinternal
endlatexonly
endlegalese
endlink
endlist
endmanonly
endmsc
endomit
endparblock
endpart
endquotation
endraw
endrtfonly
endsecreflist
endsection1
endsection2
endsection3
endsection4
endsidebar
endtable
enduml
endverbatim
endxmlonly
enum
example
exception
exceptions
expire
extends
externalpage
file
fn
footnote
generatelist
granularity
group
gui
header
headerfile
hidecallergraph
hidecallgraph
hideinitializer
htmlinclude
htmlonly
i
idlexcept
if
ifnot
image
implements
include
includelineno
index
indexpage
ingroup
inheaderfile
inherits
inlineimage
inmodule
inpublicgroup
inqmlmodule
instantiates
interface
internal
invariant
keyword
l
latexinclude
latexonly
legalese
li
line
link
list
macro
mainclass
mainpage
manonly
memberof
meta
module
msc
mscfile
n
name
namespace
network
newcode
nextpage
noautolist
nonreentrant
nosubgrouping
note
o
obsolete
oldcode
omit
omitvalue
only
opengl
overload
p
package
page
par
paragraph
param
parblock
part
post
pre
preliminary
previouspage
printline
printto
printuntil
private
privatesection
property
protected
protectedsection
protocol
public
publicsection
pure
qmlabstract
qmlattachedproperty
qmlattachedsignal
qmlbasictype
qmlclass
qmlmethod
qmlmodule
qmlproperty
qmlsignal
qmltype
qt3support
qtestlib
quotation
quotefile
quotefromfile
quotefunction
raw
reentrant
ref
refitem
reimp
related
relatedalso
relates
relatesalso
remark
remarks
result
return
returns
retval
row
rtfonly
sa
secreflist
section
section1
section2
section3
section4
see
service
short
showinitializer
sidebar
since
skip
skipline
skipto
skipuntil
snippet
span
sql
startpage
startuml
struct
sub
subpage
subsection
subsubsection
subtitle
sup
svg
table
tableofcontents
target
test
threadsafe
throw
throws
title
todo
tparam
tt
typedef
uicontrol
uitools
underline
unicode
union
until
value
var
variable
verbatim
verbinclude
version
vhdlflow
warning
weakgroup
webkit
xml
xmlonly
xrefitem

View File

@@ -115,7 +115,6 @@ struct Result
} // anonymous namespace } // anonymous namespace
Q_DECLARE_METATYPE(Result) Q_DECLARE_METATYPE(Result)
Q_DECLARE_METATYPE(QList<Result>)
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
namespace QTest { namespace QTest {

View File

@@ -48,8 +48,6 @@ using namespace CppTools::Internal;
using namespace ExtensionSystem; using namespace ExtensionSystem;
using namespace Utils; using namespace Utils;
Q_DECLARE_METATYPE(ILocatorFilter *)
namespace { namespace {
enum { debug = 0 }; enum { debug = 0 };

View File

@@ -67,8 +67,6 @@
#include <sstream> #include <sstream>
#endif #endif
Q_DECLARE_METATYPE(QSet<QString>)
static const bool DumpProjectInfo = qgetenv("QTC_DUMP_PROJECT_INFO") == "1"; static const bool DumpProjectInfo = qgetenv("QTC_DUMP_PROJECT_INFO") == "1";
using namespace CppTools; using namespace CppTools;

View File

@@ -57,7 +57,7 @@ using namespace ProjectExplorer;
typedef CPlusPlus::Document Document; typedef CPlusPlus::Document Document;
Q_DECLARE_METATYPE(QVector<ProjectFile>) Q_DECLARE_METATYPE(ProjectFile)
namespace { namespace {

View File

@@ -108,6 +108,9 @@ private slots:
void test_global_completion_data(); void test_global_completion_data();
void test_global_completion(); void test_global_completion();
void test_doxygen_tag_completion_data();
void test_doxygen_tag_completion();
void test_completion_member_access_operator_data(); void test_completion_member_access_operator_data();
void test_completion_member_access_operator(); void test_completion_member_access_operator();

View File

@@ -175,8 +175,6 @@ typedef QList<Virtuality> VirtualityList;
} // CppTools namespace } // CppTools namespace
Q_DECLARE_METATYPE(CppTools::Internal::Virtuality) Q_DECLARE_METATYPE(CppTools::Internal::Virtuality)
Q_DECLARE_METATYPE(CppTools::Internal::VirtualityList)
Q_DECLARE_METATYPE(QList<int>)
namespace CppTools { namespace CppTools {
namespace Internal { namespace Internal {

View File

@@ -33,8 +33,6 @@
#include <cassert> #include <cassert>
Q_DECLARE_METATYPE(QSet<QString>)
using namespace CppTools::Internal; using namespace CppTools::Internal;
using namespace CppTools::Tests; using namespace CppTools::Tests;

View File

@@ -126,7 +126,6 @@ private:
} // anonymous namespace } // anonymous namespace
Q_DECLARE_METATYPE(ResultData) Q_DECLARE_METATYPE(ResultData)
Q_DECLARE_METATYPE(ResultDataList)
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
namespace QTest { namespace QTest {

View File

@@ -57,7 +57,7 @@ namespace Internal {
Console::Console() Console::Console()
{ {
m_consoleItemModel = new ConsoleItemModel; m_consoleItemModel = new ConsoleItemModel(this);
m_consoleWidget = new QWidget; m_consoleWidget = new QWidget;
m_consoleWidget->setWindowTitle(displayName()); m_consoleWidget->setWindowTitle(displayName());

View File

@@ -6,6 +6,12 @@
<file>images/debugger_continue@2x.png</file> <file>images/debugger_continue@2x.png</file>
<file>images/debugger_continue_mask.png</file> <file>images/debugger_continue_mask.png</file>
<file>images/debugger_continue_mask@2x.png</file> <file>images/debugger_continue_mask@2x.png</file>
<file>images/stop_overlay_small.png</file>
<file>images/stop_overlay_small@2x.png</file>
<file>images/interrupt_overlay_small.png</file>
<file>images/interrupt_overlay_small@2x.png</file>
<file>images/continue_overlay_small.png</file>
<file>images/continue_overlay_small@2x.png</file>
<file>images/debugger_empty_14.png</file> <file>images/debugger_empty_14.png</file>
<file>images/debugger_interrupt.png</file> <file>images/debugger_interrupt.png</file>
<file>images/debugger_interrupt@2x.png</file> <file>images/debugger_interrupt@2x.png</file>

View File

@@ -47,11 +47,20 @@ const Utils::Icon CONTINUE(
const Utils::Icon CONTINUE_FLAT({ const Utils::Icon CONTINUE_FLAT({
{QLatin1String(":/projectexplorer/images/debugger_beetle_mask.png"), Utils::Theme::IconsDebugColor}, {QLatin1String(":/projectexplorer/images/debugger_beetle_mask.png"), Utils::Theme::IconsDebugColor},
{QLatin1String(":/debugger/images/debugger_continue_mask.png"), Utils::Theme::IconsRunColor}}); {QLatin1String(":/debugger/images/debugger_continue_mask.png"), Utils::Theme::IconsRunColor}});
const Utils::Icon DEBUG_CONTINUE_SMALL({
{QLatin1String(":/projectexplorer/images/debugger_overlay_small.png"), Utils::Theme::IconsDebugColor},
{QLatin1String(":/debugger/images/continue_overlay_small.png"), Utils::Theme::IconsRunColor}});
const Utils::Icon INTERRUPT( const Utils::Icon INTERRUPT(
QLatin1String(":/debugger/images/debugger_interrupt.png")); QLatin1String(":/debugger/images/debugger_interrupt.png"));
const Utils::Icon INTERRUPT_FLAT({ const Utils::Icon INTERRUPT_FLAT({
{QLatin1String(":/projectexplorer/images/debugger_beetle_mask.png"), Utils::Theme::IconsDebugColor}, {QLatin1String(":/projectexplorer/images/debugger_beetle_mask.png"), Utils::Theme::IconsDebugColor},
{QLatin1String(":/debugger/images/debugger_interrupt_mask.png"), Utils::Theme::IconsInterruptColor}}); {QLatin1String(":/debugger/images/debugger_interrupt_mask.png"), Utils::Theme::IconsInterruptColor}});
const Utils::Icon DEBUG_INTERRUPT_SMALL({
{QLatin1String(":/projectexplorer/images/debugger_overlay_small.png"), Utils::Theme::IconsDebugColor},
{QLatin1String(":/debugger/images/interrupt_overlay_small.png"), Utils::Theme::IconsInterruptColor}});
const Utils::Icon DEBUG_EXIT_SMALL({
{QLatin1String(":/projectexplorer/images/debugger_overlay_small.png"), Utils::Theme::IconsDebugColor},
{QLatin1String(":/debugger/images/stop_overlay_small.png"), Utils::Theme::IconsStopColor}});
const Utils::Icon LOCATION( const Utils::Icon LOCATION(
QLatin1String(":/debugger/images/location_16.png")); QLatin1String(":/debugger/images/location_16.png"));
const Utils::Icon SNAPSHOT( const Utils::Icon SNAPSHOT(

View File

@@ -79,11 +79,24 @@ DebuggerMainWindow::DebuggerMainWindow()
DebuggerMainWindow::~DebuggerMainWindow() DebuggerMainWindow::~DebuggerMainWindow()
{ {
// as we have to setParent(0) on dock widget that are not selected, // We keep track of widgets for operations that haven't been activated, yet, and make sure we
// we keep track of all and make sure we don't leak any // don't leak any.
foreach (const DockPtr &ptr, m_dockWidgets) { foreach (const Perspective &perspective, m_perspectiveForPerspectiveId) {
if (ptr) foreach (const Perspective::Operation &operation, perspective.operations()) {
delete ptr.data(); if (operation.widget) {
// There are two possible states: Either addDockForWidget(widget) has
// been called on an operation.widget (e.g. when the perspective gets
// activated for the first time), or not. In the first case we don't
// have to explicitly delete it as we have called setParent(this) on
// it. In the second case, if the widget didn't have a parent before,
// we have to delete it.
if (!operation.widget->parentWidget()) {
// These are from perspectives that were never activated and didn't
// have a parent to begin with.
delete operation.widget;
}
}
}
} }
} }
@@ -119,11 +132,6 @@ QDockWidget *DebuggerMainWindow::dockWidget(const QByteArray &dockId) const
return m_dockForDockId.value(dockId); return m_dockForDockId.value(dockId);
} }
QWidget *DebuggerMainWindow::modeWindow()
{
return m_modeWindow;
}
void DebuggerMainWindow::resetCurrentPerspective() void DebuggerMainWindow::resetCurrentPerspective()
{ {
loadPerspectiveHelper(m_currentPerspectiveId, false); loadPerspectiveHelper(m_currentPerspectiveId, false);
@@ -140,7 +148,7 @@ void DebuggerMainWindow::restorePerspective(const QByteArray &perspectiveId)
m_perspectiveChooser->setCurrentIndex(index); m_perspectiveChooser->setCurrentIndex(index);
} }
void DebuggerMainWindow::finalizeSetup(Core::IMode *mode, QWidget *central) void DebuggerMainWindow::finalizeSetup()
{ {
auto viewButton = new QToolButton; auto viewButton = new QToolButton;
viewButton->setText(tr("Views")); viewButton->setText(tr("Views"));
@@ -195,7 +203,10 @@ void DebuggerMainWindow::finalizeSetup(Core::IMode *mode, QWidget *central)
m_toolbarDock = dock; m_toolbarDock = dock;
addDockWidget(Qt::BottomDockWidgetArea, dock); addDockWidget(Qt::BottomDockWidgetArea, dock);
}
QWidget *createModeWindow(Core::IMode *mode, DebuggerMainWindow *mainWindow, QWidget *central)
{
if (!central) if (!central)
central = new EditorManagerPlaceHolder(mode); central = new EditorManagerPlaceHolder(mode);
@@ -225,7 +236,7 @@ void DebuggerMainWindow::finalizeSetup(Core::IMode *mode, QWidget *central)
// Right-side window with editor, output etc. // Right-side window with editor, output etc.
auto mainWindowSplitter = new MiniSplitter; auto mainWindowSplitter = new MiniSplitter;
mainWindowSplitter->addWidget(this); mainWindowSplitter->addWidget(mainWindow);
mainWindowSplitter->addWidget(new OutputPanePlaceHolder(mode, mainWindowSplitter)); mainWindowSplitter->addWidget(new OutputPanePlaceHolder(mode, mainWindowSplitter));
auto outputPane = new OutputPanePlaceHolder(mode, mainWindowSplitter); auto outputPane = new OutputPanePlaceHolder(mode, mainWindowSplitter);
outputPane->setObjectName(QLatin1String("DebuggerOutputPanePlaceHolder")); outputPane->setObjectName(QLatin1String("DebuggerOutputPanePlaceHolder"));
@@ -242,9 +253,9 @@ void DebuggerMainWindow::finalizeSetup(Core::IMode *mode, QWidget *central)
splitter->setStretchFactor(0, 0); splitter->setStretchFactor(0, 0);
splitter->setStretchFactor(1, 1); splitter->setStretchFactor(1, 1);
splitter->setObjectName(QLatin1String("DebugModeWidget")); splitter->setObjectName(QLatin1String("DebugModeWidget"));
setCentralWidget(centralEditorWidget); mainWindow->setCentralWidget(centralEditorWidget);
m_modeWindow = splitter; return splitter;
} }
void DebuggerMainWindow::loadPerspectiveHelper(const QByteArray &perspectiveId, bool fromStoredSettings) void DebuggerMainWindow::loadPerspectiveHelper(const QByteArray &perspectiveId, bool fromStoredSettings)
@@ -254,10 +265,10 @@ void DebuggerMainWindow::loadPerspectiveHelper(const QByteArray &perspectiveId,
saveCurrentPerspective(); saveCurrentPerspective();
foreach (QDockWidget *dockWidget, m_dockForDockId) { foreach (QDockWidget *dockWidget, m_dockForDockId) {
QTC_ASSERT(dockWidget, continue); QTC_ASSERT(dockWidget, continue);
dockWidget->setFloating(false);
dockWidget->setParent(this);
removeDockWidget(dockWidget); removeDockWidget(dockWidget);
dockWidget->hide(); dockWidget->hide();
// Prevent saveState storing the data of the wrong children.
dockWidget->setParent(0);
} }
ICore::removeAdditionalContext(Context(Id::fromName(m_currentPerspectiveId))); ICore::removeAdditionalContext(Context(Id::fromName(m_currentPerspectiveId)));
@@ -350,8 +361,7 @@ QDockWidget *DebuggerMainWindow::registerDockWidget(const QByteArray &dockId, QW
{ {
QTC_ASSERT(!widget->objectName().isEmpty(), return 0); QTC_ASSERT(!widget->objectName().isEmpty(), return 0);
QDockWidget *dockWidget = addDockForWidget(widget); QDockWidget *dockWidget = addDockForWidget(widget);
dockWidget->setParent(0); dockWidget->setParent(this);
m_dockWidgets.append(DebuggerMainWindow::DockPtr(dockWidget));
m_dockForDockId[dockId] = dockWidget; m_dockForDockId[dockId] = dockWidget;
return dockWidget; return dockWidget;
} }

View File

@@ -60,7 +60,7 @@ public:
Qt::DockWidgetArea area = Qt::BottomDockWidgetArea); Qt::DockWidgetArea area = Qt::BottomDockWidgetArea);
QByteArray dockId; QByteArray dockId;
QWidget *widget = 0; QPointer<QWidget> widget;
QByteArray anchorDockId; QByteArray anchorDockId;
OperationType operationType; OperationType operationType;
bool visibleByDefault; bool visibleByDefault;
@@ -114,14 +114,12 @@ public:
void resetCurrentPerspective(); void resetCurrentPerspective();
void restorePerspective(const QByteArray &perspectiveId); void restorePerspective(const QByteArray &perspectiveId);
void finalizeSetup(Core::IMode *mode, QWidget *central = 0); void finalizeSetup();
void showStatusMessage(const QString &message, int timeoutMS); void showStatusMessage(const QString &message, int timeoutMS);
QDockWidget *dockWidget(const QByteArray &dockId) const; QDockWidget *dockWidget(const QByteArray &dockId) const;
QByteArray currentPerspective() const { return m_currentPerspectiveId; } QByteArray currentPerspective() const { return m_currentPerspectiveId; }
QWidget *modeWindow();
private: private:
QDockWidget *registerDockWidget(const QByteArray &dockId, QWidget *widget); QDockWidget *registerDockWidget(const QByteArray &dockId, QWidget *widget);
void loadPerspectiveHelper(const QByteArray &perspectiveId, bool fromStoredSettings = true); void loadPerspectiveHelper(const QByteArray &perspectiveId, bool fromStoredSettings = true);
@@ -135,12 +133,8 @@ private:
QHash<QByteArray, QDockWidget *> m_dockForDockId; QHash<QByteArray, QDockWidget *> m_dockForDockId;
QHash<QByteArray, QWidget *> m_toolbarForPerspectiveId; QHash<QByteArray, QWidget *> m_toolbarForPerspectiveId;
QHash<QByteArray, Perspective> m_perspectiveForPerspectiveId; QHash<QByteArray, Perspective> m_perspectiveForPerspectiveId;
// list of dock widgets to prevent memory leak
typedef QPointer<QDockWidget> DockPtr;
QList<DockPtr> m_dockWidgets;
QWidget *m_modeWindow = 0;
}; };
QWidget *createModeWindow(Core::IMode *mode, DebuggerMainWindow *mainWindow, QWidget *central);
} // Utils } // Utils

View File

@@ -486,41 +486,27 @@ bool DummyEngine::hasCapability(unsigned cap) const
class DebugModeContext : public IContext class DebugModeContext : public IContext
{ {
public: public:
DebugModeContext(DebuggerMainWindow *mainWindow) : m_mainWindow(mainWindow) DebugModeContext(QWidget *modeWindow)
{ {
setContext(Context(CC::C_EDITORMANAGER)); setContext(Context(CC::C_EDITORMANAGER));
setWidget(modeWindow);
ICore::addContextObject(this); ICore::addContextObject(this);
} }
QWidget *widget() const override { return m_mainWindow->modeWindow(); }
DebuggerMainWindow *m_mainWindow;
}; };
class DebugMode : public IMode class DebugMode : public IMode
{ {
public: public:
DebugMode(DebuggerMainWindow *mainWindow) : m_mainWindow(mainWindow) DebugMode()
{ {
setObjectName(QLatin1String("DebugMode")); setObjectName(QLatin1String("DebugMode"));
setContext(Context(C_DEBUGMODE, CC::C_NAVIGATION_PANE)); setContext(Context(C_DEBUGMODE, CC::C_NAVIGATION_PANE));
setDisplayName(DebuggerPlugin::tr("Debug")); setDisplayName(DebuggerPlugin::tr("Debug"));
setIcon(Utils::Icon::modeIcon(Icons::MODE_DEBUGGER_CLASSIC, setIcon(Utils::Icon::modeIcon(Icons::MODE_DEBUGGER_CLASSIC,
Icons::MODE_DEBUGGER_FLAT, Icons::MODE_DEBUGGER_FLAT_ACTIVE)); Icons::MODE_DEBUGGER_FLAT, Icons::MODE_DEBUGGER_FLAT_ACTIVE));
// setIcon(Utils::Icon::modeIcon(Icons::MODE_ANALYZE_CLASSIC,
// Icons::MODE_ANALYZE_FLAT, Icons::MODE_ANALYZE_FLAT_ACTIVE));
setPriority(85); setPriority(85);
setId(MODE_DEBUG); setId(MODE_DEBUG);
} }
QWidget *widget() const override { return m_mainWindow->modeWindow(); }
~DebugMode()
{
// delete m_widget;
}
DebuggerMainWindow *m_mainWindow;
}; };
/////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////
@@ -924,7 +910,9 @@ public:
void updateActiveLanguages(); void updateActiveLanguages();
public: public:
DebuggerMainWindow *m_mainWindow = 0; QPointer<DebuggerMainWindow> m_mainWindow;
QPointer<QWidget> m_modeWindow;
QPointer<DebugMode> m_mode;
QHash<Id, ActionDescription> m_descriptions; QHash<Id, ActionDescription> m_descriptions;
ActionContainer *m_menu = 0; ActionContainer *m_menu = 0;
@@ -1051,11 +1039,6 @@ DebuggerPluginPrivate::~DebuggerPluginPrivate()
delete m_breakHandler; delete m_breakHandler;
m_breakHandler = 0; m_breakHandler = 0;
// delete m_debugMode;
// m_debugMode = 0;
delete m_mainWindow;
m_mainWindow = 0;
} }
DebuggerEngine *DebuggerPluginPrivate::dummyEngine() DebuggerEngine *DebuggerPluginPrivate::dummyEngine()
@@ -1073,6 +1056,42 @@ static QString msgParameterMissing(const QString &a)
return DebuggerPlugin::tr("Option \"%1\" is missing the parameter.").arg(a); return DebuggerPlugin::tr("Option \"%1\" is missing the parameter.").arg(a);
} }
static Kit *guessKitFromParameters(const DebuggerRunParameters &rp)
{
Kit *kit = 0;
// Try to find a kit via ABI.
QList<Abi> abis;
if (rp.toolChainAbi.isValid())
abis.push_back(rp.toolChainAbi);
else if (!rp.inferior.executable.isEmpty())
abis = Abi::abisOfBinary(FileName::fromString(rp.inferior.executable));
if (!abis.isEmpty()) {
// Try exact abis.
kit = KitManager::find(KitMatcher([abis](const Kit *k) -> bool {
if (const ToolChain *tc = ToolChainKitInformation::toolChain(k))
return abis.contains(tc->targetAbi()) && DebuggerKitInformation::isValidDebugger(k);
return false;
}));
if (!kit) {
// Or something compatible.
kit = KitManager::find(KitMatcher([abis](const Kit *k) -> bool {
if (const ToolChain *tc = ToolChainKitInformation::toolChain(k))
foreach (const Abi &a, abis)
if (a.isCompatibleWith(tc->targetAbi()) && DebuggerKitInformation::isValidDebugger(k))
return true;
return false;
}));
}
}
if (!kit)
kit = KitManager::defaultKit();
return kit;
}
bool DebuggerPluginPrivate::parseArgument(QStringList::const_iterator &it, bool DebuggerPluginPrivate::parseArgument(QStringList::const_iterator &it,
const QStringList::const_iterator &cend, QString *errorMessage) const QStringList::const_iterator &cend, QString *errorMessage)
{ {
@@ -1135,6 +1154,9 @@ bool DebuggerPluginPrivate::parseArgument(QStringList::const_iterator &it,
rp.inferior.environment = Utils::Environment::systemEnvironment(); rp.inferior.environment = Utils::Environment::systemEnvironment();
rp.stubEnvironment = Utils::Environment::systemEnvironment(); rp.stubEnvironment = Utils::Environment::systemEnvironment();
rp.debuggerEnvironment = Utils::Environment::systemEnvironment(); rp.debuggerEnvironment = Utils::Environment::systemEnvironment();
if (!kit)
kit = guessKitFromParameters(rp);
m_scheduledStarts.append(QPair<DebuggerRunParameters, Kit *>(rp, kit)); m_scheduledStarts.append(QPair<DebuggerRunParameters, Kit *>(rp, kit));
return true; return true;
} }
@@ -1323,14 +1345,14 @@ bool DebuggerPluginPrivate::initialize(const QStringList &arguments,
this, &DebuggerPluginPrivate::updateWatchersHeader, Qt::QueuedConnection); this, &DebuggerPluginPrivate::updateWatchersHeader, Qt::QueuedConnection);
auto act = m_continueAction = new QAction(tr("Continue"), this); auto act = m_continueAction = new QAction(tr("Continue"), this);
act->setIcon(Icon::combinedIcon({Core::Icons::DEBUG_CONTINUE_SMALL.icon(), continueSideBarIcon})); act->setIcon(Icon::combinedIcon({Icons::DEBUG_CONTINUE_SMALL.icon(), continueSideBarIcon}));
connect(act, &QAction::triggered, this, &DebuggerPluginPrivate::handleExecContinue); connect(act, &QAction::triggered, this, &DebuggerPluginPrivate::handleExecContinue);
act = m_exitAction = new QAction(tr("Stop Debugger"), this); act = m_exitAction = new QAction(tr("Stop Debugger"), this);
act->setIcon(Core::Icons::DEBUG_EXIT_SMALL.icon()); act->setIcon(Icons::DEBUG_EXIT_SMALL.icon());
connect(act, &QAction::triggered, this, &DebuggerPluginPrivate::handleExecExit); connect(act, &QAction::triggered, this, &DebuggerPluginPrivate::handleExecExit);
auto interruptIcon = Icon::combinedIcon({Core::Icons::DEBUG_INTERRUPT_SMALL.icon(), interruptSideBarIcon}); auto interruptIcon = Icon::combinedIcon({Icons::DEBUG_INTERRUPT_SMALL.icon(), interruptSideBarIcon});
act = m_interruptAction = new QAction(tr("Interrupt"), this); act = m_interruptAction = new QAction(tr("Interrupt"), this);
act->setIcon(interruptIcon); act->setIcon(interruptIcon);
connect(act, &QAction::triggered, this, &DebuggerPluginPrivate::handleExecInterrupt); connect(act, &QAction::triggered, this, &DebuggerPluginPrivate::handleExecInterrupt);
@@ -1417,7 +1439,7 @@ bool DebuggerPluginPrivate::initialize(const QStringList &arguments,
act = m_startAction = new QAction(this); act = m_startAction = new QAction(this);
const QIcon sideBarIcon = const QIcon sideBarIcon =
Icon::sideBarIcon(ProjectExplorer::Icons::DEBUG_START, ProjectExplorer::Icons::DEBUG_START_FLAT); Icon::sideBarIcon(ProjectExplorer::Icons::DEBUG_START, ProjectExplorer::Icons::DEBUG_START_FLAT);
const QIcon debuggerIcon = Icon::combinedIcon({Core::Icons::DEBUG_START_SMALL.icon(), sideBarIcon}); const QIcon debuggerIcon = Icon::combinedIcon({ProjectExplorer::Icons::DEBUG_START_SMALL.icon(), sideBarIcon});
act->setIcon(debuggerIcon); act->setIcon(debuggerIcon);
act->setText(tr("Start Debugging")); act->setText(tr("Start Debugging"));
connect(act, &QAction::triggered, [] { ProjectExplorerPlugin::runStartupProject(ProjectExplorer::Constants::DEBUG_RUN_MODE); }); connect(act, &QAction::triggered, [] { ProjectExplorerPlugin::runStartupProject(ProjectExplorer::Constants::DEBUG_RUN_MODE); });
@@ -1709,13 +1731,16 @@ bool DebuggerPluginPrivate::initialize(const QStringList &arguments,
connect(ProjectExplorerPlugin::instance(), &ProjectExplorerPlugin::settingsChanged, connect(ProjectExplorerPlugin::instance(), &ProjectExplorerPlugin::settingsChanged,
this, &DebuggerPluginPrivate::updateDebugWithoutDeployMenu); this, &DebuggerPluginPrivate::updateDebugWithoutDeployMenu);
m_mainWindow->finalizeSetup();
// Debug mode setup // Debug mode setup
auto mode = new DebugMode(m_mainWindow); m_mode = new DebugMode;
m_modeWindow = createModeWindow(m_mode, m_mainWindow, 0);
m_mode->setWidget(m_modeWindow);
(void) new DebugModeContext(m_mainWindow); m_plugin->addAutoReleasedObject(new DebugModeContext(m_mainWindow));
m_mainWindow->finalizeSetup(mode);
m_plugin->addAutoReleasedObject(mode); m_plugin->addObject(m_mode);
connect(SessionManager::instance(), &SessionManager::startupProjectChanged, connect(SessionManager::instance(), &SessionManager::startupProjectChanged,
@@ -2074,6 +2099,8 @@ void DebuggerPlugin::attachExternalApplication(RunControl *rc)
if (const RunConfiguration *runConfiguration = rc->runConfiguration()) if (const RunConfiguration *runConfiguration = rc->runConfiguration())
if (const Target *target = runConfiguration->target()) if (const Target *target = runConfiguration->target())
kit = target->kit(); kit = target->kit();
if (!kit)
kit = guessKitFromParameters(rp);
createAndScheduleRun(rp, kit); createAndScheduleRun(rp, kit);
} }
@@ -3005,6 +3032,23 @@ void DebuggerPluginPrivate::aboutToShutdown()
disconnect(SessionManager::instance(), disconnect(SessionManager::instance(),
SIGNAL(startupProjectChanged(ProjectExplorer::Project*)), SIGNAL(startupProjectChanged(ProjectExplorer::Project*)),
this, 0); this, 0);
m_mainWindow->saveCurrentPerspective();
delete m_mainWindow;
m_mainWindow = 0;
// removeObject leads to aboutToRemoveObject, which leads to
// ModeManager::aboutToRemove, which leads to the mode manager
// removing the mode's widget from the stackwidget
// (currently by index, but possibly the stackwidget resets the
// parent and stuff on the widget)
m_plugin->removeObject(m_mode);
delete m_modeWindow;
m_modeWindow = 0;
delete m_mode;
m_mode = 0;
} }
void updateState(DebuggerEngine *engine) void updateState(DebuggerEngine *engine)
@@ -3172,7 +3216,6 @@ IPlugin::ShutdownFlag DebuggerPlugin::aboutToShutdown()
{ {
removeObject(this); removeObject(this);
dd->aboutToShutdown(); dd->aboutToShutdown();
dd->m_mainWindow->saveCurrentPerspective();
return SynchronousShutdown; return SynchronousShutdown;
} }
@@ -3479,15 +3522,15 @@ void registerToolbar(const QByteArray &perspectiveId, const ToolbarDescription &
QAction *createStartAction() QAction *createStartAction()
{ {
auto action = new QAction(DebuggerMainWindow::tr("Start"), 0); auto action = new QAction(DebuggerMainWindow::tr("Start"), DebuggerPlugin::instance());
action->setIcon(Debugger::Icons::ANALYZER_CONTROL_START.icon()); action->setIcon(Icons::ANALYZER_CONTROL_START.icon());
action->setEnabled(true); action->setEnabled(true);
return action; return action;
} }
QAction *createStopAction() QAction *createStopAction()
{ {
auto action = new QAction(DebuggerMainWindow::tr("Stop"), 0); auto action = new QAction(DebuggerMainWindow::tr("Stop"), DebuggerPlugin::instance());
action->setIcon(ProjectExplorer::Icons::STOP_SMALL.icon()); action->setIcon(ProjectExplorer::Icons::STOP_SMALL.icon());
action->setEnabled(true); action->setEnabled(true);
return action; return action;

View File

@@ -43,6 +43,7 @@
#include <projectexplorer/environmentaspect.h> // For the environment #include <projectexplorer/environmentaspect.h> // For the environment
#include <projectexplorer/project.h> #include <projectexplorer/project.h>
#include <projectexplorer/projectexplorer.h> #include <projectexplorer/projectexplorer.h>
#include <projectexplorer/projectexplorericons.h>
#include <projectexplorer/runnables.h> #include <projectexplorer/runnables.h>
#include <projectexplorer/target.h> #include <projectexplorer/target.h>
#include <projectexplorer/taskhub.h> #include <projectexplorer/taskhub.h>
@@ -54,7 +55,6 @@
#include <utils/qtcprocess.h> #include <utils/qtcprocess.h>
#include <coreplugin/icore.h> #include <coreplugin/icore.h>
#include <coreplugin/coreconstants.h> #include <coreplugin/coreconstants.h>
#include <coreplugin/coreicons.h>
#include <qmldebug/qmldebugcommandlinearguments.h> #include <qmldebug/qmldebugcommandlinearguments.h>
#include <qtsupport/qtkitinformation.h> #include <qtsupport/qtkitinformation.h>
@@ -111,7 +111,7 @@ DebuggerRunControl::DebuggerRunControl(RunConfiguration *runConfig, DebuggerEngi
m_engine(engine), m_engine(engine),
m_running(false) m_running(false)
{ {
setIcon(Core::Icons::DEBUG_START_SMALL); setIcon(ProjectExplorer::Icons::DEBUG_START_SMALL);
connect(this, &RunControl::finished, this, &DebuggerRunControl::handleFinished); connect(this, &RunControl::finished, this, &DebuggerRunControl::handleFinished);
connect(engine, &DebuggerEngine::requestRemoteSetup, connect(engine, &DebuggerEngine::requestRemoteSetup,
@@ -321,6 +321,7 @@ void DebuggerRunControlCreator::initialize(const DebuggerStartParameters &sp)
void DebuggerRunControlCreator::enrich(const RunConfiguration *runConfig, const Kit *kit) void DebuggerRunControlCreator::enrich(const RunConfiguration *runConfig, const Kit *kit)
{ {
m_runConfig = runConfig; m_runConfig = runConfig;
QTC_ASSERT(kit, return);
Target *target = 0; Target *target = 0;
Project *project = 0; Project *project = 0;
@@ -329,13 +330,6 @@ void DebuggerRunControlCreator::enrich(const RunConfiguration *runConfig, const
if (m_runConfig) if (m_runConfig)
target = m_runConfig->target(); target = m_runConfig->target();
if (!kit && target)
kit = target->kit();
// Make sure we have something sensible to start with.
m_rp.inferior.runMode = ApplicationLauncher::Console;
m_rp.useTerminal = false;
// Extract as much as possible from available RunConfiguration. // Extract as much as possible from available RunConfiguration.
if (m_runConfig && m_runConfig->runnable().is<StandardRunnable>()) { if (m_runConfig && m_runConfig->runnable().is<StandardRunnable>()) {
m_rp.inferior = m_runConfig->runnable().as<StandardRunnable>(); m_rp.inferior = m_runConfig->runnable().as<StandardRunnable>();
@@ -351,46 +345,6 @@ void DebuggerRunControlCreator::enrich(const RunConfiguration *runConfig, const
m_rp.inferior.executable = p.exe; m_rp.inferior.executable = p.exe;
} }
if (!kit) {
// This code can only be reached when starting via the command line
// (-debug pid or executable) or attaching from runconfiguration
// without specifying a kit. Try to find a kit via ABI.
QList<Abi> abis;
if (m_rp.toolChainAbi.isValid()) {
abis.push_back(m_rp.toolChainAbi);
} else if (!m_rp.inferior.executable.isEmpty()) {
abis = Abi::abisOfBinary(FileName::fromString(m_rp.inferior.executable));
}
if (!abis.isEmpty()) {
// Try exact abis.
kit = KitManager::find(KitMatcher([abis](const Kit *k) -> bool {
if (const ToolChain *tc = ToolChainKitInformation::toolChain(k))
return abis.contains(tc->targetAbi()) && DebuggerKitInformation::isValidDebugger(k);
return false;
}));
if (!kit) {
// Or something compatible.
kit = KitManager::find(KitMatcher([abis](const Kit *k) -> bool {
if (const ToolChain *tc = ToolChainKitInformation::toolChain(k))
foreach (const Abi &a, abis)
if (a.isCompatibleWith(tc->targetAbi()) && DebuggerKitInformation::isValidDebugger(k))
return true;
return false;
}));
}
}
}
if (!kit)
kit = KitManager::defaultKit();
// We really should have a kit now.
if (!kit) {
m_errors.append(DebuggerKitInformation::tr("No kit found."));
return;
}
m_rp.macroExpander = kit->macroExpander(); m_rp.macroExpander = kit->macroExpander();
if (m_runConfig) { if (m_runConfig) {
@@ -416,7 +370,7 @@ void DebuggerRunControlCreator::enrich(const RunConfiguration *runConfig, const
if (project && m_rp.projectSourceFiles.isEmpty()) if (project && m_rp.projectSourceFiles.isEmpty())
m_rp.projectSourceFiles = project->files(Project::SourceFiles); m_rp.projectSourceFiles = project->files(Project::SourceFiles);
if (false && project && kit) { if (false && project) {
const QtSupport::BaseQtVersion *version = QtSupport::QtKitInformation::qtVersion(kit); const QtSupport::BaseQtVersion *version = QtSupport::QtKitInformation::qtVersion(kit);
m_rp.nativeMixedEnabled = version && version->qtVersion() >= QtSupport::QtVersionNumber(5, 7, 0); m_rp.nativeMixedEnabled = version && version->qtVersion() >= QtSupport::QtVersionNumber(5, 7, 0);
} }
@@ -622,7 +576,7 @@ public:
// We cover only local setup here. Remote setups are handled by the // We cover only local setup here. Remote setups are handled by the
// RunControl factories in the target specific plugins. // RunControl factories in the target specific plugins.
DebuggerRunControlCreator creator; DebuggerRunControlCreator creator;
creator.enrich(runConfig, 0); creator.enrich(runConfig, runConfig->target()->kit());
creator.createRunControl(mode); creator.createRunControl(mode);
if (errorMessage) if (errorMessage)
*errorMessage = creator.fullError(); *errorMessage = creator.fullError();
@@ -660,6 +614,7 @@ QObject *createDebuggerRunControlFactory(QObject *parent)
*/ */
DebuggerRunControl *createAndScheduleRun(const DebuggerRunParameters &rp, const Kit *kit) DebuggerRunControl *createAndScheduleRun(const DebuggerRunParameters &rp, const Kit *kit)
{ {
QTC_ASSERT(kit, return 0); // Caller needs to look for a suitable kit.
DebuggerRunControlCreator creator; DebuggerRunControlCreator creator;
creator.m_rp = rp; creator.m_rp = rp;
creator.enrich(0, kit); creator.enrich(0, kit);
@@ -683,9 +638,10 @@ DebuggerRunControl *createDebuggerRunControl(const DebuggerStartParameters &sp,
QString *errorMessage, QString *errorMessage,
Core::Id runMode) Core::Id runMode)
{ {
QTC_ASSERT(runConfig, return 0);
DebuggerRunControlCreator creator; DebuggerRunControlCreator creator;
creator.initialize(sp); creator.initialize(sp);
creator.enrich(runConfig, 0); creator.enrich(runConfig, runConfig->target()->kit());
creator.createRunControl(runMode); creator.createRunControl(runMode);
if (errorMessage) if (errorMessage)
*errorMessage = creator.fullError(); *errorMessage = creator.fullError();

View File

Before

Width:  |  Height:  |  Size: 163 B

After

Width:  |  Height:  |  Size: 163 B

View File

Before

Width:  |  Height:  |  Size: 277 B

After

Width:  |  Height:  |  Size: 277 B

View File

Before

Width:  |  Height:  |  Size: 94 B

After

Width:  |  Height:  |  Size: 94 B

View File

Before

Width:  |  Height:  |  Size: 97 B

After

Width:  |  Height:  |  Size: 97 B

View File

Before

Width:  |  Height:  |  Size: 94 B

After

Width:  |  Height:  |  Size: 94 B

View File

Before

Width:  |  Height:  |  Size: 97 B

After

Width:  |  Height:  |  Size: 97 B

View File

@@ -1078,16 +1078,24 @@ Qt::ItemFlags WatchModel::flags(const QModelIndex &idx) const
const Qt::ItemFlags notEditable = Qt::ItemIsSelectable | Qt::ItemIsEnabled; const Qt::ItemFlags notEditable = Qt::ItemIsSelectable | Qt::ItemIsEnabled;
const Qt::ItemFlags editable = notEditable | Qt::ItemIsEditable; const Qt::ItemFlags editable = notEditable | Qt::ItemIsEditable;
bool isRunning = true;
switch (state) {
case InferiorStopOk:
case InferiorUnrunnable:
case DebuggerNotReady:
case DebuggerFinished:
isRunning = false;
break;
default:
break;
}
if (item->isWatcher()) { if (item->isWatcher()) {
if (state == InferiorUnrunnable) if (state == InferiorUnrunnable)
return (column == 0 && item->iname.count('.') == 1) ? editable : notEditable; return (column == 0 && item->iname.count('.') == 1) ? editable : notEditable;
if (state != InferiorStopOk if (isRunning && !m_engine->hasCapability(AddWatcherWhileRunningCapability))
&& state != DebuggerNotReady return notEditable;
&& state != DebuggerFinished
&& !m_engine->hasCapability(AddWatcherWhileRunningCapability))
return Qt::ItemFlags();
if (column == 0 && item->iname.count('.') == 1) if (column == 0 && item->iname.count('.') == 1)
return editable; // Watcher names are editable. return editable; // Watcher names are editable.
if (column == 1 && item->arrayIndex >= 0) if (column == 1 && item->arrayIndex >= 0)
@@ -1101,8 +1109,10 @@ Qt::ItemFlags WatchModel::flags(const QModelIndex &idx) const
return editable; // Watcher values are sometimes editable. return editable; // Watcher values are sometimes editable.
} }
} else if (item->isLocal()) { } else if (item->isLocal()) {
if (state != InferiorStopOk && !m_engine->hasCapability(AddWatcherWhileRunningCapability)) if (state == InferiorUnrunnable)
return Qt::ItemFlags(); return notEditable;
if (isRunning && !m_engine->hasCapability(AddWatcherWhileRunningCapability))
return notEditable;
if (column == 1 && item->valueEditable && !item->elided) if (column == 1 && item->valueEditable && !item->elided)
return editable; // Locals values are sometimes editable. return editable; // Locals values are sometimes editable.
if (column == 1 && item->arrayIndex >= 0) if (column == 1 && item->arrayIndex >= 0)
@@ -1787,7 +1797,7 @@ static void showInEditorHelper(const WatchItem *item, QTextStream &ts, int depth
{ {
const QChar tab = QLatin1Char('\t'); const QChar tab = QLatin1Char('\t');
const QChar nl = QLatin1Char('\n'); const QChar nl = QLatin1Char('\n');
ts << QString(depth, tab) << item->name << tab << item->value << tab ts << QString(depth, tab) << item->name << tab << displayValue(item) << tab
<< item->type << nl; << item->type << nl;
foreach (const TreeItem *child, item->children()) foreach (const TreeItem *child, item->children())
showInEditorHelper(static_cast<const WatchItem *>(child), ts, depth + 1); showInEditorHelper(static_cast<const WatchItem *>(child), ts, depth + 1);

View File

@@ -3,7 +3,9 @@
<file>images/find.png</file> <file>images/find.png</file>
<file>images/book.png</file> <file>images/book.png</file>
<file>images/home.png</file> <file>images/home.png</file>
<file>images/home@2x.png</file>
<file>images/bookmark.png</file> <file>images/bookmark.png</file>
<file>images/bookmark@2x.png</file>
<file>images/category_help.png</file> <file>images/category_help.png</file>
<file>images/mode_help.png</file> <file>images/mode_help.png</file>
<file>images/mode_help@2x.png</file> <file>images/mode_help@2x.png</file>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 134 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 162 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 146 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 251 B

View File

@@ -136,9 +136,9 @@ QNetworkReply *HelpNetworkAccessManager::createRequest(Operation op,
return new HelpNetworkReply(request, data.data, data.mimeType); return new HelpNetworkReply(request, data.data, data.mimeType);
} }
// - HelpPage // - QtWebKitHelpPage
HelpPage::HelpPage(QObject *parent) QtWebKitHelpPage::QtWebKitHelpPage(QObject *parent)
: QWebPage(parent) : QWebPage(parent)
, closeNewTabIfNeeded(false) , closeNewTabIfNeeded(false)
, m_pressedButtons(Qt::NoButton) , m_pressedButtons(Qt::NoButton)
@@ -149,18 +149,18 @@ HelpPage::HelpPage(QObject *parent)
SLOT(onHandleUnsupportedContent(QNetworkReply*))); SLOT(onHandleUnsupportedContent(QNetworkReply*)));
} }
QWebPage *HelpPage::createWindow(QWebPage::WebWindowType) QWebPage *QtWebKitHelpPage::createWindow(QWebPage::WebWindowType)
{ {
// TODO: ensure that we'll get a QtWebKitHelpViewer here // TODO: ensure that we'll get a QtWebKitHelpViewer here
QtWebKitHelpViewer* viewer = static_cast<QtWebKitHelpViewer *>(OpenPagesManager::instance() QtWebKitHelpViewer* viewer = static_cast<QtWebKitHelpViewer *>(OpenPagesManager::instance()
.createPage()); .createPage());
HelpPage *newPage = viewer->page(); QtWebKitHelpPage *newPage = viewer->page();
newPage->closeNewTabIfNeeded = closeNewTabIfNeeded; newPage->closeNewTabIfNeeded = closeNewTabIfNeeded;
closeNewTabIfNeeded = false; closeNewTabIfNeeded = false;
return newPage; return newPage;
} }
void HelpPage::triggerAction(WebAction action, bool checked) void QtWebKitHelpPage::triggerAction(WebAction action, bool checked)
{ {
switch (action) { switch (action) {
case OpenLinkInNewWindow: case OpenLinkInNewWindow:
@@ -171,7 +171,7 @@ void HelpPage::triggerAction(WebAction action, bool checked)
} }
} }
bool HelpPage::acceptNavigationRequest(QWebFrame *frame, const QNetworkRequest &request, bool QtWebKitHelpPage::acceptNavigationRequest(QWebFrame *frame, const QNetworkRequest &request,
QWebPage::NavigationType type) QWebPage::NavigationType type)
{ {
const bool closeNewTab = closeNewTabIfNeeded; const bool closeNewTab = closeNewTabIfNeeded;
@@ -198,7 +198,7 @@ bool HelpPage::acceptNavigationRequest(QWebFrame *frame, const QNetworkRequest &
return true; return true;
} }
void HelpPage::onHandleUnsupportedContent(QNetworkReply *reply) void QtWebKitHelpPage::onHandleUnsupportedContent(QNetworkReply *reply)
{ {
// sub resource of this page // sub resource of this page
if (m_loadingUrl != reply->url()) { if (m_loadingUrl != reply->url()) {
@@ -254,7 +254,7 @@ QtWebKitHelpWidget::QtWebKitHelpWidget(QtWebKitHelpViewer *parent)
QWebSettings::globalSettings()->setAttribute(QWebSettings::DnsPrefetchEnabled, true); QWebSettings::globalSettings()->setAttribute(QWebSettings::DnsPrefetchEnabled, true);
setPage(new HelpPage(this)); setPage(new QtWebKitHelpPage(this));
HelpNetworkAccessManager *manager = new HelpNetworkAccessManager(this); HelpNetworkAccessManager *manager = new HelpNetworkAccessManager(this);
page()->setNetworkAccessManager(manager); page()->setNetworkAccessManager(manager);
connect(manager, SIGNAL(finished(QNetworkReply*)), this, connect(manager, SIGNAL(finished(QNetworkReply*)), this,
@@ -323,7 +323,7 @@ void QtWebKitHelpWidget::mousePressEvent(QMouseEvent *event)
if (Utils::HostOsInfo::isLinuxHost() && m_parent->handleForwardBackwardMouseButtons(event)) if (Utils::HostOsInfo::isLinuxHost() && m_parent->handleForwardBackwardMouseButtons(event))
return; return;
if (HelpPage *currentPage = static_cast<HelpPage*>(page())) { if (QtWebKitHelpPage *currentPage = static_cast<QtWebKitHelpPage*>(page())) {
currentPage->m_pressedButtons = event->buttons(); currentPage->m_pressedButtons = event->buttons();
currentPage->m_keyboardModifiers = event->modifiers(); currentPage->m_keyboardModifiers = event->modifiers();
} }
@@ -402,7 +402,7 @@ QtWebKitHelpViewer::QtWebKitHelpViewer(QWidget *parent)
connect(m_webView->page(), SIGNAL(printRequested(QWebFrame*)), this, SIGNAL(printRequested())); connect(m_webView->page(), SIGNAL(printRequested(QWebFrame*)), this, SIGNAL(printRequested()));
connect(m_webView, SIGNAL(backwardAvailable(bool)), this, SIGNAL(backwardAvailable(bool))); connect(m_webView, SIGNAL(backwardAvailable(bool)), this, SIGNAL(backwardAvailable(bool)));
connect(m_webView, SIGNAL(forwardAvailable(bool)), this, SIGNAL(forwardAvailable(bool))); connect(m_webView, SIGNAL(forwardAvailable(bool)), this, SIGNAL(forwardAvailable(bool)));
connect(page(), &HelpPage::linkHovered, this, &QtWebKitHelpViewer::setToolTip); connect(page(), &QtWebKitHelpPage::linkHovered, this, &QtWebKitHelpViewer::setToolTip);
} }
QFont QtWebKitHelpViewer::viewerFont() const QFont QtWebKitHelpViewer::viewerFont() const
@@ -582,9 +582,9 @@ bool QtWebKitHelpViewer::findText(const QString &text, FindFlags flags,
return found; return found;
} }
HelpPage *QtWebKitHelpViewer::page() const QtWebKitHelpPage *QtWebKitHelpViewer::page() const
{ {
return static_cast<HelpPage *>(m_webView->page()); return static_cast<QtWebKitHelpPage *>(m_webView->page());
} }
void QtWebKitHelpViewer::copy() void QtWebKitHelpViewer::copy()

View File

@@ -35,7 +35,7 @@
namespace Help { namespace Help {
namespace Internal { namespace Internal {
class HelpPage; class QtWebKitHelpPage;
class QtWebKitHelpWidget; class QtWebKitHelpWidget;
class QtWebKitHelpViewer : public HelpViewer class QtWebKitHelpViewer : public HelpViewer
@@ -69,7 +69,7 @@ public:
bool findText(const QString &text, Core::FindFlags flags, bool findText(const QString &text, Core::FindFlags flags,
bool incremental, bool fromSearch, bool *wrapped = 0); bool incremental, bool fromSearch, bool *wrapped = 0);
HelpPage *page() const; QtWebKitHelpPage *page() const;
public slots: public slots:
void scaleUp(); void scaleUp();
@@ -127,11 +127,11 @@ private:
QtWebKitHelpViewer *m_parent; QtWebKitHelpViewer *m_parent;
}; };
class HelpPage : public QWebPage class QtWebKitHelpPage : public QWebPage
{ {
Q_OBJECT Q_OBJECT
public: public:
HelpPage(QObject *parent); QtWebKitHelpPage(QObject *parent);
protected: protected:
virtual QWebPage *createWindow(QWebPage::WebWindowType); virtual QWebPage *createWindow(QWebPage::WebWindowType);

View File

@@ -81,8 +81,6 @@ private slots:
void goToHistoryItem(); void goToHistoryItem();
private: private:
QVariant loadResource(int type, const QUrl &name);
TextBrowserHelpWidget *m_textBrowser; TextBrowserHelpWidget *m_textBrowser;
}; };
@@ -109,11 +107,11 @@ private:
QString linkAt(const QPoint& pos); QString linkAt(const QPoint& pos);
void openLink(const QUrl &url, bool newPage); void openLink(const QUrl &url, bool newPage);
public:
int zoomCount; int zoomCount;
bool forceFont; bool forceFont;
bool m_openInNewPageActionVisible; bool m_openInNewPageActionVisible;
TextBrowserHelpViewer *m_parent; TextBrowserHelpViewer *m_parent;
friend class Help::Internal::TextBrowserHelpViewer;
}; };
} // namespace Internal } // namespace Internal

View File

@@ -73,7 +73,7 @@ WebEngineHelpViewer::WebEngineHelpViewer(QWidget *parent) :
HelpViewer(parent), HelpViewer(parent),
m_widget(new WebView(this)) m_widget(new WebView(this))
{ {
m_widget->setPage(new HelpPage(this)); m_widget->setPage(new WebEngineHelpPage(this));
auto layout = new QVBoxLayout; auto layout = new QVBoxLayout;
setLayout(layout); setLayout(layout);
layout->setContentsMargins(0, 0, 0, 0); layout->setContentsMargins(0, 0, 0, 0);
@@ -226,9 +226,9 @@ bool WebEngineHelpViewer::findText(const QString &text, Core::FindFlags flags, b
return true; return true;
} }
HelpPage *WebEngineHelpViewer::page() const WebEngineHelpPage *WebEngineHelpViewer::page() const
{ {
return static_cast<HelpPage *>(m_widget->page()); return static_cast<WebEngineHelpPage *>(m_widget->page());
} }
void WebEngineHelpViewer::scaleUp() void WebEngineHelpViewer::scaleUp()
@@ -271,12 +271,12 @@ void WebEngineHelpViewer::print(QPrinter *printer)
Q_UNUSED(printer) Q_UNUSED(printer)
} }
HelpPage::HelpPage(QObject *parent) WebEngineHelpPage::WebEngineHelpPage(QObject *parent)
: QWebEnginePage(parent) : QWebEnginePage(parent)
{ {
} }
QWebEnginePage *HelpPage::createWindow(QWebEnginePage::WebWindowType) QWebEnginePage *WebEngineHelpPage::createWindow(QWebEnginePage::WebWindowType)
{ {
auto viewer = static_cast<WebEngineHelpViewer *>(OpenPagesManager::instance().createPage()); auto viewer = static_cast<WebEngineHelpViewer *>(OpenPagesManager::instance().createPage());
return viewer->page(); return viewer->page();

View File

@@ -40,10 +40,10 @@ public:
void requestStarted(QWebEngineUrlRequestJob *job) override; void requestStarted(QWebEngineUrlRequestJob *job) override;
}; };
class HelpPage : public QWebEnginePage class WebEngineHelpPage : public QWebEnginePage
{ {
public: public:
explicit HelpPage(QObject *parent = 0); explicit WebEngineHelpPage(QObject *parent = 0);
QWebEnginePage *createWindow(QWebEnginePage::WebWindowType) override; QWebEnginePage *createWindow(QWebEnginePage::WebWindowType) override;
}; };
@@ -83,7 +83,7 @@ public:
void setOpenInNewPageActionVisible(bool visible) override; void setOpenInNewPageActionVisible(bool visible) override;
bool findText(const QString &text, Core::FindFlags flags, bool incremental, bool fromSearch, bool *wrapped) override; bool findText(const QString &text, Core::FindFlags flags, bool incremental, bool fromSearch, bool *wrapped) override;
HelpPage *page() const; WebEngineHelpPage *page() const;
public slots: public slots:
void scaleUp() override; void scaleUp() override;

View File

@@ -28,8 +28,8 @@
#include "iosrunconfiguration.h" #include "iosrunconfiguration.h"
#include "iosrunner.h" #include "iosrunner.h"
#include <coreplugin/coreicons.h>
#include <projectexplorer/projectexplorerconstants.h> #include <projectexplorer/projectexplorerconstants.h>
#include <projectexplorer/projectexplorericons.h>
using namespace ProjectExplorer; using namespace ProjectExplorer;
@@ -41,7 +41,7 @@ IosRunControl::IosRunControl(IosRunConfiguration *rc)
, m_runner(new IosRunner(this, rc, false, QmlDebug::NoQmlDebugServices)) , m_runner(new IosRunner(this, rc, false, QmlDebug::NoQmlDebugServices))
, m_running(false) , m_running(false)
{ {
setIcon(Core::Icons::DEBUG_START_SMALL); setIcon(Icons::RUN_SMALL);
} }
IosRunControl::~IosRunControl() IosRunControl::~IosRunControl()

View File

@@ -181,7 +181,7 @@ AppOutputPane::AppOutputPane() :
// Attach // Attach
m_attachButton->setToolTip(msgAttachDebuggerTooltip()); m_attachButton->setToolTip(msgAttachDebuggerTooltip());
m_attachButton->setEnabled(false); m_attachButton->setEnabled(false);
m_attachButton->setIcon(Core::Icons::DEBUG_START_SMALL.icon()); m_attachButton->setIcon(Icons::DEBUG_START_SMALL.icon());
m_attachButton->setAutoRaise(true); m_attachButton->setAutoRaise(true);
connect(m_attachButton, &QAbstractButton::clicked, connect(m_attachButton, &QAbstractButton::clicked,

View File

@@ -62,6 +62,7 @@ static const char compilerCommandKeyC[] = "ProjectExplorer.GccToolChain.Path";
static const char compilerPlatformCodeGenFlagsKeyC[] = "ProjectExplorer.GccToolChain.PlatformCodeGenFlags"; static const char compilerPlatformCodeGenFlagsKeyC[] = "ProjectExplorer.GccToolChain.PlatformCodeGenFlags";
static const char compilerPlatformLinkerFlagsKeyC[] = "ProjectExplorer.GccToolChain.PlatformLinkerFlags"; static const char compilerPlatformLinkerFlagsKeyC[] = "ProjectExplorer.GccToolChain.PlatformLinkerFlags";
static const char targetAbiKeyC[] = "ProjectExplorer.GccToolChain.TargetAbi"; static const char targetAbiKeyC[] = "ProjectExplorer.GccToolChain.TargetAbi";
static const char originalTargetTripleKeyC[] = "ProjectExplorer.GccToolChain.OriginalTargetTriple";
static const char supportedAbisKeyC[] = "ProjectExplorer.GccToolChain.SupportedAbis"; static const char supportedAbisKeyC[] = "ProjectExplorer.GccToolChain.SupportedAbis";
static QByteArray runGcc(const FileName &gcc, const QStringList &arguments, const QStringList &env) static QByteArray runGcc(const FileName &gcc, const QStringList &arguments, const QStringList &env)
@@ -214,19 +215,20 @@ static QList<Abi> guessGccAbi(const QString &m, const QByteArray &macros)
return abiList; return abiList;
} }
static QList<Abi> guessGccAbi(const FileName &path, const QStringList &env,
const QByteArray &macros, static GccToolChain::DetectedAbisResult guessGccAbi(const FileName &path, const QStringList &env,
const QStringList &extraArgs = QStringList()) const QByteArray &macros,
const QStringList &extraArgs = QStringList())
{ {
if (path.isEmpty()) if (path.isEmpty())
return QList<Abi>(); return GccToolChain::DetectedAbisResult();
QStringList arguments = extraArgs; QStringList arguments = extraArgs;
arguments << QLatin1String("-dumpmachine"); arguments << QLatin1String("-dumpmachine");
QString machine = QString::fromLocal8Bit(runGcc(path, arguments, env)).trimmed(); QString machine = QString::fromLocal8Bit(runGcc(path, arguments, env)).trimmed();
if (machine.isEmpty()) if (machine.isEmpty())
return QList<Abi>(); // no need to continue if running failed once... return GccToolChain::DetectedAbisResult(); // no need to continue if running failed once...
return guessGccAbi(machine, macros); return GccToolChain::DetectedAbisResult(guessGccAbi(machine, macros), machine);
} }
static QString gccVersion(const FileName &path, const QStringList &env) static QString gccVersion(const FileName &path, const QStringList &env)
@@ -260,6 +262,11 @@ void GccToolChain::setSupportedAbis(const QList<Abi> &m_abis)
m_supportedAbis = m_abis; m_supportedAbis = m_abis;
} }
void GccToolChain::setOriginalTargetTriple(const QString &targetTriple)
{
m_originalTargetTriple = targetTriple;
}
void GccToolChain::setMacroCache(const QStringList &allCxxflags, const QByteArray &macros) const void GccToolChain::setMacroCache(const QStringList &allCxxflags, const QByteArray &macros) const
{ {
if (macros.isNull()) if (macros.isNull())
@@ -318,6 +325,11 @@ Abi GccToolChain::targetAbi() const
return m_targetAbi; return m_targetAbi;
} }
QString GccToolChain::originalTargetTriple() const
{
return m_originalTargetTriple;
}
QString GccToolChain::version() const QString GccToolChain::version() const
{ {
if (m_version.isEmpty()) if (m_version.isEmpty())
@@ -620,7 +632,9 @@ void GccToolChain::resetToolChain(const FileName &path)
setCompilerCommand(path); setCompilerCommand(path);
Abi currentAbi = m_targetAbi; Abi currentAbi = m_targetAbi;
m_supportedAbis = detectSupportedAbis(); const DetectedAbisResult detectedAbis = detectSupportedAbis();
m_supportedAbis = detectedAbis.supportedAbis;
m_originalTargetTriple = detectedAbis.originalTargetTriple;
m_targetAbi = Abi(); m_targetAbi = Abi();
if (!m_supportedAbis.isEmpty()) { if (!m_supportedAbis.isEmpty()) {
@@ -687,6 +701,7 @@ QVariantMap GccToolChain::toMap() const
data.insert(QLatin1String(compilerPlatformCodeGenFlagsKeyC), m_platformCodeGenFlags); data.insert(QLatin1String(compilerPlatformCodeGenFlagsKeyC), m_platformCodeGenFlags);
data.insert(QLatin1String(compilerPlatformLinkerFlagsKeyC), m_platformLinkerFlags); data.insert(QLatin1String(compilerPlatformLinkerFlagsKeyC), m_platformLinkerFlags);
data.insert(QLatin1String(targetAbiKeyC), m_targetAbi.toString()); data.insert(QLatin1String(targetAbiKeyC), m_targetAbi.toString());
data.insert(QLatin1String(originalTargetTripleKeyC), m_originalTargetTriple);
QStringList abiList = Utils::transform(m_supportedAbis, &Abi::toString); QStringList abiList = Utils::transform(m_supportedAbis, &Abi::toString);
data.insert(QLatin1String(supportedAbisKeyC), abiList); data.insert(QLatin1String(supportedAbisKeyC), abiList);
return data; return data;
@@ -701,6 +716,7 @@ bool GccToolChain::fromMap(const QVariantMap &data)
m_platformCodeGenFlags = data.value(QLatin1String(compilerPlatformCodeGenFlagsKeyC)).toStringList(); m_platformCodeGenFlags = data.value(QLatin1String(compilerPlatformCodeGenFlagsKeyC)).toStringList();
m_platformLinkerFlags = data.value(QLatin1String(compilerPlatformLinkerFlagsKeyC)).toStringList(); m_platformLinkerFlags = data.value(QLatin1String(compilerPlatformLinkerFlagsKeyC)).toStringList();
m_targetAbi = Abi(data.value(QLatin1String(targetAbiKeyC)).toString()); m_targetAbi = Abi(data.value(QLatin1String(targetAbiKeyC)).toString());
m_originalTargetTriple = data.value(QLatin1String(originalTargetTripleKeyC)).toString();
QStringList abiList = data.value(QLatin1String(supportedAbisKeyC)).toStringList(); QStringList abiList = data.value(QLatin1String(supportedAbisKeyC)).toStringList();
m_supportedAbis.clear(); m_supportedAbis.clear();
foreach (const QString &a, abiList) { foreach (const QString &a, abiList) {
@@ -730,11 +746,14 @@ ToolChainConfigWidget *GccToolChain::configurationWidget()
void GccToolChain::updateSupportedAbis() const void GccToolChain::updateSupportedAbis() const
{ {
if (m_supportedAbis.isEmpty()) if (m_supportedAbis.isEmpty()) {
m_supportedAbis = detectSupportedAbis(); const DetectedAbisResult detected = detectSupportedAbis();
m_supportedAbis = detected.supportedAbis;
m_originalTargetTriple = detected.originalTargetTriple;
}
} }
QList<Abi> GccToolChain::detectSupportedAbis() const GccToolChain::DetectedAbisResult GccToolChain::detectSupportedAbis() const
{ {
Environment env = Environment::systemEnvironment(); Environment env = Environment::systemEnvironment();
addToEnvironment(env); addToEnvironment(env);
@@ -827,7 +846,10 @@ QList<ToolChain *> GccToolChainFactory::autoDetectToolchains(const QString &comp
GccToolChain::addCommandPathToEnvironment(compilerPath, systemEnvironment); GccToolChain::addCommandPathToEnvironment(compilerPath, systemEnvironment);
QByteArray macros QByteArray macros
= gccPredefinedMacros(compilerPath, gccPredefinedMacrosOptions(), systemEnvironment.toStringList()); = gccPredefinedMacros(compilerPath, gccPredefinedMacrosOptions(), systemEnvironment.toStringList());
QList<Abi> abiList = guessGccAbi(compilerPath, systemEnvironment.toStringList(), macros); const GccToolChain::DetectedAbisResult detectedAbis = guessGccAbi(compilerPath,
systemEnvironment.toStringList(),
macros);
QList<Abi> abiList = detectedAbis.supportedAbis;
if (!abiList.contains(requiredAbi)) { if (!abiList.contains(requiredAbi)) {
if (requiredAbi.wordWidth() != 64 if (requiredAbi.wordWidth() != 64
|| !abiList.contains(Abi(requiredAbi.architecture(), requiredAbi.os(), requiredAbi.osFlavor(), || !abiList.contains(Abi(requiredAbi.architecture(), requiredAbi.os(), requiredAbi.osFlavor(),
@@ -844,6 +866,7 @@ QList<ToolChain *> GccToolChainFactory::autoDetectToolchains(const QString &comp
tc->setCompilerCommand(compilerPath); tc->setCompilerCommand(compilerPath);
tc->setSupportedAbis(abiList); tc->setSupportedAbis(abiList);
tc->setTargetAbi(abi); tc->setTargetAbi(abi);
tc->setOriginalTargetTriple(detectedAbis.originalTargetTriple);
tc->setDisplayName(tc->defaultDisplayName()); // reset displayname tc->setDisplayName(tc->defaultDisplayName()); // reset displayname
result.append(tc.take()); result.append(tc.take());
@@ -902,6 +925,7 @@ void GccToolChainConfigWidget::applyImpl()
tc->setCompilerCommand(m_compilerCommand->fileName()); tc->setCompilerCommand(m_compilerCommand->fileName());
tc->setSupportedAbis(m_abiWidget->supportedAbis()); tc->setSupportedAbis(m_abiWidget->supportedAbis());
tc->setTargetAbi(m_abiWidget->currentAbi()); tc->setTargetAbi(m_abiWidget->currentAbi());
tc->setOriginalTargetTriple(tc->detectSupportedAbis().originalTargetTriple);
tc->setDisplayName(displayName); // reset display name tc->setDisplayName(displayName); // reset display name
tc->setPlatformCodeGenFlags(splitString(m_platformCodeGenFlagsLineEdit->text())); tc->setPlatformCodeGenFlags(splitString(m_platformCodeGenFlagsLineEdit->text()));
tc->setPlatformLinkerFlags(splitString(m_platformLinkerFlagsLineEdit->text())); tc->setPlatformLinkerFlags(splitString(m_platformLinkerFlagsLineEdit->text()));
@@ -975,7 +999,7 @@ void GccToolChainConfigWidget::handleCompilerCommandChange()
QStringList args = gccPredefinedMacrosOptions() + splitString(m_platformCodeGenFlagsLineEdit->text()); QStringList args = gccPredefinedMacrosOptions() + splitString(m_platformCodeGenFlagsLineEdit->text());
m_macros = gccPredefinedMacros(path, args, env.toStringList()); m_macros = gccPredefinedMacros(path, args, env.toStringList());
abiList = guessGccAbi(path, env.toStringList(), m_macros, abiList = guessGccAbi(path, env.toStringList(), m_macros,
splitString(m_platformCodeGenFlagsLineEdit->text())); splitString(m_platformCodeGenFlagsLineEdit->text())).supportedAbis;
} }
m_abiWidget->setEnabled(haveCompiler); m_abiWidget->setEnabled(haveCompiler);

View File

@@ -54,6 +54,7 @@ public:
GccToolChain(Core::Id typeId, Detection d); GccToolChain(Core::Id typeId, Detection d);
QString typeDisplayName() const override; QString typeDisplayName() const override;
Abi targetAbi() const override; Abi targetAbi() const override;
QString originalTargetTriple() const override;
QString version() const; QString version() const;
QList<Abi> supportedAbis() const; QList<Abi> supportedAbis() const;
void setTargetAbi(const Abi &); void setTargetAbi(const Abi &);
@@ -89,6 +90,19 @@ public:
static void addCommandPathToEnvironment(const Utils::FileName &command, Utils::Environment &env); static void addCommandPathToEnvironment(const Utils::FileName &command, Utils::Environment &env);
class DetectedAbisResult {
public:
DetectedAbisResult() = default;
DetectedAbisResult(const QList<Abi> &supportedAbis,
const QString &originalTargetTriple = QString())
: supportedAbis(supportedAbis)
, originalTargetTriple(originalTargetTriple)
{}
QList<Abi> supportedAbis;
QString originalTargetTriple;
};
protected: protected:
typedef QList<QPair<QStringList, QByteArray> > GccCache; typedef QList<QPair<QStringList, QByteArray> > GccCache;
@@ -98,13 +112,14 @@ protected:
void setCompilerCommand(const Utils::FileName &path); void setCompilerCommand(const Utils::FileName &path);
void setSupportedAbis(const QList<Abi> &m_abis); void setSupportedAbis(const QList<Abi> &m_abis);
void setOriginalTargetTriple(const QString &targetTriple);
void setMacroCache(const QStringList &allCxxflags, const QByteArray &macroCache) const; void setMacroCache(const QStringList &allCxxflags, const QByteArray &macroCache) const;
QByteArray macroCache(const QStringList &allCxxflags) const; QByteArray macroCache(const QStringList &allCxxflags) const;
virtual QString defaultDisplayName() const; virtual QString defaultDisplayName() const;
virtual CompilerFlags defaultCompilerFlags() const; virtual CompilerFlags defaultCompilerFlags() const;
virtual QList<Abi> detectSupportedAbis() const; virtual DetectedAbisResult detectSupportedAbis() const;
virtual QString detectVersion() const; virtual QString detectVersion() const;
// Reinterpret options for compiler drivers inheriting from GccToolChain (e.g qcc) to apply -Wp option // Reinterpret options for compiler drivers inheriting from GccToolChain (e.g qcc) to apply -Wp option
@@ -139,6 +154,7 @@ private:
Abi m_targetAbi; Abi m_targetAbi;
mutable QList<Abi> m_supportedAbis; mutable QList<Abi> m_supportedAbis;
mutable QString m_originalTargetTriple;
mutable QList<HeaderPath> m_headerPaths; mutable QList<HeaderPath> m_headerPaths;
mutable QString m_version; mutable QString m_version;

View File

Before

Width:  |  Height:  |  Size: 169 B

After

Width:  |  Height:  |  Size: 169 B

View File

Before

Width:  |  Height:  |  Size: 290 B

After

Width:  |  Height:  |  Size: 290 B

View File

Before

Width:  |  Height:  |  Size: 163 B

After

Width:  |  Height:  |  Size: 163 B

View File

Before

Width:  |  Height:  |  Size: 156 B

After

Width:  |  Height:  |  Size: 156 B

Some files were not shown because too many files have changed in this diff Show More