forked from qt-creator/qt-creator
Merge remote-tracking branch 'origin/4.14'
Change-Id: I8543d87779c0da6a876caa046f6852737c9ae680
This commit is contained in:
@@ -105,15 +105,21 @@ Diagnostics DocumentClangToolRunner::diagnosticsAtLine(int lineNumber) const
|
||||
return diagnostics;
|
||||
}
|
||||
|
||||
static void removeClangToolRefactorMarkers(TextEditor::TextEditorWidget *editor)
|
||||
{
|
||||
if (!editor)
|
||||
return;
|
||||
editor->setRefactorMarkers(
|
||||
TextEditor::RefactorMarker::filterOutType(editor->refactorMarkers(),
|
||||
Constants::CLANG_TOOL_FIXIT_AVAILABLE_MARKER_ID));
|
||||
}
|
||||
|
||||
void DocumentClangToolRunner::scheduleRun()
|
||||
{
|
||||
for (DiagnosticMark *mark : m_marks)
|
||||
mark->disable();
|
||||
for (TextEditor::TextEditorWidget *editor : m_editorsWithMarkers) {
|
||||
editor->setRefactorMarkers(
|
||||
TextEditor::RefactorMarker::filterOutType(editor->refactorMarkers(),
|
||||
Constants::CLANG_TOOL_FIXIT_AVAILABLE_MARKER_ID));
|
||||
}
|
||||
for (TextEditor::TextEditorWidget *editor : m_editorsWithMarkers)
|
||||
removeClangToolRefactorMarkers(editor);
|
||||
m_runTimer.start();
|
||||
}
|
||||
|
||||
@@ -144,22 +150,17 @@ static FileInfo getFileInfo(const Utils::FilePath &file, ProjectExplorer::Projec
|
||||
QTC_ASSERT(projectFile.kind != CppTools::ProjectFile::Unsupported, continue);
|
||||
if (projectFile.path == CppTools::CppModelManager::configurationFileName())
|
||||
continue;
|
||||
if (file.toString() != projectFile.path)
|
||||
const auto projectFilePath = Utils::FilePath::fromString(projectFile.path);
|
||||
if (file != projectFilePath)
|
||||
continue;
|
||||
if (!projectFile.active)
|
||||
continue;
|
||||
if (projectPart->buildTargetType != ProjectExplorer::BuildTargetType::Unknown) {
|
||||
// found the best candidate, early return
|
||||
return FileInfo(Utils::FilePath::fromString(projectFile.path),
|
||||
projectFile.kind,
|
||||
projectPart);
|
||||
}
|
||||
if (candidate.projectPart.isNull()) {
|
||||
// found at least something but keep looking for better candidates
|
||||
candidate = FileInfo(Utils::FilePath::fromString(projectFile.path),
|
||||
projectFile.kind,
|
||||
projectPart);
|
||||
}
|
||||
// found the best candidate, early return
|
||||
if (projectPart->buildTargetType != ProjectExplorer::BuildTargetType::Unknown)
|
||||
return FileInfo(projectFilePath, projectFile.kind, projectPart);
|
||||
// found something but keep looking for better candidates
|
||||
if (candidate.projectPart.isNull())
|
||||
candidate = FileInfo(projectFilePath, projectFile.kind, projectPart);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -325,7 +326,8 @@ void DocumentClangToolRunner::onSuccess()
|
||||
for (auto editor : TextEditor::BaseTextEditor::textEditorsForDocument(doc)) {
|
||||
if (TextEditor::TextEditorWidget *widget = editor->editorWidget()) {
|
||||
widget->setRefactorMarkers(markers + widget->refactorMarkers());
|
||||
m_editorsWithMarkers << widget;
|
||||
if (!m_editorsWithMarkers.contains(widget))
|
||||
m_editorsWithMarkers << widget;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -83,7 +83,7 @@ private:
|
||||
QList<DiagnosticMark *> m_marks;
|
||||
FileInfo m_fileInfo;
|
||||
QMetaObject::Connection m_projectSettingsUpdate;
|
||||
QSet<TextEditor::TextEditorWidget *> m_editorsWithMarkers;
|
||||
QList<QPointer<TextEditor::TextEditorWidget>> m_editorsWithMarkers;
|
||||
SuppressedDiagnosticsList m_suppressed;
|
||||
Utils::FilePath m_lastProjectDirectory;
|
||||
};
|
||||
|
||||
@@ -111,7 +111,7 @@ CMakeBuildConfiguration::CMakeBuildConfiguration(Target *target, Utils::Id id)
|
||||
if (oldDir.isEmpty())
|
||||
return newDir;
|
||||
|
||||
if (QDir(oldDir).exists("CMakeCache.txt")) {
|
||||
if (QDir(oldDir).exists("CMakeCache.txt") && !QDir(newDir).exists("CMakeCache.txt")) {
|
||||
if (QMessageBox::information(nullptr,
|
||||
tr("Changing Build Directory"),
|
||||
tr("Change the build directory and start with a "
|
||||
|
||||
@@ -796,14 +796,23 @@ void CMakeBuildSystem::wireUpConnections()
|
||||
setParametersAndRequestParse(BuildDirParameters(cmakeBuildConfiguration()),
|
||||
CMakeBuildSystem::REPARSE_FORCE_CMAKE_RUN);
|
||||
});
|
||||
connect(cmakeBuildConfiguration(), &CMakeBuildConfiguration::buildDirectoryChanged, this, [this]() {
|
||||
// The build directory of our BC has changed:
|
||||
// Run with initial arguments!
|
||||
qCDebug(cmakeBuildSystemLog) << "Requesting parse due to build directory change";
|
||||
setParametersAndRequestParse(BuildDirParameters(cmakeBuildConfiguration()),
|
||||
CMakeBuildSystem::REPARSE_FORCE_INITIAL_CONFIGURATION
|
||||
| CMakeBuildSystem::REPARSE_FORCE_CMAKE_RUN);
|
||||
});
|
||||
connect(cmakeBuildConfiguration(),
|
||||
&CMakeBuildConfiguration::buildDirectoryChanged,
|
||||
this,
|
||||
[this]() {
|
||||
// The build directory of our BC has changed:
|
||||
// Does the directory contain a CMakeCache ? Existing build, just parse
|
||||
// No CMakeCache? Run with initial arguments!
|
||||
qCDebug(cmakeBuildSystemLog) << "Requesting parse due to build directory change";
|
||||
const BuildDirParameters parameters(cmakeBuildConfiguration());
|
||||
const bool hasCMakeCache = QFile::exists(
|
||||
(parameters.buildDirectory / "CMakeCache.txt").toString());
|
||||
const auto options = ReparseParameters(
|
||||
hasCMakeCache
|
||||
? REPARSE_DEFAULT
|
||||
: (REPARSE_FORCE_INITIAL_CONFIGURATION | REPARSE_FORCE_CMAKE_RUN));
|
||||
setParametersAndRequestParse(BuildDirParameters(cmakeBuildConfiguration()), options);
|
||||
});
|
||||
|
||||
connect(project(), &Project::projectFileIsDirty, this, [this]() {
|
||||
if (cmakeBuildConfiguration()->isActive() && !isParsing()) {
|
||||
@@ -811,7 +820,7 @@ void CMakeBuildSystem::wireUpConnections()
|
||||
if (cmake && cmake->isAutoRun()) {
|
||||
qCDebug(cmakeBuildSystemLog) << "Requesting parse due to dirty project file";
|
||||
setParametersAndRequestParse(BuildDirParameters(cmakeBuildConfiguration()),
|
||||
CMakeBuildSystem::REPARSE_DEFAULT);
|
||||
CMakeBuildSystem::REPARSE_FORCE_CMAKE_RUN);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -431,7 +431,7 @@ static void drawPrimitiveTweakedForDarkTheme(QStyle::PrimitiveElement element,
|
||||
break;
|
||||
}
|
||||
case QStyle::PE_FrameLineEdit: {
|
||||
const bool isComboBox = widget->inherits("QComboBox");
|
||||
const bool isComboBox = widget && widget->inherits("QComboBox");
|
||||
const QRectF frameRectF =
|
||||
QRectF(option->rect).adjusted(0.5, 0.5, isComboBox ? -8.5 : -0.5, -0.5);
|
||||
painter->setPen(framePen);
|
||||
@@ -447,7 +447,8 @@ static void drawPrimitiveTweakedForDarkTheme(QStyle::PrimitiveElement element,
|
||||
// Shrinking the topMargin if Not checkable AND title is empty
|
||||
topMargin = groupBoxTopMargin;
|
||||
} else {
|
||||
topMargin = qMax(widget->style()->pixelMetric(QStyle::PM_ExclusiveIndicatorHeight),
|
||||
const int exclusiveIndicatorHeight = widget ? widget->style()->pixelMetric(QStyle::PM_ExclusiveIndicatorHeight) : 0;
|
||||
topMargin = qMax(exclusiveIndicatorHeight,
|
||||
option->fontMetrics.height()) + groupBoxTopMargin;
|
||||
}
|
||||
// Snippet from QFusionStyle::drawPrimitive - END
|
||||
@@ -505,15 +506,16 @@ static void drawPrimitiveTweakedForDarkTheme(QStyle::PrimitiveElement element,
|
||||
break;
|
||||
}
|
||||
case QStyle::PE_IndicatorTabClose: {
|
||||
QWindow *window = widget->window()->windowHandle();
|
||||
QWindow *window = widget ? widget->window()->windowHandle() : nullptr;
|
||||
QRect iconRect = QRect(0, 0, 16, 16);
|
||||
iconRect.moveCenter(option->rect.center());
|
||||
const QIcon::Mode mode = !isEnabled ? QIcon::Disabled : QIcon::Normal;
|
||||
const static QIcon closeIcon = Utils::Icons::CLOSE_FOREGROUND.icon();
|
||||
if (option->state & QStyle::State_MouseOver)
|
||||
if (option->state & QStyle::State_MouseOver && widget)
|
||||
widget->style()->drawPrimitive(QStyle::PE_PanelButtonCommand, option, painter, widget);
|
||||
const int devicePixelRatio = widget ? widget->devicePixelRatio() : 1;
|
||||
const QPixmap iconPx =
|
||||
closeIcon.pixmap(window, iconRect.size() * widget->devicePixelRatio(), mode);
|
||||
closeIcon.pixmap(window, iconRect.size() * devicePixelRatio, mode);
|
||||
painter->drawPixmap(iconRect, iconPx);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -96,12 +96,8 @@ void ItemLibraryView::modelAttached(Model *model)
|
||||
auto target = QmlDesignerPlugin::instance()->currentDesignDocument()->currentTarget();
|
||||
m_imageCacheData->cache.clean();
|
||||
|
||||
if (target) {
|
||||
auto clonedTarget = std::make_unique<ProjectExplorer::Target>(
|
||||
target->project(), target->kit()->clone(), ProjectExplorer::Target::_constructor_tag{});
|
||||
|
||||
m_imageCacheData->collector.setTarget(std::move(clonedTarget));
|
||||
}
|
||||
if (target)
|
||||
m_imageCacheData->collector.setTarget(target);
|
||||
|
||||
m_widget->clearSearchFilter();
|
||||
m_widget->setModel(model);
|
||||
|
||||
@@ -99,7 +99,7 @@ void ImageCacheCollector::start(Utils::SmallStringView name,
|
||||
|
||||
m_connectionManager.setCallback(std::move(captureCallback));
|
||||
|
||||
nodeInstanceView.setTarget(m_target.get());
|
||||
nodeInstanceView.setTarget(m_target.data());
|
||||
nodeInstanceView.setCrashCallback(abortCallback);
|
||||
model->setNodeInstanceView(&nodeInstanceView);
|
||||
|
||||
@@ -115,9 +115,9 @@ void ImageCacheCollector::start(Utils::SmallStringView name,
|
||||
abortCallback();
|
||||
}
|
||||
|
||||
void ImageCacheCollector::setTarget(std::unique_ptr<ProjectExplorer::Target> target)
|
||||
void ImageCacheCollector::setTarget(ProjectExplorer::Target *target)
|
||||
{
|
||||
m_target = std::move(target);
|
||||
m_target = target;
|
||||
}
|
||||
|
||||
} // namespace QmlDesigner
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
|
||||
#include "imagecachecollectorinterface.h"
|
||||
|
||||
#include <memory>
|
||||
#include <QPointer>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QTextDocument;
|
||||
@@ -57,11 +57,11 @@ public:
|
||||
CaptureCallback captureCallback,
|
||||
AbortCallback abortCallback) override;
|
||||
|
||||
void setTarget(std::unique_ptr<ProjectExplorer::Target> target);
|
||||
void setTarget(ProjectExplorer::Target *target);
|
||||
|
||||
private:
|
||||
ImageCacheConnectionManager &m_connectionManager;
|
||||
std::unique_ptr<ProjectExplorer::Target> m_target;
|
||||
QPointer<ProjectExplorer::Target> m_target;
|
||||
};
|
||||
|
||||
} // namespace QmlDesigner
|
||||
|
||||
Reference in New Issue
Block a user