forked from qt-creator/qt-creator
Merge remote-tracking branch 'origin/12.0'
Conflicts: src/plugins/designer/formeditor.cpp src/plugins/git/gitplugin.cpp Change-Id: I554a844fab4c55249a00f394f9ba174c7548dbbe
This commit is contained in:
@@ -316,8 +316,10 @@ int forceIndentWithExtraText(QByteArray &buffer,
|
|||||||
// A comment at the end of the line appears to prevent clang-format from removing line breaks.
|
// A comment at the end of the line appears to prevent clang-format from removing line breaks.
|
||||||
if (dummyText == "/*//*/" || dummyText.isEmpty()) {
|
if (dummyText == "/*//*/" || dummyText.isEmpty()) {
|
||||||
if (block.previous().isValid()) {
|
if (block.previous().isValid()) {
|
||||||
const int prevEndOffset = Utils::Text::utf8NthLineOffset(block.document(), buffer,
|
const int prevEndOffset = Utils::Text::utf8NthLineOffset(block.document(),
|
||||||
block.blockNumber()) + block.previous().text().length();
|
buffer,
|
||||||
|
block.blockNumber())
|
||||||
|
+ block.previous().text().toUtf8().length();
|
||||||
buffer.insert(prevEndOffset, " //");
|
buffer.insert(prevEndOffset, " //");
|
||||||
extraLength += 3;
|
extraLength += 3;
|
||||||
}
|
}
|
||||||
|
@@ -730,4 +730,20 @@ void ClangFormatTest::testIndentCommentOnNewLine()
|
|||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ClangFormatTest::testUtf8SymbolLine()
|
||||||
|
{
|
||||||
|
insertLines({"int main()",
|
||||||
|
"{",
|
||||||
|
" cout << \"ä\" << endl;",
|
||||||
|
" return 0;",
|
||||||
|
"}"});
|
||||||
|
m_indenter->indent(*m_cursor, QChar::Null, TextEditor::TabSettings());
|
||||||
|
QCOMPARE(documentLines(),
|
||||||
|
(std::vector<QString>{"int main()",
|
||||||
|
"{",
|
||||||
|
" cout << \"ä\" << endl;",
|
||||||
|
" return 0;",
|
||||||
|
"}"}));
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace ClangFormat::Internal
|
} // namespace ClangFormat::Internal
|
||||||
|
@@ -91,6 +91,7 @@ private slots:
|
|||||||
void testIndentInitializeVector();
|
void testIndentInitializeVector();
|
||||||
void testIndentFunctionArgumentOnNewLine();
|
void testIndentFunctionArgumentOnNewLine();
|
||||||
void testIndentCommentOnNewLine();
|
void testIndentCommentOnNewLine();
|
||||||
|
void testUtf8SymbolLine();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void insertLines(const std::vector<QString> &lines);
|
void insertLines(const std::vector<QString> &lines);
|
||||||
|
@@ -230,6 +230,7 @@ CMakeBuildStep::CMakeBuildStep(BuildStepList *bsl, Id id) :
|
|||||||
stagingDir.setSettingsKey(STAGING_DIR_KEY);
|
stagingDir.setSettingsKey(STAGING_DIR_KEY);
|
||||||
stagingDir.setLabelText(Tr::tr("Staging directory:"));
|
stagingDir.setLabelText(Tr::tr("Staging directory:"));
|
||||||
stagingDir.setDefaultValue(initialStagingDir(kit()));
|
stagingDir.setDefaultValue(initialStagingDir(kit()));
|
||||||
|
stagingDir.setExpectedKind(PathChooser::Kind::Directory);
|
||||||
|
|
||||||
Kit *kit = buildConfiguration()->kit();
|
Kit *kit = buildConfiguration()->kit();
|
||||||
if (CMakeBuildConfiguration::isIos(kit)) {
|
if (CMakeBuildConfiguration::isIos(kit)) {
|
||||||
|
@@ -314,7 +314,9 @@ static void updateCMakeConfigurationWithLocalData(CMakeConfig &cmakeCache,
|
|||||||
return var == "CMAKE_PREFIX_PATH" || var == "CMAKE_MODULE_PATH";
|
return var == "CMAKE_PREFIX_PATH" || var == "CMAKE_MODULE_PATH";
|
||||||
};
|
};
|
||||||
|
|
||||||
const FilePath projectDir = ProjectTree::currentBuildSystem()->projectDirectory();
|
const FilePath projectDir = ProjectTree::currentBuildSystem()
|
||||||
|
? ProjectTree::currentBuildSystem()->projectDirectory()
|
||||||
|
: currentDir;
|
||||||
auto updateDirVariables = [currentDir, projectDir, cmakeCache](QByteArray &value) {
|
auto updateDirVariables = [currentDir, projectDir, cmakeCache](QByteArray &value) {
|
||||||
value.replace("${CMAKE_CURRENT_SOURCE_DIR}", currentDir.path().toUtf8());
|
value.replace("${CMAKE_CURRENT_SOURCE_DIR}", currentDir.path().toUtf8());
|
||||||
value.replace("${CMAKE_CURRENT_LIST_DIR}", currentDir.path().toUtf8());
|
value.replace("${CMAKE_CURRENT_LIST_DIR}", currentDir.path().toUtf8());
|
||||||
|
@@ -1653,7 +1653,10 @@ QList<ProjectPart::ConstPtr> CppModelManager::projectPart(const FilePath &fileNa
|
|||||||
}
|
}
|
||||||
const FilePath canonicalPath = fileName.canonicalPath();
|
const FilePath canonicalPath = fileName.canonicalPath();
|
||||||
QWriteLocker locker(&d->m_projectLock);
|
QWriteLocker locker(&d->m_projectLock);
|
||||||
auto it = d->m_fileToProjectParts.insert(fileName, d->m_fileToProjectParts.value(canonicalPath));
|
const auto it = d->m_fileToProjectParts.constFind(canonicalPath);
|
||||||
|
if (it == d->m_fileToProjectParts.constEnd())
|
||||||
|
return {};
|
||||||
|
d->m_fileToProjectParts.insert(fileName, it.value());
|
||||||
return it.value();
|
return it.value();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -35,14 +35,15 @@
|
|||||||
|
|
||||||
#include <aggregation/aggregate.h>
|
#include <aggregation/aggregate.h>
|
||||||
|
|
||||||
#include <QDesignerFormEditorPluginInterface>
|
|
||||||
#include <QDesignerFormEditorInterface>
|
|
||||||
#include <QDesignerComponents>
|
|
||||||
#include <QDesignerFormWindowManagerInterface>
|
|
||||||
#include <QDesignerWidgetBoxInterface>
|
|
||||||
#include <abstractobjectinspector.h>
|
#include <abstractobjectinspector.h>
|
||||||
#include <QDesignerPropertyEditorInterface>
|
|
||||||
#include <QDesignerActionEditorInterface>
|
#include <QDesignerActionEditorInterface>
|
||||||
|
#include <QDesignerComponents>
|
||||||
|
#include <QDesignerFormEditorInterface>
|
||||||
|
#include <QDesignerFormEditorPluginInterface>
|
||||||
|
#include <QDesignerFormWindowManagerInterface>
|
||||||
|
#include <QDesignerFormWindowToolInterface>
|
||||||
|
#include <QDesignerPropertyEditorInterface>
|
||||||
|
#include <QDesignerWidgetBoxInterface>
|
||||||
|
|
||||||
#include <QAction>
|
#include <QAction>
|
||||||
#include <QActionGroup>
|
#include <QActionGroup>
|
||||||
@@ -131,6 +132,13 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class ToolData
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
int index;
|
||||||
|
QByteArray className;
|
||||||
|
};
|
||||||
|
|
||||||
// FormEditorData
|
// FormEditorData
|
||||||
|
|
||||||
class FormEditorData : public QObject
|
class FormEditorData : public QObject
|
||||||
@@ -139,8 +147,8 @@ public:
|
|||||||
FormEditorData();
|
FormEditorData();
|
||||||
~FormEditorData();
|
~FormEditorData();
|
||||||
|
|
||||||
void activateEditMode(int id);
|
void activateEditMode(const ToolData &toolData);
|
||||||
void toolChanged(int);
|
void toolChanged(QDesignerFormWindowInterface *form, int);
|
||||||
void print();
|
void print();
|
||||||
void setPreviewMenuEnabled(bool e);
|
void setPreviewMenuEnabled(bool e);
|
||||||
void updateShortcut(Command *command);
|
void updateShortcut(Command *command);
|
||||||
@@ -168,6 +176,7 @@ public:
|
|||||||
const QString &actionName,
|
const QString &actionName,
|
||||||
Id id,
|
Id id,
|
||||||
int toolNumber,
|
int toolNumber,
|
||||||
|
const QByteArray &toolClassName,
|
||||||
const QString &iconName = QString(),
|
const QString &iconName = QString(),
|
||||||
const QString &keySequence = QString());
|
const QString &keySequence = QString());
|
||||||
Command *addToolAction(QAction *a,
|
Command *addToolAction(QAction *a,
|
||||||
@@ -528,30 +537,53 @@ void FormEditorData::setupActions()
|
|||||||
|
|
||||||
m_actionGroupEditMode = new QActionGroup(this);
|
m_actionGroupEditMode = new QActionGroup(this);
|
||||||
m_actionGroupEditMode->setExclusive(true);
|
m_actionGroupEditMode->setExclusive(true);
|
||||||
QObject::connect(m_actionGroupEditMode, &QActionGroup::triggered, this,
|
QObject::connect(m_actionGroupEditMode, &QActionGroup::triggered, this, [this](QAction *a) {
|
||||||
[this](QAction *a) { activateEditMode(a->data().toInt()); });
|
activateEditMode(a->data().value<ToolData>());
|
||||||
|
});
|
||||||
|
|
||||||
medit->addSeparator(m_contexts, Core::Constants::G_EDIT_OTHER);
|
medit->addSeparator(m_contexts, Core::Constants::G_EDIT_OTHER);
|
||||||
|
|
||||||
m_toolActionIds.push_back("FormEditor.WidgetEditor");
|
m_toolActionIds.push_back("FormEditor.WidgetEditor");
|
||||||
createEditModeAction(m_actionGroupEditMode, m_contexts, medit,
|
createEditModeAction(m_actionGroupEditMode,
|
||||||
Tr::tr("Edit Widgets"), m_toolActionIds.back(),
|
m_contexts,
|
||||||
EditModeWidgetEditor, "widgettool.png", Tr::tr("F3"));
|
medit,
|
||||||
|
Tr::tr("Edit Widgets"),
|
||||||
|
m_toolActionIds.back(),
|
||||||
|
EditModeWidgetEditor,
|
||||||
|
"qdesigner_internal::WidgetEditorTool",
|
||||||
|
"widgettool.png",
|
||||||
|
Tr::tr("F3"));
|
||||||
|
|
||||||
m_toolActionIds.push_back("FormEditor.SignalsSlotsEditor");
|
m_toolActionIds.push_back("FormEditor.SignalsSlotsEditor");
|
||||||
createEditModeAction(m_actionGroupEditMode, m_contexts, medit,
|
createEditModeAction(m_actionGroupEditMode,
|
||||||
Tr::tr("Edit Signals/Slots"), m_toolActionIds.back(),
|
m_contexts,
|
||||||
EditModeSignalsSlotEditor, "signalslottool.png", Tr::tr("F4"));
|
medit,
|
||||||
|
Tr::tr("Edit Signals/Slots"),
|
||||||
|
m_toolActionIds.back(),
|
||||||
|
EditModeSignalsSlotEditor,
|
||||||
|
"qdesigner_internal::SignalSlotEditorTool",
|
||||||
|
"signalslottool.png",
|
||||||
|
Tr::tr("F4"));
|
||||||
|
|
||||||
m_toolActionIds.push_back("FormEditor.BuddyEditor");
|
m_toolActionIds.push_back("FormEditor.BuddyEditor");
|
||||||
createEditModeAction(m_actionGroupEditMode, m_contexts, medit,
|
createEditModeAction(m_actionGroupEditMode,
|
||||||
Tr::tr("Edit Buddies"), m_toolActionIds.back(),
|
m_contexts,
|
||||||
EditModeBuddyEditor, "buddytool.png");
|
medit,
|
||||||
|
Tr::tr("Edit Buddies"),
|
||||||
|
m_toolActionIds.back(),
|
||||||
|
EditModeBuddyEditor,
|
||||||
|
"qdesigner_internal::BuddyEditorTool",
|
||||||
|
"buddytool.png");
|
||||||
|
|
||||||
m_toolActionIds.push_back("FormEditor.TabOrderEditor");
|
m_toolActionIds.push_back("FormEditor.TabOrderEditor");
|
||||||
createEditModeAction(m_actionGroupEditMode, m_contexts, medit,
|
createEditModeAction(m_actionGroupEditMode,
|
||||||
Tr::tr("Edit Tab Order"), m_toolActionIds.back(),
|
m_contexts,
|
||||||
EditModeTabOrderEditor, "tabordertool.png");
|
medit,
|
||||||
|
Tr::tr("Edit Tab Order"),
|
||||||
|
m_toolActionIds.back(),
|
||||||
|
EditModeTabOrderEditor,
|
||||||
|
"qdesigner_internal::TabOrderEditorTool",
|
||||||
|
"tabordertool.png");
|
||||||
|
|
||||||
//tool actions
|
//tool actions
|
||||||
m_toolActionIds.push_back("FormEditor.LayoutHorizontally");
|
m_toolActionIds.push_back("FormEditor.LayoutHorizontally");
|
||||||
@@ -721,13 +753,14 @@ void FormEditorData::bindShortcut(Command *command, QAction *action)
|
|||||||
|
|
||||||
// Create an action to activate a designer tool
|
// Create an action to activate a designer tool
|
||||||
QAction *FormEditorData::createEditModeAction(QActionGroup *ag,
|
QAction *FormEditorData::createEditModeAction(QActionGroup *ag,
|
||||||
const Context &context,
|
const Context &context,
|
||||||
ActionContainer *medit,
|
ActionContainer *medit,
|
||||||
const QString &actionName,
|
const QString &actionName,
|
||||||
Id id,
|
Id id,
|
||||||
int toolNumber,
|
int toolNumber,
|
||||||
const QString &iconName,
|
const QByteArray &toolClassName,
|
||||||
const QString &keySequence)
|
const QString &iconName,
|
||||||
|
const QString &keySequence)
|
||||||
{
|
{
|
||||||
auto rc = new QAction(actionName, ag);
|
auto rc = new QAction(actionName, ag);
|
||||||
rc->setCheckable(true);
|
rc->setCheckable(true);
|
||||||
@@ -739,7 +772,7 @@ QAction *FormEditorData::createEditModeAction(QActionGroup *ag,
|
|||||||
command->setDefaultKeySequence(QKeySequence(keySequence));
|
command->setDefaultKeySequence(QKeySequence(keySequence));
|
||||||
bindShortcut(command, rc);
|
bindShortcut(command, rc);
|
||||||
medit->addAction(command, Core::Constants::G_EDIT_OTHER);
|
medit->addAction(command, Core::Constants::G_EDIT_OTHER);
|
||||||
rc->setData(toolNumber);
|
rc->setData(QVariant::fromValue(ToolData{toolNumber, toolClassName}));
|
||||||
ag->addAction(rc);
|
ag->addAction(rc);
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
@@ -767,8 +800,9 @@ IEditor *FormEditorData::createEditor()
|
|||||||
QDesignerFormWindowInterface *form = m_fwm->createFormWindow(nullptr);
|
QDesignerFormWindowInterface *form = m_fwm->createFormWindow(nullptr);
|
||||||
QTC_ASSERT(form, return nullptr);
|
QTC_ASSERT(form, return nullptr);
|
||||||
form->setPalette(Theme::initialPalette());
|
form->setPalette(Theme::initialPalette());
|
||||||
connect(form, &QDesignerFormWindowInterface::toolChanged,
|
connect(form, &QDesignerFormWindowInterface::toolChanged, this, [this, form](int index) {
|
||||||
this, &FormEditorData::toolChanged);
|
toolChanged(form, index);
|
||||||
|
});
|
||||||
|
|
||||||
auto widgetHost = new SharedTools::WidgetHost( /* parent */ nullptr, form);
|
auto widgetHost = new SharedTools::WidgetHost( /* parent */ nullptr, form);
|
||||||
FormWindowEditor *formWindowEditor = m_xmlEditorFactory->create(form);
|
FormWindowEditor *formWindowEditor = m_xmlEditorFactory->create(form);
|
||||||
@@ -820,26 +854,48 @@ void FormEditorData::updateShortcut(Command *command)
|
|||||||
a->setShortcut(command->action()->shortcut());
|
a->setShortcut(command->action()->shortcut());
|
||||||
}
|
}
|
||||||
|
|
||||||
void FormEditorData::activateEditMode(int id)
|
static void setTool(QDesignerFormWindowInterface *formWindow, const ToolData &toolData)
|
||||||
{
|
{
|
||||||
if (const int count = m_fwm->formWindowCount())
|
// check for tool action with correct object name,
|
||||||
for (int i = 0; i < count; i++)
|
// otherwise fall back to index
|
||||||
m_fwm->formWindow(i)->setCurrentTool(id);
|
if (!toolData.className.isEmpty()) {
|
||||||
|
const int toolCount = formWindow->toolCount();
|
||||||
|
for (int tool = 0; tool < toolCount; ++tool) {
|
||||||
|
if (formWindow->tool(tool)->metaObject()->className() == toolData.className) {
|
||||||
|
formWindow->setCurrentTool(tool);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
formWindow->setCurrentTool(toolData.index);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FormEditorData::toolChanged(int t)
|
void FormEditorData::activateEditMode(const ToolData &toolData)
|
||||||
{
|
{
|
||||||
typedef QList<QAction *> ActionList;
|
if (const int count = m_fwm->formWindowCount()) {
|
||||||
if (const QAction *currentAction = m_actionGroupEditMode->checkedAction())
|
for (int i = 0; i < count; i++)
|
||||||
if (currentAction->data().toInt() == t)
|
setTool(m_fwm->formWindow(i), toolData);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void FormEditorData::toolChanged(QDesignerFormWindowInterface *form, int t)
|
||||||
|
{
|
||||||
|
// check for action with correct object name,
|
||||||
|
// otherwise fall back to index
|
||||||
|
QDesignerFormWindowToolInterface *tool = form->tool(t);
|
||||||
|
const QList<QAction *> actions = m_actionGroupEditMode->actions();
|
||||||
|
QAction *candidateByIndex = nullptr;
|
||||||
|
for (QAction *action : actions) {
|
||||||
|
const auto toolData = action->data().value<ToolData>();
|
||||||
|
if (!toolData.className.isEmpty() && toolData.className == tool->metaObject()->className()) {
|
||||||
|
action->setChecked(true);
|
||||||
return;
|
return;
|
||||||
const ActionList actions = m_actionGroupEditMode->actions();
|
|
||||||
const ActionList::const_iterator cend = actions.constEnd();
|
|
||||||
for (ActionList::const_iterator it = actions.constBegin(); it != cend; ++it)
|
|
||||||
if ( (*it)->data().toInt() == t) {
|
|
||||||
(*it)->setChecked(true);
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
if (toolData.index == t)
|
||||||
|
candidateByIndex = action;
|
||||||
|
}
|
||||||
|
if (candidateByIndex)
|
||||||
|
candidateByIndex->setChecked(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FormEditorData::print()
|
void FormEditorData::print()
|
||||||
@@ -929,3 +985,5 @@ void addPluginPath(const QString &pluginPath)
|
|||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
} // namespace Designer
|
} // namespace Designer
|
||||||
|
|
||||||
|
Q_DECLARE_METATYPE(Designer::Internal::ToolData)
|
||||||
|
@@ -519,7 +519,7 @@ void QbsBuildSystem::handleQbsParsingDone(bool success)
|
|||||||
m_qbsUpdateFutureInterface->reportCanceled();
|
m_qbsUpdateFutureInterface->reportCanceled();
|
||||||
}
|
}
|
||||||
|
|
||||||
m_qbsProjectParser->deleteLater();
|
m_qbsProjectParser->deleteLaterSafely();
|
||||||
m_qbsProjectParser = nullptr;
|
m_qbsProjectParser = nullptr;
|
||||||
m_qbsUpdateFutureInterface->reportFinished();
|
m_qbsUpdateFutureInterface->reportFinished();
|
||||||
delete m_qbsUpdateFutureInterface;
|
delete m_qbsUpdateFutureInterface;
|
||||||
|
@@ -30,6 +30,9 @@ public:
|
|||||||
void cancel();
|
void cancel();
|
||||||
Utils::Environment environment() const { return m_environment; }
|
Utils::Environment environment() const { return m_environment; }
|
||||||
|
|
||||||
|
// FIXME: Why on earth do we not own the FutureInterface?
|
||||||
|
void deleteLaterSafely() { m_fi = nullptr; deleteLater(); }
|
||||||
|
|
||||||
QbsSession *session() const { return m_session; }
|
QbsSession *session() const { return m_session; }
|
||||||
QJsonObject projectData() const { return m_projectData; }
|
QJsonObject projectData() const { return m_projectData; }
|
||||||
ErrorInfo error() const { return m_error; }
|
ErrorInfo error() const { return m_error; }
|
||||||
|
Submodule src/shared/qbs updated: 36e230e0ba...b1d6a0518a
@@ -45,7 +45,7 @@ def main():
|
|||||||
# Verify that qmljs.g is in the project even when we don't know where (QTCREATORBUG-17609)
|
# Verify that qmljs.g is in the project even when we don't know where (QTCREATORBUG-17609)
|
||||||
selectFromLocator("p qmljs.g", "qmljs.g")
|
selectFromLocator("p qmljs.g", "qmljs.g")
|
||||||
# Now check some basic lookups in the search box
|
# Now check some basic lookups in the search box
|
||||||
selectFromLocator(": qlist::qlist", "QList::QList")
|
selectFromLocator(": qlist", "QList")
|
||||||
test.compare(wordUnderCursor(waitForObject(":Qt Creator_CppEditor::Internal::CPPEditorWidget")), "QList")
|
test.compare(wordUnderCursor(waitForObject(":Qt Creator_CppEditor::Internal::CPPEditorWidget")), "QList")
|
||||||
|
|
||||||
invokeMenuItem("File", "Exit")
|
invokeMenuItem("File", "Exit")
|
||||||
|
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user