Commit d288bd66 authored by Eike Ziller's avatar Eike Ziller
Browse files

Merge remote-tracking branch 'origin/4.2'

Change-Id: Ib466094b4d234869cd7e122830ca4f9a11667e58
parents 832be2ec 21258bac
......@@ -219,8 +219,12 @@ class Dumper(DumperBase):
base = nativeType.GetVirtualBaseClassAtIndex(i)
virtualNames[base.GetName()] = i
fieldBits = dict((field.name, (field.GetBitfieldSizeInBits(), field.GetOffsetInBits()))
for field in nativeType.get_fields_array())
fieldBits = dict((f.name,
((f.GetBitfieldSizeInBits()
if f.GetBitfieldSizeInBits() else
(f.GetType().GetByteSize() * 8)),
f.GetOffsetInBits()))
for f in nativeType.get_fields_array())
#warn("BASE NAMES: %s" % baseNames)
#warn("VIRTUAL NAMES: %s" % virtualNames)
......@@ -279,7 +283,7 @@ class Dumper(DumperBase):
field.parentType = fieldParentType
field.ltype = self.fromNativeType(fieldType)
field.name = fieldName
field.lbitsize = 0
field.lbitsize = field.ltype.lbitsize * 8
field.lbitpos = 0
fields.append(field)
......
......@@ -504,7 +504,9 @@ SynchronousProcessResponse SynchronousProcess::runBlocking(const QString &binary
}
}
QTC_ASSERT(d->m_process.state() == QProcess::NotRunning, return d->m_result);
if (d->m_process.state() != QProcess::NotRunning)
return d->m_result;
d->m_result.exitCode = d->m_process.exitCode();
if (d->m_result.result == SynchronousProcessResponse::StartFailed) {
if (d->m_process.exitStatus() != QProcess::NormalExit)
......
......@@ -254,6 +254,8 @@ CdbEngine::CdbEngine(const DebuggerRunParameters &sp) :
this, &CdbEngine::readyReadStandardOut);
connect(&m_process, &QProcess::readyReadStandardError,
this, &CdbEngine::readyReadStandardOut);
connect(action(UseDebuggingHelpers), &SavedAction::valueChanged,
this, &CdbEngine::updateLocals);
}
void CdbEngine::init()
......
......@@ -68,7 +68,6 @@ public:
QString fallbackSaveAsPath() const override;
QString fallbackSaveAsFileName() const override;
bool isModified() const override { return false; }
bool isSaveAsAllowed() const override { return true; }
bool save(QString *errorString, const QString &fileName, bool autoSave) override;
void reload();
......
......@@ -33,25 +33,189 @@
#include <QAction>
#include <QFileDialog>
#include <QMenu>
#include <QTextCodec>
#include <QtPlugin>
#include <coreplugin/actionmanager/actioncontainer.h>
#include <coreplugin/actionmanager/actionmanager.h>
#include <coreplugin/coreconstants.h>
#include <coreplugin/editormanager/documentmodel.h>
#include <coreplugin/editormanager/editormanager.h>
#include <coreplugin/icore.h>
#include <texteditor/texteditor.h>
#include <utils/qtcassert.h>
namespace DiffEditor {
namespace Internal {
class FileDiffController : public DiffEditorController
class DiffFilesController : public DiffEditorController
{
Q_OBJECT
public:
DiffFilesController(Core::IDocument *document);
protected:
FileData diffFiles(const QString &leftContents, const QString &rightContents);
};
DiffFilesController::DiffFilesController(Core::IDocument *document)
: DiffEditorController(document)
{}
FileData DiffFilesController::diffFiles(const QString &leftContents, const QString &rightContents)
{
Differ differ;
QList<Diff> diffList = differ.cleanupSemantics(differ.diff(leftContents, rightContents));
QList<Diff> leftDiffList;
QList<Diff> rightDiffList;
Differ::splitDiffList(diffList, &leftDiffList, &rightDiffList);
QList<Diff> outputLeftDiffList;
QList<Diff> outputRightDiffList;
if (ignoreWhitespace()) {
const QList<Diff> leftIntermediate
= Differ::moveWhitespaceIntoEqualities(leftDiffList);
const QList<Diff> rightIntermediate
= Differ::moveWhitespaceIntoEqualities(rightDiffList);
Differ::ignoreWhitespaceBetweenEqualities(leftIntermediate, rightIntermediate,
&outputLeftDiffList, &outputRightDiffList);
} else {
outputLeftDiffList = leftDiffList;
outputRightDiffList = rightDiffList;
}
const ChunkData chunkData = DiffUtils::calculateOriginalData(
outputLeftDiffList, outputRightDiffList);
FileData fileData = DiffUtils::calculateContextData(chunkData, contextLineCount(), 0);
return fileData;
}
class DiffCurrentFileController : public DiffFilesController
{
Q_OBJECT
public:
FileDiffController(Core::IDocument *document, const QString &leftFileName,
DiffCurrentFileController(Core::IDocument *document, const QString &fileName);
protected:
void reload();
private:
QString m_fileName;
};
DiffCurrentFileController::DiffCurrentFileController(Core::IDocument *document, const QString &fileName) :
DiffFilesController(document), m_fileName(fileName)
{ }
void DiffCurrentFileController::reload()
{
QList<FileData> fileDataList;
TextEditor::TextDocument *textDocument = qobject_cast<TextEditor::TextDocument *>(
Core::DocumentModel::documentForFilePath(m_fileName));
if (textDocument && textDocument->isModified()) {
QString errorString;
Utils::TextFileFormat format = textDocument->format();
QString leftText;
bool leftFileExists = true;
if (Utils::TextFileFormat::readFile(m_fileName,
format.codec,
&leftText, &format, &errorString)
!= Utils::TextFileFormat::ReadSuccess) {
leftFileExists = false;
}
const QString rightText = textDocument->plainText();
FileData fileData = diffFiles(leftText, rightText);
fileData.leftFileInfo.fileName = m_fileName;
fileData.rightFileInfo.fileName = m_fileName;
fileData.leftFileInfo.typeInfo = tr("Saved");
fileData.rightFileInfo.typeInfo = tr("Modified");
if (!leftFileExists)
fileData.fileOperation = FileData::NewFile;
fileDataList << fileData;
}
setDiffFiles(fileDataList);
reloadFinished(true);
}
/////////////////
class DiffAllModifiedFilesController : public DiffFilesController
{
Q_OBJECT
public:
DiffAllModifiedFilesController(Core::IDocument *document);
protected:
void reload();
};
DiffAllModifiedFilesController::DiffAllModifiedFilesController(Core::IDocument *document) :
DiffFilesController(document)
{ }
void DiffAllModifiedFilesController::reload()
{
QList<Core::IDocument *> openedDocuments =
Core::DocumentModel::openedDocuments();
QList<FileData> fileDataList;
foreach (Core::IDocument *doc, openedDocuments) {
TextEditor::TextDocument *textDocument = qobject_cast<TextEditor::TextDocument *>(doc);
if (textDocument && textDocument->isModified()) {
QString errorString;
Utils::TextFileFormat format = textDocument->format();
QString leftText;
bool leftFileExists = true;
const QString fileName = textDocument->filePath().toString();
if (Utils::TextFileFormat::readFile(fileName,
format.codec,
&leftText, &format, &errorString)
!= Utils::TextFileFormat::ReadSuccess) {
leftFileExists = false;
}
const QString rightText = textDocument->plainText();
FileData fileData = diffFiles(leftText, rightText);
fileData.leftFileInfo.fileName = fileName;
fileData.rightFileInfo.fileName = fileName;
fileData.leftFileInfo.typeInfo = tr("Saved");
fileData.rightFileInfo.typeInfo = tr("Modified");
if (!leftFileExists)
fileData.fileOperation = FileData::NewFile;
fileDataList << fileData;
}
}
setDiffFiles(fileDataList);
reloadFinished(true);
}
/////////////////
class DiffExternalFilesController : public DiffFilesController
{
Q_OBJECT
public:
DiffExternalFilesController(Core::IDocument *document, const QString &leftFileName,
const QString &rightFileName);
protected:
......@@ -62,12 +226,12 @@ private:
QString m_rightFileName;
};
FileDiffController::FileDiffController(Core::IDocument *document, const QString &leftFileName,
DiffExternalFilesController::DiffExternalFilesController(Core::IDocument *document, const QString &leftFileName,
const QString &rightFileName) :
DiffEditorController(document), m_leftFileName(leftFileName), m_rightFileName(rightFileName)
DiffFilesController(document), m_leftFileName(leftFileName), m_rightFileName(rightFileName)
{ }
void FileDiffController::reload()
void DiffExternalFilesController::reload()
{
QString errorString;
Utils::TextFileFormat format;
......@@ -91,30 +255,7 @@ void FileDiffController::reload()
rightFileExists = false;
}
Differ differ;
QList<Diff> diffList = differ.cleanupSemantics(differ.diff(leftText, rightText));
QList<Diff> leftDiffList;
QList<Diff> rightDiffList;
Differ::splitDiffList(diffList, &leftDiffList, &rightDiffList);
QList<Diff> outputLeftDiffList;
QList<Diff> outputRightDiffList;
if (ignoreWhitespace()) {
const QList<Diff> leftIntermediate
= Differ::moveWhitespaceIntoEqualities(leftDiffList);
const QList<Diff> rightIntermediate
= Differ::moveWhitespaceIntoEqualities(rightDiffList);
Differ::ignoreWhitespaceBetweenEqualities(leftIntermediate, rightIntermediate,
&outputLeftDiffList, &outputRightDiffList);
} else {
outputLeftDiffList = leftDiffList;
outputRightDiffList = rightDiffList;
}
const ChunkData chunkData = DiffUtils::calculateOriginalData(
outputLeftDiffList, outputRightDiffList);
FileData fileData = DiffUtils::calculateContextData(chunkData, contextLineCount(), 0);
FileData fileData = diffFiles(leftText, rightText);
fileData.leftFileInfo.fileName = m_leftFileName;
fileData.rightFileInfo.fileName = m_rightFileName;
if (!leftFileExists && rightFileExists)
......@@ -123,7 +264,8 @@ void FileDiffController::reload()
fileData.fileOperation = FileData::DeleteFile;
QList<FileData> fileDataList;
fileDataList << fileData;
if (leftFileExists || rightFileExists)
fileDataList << fileData;
setDiffFiles(fileDataList);
reloadFinished(true);
......@@ -140,11 +282,31 @@ bool DiffEditorPlugin::initialize(const QStringList &arguments, QString *errorMe
Core::ActionContainer *toolsContainer
= Core::ActionManager::actionContainer(Core::Constants::M_TOOLS);
toolsContainer->insertGroup(Core::Constants::G_TOOLS_OPTIONS, Constants::G_TOOLS_DIFF);
Core::ActionContainer *diffContainer = Core::ActionManager::createMenu("Diff");
diffContainer->menu()->setTitle(tr("&Diff"));
toolsContainer->addMenu(diffContainer, Constants::G_TOOLS_DIFF);
m_diffCurrentFileAction = new QAction(tr("Diff Current File"), this);
Core::Command *diffCurrentFileCommand = Core::ActionManager::registerAction(m_diffCurrentFileAction, "DiffEditor.DiffCurrentFile");
diffCurrentFileCommand->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Meta+H") : tr("Ctrl+H")));
connect(m_diffCurrentFileAction, &QAction::triggered, this, &DiffEditorPlugin::diffCurrentFile);
diffContainer->addAction(diffCurrentFileCommand);
QAction *diffAction = new QAction(tr("Diff..."), this);
Core::Command *diffCommand = Core::ActionManager::registerAction(diffAction, "DiffEditor.Diff");
connect(diffAction, &QAction::triggered, this, &DiffEditorPlugin::diff);
toolsContainer->addAction(diffCommand, Constants::G_TOOLS_DIFF);
QAction *diffAllModifiedFilesAction = new QAction(tr("Diff All Modified Files"), this);
Core::Command *diffAllModifiedFilesCommand = Core::ActionManager::registerAction(diffAllModifiedFilesAction, "DiffEditor.DiffAllModifiedFiles");
diffAllModifiedFilesCommand->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Meta+Shift+H") : tr("Ctrl+Shift+H")));
connect(diffAllModifiedFilesAction, &QAction::triggered, this, &DiffEditorPlugin::diffAllModifiedFiles);
diffContainer->addAction(diffAllModifiedFilesCommand);
QAction *diffExternalFilesAction = new QAction(tr("Diff External Files..."), this);
Core::Command *diffExternalFilesCommand = Core::ActionManager::registerAction(diffExternalFilesAction, "DiffEditor.DiffExternalFiles");
connect(diffExternalFilesAction, &QAction::triggered, this, &DiffEditorPlugin::diffExternalFiles);
diffContainer->addAction(diffExternalFilesCommand);
connect(Core::EditorManager::instance(), &Core::EditorManager::currentEditorChanged,
this, &DiffEditorPlugin::updateCurrentEditor);
updateActions();
addAutoReleasedObject(new DiffEditorFactory(this));
......@@ -154,15 +316,77 @@ bool DiffEditorPlugin::initialize(const QStringList &arguments, QString *errorMe
void DiffEditorPlugin::extensionsInitialized()
{ }
void DiffEditorPlugin::diff()
void DiffEditorPlugin::updateCurrentEditor(Core::IEditor *editor)
{
if (m_currentTextDocument)
m_currentTextDocument->disconnect(this);
m_currentTextDocument = 0;
if (editor) {
TextEditor::TextEditorWidget *editorWidget = qobject_cast<TextEditor::TextEditorWidget *>(editor->widget());
if (editorWidget) {
m_currentTextDocument = editorWidget->textDocument();
connect(m_currentTextDocument.data(), &Core::IDocument::changed,
this, &DiffEditorPlugin::updateActions);
}
}
updateActions();
}
void DiffEditorPlugin::updateActions()
{
const bool diffCurrentFileEnabled = m_currentTextDocument && m_currentTextDocument->isModified();
m_diffCurrentFileAction->setEnabled(diffCurrentFileEnabled);
}
void DiffEditorPlugin::diffCurrentFile()
{
if (!m_currentTextDocument)
return;
const QString fileName = m_currentTextDocument->filePath().toString();
if (fileName.isEmpty())
return;
const QString documentId = QLatin1String("Diff ") + fileName;
const QString title = tr("Diff \"%1\"").arg(fileName);
auto const document = qobject_cast<DiffEditorDocument *>(
DiffEditorController::findOrCreateDocument(documentId, title));
if (!document)
return;
if (!DiffEditorController::controller(document))
new DiffCurrentFileController(document, fileName);
Core::EditorManager::activateEditorForDocument(document);
document->reload();
}
void DiffEditorPlugin::diffAllModifiedFiles()
{
const QString documentId = QLatin1String("Diff All Modified Files");
const QString title = tr("Diff All Modified Files");
auto const document = qobject_cast<DiffEditorDocument *>(
DiffEditorController::findOrCreateDocument(documentId, title));
if (!document)
return;
if (!DiffEditorController::controller(document))
new DiffAllModifiedFilesController(document);
Core::EditorManager::activateEditorForDocument(document);
document->reload();
}
void DiffEditorPlugin::diffExternalFiles()
{
QString fileName1 = QFileDialog::getOpenFileName(Core::ICore::dialogParent(),
const QString fileName1 = QFileDialog::getOpenFileName(Core::ICore::dialogParent(),
tr("Select First File for Diff"),
QString());
if (fileName1.isNull())
return;
QString fileName2 = QFileDialog::getOpenFileName(Core::ICore::dialogParent(),
const QString fileName2 = QFileDialog::getOpenFileName(Core::ICore::dialogParent(),
tr("Select Second File for Diff"),
QString());
if (fileName2.isNull())
......@@ -170,14 +394,14 @@ void DiffEditorPlugin::diff()
const QString documentId = QLatin1String("Diff ") + fileName1 + QLatin1String(", ") + fileName2;
QString title = tr("Diff \"%1\", \"%2\"").arg(fileName1).arg(fileName2);
const QString title = tr("Diff \"%1\", \"%2\"").arg(fileName1, fileName2);
auto const document = qobject_cast<DiffEditorDocument *>(
DiffEditorController::findOrCreateDocument(documentId, title));
if (!document)
return;
if (!DiffEditorController::controller(document))
new FileDiffController(document, fileName1, fileName2);
new DiffExternalFilesController(document, fileName1, fileName2);
Core::EditorManager::activateEditorForDocument(document);
document->reload();
}
......
......@@ -27,8 +27,13 @@
#include "diffeditor_global.h"
#include <texteditor/textdocument.h>
#include <extensionsystem/iplugin.h>
QT_FORWARD_DECLARE_CLASS(QAction)
namespace Core { class IEditor; }
namespace DiffEditor {
namespace Internal {
......@@ -42,7 +47,11 @@ public:
void extensionsInitialized();
private slots:
void diff();
void updateCurrentEditor(Core::IEditor *editor);
void updateActions();
void diffCurrentFile();
void diffAllModifiedFiles();
void diffExternalFiles();
#ifdef WITH_TESTS
void testMakePatch_data();
......@@ -50,6 +59,9 @@ private slots:
void testReadPatch_data();
void testReadPatch();
#endif // WITH_TESTS
private:
QAction *m_diffCurrentFileAction;
QPointer<TextEditor::TextDocument> m_currentTextDocument;
};
} // namespace Internal
......
......@@ -622,7 +622,12 @@ void QbsProject::cancelParsing()
void QbsProject::updateAfterBuild()
{
QTC_ASSERT(m_qbsProject.isValid(), return);
m_projectData = m_qbsProject.projectData();
const qbs::ProjectData &projectData = m_qbsProject.projectData();
if (projectData == m_projectData)
return;
qCDebug(qbsPmLog) << "Updating data after build";
m_projectData = projectData;
rootProjectNode()->update();
updateBuildTargetData();
updateCppCompilerCallData();
if (m_extraCompilersPending) {
......@@ -993,8 +998,6 @@ void QbsProject::updateDeploymentInfo()
{
DeploymentData deploymentData;
if (m_qbsProject.isValid()) {
qbs::InstallOptions installOptions;
installOptions.setInstallRoot(QLatin1String("/"));
foreach (const qbs::ArtifactData &f, m_projectData.installableArtifacts()) {
deploymentData.addFile(f.filePath(), f.installData().installDir(),
f.isExecutable() ? DeployableFile::TypeExecutable : DeployableFile::TypeNormal);
......
......@@ -40,6 +40,7 @@ PuppetBuildProgressDialog::PuppetBuildProgressDialog() :
m_useFallbackPuppet(false)
{
setWindowFlags(Qt::SplashScreen);
setWindowModality(Qt::ApplicationModal);
ui->setupUi(this);
ui->buildProgressBar->setMaximum(85);
connect(ui->useFallbackPuppetPushButton, SIGNAL(clicked()), this, SLOT(setUseFallbackPuppet()));
......
......@@ -68,6 +68,7 @@ void DesignerSettings::fromSettings(QSettings *settings)
restoreValue(settings, DesignerSettingsKey::PUPPET_KILL_TIMEOUT, 3000); // this has no ui at the moment
restoreValue(settings, DesignerSettingsKey::DEBUG_PUPPET, QString());
restoreValue(settings, DesignerSettingsKey::FORWARD_PUPPET_OUTPUT, QString());
restoreValue(settings, DesignerSettingsKey::REFORMAT_UI_QML_FILES, true);
settings->endGroup();
settings->endGroup();
......
......@@ -57,7 +57,9 @@ const char ENABLE_MODEL_EXCEPTION_OUTPUT[] = "WarnException";
const char PUPPET_KILL_TIMEOUT[] = "PuppetKillTimeout";
const char DEBUG_PUPPET[] = "DebugPuppet";
const char FORWARD_PUPPET_OUTPUT[] = "ForwardPuppetOutput";
const char REFORMAT_UI_QML_FILES[] = "ReformatUiQmlFiles"; /* This Setting is not exposed in ui.
The setting can be used to turn off the feature,
if there are serious issues */
}
class DesignerSettings : public QHash<QByteArray, QVariant>
......
......@@ -27,6 +27,10 @@
#include <qmldesignerplugin.h>
#include <utils/theme/theme.h>
#include <utils/stylehelper.h>
#include <QLabel>
#include <QPushButton>
#include <QCheckBox>
......@@ -170,6 +174,13 @@ bool DocumentWarningWidget::eventFilter(QObject *object, QEvent *event)
void DocumentWarningWidget::showEvent(QShowEvent *event)
{
const QColor backgroundColor = Utils::creatorTheme()->color(Utils::Theme::QmlDesigner_BackgroundColor);
QPalette pal = palette();
QColor color = pal.color(QPalette::ToolTipBase);
const QColor backgroundNoAlpha = Utils::StyleHelper::alphaBlendedColors(color, backgroundColor);
color.setAlpha(255);
pal.setColor(QPalette::ToolTipBase, backgroundNoAlpha);
setPalette(pal);
m_gotoCodeWasClicked = false;
moveToParentCenter();
refreshContent();
......
......@@ -13,6 +13,12 @@ QTableView {
}
QTabBar QToolButton {
background-color: creatorTheme.QmlDesignerBackgroundColorDarkAlternate;
border: 1px solid creatorTheme.QmlDesignerBackgroundColorDarker;
border-radius: 0px;
}
QTableView::item
{
border: 0px;
......
......@@ -25,6 +25,8 @@
#include "shortcutmanager.h"
#include "designersettings.h"
#include <coreplugin/actionmanager/actionmanager.h>
#include <coreplugin/actionmanager/actioncontainer.h>
#include <coreplugin/actionmanager/command.h>
......@@ -33,7 +35,13 @@
#include <coreplugin/editormanager/documentmodel.h>
#include <coreplugin/editormanager/editormanager.h>
#include <coreplugin/coreconstants.h>
#include <qmljseditor/qmljseditorconstants.h>
#include <qmljseditor/qmljseditordocument.h>
#include <utils/hostosinfo.h>
#include <utils/qtcassert.h>
#include <qmljs/qmljsreformatter.h>
#include "qmldesignerconstants.h"
#include "qmldesignerplugin.h"
......@@ -106,13 +114,29 @@ void ShortCutManager::registerActions(const Core::Context &qmlDesignerMainContex
SLOT(toggleRightSidebar()));
// Revert to saved
QObject *em = Core::EditorManager::instance();
Core::EditorMan