From 04bc18eaa57b8284ccc2eec7b9d71dc569bcff5e Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Tue, 28 Aug 2012 09:31:59 +0200 Subject: [PATCH 01/39] Win: Don't require interaction with "make deployartifacts" Change-Id: Ieacef53be501fdddc16c10e9facbb3937cbd37b4 Reviewed-by: Daniel Molkentin --- qtcreator.pro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qtcreator.pro b/qtcreator.pro index 84e287a27d9..62799e8fd4b 100644 --- a/qtcreator.pro +++ b/qtcreator.pro @@ -32,7 +32,7 @@ macx { deployqt.commands ~= s,/,\\\\,g deployartifacts.depends = install PLATFORM="windows" - deployartifacts.commands = git clone "git://gitorious.org/qt-creator/binary-artifacts.git"&& xcopy /s /q /y /i "binary-artifacts\\win32" $(INSTALL_ROOT)&& rmdir /s binary-artifacts + deployartifacts.commands = git clone "git://gitorious.org/qt-creator/binary-artifacts.git"&& xcopy /s /q /y /i "binary-artifacts\\win32" $(INSTALL_ROOT)&& rmdir /s /q binary-artifacts QMAKE_EXTRA_TARGETS += deployartifacts } else:linux-*:PLATFORM="linux-$${QT_ARCH}" From 2342fbb32cfe56533ebc8d87ed0134651e2c812a Mon Sep 17 00:00:00 2001 From: Leandro Melo Date: Tue, 28 Aug 2012 14:23:53 +0200 Subject: [PATCH 02/39] C++: Fix duplicate base classes in lookup Previously we detected the duplicates by name and then processed the missing ones, but this was not handling qualification properly. Now we process the bases and only after lookup (making sure we are talking about the *same* types) we add then if necessary. Change-Id: Ic318b174d2174e24c24a4f2f1b612fbcb3f20491 Reviewed-by: Orgad Shaneh Reviewed-by: Roberto Raggi --- src/libs/cplusplus/LookupContext.cpp | 26 +++++++++----------------- 1 file changed, 9 insertions(+), 17 deletions(-) diff --git a/src/libs/cplusplus/LookupContext.cpp b/src/libs/cplusplus/LookupContext.cpp index 743e9a0fca1..d41846014ca 100644 --- a/src/libs/cplusplus/LookupContext.cpp +++ b/src/libs/cplusplus/LookupContext.cpp @@ -626,24 +626,14 @@ ClassOrNamespace *ClassOrNamespace::nestedType(const Name *name, ClassOrNamespac // are templates. We need to collect them now. First, we track the bases which are already // part of the binding so we can identify the missings ones later. - QSet knownBases; - foreach (ClassOrNamespace *con, reference->usings()) { - foreach (Symbol *s, con->symbols()) { - if (Class *c = s->asClass()) { - knownBases.insert(c->name()); - break; - } - } - } - Class *referenceClass = 0; - QList missingBases; + QList allBases; foreach (Symbol *s, reference->symbols()) { if (Class *clazz = s->asClass()) { for (unsigned i = 0; i < clazz->baseClassCount(); ++i) { BaseClass *baseClass = clazz->baseClassAt(i); - if (baseClass->name() && !knownBases.contains(baseClass->name())) - missingBases.append(baseClass->name()); + if (baseClass->name()) + allBases.append(baseClass->name()); } referenceClass = clazz; break; @@ -653,6 +643,8 @@ ClassOrNamespace *ClassOrNamespace::nestedType(const Name *name, ClassOrNamespac if (!referenceClass) return reference; + QSet knownUsings = reference->usings().toSet(); + // If we are dealling with a template type, more work is required, since we need to // construct all instantiation data. if (const TemplateNameId *templId = name->asTemplateNameId()) { @@ -673,7 +665,7 @@ ClassOrNamespace *ClassOrNamespace::nestedType(const Name *name, ClassOrNamespac for (unsigned i = 0; i < templ->templateParameterCount(); ++i) templParams.insert(templ->templateParameterAt(i)->name(), i); - foreach (const Name *baseName, missingBases) { + foreach (const Name *baseName, allBases) { ClassOrNamespace *baseBinding = 0; if (const Identifier *nameId = baseName->asNameId()) { @@ -721,7 +713,7 @@ ClassOrNamespace *ClassOrNamespace::nestedType(const Name *name, ClassOrNamespac } } - if (baseBinding) + if (baseBinding && !knownUsings.contains(baseBinding)) instantiation->addUsing(baseBinding); } } @@ -731,7 +723,7 @@ ClassOrNamespace *ClassOrNamespace::nestedType(const Name *name, ClassOrNamespac // Find the missing bases for regular (non-template) types. // Ex.: class A : public B::Type {}; - foreach (const Name *baseName, missingBases) { + foreach (const Name *baseName, allBases) { ClassOrNamespace *binding = this; if (const QualifiedNameId *qBaseName = baseName->asQualifiedNameId()) { if (const Name *qualification = qBaseName->base()) @@ -741,7 +733,7 @@ ClassOrNamespace *ClassOrNamespace::nestedType(const Name *name, ClassOrNamespac if (binding) { ClassOrNamespace * baseBinding = binding->lookupType(baseName); - if (baseBinding) + if (baseBinding && !knownUsings.contains(baseBinding)) reference->addUsing(baseBinding); } } From f555c936a440133aa5d537b396af47e4917bd4aa Mon Sep 17 00:00:00 2001 From: Daniel Teske Date: Fri, 24 Aug 2012 16:09:41 +0200 Subject: [PATCH 03/39] Optimize MiniTargetSelector's various update functions Should be called less often now. Change-Id: Id7cd751e2be348c13ecc7dc02bffd0e33ccc297c Reviewed-by: Daniel Molkentin --- .../miniprojecttargetselector.cpp | 78 +++++++++++++++---- .../miniprojecttargetselector.h | 26 +++++-- 2 files changed, 80 insertions(+), 24 deletions(-) diff --git a/src/plugins/projectexplorer/miniprojecttargetselector.cpp b/src/plugins/projectexplorer/miniprojecttargetselector.cpp index cb50d71a609..9c9177482fa 100644 --- a/src/plugins/projectexplorer/miniprojecttargetselector.cpp +++ b/src/plugins/projectexplorer/miniprojecttargetselector.cpp @@ -625,10 +625,10 @@ void MiniProjectTargetSelector::setActiveRunConfiguration(ProjectExplorer::Proje void MiniProjectTargetSelector::projectAdded(ProjectExplorer::Project *project) { connect(project, SIGNAL(addedTarget(ProjectExplorer::Target*)), - this, SLOT(addedTarget(ProjectExplorer::Target*))); + this, SLOT(slotAddedTarget(ProjectExplorer::Target*))); connect(project, SIGNAL(removedTarget(ProjectExplorer::Target*)), - this, SLOT(removedTarget(ProjectExplorer::Target*))); + this, SLOT(slotRemovedTarget(ProjectExplorer::Target*))); foreach (Target *t, project->targets()) addedTarget(t); @@ -643,10 +643,10 @@ void MiniProjectTargetSelector::projectAdded(ProjectExplorer::Project *project) void MiniProjectTargetSelector::projectRemoved(ProjectExplorer::Project *project) { disconnect(project, SIGNAL(addedTarget(ProjectExplorer::Target*)), - this, SLOT(addedTarget(ProjectExplorer::Target*))); + this, SLOT(slotAddedTarget(ProjectExplorer::Target*))); disconnect(project, SIGNAL(removedTarget(ProjectExplorer::Target*)), - this, SLOT(removedTarget(ProjectExplorer::Target*))); + this, SLOT(slotRemovedTarget(ProjectExplorer::Target*))); foreach (Target *t, project->targets()) removedTarget(t); @@ -661,19 +661,19 @@ void MiniProjectTargetSelector::projectRemoved(ProjectExplorer::Project *project void MiniProjectTargetSelector::addedTarget(ProjectExplorer::Target *target) { connect(target, SIGNAL(addedBuildConfiguration(ProjectExplorer::BuildConfiguration*)), - this, SLOT(addedBuildConfiguration(ProjectExplorer::BuildConfiguration*))); + this, SLOT(slotAddedBuildConfiguration(ProjectExplorer::BuildConfiguration*))); connect(target, SIGNAL(removedBuildConfiguration(ProjectExplorer::BuildConfiguration*)), - this, SLOT(removedBuildConfiguration(ProjectExplorer::BuildConfiguration*))); + this, SLOT(slotRemovedBuildConfiguration(ProjectExplorer::BuildConfiguration*))); connect(target, SIGNAL(addedDeployConfiguration(ProjectExplorer::DeployConfiguration*)), - this, SLOT(addedDeployConfiguration(ProjectExplorer::DeployConfiguration*))); + this, SLOT(slotAddedDeployConfiguration(ProjectExplorer::DeployConfiguration*))); connect(target, SIGNAL(removedDeployConfiguration(ProjectExplorer::DeployConfiguration*)), - this, SLOT(removedDeployConfiguration(ProjectExplorer::DeployConfiguration*))); + this, SLOT(slotRemovedDeployConfiguration(ProjectExplorer::DeployConfiguration*))); connect(target, SIGNAL(addedRunConfiguration(ProjectExplorer::RunConfiguration*)), - this, SLOT(addedRunConfiguration(ProjectExplorer::RunConfiguration*))); + this, SLOT(slotAddedRunConfiguration(ProjectExplorer::RunConfiguration*))); connect(target, SIGNAL(removedRunConfiguration(ProjectExplorer::RunConfiguration*)), - this, SLOT(removedRunConfiguration(ProjectExplorer::RunConfiguration*))); + this, SLOT(slotRemovedRunConfiguration(ProjectExplorer::RunConfiguration*))); if (target->project() == m_project) m_listWidgets[TARGET]->addProjectConfiguration(target); @@ -684,7 +684,11 @@ void MiniProjectTargetSelector::addedTarget(ProjectExplorer::Target *target) addedDeployConfiguration(dc); foreach (RunConfiguration *rc, target->runConfigurations()) addedRunConfiguration(rc); +} +void MiniProjectTargetSelector::slotAddedTarget(ProjectExplorer::Target *target) +{ + addedTarget(target); updateTargetListVisible(); updateBuildListVisible(); updateDeployListVisible(); @@ -694,19 +698,19 @@ void MiniProjectTargetSelector::addedTarget(ProjectExplorer::Target *target) void MiniProjectTargetSelector::removedTarget(ProjectExplorer::Target *target) { disconnect(target, SIGNAL(addedBuildConfiguration(ProjectExplorer::BuildConfiguration*)), - this, SLOT(addedBuildConfiguration(ProjectExplorer::BuildConfiguration*))); + this, SLOT(slotAddedBuildConfiguration(ProjectExplorer::BuildConfiguration*))); disconnect(target, SIGNAL(removedBuildConfiguration(ProjectExplorer::BuildConfiguration*)), - this, SLOT(removedBuildConfiguration(ProjectExplorer::BuildConfiguration*))); + this, SLOT(slotRemovedBuildConfiguration(ProjectExplorer::BuildConfiguration*))); disconnect(target, SIGNAL(addedDeployConfiguration(ProjectExplorer::DeployConfiguration*)), - this, SLOT(addedDeployConfiguration(ProjectExplorer::DeployConfiguration*))); + this, SLOT(slotAddedDeployConfiguration(ProjectExplorer::DeployConfiguration*))); disconnect(target, SIGNAL(removedDeployConfiguration(ProjectExplorer::DeployConfiguration*)), - this, SLOT(removedDeployConfiguration(ProjectExplorer::DeployConfiguration*))); + this, SLOT(slotRemovedDeployConfiguration(ProjectExplorer::DeployConfiguration*))); disconnect(target, SIGNAL(addedRunConfiguration(ProjectExplorer::RunConfiguration*)), - this, SLOT(addedRunConfiguration(ProjectExplorer::RunConfiguration*))); + this, SLOT(slotAddedRunConfiguration(ProjectExplorer::RunConfiguration*))); disconnect(target, SIGNAL(removedRunConfiguration(ProjectExplorer::RunConfiguration*)), - this, SLOT(removedRunConfiguration(ProjectExplorer::RunConfiguration*))); + this, SLOT(slotRemovedRunConfiguration(ProjectExplorer::RunConfiguration*))); if (target->project() == m_project) m_listWidgets[TARGET]->removeProjectConfiguration(target); @@ -717,6 +721,11 @@ void MiniProjectTargetSelector::removedTarget(ProjectExplorer::Target *target) removedDeployConfiguration(dc); foreach (RunConfiguration *rc, target->runConfigurations()) removedRunConfiguration(rc); +} + +void MiniProjectTargetSelector::slotRemovedTarget(ProjectExplorer::Target *target) +{ + removedTarget(target); updateTargetListVisible(); updateBuildListVisible(); @@ -724,7 +733,14 @@ void MiniProjectTargetSelector::removedTarget(ProjectExplorer::Target *target) updateRunListVisible(); } + void MiniProjectTargetSelector::addedBuildConfiguration(ProjectExplorer::BuildConfiguration *bc) +{ + if (bc->target() == m_target) + m_listWidgets[BUILD]->addProjectConfiguration(bc); +} + +void MiniProjectTargetSelector::slotAddedBuildConfiguration(ProjectExplorer::BuildConfiguration *bc) { if (bc->target() == m_target) m_listWidgets[BUILD]->addProjectConfiguration(bc); @@ -732,6 +748,12 @@ void MiniProjectTargetSelector::addedBuildConfiguration(ProjectExplorer::BuildCo } void MiniProjectTargetSelector::removedBuildConfiguration(ProjectExplorer::BuildConfiguration *bc) +{ + if (bc->target() == m_target) + m_listWidgets[BUILD]->removeProjectConfiguration(bc); +} + +void MiniProjectTargetSelector::slotRemovedBuildConfiguration(ProjectExplorer::BuildConfiguration *bc) { if (bc->target() == m_target) m_listWidgets[BUILD]->removeProjectConfiguration(bc); @@ -739,6 +761,12 @@ void MiniProjectTargetSelector::removedBuildConfiguration(ProjectExplorer::Build } void MiniProjectTargetSelector::addedDeployConfiguration(ProjectExplorer::DeployConfiguration *dc) +{ + if (dc->target() == m_target) + m_listWidgets[DEPLOY]->addProjectConfiguration(dc); +} + +void MiniProjectTargetSelector::slotAddedDeployConfiguration(ProjectExplorer::DeployConfiguration *dc) { if (dc->target() == m_target) m_listWidgets[DEPLOY]->addProjectConfiguration(dc); @@ -746,6 +774,12 @@ void MiniProjectTargetSelector::addedDeployConfiguration(ProjectExplorer::Deploy } void MiniProjectTargetSelector::removedDeployConfiguration(ProjectExplorer::DeployConfiguration *dc) +{ + if (dc->target() == m_target) + m_listWidgets[DEPLOY]->removeProjectConfiguration(dc); +} + +void MiniProjectTargetSelector::slotRemovedDeployConfiguration(ProjectExplorer::DeployConfiguration *dc) { if (dc->target() == m_target) m_listWidgets[DEPLOY]->removeProjectConfiguration(dc); @@ -753,6 +787,12 @@ void MiniProjectTargetSelector::removedDeployConfiguration(ProjectExplorer::Depl } void MiniProjectTargetSelector::addedRunConfiguration(ProjectExplorer::RunConfiguration *rc) +{ + if (rc->target() == m_target) + m_listWidgets[RUN]->addProjectConfiguration(rc); +} + +void MiniProjectTargetSelector::slotAddedRunConfiguration(ProjectExplorer::RunConfiguration *rc) { if (rc->target() == m_target) m_listWidgets[RUN]->addProjectConfiguration(rc); @@ -760,6 +800,12 @@ void MiniProjectTargetSelector::addedRunConfiguration(ProjectExplorer::RunConfig } void MiniProjectTargetSelector::removedRunConfiguration(ProjectExplorer::RunConfiguration *rc) +{ + if (rc->target() == m_target) + m_listWidgets[RUN]->removeProjectConfiguration(rc); +} + +void MiniProjectTargetSelector::slotRemovedRunConfiguration(ProjectExplorer::RunConfiguration *rc) { if (rc->target() == m_target) m_listWidgets[RUN]->removeProjectConfiguration(rc); diff --git a/src/plugins/projectexplorer/miniprojecttargetselector.h b/src/plugins/projectexplorer/miniprojecttargetselector.h index c2dbca46d22..c7cda425740 100644 --- a/src/plugins/projectexplorer/miniprojecttargetselector.h +++ b/src/plugins/projectexplorer/miniprojecttargetselector.h @@ -62,6 +62,7 @@ public: void keyPressEvent(QKeyEvent *event); void keyReleaseEvent(QKeyEvent *event); void setMaxCount(int maxCount); + private: int m_maxCount; }; @@ -122,14 +123,14 @@ public slots: private slots: void projectAdded(ProjectExplorer::Project *project); void projectRemoved(ProjectExplorer::Project *project); - void addedTarget(ProjectExplorer::Target *target); - void removedTarget(ProjectExplorer::Target *target); - void addedBuildConfiguration(ProjectExplorer::BuildConfiguration* bc); - void removedBuildConfiguration(ProjectExplorer::BuildConfiguration* bc); - void addedDeployConfiguration(ProjectExplorer::DeployConfiguration *dc); - void removedDeployConfiguration(ProjectExplorer::DeployConfiguration *dc); - void addedRunConfiguration(ProjectExplorer::RunConfiguration *rc); - void removedRunConfiguration(ProjectExplorer::RunConfiguration *rc); + void slotAddedTarget(ProjectExplorer::Target *target); + void slotRemovedTarget(ProjectExplorer::Target *target); + void slotAddedBuildConfiguration(ProjectExplorer::BuildConfiguration *bc); + void slotRemovedBuildConfiguration(ProjectExplorer::BuildConfiguration *bc); + void slotAddedDeployConfiguration(ProjectExplorer::DeployConfiguration *dc); + void slotRemovedDeployConfiguration(ProjectExplorer::DeployConfiguration *dc); + void slotAddedRunConfiguration(ProjectExplorer::RunConfiguration *rc); + void slotRemovedRunConfiguration(ProjectExplorer::RunConfiguration *rc); void changeStartupProject(ProjectExplorer::Project *project); void activeTargetChanged(ProjectExplorer::Target *target); @@ -147,6 +148,15 @@ private slots: void updateActionAndSummary(); void switchToProjectsMode(); private: + void addedTarget(ProjectExplorer::Target *target); + void removedTarget(ProjectExplorer::Target *target); + void addedBuildConfiguration(ProjectExplorer::BuildConfiguration* bc); + void removedBuildConfiguration(ProjectExplorer::BuildConfiguration* bc); + void addedDeployConfiguration(ProjectExplorer::DeployConfiguration *dc); + void removedDeployConfiguration(ProjectExplorer::DeployConfiguration *dc); + void addedRunConfiguration(ProjectExplorer::RunConfiguration *rc); + void removedRunConfiguration(ProjectExplorer::RunConfiguration *rc); + void updateProjectListVisible(); void updateTargetListVisible(); void updateBuildListVisible(); From 8ed9720cd1afa60f3086f9fa3457a15ff963d246 Mon Sep 17 00:00:00 2001 From: Orgad Shaneh Date: Thu, 9 Aug 2012 23:19:09 +0300 Subject: [PATCH 04/39] TypeHierarchy: Invert bases order Current display doesn't make sense (to me :)) Active class is the middle one, derived classes should be top-down, but base classes should be bottom-up. That's easier to understand. Change-Id: I06693da37c834f5a99fd62ae29a91d958bafe136 Reviewed-by: Leandro Melo --- src/plugins/cppeditor/cpptypehierarchy.cpp | 42 ++++++---------------- src/plugins/cppeditor/cpptypehierarchy.h | 5 +-- 2 files changed, 13 insertions(+), 34 deletions(-) diff --git a/src/plugins/cppeditor/cpptypehierarchy.cpp b/src/plugins/cppeditor/cpptypehierarchy.cpp index 2c5c79d5d20..88ca5f89287 100644 --- a/src/plugins/cppeditor/cpptypehierarchy.cpp +++ b/src/plugins/cppeditor/cpptypehierarchy.cpp @@ -196,46 +196,24 @@ void CppTypeHierarchyWidget::perform() m_inspectedClass->setup(cppClass); QStandardItem *bases = new QStandardItem(tr("Bases")); m_model->invisibleRootItem()->appendRow(bases); - QVector v; - v.push_back(*cppClass); - buildBaseHierarchy(&v); - m_treeView->expand(m_model->indexFromItem(bases)); + buildHierarchy(*cppClass, bases, true, &CppClass::bases); QStandardItem *derived = new QStandardItem(tr("Derived")); m_model->invisibleRootItem()->appendRow(derived); - foreach (const CppClass &derivedClass, sortClasses(cppClass->derived())) - buildDerivedHierarchy(derivedClass, derived); + buildHierarchy(*cppClass, derived, true, &CppClass::derived); + m_treeView->expandAll(); } } } -void CppTypeHierarchyWidget::buildBaseHierarchy(QVector *s) +void CppTypeHierarchyWidget::buildHierarchy(const CppClass &cppClass, QStandardItem *parent, bool isRoot, HierarchyFunc func) { - const CppClass ¤t = s->back(); - const QList &bases = sortClasses(current.bases()); - if (!bases.isEmpty()) { - foreach (const CppClass &base, bases) { - s->push_back(base); - buildBaseHierarchy(s); - s->pop_back(); - } - } else { - QStandardItem *parent = m_model->item(0, 0); - for (int i = s->size() - 1; i > 0; --i) { - QStandardItem *item = itemForClass(s->at(i)); - parent->appendRow(item); - m_treeView->expand(m_model->indexFromItem(parent)); - parent = item; - } + if (!isRoot) { + QStandardItem *item = itemForClass(cppClass); + parent->appendRow(item); + parent = item; } -} - -void CppTypeHierarchyWidget::buildDerivedHierarchy(const CppClass &cppClass, QStandardItem *parent) -{ - QStandardItem *item = itemForClass(cppClass); - parent->appendRow(item); - foreach (const CppClass &derived, sortClasses(cppClass.derived())) - buildDerivedHierarchy(derived, item); - m_treeView->expand(m_model->indexFromItem(parent)); + foreach (const CppClass &klass, sortClasses((cppClass.*func)())) + buildHierarchy(klass, parent, false, func); } void CppTypeHierarchyWidget::onItemClicked(const QModelIndex &index) diff --git a/src/plugins/cppeditor/cpptypehierarchy.h b/src/plugins/cppeditor/cpptypehierarchy.h index d9c5e8d9410..2d862d69044 100644 --- a/src/plugins/cppeditor/cpptypehierarchy.h +++ b/src/plugins/cppeditor/cpptypehierarchy.h @@ -43,6 +43,7 @@ class QStandardItem; class QModelIndex; class QLabel; template class QVector; +template class QList; QT_END_NAMESPACE namespace Core { @@ -77,8 +78,8 @@ private slots: void onItemClicked(const QModelIndex &index); private: - void buildDerivedHierarchy(const CppClass &cppClass, QStandardItem *parent); - void buildBaseHierarchy(QVector *s); + typedef const QList &(CppClass::* HierarchyFunc)() const; + void buildHierarchy(const CppClass &cppClass, QStandardItem *parent, bool isRoot, HierarchyFunc func); CPPEditorWidget *m_cppEditor; Utils::NavigationTreeView *m_treeView; From d07e7d2aab42105ead451c5381ddc0b52994b6b1 Mon Sep 17 00:00:00 2001 From: Nikolai Kosjar Date: Thu, 23 Aug 2012 11:39:46 +0200 Subject: [PATCH 05/39] Fix running applications in non-xterm terminals Setting Tools/Options/Environment/General/Terminal to one of the following works now as expected. 1. xterm -e 2. aterm -e 3. rxvt -e 4. urxvt -e 5. xfce4-terminal -x 6. konsole --nofork -e 7. gnome-terminal -x Without the '--nofork' option for konsole, from creator's pov, the terminal emulator will finish immediately and therefore creator closes the local socket. As a result of this, the user is presented with sth. like this (from the stub): Cannot connect creator comm socket /tmp/qt_temp.A13523/stub-socket: No such file or directory. Task-Number: QTCREATORBUG-1633 Change-Id: I732e20d34aebdc1591355e0c4e78c907f439924c Reviewed-by: Oswald Buddenhagen --- src/libs/utils/process_stub_unix.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/libs/utils/process_stub_unix.c b/src/libs/utils/process_stub_unix.c index 75096f230d9..2c4263a99e8 100644 --- a/src/libs/utils/process_stub_unix.c +++ b/src/libs/utils/process_stub_unix.c @@ -154,6 +154,12 @@ int main(int argc, char *argv[]) env[count] = 0; } + + /* Ignore SIGTTOU. Without this, calling tcsetpgrp() from a background + * process group (in which we will be, once as child and once as parent) + * generates the mentioned signal and stops the concerned process. */ + signal(SIGTTOU, SIG_IGN); + /* Create execution result notification pipe. */ if (pipe(chldPipe)) { perror("Cannot create status pipe"); From 5409d2d1d3491b83c6e4cf9a22c6d15fca2d3361 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Tue, 28 Aug 2012 14:37:18 +0200 Subject: [PATCH 06/39] CDB: Add setting to add breakpoint at CrtDbgReport(). - Factor out message/tooltips for breakpoints on functions. - Add stringlist of break functions to CdbOptions. - Set breakpoints with module, ignore response. Change-Id: If5cf7647b190057c18d8499b9f4862696610e4f6 Reviewed-by: hjk --- src/plugins/debugger/cdb/cdbengine.cpp | 49 +++++++++++++++++++ src/plugins/debugger/cdb/cdboptions.cpp | 10 +++- src/plugins/debugger/cdb/cdboptions.h | 3 ++ src/plugins/debugger/cdb/cdboptionspage.cpp | 9 ++++ .../debugger/cdb/cdboptionspagewidget.ui | 12 +++++ src/plugins/debugger/commonoptionspage.cpp | 18 +++++++ src/plugins/debugger/commonoptionspage.h | 4 ++ src/plugins/debugger/gdb/gdboptionspage.cpp | 19 +++---- 8 files changed, 111 insertions(+), 13 deletions(-) diff --git a/src/plugins/debugger/cdb/cdbengine.cpp b/src/plugins/debugger/cdb/cdbengine.cpp index a88b7e9e4e9..12de1c163e2 100644 --- a/src/plugins/debugger/cdb/cdbengine.cpp +++ b/src/plugins/debugger/cdb/cdbengine.cpp @@ -775,12 +775,59 @@ void CdbEngine::setupInferior() postExtensionCommand("pid", QByteArray(), 0, &CdbEngine::handlePid); } +static QByteArray msvcRunTime(const Abi::OSFlavor flavour) +{ + switch (flavour) { + case Abi::WindowsMsvc2005Flavor: + return "MSVCR80"; + case Abi::WindowsMsvc2008Flavor: + return "MSVCR90"; + case Abi::WindowsMsvc2010Flavor: + return "MSVCR100"; + case Abi::WindowsMsvc2012Flavor: + return "MSVCR110"; // #FIXME: VS2012 beta, will probably be 12 in final? + default: + break; + } + return "MSVCRT"; // MinGW, others. +} + +static QByteArray breakAtFunctionCommand(const QByteArray &function, + const QByteArray &module = QByteArray()) +{ + QByteArray result = "bu "; + if (!module.isEmpty()) { + result += module; + result += '!'; + } + result += function; + return result; +} + void CdbEngine::runEngine() { if (debug) qDebug("runEngine"); foreach (const QString &breakEvent, m_options->breakEvents) postCommand(QByteArray("sxe ") + breakEvent.toAscii(), 0); + // Break functions: each function must be fully qualified, + // else the debugger will slow down considerably. + foreach (const QString &breakFunctionS, m_options->breakFunctions) { + const QByteArray breakFunction = breakFunctionS.toLatin1(); + if (breakFunction == CdbOptions::crtDbgReport) { + // CrtDbgReport(): Add MSVC runtime (debug, release) + // and stop at Wide character version as well + const QByteArray module = msvcRunTime(startParameters().toolChainAbi.osFlavor()); + const QByteArray debugModule = module + 'D'; + const QByteArray wideFunc = breakFunction + 'W'; + postCommand(breakAtFunctionCommand(breakFunction, module), 0); + postCommand(breakAtFunctionCommand(wideFunc, module), 0); + postCommand(breakAtFunctionCommand(breakFunction, debugModule), 0); + postCommand(breakAtFunctionCommand(wideFunc, debugModule), 0); + } else { + postCommand(breakAtFunctionCommand(breakFunction), 0); + } + } if (startParameters().startMode == AttachCore) { QTC_ASSERT(!m_coreStopReason.isNull(), return; ); notifyInferiorUnrunnable(); @@ -2990,6 +3037,8 @@ void CdbEngine::handleBreakPoints(const GdbMi &value) qPrintable(reportedResponse.toString())); if (reportedResponse.id.isValid() && !reportedResponse.pending) { const BreakpointModelId mid = handler->findBreakpointByResponseId(reportedResponse.id); + if (!mid.isValid() && reportedResponse.type == BreakpointByFunction) + continue; // Breakpoints from options, CrtDbgReport() and others. QTC_ASSERT(mid.isValid(), continue); const PendingBreakPointMap::iterator it = m_pendingBreakpointMap.find(mid); if (it != m_pendingBreakpointMap.end()) { diff --git a/src/plugins/debugger/cdb/cdboptions.cpp b/src/plugins/debugger/cdb/cdboptions.cpp index 413b2763c84..1c629da9411 100644 --- a/src/plugins/debugger/cdb/cdboptions.cpp +++ b/src/plugins/debugger/cdb/cdboptions.cpp @@ -36,6 +36,7 @@ static const char settingsGroupC[] = "CDB2"; static const char symbolPathsKeyC[] = "SymbolPaths"; static const char sourcePathsKeyC[] = "SourcePaths"; static const char breakEventKeyC[] = "BreakEvent"; +static const char breakFunctionsKeyC[] = "BreakFunctions"; static const char additionalArgumentsKeyC[] = "AdditionalArguments"; static const char cdbConsoleKeyC[] = "CDB_Console"; static const char breakpointCorrectionKeyC[] = "BreakpointCorrection"; @@ -43,6 +44,8 @@ static const char breakpointCorrectionKeyC[] = "BreakpointCorrection"; namespace Debugger { namespace Internal { +const char *CdbOptions::crtDbgReport = "CrtDbgReport"; + CdbOptions::CdbOptions() : cdbConsole(false), breakpointCorrection(true) { } @@ -57,6 +60,8 @@ void CdbOptions::clear() symbolPaths.clear(); sourcePaths.clear(); cdbConsole = false; + breakEvents.clear(); + breakFunctions.clear(); } QStringList CdbOptions::oldEngineSymbolPaths(const QSettings *s) @@ -72,6 +77,7 @@ void CdbOptions::fromSettings(QSettings *s) symbolPaths = s->value(keyRoot + QLatin1String(symbolPathsKeyC), QStringList()).toStringList(); sourcePaths = s->value(keyRoot + QLatin1String(sourcePathsKeyC), QStringList()).toStringList(); breakEvents = s->value(keyRoot + QLatin1String(breakEventKeyC), QStringList()).toStringList(); + breakFunctions = s->value(keyRoot + QLatin1String(breakFunctionsKeyC), QStringList()).toStringList(); cdbConsole = s->value(keyRoot + QLatin1String(cdbConsoleKeyC), QVariant(false)).toBool(); breakpointCorrection = s->value(keyRoot + QLatin1String(breakpointCorrectionKeyC), QVariant(true)).toBool(); } @@ -82,6 +88,7 @@ void CdbOptions::toSettings(QSettings *s) const s->setValue(QLatin1String(symbolPathsKeyC), symbolPaths); s->setValue(QLatin1String(sourcePathsKeyC), sourcePaths); s->setValue(QLatin1String(breakEventKeyC), breakEvents); + s->setValue(QLatin1String(breakFunctionsKeyC), breakFunctions); s->setValue(QLatin1String(additionalArgumentsKeyC), additionalArguments); s->setValue(QLatin1String(cdbConsoleKeyC), QVariant(cdbConsole)); s->setValue(QLatin1String(breakpointCorrectionKeyC), QVariant(breakpointCorrection)); @@ -95,7 +102,8 @@ bool CdbOptions::equals(const CdbOptions &rhs) const && additionalArguments == rhs.additionalArguments && symbolPaths == rhs.symbolPaths && sourcePaths == rhs.sourcePaths - && breakEvents == rhs.breakEvents; + && breakEvents == rhs.breakEvents + && breakFunctions == rhs.breakFunctions; } } // namespace Internal diff --git a/src/plugins/debugger/cdb/cdboptions.h b/src/plugins/debugger/cdb/cdboptions.h index 7e29a3eb05e..f681c5e9f0f 100644 --- a/src/plugins/debugger/cdb/cdboptions.h +++ b/src/plugins/debugger/cdb/cdboptions.h @@ -62,10 +62,13 @@ public: QStringList sourcePaths; // Events to break on (Command 'sxe' with abbreviation and optional parameter) QStringList breakEvents; + QStringList breakFunctions; // Launch CDB's own console instead of Qt Creator's bool cdbConsole; // Perform code-model based correction of breakpoint location. bool breakpointCorrection; + + static const char *crtDbgReport; }; inline bool operator==(const CdbOptions &s1, const CdbOptions &s2) diff --git a/src/plugins/debugger/cdb/cdboptionspage.cpp b/src/plugins/debugger/cdb/cdboptionspage.cpp index a8b09f35fc8..2ee23b4c119 100644 --- a/src/plugins/debugger/cdb/cdboptionspage.cpp +++ b/src/plugins/debugger/cdb/cdboptionspage.cpp @@ -30,6 +30,7 @@ #include "cdboptionspage.h" #include "cdboptions.h" +#include "commonoptionspage.h" #include "debuggerinternalconstants.h" #include "cdbengine.h" @@ -176,6 +177,11 @@ CdbOptionsPageWidget::CdbOptionsPageWidget(QWidget *parent) : eventLayout->setContentsMargins(margins); eventLayout->addWidget(m_breakEventWidget); m_ui.eventGroupBox->setLayout(eventLayout); + m_ui.breakCrtDbgReportCheckBox + ->setText(CommonOptionsPage::msgSetBreakpointAtFunction(CdbOptions::crtDbgReport)); + const QString hint = tr("This is useful to catch runtime error messages, for example caused by assert()."); + m_ui.breakCrtDbgReportCheckBox + ->setToolTip(CommonOptionsPage::msgSetBreakpointAtFunctionToolTip(CdbOptions::crtDbgReport, hint)); } void CdbOptionsPageWidget::setOptions(CdbOptions &o) @@ -186,6 +192,7 @@ void CdbOptionsPageWidget::setOptions(CdbOptions &o) m_breakEventWidget->setBreakEvents(o.breakEvents); m_ui.consoleCheckBox->setChecked(o.cdbConsole); m_ui.breakpointCorrectionCheckBox->setChecked(o.breakpointCorrection); + m_ui.breakCrtDbgReportCheckBox->setChecked(o.breakFunctions.contains(QLatin1String(CdbOptions::crtDbgReport))); } CdbOptions CdbOptionsPageWidget::options() const @@ -197,6 +204,8 @@ CdbOptions CdbOptionsPageWidget::options() const rc.breakEvents = m_breakEventWidget->breakEvents(); rc.cdbConsole = m_ui.consoleCheckBox->isChecked(); rc.breakpointCorrection = m_ui.breakpointCorrectionCheckBox->isChecked(); + if (m_ui.breakCrtDbgReportCheckBox->isChecked()) + rc.breakFunctions.push_back(QLatin1String(CdbOptions::crtDbgReport)); return rc; } diff --git a/src/plugins/debugger/cdb/cdboptionspagewidget.ui b/src/plugins/debugger/cdb/cdboptionspagewidget.ui index 8160cd74db3..41b3d6a1ffb 100644 --- a/src/plugins/debugger/cdb/cdboptionspagewidget.ui +++ b/src/plugins/debugger/cdb/cdboptionspagewidget.ui @@ -120,6 +120,18 @@ + + + + Break on functions: + + + + + + + + diff --git a/src/plugins/debugger/commonoptionspage.cpp b/src/plugins/debugger/commonoptionspage.cpp index 495f28af0fb..06a74b5235b 100644 --- a/src/plugins/debugger/commonoptionspage.cpp +++ b/src/plugins/debugger/commonoptionspage.cpp @@ -200,6 +200,24 @@ bool CommonOptionsPage::matches(const QString &s) const return m_searchKeywords.contains(s, Qt::CaseInsensitive); } +QString CommonOptionsPage::msgSetBreakpointAtFunction(const char *function) +{ + return tr("Stop when %1() is called").arg(QLatin1String(function)); +} + +QString CommonOptionsPage::msgSetBreakpointAtFunctionToolTip(const char *function, + const QString &hint) +{ + QString result = QLatin1String(""); + result += tr("Always add a breakpoint on the %1() function.").arg(QLatin1String(function)); + if (!hint.isEmpty()) { + result += QLatin1String("
"); + result += hint; + } + result += QLatin1String(""); + return result; +} + /////////////////////////////////////////////////////////////////////// // // LocalsAndExpressionsOptionsPage diff --git a/src/plugins/debugger/commonoptionspage.h b/src/plugins/debugger/commonoptionspage.h index b5eaf9392a5..4f5b76ab2c0 100644 --- a/src/plugins/debugger/commonoptionspage.h +++ b/src/plugins/debugger/commonoptionspage.h @@ -79,6 +79,10 @@ public: void finish(); bool matches(const QString &s) const; + static QString msgSetBreakpointAtFunction(const char *function); + static QString msgSetBreakpointAtFunctionToolTip(const char *function, + const QString &hint = QString()); + private: const QSharedPointer m_options; QSharedPointer m_group; diff --git a/src/plugins/debugger/gdb/gdboptionspage.cpp b/src/plugins/debugger/gdb/gdboptionspage.cpp index 5f3bc80efa4..4d11152141e 100644 --- a/src/plugins/debugger/gdb/gdboptionspage.cpp +++ b/src/plugins/debugger/gdb/gdboptionspage.cpp @@ -29,6 +29,7 @@ **************************************************************************/ #include "gdboptionspage.h" +#include "commonoptionspage.h" #include "debuggeractions.h" #include "debuggercore.h" #include "debuggerinternalconstants.h" @@ -181,22 +182,16 @@ GdbOptionsPageWidget::GdbOptionsPageWidget(QWidget *parent) "when starting GDB.")); checkBoxBreakOnWarning = new QCheckBox(groupBoxGeneral); - checkBoxBreakOnWarning->setText(GdbOptionsPage::tr("Stop when qWarning() is called")); - checkBoxBreakOnWarning->setToolTip(GdbOptionsPage::tr( - "Always add a breakpoint on the qWarning() function." - "")); + checkBoxBreakOnWarning->setText(CommonOptionsPage::msgSetBreakpointAtFunction("qWarning")); + checkBoxBreakOnWarning->setToolTip(CommonOptionsPage::msgSetBreakpointAtFunctionToolTip("qWarning")); checkBoxBreakOnFatal = new QCheckBox(groupBoxGeneral); - checkBoxBreakOnFatal->setText(GdbOptionsPage::tr("Stop when qFatal() is called")); - checkBoxBreakOnFatal->setToolTip(GdbOptionsPage::tr( - "Always add a breakpoint on the qFatal() function." - "")); + checkBoxBreakOnFatal->setText(CommonOptionsPage::msgSetBreakpointAtFunction("qFatal")); + checkBoxBreakOnFatal->setToolTip(CommonOptionsPage::msgSetBreakpointAtFunctionToolTip("qFatal")); checkBoxBreakOnAbort = new QCheckBox(groupBoxGeneral); - checkBoxBreakOnAbort->setText(GdbOptionsPage::tr("Stop when abort() is called")); - checkBoxBreakOnAbort->setToolTip(GdbOptionsPage::tr( - "

Always add a breakpoint on the abort() function." - "

")); + checkBoxBreakOnAbort->setText(CommonOptionsPage::msgSetBreakpointAtFunction("abort")); + checkBoxBreakOnAbort->setText(CommonOptionsPage::msgSetBreakpointAtFunctionToolTip("abort")); checkBoxEnableReverseDebugging = new QCheckBox(groupBoxGeneral); checkBoxEnableReverseDebugging->setText(GdbOptionsPage::tr("Enable reverse debugging")); From e5e6cdd11ed65a1e63db94d35b73d904abf7a52a Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Tue, 28 Aug 2012 15:59:21 +0200 Subject: [PATCH 07/39] bump qt dependency to 4.8 Change-Id: I5aa424bacf9f66761d335f5b53734453ee864b80 Reviewed-by: Robert Loehning Reviewed-by: hjk --- qtcreator.pro | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/qtcreator.pro b/qtcreator.pro index 62799e8fd4b..d08345e3516 100644 --- a/qtcreator.pro +++ b/qtcreator.pro @@ -1,9 +1,9 @@ include(qtcreator.pri) #version check qt -!minQtVersion(4, 7, 4) { +!minQtVersion(4, 8, 0) { message("Cannot build Qt Creator with Qt version $${QT_VERSION}.") - error("Use at least Qt 4.7.4.") + error("Use at least Qt 4.8.0.") } include(doc/doc.pri) From 909f936a3256d597f4cd0126e17c7f1182a1a334 Mon Sep 17 00:00:00 2001 From: Andreas Holzammer Date: Wed, 29 Aug 2012 08:48:48 +0200 Subject: [PATCH 08/39] Add GCC Toolchain also to other platfroms then linux Change-Id: I89904d877d42904b9c37542ad3b51fe513542cfd Reviewed-by: Tobias Hunger --- src/plugins/projectexplorer/projectexplorer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/projectexplorer/projectexplorer.cpp b/src/plugins/projectexplorer/projectexplorer.cpp index 1ba854782b6..ced3977d806 100644 --- a/src/plugins/projectexplorer/projectexplorer.cpp +++ b/src/plugins/projectexplorer/projectexplorer.cpp @@ -330,12 +330,12 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er addAutoReleasedObject(new Internal::MsvcToolChainFactory); addAutoReleasedObject(new Internal::WinCEToolChainFactory); #else - addAutoReleasedObject(new Internal::GccToolChainFactory); addAutoReleasedObject(new Internal::LinuxIccToolChainFactory); #endif #ifndef Q_OS_MAC addAutoReleasedObject(new Internal::MingwToolChainFactory); // Mingw offers cross-compiling to windows #endif + addAutoReleasedObject(new Internal::GccToolChainFactory); addAutoReleasedObject(new Internal::ClangToolChainFactory); addAutoReleasedObject(new Internal::DesktopDeviceFactory); From 2ebce73d13dcdd5300384daf348a2ffd51f52b24 Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Tue, 28 Aug 2012 15:48:16 +0200 Subject: [PATCH 09/39] Madde: Add deploy step for starting Qemu. Until now, the code is duplicated in all deploy steps that need access to the device, which obviously doesn't scale. We now do it once in a dedicated step. Change-Id: I27f67f28a2e9ccaf9d2b3a5a9635d84b14f5eb07 Reviewed-by: Tobias Hunger --- src/plugins/madde/madde.pro | 6 +- src/plugins/madde/madde.qbs | 2 + src/plugins/madde/maddeqemustartstep.cpp | 128 ++++++++++++++++++ src/plugins/madde/maddeqemustartstep.h | 61 +++++++++ .../maddeuploadandinstallpackagesteps.cpp | 27 ---- src/plugins/madde/maemodeploybymountsteps.cpp | 25 +--- src/plugins/madde/maemodeploystepfactory.cpp | 28 ++-- .../madde/qt4maemodeployconfiguration.cpp | 16 ++- 8 files changed, 224 insertions(+), 69 deletions(-) create mode 100644 src/plugins/madde/maddeqemustartstep.cpp create mode 100644 src/plugins/madde/maddeqemustartstep.h diff --git a/src/plugins/madde/madde.pro b/src/plugins/madde/madde.pro index b72a2043393..73bf1efad46 100644 --- a/src/plugins/madde/madde.pro +++ b/src/plugins/madde/madde.pro @@ -49,7 +49,8 @@ HEADERS += \ maddedevicetester.h \ maddedeviceconfigurationfactory.h \ maddedevice.h \ - maemoapplicationrunnerhelperactions.h + maemoapplicationrunnerhelperactions.h \ + maddeqemustartstep.h SOURCES += \ maddeplugin.cpp \ @@ -92,7 +93,8 @@ SOURCES += \ maddedevicetester.cpp \ maemorunconfiguration.cpp \ maddedevice.cpp \ - maemoapplicationrunnerhelperactions.cpp + maemoapplicationrunnerhelperactions.cpp \ + maddeqemustartstep.cpp FORMS += \ maemopackagecreationwidget.ui \ diff --git a/src/plugins/madde/madde.qbs b/src/plugins/madde/madde.qbs index 9ed834d1dbf..260ca820504 100644 --- a/src/plugins/madde/madde.qbs +++ b/src/plugins/madde/madde.qbs @@ -30,6 +30,8 @@ QtcPlugin { "maddeplugin.h", "maddeuploadandinstallpackagesteps.cpp", "maddeuploadandinstallpackagesteps.h", + "maddeqemustartstep.cpp", + "maddeqemustartstep.h", "maemoconstants.h", "maemodeploybymountsteps.cpp", "maemodeploybymountsteps.h", diff --git a/src/plugins/madde/maddeqemustartstep.cpp b/src/plugins/madde/maddeqemustartstep.cpp new file mode 100644 index 00000000000..a2748712d5e --- /dev/null +++ b/src/plugins/madde/maddeqemustartstep.cpp @@ -0,0 +1,128 @@ +/************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: http://www.qt-project.org/ +** +** +** GNU Lesser General Public License Usage +** +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this file. +** Please review the following information to ensure the GNU Lesser General +** Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** Other Usage +** +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +**************************************************************************/ +#include "maddeqemustartstep.h" + +#include "maemoqemumanager.h" + +#include +#include +#include +#include + +using namespace ProjectExplorer; +using namespace RemoteLinux; + +namespace Madde { +namespace Internal { +class MaddeQemuStartService : public AbstractRemoteLinuxDeployService +{ + Q_OBJECT +public: + MaddeQemuStartService(QObject *parent = 0) : AbstractRemoteLinuxDeployService(parent) {} + +private: + bool isDeploymentNecessary() const { return true; } + + void doDeviceSetup() + { + emit progressMessage(tr("Checking whether to start Qemu...")); + if (deviceConfiguration()->machineType() == IDevice::Hardware) { + emit progressMessage(tr("Target device is not an emulator. Nothing to do.")); + handleDeviceSetupDone(true); + return; + } + + if (MaemoQemuManager::instance().qemuIsRunning()) { + emit progressMessage(tr("Qemu is already running. Nothing to do.")); + handleDeviceSetupDone(true); + return; + } + + MaemoQemuRuntime rt; + const int qtId = QtSupport::QtProfileInformation::qtVersionId(profile()); + if (MaemoQemuManager::instance().runtimeForQtVersion(qtId, &rt)) { + MaemoQemuManager::instance().startRuntime(); + emit errorMessage(tr("Cannot deploy: Qemu was not running. " + "It has now been started up for you, but it will take " + "a bit of time until it is ready. Please try again then.")); + } else { + emit errorMessage(tr("Cannot deploy: You want to deploy to Qemu, but it is not enabled " + "for this Qt version.")); + } + handleDeviceSetupDone(false); + } + + void stopDeviceSetup() { handleDeviceSetupDone(false); } + void doDeploy() { handleDeploymentDone(); } + void stopDeployment() { handleDeploymentDone(); } +}; + +MaddeQemuStartStep::MaddeQemuStartStep(BuildStepList *bsl) + : AbstractRemoteLinuxDeployStep(bsl, stepId()) +{ + ctor(); + setDefaultDisplayName(stepDisplayName()); +} + +MaddeQemuStartStep::MaddeQemuStartStep(BuildStepList *bsl, MaddeQemuStartStep *other) + : AbstractRemoteLinuxDeployStep(bsl, other) +{ + ctor(); +} + +AbstractRemoteLinuxDeployService *MaddeQemuStartStep::deployService() const +{ + return m_service; +} + +bool MaddeQemuStartStep::initInternal(QString *error) +{ + return deployService()->isDeploymentPossible(error); +} + +void MaddeQemuStartStep::ctor() +{ + m_service = new MaddeQemuStartService(this); +} + +Core::Id MaddeQemuStartStep::stepId() +{ + return Core::Id("Madde.MaddeQemuCheckStep"); +} + +QString MaddeQemuStartStep::stepDisplayName() +{ + return tr("Start Qemu, if necessary"); +} + +} // namespace Internal +} // namespace Madde + +#include "maddeqemustartstep.moc" diff --git a/src/plugins/madde/maddeqemustartstep.h b/src/plugins/madde/maddeqemustartstep.h new file mode 100644 index 00000000000..384faeddf84 --- /dev/null +++ b/src/plugins/madde/maddeqemustartstep.h @@ -0,0 +1,61 @@ +/************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: http://www.qt-project.org/ +** +** +** GNU Lesser General Public License Usage +** +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this file. +** Please review the following information to ensure the GNU Lesser General +** Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** Other Usage +** +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +**************************************************************************/ +#ifndef MAEMOQEMUCHECKSTEP_H +#define MAEMOQEMUCHECKSTEP_H + +#include + +namespace Madde { +namespace Internal { +class MaddeQemuStartService; + +class MaddeQemuStartStep : public RemoteLinux::AbstractRemoteLinuxDeployStep +{ + Q_OBJECT +public: + MaddeQemuStartStep(ProjectExplorer::BuildStepList *bsl); + MaddeQemuStartStep(ProjectExplorer::BuildStepList *bsl, MaddeQemuStartStep *other); + + static Core::Id stepId(); + static QString stepDisplayName(); + +private: + void ctor(); + + RemoteLinux::AbstractRemoteLinuxDeployService *deployService() const; + bool initInternal(QString *error = 0); + + MaddeQemuStartService *m_service; +}; + +} // namespace Internal +} // namespace Madde + +#endif // MAEMOQEMUCHECKSTEP_H diff --git a/src/plugins/madde/maddeuploadandinstallpackagesteps.cpp b/src/plugins/madde/maddeuploadandinstallpackagesteps.cpp index 6818171b449..9a5c918f45a 100644 --- a/src/plugins/madde/maddeuploadandinstallpackagesteps.cpp +++ b/src/plugins/madde/maddeuploadandinstallpackagesteps.cpp @@ -35,7 +35,6 @@ #include "maemoqemumanager.h" #include -#include #include #include #include @@ -57,32 +56,6 @@ protected: { } - void doDeviceSetup() - { - if (deviceConfiguration()->machineType() == IDevice::Hardware) { - handleDeviceSetupDone(true); - return; - } - - if (MaemoQemuManager::instance().qemuIsRunning()) { - handleDeviceSetupDone(true); - return; - } - - MaemoQemuRuntime rt; - const int qtId = QtSupport::QtProfileInformation::qtVersionId(profile()); - if (MaemoQemuManager::instance().runtimeForQtVersion(qtId, &rt)) { - MaemoQemuManager::instance().startRuntime(); - emit errorMessage(tr("Cannot deploy: Qemu was not running. " - "It has now been started up for you, but it will take " - "a bit of time until it is ready. Please try again then.")); - } else { - emit errorMessage(tr("Cannot deploy: You want to deploy to Qemu, but it is not enabled " - "for this Qt version.")); - } - handleDeviceSetupDone(false); - } - private: QString uploadDir() const { diff --git a/src/plugins/madde/maemodeploybymountsteps.cpp b/src/plugins/madde/maemodeploybymountsteps.cpp index 0503b9d72ef..88806ca38ca 100644 --- a/src/plugins/madde/maemodeploybymountsteps.cpp +++ b/src/plugins/madde/maemodeploybymountsteps.cpp @@ -40,8 +40,6 @@ #include #include #include -#include -#include #include #include #include @@ -156,28 +154,7 @@ void AbstractMaemoDeployByMountService::doDeviceSetup() { QTC_ASSERT(m_state == Inactive, return); - if (deviceConfiguration()->machineType() == IDevice::Hardware) { - handleDeviceSetupDone(true); - return; - } - - if (MaemoQemuManager::instance().qemuIsRunning()) { - handleDeviceSetupDone(true); - return; - } - - MaemoQemuRuntime rt; - const int qtId = QtSupport::QtProfileInformation::qtVersionId(profile()); - if (MaemoQemuManager::instance().runtimeForQtVersion(qtId, &rt)) { - MaemoQemuManager::instance().startRuntime(); - emit errorMessage(tr("Cannot deploy: Qemu was not running. " - "It has now been started up for you, but it will take " - "a bit of time until it is ready. Please try again then.")); - } else { - emit errorMessage(tr("Cannot deploy: You want to deploy to Qemu, but it is not enabled " - "for this Qt version.")); - } - handleDeviceSetupDone(false); + handleDeviceSetupDone(true); } void AbstractMaemoDeployByMountService::stopDeviceSetup() diff --git a/src/plugins/madde/maemodeploystepfactory.cpp b/src/plugins/madde/maemodeploystepfactory.cpp index b1ea5655e47..475bd7b8f19 100644 --- a/src/plugins/madde/maemodeploystepfactory.cpp +++ b/src/plugins/madde/maemodeploystepfactory.cpp @@ -31,6 +31,7 @@ #include "maemodeploystepfactory.h" #include "maemoconstants.h" +#include "maddeqemustartstep.h" #include "maddeuploadandinstallpackagesteps.h" #include "maemodeploybymountsteps.h" #include "maemoinstalltosysrootstep.h" @@ -73,16 +74,18 @@ QList MaemoDeployStepFactory::availableCreationIds(BuildStepList *pare platform = version->platformName(); if (platform == QtSupport::Constants::MAEMO_FREMANTLE_PLATFORM) { - ids << Core::Id(MaemoMakeInstallToSysrootStep::Id) - << Core::Id(MaemoInstallDebianPackageToSysrootStep::Id) - << Core::Id(MaemoUploadAndInstallPackageStep::stepId()) - << Core::Id(MaemoInstallPackageViaMountStep::stepId()) - << Core::Id(MaemoCopyFilesViaMountStep::stepId()); + ids << MaemoMakeInstallToSysrootStep::Id + << MaemoInstallDebianPackageToSysrootStep::Id + << MaemoUploadAndInstallPackageStep::stepId() + << MaemoInstallPackageViaMountStep::stepId() + << MaemoCopyFilesViaMountStep::stepId() + << MaddeQemuStartStep::stepId(); } else if (platform == QtSupport::Constants::MEEGO_HARMATTAN_PLATFORM) { - ids << Core::Id(MaemoMakeInstallToSysrootStep::Id) - << Core::Id(MaemoInstallDebianPackageToSysrootStep::Id) - << Core::Id(MaemoUploadAndInstallPackageStep::stepId()) - << Core::Id(GenericDirectUploadStep::stepId()); + ids << MaemoMakeInstallToSysrootStep::Id + << MaemoInstallDebianPackageToSysrootStep::Id + << MaemoUploadAndInstallPackageStep::stepId() + << GenericDirectUploadStep::stepId() + << MaddeQemuStartStep::stepId(); } return ids; @@ -106,6 +109,8 @@ QString MaemoDeployStepFactory::displayNameForId(const Core::Id id) const return GenericDirectUploadStep::displayName(); if (id == RemoteLinuxCheckForFreeDiskSpaceStep::stepId()) return RemoteLinuxCheckForFreeDiskSpaceStep::stepDisplayName(); + if (id == MaddeQemuStartStep::stepId()) + return MaddeQemuStartStep::stepDisplayName(); return QString(); } @@ -136,7 +141,8 @@ BuildStep *MaemoDeployStepFactory::create(BuildStepList *parent, const Core::Id return new GenericDirectUploadStep(parent, id); if (id == RemoteLinuxCheckForFreeDiskSpaceStep::stepId()) return new RemoteLinuxCheckForFreeDiskSpaceStep(parent); - + if (id == MaddeQemuStartStep::stepId()) + return new MaddeQemuStartStep(parent); return 0; } @@ -187,6 +193,8 @@ BuildStep *MaemoDeployStepFactory::clone(BuildStepList *parent, BuildStep *produ qobject_cast(product)); } else if (RemoteLinuxCheckForFreeDiskSpaceStep * const other = qobject_cast(product)) { return new RemoteLinuxCheckForFreeDiskSpaceStep(parent, other); + } else if (MaddeQemuStartStep * const other = qobject_cast(product)) { + return new MaddeQemuStartStep(parent, other); } return 0; diff --git a/src/plugins/madde/qt4maemodeployconfiguration.cpp b/src/plugins/madde/qt4maemodeployconfiguration.cpp index afe60a1fbda..667f110a60f 100644 --- a/src/plugins/madde/qt4maemodeployconfiguration.cpp +++ b/src/plugins/madde/qt4maemodeployconfiguration.cpp @@ -30,6 +30,7 @@ #include "qt4maemodeployconfiguration.h" #include "debianmanager.h" +#include "maddeqemustartstep.h" #include "maddeuploadandinstallpackagesteps.h" #include "maemoconstants.h" #include "maemodeploybymountsteps.h" @@ -304,18 +305,21 @@ DeployConfiguration *Qt4MaemoDeployConfigurationFactory::create(Target *parent, if (id == Qt4MaemoDeployConfiguration::fremantleWithoutPackagingId()) { dc->stepList()->insertStep(0, new MaemoMakeInstallToSysrootStep(dc->stepList())); - dc->stepList()->insertStep(1, new RemoteLinuxCheckForFreeDiskSpaceStep(dc->stepList())); - dc->stepList()->insertStep(2, new MaemoCopyFilesViaMountStep(dc->stepList())); + dc->stepList()->insertStep(1, new MaddeQemuStartStep(dc->stepList())); + dc->stepList()->insertStep(2, new RemoteLinuxCheckForFreeDiskSpaceStep(dc->stepList())); + dc->stepList()->insertStep(3, new MaemoCopyFilesViaMountStep(dc->stepList())); } else if (id == Qt4MaemoDeployConfiguration::fremantleWithPackagingId()) { dc->stepList()->insertStep(0, new MaemoDebianPackageCreationStep(dc->stepList())); dc->stepList()->insertStep(1, new MaemoInstallDebianPackageToSysrootStep(dc->stepList())); - dc->stepList()->insertStep(2, new RemoteLinuxCheckForFreeDiskSpaceStep(dc->stepList())); - dc->stepList()->insertStep(3, new MaemoInstallPackageViaMountStep(dc->stepList())); + dc->stepList()->insertStep(2, new MaddeQemuStartStep(dc->stepList())); + dc->stepList()->insertStep(3, new RemoteLinuxCheckForFreeDiskSpaceStep(dc->stepList())); + dc->stepList()->insertStep(4, new MaemoInstallPackageViaMountStep(dc->stepList())); } else if (id == Qt4MaemoDeployConfiguration::harmattanId()) { dc->stepList()->insertStep(0, new MaemoDebianPackageCreationStep(dc->stepList())); dc->stepList()->insertStep(1, new MaemoInstallDebianPackageToSysrootStep(dc->stepList())); - dc->stepList()->insertStep(2, new RemoteLinuxCheckForFreeDiskSpaceStep(dc->stepList())); - dc->stepList()->insertStep(3, new MaemoUploadAndInstallPackageStep(dc->stepList())); + dc->stepList()->insertStep(2, new MaddeQemuStartStep(dc->stepList())); + dc->stepList()->insertStep(3, new RemoteLinuxCheckForFreeDiskSpaceStep(dc->stepList())); + dc->stepList()->insertStep(4, new MaemoUploadAndInstallPackageStep(dc->stepList())); } return dc; } From f47a916c537ecad6cea5c304d104d5e29830aa05 Mon Sep 17 00:00:00 2001 From: Tobias Hunger Date: Fri, 24 Aug 2012 14:11:06 +0200 Subject: [PATCH 10/39] Save settings on mode changes This partly addresses QTCREATORBUG-7754: Settings are lost way less often this way. We do not really want to save whenever settings might have been touched, so this seems like a good compromise to me. Most modes at least have some view specific settings that need saving, so lets just save everything on each mode change. Settings are only written to disk if they really changed nowadays, so this should be fine. Task-number: QTCREATORBUG-7754 Change-Id: I26ae18cae38754da6c79a8b870ffae2e681db7c1 Reviewed-by: Daniel Teske --- src/plugins/coreplugin/modemanager.cpp | 15 ++++++++++++++- src/plugins/coreplugin/modemanager.h | 2 ++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/plugins/coreplugin/modemanager.cpp b/src/plugins/coreplugin/modemanager.cpp index 7a8015a96f0..3aa21373145 100644 --- a/src/plugins/coreplugin/modemanager.cpp +++ b/src/plugins/coreplugin/modemanager.cpp @@ -78,6 +78,7 @@ struct ModeManagerPrivate QSignalMapper *m_signalMapper; Context m_addedContexts; int m_oldCurrent; + bool m_saveSettingsOnModeChange; }; static ModeManagerPrivate *d; @@ -104,10 +105,13 @@ ModeManager::ModeManager(Internal::MainWindow *mainWindow, d->m_oldCurrent = -1; d->m_actionBar = new Internal::FancyActionBar(modeStack); d->m_modeStack->addCornerWidget(d->m_actionBar); + d->m_saveSettingsOnModeChange = false; connect(d->m_modeStack, SIGNAL(currentAboutToShow(int)), SLOT(currentTabAboutToChange(int))); connect(d->m_modeStack, SIGNAL(currentChanged(int)), SLOT(currentTabChanged(int))); connect(d->m_signalMapper, SIGNAL(mapped(int)), this, SLOT(slotActivateMode(int))); + connect(ExtensionSystem::PluginManager::instance(), SIGNAL(initializationDone()), this, SLOT(handleStartup())); + connect(ICore::instance(), SIGNAL(coreAboutToClose()), this, SLOT(handleShutdown())); } void ModeManager::init() @@ -252,6 +256,12 @@ void ModeManager::enabledStateChanged() } } +void ModeManager::handleStartup() +{ d->m_saveSettingsOnModeChange = true; } + +void ModeManager::handleShutdown() +{ d->m_saveSettingsOnModeChange = false; } + void ModeManager::aboutToRemoveObject(QObject *obj) { IMode *mode = Aggregation::query(obj); @@ -290,8 +300,11 @@ void ModeManager::currentTabAboutToChange(int index) { if (index >= 0) { IMode *mode = d->m_modes.at(index); - if (mode) + if (mode) { + if (d->m_saveSettingsOnModeChange) + ICore::saveSettings(); emit currentModeAboutToChange(mode); + } } } diff --git a/src/plugins/coreplugin/modemanager.h b/src/plugins/coreplugin/modemanager.h index cdf26b84ae2..d1fc497d9ea 100644 --- a/src/plugins/coreplugin/modemanager.h +++ b/src/plugins/coreplugin/modemanager.h @@ -85,6 +85,8 @@ private slots: void currentTabChanged(int index); void updateModeToolTip(); void enabledStateChanged(); + void handleStartup(); + void handleShutdown(); }; } // namespace Core From 33f8a42503e45ba1cd22a6b9adb4a7020cfe0b9d Mon Sep 17 00:00:00 2001 From: David Schulz Date: Mon, 27 Aug 2012 10:42:42 +0200 Subject: [PATCH 11/39] Editor: rename "Static" in Font & Colors settings to more clearer "Enumeration" Change-Id: I785edb6d31a4cd6a0875549f80bcf791ad61587a Reviewed-by: Orgad Shaneh Reviewed-by: Leandro Melo --- src/plugins/cppeditor/cppeditor.cpp | 4 ++-- src/plugins/cpptools/cppchecksymbols.cpp | 4 ++-- src/plugins/cpptools/cppsemanticinfo.h | 2 +- src/plugins/texteditor/texteditorconstants.cpp | 4 +++- src/plugins/texteditor/texteditorconstants.h | 2 +- src/plugins/texteditor/texteditorsettings.cpp | 2 +- 6 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/plugins/cppeditor/cppeditor.cpp b/src/plugins/cppeditor/cppeditor.cpp index 13eb6dcde77..85ef02020fb 100644 --- a/src/plugins/cppeditor/cppeditor.cpp +++ b/src/plugins/cppeditor/cppeditor.cpp @@ -1765,8 +1765,8 @@ void CPPEditorWidget::setFontSettings(const TextEditor::FontSettings &fs) fs.toTextCharFormat(TextEditor::C_LOCAL); m_semanticHighlightFormatMap[SemanticInfo::FieldUse] = fs.toTextCharFormat(TextEditor::C_FIELD); - m_semanticHighlightFormatMap[SemanticInfo::StaticUse] = - fs.toTextCharFormat(TextEditor::C_STATIC); + m_semanticHighlightFormatMap[SemanticInfo::EnumerationUse] = + fs.toTextCharFormat(TextEditor::C_ENUMERATION); m_semanticHighlightFormatMap[SemanticInfo::VirtualMethodUse] = fs.toTextCharFormat(TextEditor::C_VIRTUAL_METHOD); m_semanticHighlightFormatMap[SemanticInfo::LabelUse] = diff --git a/src/plugins/cpptools/cppchecksymbols.cpp b/src/plugins/cpptools/cppchecksymbols.cpp index ab8efe5abfd..c24acc2f0e4 100644 --- a/src/plugins/cpptools/cppchecksymbols.cpp +++ b/src/plugins/cpptools/cppchecksymbols.cpp @@ -485,7 +485,7 @@ bool CheckSymbols::visit(UsingDirectiveAST *) bool CheckSymbols::visit(EnumeratorAST *ast) { - addUse(ast->identifier_token, SemanticInfo::StaticUse); + addUse(ast->identifier_token, SemanticInfo::EnumerationUse); return true; } @@ -1163,7 +1163,7 @@ bool CheckSymbols::maybeAddTypeOrStatic(const QList &candidates, Nam UseKind kind = SemanticInfo::TypeUse; if (c->enclosingEnum() != 0) - kind = SemanticInfo::StaticUse; + kind = SemanticInfo::EnumerationUse; const Use use(line, column, length, kind); addUse(use); diff --git a/src/plugins/cpptools/cppsemanticinfo.h b/src/plugins/cpptools/cppsemanticinfo.h index f87feb334d1..5502a51b213 100644 --- a/src/plugins/cpptools/cppsemanticinfo.h +++ b/src/plugins/cpptools/cppsemanticinfo.h @@ -48,7 +48,7 @@ public: TypeUse, LocalUse, FieldUse, - StaticUse, + EnumerationUse, VirtualMethodUse, LabelUse, MacroUse, diff --git a/src/plugins/texteditor/texteditorconstants.cpp b/src/plugins/texteditor/texteditorconstants.cpp index 0cb6300e6c8..22ed20b8f11 100644 --- a/src/plugins/texteditor/texteditorconstants.cpp +++ b/src/plugins/texteditor/texteditorconstants.cpp @@ -57,7 +57,9 @@ const char *nameForStyle(TextStyle style) case C_TYPE: return "Type"; case C_LOCAL: return "Local"; case C_FIELD: return "Field"; - case C_STATIC: return "Static"; + // TODO: Rename "Static" to "Enumeration" in next major update, + // because renaming here would break styles defined by the user. + case C_ENUMERATION: return "Static"; case C_VIRTUAL_METHOD: return "VirtualMethod"; case C_FUNCTION: return "Function"; case C_KEYWORD: return "Keyword"; diff --git a/src/plugins/texteditor/texteditorconstants.h b/src/plugins/texteditor/texteditorconstants.h index e11e0a442db..c5956be707a 100644 --- a/src/plugins/texteditor/texteditorconstants.h +++ b/src/plugins/texteditor/texteditorconstants.h @@ -56,7 +56,7 @@ enum TextStyle { C_TYPE, C_LOCAL, C_FIELD, - C_STATIC, + C_ENUMERATION, C_VIRTUAL_METHOD, C_FUNCTION, C_KEYWORD, diff --git a/src/plugins/texteditor/texteditorsettings.cpp b/src/plugins/texteditor/texteditorsettings.cpp index 5114e6e06f2..3c4ed91adc0 100644 --- a/src/plugins/texteditor/texteditorsettings.cpp +++ b/src/plugins/texteditor/texteditorsettings.cpp @@ -139,7 +139,7 @@ TextEditorSettings::TextEditorSettings(QObject *parent) formatDescriptions.append(FormatDescription(C_TYPE, tr("Type"), Qt::darkMagenta)); formatDescriptions.append(FormatDescription(C_LOCAL, tr("Local"))); formatDescriptions.append(FormatDescription(C_FIELD, tr("Field"), Qt::darkRed)); - formatDescriptions.append(FormatDescription(C_STATIC, tr("Static"), Qt::darkMagenta)); + formatDescriptions.append(FormatDescription(C_ENUMERATION, tr("Enumeration"), Qt::darkMagenta)); Format functionFormat; formatDescriptions.append(FormatDescription(C_FUNCTION, tr("Function"), functionFormat)); From 8ceff27cc6fe6787a2f004000df131a0093c0e83 Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Wed, 29 Aug 2012 11:43:34 +0200 Subject: [PATCH 12/39] QmlProfiler: Build only if Qt Quick (version 1) is there The QmlProfiler depends on QML. Change-Id: Iee2ed66540ed2aee7d667850852b5ea7815a17fa Reviewed-by: Christiaan Janssen --- src/plugins/plugins.pro | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/plugins.pro b/src/plugins/plugins.pro index 6d36a723b21..0047aa67f72 100644 --- a/src/plugins/plugins.pro +++ b/src/plugins/plugins.pro @@ -40,7 +40,6 @@ SUBDIRS = plugin_coreplugin \ plugin_qmljstools \ plugin_macros \ debugger/dumper.pro \ - plugin_qmlprofiler \ plugin_remotelinux \ plugin_android \ plugin_madde \ @@ -63,7 +62,8 @@ include(../../qtcreator.pri) contains(QT_CONFIG, declarative)|contains(QT_CONFIG, quick1) { SUBDIRS += \ - plugin_qmlprojectmanager + plugin_qmlprojectmanager \ + plugin_qmlprofiler include(../private_headers.pri) exists($${QT_PRIVATE_HEADERS}/QtDeclarative/private/qdeclarativecontext_p.h) { From d6dee160607cfe2abf680f1c88b37e42feb22a66 Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Wed, 29 Aug 2012 11:51:35 +0200 Subject: [PATCH 13/39] Plugins: Update Qt version checks Remove the warning for Qt 4.7.0: The minimum version for Qt Creator is now Qt 4.7.4. Instead, warn users that the QmlX plugins won't be compiled if QtDeclarative or QtQuick1 is missing. (QtQuick1 isn't compiled by default on Qt 5). Change-Id: Ib9713282ad3759045a6eb994da1a12aac5176910 Reviewed-by: Thomas Hartmann --- src/plugins/plugins.pro | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/plugins/plugins.pro b/src/plugins/plugins.pro index 0047aa67f72..3268421e309 100644 --- a/src/plugins/plugins.pro +++ b/src/plugins/plugins.pro @@ -67,20 +67,14 @@ contains(QT_CONFIG, declarative)|contains(QT_CONFIG, quick1) { include(../private_headers.pri) exists($${QT_PRIVATE_HEADERS}/QtDeclarative/private/qdeclarativecontext_p.h) { - - minQtVersion(4, 7, 1) { SUBDIRS += plugin_qmldesigner - } else { - warning() - warning("QmlDesigner plugin has been disabled.") - warning("QmlDesigner requires Qt 4.7.1 or later.") - } } else { - warning() warning("QmlDesigner plugin has been disabled.") warning("The plugin depends on private headers from QtDeclarative module.") warning("To enable it, pass 'QT_PRIVATE_HEADERS=$QTDIR/include' to qmake, where $QTDIR is the source directory of qt.") } +} else { + warning("QmlProjectManager, QmlProfiler and QmlDesigner plugins have been disabled: The plugins require QtDeclarative (Qt 4.x) or QtQuick1 (Qt 5.x)"); } include (debugger/lldb/guest/qtcreator-lldb.pri) From 47249020bb573d651605d5075429aeebb7a2a169 Mon Sep 17 00:00:00 2001 From: hjk Date: Mon, 27 Aug 2012 16:23:49 +0200 Subject: [PATCH 14/39] historycompleter: fix user experience Make it actually remember things and allow completion if lineedit is not empty. Change-Id: Iccec6de94a8a304773dbb679e06fc68e2e496376 Reviewed-by: Orgad Shaneh Reviewed-by: hjk --- src/libs/utils/historycompleter.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/libs/utils/historycompleter.cpp b/src/libs/utils/historycompleter.cpp index c79a52ecb7d..1e0356c86ef 100644 --- a/src/libs/utils/historycompleter.cpp +++ b/src/libs/utils/historycompleter.cpp @@ -50,7 +50,7 @@ static QSettings *theSettings = 0; class HistoryCompleterPrivate : public QAbstractListModel { public: - HistoryCompleterPrivate() : maxLines(30) {} + HistoryCompleterPrivate() : maxLines(30), lineEdit(0) {} int rowCount(const QModelIndex &parent = QModelIndex()) const; QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; @@ -62,6 +62,7 @@ public: QStringList list; QString historyKey; int maxLines; + QLineEdit *lineEdit; }; class HistoryLineDelegate : public QItemDelegate @@ -166,12 +167,15 @@ HistoryCompleter::HistoryCompleter(QLineEdit *lineEdit, const QString &historyKe d->historyKey = QLatin1String("CompleterHistory/") + historyKey; d->list = theSettings->value(d->historyKey).toStringList(); + d->lineEdit = lineEdit; if (d->list.count()) lineEdit->setText(d->list.at(0)); setModel(d); setPopup(new HistoryLineView(d)); lineEdit->installEventFilter(this); + + connect(lineEdit, SIGNAL(editingFinished()), this, SLOT(saveHistory())); } HistoryCompleter::~HistoryCompleter() @@ -181,9 +185,9 @@ HistoryCompleter::~HistoryCompleter() bool HistoryCompleter::eventFilter(QObject *obj, QEvent *event) { - if (event->type() == QEvent::KeyPress && - static_cast(event)->key() == Qt::Key_Down && - static_cast(widget())->text().isEmpty()) { + if (event->type() == QEvent::KeyPress + && static_cast(event)->key() == Qt::Key_Down + && !popup()->isVisible()) { setCompletionPrefix(QString()); complete(); } @@ -212,7 +216,7 @@ void HistoryCompleter::clearHistory() void HistoryCompleter::saveHistory() { - d->saveEntry(completionPrefix()); + d->saveEntry(d->lineEdit->text()); } void HistoryCompleter::setSettings(QSettings *settings) From aa178ebf31e7ab69e767f435dc414a106c0b74f2 Mon Sep 17 00:00:00 2001 From: hjk Date: Tue, 28 Aug 2012 11:33:49 +0200 Subject: [PATCH 15/39] debugger: Shorten "Debugger command:" to "Debugger:" Sticks out in the target setup page otherwise. Change-Id: I2b9e657dc05ff41e6e511e7bdd1abf5f83800bca Reviewed-by: hjk --- src/plugins/debugger/debuggerprofileconfigwidget.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/debugger/debuggerprofileconfigwidget.cpp b/src/plugins/debugger/debuggerprofileconfigwidget.cpp index cc8fa70ee42..81789acfb11 100644 --- a/src/plugins/debugger/debuggerprofileconfigwidget.cpp +++ b/src/plugins/debugger/debuggerprofileconfigwidget.cpp @@ -106,7 +106,7 @@ DebuggerProfileConfigWidget::DebuggerProfileConfigWidget(ProjectExplorer::Profil QString DebuggerProfileConfigWidget::displayName() const { - return tr("Debugger command:"); + return tr("Debugger:"); } void DebuggerProfileConfigWidget::makeReadOnly() From 8073ffdffd18db5085fbbaa189c1a1b5c1371130 Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Wed, 29 Aug 2012 13:09:46 +0200 Subject: [PATCH 16/39] Madde: Fix some bugs introduced by profiles patch. - Correctly read the packaging icon. - Inform of packaging file changes in all cases, not on initial setup. - Emit signals from debian manager with the right argument. Change-Id: Id44828b6e581e639acd491923cff8114cb57f6c6 Reviewed-by: Tobias Hunger --- src/plugins/madde/debianmanager.cpp | 7 ++++--- .../madde/qt4maemodeployconfiguration.cpp | 17 +++++++++-------- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/src/plugins/madde/debianmanager.cpp b/src/plugins/madde/debianmanager.cpp index cffc444c970..d3273589acf 100644 --- a/src/plugins/madde/debianmanager.cpp +++ b/src/plugins/madde/debianmanager.cpp @@ -507,7 +507,8 @@ bool DebianManager::setPackageManagerName(const Utils::FileName &debianDir, Core QIcon DebianManager::packageManagerIcon(const Utils::FileName &debianDir, QString *error) { - const QByteArray &base64Icon = controlFileFieldValue(debianDir, IconFieldName, true); + const QByteArray &base64Icon + = controlFileFieldValue(controlFilePath(debianDir), IconFieldName, true); if (base64Icon.isEmpty()) return QIcon(); QPixmap pixmap; @@ -695,7 +696,7 @@ void DebianManager::controlWasChanged() WatchableFile *file = qobject_cast(sender()); if (!file) return; - emit controlChanged(Utils::FileName::fromString(file->fileName())); + emit controlChanged(Utils::FileName::fromString(file->fileName()).parentDir()); } void DebianManager::changelogWasChanged() @@ -703,7 +704,7 @@ void DebianManager::changelogWasChanged() WatchableFile *file = qobject_cast(sender()); if (!file) return; - emit changelogChanged(Utils::FileName::fromString(file->fileName())); + emit changelogChanged(Utils::FileName::fromString(file->fileName()).parentDir()); } Utils::FileName DebianManager::changelogFilePath(const Utils::FileName &debianDir) diff --git a/src/plugins/madde/qt4maemodeployconfiguration.cpp b/src/plugins/madde/qt4maemodeployconfiguration.cpp index 667f110a60f..7b03269a3c6 100644 --- a/src/plugins/madde/qt4maemodeployconfiguration.cpp +++ b/src/plugins/madde/qt4maemodeployconfiguration.cpp @@ -165,12 +165,18 @@ void Qt4MaemoDeployConfiguration::setupDebianPackaging() Utils::FileName debianDir = DebianManager::debianDirectory(target()); DebianManager::ActionStatus status = DebianManager::createTemplate(bc, debianDir); - if (status == DebianManager::NoActionRequired || - status == DebianManager::ActionFailed) + if (status == DebianManager::ActionFailed) + return; + + DebianManager * const dm = DebianManager::instance(); + dm->monitor(debianDir); + connect(dm, SIGNAL(debianDirectoryChanged(Utils::FileName)), this, + SLOT(debianDirChanged(Utils::FileName))); + + if (status == DebianManager::NoActionRequired) return; Core::Id deviceType = ProjectExplorer::DeviceTypeProfileInformation::deviceTypeId(target()->profile()); - DebianManager *dm = DebianManager::instance(); QString projectName = target()->project()->displayName(); if (!DebianManager::hasPackageManagerIcon(debianDir)) { @@ -181,11 +187,6 @@ void Qt4MaemoDeployConfiguration::setupDebianPackaging() dm->setPackageManagerIcon(debianDir, deviceType, iconPath); } - - - dm->monitor(debianDir); - connect(dm, SIGNAL(debianDirectoryChanged(Utils::FileName)), this, SLOT(debianDirChanged(Utils::FileName))); - // Set up aegis manifest on harmattan: if (deviceType == HarmattanOsType) { Utils::FileName manifest = debianDir; From 966c82d212117a59487ff0e934065f290287c0dc Mon Sep 17 00:00:00 2001 From: Daniel Teske Date: Wed, 29 Aug 2012 15:31:04 +0200 Subject: [PATCH 17/39] Give Import widget a parent Task-number: QTCREATORBUG-7652 Change-Id: I0751a494f97ff77c7dc52e81c789b0f0111633c5 Reviewed-by: Robert Loehning --- src/plugins/qt4projectmanager/wizards/targetsetuppage.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/qt4projectmanager/wizards/targetsetuppage.cpp b/src/plugins/qt4projectmanager/wizards/targetsetuppage.cpp index 5c187f0c2bb..ff26061205e 100644 --- a/src/plugins/qt4projectmanager/wizards/targetsetuppage.cpp +++ b/src/plugins/qt4projectmanager/wizards/targetsetuppage.cpp @@ -65,7 +65,7 @@ TargetSetupPage::TargetSetupPage(QWidget *parent) : m_ignoreUpdates(false), m_firstWidget(0), m_ui(new Internal::Ui::TargetSetupPage), - m_importWidget(new Internal::ImportWidget), + m_importWidget(new Internal::ImportWidget(this)), m_spacer(new QSpacerItem(0,0, QSizePolicy::Minimum, QSizePolicy::MinimumExpanding)) { setObjectName(QLatin1String("TargetSetupPage")); From 813cd709fb777272ed4edb6784d77257a026d060 Mon Sep 17 00:00:00 2001 From: David Schulz Date: Mon, 27 Aug 2012 10:55:13 +0200 Subject: [PATCH 18/39] Editor: Tooltips for color scheme items in Fonts & collors settingspage Change-Id: Ia067e86a31a12301458a5d49e1096e7b2aa0f118 Reviewed-by: hjk --- src/plugins/texteditor/colorschemeedit.cpp | 3 + src/plugins/texteditor/fontsettingspage.cpp | 20 ++- src/plugins/texteditor/fontsettingspage.h | 8 +- src/plugins/texteditor/texteditorsettings.cpp | 161 +++++++++++++----- 4 files changed, 134 insertions(+), 58 deletions(-) diff --git a/src/plugins/texteditor/colorschemeedit.cpp b/src/plugins/texteditor/colorschemeedit.cpp index 7877db87ef1..c03b58f95e8 100644 --- a/src/plugins/texteditor/colorschemeedit.cpp +++ b/src/plugins/texteditor/colorschemeedit.cpp @@ -115,6 +115,9 @@ public: font.setItalic(m_scheme->formatFor(description.id()).italic()); return font; } + case Qt::ToolTipRole: { + return description.tooltipText(); + } } return QVariant(); } diff --git a/src/plugins/texteditor/fontsettingspage.cpp b/src/plugins/texteditor/fontsettingspage.cpp index 2f7da138190..d3ae74d931e 100644 --- a/src/plugins/texteditor/fontsettingspage.cpp +++ b/src/plugins/texteditor/fontsettingspage.cpp @@ -228,17 +228,19 @@ FontSettingsPagePrivate::~FontSettingsPagePrivate() // ------- FormatDescription -FormatDescription::FormatDescription(TextStyle id, const QString &displayName, const QColor &color) : - m_id(id), - m_displayName(displayName) -{ - m_format.setForeground(color); -} - -FormatDescription::FormatDescription(TextStyle id, const QString &displayName, const Format &format) : +FormatDescription::FormatDescription(TextStyle id, const QString &displayName, const QString &tooltipText, const QColor &foreground) : m_id(id), m_displayName(displayName), - m_format(format) + m_tooltipText(tooltipText) +{ + m_format.setForeground(foreground); +} + +FormatDescription::FormatDescription(TextStyle id, const QString &displayName, const QString &tooltipText, const Format &format) : + m_id(id), + m_displayName(displayName), + m_format(format), + m_tooltipText(tooltipText) { } diff --git a/src/plugins/texteditor/fontsettingspage.h b/src/plugins/texteditor/fontsettingspage.h index 915d73d0d33..d6c3de92edb 100644 --- a/src/plugins/texteditor/fontsettingspage.h +++ b/src/plugins/texteditor/fontsettingspage.h @@ -56,9 +56,9 @@ class FontSettingsPagePrivate; class TEXTEDITOR_EXPORT FormatDescription { public: - FormatDescription(TextStyle id, const QString &displayName, + FormatDescription(TextStyle id, const QString &displayName, const QString &tooltipText, const QColor &foreground = Qt::black); - FormatDescription(TextStyle id, const QString &displayName, + FormatDescription(TextStyle id, const QString &displayName, const QString &tooltipText, const Format &format); TextStyle id() const { return m_id; } @@ -72,10 +72,14 @@ public: const Format &format() const { return m_format; } Format &format() { return m_format; } + QString tooltipText() const + { return m_tooltipText; } + private: TextStyle m_id; // Name of the category QString m_displayName; // Displayed name of the category Format m_format; // Default format + QString m_tooltipText; // Description text for category }; typedef QList FormatDescriptions; diff --git a/src/plugins/texteditor/texteditorsettings.cpp b/src/plugins/texteditor/texteditorsettings.cpp index 3c4ed91adc0..02afdf49068 100644 --- a/src/plugins/texteditor/texteditorsettings.cpp +++ b/src/plugins/texteditor/texteditorsettings.cpp @@ -112,84 +112,151 @@ TextEditorSettings::TextEditorSettings(QObject *parent) // Note: default background colors are coming from FormatDescription::background() // Add font preference page - FormatDescriptions formatDescriptions; - formatDescriptions.append(FormatDescription(C_TEXT, tr("Text"))); + FormatDescriptions formatDescr; + formatDescr.append(FormatDescription(C_TEXT, tr("Text"), tr("Generic text.\nApplied for " + "text, if no other " + "rules matching."))); // Special categories const QPalette p = QApplication::palette(); - formatDescriptions.append(FormatDescription(C_LINK, tr("Link"), Qt::blue)); - formatDescriptions.append(FormatDescription(C_SELECTION, tr("Selection"), p.color(QPalette::HighlightedText))); - formatDescriptions.append(FormatDescription(C_LINE_NUMBER, tr("Line Number"))); - formatDescriptions.append(FormatDescription(C_SEARCH_RESULT, tr("Search Result"))); - formatDescriptions.append(FormatDescription(C_SEARCH_SCOPE, tr("Search Scope"))); - formatDescriptions.append(FormatDescription(C_PARENTHESES, tr("Parentheses"))); - formatDescriptions.append(FormatDescription(C_CURRENT_LINE, tr("Current Line"))); + formatDescr.append(FormatDescription(C_LINK, tr("Link"), + tr("Links that follow symbol under cursor."), Qt::blue)); + formatDescr.append(FormatDescription(C_SELECTION, tr("Selection"), tr("Selected text."), + p.color(QPalette::HighlightedText))); + formatDescr.append(FormatDescription(C_LINE_NUMBER, tr("Line Number"), + tr("Line numbers located on the " + "left side of the editor."))); + formatDescr.append(FormatDescription(C_SEARCH_RESULT, tr("Search Result"), + tr("Highlighted search results inside the editor."))); + formatDescr.append(FormatDescription(C_SEARCH_SCOPE, tr("Search Scope"), + tr("Section where the pattern is searched in."))); + formatDescr.append(FormatDescription(C_PARENTHESES, tr("Parentheses"), + tr("Displayed when matching parantheses, square brackets " + "or curly brackets are found."))); + formatDescr.append(FormatDescription(C_CURRENT_LINE, tr("Current Line"), + tr("Line where the cursor is placed in."))); - FormatDescription currentLineNumber = FormatDescription(C_CURRENT_LINE_NUMBER, tr("Current Line Number"), Qt::darkGray); + FormatDescription currentLineNumber = + FormatDescription(C_CURRENT_LINE_NUMBER, tr("Current Line Number"), + tr("Line number located on the left side of the " + "editor where the cursor is placed in."), Qt::darkGray); currentLineNumber.format().setBold(true); - formatDescriptions.append(currentLineNumber); + formatDescr.append(currentLineNumber); - formatDescriptions.append(FormatDescription(C_OCCURRENCES, tr("Occurrences"))); - formatDescriptions.append(FormatDescription(C_OCCURRENCES_UNUSED, tr("Unused Occurrence"))); - formatDescriptions.append(FormatDescription(C_OCCURRENCES_RENAME, tr("Renaming Occurrence"))); + + formatDescr.append(FormatDescription(C_OCCURRENCES, tr("Occurrences"), + tr("Occurences of the symbol under the cursor.\n" + "(Only the backgroud will be applied.)"))); + formatDescr.append(FormatDescription(C_OCCURRENCES_UNUSED, tr("Unused Occurrence"), + tr("Occurences of unused variables."))); + formatDescr.append(FormatDescription(C_OCCURRENCES_RENAME, tr("Renaming Occurrence"), + tr("Occurences of a symbol that will be renamed."))); // Standard categories - formatDescriptions.append(FormatDescription(C_NUMBER, tr("Number"), Qt::darkBlue)); - formatDescriptions.append(FormatDescription(C_STRING, tr("String"), Qt::darkGreen)); - formatDescriptions.append(FormatDescription(C_TYPE, tr("Type"), Qt::darkMagenta)); - formatDescriptions.append(FormatDescription(C_LOCAL, tr("Local"))); - formatDescriptions.append(FormatDescription(C_FIELD, tr("Field"), Qt::darkRed)); - formatDescriptions.append(FormatDescription(C_ENUMERATION, tr("Enumeration"), Qt::darkMagenta)); + formatDescr.append(FormatDescription(C_NUMBER, tr("Number"), tr("Number literal."), + Qt::darkBlue)); + formatDescr.append(FormatDescription(C_STRING, tr("String"), + tr("Character and string literals."), Qt::darkGreen)); + formatDescr.append(FormatDescription(C_TYPE, tr("Type"), tr("Name of a type."), + Qt::darkMagenta)); + formatDescr.append(FormatDescription(C_LOCAL, tr("Local"), tr("Local variables."))); + formatDescr.append(FormatDescription(C_FIELD, tr("Field"), + tr("Class' data members."), Qt::darkRed)); + formatDescr.append(FormatDescription(C_ENUMERATION, tr("Enumeration"), + tr("Applied for Enumeration Items."), Qt::darkMagenta)); Format functionFormat; - formatDescriptions.append(FormatDescription(C_FUNCTION, tr("Function"), functionFormat)); + formatDescr.append(FormatDescription(C_FUNCTION, tr("Function"), tr("Name of a function."), + functionFormat)); functionFormat.setItalic(true); - formatDescriptions.append(FormatDescription(C_VIRTUAL_METHOD, tr("Virtual Method"), functionFormat)); + formatDescr.append(FormatDescription(C_VIRTUAL_METHOD, tr("Virtual Method"), + tr("Name of method declared as virtual."), + functionFormat)); - formatDescriptions.append(FormatDescription(C_BINDING, tr("QML Binding"), Qt::darkRed)); + formatDescr.append(FormatDescription(C_BINDING, tr("QML Binding"), + tr("QML item property, that allows a " + "binding to another property."), + Qt::darkRed)); Format qmlLocalNameFormat; qmlLocalNameFormat.setItalic(true); - formatDescriptions.append(FormatDescription(C_QML_LOCAL_ID, tr("QML Local Id"), qmlLocalNameFormat)); - formatDescriptions.append(FormatDescription(C_QML_ROOT_OBJECT_PROPERTY, tr("QML Root Object Property"), qmlLocalNameFormat)); - formatDescriptions.append(FormatDescription(C_QML_SCOPE_OBJECT_PROPERTY, tr("QML Scope Object Property"), qmlLocalNameFormat)); - formatDescriptions.append(FormatDescription(C_QML_STATE_NAME, tr("QML State Name"), qmlLocalNameFormat)); + formatDescr.append(FormatDescription(C_QML_LOCAL_ID, tr("QML Local Id"), + tr("QML item id within a QML file."), qmlLocalNameFormat)); + formatDescr.append(FormatDescription(C_QML_ROOT_OBJECT_PROPERTY, + tr("QML root Object Property"), + tr("QML property of a parent item."), qmlLocalNameFormat)); + formatDescr.append(FormatDescription(C_QML_SCOPE_OBJECT_PROPERTY, + tr("QML scope Object Property"), + tr("Property of the same QML item."), qmlLocalNameFormat)); + formatDescr.append(FormatDescription(C_QML_STATE_NAME, tr("QML State Name"), + tr("Name of a QML state."), qmlLocalNameFormat)); - formatDescriptions.append(FormatDescription(C_QML_TYPE_ID, tr("QML Type Name"), Qt::darkMagenta)); + formatDescr.append(FormatDescription(C_QML_TYPE_ID, tr("QML Type Name"), + tr("Name of a QML type."), Qt::darkMagenta)); Format qmlExternalNameFormat = qmlLocalNameFormat; qmlExternalNameFormat.setForeground(Qt::darkBlue); - formatDescriptions.append(FormatDescription(C_QML_EXTERNAL_ID, tr("QML External Id"), qmlExternalNameFormat)); - formatDescriptions.append(FormatDescription(C_QML_EXTERNAL_OBJECT_PROPERTY, tr("QML External Object Property"), qmlExternalNameFormat)); + formatDescr.append(FormatDescription(C_QML_EXTERNAL_ID, tr("QML External Id"), + tr("QML id defined in another QML file."), + qmlExternalNameFormat)); + formatDescr.append(FormatDescription(C_QML_EXTERNAL_OBJECT_PROPERTY, + tr("QML External Object Property"), + tr("QML property defined in another QML file."), + qmlExternalNameFormat)); Format jsLocalFormat; jsLocalFormat.setForeground(QColor(41, 133, 199)); // very light blue jsLocalFormat.setItalic(true); - formatDescriptions.append(FormatDescription(C_JS_SCOPE_VAR, tr("JavaScript Scope Var"), jsLocalFormat)); + formatDescr.append(FormatDescription(C_JS_SCOPE_VAR, tr("JavaScript Scope Var"), + tr("Variables defined inside the JavaScript file."), + jsLocalFormat)); Format jsGlobalFormat; jsGlobalFormat.setForeground(QColor(0, 85, 175)); // light blue jsGlobalFormat.setItalic(true); - formatDescriptions.append(FormatDescription(C_JS_IMPORT_VAR, tr("JavaScript Import"), jsGlobalFormat)); - formatDescriptions.append(FormatDescription(C_JS_GLOBAL_VAR, tr("JavaScript Global Variable"), jsGlobalFormat)); + formatDescr.append(FormatDescription(C_JS_IMPORT_VAR, tr("JavaScript Import"), + tr("Name of a JavaScript import inside a QML file."), + jsGlobalFormat)); + formatDescr.append(FormatDescription(C_JS_GLOBAL_VAR, tr("JavaScript Global Variable"), + tr("Variables defined outside the script."), + jsGlobalFormat)); - formatDescriptions.append(FormatDescription(C_KEYWORD, tr("Keyword"), Qt::darkYellow)); - formatDescriptions.append(FormatDescription(C_OPERATOR, tr("Operator"))); - formatDescriptions.append(FormatDescription(C_PREPROCESSOR, tr("Preprocessor"), Qt::darkBlue)); - formatDescriptions.append(FormatDescription(C_LABEL, tr("Label"), Qt::darkRed)); - formatDescriptions.append(FormatDescription(C_COMMENT, tr("Comment"), Qt::darkGreen)); - formatDescriptions.append(FormatDescription(C_DOXYGEN_COMMENT, tr("Doxygen Comment"), Qt::darkBlue)); - formatDescriptions.append(FormatDescription(C_DOXYGEN_TAG, tr("Doxygen Tag"), Qt::blue)); - formatDescriptions.append(FormatDescription(C_VISUAL_WHITESPACE, tr("Visual Whitespace"), Qt::lightGray)); - formatDescriptions.append(FormatDescription(C_DISABLED_CODE, tr("Disabled Code"))); + formatDescr.append(FormatDescription(C_KEYWORD, tr("Keyword"), + tr("Reserved keywords of the programming language."), + Qt::darkYellow)); + formatDescr.append(FormatDescription(C_OPERATOR, tr("Operator"), + tr("Operators. (for example operator++ operator-=)"))); + formatDescr.append(FormatDescription(C_PREPROCESSOR, tr("Preprocessor"), + tr("Preprocessor directives."), Qt::darkBlue)); + formatDescr.append(FormatDescription(C_LABEL, tr("Label"), tr("Labels for goto steatments."), + Qt::darkRed)); + formatDescr.append(FormatDescription(C_COMMENT, tr("Comment"), + tr("All style of comments except Doxygen comments."), + Qt::darkGreen)); + formatDescr.append(FormatDescription(C_DOXYGEN_COMMENT, tr("Doxygen Comment"), + tr("Doxygen comments."), Qt::darkBlue)); + formatDescr.append(FormatDescription(C_DOXYGEN_TAG, tr("Doxygen Tag"), tr("Doxygen tags"), + Qt::blue)); + formatDescr.append(FormatDescription(C_VISUAL_WHITESPACE, tr("Visual Whitespace"), + tr("Whitespace\nWill not be applied for whitespace " + "in comments and strings."), Qt::lightGray)); + formatDescr.append(FormatDescription(C_DISABLED_CODE, tr("Disabled Code"), + tr("Code disabled by preprocessor directives."))); // Diff categories - formatDescriptions.append(FormatDescription(C_ADDED_LINE, tr("Added Line"), QColor(0, 170, 0))); - formatDescriptions.append(FormatDescription(C_REMOVED_LINE, tr("Removed Line"), Qt::red)); - formatDescriptions.append(FormatDescription(C_DIFF_FILE, tr("Diff File"), Qt::darkBlue)); - formatDescriptions.append(FormatDescription(C_DIFF_LOCATION, tr("Diff Location"), Qt::blue)); + formatDescr.append(FormatDescription(C_ADDED_LINE, tr("Added Line"), + tr("Applied for added lines in differences " + "(in diff editor)."), QColor(0, 170, 0))); + formatDescr.append(FormatDescription(C_REMOVED_LINE, tr("Removed Line"), + tr("Applied for removed lines " + "in differences (in diff editor)."), Qt::red)); + formatDescr.append(FormatDescription(C_DIFF_FILE, tr("Diff File"), + tr("Compared files (in diff editor)."), Qt::darkBlue)); + formatDescr.append(FormatDescription(C_DIFF_LOCATION, tr("Diff Location"), + tr("Location in the files where the difference is " + "(in diff editor)."), Qt::blue)); - m_d->m_fontSettingsPage = new FontSettingsPage(formatDescriptions, + m_d->m_fontSettingsPage = new FontSettingsPage(formatDescr, QLatin1String(Constants::TEXT_EDITOR_FONT_SETTINGS), this); ExtensionSystem::PluginManager::addObject(m_d->m_fontSettingsPage); From d87835cc9003f43841cce88be499aaf88d431c68 Mon Sep 17 00:00:00 2001 From: Leandro Melo Date: Wed, 29 Aug 2012 13:21:22 +0200 Subject: [PATCH 19/39] C++: Always skip unknown preprocessor "directives" Task-number: QTCREATORBUG-7780 Change-Id: Ie93704feff17ad8229e50fb1133048f2c7598dea Reviewed-by: Orgad Shaneh Reviewed-by: hjk --- src/libs/cplusplus/pp-engine.cpp | 4 +-- .../preprocessor/tst_preprocessor.cpp | 26 +++++++++++++++++++ 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/src/libs/cplusplus/pp-engine.cpp b/src/libs/cplusplus/pp-engine.cpp index f71ba47c142..377e8c8e94e 100644 --- a/src/libs/cplusplus/pp-engine.cpp +++ b/src/libs/cplusplus/pp-engine.cpp @@ -1417,9 +1417,9 @@ void Preprocessor::handlePreprocessorDirective(PPToken *tk) handleElseDirective(tk, poundToken); else if (directive == ppElif) handleElifDirective(tk, poundToken); - - skipPreprocesorDirective(tk); } + + skipPreprocesorDirective(tk); } diff --git a/tests/auto/cplusplus/preprocessor/tst_preprocessor.cpp b/tests/auto/cplusplus/preprocessor/tst_preprocessor.cpp index 015fffc153a..d3777d1998a 100644 --- a/tests/auto/cplusplus/preprocessor/tst_preprocessor.cpp +++ b/tests/auto/cplusplus/preprocessor/tst_preprocessor.cpp @@ -338,6 +338,8 @@ private slots: void multitokens_argument_data(); void multiline_strings(); void multiline_strings_data(); + void skip_unknown_directives(); + void skip_unknown_directives_data(); }; // Remove all #... lines, and 'simplify' string, to allow easily comparing the result @@ -1394,6 +1396,30 @@ void tst_Preprocessor::multiline_strings_data() QTest::newRow("case 1") << original << expected; } +void tst_Preprocessor::skip_unknown_directives() +{ + compare_input_output(); +} + +void tst_Preprocessor::skip_unknown_directives_data() +{ + QTest::addColumn("input"); + QTest::addColumn("output"); + + QByteArray original; + QByteArray expected; + + // We should skip "weird" things when preprocessing. Particularly useful when we preprocess + // a particular expression from a document which has already been processed. + + original = "# foo\n" + "# 10 \"file.cpp\"\n" + "# ()\n" + "#\n"; + expected = "# 1 \"\"\n"; + QTest::newRow("case 1") << original << expected; +} + void tst_Preprocessor::compare_input_output(bool keepComments) { QFETCH(QByteArray, input); From bef43adb79ead22043b3aa3bbb24e337b6443843 Mon Sep 17 00:00:00 2001 From: hjk Date: Wed, 29 Aug 2012 13:00:12 +0200 Subject: [PATCH 20/39] debugger: fix manual test description for stack colouring Feature worked, test description was wrong. Task-number: QTCREATORBUG-7281 Change-Id: I81c93b66cb28e9d6adf15a49c086d5faaa908d0a Reviewed-by: hjk --- tests/manual/debugger/simple/simple_test_app.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/manual/debugger/simple/simple_test_app.cpp b/tests/manual/debugger/simple/simple_test_app.cpp index cba493f4447..e9466b9a747 100644 --- a/tests/manual/debugger/simple/simple_test_app.cpp +++ b/tests/manual/debugger/simple/simple_test_app.cpp @@ -4933,8 +4933,8 @@ namespace basic { // Check s "Foo" QString. // Continue. - // Select "Open Memory View" from Locals and Expressions - // context menu for item 'd'. + // Select "Open Memory Editor->Open Memory Editor Showing Stack Layout" + // from Locals and Expressions context menu. // Check that the opened memory view contains coloured items // for 'i', 'd', and 's'. dummyStatement(&i, &d, &s); From 57097a151dd2f77569faf585916d63805ac3bca4 Mon Sep 17 00:00:00 2001 From: Daniel Teske Date: Wed, 29 Aug 2012 17:52:36 +0200 Subject: [PATCH 21/39] Fix Ghost window on switching to debug mode for qml projects Change-Id: I0724a3c8d4add1821b97a4a068f94df1dbc4e512 Reviewed-by: Robert Loehning Reviewed-by: Aurindam Jana --- src/plugins/debugger/debuggermainwindow.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/debugger/debuggermainwindow.cpp b/src/plugins/debugger/debuggermainwindow.cpp index 450c6394a40..8e7bf33ee94 100644 --- a/src/plugins/debugger/debuggermainwindow.cpp +++ b/src/plugins/debugger/debuggermainwindow.cpp @@ -369,8 +369,8 @@ void DebuggerMainWindowPrivate::activateQmlCppLayout() Context qmlCppContext = m_contextsForLanguage.value(QmlLanguage); qmlCppContext.add(m_contextsForLanguage.value(CppLanguage)); if (m_toolBars.value(QmlLanguage)) { - m_toolBars.value(QmlLanguage)->show(); m_debugToolBarLayout->insertWidget(1, m_toolBars.value(QmlLanguage)); + m_toolBars.value(QmlLanguage)->show(); } if (m_previousDebugLanguages & QmlLanguage) { From 3518934e2404fc287d50d2c5b338b44ae8ea378c Mon Sep 17 00:00:00 2001 From: Orgad Shaneh Date: Wed, 29 Aug 2012 13:58:50 +0300 Subject: [PATCH 22/39] Dumper: Use Latin1 as default for char array Change-Id: Ia3e2fc737c4d40e9b8bce0fbb147fe3d8a523351 Reviewed-by: hjk --- share/qtcreator/dumper/dumper.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/share/qtcreator/dumper/dumper.py b/share/qtcreator/dumper/dumper.py index 4d4f747dd5f..782f9cd3d7e 100644 --- a/share/qtcreator/dumper/dumper.py +++ b/share/qtcreator/dumper/dumper.py @@ -1472,7 +1472,10 @@ class Dumper: self.putType(typeName) self.putNumChild(1) format = self.currentItemFormat() - if format == 0: + if format == None and str(targetType.unqualified()) == "char": + # Use Latin1 as default for char []. + self.putValue(encodeCharArray(value), Hex2EncodedLatin1) + elif format == 0: # Explicitly requested Latin1 formatting. self.putValue(encodeCharArray(value), Hex2EncodedLatin1) elif format == 1: From 2cf04cb248c6b061b5b0aac1f808fdbb72602de3 Mon Sep 17 00:00:00 2001 From: Ryan May Date: Tue, 28 Aug 2012 12:39:57 -0500 Subject: [PATCH 23/39] Fix register view with GDB. Because missing registers are discarded, the register number returned by GDB (when values are obtained) are not the same as the indices into the internal list of registers. Explicitly store this mapping now. Task-number: QTCREATORBUG-7468 Change-Id: Ica6fc6e6bd0a240cbd59923e4cabc7127e1aad8b Reviewed-by: hjk --- src/plugins/debugger/gdb/gdbengine.cpp | 23 +++++++++++++++++++---- src/plugins/debugger/gdb/gdbengine.h | 1 + 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/src/plugins/debugger/gdb/gdbengine.cpp b/src/plugins/debugger/gdb/gdbengine.cpp index 161d48c424a..7af0a9ced5b 100644 --- a/src/plugins/debugger/gdb/gdbengine.cpp +++ b/src/plugins/debugger/gdb/gdbengine.cpp @@ -3770,9 +3770,23 @@ void GdbEngine::handleRegisterListNames(const GdbResponse &response) } Registers registers; - foreach (const GdbMi &item, response.data.findChild("register-names").children()) - if (!item.data().isEmpty()) + int gdbRegisterNumber = 0, internalIndex = 0; + + // This both handles explicitly having space for all the registers and + // initializes all indices to 0, giving missing registers a sane default + // in the event of something wacky. + GdbMi names = response.data.findChild("register-names"); + m_registerNumbers.resize(names.childCount()); + foreach (const GdbMi &item, names.children()) { + // Since we throw away missing registers to eliminate empty rows + // we need to maintain a mapping of GDB register numbers to their + // respective indices in the register list. + if (!item.data().isEmpty()) { + m_registerNumbers[gdbRegisterNumber] = internalIndex++; registers.append(Register(item.data())); + } + gdbRegisterNumber++; + } registerHandler()->setRegisters(registers); } @@ -3784,14 +3798,15 @@ void GdbEngine::handleRegisterListValues(const GdbResponse &response) Registers registers = registerHandler()->registers(); const int registerCount = registers.size(); + const int gdbRegisterCount = m_registerNumbers.size(); // 24^done,register-values=[{number="0",value="0xf423f"},...] const GdbMi values = response.data.findChild("register-values"); QTC_ASSERT(registerCount == values.children().size(), return); foreach (const GdbMi &item, values.children()) { const int number = item.findChild("number").data().toInt(); - if (number >= 0 && number < registerCount) - registers[number].value = item.findChild("value").data(); + if (number >= 0 && number < gdbRegisterCount) + registers[m_registerNumbers[number]].value = item.findChild("value").data(); } registerHandler()->setAndMarkRegisters(registers); } diff --git a/src/plugins/debugger/gdb/gdbengine.h b/src/plugins/debugger/gdb/gdbengine.h index 18adc7fc17f..cdb76eb60a2 100644 --- a/src/plugins/debugger/gdb/gdbengine.h +++ b/src/plugins/debugger/gdb/gdbengine.h @@ -495,6 +495,7 @@ private: ////////// View & Data Stuff ////////// void setRegisterValue(int nr, const QString &value); void handleRegisterListNames(const GdbResponse &response); void handleRegisterListValues(const GdbResponse &response); + QVector m_registerNumbers; // Map GDB register numbers to indices // // Disassembler specific stuff From c216863cf7737f99eb00d326042a34bcfdc166b9 Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Wed, 29 Aug 2012 11:50:00 +0200 Subject: [PATCH 24/39] Botan: Don't unconditionally build in release mode. Mixing debug and release mode is a bad idea in general and does not even work on some platforms. Change-Id: I0e112de1f3e878c5d8f3b57789df194c772848ae Reviewed-by: Andreas Holzammer Reviewed-by: Friedemann Kleint --- src/libs/3rdparty/botan/botan.pri | 2 +- src/libs/3rdparty/botan/botan.pro | 7 ++----- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/src/libs/3rdparty/botan/botan.pri b/src/libs/3rdparty/botan/botan.pri index f0c5bdeafbe..20832c1a7aa 100644 --- a/src/libs/3rdparty/botan/botan.pri +++ b/src/libs/3rdparty/botan/botan.pri @@ -1,2 +1,2 @@ INCLUDEPATH *= $$PWD/.. -LIBS += -lBotan # Don't use qtLibraryName. Botan is always built in release mode. +LIBS *= -l$$qtLibraryName(Botan) diff --git a/src/libs/3rdparty/botan/botan.pro b/src/libs/3rdparty/botan/botan.pro index 1e7ef103cdd..92f2bd0f6a1 100644 --- a/src/libs/3rdparty/botan/botan.pro +++ b/src/libs/3rdparty/botan/botan.pro @@ -3,15 +3,12 @@ TARGET = Botan PRECOMPILED_HEADER = ../precompiled_headers/botan_pch.h -QT = - CONFIG += exceptions -CONFIG += release -CONFIG -= debug debug_and_release + include(../../../qtcreatorlibrary.pri) DEPENDPATH += . -INCLUDEPATH += . $$[QT_INSTALL_HEADERS] $$[QT_INSTALL_HEADERS]/QtCore +INCLUDEPATH += . DEFINES += BOTAN_DLL=Q_DECL_EXPORT unix:DEFINES += BOTAN_TARGET_OS_HAS_GETTIMEOFDAY BOTAN_HAS_ALLOC_MMAP \ From 9f98c27879d0b7f7e0c80bacda3b1650eadb1acc Mon Sep 17 00:00:00 2001 From: Kaffeine Date: Wed, 22 Aug 2012 15:44:45 +0600 Subject: [PATCH 25/39] Project target page: Remove unneeded QHBoxLayout. Fix buttons spacing. Change-Id: I82c4fde505d67de30787077c788af97822153b1e Reviewed-by: Eike Ziller --- src/plugins/projectexplorer/profilemanagerconfigwidget.cpp | 5 +---- src/plugins/projectexplorer/profileoptionspage.cpp | 1 + 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/plugins/projectexplorer/profilemanagerconfigwidget.cpp b/src/plugins/projectexplorer/profilemanagerconfigwidget.cpp index 5fe8c0d46c3..abf9dfb35d1 100644 --- a/src/plugins/projectexplorer/profilemanagerconfigwidget.cpp +++ b/src/plugins/projectexplorer/profilemanagerconfigwidget.cpp @@ -76,15 +76,12 @@ ProfileManagerConfigWidget::ProfileManagerConfigWidget(Profile *p, QWidget *pare iconLayout->addWidget(m_iconButton); iconLayout->addStretch(); - QHBoxLayout *spacer = new QHBoxLayout; - spacer->addItem(new QSpacerItem(1, 1, QSizePolicy::Fixed, QSizePolicy::MinimumExpanding)); - QGridLayout *masterLayout = new QGridLayout(widget); masterLayout->setMargin(0); masterLayout->setContentsMargins(6, 0, 6, 0); masterLayout->addLayout(iconLayout, 0, 0); masterLayout->addLayout(m_layout, 0, 1); - masterLayout->addLayout(spacer, 1, 0); + masterLayout->setRowStretch(1, 1); discard(); diff --git a/src/plugins/projectexplorer/profileoptionspage.cpp b/src/plugins/projectexplorer/profileoptionspage.cpp index 2742bd9db59..6feffdfb55a 100644 --- a/src/plugins/projectexplorer/profileoptionspage.cpp +++ b/src/plugins/projectexplorer/profileoptionspage.cpp @@ -80,6 +80,7 @@ QWidget *ProfileOptionsPage::createPage(QWidget *parent) m_makeDefaultButton = new QPushButton(tr("Make Default"), m_configWidget); QVBoxLayout *buttonLayout = new QVBoxLayout(); + buttonLayout->setSpacing(6); buttonLayout->setContentsMargins(0, 0, 0, 0); buttonLayout->addWidget(m_addButton); buttonLayout->addWidget(m_cloneButton); From d03f33e482a9baf5f627a9b8cb735061c183306e Mon Sep 17 00:00:00 2001 From: Orgad Shaneh Date: Sun, 26 Aug 2012 14:50:00 +0300 Subject: [PATCH 26/39] Find: Allow empty prefix for completers Change-Id: Ie59a7613775c7e5ab19524adc0c5658a81532e95 Reviewed-by: Eike Ziller --- src/plugins/find/findtoolbar.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/plugins/find/findtoolbar.cpp b/src/plugins/find/findtoolbar.cpp index c9e8bf9c0ec..7fa4049689e 100644 --- a/src/plugins/find/findtoolbar.cpp +++ b/src/plugins/find/findtoolbar.cpp @@ -278,10 +278,15 @@ bool FindToolBar::eventFilter(QObject *obj, QEvent *event) if (event->type() == QEvent::KeyPress) { QKeyEvent *ke = static_cast(event); if (ke->key() == Qt::Key_Down) { - if (obj == m_ui.findEdit) + if (obj == m_ui.findEdit) { + if (m_ui.findEdit->text().isEmpty()) + m_findCompleter->setCompletionPrefix(QString()); m_findCompleter->complete(); - else if (obj == m_ui.replaceEdit) + } else if (obj == m_ui.replaceEdit) { + if (m_ui.replaceEdit->text().isEmpty()) + m_replaceCompleter->setCompletionPrefix(QString()); m_replaceCompleter->complete(); + } } } From 3797595c317c6474e7a457b040522f6dff4d64c6 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Thu, 30 Aug 2012 10:26:09 +0200 Subject: [PATCH 27/39] Fix 'Attach Debugger' in output pane. Bring back the slot, suppress a warning about empty binaries in the release check. Task-number: QTCREATORBUG-7677 Change-Id: I2f1703b38b68995a1e2533ed8a6c94985cc3b430 Reviewed-by: hjk --- src/plugins/debugger/debuggercore.h | 7 +++++++ src/plugins/debugger/debuggerplugin.cpp | 13 +++++++++++++ src/plugins/debugger/gdb/gdbengine.cpp | 4 +++- 3 files changed, 23 insertions(+), 1 deletion(-) diff --git a/src/plugins/debugger/debuggercore.h b/src/plugins/debugger/debuggercore.h index 7ca14e05a8d..883fb7f5e4b 100644 --- a/src/plugins/debugger/debuggercore.h +++ b/src/plugins/debugger/debuggercore.h @@ -52,6 +52,10 @@ namespace Utils { class SavedAction; } +namespace ProjectExplorer { +class RunControl; +} + namespace Debugger { class DebuggerEngine; @@ -122,6 +126,9 @@ public: virtual DebuggerToolTipManager *toolTipManager() const = 0; virtual QSharedPointer globalDebuggerOptions() const = 0; + +public slots: + virtual void attachExternalApplication(ProjectExplorer::RunControl *rc) = 0; }; // This is the only way to access the global object. diff --git a/src/plugins/debugger/debuggerplugin.cpp b/src/plugins/debugger/debuggerplugin.cpp index 87ae97d8ee0..e2b61b11537 100644 --- a/src/plugins/debugger/debuggerplugin.cpp +++ b/src/plugins/debugger/debuggerplugin.cpp @@ -888,6 +888,7 @@ public slots: void attachToRemoteServer(); void attachToProcess(bool startServerOnly); void attachToRunningApplication(); + void attachExternalApplication(ProjectExplorer::RunControl *rc); void attachToQmlPort(); void startRemoteEngine(); void runScheduled(); @@ -1684,6 +1685,18 @@ void DebuggerPluginPrivate::attachToProcess(bool startServerOnly) } } +void DebuggerPluginPrivate::attachExternalApplication(ProjectExplorer::RunControl *rc) +{ + DebuggerStartParameters sp; + fillParameters(&sp); + sp.attachPID = rc->applicationProcessHandle().pid(); + sp.displayName = tr("Process %1").arg(sp.attachPID); + sp.startMode = AttachExternal; + sp.closeMode = DetachAtClose; + sp.toolChainAbi = rc->abi(); + DebuggerRunControlFactory::createAndScheduleRun(sp); +} + void DebuggerPluginPrivate::attachToQmlPort() { DebuggerStartParameters sp; diff --git a/src/plugins/debugger/gdb/gdbengine.cpp b/src/plugins/debugger/gdb/gdbengine.cpp index 7af0a9ced5b..47a61c1eca6 100644 --- a/src/plugins/debugger/gdb/gdbengine.cpp +++ b/src/plugins/debugger/gdb/gdbengine.cpp @@ -5235,7 +5235,9 @@ bool GdbEngine::attemptQuickStart() const void GdbEngine::checkForReleaseBuild() { - QString binary = startParameters().executable; + const QString binary = startParameters().executable; + if (binary.isEmpty()) + return; ElfReader reader(binary); ElfData elfData = reader.readHeaders(); QString error = reader.errorString(); From 4dc6be6d43f74a381ea01e027eeea3f9c323ff04 Mon Sep 17 00:00:00 2001 From: hjk Date: Thu, 30 Aug 2012 11:47:43 +0200 Subject: [PATCH 28/39] debugger: add manual test Task-number: QTCREATORBUG-7770 Change-Id: Iecfd25e11748622afaebc320ea29d633f9e08638 Reviewed-by: Friedemann Kleint --- .../manual/debugger/simple/simple_test_app.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/tests/manual/debugger/simple/simple_test_app.cpp b/tests/manual/debugger/simple/simple_test_app.cpp index e9466b9a747..c7e683a9045 100644 --- a/tests/manual/debugger/simple/simple_test_app.cpp +++ b/tests/manual/debugger/simple/simple_test_app.cpp @@ -675,6 +675,23 @@ namespace catchthrow { } // namespace catchthrow +namespace undefined { + + void testUndefined() + { + int *i = new int; + delete i; + BREAK_HERE; + // Manual: Uncomment the following line. Step. + // On Linux, a SIGABRT should be received. + //delete i; + // Continue. + dummyStatement(&i); + } + +} // namespace undefined + + namespace qdatetime { void testQDate() @@ -6545,6 +6562,7 @@ int main(int argc, char *argv[]) text::testText(); io::testIO(); catchthrow::testCatchThrow(); + undefined::testUndefined(); plugin::testPlugin(); valgrind::testValgrind(); namespc::testNamespace(); From 3e0950bd86c3474326537c4a4923d24a6c407821 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 29 Aug 2012 11:42:28 +0200 Subject: [PATCH 29/39] Debugger: Fix Windows terminal execution. The console trap seems to cause a spurious "* stopped" message without reasons in gdb 7.4. Ignore once. Fix warnings about empty file names in cleanupFullName() for assembly frames. Ignore "* running" in state InferiorSetupRequested, which occurs for Windows terminals. Task-number: QTCREATORBUG-7770 Change-Id: Ief6dff4a946eea1b1489caddf8748fb10a647dad Reviewed-by: Orgad Shaneh Reviewed-by: hjk --- src/plugins/debugger/gdb/gdbengine.cpp | 43 +++++++++++++++----------- src/plugins/debugger/gdb/gdbengine.h | 2 +- 2 files changed, 26 insertions(+), 19 deletions(-) diff --git a/src/plugins/debugger/gdb/gdbengine.cpp b/src/plugins/debugger/gdb/gdbengine.cpp index 47a61c1eca6..7c439020ccb 100644 --- a/src/plugins/debugger/gdb/gdbengine.cpp +++ b/src/plugins/debugger/gdb/gdbengine.cpp @@ -258,7 +258,7 @@ GdbEngine::GdbEngine(const DebuggerStartParameters &startParameters) m_stackNeeded = false; m_preparedForQmlBreak = false; m_disassembleUsesComma = false; - m_actingOnExpectedStop = false; + m_terminalTrap = startParameters.useTerminal; m_fullStartDone = false; m_forceAsyncModel = false; @@ -466,9 +466,10 @@ void GdbEngine::handleResponse(const QByteArray &buff) m_pendingLogStreamOutput.clear(); m_pendingConsoleStreamOutput.clear(); } else if (asyncClass == "running") { - if (state() == InferiorRunOk) { - // We get multiple *running after thread creation. - showMessage(_("NOTE: INFERIOR STILL RUNNING.")); + if (state() == InferiorRunOk || state() == InferiorSetupRequested) { + // We get multiple *running after thread creation and in Windows terminals. + showMessage(QString::fromLatin1("NOTE: INFERIOR STILL RUNNING IN STATE %1."). + arg(QLatin1String(DebuggerEngine::stateName(state())))); } else { notifyInferiorRunOk(); } @@ -1375,9 +1376,15 @@ void GdbEngine::handleAqcuiredInferior() void GdbEngine::handleStopResponse(const GdbMi &data) { + // Ignore trap on Windows terminals, which results in + // spurious "* stopped" message. + if (!data.isValid() && m_terminalTrap && Abi::hostAbi().os() == Abi::WindowsOS) { + m_terminalTrap = false; + showMessage(_("IGNORING TERMINAL SIGTRAP"), LogMisc); + return; + } // This is gdb 7+'s initial *stopped in response to attach. // For consistency, we just discard it. - m_actingOnExpectedStop = false; if (state() == InferiorSetupRequested) return; @@ -1420,11 +1427,19 @@ void GdbEngine::handleStopResponse(const GdbMi &data) BreakpointResponseId rid(data.findChild("bkptno").data()); const GdbMi frame = data.findChild("frame"); - const int lineNumber = frame.findChild("line").data().toInt(); - QString fullName = cleanupFullName(QString::fromLocal8Bit(frame.findChild("fullname").data())); - - if (fullName.isEmpty()) - fullName = QString::fromLocal8Bit(frame.findChild("file").data()); + int lineNumber = 0; + QString fullName; + if (frame.isValid()) { + const GdbMi lineNumberG = frame.findChild("line"); + if (lineNumberG.isValid()) { + lineNumber = lineNumberG.data().toInt(); + fullName = cleanupFullName(QString::fromLocal8Bit(frame.findChild("fullname").data())); + if (fullName.isEmpty()) + fullName = QString::fromLocal8Bit(frame.findChild("file").data()); + } // found line number + } else { + showMessage(_("INVALID STOPPED REASON"), LogWarning); + } if (rid.isValid() && frame.isValid() && !isQmlStepBreakpoint(rid) @@ -1455,7 +1470,6 @@ void GdbEngine::handleStopResponse(const GdbMi &data) if (!m_commandsToRunOnTemporaryBreak.isEmpty()) { QTC_ASSERT(state() == InferiorStopRequested, qDebug() << state()); - m_actingOnExpectedStop = true; notifyInferiorStopOk(); flushQueuedCommands(); if (state() == InferiorStopOk) { @@ -1488,7 +1502,6 @@ void GdbEngine::handleStopResponse(const GdbMi &data) // That's expected. } else { QTC_ASSERT(state() == InferiorStopRequested, qDebug() << state()); - m_actingOnExpectedStop = true; notifyInferiorStopOk(); } @@ -1655,12 +1668,6 @@ void GdbEngine::handleStop2(const GdbMi &data) && reason == "signal-received" && data.findChild("signal-name").data() == "SIGTRAP") { - if (!m_actingOnExpectedStop) { - // Ignore signals from command line start up traps. - showMessage(_("INTERNAL CONTINUE AFTER SIGTRAP"), LogMisc); - continueInferiorInternal(); - return; - } // This is the stopper thread. That also means that the // reported thread is not the one we'd like to expose // to the user. diff --git a/src/plugins/debugger/gdb/gdbengine.h b/src/plugins/debugger/gdb/gdbengine.h index cdb76eb60a2..246eb552f78 100644 --- a/src/plugins/debugger/gdb/gdbengine.h +++ b/src/plugins/debugger/gdb/gdbengine.h @@ -686,7 +686,7 @@ protected: QString m_lastWinException; QString m_lastMissingDebugInfo; BreakpointResponseId m_qFatalBreakpointResponseId; - bool m_actingOnExpectedStop; + bool m_terminalTrap; bool usesExecInterrupt() const; From 465f2a15629dc4f3a577b10b5e4e1a40d3331fc4 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Wed, 29 Aug 2012 14:58:12 +0200 Subject: [PATCH 30/39] fix loading of qmakespecs in the qt support classes it's not sufficient to load the qmake.conf only any more. Change-Id: Ic699ad5e202d6f3e115e44621b4c6ee2def6edd2 Reviewed-by: Kai Koehne Reviewed-by: Daniel Teske --- src/plugins/qtsupport/baseqtversion.cpp | 5 +-- src/plugins/qtsupport/qtversionfactory.cpp | 5 +-- src/shared/proparser/profileevaluator.cpp | 9 ++++ src/shared/proparser/profileevaluator.h | 2 + src/shared/proparser/qmakeevaluator.cpp | 49 ++++++++++++---------- src/shared/proparser/qmakeevaluator.h | 1 + 6 files changed, 42 insertions(+), 29 deletions(-) diff --git a/src/plugins/qtsupport/baseqtversion.cpp b/src/plugins/qtsupport/baseqtversion.cpp index 92f55eaece8..957e6936486 100644 --- a/src/plugins/qtsupport/baseqtversion.cpp +++ b/src/plugins/qtsupport/baseqtversion.cpp @@ -758,10 +758,7 @@ void BaseQtVersion::ensureMkSpecParsed() const ProFileCacheManager::instance()->incRefCount(); QMakeParser parser(ProFileCacheManager::instance()->cache(), &msgHandler); ProFileEvaluator evaluator(&option, &parser, &msgHandler); - if (ProFile *pro = parser.parsedProFile(mkspecPath().toString() + QLatin1String("/qmake.conf"))) { - evaluator.accept(pro, QMakeEvaluator::LoadProOnly); - pro->deref(); - } + evaluator.loadNamedSpec(mkspecPath().toString(), false); parseMkSpec(&evaluator); diff --git a/src/plugins/qtsupport/qtversionfactory.cpp b/src/plugins/qtsupport/qtversionfactory.cpp index 8335c0e7d05..05cd57e87a1 100644 --- a/src/plugins/qtsupport/qtversionfactory.cpp +++ b/src/plugins/qtsupport/qtversionfactory.cpp @@ -69,10 +69,7 @@ BaseQtVersion *QtVersionFactory::createQtVersionFromQMakePath(const Utils::FileN ProFileCacheManager::instance()->incRefCount(); QMakeParser parser(ProFileCacheManager::instance()->cache(), &msgHandler); ProFileEvaluator evaluator(&globals, &parser, &msgHandler); - if (ProFile *pro = parser.parsedProFile(mkspec.toString() + QLatin1String("/qmake.conf"))) { - evaluator.accept(pro, QMakeEvaluator::LoadProOnly); - pro->deref(); - } + evaluator.loadNamedSpec(mkspec.toString(), false); QList factories = ExtensionSystem::PluginManager::getObjects(); qSort(factories.begin(), factories.end(), &sortByPriority); diff --git a/src/shared/proparser/profileevaluator.cpp b/src/shared/proparser/profileevaluator.cpp index 2b8e5e46511..6e1ad8af863 100644 --- a/src/shared/proparser/profileevaluator.cpp +++ b/src/shared/proparser/profileevaluator.cpp @@ -184,6 +184,15 @@ ProFileEvaluator::TemplateType ProFileEvaluator::templateType() const return TT_Unknown; } +bool ProFileEvaluator::loadNamedSpec(const QString &specDir, bool hostSpec) +{ + d->m_qmakespec = specDir; + d->m_hostBuild = hostSpec; + + d->updateMkspecPaths(); + return d->loadSpecInternal(); +} + bool ProFileEvaluator::accept(ProFile *pro, QMakeEvaluator::LoadFlags flags) { return d->visitProFile(pro, QMakeHandler::EvalProjectFile, flags) == QMakeEvaluator::ReturnTrue; diff --git a/src/shared/proparser/profileevaluator.h b/src/shared/proparser/profileevaluator.h index 531f85e45a7..3d6f9179113 100644 --- a/src/shared/proparser/profileevaluator.h +++ b/src/shared/proparser/profileevaluator.h @@ -69,6 +69,8 @@ public: #endif void setOutputDir(const QString &dir); // Default is empty + bool loadNamedSpec(const QString &specDir, bool hostSpec); + bool accept(ProFile *pro, QMakeEvaluator::LoadFlags flags = QMakeEvaluator::LoadAll); bool contains(const QString &variableName) const; diff --git a/src/shared/proparser/qmakeevaluator.cpp b/src/shared/proparser/qmakeevaluator.cpp index b017dcdcadb..0bc68838dc3 100644 --- a/src/shared/proparser/qmakeevaluator.cpp +++ b/src/shared/proparser/qmakeevaluator.cpp @@ -1032,6 +1032,33 @@ bool QMakeEvaluator::prepareProject(const QString &inDir) return true; } +bool QMakeEvaluator::loadSpecInternal() +{ + if (!evaluateFeatureFile(QLatin1String("spec_pre.prf"))) + return false; + QString spec = m_qmakespec + QLatin1String("/qmake.conf"); + if (!evaluateFileDirect(spec, QMakeHandler::EvalConfigFile, LoadProOnly)) { + evalError(fL1S("Could not read qmake configuration file %1.").arg(spec)); + return false; + } +#ifdef Q_OS_UNIX + m_qmakespecFull = QFileInfo(m_qmakespec).canonicalFilePath(); +#else + // We can't resolve symlinks as they do on Unix, so configure.exe puts + // the source of the qmake.conf at the end of the default/qmake.conf in + // the QMAKESPEC_ORIGINAL variable. + const ProString &orig_spec = first(ProKey("QMAKESPEC_ORIGINAL")); + m_qmakespecFull = orig_spec.isEmpty() ? m_qmakespec : orig_spec.toQString(); +#endif + valuesRef(ProKey("QMAKESPEC")) << ProString(m_qmakespecFull); + m_qmakespecName = IoUtils::fileName(m_qmakespecFull).toString(); + if (!evaluateFeatureFile(QLatin1String("spec_post.prf"))) + return false; + // The MinGW and x-build specs may change the separator; $$shell_{path,quote}() need it + m_dirSep = first(ProKey("QMAKE_DIR_SEP")); + return true; +} + bool QMakeEvaluator::loadSpec() { QString qmakespec = m_option->expandEnvVars( @@ -1085,29 +1112,9 @@ bool QMakeEvaluator::loadSpec() && !evaluateFileDirect(m_superfile, QMakeHandler::EvalConfigFile, LoadProOnly)) { return false; } - if (!evaluateFeatureFile(QLatin1String("spec_pre.prf"))) - return false; - QString spec = m_qmakespec + QLatin1String("/qmake.conf"); - if (!evaluateFileDirect(spec, QMakeHandler::EvalConfigFile, LoadProOnly)) { - evalError(fL1S("Could not read qmake configuration file %1.").arg(spec)); - return false; - } -#ifdef Q_OS_UNIX - m_qmakespecFull = QFileInfo(m_qmakespec).canonicalFilePath(); -#else - // We can't resolve symlinks as they do on Unix, so configure.exe puts - // the source of the qmake.conf at the end of the default/qmake.conf in - // the QMAKESPEC_ORIGINAL variable. - const ProString &orig_spec = first(ProKey("QMAKESPEC_ORIGINAL")); - m_qmakespecFull = orig_spec.isEmpty() ? m_qmakespec : orig_spec.toQString(); -#endif - valuesRef(ProKey("QMAKESPEC")) << ProString(m_qmakespecFull); - m_qmakespecName = IoUtils::fileName(m_qmakespecFull).toString(); - if (!evaluateFeatureFile(QLatin1String("spec_post.prf"))) + if (!loadSpecInternal()) return false; updateFeaturePaths(); // The spec extends the feature search path, so rebuild the cache. - // The MinGW and x-build specs may change the separator; $$shell_{path,quote}() need it - m_dirSep = first(ProKey("QMAKE_DIR_SEP")); if (!m_conffile.isEmpty() && !evaluateFileDirect(m_conffile, QMakeHandler::EvalConfigFile, LoadProOnly)) { return false; diff --git a/src/shared/proparser/qmakeevaluator.h b/src/shared/proparser/qmakeevaluator.h index 970a18b0115..92d6cc329f0 100644 --- a/src/shared/proparser/qmakeevaluator.h +++ b/src/shared/proparser/qmakeevaluator.h @@ -116,6 +116,7 @@ public: void loadDefaults(); bool prepareProject(const QString &inDir); + bool loadSpecInternal(); bool loadSpec(); void initFrom(const QMakeEvaluator &other); void setupProject(); From a39ad794a74e66a166d572e733170f33e977ef6c Mon Sep 17 00:00:00 2001 From: Robert Loehning Date: Tue, 28 Aug 2012 16:04:21 +0200 Subject: [PATCH 31/39] Squish: Removed workaround for closed bug Change-Id: I6532c7d9639d587663a204d401295d67b2310d8b Reviewed-by: Christian Stenger --- tests/system/shared/workarounds.py | 1 - tests/system/suite_general/tst_basic_cpp_support/test.py | 1 - 2 files changed, 2 deletions(-) diff --git a/tests/system/shared/workarounds.py b/tests/system/shared/workarounds.py index f5a302243cb..a1e98b70713 100644 --- a/tests/system/shared/workarounds.py +++ b/tests/system/shared/workarounds.py @@ -210,7 +210,6 @@ class JIRA: self.__bugs__= { 'QTCREATORBUG-6853':self._workaroundCreator6853_, 'QTCREATORBUG-6918':self._workaroundCreator_MacEditorFocus_, - 'QTCREATORBUG-6953':self._workaroundCreator_MacEditorFocus_, 'QTCREATORBUG-6994':self._workaroundCreator6994_ } # helper function - will be called if no workaround for the requested bug is deposited diff --git a/tests/system/suite_general/tst_basic_cpp_support/test.py b/tests/system/suite_general/tst_basic_cpp_support/test.py index 4b3b678aa8e..d4156c3632b 100644 --- a/tests/system/suite_general/tst_basic_cpp_support/test.py +++ b/tests/system/suite_general/tst_basic_cpp_support/test.py @@ -27,7 +27,6 @@ def main(): # - Press F2 or select from the menu: Tools / C++ / Follow Symbol under Cursor # Creator will show you the declaration of the variable. - JIRA.performWorkaroundIfStillOpen(6953, JIRA.Bug.CREATOR, cppwindow) type(cppwindow, "") type(waitForObject(":*Qt Creator.findEdit_Utils::FilterLineEdit"), " xi") type(waitForObject(":*Qt Creator.findEdit_Utils::FilterLineEdit"), "") From c00a76bde3354111f301646ac1ffd71aca484d2d Mon Sep 17 00:00:00 2001 From: Robert Loehning Date: Tue, 28 Aug 2012 14:19:52 +0200 Subject: [PATCH 32/39] Squish: Partly revert "remotelinux: rename LinuxDeviceConfiguration to LinuxDevice" This reverts commit 646025493197f4605874206e8029597f659078e4 Change-Id: Ifa0aaf19787a0d73ddf1a6d3dfe690bbfa8b4e1e Reviewed-by: Christian Stenger --- .../tst_openqt_creator/testdata/projecttree_creator.tsv | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/system/suite_general/tst_openqt_creator/testdata/projecttree_creator.tsv b/tests/system/suite_general/tst_openqt_creator/testdata/projecttree_creator.tsv index 0b3ce9afa8b..ccdcad6ef9b 100644 --- a/tests/system/suite_general/tst_openqt_creator/testdata/projecttree_creator.tsv +++ b/tests/system/suite_general/tst_openqt_creator/testdata/projecttree_creator.tsv @@ -6926,7 +6926,7 @@ "genericlinuxdeviceconfigurationwizard.h" "4" "genericlinuxdeviceconfigurationwizardpages.h" "4" "genericremotelinuxdeploystepfactory.h" "4" -"linuxdevice.h" "4" +"linuxdeviceconfiguration.h" "4" "linuxdevicetestdialog.h" "4" "linuxdevicetester.h" "4" "packageuploader.h" "4" From cd91925dcdd76e081fe071bcde3f293cbb21e3eb Mon Sep 17 00:00:00 2001 From: Jarek Kobus Date: Thu, 30 Aug 2012 11:08:26 +0200 Subject: [PATCH 33/39] Fix source strings Change-Id: I3c96c467f79fa7722c270a5887997294a7042adc Reviewed-by: Oswald Buddenhagen --- src/plugins/debugger/debuggerdialogs.cpp | 2 +- src/plugins/find/searchresultwidget.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/plugins/debugger/debuggerdialogs.cpp b/src/plugins/debugger/debuggerdialogs.cpp index d8e8d7f3c1a..f27b8c00e47 100644 --- a/src/plugins/debugger/debuggerdialogs.cpp +++ b/src/plugins/debugger/debuggerdialogs.cpp @@ -244,7 +244,7 @@ StartApplicationDialog::StartApplicationDialog(QWidget *parent) d->debuginfoPathChooser = new PathChooser(this); d->debuginfoPathChooser->setPromptDialogTitle(tr("Select Location of Debugging Information")); d->debuginfoPathChooser->setToolTip(tr( - "Base path for external debug information and debug sources." + "Base path for external debug information and debug sources. " "If empty, $SYSROOT/usr/lib/debug will be chosen.")); QFrame *line = new QFrame(this); diff --git a/src/plugins/find/searchresultwidget.cpp b/src/plugins/find/searchresultwidget.cpp index 4c6bfe18809..384f263dcf2 100644 --- a/src/plugins/find/searchresultwidget.cpp +++ b/src/plugins/find/searchresultwidget.cpp @@ -242,8 +242,8 @@ void SearchResultWidget::addResults(const QList &items, Search m_sizeWarningActive = true; emit paused(true); Core::InfoBarEntry info(QLatin1String(SIZE_WARNING_ID), - tr("The search resulted in more than %1 items, do you still want to continue?") - .arg(SEARCHRESULT_WARNING_LIMIT)); + tr("The search resulted in more than %n items, do you still want to continue?", + 0, SEARCHRESULT_WARNING_LIMIT)); info.setCancelButtonInfo(tr("Cancel"), this, SLOT(cancelAfterSizeWarning())); info.setCustomButtonInfo(tr("Continue"), this, SLOT(continueAfterSizeWarning())); m_infoBar.addInfo(info); From f30111a6cbd5a59f1e15e385d5cba60081c39836 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Thu, 30 Aug 2012 15:31:48 +0200 Subject: [PATCH 34/39] GdbOptionsPage: Fix text for break at 'abort'. Change-Id: Ibd0385fbe5a7dacd9138b794c9927538be235680 Reviewed-by: hjk --- src/plugins/debugger/gdb/gdboptionspage.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/debugger/gdb/gdboptionspage.cpp b/src/plugins/debugger/gdb/gdboptionspage.cpp index 4d11152141e..4535f5cdc46 100644 --- a/src/plugins/debugger/gdb/gdboptionspage.cpp +++ b/src/plugins/debugger/gdb/gdboptionspage.cpp @@ -191,7 +191,7 @@ GdbOptionsPageWidget::GdbOptionsPageWidget(QWidget *parent) checkBoxBreakOnAbort = new QCheckBox(groupBoxGeneral); checkBoxBreakOnAbort->setText(CommonOptionsPage::msgSetBreakpointAtFunction("abort")); - checkBoxBreakOnAbort->setText(CommonOptionsPage::msgSetBreakpointAtFunctionToolTip("abort")); + checkBoxBreakOnAbort->setToolTip(CommonOptionsPage::msgSetBreakpointAtFunctionToolTip("abort")); checkBoxEnableReverseDebugging = new QCheckBox(groupBoxGeneral); checkBoxEnableReverseDebugging->setText(GdbOptionsPage::tr("Enable reverse debugging")); From e160d286f88c7e415e72afe736bf147049c0e322 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobias=20N=C3=A4tterlund?= Date: Thu, 30 Aug 2012 14:23:20 +0200 Subject: [PATCH 35/39] QNX: Fixed updating package path if deploy configuration changes The path to the BAR package in the run configuration did not react to changes in the deploy configuration. Change-Id: I5eabbf600a3c0704ff4049edeceee67644c615df Reviewed-by: Daniel Teske --- src/plugins/qnx/blackberryrunconfiguration.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/plugins/qnx/blackberryrunconfiguration.cpp b/src/plugins/qnx/blackberryrunconfiguration.cpp index 45cc0fbb39e..7393525f3b1 100644 --- a/src/plugins/qnx/blackberryrunconfiguration.cpp +++ b/src/plugins/qnx/blackberryrunconfiguration.cpp @@ -64,6 +64,9 @@ BlackBerryRunConfiguration::BlackBerryRunConfiguration(ProjectExplorer::Target * void BlackBerryRunConfiguration::init() { updateDisplayName(); + + connect(deployConfiguration()->deploymentInfo(), SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SIGNAL(targetInformationChanged())); + connect(deployConfiguration()->deploymentInfo(), SIGNAL(modelReset()), this, SIGNAL(targetInformationChanged())); } void BlackBerryRunConfiguration::updateDisplayName() From 813539a70a45ba04ec982d4ad9aabb0842c00df5 Mon Sep 17 00:00:00 2001 From: Leandro Melo Date: Thu, 30 Aug 2012 15:04:25 +0200 Subject: [PATCH 36/39] C++: Fix lexer for token Q_SLOT When adding Q_EMIT a while ago the the if chain got messed up and Q_SLOT was being skipped. Change-Id: Ib1f49c00290a09286506de9510d0067eaf5e3b96 Reviewed-by: hjk --- src/libs/3rdparty/cplusplus/Keywords.cpp | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/src/libs/3rdparty/cplusplus/Keywords.cpp b/src/libs/3rdparty/cplusplus/Keywords.cpp index 3d1b50e67a2..cac51a4fd68 100644 --- a/src/libs/3rdparty/cplusplus/Keywords.cpp +++ b/src/libs/3rdparty/cplusplus/Keywords.cpp @@ -424,19 +424,6 @@ static inline int classify6(const char *s, bool q, bool) { } } } - else if (q && s[0] == 'Q') { - if (s[1] == '_') { - if (s[2] == 'E') { - if (s[3] == 'M') { - if (s[4] == 'I') { - if (s[5] == 'T') { - return T_Q_EMIT; - } - } - } - } - } - } else if (s[0] == 'r') { if (s[1] == 'e') { if (s[2] == 't') { @@ -545,6 +532,15 @@ static inline int classify6(const char *s, bool q, bool) { } } } + else if (s[2] == 'E') { + if (s[3] == 'M') { + if (s[4] == 'I') { + if (s[5] == 'T') { + return T_Q_EMIT; + } + } + } + } } } return T_IDENTIFIER; From 5c4fddc6a5d766fd62a4d3b89b49d5e4ffdee6ba Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 29 Aug 2012 09:13:42 +0200 Subject: [PATCH 37/39] Detect Linux terminal by checking a number of known terminals. Change the behaviour of defaultTerminalEmulator() to already return the run option in line with terminalEmulator(). Change the QLineEdit in settings to an editable combo offering the available terminals. Change-Id: I333ef08ad06934bcd9fcafb50ff1eced1af6293a Reviewed-by: Nikolai Kosjar --- src/libs/utils/consoleprocess.h | 1 + src/libs/utils/consoleprocess_unix.cpp | 62 +++++++++++++++++++--- src/plugins/coreplugin/generalsettings.cpp | 11 ++-- src/plugins/coreplugin/generalsettings.ui | 8 ++- 4 files changed, 70 insertions(+), 12 deletions(-) diff --git a/src/libs/utils/consoleprocess.h b/src/libs/utils/consoleprocess.h index 949db8fc637..0be84b8f2f2 100644 --- a/src/libs/utils/consoleprocess.h +++ b/src/libs/utils/consoleprocess.h @@ -87,6 +87,7 @@ public: #else void setSettings(QSettings *settings); static QString defaultTerminalEmulator(); + static QStringList availableTerminalEmulators(); static QString terminalEmulator(const QSettings *settings); static void setTerminalEmulator(QSettings *settings, const QString &term); #endif diff --git a/src/libs/utils/consoleprocess_unix.cpp b/src/libs/utils/consoleprocess_unix.cpp index 4c514455676..c2f88cf1f9c 100644 --- a/src/libs/utils/consoleprocess_unix.cpp +++ b/src/libs/utils/consoleprocess_unix.cpp @@ -277,21 +277,71 @@ void ConsoleProcess::stubExited() emit wrapperStopped(); } +struct Terminal { + const char *binary; + const char *options; +}; + +static const Terminal knownTerminals[] = +{ + {"xterm", "-e"}, + {"aterm", "-e"}, + {"Eterm", "-e"}, + {"rxvt", "-e"}, + {"urxvt", "-e"}, + {"xfce4-terminal", "-x"}, + {"konsole", "--nofork -e"}, + {"gnome-terminal", "-x"} +}; + QString ConsoleProcess::defaultTerminalEmulator() { #ifdef Q_OS_MAC - return QLatin1String("/usr/X11/bin/xterm"); + return QLatin1String("/usr/X11/bin/xterm -e"); #else - return QLatin1String("xterm"); + const Environment env = Environment::systemEnvironment(); + const int terminalCount = int(sizeof(knownTerminals) / sizeof(knownTerminals[0])); + for (int i = 0; i < terminalCount; ++i) { + QString result = env.searchInPath(QLatin1String(knownTerminals[i].binary)); + if (!result.isEmpty()) { + result += QLatin1Char(' '); + result += QLatin1String(knownTerminals[i].options); + return result; + } + } + return QLatin1String("xterm -e"); +#endif +} + +QStringList ConsoleProcess::availableTerminalEmulators() +{ +#ifdef Q_OS_MAC + return QStringList(defaultTerminalEmulator()); +#else + QStringList result; + const Environment env = Environment::systemEnvironment(); + const int terminalCount = int(sizeof(knownTerminals) / sizeof(knownTerminals[0])); + for (int i = 0; i < terminalCount; ++i) { + QString terminal = env.searchInPath(QLatin1String(knownTerminals[i].binary)); + if (!terminal.isEmpty()) { + terminal += QLatin1Char(' '); + terminal += QLatin1String(knownTerminals[i].options); + result.push_back(terminal); + } + } + result.sort(); + return result; #endif } QString ConsoleProcess::terminalEmulator(const QSettings *settings) { - const QString dflt = defaultTerminalEmulator() + QLatin1String(" -e"); - if (!settings) - return dflt; - return settings->value(QLatin1String("General/TerminalEmulator"), dflt).toString(); + if (settings) { + const QString value = settings->value(QLatin1String("General/TerminalEmulator")).toString(); + if (!value.isEmpty()) + return value; + } + return defaultTerminalEmulator(); } void ConsoleProcess::setTerminalEmulator(QSettings *settings, const QString &term) diff --git a/src/plugins/coreplugin/generalsettings.cpp b/src/plugins/coreplugin/generalsettings.cpp index a6ab371b2b3..d8d98a8feec 100644 --- a/src/plugins/coreplugin/generalsettings.cpp +++ b/src/plugins/coreplugin/generalsettings.cpp @@ -113,10 +113,13 @@ QWidget *GeneralSettings::createPage(QWidget *parent) m_page->colorButton->setColor(StyleHelper::requestedBaseColor()); m_page->reloadBehavior->setCurrentIndex(EditorManager::instance()->reloadSetting()); #ifdef Q_OS_UNIX - m_page->terminalEdit->setText(ConsoleProcess::terminalEmulator(settings)); + const QStringList availableTerminals = ConsoleProcess::availableTerminalEmulators(); + const QString currentTerminal = ConsoleProcess::terminalEmulator(settings); + m_page->terminalComboBox->addItems(availableTerminals); + m_page->terminalComboBox->lineEdit()->setText(currentTerminal); #else m_page->terminalLabel->hide(); - m_page->terminalEdit->hide(); + m_page->terminalComboBox->hide(); m_page->resetTerminalButton->hide(); #endif @@ -175,7 +178,7 @@ void GeneralSettings::apply() EditorManager::instance()->setReloadSetting(IDocument::ReloadSetting(m_page->reloadBehavior->currentIndex())); #ifdef Q_OS_UNIX ConsoleProcess::setTerminalEmulator(Core::ICore::settings(), - m_page->terminalEdit->text()); + m_page->terminalComboBox->lineEdit()->text()); #ifndef Q_OS_MAC Utils::UnixUtils::setFileBrowser(Core::ICore::settings(), m_page->externalFileBrowserEdit->text()); #endif @@ -200,7 +203,7 @@ void GeneralSettings::resetInterfaceColor() void GeneralSettings::resetTerminal() { #if defined(Q_OS_UNIX) - m_page->terminalEdit->setText(ConsoleProcess::defaultTerminalEmulator() + QLatin1String(" -e")); + m_page->terminalComboBox->lineEdit()->setText(ConsoleProcess::defaultTerminalEmulator()); #endif } diff --git a/src/plugins/coreplugin/generalsettings.ui b/src/plugins/coreplugin/generalsettings.ui index 960d05b098d..08b42c94e0b 100644 --- a/src/plugins/coreplugin/generalsettings.ui +++ b/src/plugins/coreplugin/generalsettings.ui @@ -124,7 +124,11 @@
- + + + true + + @@ -305,7 +309,7 @@ colorButton resetButton languageBox - terminalEdit + terminalComboBox resetTerminalButton externalFileBrowserEdit resetFileBrowserButton From fb6b15f9577261a2d37d09475f8bafcbc69e274b Mon Sep 17 00:00:00 2001 From: Orgad Shaneh Date: Sun, 26 Aug 2012 09:19:43 +0300 Subject: [PATCH 38/39] Remove stale shared/json directory Symbian leftovers Change-Id: I4479113b6f80eb4a667054d72da1b185c315f61d Reviewed-by: Kai Koehne Reviewed-by: Alessandro Portale --- src/plugins/debugger/debugger.qbs | 9 - src/shared/json/json.cpp | 549 ---------------------------- src/shared/json/json.h | 143 -------- src/shared/json/json.pri | 7 - src/shared/json/json_global.h | 44 --- tests/auto/debugger/dumpers.pro | 4 +- tests/auto/debugger/tst_dumpers.cpp | 2 +- 7 files changed, 2 insertions(+), 756 deletions(-) delete mode 100644 src/shared/json/json.cpp delete mode 100644 src/shared/json/json.h delete mode 100644 src/shared/json/json.pri delete mode 100644 src/shared/json/json_global.h diff --git a/src/plugins/debugger/debugger.qbs b/src/plugins/debugger/debugger.qbs index b0d9094436e..cd1300f276f 100644 --- a/src/plugins/debugger/debugger.qbs +++ b/src/plugins/debugger/debugger.qbs @@ -272,15 +272,6 @@ QtcPlugin { ] } - Group { - prefix: "../../shared/json/" - files: [ - "json_global.h", - "json.cpp", - "json.h" - ] - } - Group { condition: qbs.targetOS == "windows" files: [ diff --git a/src/shared/json/json.cpp b/src/shared/json/json.cpp deleted file mode 100644 index 6f79554d798..00000000000 --- a/src/shared/json/json.cpp +++ /dev/null @@ -1,549 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: http://www.qt-project.org/ -** -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -**************************************************************************/ - -#include "json.h" - -#ifdef TODO_USE_CREATOR -#include -#endif // TODO_USE_CREATOR - -#include -#include -#include -#include -#include - -#include - -#ifdef DEBUG_JASON -#define JDEBUG(s) qDebug() << s -#else -#define JDEBUG(s) -#endif - -using namespace Json; - -static void skipSpaces(const char *&from, const char *to) -{ - while (from != to && isspace(*from)) - ++from; -} - -QTextStream &operator<<(QTextStream &os, const JsonValue &mi) -{ - return os << mi.toString(); -} - -void JsonValue::parsePair(const char *&from, const char *to) -{ - skipSpaces(from, to); - JDEBUG("parsePair: " << QByteArray(from, to - from)); - m_name = parseCString(from, to); - skipSpaces(from, to); - while (from < to && *from != ':') { - JDEBUG("not a colon" << *from); - ++from; - } - ++from; - parseValue(from, to); - skipSpaces(from, to); -} - -QByteArray JsonValue::parseNumber(const char *&from, const char *to) -{ - QByteArray result; - if (from < to && *from == '-') // Leading '-'. - result.append(*from++); - while (from < to && *from >= '0' && *from <= '9') - result.append(*from++); - return result; -} - -QByteArray JsonValue::parseCString(const char *&from, const char *to) -{ - QByteArray result; - const char * const fromSaved = from; - JDEBUG("parseCString: " << QByteArray(from, to - from)); - if (*from != '"') { - qDebug() << "JSON Parse Error, double quote expected"; - ++from; // So we don't hang - return QByteArray(); - } - const char *ptr = from; - ++ptr; - while (ptr < to) { - if (*ptr == '"') { - ++ptr; - result = QByteArray(from + 1, ptr - from - 2); - break; - } - if (*ptr == '\\') { - ++ptr; - if (ptr == to) { - qWarning("JSON Parse Error, unterminated backslash escape in '%s'", - QByteArray(fromSaved, to - fromSaved).constData()); - from = ptr; // So we don't hang - return QByteArray(); - } - } - ++ptr; - } - from = ptr; - - int idx = result.indexOf('\\'); - if (idx >= 0) { - char *dst = result.data() + idx; - const char *src = dst + 1, *end = result.data() + result.length(); - do { - char c = *src++; - switch (c) { - case 'a': *dst++ = '\a'; break; - case 'b': *dst++ = '\b'; break; - case 'f': *dst++ = '\f'; break; - case 'n': *dst++ = '\n'; break; - case 'r': *dst++ = '\r'; break; - case 't': *dst++ = '\t'; break; - case 'v': *dst++ = '\v'; break; - case '"': *dst++ = '"'; break; - case '\\': *dst++ = '\\'; break; - case 'u': { // 4 digit hex escape as in '\u000a' - if (end - src < 4) { - qWarning("JSON Parse Error, too few hex digits in \\u-escape in '%s' obtained from '%s'", - result.constData(), QByteArray(fromSaved, to - fromSaved).constData()); - return QByteArray(); - } - bool ok; - const uchar prod = QByteArray(src, 4).toUInt(&ok, 16); - if (!ok) { - qWarning("JSON Parse Error, invalid hex digits in \\u-escape in '%s' obtained from '%s'", - result.constData(), QByteArray(fromSaved, to - fromSaved).constData()); - return QByteArray(); - } - *dst++ = prod; - src += 4; - } - break; - default: { // Up to 3 decimal digits: Not sure if this is supported in JSON? - int chars = 0; - uchar prod = 0; - forever { - if (c < '0' || c > '7') { - --src; - break; - } - prod = prod * 8 + c - '0'; - if (++chars == 3 || src == end) - break; - c = *src++; - } - if (!chars) { - qWarning("JSON Parse Error, unrecognized backslash escape in string '%s' obtained from '%s'", - result.constData(), QByteArray(fromSaved, to - fromSaved).constData()); - return QByteArray(); - } - *dst++ = prod; - } - } - while (src != end) { - char c = *src++; - if (c == '\\') - break; - *dst++ = c; - } - } while (src != end); - *dst = 0; - result.truncate(dst - result.data()); - } - - JDEBUG("parseCString, got " << result); - return result; -} - - - -void JsonValue::parseValue(const char *&from, const char *to) -{ - JDEBUG("parseValue: " << QByteArray(from, to - from)); - switch (*from) { - case '{': - parseObject(from, to); - break; - case 't': - if (to - from >= 4 && qstrncmp(from, "true", 4) == 0) { - m_data = QByteArray(from, 4); - from += m_data.size(); - m_type = Boolean; - } - break; - case 'f': - if (to - from >= 5 && qstrncmp(from, "false", 5) == 0) { - m_data = QByteArray(from, 5); - from += m_data.size(); - m_type = Boolean; - } - break; - case 'n': - if (to - from >= 4 && qstrncmp(from, "null", 4) == 0) { - m_data = QByteArray(from, 4); - from += m_data.size(); - m_type = NullObject; - } - break; - case '[': - parseArray(from, to); - break; - case '"': - m_type = String; - m_data = parseCString(from, to); - break; - case '0': case '1': case '2': case '3': case '4': - case '5': case '6': case '7': case '8': case '9': - case '-': - m_type = Number; - m_data = parseNumber(from, to); - default: - break; - } -} - -void JsonValue::parseObject(const char *&from, const char *to) -{ - JDEBUG("parseObject: " << QByteArray(from, to - from)); -#ifdef TODO_USE_CREATOR - QTC_CHECK(*from == '{'); -#endif - ++from; - m_type = Object; - while (from < to) { - if (*from == '}') { - ++from; - break; - } - JsonValue child; - child.parsePair(from, to); - if (!child.isValid()) - return; - m_children += child; - if (*from == ',') - ++from; - } -} - -void JsonValue::parseArray(const char *&from, const char *to) -{ - JDEBUG("parseArray: " << QByteArray(from, to - from)); -#ifdef TODO_USE_CREATOR - QTC_CHECK(*from == '['); -#endif - ++from; - m_type = Array; - while (from < to) { - if (*from == ']') { - ++from; - break; - } - JsonValue child; - child.parseValue(from, to); - if (child.isValid()) - m_children += child; - if (*from == ',') - ++from; - } -} - -void JsonValue::setStreamOutput(const QByteArray &name, const QByteArray &content) -{ - if (content.isEmpty()) - return; - JsonValue child; - child.m_type = String; - child.m_name = name; - child.m_data = content; - m_children += child; - if (m_type == Invalid) - m_type = Object; -} - -static QByteArray ind(int indent) -{ - return QByteArray(2 * indent, ' '); -} - -void JsonValue::dumpChildren(QByteArray * str, bool multiline, int indent) const -{ - for (int i = 0; i < m_children.size(); ++i) { - if (i != 0) { - *str += ','; - if (multiline) - *str += '\n'; - } - if (multiline) - *str += ind(indent); - *str += m_children.at(i).toString(multiline, indent); - } -} - -class MyString : public QString { -public: - ushort at(int i) const { return constData()[i].unicode(); } -}; - -template -inline ST escapeCStringTpl(const ST &ba) -{ - ST ret; - ret.reserve(ba.length() * 2); - for (int i = 0; i < ba.length(); ++i) { - CT c = ba.at(i); - switch (c) { - case '\\': ret += "\\\\"; break; - case '\a': ret += "\\a"; break; - case '\b': ret += "\\b"; break; - case '\f': ret += "\\f"; break; - case '\n': ret += "\\n"; break; - case '\r': ret += "\\r"; break; - case '\t': ret += "\\t"; break; - case '\v': ret += "\\v"; break; - case '"': ret += "\\\""; break; - default: - if (c < 32 || c == 127) { - ret += '\\'; - ret += '0' + (c >> 6); - ret += '0' + ((c >> 3) & 7); - ret += '0' + (c & 7); - } else { - ret += c; - } - } - } - return ret; -} - -QString JsonValue::escapeCString(const QString &ba) -{ - return escapeCStringTpl(static_cast(ba)); -} - -QByteArray JsonValue::escapeCString(const QByteArray &ba) -{ - return escapeCStringTpl(ba); -} - -QByteArray JsonValue::toString(bool multiline, int indent) const -{ - QByteArray result; - switch (m_type) { - case Invalid: - if (multiline) - result += ind(indent) + "Invalid\n"; - else - result += "Invalid"; - break; - case String: - if (!m_name.isEmpty()) - result += m_name + '='; - result += '"' + escapeCString(m_data) + '"'; - break; - case Number: - if (!m_name.isEmpty()) - result += '"' + m_name + "\":"; - result += m_data; - break; - case Boolean: - case NullObject: - if (!m_name.isEmpty()) - result += '"' + m_name + "\":"; - result += m_data; - break; - case Object: - if (!m_name.isEmpty()) - result += m_name + '='; - if (multiline) { - result += "{\n"; - dumpChildren(&result, multiline, indent + 1); - result += '\n' + ind(indent) + '}'; - } else { - result += '{'; - dumpChildren(&result, multiline, indent + 1); - result += '}'; - } - break; - case Array: - if (!m_name.isEmpty()) - result += m_name + '='; - if (multiline) { - result += "[\n"; - dumpChildren(&result, multiline, indent + 1); - result += '\n' + ind(indent) + ']'; - } else { - result += '['; - dumpChildren(&result, multiline, indent + 1); - result += ']'; - } - break; - } - return result; -} - - -QVariant JsonValue::toVariant() const -{ - switch (m_type) { - case String: - return QString(m_data); - case Number: { - bool ok; - qint64 val = QString(m_data).toLongLong(&ok); - if (ok) - return val; - return QVariant(); - } - case Object: { - QHash hash; - for (int i = 0; i < m_children.size(); ++i) { - QString name(m_children[i].name()); - QVariant val = m_children[i].toVariant(); - hash.insert(name, val); - } - return hash; - } - case Array: { - QList list; - for (int i = 0; i < m_children.size(); ++i) { - list.append(m_children[i].toVariant()); - } - return list; - } - case Boolean: - return data() == QByteArray("true"); - case Invalid: - case NullObject: - default: - return QVariant(); - } -} - - -void JsonValue::fromString(const QByteArray &ba) -{ - const char *from = ba.constBegin(); - const char *to = ba.constEnd(); - parseValue(from, to); -} - -JsonValue JsonValue::findChild(const char *name) const -{ - for (int i = 0; i < m_children.size(); ++i) - if (m_children.at(i).m_name == name) - return m_children.at(i); - return JsonValue(); -} - -void JsonInputStream::appendCString(const char *s) -{ - m_target.append('"'); - for (const char *p = s; *p; p++) { - if (*p == '"' || *p == '\\') - m_target.append('\\'); - m_target.append(*p); - } - m_target.append('"'); -} - -void JsonInputStream::appendString(const QString &in) -{ - if (in.isEmpty()) { - m_target.append("\"\""); - return; - } - - const QChar doubleQuote('"'); - const QChar backSlash('\\'); - QString rc; - const int inSize = in.size(); - rc.reserve(in.size() + 5); - rc.append(doubleQuote); - for (int i = 0; i < inSize; i++) { - const QChar c = in.at(i); - if (c == doubleQuote || c == backSlash) - rc.append(backSlash); - rc.append(c); - } - rc.append(doubleQuote); - m_target.append(rc.toUtf8()); - return; -} - -JsonInputStream &JsonInputStream::operator<<(const QStringList &in) -{ - m_target.append('['); - const int count = in.size(); - for (int i = 0 ; i < count; i++) { - if (i) - m_target.append(','); - appendString(in.at(i)); - } - m_target.append(']'); - return *this; -} - -JsonInputStream &JsonInputStream::operator<<(const QVector &ba) -{ - m_target.append('['); - const int count = ba.size(); - for (int i = 0 ; i < count; i++) { - if (i) - m_target.append(','); - appendCString(ba.at(i).constData()); - } - m_target.append(']'); - return *this; -} - -JsonInputStream &JsonInputStream::operator<<(const QList &in) -{ - m_target.append('['); - const int count = in.size(); - for (int i = 0 ; i < count; i++) { - if (i) - m_target.append(','); - m_target.append(QByteArray::number(in.at(i))); - } - m_target.append(']'); - return *this; -} - -JsonInputStream &JsonInputStream::operator<<(bool b) -{ - m_target.append(b ? "true" : "false"); - return *this; -} - - diff --git a/src/shared/json/json.h b/src/shared/json/json.h deleted file mode 100644 index 619397f64bd..00000000000 --- a/src/shared/json/json.h +++ /dev/null @@ -1,143 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: http://www.qt-project.org/ -** -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -**************************************************************************/ - -#ifndef JSON_H -#define JSON_H - -#include "json_global.h" - -#include -#include -#include - -namespace Json { - -class JSON_EXPORT JsonValue -{ -public: - JsonValue() : m_type(Invalid) {} - explicit JsonValue(const QByteArray &str) { fromString(str); } - - QByteArray m_name; - QByteArray m_data; - QList m_children; - - enum Type { - Invalid, - String, - Number, - Boolean, - Object, - NullObject, - Array - }; - - Type m_type; - - inline Type type() const { return m_type; } - inline QByteArray name() const { return m_name; } - inline bool hasName(const char *name) const { return m_name == name; } - - inline bool isValid() const { return m_type != Invalid; } - inline bool isNumber() const { return m_type == Number; } - inline bool isString() const { return m_type == String; } - inline bool isObject() const { return m_type == Object; } - inline bool isArray() const { return m_type == Array; } - - - inline QByteArray data() const { return m_data; } - inline const QList &children() const { return m_children; } - inline int childCount() const { return m_children.size(); } - - const JsonValue &childAt(int index) const { return m_children[index]; } - JsonValue &childAt(int index) { return m_children[index]; } - JsonValue findChild(const char *name) const; - - QByteArray toString(bool multiline = false, int indent = 0) const; - void fromString(const QByteArray &str); - void setStreamOutput(const QByteArray &name, const QByteArray &content); - - QVariant toVariant() const; - -private: - static QByteArray parseCString(const char *&from, const char *to); - static QByteArray parseNumber(const char *&from, const char *to); - static QByteArray escapeCString(const QByteArray &ba); - static QString escapeCString(const QString &ba); - void parsePair(const char *&from, const char *to); - void parseValue(const char *&from, const char *to); - void parseObject(const char *&from, const char *to); - void parseArray(const char *&from, const char *to); - - void dumpChildren(QByteArray *str, bool multiline, int indent) const; -}; - -/* Thin wrapper around QByteArray for formatting JSON input. Use as in: - * JsonInputStream(byteArray) << '{' << "bla" << ':' << "blup" << '}'; - * Note that strings get double quotes and JSON-escaping, characters should be - * used for the array/hash delimiters. - * */ -class JSON_EXPORT JsonInputStream { -public: - explicit JsonInputStream(QByteArray &a) : m_target(a) {} - - JsonInputStream &operator<<(char c) { m_target.append(c); return *this; } - JsonInputStream &operator<<(const char *c) { appendCString(c); return *this; } - JsonInputStream &operator<<(const QByteArray &a) { appendCString(a.constData()); return *this; } - JsonInputStream &operator<<(const QString &c) { appendString(c); return *this; } - - // Format as array - JsonInputStream &operator<<(const QStringList &c); - - // Format as array - JsonInputStream &operator<<(const QVector &ba); - - //Format as array - JsonInputStream &operator<<(const QList &in); - - JsonInputStream &operator<<(bool b); - - JsonInputStream &operator<<(int i) - { m_target.append(QByteArray::number(i)); return *this; } - JsonInputStream &operator<<(unsigned i) - { m_target.append(QByteArray::number(i)); return *this; } - JsonInputStream &operator<<(quint64 i) - { m_target.append(QByteArray::number(i)); return *this; } - -private: - void appendString(const QString &); - void appendCString(const char *c); - - QByteArray &m_target; -}; - -} //namespace Json - -#endif // JSON_H diff --git a/src/shared/json/json.pri b/src/shared/json/json.pri deleted file mode 100644 index 088fc4cb4e4..00000000000 --- a/src/shared/json/json.pri +++ /dev/null @@ -1,7 +0,0 @@ -INCLUDEPATH *= $$PWD - -# Input -HEADERS += $$PWD/json_global.h \ - $$PWD/json.h - -SOURCES += $$PWD/json.cpp diff --git a/src/shared/json/json_global.h b/src/shared/json/json_global.h deleted file mode 100644 index 910bb0948b9..00000000000 --- a/src/shared/json/json_global.h +++ /dev/null @@ -1,44 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: http://www.qt-project.org/ -** -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -**************************************************************************/ - -#ifndef JSON_GLOBAL_H -#define JSON_GLOBAL_H - -#include - -#if defined(JSON_BUILD_LIB) -# define JSON_EXPORT Q_DECL_EXPORT -#elif defined(JSON_BUILD_STATIC_LIB) || defined(JSON_INCLUDE_PRI) -# define JSON_EXPORT -#else -# define JSON_EXPORT Q_DECL_IMPORT -#endif - -#endif // JSON_GLOBAL_H diff --git a/tests/auto/debugger/dumpers.pro b/tests/auto/debugger/dumpers.pro index ed83ea9621d..3f7e2959723 100644 --- a/tests/auto/debugger/dumpers.pro +++ b/tests/auto/debugger/dumpers.pro @@ -1,11 +1,9 @@ greaterThan(QT_MAJOR_VERSION, 4): QT += core-private include(../qttest.pri) -include($$IDE_SOURCE_TREE/src/shared/json/json.pri) include($$IDE_SOURCE_TREE/src/libs/utils/utils.pri) -DEFINES += JSON_INCLUDE_PRI DEBUGGERDIR = $$IDE_SOURCE_TREE/src/plugins/debugger -UTILSDIR = $$IDE_SOURCE_TREE/src/libs +UTILSDIR = $$IDE_SOURCE_TREE/src/libs/utils MACROSDIR = $$IDE_SOURCE_TREE/share/qtcreator/dumper SOURCES += \ diff --git a/tests/auto/debugger/tst_dumpers.cpp b/tests/auto/debugger/tst_dumpers.cpp index 972f683b521..e63937ee19c 100644 --- a/tests/auto/debugger/tst_dumpers.cpp +++ b/tests/auto/debugger/tst_dumpers.cpp @@ -164,7 +164,7 @@ public: void testJson(const char* input) { - QCOMPARE('\n' + QString::fromLatin1(Json::JsonValue(input).toString(false)), + QCOMPARE('\n' + Utils::JsonStringValue(QLatin1String(input)).value(), '\n' + QString(input)); } From 5fdb9f0df92e14c3ab92a0c34dfbbd0956131c2c Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Thu, 30 Aug 2012 16:25:33 +0200 Subject: [PATCH 39/39] Debugger: Add more C++ keywords. Change-Id: I127a33939bd46945d2cfd47f70ee72cb50a986c7 Reviewed-by: hjk --- src/plugins/debugger/watchutils.cpp | 63 ++++++++++++++++++++++++----- 1 file changed, 53 insertions(+), 10 deletions(-) diff --git a/src/plugins/debugger/watchutils.cpp b/src/plugins/debugger/watchutils.cpp index 2e2fb334579..c5f142d6ea9 100644 --- a/src/plugins/debugger/watchutils.cpp +++ b/src/plugins/debugger/watchutils.cpp @@ -280,16 +280,59 @@ bool hasSideEffects(const QString &exp) bool isKeyWord(const QString &exp) { // FIXME: incomplete - return exp == QLatin1String("class") - || exp == QLatin1String("const") - || exp == QLatin1String("do") - || exp == QLatin1String("if") - || exp == QLatin1String("return") - || exp == QLatin1String("struct") - || exp == QLatin1String("template") - || exp == QLatin1String("void") - || exp == QLatin1String("volatile") - || exp == QLatin1String("while"); + QTC_ASSERT(!exp.isEmpty(), return false); + switch (exp.at(0).toAscii()) { + case 'a': + return exp == QLatin1String("auto"); + case 'b': + return exp == QLatin1String("break"); + case 'c': + return exp == QLatin1String("case") || exp == QLatin1String("class") + || exp == QLatin1String("const") || exp == QLatin1String("constexpr") + || exp == QLatin1String("catch") || exp == QLatin1String("continue") + || exp == QLatin1String("const_cast"); + case 'd': + return exp == QLatin1String("do") || exp == QLatin1String("default") + || exp == QLatin1String("delete") || exp == QLatin1String("decltype") + || exp == QLatin1String("dynamic_cast"); + case 'e': + return exp == QLatin1String("else") || exp == QLatin1String("extern") + || exp == QLatin1String("enum") || exp == QLatin1String("explicit"); + case 'f': + return exp == QLatin1String("for") || exp == QLatin1String("friend"); // 'final'? + case 'g': + return exp == QLatin1String("goto"); + case 'i': + return exp == QLatin1String("if") || exp == QLatin1String("inline"); + case 'n': + return exp == QLatin1String("new") || exp == QLatin1String("namespace") + || exp == QLatin1String("noexcept"); + case 'm': + return exp == QLatin1String("mutable"); + case 'o': + return exp == QLatin1String("operator"); // 'override'? + case 'p': + return exp == QLatin1String("public") || exp == QLatin1String("protected") + || exp == QLatin1String("private"); + case 'r': + return exp == QLatin1String("return") || exp == QLatin1String("register") + || exp == QLatin1String("reinterpret_cast"); + case 's': + return exp == QLatin1String("struct") || exp == QLatin1String("switch") + || exp == QLatin1String("static_cast"); + case 't': + return exp == QLatin1String("template") || exp == QLatin1String("typename") + || exp == QLatin1String("try") || exp == QLatin1String("throw") + || exp == QLatin1String("typedef"); + case 'u': + return exp == QLatin1String("union") || exp == QLatin1String("using"); + case 'v': + return exp == QLatin1String("void") || exp == QLatin1String("volatile") + || exp == QLatin1String("virtual"); + case 'w': + return exp == QLatin1String("while"); + } + return false; } bool startsWithDigit(const QString &str)