From 9f93c7016e2ad24bea7a31ff9a9e46a0f95dabd8 Mon Sep 17 00:00:00 2001 From: dt Date: Mon, 6 Apr 2009 14:40:46 +0200 Subject: [PATCH 01/31] Fix slowness of Locator if the string was "f \" or "f /". The way we constructed the paths was just wrong, so we ended up resolving lots of UNC paths. --- src/plugins/quickopen/filesystemfilter.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/quickopen/filesystemfilter.cpp b/src/plugins/quickopen/filesystemfilter.cpp index 7edc7f34f1c..a776bdc4e0a 100644 --- a/src/plugins/quickopen/filesystemfilter.cpp +++ b/src/plugins/quickopen/filesystemfilter.cpp @@ -74,14 +74,14 @@ QList FileSystemFilter::matchesFor(const QString &entry) QDir::Name|QDir::IgnoreCase|QDir::LocaleAware); foreach (const QString &dir, dirs) { if (dir != "." && (name.isEmpty() || dir.startsWith(name, Qt::CaseInsensitive))) { - FilterEntry entry(this, dir, directory + "/" + dir); + FilterEntry entry(this, dir, dirInfo.filePath(dir)); entry.resolveFileIcon = true; value.append(entry); } } foreach (const QString &file, files) { if (name.isEmpty() || file.startsWith(name, Qt::CaseInsensitive)) { - const QString fullPath = directory + "/" + file; + const QString fullPath = dirInfo.filePath(file); FilterEntry entry(this, file, fullPath); entry.resolveFileIcon = true; value.append(entry); From 6a55ca9776c9fc5d6cce0bc0240b7437620cd49f Mon Sep 17 00:00:00 2001 From: dt Date: Mon, 6 Apr 2009 15:23:27 +0200 Subject: [PATCH 02/31] Make .user files a little more robust to be used in different paths Save a relative path to the .pro file. This means RunConfigurations can now be shared between platforms. Note: BuildConfigurations have two problems: The qt version id and the shadow build option. If the user doesn't use those two, then he is fine. --- src/plugins/qt4projectmanager/qt4runconfiguration.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/plugins/qt4projectmanager/qt4runconfiguration.cpp b/src/plugins/qt4projectmanager/qt4runconfiguration.cpp index 0522fab8d35..f3cfed80025 100644 --- a/src/plugins/qt4projectmanager/qt4runconfiguration.cpp +++ b/src/plugins/qt4projectmanager/qt4runconfiguration.cpp @@ -37,6 +37,7 @@ #include #include #include +#include #include #include @@ -225,8 +226,9 @@ QWidget *Qt4RunConfiguration::configurationWidget() void Qt4RunConfiguration::save(PersistentSettingsWriter &writer) const { + QDir projectDir(QFileInfo(project()->file()->fileName()).absoluteDir()); writer.saveValue("CommandLineArguments", m_commandLineArguments); - writer.saveValue("ProFile", m_proFilePath); + writer.saveValue("ProFile", projectDir.relativeFilePath(m_proFilePath)); writer.saveValue("UserSetName", m_userSetName); writer.saveValue("UseTerminal", m_runMode == Console); writer.saveValue("UseDyldImageSuffix", m_isUsingDyldImageSuffix); @@ -234,10 +236,11 @@ void Qt4RunConfiguration::save(PersistentSettingsWriter &writer) const } void Qt4RunConfiguration::restore(const PersistentSettingsReader &reader) -{ +{ ApplicationRunConfiguration::restore(reader); + QDir projectDir(QFileInfo(project()->file()->fileName()).absoluteDir()); m_commandLineArguments = reader.restoreValue("CommandLineArguments").toStringList(); - m_proFilePath = reader.restoreValue("ProFile").toString(); + m_proFilePath = projectDir.filePath(reader.restoreValue("ProFile").toString()); m_userSetName = reader.restoreValue("UserSetName").toBool(); m_runMode = reader.restoreValue("UseTerminal").toBool() ? Console : Gui; m_isUsingDyldImageSuffix = reader.restoreValue("UseDyldImageSuffix").toBool(); From 3b6d8b8f4d27456587f259f1d93ee9a260ad2267 Mon Sep 17 00:00:00 2001 From: dt Date: Mon, 6 Apr 2009 17:01:26 +0200 Subject: [PATCH 03/31] Add the ability to add Runconfigurations for cmake-targets we know about Task: 250415 --- .../cmakeprojectmanager/cmakeproject.cpp | 45 ++++++++++++------- .../cmakeprojectmanager/cmakeproject.h | 1 + .../cmakerunconfiguration.cpp | 13 +++--- 3 files changed, 38 insertions(+), 21 deletions(-) diff --git a/src/plugins/cmakeprojectmanager/cmakeproject.cpp b/src/plugins/cmakeprojectmanager/cmakeproject.cpp index d0229bd8b11..b66ebb70c6a 100644 --- a/src/plugins/cmakeprojectmanager/cmakeproject.cpp +++ b/src/plugins/cmakeprojectmanager/cmakeproject.cpp @@ -207,30 +207,30 @@ void CMakeProject::parseCMakeLists() // Create run configurations for m_targets //qDebug()<<"Create run configurations of m_targets"; - QMap > existingRunConfigurations; + QMultiMap > existingRunConfigurations; foreach(QSharedPointer cmakeRunConfiguration, runConfigurations()) { if (QSharedPointer rc = cmakeRunConfiguration.dynamicCast()) { existingRunConfigurations.insert(rc->title(), rc); } } - bool setActive = false; + bool setActive = existingRunConfigurations.isEmpty(); foreach(const CMakeTarget &ct, m_targets) { if (ct.executable.isEmpty()) continue; if (ct.title.endsWith("/fast")) continue; - QMap >::iterator it = - existingRunConfigurations.find(ct.title); - if (it != existingRunConfigurations.end()) { + QList > list = existingRunConfigurations.values(ct.title); + if (!list.isEmpty()) { // Already exists, so override the settings... - QSharedPointer rc = it.value(); - //qDebug()<<"Updating Run Configuration with title"<executable(); - //qDebug()<<" WD new:"<workingDirectory(); - rc->setExecutable(ct.executable); - rc->setWorkingDirectory(ct.workingDirectory); - existingRunConfigurations.erase(it); + foreach (QSharedPointer rc, list) { + //qDebug()<<"Updating Run Configuration with title"<executable(); + //qDebug()<<" WD new:"<workingDirectory(); + rc->setExecutable(ct.executable); + rc->setWorkingDirectory(ct.workingDirectory); + } + existingRunConfigurations.remove(ct.title); } else { // Does not exist yet //qDebug()<<"Adding new run configuration with title"< rc(new CMakeRunConfiguration(this, ct.executable, ct.workingDirectory, ct.title)); addRunConfiguration(rc); // The first one gets the honour of beeing the active one - if (!setActive) { + if (setActive) { setActiveRunConfiguration(rc); - setActive = true; + setActive = false; } } } - QMap >::const_iterator it = + QMultiMap >::const_iterator it = existingRunConfigurations.constBegin(); for( ; it != existingRunConfigurations.constEnd(); ++it) { QSharedPointer rc = it.value(); @@ -282,8 +282,13 @@ QString CMakeProject::buildParser(const QString &buildConfiguration) const QStringList CMakeProject::targets() const { QStringList results; - foreach (const CMakeTarget &ct, m_targets) + foreach (const CMakeTarget &ct, m_targets) { + if (ct.executable.isEmpty()) + continue; + if (ct.title.endsWith("/fast")) + continue; results << ct.title; + } return results; } @@ -526,6 +531,14 @@ void CMakeProject::restoreSettingsImpl(ProjectExplorer::PersistentSettingsReader parseCMakeLists(); // Gets the directory from the active buildconfiguration } +CMakeTarget CMakeProject::targetForTitle(const QString &title) +{ + foreach(const CMakeTarget &ct, m_targets) + if (ct.title == title) + return ct; + return CMakeTarget(); +} + CMakeFile::CMakeFile(CMakeProject *parent, QString fileName) : Core::IFile(parent), m_project(parent), m_fileName(fileName) { diff --git a/src/plugins/cmakeprojectmanager/cmakeproject.h b/src/plugins/cmakeprojectmanager/cmakeproject.h index 74b1a2f0eec..90934d1bcbb 100644 --- a/src/plugins/cmakeprojectmanager/cmakeproject.h +++ b/src/plugins/cmakeprojectmanager/cmakeproject.h @@ -101,6 +101,7 @@ public: MakeStep *makeStep() const; QStringList targets() const; QString buildParser(const QString &buildConfiguration) const; + CMakeTarget targetForTitle(const QString &title); protected: virtual void saveSettingsImpl(ProjectExplorer::PersistentSettingsWriter &writer); diff --git a/src/plugins/cmakeprojectmanager/cmakerunconfiguration.cpp b/src/plugins/cmakeprojectmanager/cmakerunconfiguration.cpp index bef4185ba94..817eeb35c3e 100644 --- a/src/plugins/cmakeprojectmanager/cmakerunconfiguration.cpp +++ b/src/plugins/cmakeprojectmanager/cmakerunconfiguration.cpp @@ -168,8 +168,11 @@ QStringList CMakeRunConfigurationFactory::canCreate(ProjectExplorer::Project *pr CMakeProject *pro = qobject_cast(project); if (!pro) return QStringList(); - // TODO gather all targets and return them here - return QStringList(); + QStringList allTargets = pro->targets(); + for (int i=0; i CMakeRunConfigurationFactory:: return rc; } else { // Adding new - // TODO extract target from type - QString file = type.mid(QString(Constants::CMAKERUNCONFIGURATION).length()); - QSharedPointer rc(new CMakeRunConfiguration(pro, file, QString::null, QString::null)); + const QString title = type.mid(QString(Constants::CMAKERUNCONFIGURATION).length()); + const CMakeTarget &ct = pro->targetForTitle(title); + QSharedPointer rc(new CMakeRunConfiguration(pro, ct.executable, ct.workingDirectory, ct.title)); return rc; } } From 16be88e992e3aa78e2018d3e76f254ced10e3b5e Mon Sep 17 00:00:00 2001 From: dt Date: Mon, 6 Apr 2009 17:07:51 +0200 Subject: [PATCH 04/31] Make the layout of the CMakeRunPage nicer. --- .../cmakeprojectmanager/cmakeopenprojectwizard.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/plugins/cmakeprojectmanager/cmakeopenprojectwizard.cpp b/src/plugins/cmakeprojectmanager/cmakeopenprojectwizard.cpp index 4c70858bcc1..e1c0700c13a 100644 --- a/src/plugins/cmakeprojectmanager/cmakeopenprojectwizard.cpp +++ b/src/plugins/cmakeprojectmanager/cmakeopenprojectwizard.cpp @@ -239,13 +239,19 @@ void CMakeRunPage::initWidgets() fl->addRow(m_descriptionLabel); m_argumentsLineEdit = new QLineEdit(this); - fl->addRow(tr("Arguments:"), m_argumentsLineEdit); - + //fl->addRow(tr("Arguments:"), m_argumentsLineEdit); m_runCMake = new QPushButton(this); - m_runCMake->setText("Run CMake"); + m_runCMake->setText(tr("Run CMake")); connect(m_runCMake, SIGNAL(clicked()), this, SLOT(runCMake())); - fl->addWidget(m_runCMake); + //fl->addWidget(m_runCMake); + + QHBoxLayout *hbox = new QHBoxLayout; + hbox->addWidget(m_argumentsLineEdit); + hbox->addWidget(m_runCMake); + + fl->addRow(tr("Arguments"), hbox); + m_output = new QPlainTextEdit(this); m_output->setReadOnly(true); From eb1b86ef868a9056fcfcdaacbcc81526797cbaae Mon Sep 17 00:00:00 2001 From: Roberto Raggi Date: Tue, 7 Apr 2009 10:57:47 +0200 Subject: [PATCH 05/31] Don't mention the ObjC++ support. ObjC needs a lot of work and we won't have time to finish it in time for 1.1. --- dist/changes-1.1.0 | 1 - 1 file changed, 1 deletion(-) diff --git a/dist/changes-1.1.0 b/dist/changes-1.1.0 index ca31d5783c2..a1166c2a82f 100644 --- a/dist/changes-1.1.0 +++ b/dist/changes-1.1.0 @@ -13,7 +13,6 @@ General * Completely reworked editor split mechanism. Editing - * Some support for Obj-C++ //TODO: what does that mean more concrete? * Some support for doxygen style comments //TODO: what does that mean more concrete? * Improved function argument hint. * More checkpoints in editor history. From d7d8ed6d95b2d2d8db6ac3c07dfaab52fe5e05f7 Mon Sep 17 00:00:00 2001 From: Roberto Raggi Date: Tue, 7 Apr 2009 11:02:20 +0200 Subject: [PATCH 06/31] Updated the changes for 1.1 --- dist/changes-1.1.0 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dist/changes-1.1.0 b/dist/changes-1.1.0 index a1166c2a82f..207a086fb06 100644 --- a/dist/changes-1.1.0 +++ b/dist/changes-1.1.0 @@ -13,7 +13,8 @@ General * Completely reworked editor split mechanism. Editing - * Some support for doxygen style comments //TODO: what does that mean more concrete? + * Added support for JavaScript. + * Added syntax highlighting and code completion for qdoc and doxygen tags. * Improved function argument hint. * More checkpoints in editor history. * Ctrl-click for jumping to a symbol definition. From 8e16a02acfa816158cbcc94b7385450d5da5eea8 Mon Sep 17 00:00:00 2001 From: hjk Date: Tue, 7 Apr 2009 11:24:00 +0200 Subject: [PATCH 07/31] debugger: fix script debugger startup --- src/plugins/debugger/scriptengine.cpp | 77 ++++++++++++++++----------- src/plugins/debugger/scriptengine.h | 2 +- 2 files changed, 47 insertions(+), 32 deletions(-) diff --git a/src/plugins/debugger/scriptengine.cpp b/src/plugins/debugger/scriptengine.cpp index cf9e4827a72..75513042ee4 100644 --- a/src/plugins/debugger/scriptengine.cpp +++ b/src/plugins/debugger/scriptengine.cpp @@ -63,6 +63,12 @@ using namespace Debugger; using namespace Debugger::Internal; using namespace Debugger::Constants; +//#define DEBUG_SCRIPT 1 +#if DEBUG_SCRIPT +# define SDEBUG(s) qDebug() << s +#else +# define SDEBUG(s) +#endif /////////////////////////////////////////////////////////////////////// // @@ -100,24 +106,29 @@ ScriptAgent::ScriptAgent(ScriptEngine *debugger, QScriptEngine *script) void ScriptAgent::contextPop() { - qDebug() << "ScriptAgent::contextPop: "; + SDEBUG("ScriptAgent::contextPop: "); } void ScriptAgent::contextPush() { - qDebug() << "ScriptAgent::contextPush: "; + SDEBUG("ScriptAgent::contextPush: "); } void ScriptAgent::exceptionCatch(qint64 scriptId, const QScriptValue & exception) { - qDebug() << "ScriptAgent::exceptionCatch: " << scriptId << &exception; + Q_UNUSED(scriptId); + Q_UNUSED(exception); + SDEBUG("ScriptAgent::exceptionCatch: " << scriptId << &exception); } void ScriptAgent::exceptionThrow(qint64 scriptId, const QScriptValue &exception, bool hasHandler) { - qDebug() << "ScriptAgent::exceptionThrow: " << scriptId << &exception - << hasHandler; + Q_UNUSED(scriptId); + Q_UNUSED(exception); + Q_UNUSED(hasHandler); + SDEBUG("ScriptAgent::exceptionThrow: " << scriptId << &exception + << hasHandler); } void ScriptAgent::functionEntry(qint64 scriptId) @@ -128,12 +139,14 @@ void ScriptAgent::functionEntry(qint64 scriptId) void ScriptAgent::functionExit(qint64 scriptId, const QScriptValue &returnValue) { - qDebug() << "ScriptAgent::functionExit: " << scriptId << &returnValue; + Q_UNUSED(scriptId); + Q_UNUSED(returnValue); + SDEBUG("ScriptAgent::functionExit: " << scriptId << &returnValue); } void ScriptAgent::positionChange(qint64 scriptId, int lineNumber, int columnNumber) { - //qDebug() << "ScriptAgent::position: " << lineNumber; + SDEBUG("ScriptAgent::position: " << lineNumber); Q_UNUSED(scriptId); Q_UNUSED(lineNumber); Q_UNUSED(columnNumber); @@ -147,14 +160,14 @@ void ScriptAgent::scriptLoad(qint64 scriptId, const QString &program, Q_UNUSED(program); Q_UNUSED(fileName); Q_UNUSED(baseLineNumber); - //qDebug() << "ScriptAgent::scriptLoad: " << program << fileName - // << baseLineNumber; + SDEBUG("ScriptAgent::scriptLoad: " << program << fileName + << baseLineNumber); } void ScriptAgent::scriptUnload(qint64 scriptId) { Q_UNUSED(scriptId); - //qDebug() << "ScriptAgent::scriptUnload: " << scriptId; + SDEBUG("ScriptAgent::scriptUnload: " << scriptId); } @@ -181,7 +194,7 @@ ScriptEngine::~ScriptEngine() void ScriptEngine::executeDebuggerCommand(const QString &command) { Q_UNUSED(command); - qDebug() << "FIXME: ScriptEngine::executeDebuggerCommand()"; + SDEBUG("FIXME: ScriptEngine::executeDebuggerCommand()"); } void ScriptEngine::shutdown() @@ -191,7 +204,7 @@ void ScriptEngine::shutdown() void ScriptEngine::exitDebugger() { - //qDebug() << " ScriptEngine::exitDebugger()"; + SDEBUG("ScriptEngine::exitDebugger()"); m_stopped = false; m_stopOnNextLine = false; m_scriptEngine->abortEvaluation(); @@ -212,19 +225,21 @@ bool ScriptEngine::startDebugger() m_scriptContents = stream.readAll(); scriptFile.close(); attemptBreakpointSynchronization(); + qq->notifyInferiorRunningRequested(); + QTimer::singleShot(0, this, SLOT(runInferior())); return true; } void ScriptEngine::continueInferior() { - //qDebug() << "ScriptEngine::continueInferior()"; + SDEBUG("ScriptEngine::continueInferior()"); m_stopped = false; m_stopOnNextLine = false; } void ScriptEngine::runInferior() { - //qDebug() << "ScriptEngine::runInferior()"; + SDEBUG("ScriptEngine::runInferior()"); QScriptValue result = m_scriptEngine->evaluate(m_scriptContents, m_scriptFileName); } @@ -232,40 +247,40 @@ void ScriptEngine::interruptInferior() { m_stopped = false; m_stopOnNextLine = true; - qDebug() << "FIXME: ScriptEngine::interruptInferior()"; + SDEBUG("FIXME: ScriptEngine::interruptInferior()"); } void ScriptEngine::stepExec() { - //qDebug() << "FIXME: ScriptEngine::stepExec()"; + //SDEBUG("FIXME: ScriptEngine::stepExec()"); m_stopped = false; m_stopOnNextLine = true; } void ScriptEngine::stepIExec() { - //qDebug() << "FIXME: ScriptEngine::stepIExec()"; + //SDEBUG("FIXME: ScriptEngine::stepIExec()"); m_stopped = false; m_stopOnNextLine = true; } void ScriptEngine::stepOutExec() { - //qDebug() << "FIXME: ScriptEngine::stepOutExec()"; + //SDEBUG("FIXME: ScriptEngine::stepOutExec()"); m_stopped = false; m_stopOnNextLine = true; } void ScriptEngine::nextExec() { - //qDebug() << "FIXME: ScriptEngine::nextExec()"; + //SDEBUG("FIXME: ScriptEngine::nextExec()"); m_stopped = false; m_stopOnNextLine = true; } void ScriptEngine::nextIExec() { - //qDebug() << "FIXME: ScriptEngine::nextIExec()"; + //SDEBUG("FIXME: ScriptEngine::nextIExec()"); m_stopped = false; m_stopOnNextLine = true; } @@ -274,20 +289,20 @@ void ScriptEngine::runToLineExec(const QString &fileName, int lineNumber) { Q_UNUSED(fileName); Q_UNUSED(lineNumber); - qDebug() << "FIXME: ScriptEngine::runToLineExec()"; + SDEBUG("FIXME: ScriptEngine::runToLineExec()"); } void ScriptEngine::runToFunctionExec(const QString &functionName) { Q_UNUSED(functionName); - qDebug() << "FIXME: ScriptEngine::runToFunctionExec()"; + SDEBUG("FIXME: ScriptEngine::runToFunctionExec()"); } void ScriptEngine::jumpToLineExec(const QString &fileName, int lineNumber) { Q_UNUSED(fileName); Q_UNUSED(lineNumber); - qDebug() << "FIXME: ScriptEngine::jumpToLineExec()"; + SDEBUG("FIXME: ScriptEngine::jumpToLineExec()"); } void ScriptEngine::activateFrame(int index) @@ -381,7 +396,7 @@ void ScriptEngine::setToolTipExpression(const QPoint &pos, const QString &exp0) Q_UNUSED(exp0); if (q->status() != DebuggerInferiorStopped) { - //qDebug() << "SUPPRESSING DEBUGGER TOOLTIP, INFERIOR NOT STOPPED"; + //SDEBUG("SUPPRESSING DEBUGGER TOOLTIP, INFERIOR NOT STOPPED"); return; } @@ -493,7 +508,7 @@ void ScriptEngine::maybeBreakNow(bool byFunction) return; // we just run into a breakpoint - //qDebug() << "RESOLVING BREAKPOINT AT " << fileName << lineNumber; + //SDEBUG("RESOLVING BREAKPOINT AT " << fileName << lineNumber); BreakpointData *data = handler->at(index); data->bpLineNumber = QString::number(lineNumber); data->bpFileName = fileName; @@ -508,7 +523,7 @@ void ScriptEngine::maybeBreakNow(bool byFunction) q->gotoLocation(fileName, lineNumber, true); qq->watchHandler()->reinitializeWatchers(); - //qDebug() << "UPDATE LOCALS"; + //SDEBUG("UPDATE LOCALS"); // // Build stack @@ -545,10 +560,10 @@ void ScriptEngine::maybeBreakNow(bool byFunction) // FIXME: Use an extra thread. This here is evil m_stopped = true; while (m_stopped) { - //qDebug() << "LOOPING"; + //SDEBUG("LOOPING"); QApplication::processEvents(); } - //qDebug() << "RUNNING AGAIN"; + //SDEBUG("RUNNING AGAIN"); } void ScriptEngine::updateWatchModel() @@ -567,7 +582,7 @@ void ScriptEngine::updateWatchModel() void ScriptEngine::updateSubItem(const WatchData &data0) { WatchData data = data0; - //qDebug() << "\nUPDATE SUBITEM: " << data.toString(); + //SDEBUG("\nUPDATE SUBITEM: " << data.toString()); QTC_ASSERT(data.isValid(), return); if (data.isTypeNeeded() || data.isValueNeeded()) { @@ -641,7 +656,7 @@ void ScriptEngine::updateSubItem(const WatchData &data0) qq->watchHandler()->insertData(data1); ++numChild; } - //qDebug() << " ... CHILDREN: " << numChild; + //SDEBUG(" ... CHILDREN: " << numChild); data.setChildCount(numChild); data.setChildrenUnneeded(); qq->watchHandler()->insertData(data); @@ -656,7 +671,7 @@ void ScriptEngine::updateSubItem(const WatchData &data0) ++numChild; } data.setChildCount(numChild); - //qDebug() << " ... CHILDCOUNT: " << numChild; + //SDEBUG(" ... CHILDCOUNT: " << numChild); qq->watchHandler()->insertData(data); return; } diff --git a/src/plugins/debugger/scriptengine.h b/src/plugins/debugger/scriptengine.h index e42e8d63a93..33e102e750f 100644 --- a/src/plugins/debugger/scriptengine.h +++ b/src/plugins/debugger/scriptengine.h @@ -82,7 +82,7 @@ private: void exitDebugger(); void continueInferior(); - void runInferior(); + Q_SLOT void runInferior(); void interruptInferior(); void runToLineExec(const QString &fileName, int lineNumber); From c95f079fc0aa53aab0ffea9ec093187490747ecf Mon Sep 17 00:00:00 2001 From: dt Date: Tue, 7 Apr 2009 11:59:26 +0200 Subject: [PATCH 08/31] Fixes: Recent Projectsd list all cmake projects as CMakeLists.txt Required a few changes to pass on the displayName everywhere. Task-number: 250402 --- src/plugins/coreplugin/welcomemode.cpp | 11 ++- src/plugins/coreplugin/welcomemode.h | 3 +- .../projectexplorer/projectexplorer.cpp | 76 ++++++++++++++----- src/plugins/projectexplorer/projectexplorer.h | 6 +- 4 files changed, 71 insertions(+), 25 deletions(-) diff --git a/src/plugins/coreplugin/welcomemode.cpp b/src/plugins/coreplugin/welcomemode.cpp index a31e1965b10..05fd51f15af 100644 --- a/src/plugins/coreplugin/welcomemode.cpp +++ b/src/plugins/coreplugin/welcomemode.cpp @@ -233,10 +233,13 @@ void WelcomeMode::updateWelcomePage(const WelcomePageData &welcomePageData) { QString projects; QTextStream str(&projects); - foreach (const QString &s, welcomePageData.projectList) { - const QFileInfo fi(s); - str << "
  • " << fi.fileName() << "

  • \n"; + + QList >::const_iterator it, end; + end = welcomePageData.projectList.constEnd(); + for( it = welcomePageData.projectList.constBegin(); it != end; ++it) { + const QFileInfo fi((*it).first); + str << "
  • " << (*it).second << "

  • \n"; } projectHtml.replace(QLatin1String(""), projects); } diff --git a/src/plugins/coreplugin/welcomemode.h b/src/plugins/coreplugin/welcomemode.h index 00358e4c01f..5b4228b8b8b 100644 --- a/src/plugins/coreplugin/welcomemode.h +++ b/src/plugins/coreplugin/welcomemode.h @@ -33,6 +33,7 @@ #include #include +#include QT_BEGIN_NAMESPACE class QWidget; @@ -59,7 +60,7 @@ public: QString previousSession; QString activeSession; QStringList sessionList; - QStringList projectList; + QList > projectList; // pair of filename, displayname }; void updateWelcomePage(const WelcomePageData &welcomePageData); diff --git a/src/plugins/projectexplorer/projectexplorer.cpp b/src/plugins/projectexplorer/projectexplorer.cpp index a975c2bcecd..56058e782b5 100644 --- a/src/plugins/projectexplorer/projectexplorer.cpp +++ b/src/plugins/projectexplorer/projectexplorer.cpp @@ -602,16 +602,34 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er addAutoReleasedObject(new ProjectTreeWidgetFactory); addAutoReleasedObject(new FolderNavigationWidgetFactory); + QStringList oldRecentProjects; if (QSettings *s = core->settings()) - m_recentProjects = s->value("ProjectExplorer/RecentProjects/Files", QStringList()).toStringList(); - for (QStringList::iterator it = m_recentProjects.begin(); it != m_recentProjects.end(); ) { + oldRecentProjects = s->value("ProjectExplorer/RecentProjects/Files", QStringList()).toStringList(); + for (QStringList::iterator it = oldRecentProjects.begin(); it != oldRecentProjects.end(); ) { if (QFileInfo(*it).isFile()) { ++it; } else { - it = m_recentProjects.erase(it); + it = oldRecentProjects.erase(it); } } + foreach(const QString &s, oldRecentProjects) { + m_recentProjects.append(qMakePair(s, QFileInfo(s).fileName())); + } + + // TODO restore recentProjects + if (QSettings *s = core->settings()) { + const QStringList fileNames = s->value("ProjectExplorer/RecentProjects/FileNames").toStringList(); + const QStringList displayNames = s->value("ProjectExplorer/RecentProjects/DisplayNames").toStringList(); + if (fileNames.size() == displayNames.size()) { + for (int i = 0; i < fileNames.size(); ++i) { + m_recentProjects.append(qMakePair(fileNames.at(i), displayNames.at(i))); + } + } + } + + + connect(m_sessionManagerAction, SIGNAL(triggered()), this, SLOT(showSessionManager())); connect(m_newAction, SIGNAL(triggered()), this, SLOT(newProject())); #if 0 @@ -726,7 +744,7 @@ void ProjectExplorerPlugin::unloadProject() if (!success) return; - addToRecentProjects(fi->fileName()); + addToRecentProjects(fi->fileName(), m_currentProject->name()); m_session->removeProject(m_currentProject); updateActions(); } @@ -822,7 +840,19 @@ void ProjectExplorerPlugin::savePersistentSettings() QSettings *s = Core::ICore::instance()->settings(); if (s) { s->setValue("ProjectExplorer/StartupSession", m_session->file()->fileName()); - s->setValue("ProjectExplorer/RecentProjects/Files", m_recentProjects); + s->remove("ProjectExplorer/RecentProjects/Files"); + + QStringList fileNames; + QStringList displayNames; + QList >::const_iterator it, end; + end = m_recentProjects.constEnd(); + for (it = m_recentProjects.constBegin(); it != end; ++it) { + fileNames << (*it).first; + displayNames << (*it).second; + } + + s->setValue("ProjectExplorer/RecentProjects/FileNames", fileNames); + s->setValue("ProjectExplorer/RecentProjects/DisplayNames", displayNames); } } @@ -831,14 +861,15 @@ bool ProjectExplorerPlugin::openProject(const QString &fileName) if (debug) qDebug() << "ProjectExplorerPlugin::openProject"; - if (openProjects(QStringList() << fileName)) { - addToRecentProjects(fileName); + QList list = openProjects(QStringList() << fileName); + if (!list.isEmpty()) { + addToRecentProjects(fileName, list.first()->name()); return true; } return false; } -bool ProjectExplorerPlugin::openProjects(const QStringList &fileNames) +QList ProjectExplorerPlugin::openProjects(const QStringList &fileNames) { if (debug) qDebug() << "ProjectExplorerPlugin - opening projects " << fileNames; @@ -866,7 +897,7 @@ bool ProjectExplorerPlugin::openProjects(const QStringList &fileNames) if (debug) qDebug() << "ProjectExplorerPlugin - Could not open any projects!"; QApplication::restoreOverrideCursor(); - return false; + return QList(); } foreach (Project *pro, openedPro) { @@ -886,7 +917,7 @@ bool ProjectExplorerPlugin::openProjects(const QStringList &fileNames) Core::ModeManager::instance()->activateMode(Core::Constants::MODE_EDIT); QApplication::restoreOverrideCursor(); - return true; + return openedPro; } Project *ProjectExplorerPlugin::currentProject() const @@ -1477,7 +1508,7 @@ void ProjectExplorerPlugin::cancelBuild() m_buildManager->cancel(); } -void ProjectExplorerPlugin::addToRecentProjects(const QString &fileName) +void ProjectExplorerPlugin::addToRecentProjects(const QString &fileName, const QString &displayName) { if (debug) qDebug() << "ProjectExplorerPlugin::addToRecentProjects(" << fileName << ")"; @@ -1485,10 +1516,17 @@ void ProjectExplorerPlugin::addToRecentProjects(const QString &fileName) if (fileName.isEmpty()) return; QString prettyFileName(QDir::toNativeSeparators(fileName)); - m_recentProjects.removeAll(prettyFileName); + + QList >::iterator it; + for(it = m_recentProjects.begin(); it != m_recentProjects.end();) + if ((*it).first == prettyFileName) + it = m_recentProjects.erase(it); + else + ++it; + if (m_recentProjects.count() > m_maxRecentProjects) m_recentProjects.removeLast(); - m_recentProjects.prepend(prettyFileName); + m_recentProjects.prepend(qMakePair(prettyFileName, displayName)); QFileInfo fi(prettyFileName); m_lastOpenDirectory = fi.absolutePath(); } @@ -1506,11 +1544,15 @@ void ProjectExplorerPlugin::updateRecentProjectMenu() menu->setEnabled(!m_recentProjects.isEmpty()); //projects (ignore sessions, they used to be in this list) - foreach (const QString &s, m_recentProjects) { - if (s.endsWith(".qws")) + + QList >::const_iterator it, end; + end = m_recentProjects.constEnd(); + for (it = m_recentProjects.constBegin(); it != end; ++it) { + const QPair &s = *it; + if (s.first.endsWith(".qws")) continue; - QAction *action = menu->addAction(s); - action->setData(s); + QAction *action = menu->addAction(s.second); + action->setData(s.first); connect(action, SIGNAL(triggered()), this, SLOT(openRecentProject())); } } diff --git a/src/plugins/projectexplorer/projectexplorer.h b/src/plugins/projectexplorer/projectexplorer.h index 83581ec1b0f..987cb323fb6 100644 --- a/src/plugins/projectexplorer/projectexplorer.h +++ b/src/plugins/projectexplorer/projectexplorer.h @@ -85,7 +85,7 @@ public: static ProjectExplorerPlugin *instance(); bool openProject(const QString &fileName); - bool openProjects(const QStringList &fileNames); + QList openProjects(const QStringList &fileNames); SessionManager *session() const; @@ -192,7 +192,7 @@ private: IRunConfigurationRunner *findRunner(QSharedPointer config, const QString &mode); void updateActions(); - void addToRecentProjects(const QString &fileName); + void addToRecentProjects(const QString &fileName, const QString &displayName); void updateWelcomePage(Core::Internal::WelcomeMode *welcomeMode); Internal::ProjectFileFactory *findProjectFileFactory(const QString &filename) const; @@ -251,7 +251,7 @@ private: QStringList m_profileMimeTypes; Internal::OutputPane *m_outputPane; - QStringList m_recentProjects; + QList > m_recentProjects; // pair of filename, displayname static const int m_maxRecentProjects = 7; QString m_lastOpenDirectory; From 3da6ca098c66be93067bae560706b35b142295ef Mon Sep 17 00:00:00 2001 From: dt Date: Tue, 7 Apr 2009 12:04:43 +0200 Subject: [PATCH 09/31] Kill the git process if we timed out waiting for it. --- src/plugins/git/gitclient.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/plugins/git/gitclient.cpp b/src/plugins/git/gitclient.cpp index c7558f1a18f..d563b95d8fe 100644 --- a/src/plugins/git/gitclient.cpp +++ b/src/plugins/git/gitclient.cpp @@ -544,9 +544,11 @@ bool GitClient::synchronousGit(const QString &workingDirectory, process.setEnvironment(environment.toStringList()); process.start(m_binaryPath, arguments); + if (!process.waitForFinished()) { if (errorText) *errorText = "Error: Git timed out"; + process.kill(); return false; } From 088a4bd3a47f55a0b99c1a1a9881debcae9b27b2 Mon Sep 17 00:00:00 2001 From: Marco Bubke Date: Tue, 7 Apr 2009 13:50:21 +0200 Subject: [PATCH 10/31] ask for dumper for QSharedPointer --- tests/manual/gdbdebugger/simple/app.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/manual/gdbdebugger/simple/app.cpp b/tests/manual/gdbdebugger/simple/app.cpp index d50180c4ad2..3cdc0518db6 100644 --- a/tests/manual/gdbdebugger/simple/app.cpp +++ b/tests/manual/gdbdebugger/simple/app.cpp @@ -39,6 +39,7 @@ #include #include #include +#include #include #include @@ -493,6 +494,11 @@ void testQSet() //hash.insert(ptr); } + +void testQSharedPointer() +{ +} + void stringRefTest(const QString &refstring) { Q_UNUSED(refstring); From 3d863b211a74daa23d555dd8da6956748d371d97 Mon Sep 17 00:00:00 2001 From: dt Date: Tue, 7 Apr 2009 13:52:28 +0200 Subject: [PATCH 11/31] Show progress for building cmake projects. Parse percent output of cmake, report via QtConcurrent and modify the BuildManager to also report the progress to the ProgressManager. --- src/plugins/cmakeprojectmanager/makestep.cpp | 10 +++++++ src/plugins/cmakeprojectmanager/makestep.h | 2 ++ src/plugins/projectexplorer/buildmanager.cpp | 31 +++++++++++++++----- src/plugins/projectexplorer/buildmanager.h | 1 + 4 files changed, 37 insertions(+), 7 deletions(-) diff --git a/src/plugins/cmakeprojectmanager/makestep.cpp b/src/plugins/cmakeprojectmanager/makestep.cpp index 8417e842af8..83e433c0ca6 100644 --- a/src/plugins/cmakeprojectmanager/makestep.cpp +++ b/src/plugins/cmakeprojectmanager/makestep.cpp @@ -50,6 +50,7 @@ using namespace CMakeProjectManager::Internal; MakeStep::MakeStep(CMakeProject *pro) : AbstractProcessStep(pro), m_pro(pro), m_buildParser(0) { + m_percentProgress = QRegExp("^\\[\\s*(\\d*)%\\]"); } MakeStep::~MakeStep() @@ -107,7 +108,10 @@ bool MakeStep::init(const QString &buildConfiguration) void MakeStep::run(QFutureInterface &fi) { + m_futureInterface = &fi; + m_futureInterface->setProgressRange(0, 100); AbstractProcessStep::run(fi); + m_futureInterface = 0; } QString MakeStep::name() @@ -134,6 +138,12 @@ void MakeStep::stdOut(const QString &line) { if (m_buildParser) m_buildParser->stdOutput(line); + if (m_percentProgress.indexIn(line) != -1) { + bool ok = false; + int percent = m_percentProgress.cap(1).toInt(&ok);; + if (ok) + m_futureInterface->setProgressValue(percent); + } AbstractProcessStep::stdOut(line); } diff --git a/src/plugins/cmakeprojectmanager/makestep.h b/src/plugins/cmakeprojectmanager/makestep.h index 8df65e8bd0b..f43977820ae 100644 --- a/src/plugins/cmakeprojectmanager/makestep.h +++ b/src/plugins/cmakeprojectmanager/makestep.h @@ -73,6 +73,8 @@ private: CMakeProject *m_pro; ProjectExplorer::BuildParserInterface *m_buildParser; QSet m_openDirectories; + QRegExp m_percentProgress; + QFutureInterface *m_futureInterface; }; class MakeStepConfigWidget :public ProjectExplorer::BuildStepConfigWidget diff --git a/src/plugins/projectexplorer/buildmanager.cpp b/src/plugins/projectexplorer/buildmanager.cpp index e527b5cde55..285214728c0 100644 --- a/src/plugins/projectexplorer/buildmanager.cpp +++ b/src/plugins/projectexplorer/buildmanager.cpp @@ -65,6 +65,11 @@ BuildManager::BuildManager(ProjectExplorerPlugin *parent) connect(&m_watcher, SIGNAL(finished()), this, SLOT(nextBuildQueue())); + connect(&m_watcher, SIGNAL(progressValueChanged(int)), + this, SLOT(progressChanged())); + connect(&m_watcher, SIGNAL(progressRangeChanged(int, int)), + this, SLOT(progressChanged())); + m_outputWindow = new CompileOutputWindow(this); pm->addObject(m_outputWindow); @@ -115,7 +120,7 @@ void BuildManager::cancel() this, SLOT(addToOutputWindow(QString))); decrementActiveBuildSteps(m_currentBuildStep->project()); - m_progressFutureInterface->setProgressValueAndText(m_progress, "Build canceled"); //TODO NBS fix in qtconcurrent + m_progressFutureInterface->setProgressValueAndText(m_progress*100, "Build canceled"); //TODO NBS fix in qtconcurrent clearBuildQueue(); } return; @@ -184,7 +189,7 @@ void BuildManager::startBuildQueue() connect(progress, SIGNAL(clicked()), this, SLOT(showBuildResults())); progress->setWidget(new BuildProgress(m_taskWindow)); m_progress = 0; - m_progressFutureInterface->setProgressRange(0, m_maxProgress); + m_progressFutureInterface->setProgressRange(0, m_maxProgress * 100); m_running = true; m_canceling = false; @@ -194,9 +199,9 @@ void BuildManager::startBuildQueue() nextStep(); } else { // Already running - m_progressFutureInterface->setProgressRange(0, m_maxProgress); + m_progressFutureInterface->setProgressRange(0, m_maxProgress * 100); const QString &progressText = tr("Finished %1 of %2 build steps").arg(m_progress).arg(m_maxProgress); - m_progressFutureInterface->setProgressValueAndText(m_progress, progressText); + m_progressFutureInterface->setProgressValueAndText(m_progress*100, progressText); } } @@ -231,7 +236,7 @@ void BuildManager::nextBuildQueue() ++m_progress; const QString &progressText = tr("Finished %1 of %2 build steps").arg(m_progress).arg(m_maxProgress); - m_progressFutureInterface->setProgressValueAndText(m_progress, progressText); + m_progressFutureInterface->setProgressValueAndText(m_progress*100, progressText); bool result = m_watcher.result(); if (!result) { @@ -239,7 +244,7 @@ void BuildManager::nextBuildQueue() addToOutputWindow(tr("Error while building project %1").arg(m_currentBuildStep->project()->name())); addToOutputWindow(tr("When executing build step '%1'").arg(m_currentBuildStep->displayName())); // NBS TODO fix in qtconcurrent - m_progressFutureInterface->setProgressValueAndText(m_progress, tr("Error while building project %1").arg(m_currentBuildStep->project()->name())); + m_progressFutureInterface->setProgressValueAndText(m_progress*100, tr("Error while building project %1").arg(m_currentBuildStep->project()->name())); } decrementActiveBuildSteps(m_currentBuildStep->project()); @@ -249,6 +254,17 @@ void BuildManager::nextBuildQueue() clearBuildQueue(); } +void BuildManager::progressChanged() +{ + if (!m_progressFutureInterface) + return; + int range = m_watcher.progressMaximum() - m_watcher.progressMinimum(); + if (range != 0) { + int percent = (m_watcher.progressValue() - m_watcher.progressMinimum()) * 100 / range; + m_progressFutureInterface->setProgressValue(m_progress * 100 + percent); + } +} + void BuildManager::nextStep() { if (!m_buildQueue.empty()) { @@ -279,8 +295,9 @@ void BuildManager::nextStep() m_watcher.setFuture(QtConcurrent::run(&BuildStep::run, m_currentBuildStep)); } else { m_running = false; - m_previousBuildStepProject = 0; + m_previousBuildStepProject = 0; m_progressFutureInterface->reportFinished(); + m_progressWatcher.setFuture(QFuture()); delete m_progressFutureInterface; m_progressFutureInterface = 0; m_maxProgress = 0; diff --git a/src/plugins/projectexplorer/buildmanager.h b/src/plugins/projectexplorer/buildmanager.h index 6a57046164a..51292694338 100644 --- a/src/plugins/projectexplorer/buildmanager.h +++ b/src/plugins/projectexplorer/buildmanager.h @@ -97,6 +97,7 @@ private slots: void addToOutputWindow(const QString &string); void nextBuildQueue(); + void progressChanged(); void emitCancelMessage(); void showBuildResults(); From 851fb975ec82c949da9fb6318eff2020365d2b8a Mon Sep 17 00:00:00 2001 From: Marco Bubke Date: Tue, 7 Apr 2009 14:09:18 +0200 Subject: [PATCH 12/31] add readlink to the qtcreator startup script so that you can use sym links on it --- bin/qtcreator | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/qtcreator b/bin/qtcreator index bf2b18b9896..d00cfa0f582 100755 --- a/bin/qtcreator +++ b/bin/qtcreator @@ -1,6 +1,6 @@ #!/bin/sh -bindir=$(dirname "$0") +bindir=$(dirname $(readlink -nf $0)) if test "$(uname -m)" = "x86_64" ; then libdir=$(cd ${bindir}/../lib64 ; pwd) else From 8d411686721cb11635273c703820fd6244b17d2f Mon Sep 17 00:00:00 2001 From: hjk Date: Tue, 7 Apr 2009 13:38:19 +0200 Subject: [PATCH 13/31] debugger: make assignment in watch window look nicer, also make it work in script debugger --- src/plugins/debugger/debuggermanager.cpp | 2 +- src/plugins/debugger/scriptengine.cpp | 30 +++++++++++++++--------- src/plugins/debugger/scriptengine.h | 1 + src/plugins/debugger/watchhandler.cpp | 8 +++++++ src/plugins/debugger/watchhandler.h | 1 + src/plugins/debugger/watchwindow.cpp | 12 ++++++---- tests/manual/gdbdebugger/script/math.js | 3 ++- 7 files changed, 40 insertions(+), 17 deletions(-) diff --git a/src/plugins/debugger/debuggermanager.cpp b/src/plugins/debugger/debuggermanager.cpp index 4b7ac701bf7..cf2066c7909 100644 --- a/src/plugins/debugger/debuggermanager.cpp +++ b/src/plugins/debugger/debuggermanager.cpp @@ -278,7 +278,7 @@ void DebuggerManager::init() connect(m_watchHandler, SIGNAL(setSessionValueRequested(QString,QVariant)), this, SIGNAL(setSessionValueRequested(QString,QVariant))); connect(theDebuggerAction(AssignValue), SIGNAL(triggered()), - this, SLOT(assignValueInDebugger())); + this, SLOT(assignValueInDebugger()), Qt::QueuedConnection); // Tooltip QTreeView *tooltipView = qobject_cast(m_tooltipWindow); diff --git a/src/plugins/debugger/scriptengine.cpp b/src/plugins/debugger/scriptengine.cpp index 75513042ee4..413270bb673 100644 --- a/src/plugins/debugger/scriptengine.cpp +++ b/src/plugins/debugger/scriptengine.cpp @@ -69,6 +69,7 @@ using namespace Debugger::Constants; #else # define SDEBUG(s) #endif +# define XSDEBUG(s) qDebug() << s /////////////////////////////////////////////////////////////////////// // @@ -194,7 +195,7 @@ ScriptEngine::~ScriptEngine() void ScriptEngine::executeDebuggerCommand(const QString &command) { Q_UNUSED(command); - SDEBUG("FIXME: ScriptEngine::executeDebuggerCommand()"); + XSDEBUG("FIXME: ScriptEngine::executeDebuggerCommand()"); } void ScriptEngine::shutdown() @@ -247,40 +248,40 @@ void ScriptEngine::interruptInferior() { m_stopped = false; m_stopOnNextLine = true; - SDEBUG("FIXME: ScriptEngine::interruptInferior()"); + XSDEBUG("ScriptEngine::interruptInferior()"); } void ScriptEngine::stepExec() { - //SDEBUG("FIXME: ScriptEngine::stepExec()"); + //SDEBUG("ScriptEngine::stepExec()"); m_stopped = false; m_stopOnNextLine = true; } void ScriptEngine::stepIExec() { - //SDEBUG("FIXME: ScriptEngine::stepIExec()"); + //SDEBUG("ScriptEngine::stepIExec()"); m_stopped = false; m_stopOnNextLine = true; } void ScriptEngine::stepOutExec() { - //SDEBUG("FIXME: ScriptEngine::stepOutExec()"); + //SDEBUG("ScriptEngine::stepOutExec()"); m_stopped = false; m_stopOnNextLine = true; } void ScriptEngine::nextExec() { - //SDEBUG("FIXME: ScriptEngine::nextExec()"); + //SDEBUG("ScriptEngine::nextExec()"); m_stopped = false; m_stopOnNextLine = true; } void ScriptEngine::nextIExec() { - //SDEBUG("FIXME: ScriptEngine::nextIExec()"); + //SDEBUG("ScriptEngine::nextIExec()"); m_stopped = false; m_stopOnNextLine = true; } @@ -295,14 +296,14 @@ void ScriptEngine::runToLineExec(const QString &fileName, int lineNumber) void ScriptEngine::runToFunctionExec(const QString &functionName) { Q_UNUSED(functionName); - SDEBUG("FIXME: ScriptEngine::runToFunctionExec()"); + XSDEBUG("FIXME: ScriptEngine::runToFunctionExec()"); } void ScriptEngine::jumpToLineExec(const QString &fileName, int lineNumber) { Q_UNUSED(fileName); Q_UNUSED(lineNumber); - SDEBUG("FIXME: ScriptEngine::jumpToLineExec()"); + XSDEBUG("FIXME: ScriptEngine::jumpToLineExec()"); } void ScriptEngine::activateFrame(int index) @@ -468,8 +469,9 @@ void ScriptEngine::setToolTipExpression(const QPoint &pos, const QString &exp0) void ScriptEngine::assignValueInDebugger(const QString &expression, const QString &value) { - Q_UNUSED(expression); - Q_UNUSED(value); + XSDEBUG("ASSIGNING: " << expression + '=' + value); + m_scriptEngine->evaluate(expression + '=' + value); + updateLocals(); } void ScriptEngine::maybeBreakNow(bool byFunction) @@ -521,7 +523,12 @@ void ScriptEngine::maybeBreakNow(bool byFunction) qq->notifyInferiorStopped(); q->gotoLocation(fileName, lineNumber, true); + updateLocals(); +} +void ScriptEngine::updateLocals() +{ + QScriptContext *context = m_scriptEngine->currentContext(); qq->watchHandler()->reinitializeWatchers(); //SDEBUG("UPDATE LOCALS"); @@ -647,6 +654,7 @@ void ScriptEngine::updateSubItem(const WatchData &data0) it.next(); WatchData data1; data1.iname = data.iname + "." + it.name(); + data1.exp = it.name(); data1.name = it.name(); data1.scriptValue = it.value(); if (qq->watchHandler()->isExpandedIName(data1.iname)) diff --git a/src/plugins/debugger/scriptengine.h b/src/plugins/debugger/scriptengine.h index 33e102e750f..5e009327da7 100644 --- a/src/plugins/debugger/scriptengine.h +++ b/src/plugins/debugger/scriptengine.h @@ -110,6 +110,7 @@ private: bool supportsThreads() const { return true; } void maybeBreakNow(bool byFunction); void updateWatchModel(); + void updateLocals(); void updateSubItem(const WatchData &data0); private: diff --git a/src/plugins/debugger/watchhandler.cpp b/src/plugins/debugger/watchhandler.cpp index 76d27768e19..b618b98c55d 100644 --- a/src/plugins/debugger/watchhandler.cpp +++ b/src/plugins/debugger/watchhandler.cpp @@ -493,6 +493,14 @@ QVariant WatchHandler::data(const QModelIndex &idx, int role) const return QVariant(); } +bool WatchHandler::setData(const QModelIndex &index, const QVariant &value, int role) +{ + Q_UNUSED(role); + Q_UNUSED(value); + emit dataChanged(index, index); + return true; +} + Qt::ItemFlags WatchHandler::flags(const QModelIndex &idx) const { using namespace Qt; diff --git a/src/plugins/debugger/watchhandler.h b/src/plugins/debugger/watchhandler.h index ba6bb64dd1b..3f773ac1df3 100644 --- a/src/plugins/debugger/watchhandler.h +++ b/src/plugins/debugger/watchhandler.h @@ -149,6 +149,7 @@ public: // QAbstractItemModel // QVariant data(const QModelIndex &index, int role) const; + bool setData(const QModelIndex &index, const QVariant &value, int role); QModelIndex index(int, int, const QModelIndex &idx) const; QModelIndex parent(const QModelIndex &idx) const; int rowCount(const QModelIndex &idx) const; diff --git a/src/plugins/debugger/watchwindow.cpp b/src/plugins/debugger/watchwindow.cpp index 77f09f79208..a4d65d6280b 100644 --- a/src/plugins/debugger/watchwindow.cpp +++ b/src/plugins/debugger/watchwindow.cpp @@ -64,6 +64,7 @@ public: QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &, const QModelIndex &) const { + qDebug() << "CREATE EDITOR"; return new QLineEdit(parent); } @@ -77,13 +78,15 @@ public: lineEdit->setText(index.model()->data(index, ExpressionRole).toString()); } - void setModelData(QWidget *editor, QAbstractItemModel *, + void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const { + //qDebug() << "SET MODEL DATA"; QLineEdit *lineEdit = qobject_cast(editor); QTC_ASSERT(lineEdit, return); QString value = lineEdit->text(); - QString exp = index.model()->data(index, ExpressionRole).toString(); + QString exp = model->data(index, ExpressionRole).toString(); + model->setData(index, value, Qt::EditRole); if (index.column() == 1) { // the value column theDebuggerAction(AssignValue)->trigger(exp + '=' + value); @@ -147,7 +150,9 @@ void WatchWindow::keyPressEvent(QKeyEvent *ev) QModelIndex idx1 = idx.sibling(idx.row(), 0); QString exp = model()->data(idx1).toString(); theDebuggerAction(RemoveWatchExpression)->trigger(exp); - } else if (ev->key() == Qt::Key_Return && m_type == LocalsType) { + } else if (ev->key() == Qt::Key_Return + && ev->modifiers() == Qt::ControlModifier + && m_type == LocalsType) { QModelIndex idx = currentIndex(); QModelIndex idx1 = idx.sibling(idx.row(), 0); QString exp = model()->data(idx1).toString(); @@ -264,4 +269,3 @@ void WatchWindow::resetHelper(const QModelIndex &idx) collapse(idx); } } - diff --git a/tests/manual/gdbdebugger/script/math.js b/tests/manual/gdbdebugger/script/math.js index 65adac96c68..240a0f078d5 100644 --- a/tests/manual/gdbdebugger/script/math.js +++ b/tests/manual/gdbdebugger/script/math.js @@ -29,7 +29,8 @@ function cube(a) { - return a * a * a; + var x = a * a * a; + return x; } var a = cube(3); From 2da2d57143361b21b2b583247ffd0e8377c759b3 Mon Sep 17 00:00:00 2001 From: hjk Date: Tue, 7 Apr 2009 14:08:44 +0200 Subject: [PATCH 14/31] pluginspec: don't use the patched plugin loader. breaks on Fedora 10... --- src/libs/extensionsystem/pluginspec.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/libs/extensionsystem/pluginspec.cpp b/src/libs/extensionsystem/pluginspec.cpp index 74f629e15bc..9008ade3152 100644 --- a/src/libs/extensionsystem/pluginspec.cpp +++ b/src/libs/extensionsystem/pluginspec.cpp @@ -42,7 +42,8 @@ #include #ifdef Q_OS_LINUX -# define USE_UNPATCHED_QPLUGINLOADER 0 +// Using the patched version breaks on Fedora 10, KDE4.2.2/Qt4.5. +# define USE_UNPATCHED_QPLUGINLOADER 1 #else # define USE_UNPATCHED_QPLUGINLOADER 1 #endif From f88e15bf6bd0df8ed3bb928a9da10732bca913c4 Mon Sep 17 00:00:00 2001 From: hjk Date: Tue, 7 Apr 2009 14:14:43 +0200 Subject: [PATCH 15/31] debugger: fix potential endless loop --- src/plugins/debugger/gdbengine.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/plugins/debugger/gdbengine.cpp b/src/plugins/debugger/gdbengine.cpp index 2a82bbda4cf..ec552df2fbf 100644 --- a/src/plugins/debugger/gdbengine.cpp +++ b/src/plugins/debugger/gdbengine.cpp @@ -377,18 +377,18 @@ void GdbEngine::handleResponse(const QByteArray &buff) GdbMi record; while (from != to) { GdbMi data; - if (*from == ',') { - ++from; // skip ',' - data.parseResultOrValue(from, to); - if (data.isValid()) { - //qDebug() << "parsed response: " << data.toString(); - record.m_children += data; - record.m_type = GdbMi::Tuple; - } - } else { + if (*from != ',') { // happens on archer where we get // 23^running *running,thread-id="all" (gdb) record.m_type = GdbMi::Tuple; + break; + } + ++from; // skip ',' + data.parseResultOrValue(from, to); + if (data.isValid()) { + //qDebug() << "parsed response: " << data.toString(); + record.m_children += data; + record.m_type = GdbMi::Tuple; } } if (asyncClass == "stopped") { From 734aedb3c269bfd6c5bd9f470402980dbe684872 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Tue, 7 Apr 2009 14:30:13 +0200 Subject: [PATCH 16/31] install the process stub --- src/libs/utils/process_stub.pro | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/libs/utils/process_stub.pro b/src/libs/utils/process_stub.pro index a7f48846a4f..996aecea91a 100644 --- a/src/libs/utils/process_stub.pro +++ b/src/libs/utils/process_stub.pro @@ -24,3 +24,5 @@ unix { LIBS += -lshell32 } +target.path = /bin +INSTALLS += target From 85325d5056a7be32b9526a2e2a0dadb381cbe99f Mon Sep 17 00:00:00 2001 From: con Date: Tue, 7 Apr 2009 14:38:28 +0200 Subject: [PATCH 17/31] Build debugging helpers on Mac. Reviewed-by: dt --- src/plugins/qt4projectmanager/qtversionmanager.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/qt4projectmanager/qtversionmanager.cpp b/src/plugins/qt4projectmanager/qtversionmanager.cpp index eba4226c704..a716fed9e2b 100644 --- a/src/plugins/qt4projectmanager/qtversionmanager.cpp +++ b/src/plugins/qt4projectmanager/qtversionmanager.cpp @@ -1424,7 +1424,7 @@ QString QtVersion::buildDebuggingHelperLibrary() qmake.setWorkingDirectory(directory); qmake.setProcessChannelMode(QProcess::MergedChannels); - qmake.start(qmakeCommand(), QStringList()<<"-spec"<<"default"<<"gdbmacros.pro"); + qmake.start(qmakeCommand(), QStringList()<<"-spec"<< mkspec() <<"gdbmacros.pro"); qmake.waitForFinished(); output += qmake.readAll(); From 0a406dbe1fbfad1c3e19c0e85561ae742f69eeaf Mon Sep 17 00:00:00 2001 From: dt Date: Tue, 7 Apr 2009 15:00:16 +0200 Subject: [PATCH 18/31] Add a makestep that cleans up Make clean and rebuild all work. --- src/plugins/cmakeprojectmanager/cmakeproject.cpp | 4 ++++ src/plugins/cmakeprojectmanager/makestep.cpp | 12 ++++++++---- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/plugins/cmakeprojectmanager/cmakeproject.cpp b/src/plugins/cmakeprojectmanager/cmakeproject.cpp index b66ebb70c6a..d1fe107412d 100644 --- a/src/plugins/cmakeprojectmanager/cmakeproject.cpp +++ b/src/plugins/cmakeprojectmanager/cmakeproject.cpp @@ -506,6 +506,10 @@ void CMakeProject::restoreSettingsImpl(ProjectExplorer::PersistentSettingsReader if (!copw.buildDirectory().isEmpty()) setValue("all", "buildDirectory", copw.buildDirectory()); //TODO save arguments somewhere copw.arguments() + + MakeStep *cleanMakeStep = new MakeStep(this); + insertCleanStep(0, cleanMakeStep); + cleanMakeStep->setValue("clean", true); } else { // We have a user file, but we could still be missing the cbp file // TODO check that we have a cbp file and if not, open up a dialog ? diff --git a/src/plugins/cmakeprojectmanager/makestep.cpp b/src/plugins/cmakeprojectmanager/makestep.cpp index 83e433c0ca6..8209f3fc48d 100644 --- a/src/plugins/cmakeprojectmanager/makestep.cpp +++ b/src/plugins/cmakeprojectmanager/makestep.cpp @@ -99,10 +99,14 @@ bool MakeStep::init(const QString &buildConfiguration) setCommand(buildConfiguration, "make"); // TODO give full path here? #endif // Q_OS_WIN - QStringList arguments = value(buildConfiguration, "buildTargets").toStringList(); - arguments << additionalArguments(buildConfiguration); - setArguments(buildConfiguration, arguments); // TODO - setEnvironment(buildConfiguration, m_pro->environment(buildConfiguration)); + if (value("clean").isValid() && value("clean").toBool()) { + setArguments(buildConfiguration, QStringList() << "clean"); + } else { + QStringList arguments = value(buildConfiguration, "buildTargets").toStringList(); + arguments << additionalArguments(buildConfiguration); + setArguments(buildConfiguration, arguments); // TODO + setEnvironment(buildConfiguration, m_pro->environment(buildConfiguration)); + } return AbstractProcessStep::init(buildConfiguration); } From 7fba9fd7991b9ea383346d5e7f93f816c3b0cec3 Mon Sep 17 00:00:00 2001 From: dt Date: Tue, 7 Apr 2009 15:00:30 +0200 Subject: [PATCH 19/31] Typo fix --- src/plugins/cmakeprojectmanager/cmakeopenprojectwizard.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/cmakeprojectmanager/cmakeopenprojectwizard.cpp b/src/plugins/cmakeprojectmanager/cmakeopenprojectwizard.cpp index e1c0700c13a..d0198119697 100644 --- a/src/plugins/cmakeprojectmanager/cmakeopenprojectwizard.cpp +++ b/src/plugins/cmakeprojectmanager/cmakeopenprojectwizard.cpp @@ -182,7 +182,7 @@ XmlFileUpToDatePage::XmlFileUpToDatePage(CMakeOpenProjectWizard *cmakeWizard) QLabel *label = new QLabel(this); label->setWordWrap(true); label->setText(tr("Qt Creator has found a recent cbp file, which Qt Creator parses to gather information about the project. " - "You can change the command line arguments used to create this file, in the project mode. " + "You can change the command line arguments used to create this file in the project mode. " "Click finish to load the project")); layout()->addWidget(label); } From 99f23597881a3ca55d798c6d93c9ebab8c6eec18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thorbj=C3=B8rn=20Lindeijer?= Date: Tue, 7 Apr 2009 15:08:35 +0200 Subject: [PATCH 20/31] Added license headers to javascriptengine_p.{cpp,h} Reviewed-by: Roberto Raggi --- .../parser/javascriptengine_p.cpp | 55 ++++++--- .../parser/javascriptengine_p.h | 107 +++++++++++------- 2 files changed, 110 insertions(+), 52 deletions(-) diff --git a/src/plugins/qtscripteditor/parser/javascriptengine_p.cpp b/src/plugins/qtscripteditor/parser/javascriptengine_p.cpp index 050f1d1bbed..116c12ee884 100644 --- a/src/plugins/qtscripteditor/parser/javascriptengine_p.cpp +++ b/src/plugins/qtscripteditor/parser/javascriptengine_p.cpp @@ -1,3 +1,32 @@ +/************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Qt Software Information (qt-info@nokia.com) +** +** Commercial Usage +** +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** +** Alternatively, 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. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** +**************************************************************************/ + #include "javascriptengine_p.h" #include "javascriptnodepool_p.h" #include "javascriptvalue.h" @@ -10,17 +39,17 @@ namespace JavaScript { int Ecma::RegExp::flagFromChar(const QChar &ch) { - static QHash flagsHash; - if (flagsHash.isEmpty()) { - flagsHash[QLatin1Char('g')] = Global; - flagsHash[QLatin1Char('i')] = IgnoreCase; - flagsHash[QLatin1Char('m')] = Multiline; - } - QHash::const_iterator it; - it = flagsHash.constFind(ch); - if (it == flagsHash.constEnd()) - return 0; - return it.value(); + static QHash flagsHash; + if (flagsHash.isEmpty()) { + flagsHash[QLatin1Char('g')] = Global; + flagsHash[QLatin1Char('i')] = IgnoreCase; + flagsHash[QLatin1Char('m')] = Multiline; + } + QHash::const_iterator it; + it = flagsHash.constFind(ch); + if (it == flagsHash.constEnd()) + return 0; + return it.value(); } @@ -35,8 +64,8 @@ NodePool::~NodePool() Code *NodePool::createCompiledCode(AST::Node *, CompilationUnit &) { - Q_ASSERT(0); - return 0; + Q_ASSERT(0); + return 0; } static int toDigit(char c) diff --git a/src/plugins/qtscripteditor/parser/javascriptengine_p.h b/src/plugins/qtscripteditor/parser/javascriptengine_p.h index 480ef042a70..9072f410378 100644 --- a/src/plugins/qtscripteditor/parser/javascriptengine_p.h +++ b/src/plugins/qtscripteditor/parser/javascriptengine_p.h @@ -1,3 +1,32 @@ +/************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Qt Software Information (qt-info@nokia.com) +** +** Commercial Usage +** +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** +** Alternatively, 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. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** +**************************************************************************/ + #ifndef JAVASCRIPTENGINE_P_H #define JAVASCRIPTENGINE_P_H @@ -42,24 +71,24 @@ public: class JavaScriptNameIdImpl { - QString _text; + QString _text; public: - JavaScriptNameIdImpl(const QChar *u, int s) - : _text(u, s) - { } + JavaScriptNameIdImpl(const QChar *u, int s) + : _text(u, s) + { } - const QString asString() const - { return _text; } + const QString asString() const + { return _text; } - bool operator == (const JavaScriptNameIdImpl &other) const - { return _text == other._text; } + bool operator == (const JavaScriptNameIdImpl &other) const + { return _text == other._text; } - bool operator != (const JavaScriptNameIdImpl &other) const - { return _text != other._text; } + bool operator != (const JavaScriptNameIdImpl &other) const + { return _text != other._text; } - bool operator < (const JavaScriptNameIdImpl &other) const - { return _text < other._text; } + bool operator < (const JavaScriptNameIdImpl &other) const + { return _text < other._text; } }; inline uint qHash(const JavaScriptNameIdImpl &id) @@ -67,43 +96,43 @@ inline uint qHash(const JavaScriptNameIdImpl &id) class JavaScriptEnginePrivate { - JavaScript::Lexer *_lexer; - JavaScript::NodePool *_nodePool; - JavaScript::AST::Node *_ast; - QSet _literals; + JavaScript::Lexer *_lexer; + JavaScript::NodePool *_nodePool; + JavaScript::AST::Node *_ast; + QSet _literals; public: - JavaScriptEnginePrivate() - : _lexer(0), _nodePool(0), _ast(0) - { } + JavaScriptEnginePrivate() + : _lexer(0), _nodePool(0), _ast(0) + { } - QSet literals() const - { return _literals; } + QSet literals() const + { return _literals; } - JavaScriptNameIdImpl *intern(const QChar *u, int s) - { return const_cast(&*_literals.insert(JavaScriptNameIdImpl(u, s))); } + JavaScriptNameIdImpl *intern(const QChar *u, int s) + { return const_cast(&*_literals.insert(JavaScriptNameIdImpl(u, s))); } - JavaScript::Lexer *lexer() const - { return _lexer; } + JavaScript::Lexer *lexer() const + { return _lexer; } - void setLexer(JavaScript::Lexer *lexer) - { _lexer = lexer; } + void setLexer(JavaScript::Lexer *lexer) + { _lexer = lexer; } - JavaScript::NodePool *nodePool() const - { return _nodePool; } + JavaScript::NodePool *nodePool() const + { return _nodePool; } - void setNodePool(JavaScript::NodePool *nodePool) - { _nodePool = nodePool; } + void setNodePool(JavaScript::NodePool *nodePool) + { _nodePool = nodePool; } - JavaScript::AST::Node *ast() const - { return _ast; } + JavaScript::AST::Node *ast() const + { return _ast; } - JavaScript::AST::Node *changeAbstractSyntaxTree(JavaScript::AST::Node *node) - { - JavaScript::AST::Node *previousAST = _ast; - _ast = node; - return previousAST; - } + JavaScript::AST::Node *changeAbstractSyntaxTree(JavaScript::AST::Node *node) + { + JavaScript::AST::Node *previousAST = _ast; + _ast = node; + return previousAST; + } }; QT_END_NAMESPACE From ef2b100e6e1fb9f247b83ef850863dd42c9613d6 Mon Sep 17 00:00:00 2001 From: dt Date: Tue, 7 Apr 2009 15:27:51 +0200 Subject: [PATCH 21/31] Typo fixes for cmake wizard pages. --- .../cmakeopenprojectwizard.cpp | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/plugins/cmakeprojectmanager/cmakeopenprojectwizard.cpp b/src/plugins/cmakeprojectmanager/cmakeopenprojectwizard.cpp index d0198119697..fcfef28f997 100644 --- a/src/plugins/cmakeprojectmanager/cmakeopenprojectwizard.cpp +++ b/src/plugins/cmakeprojectmanager/cmakeopenprojectwizard.cpp @@ -169,8 +169,8 @@ InSourceBuildPage::InSourceBuildPage(CMakeOpenProjectWizard *cmakeWizard) QLabel *label = new QLabel(this); label->setWordWrap(true); label->setText(tr("Qt Creator has detected an in source build. " - "This prevents out of souce builds, Qt Creator won't allow you to change the build directory. " - "If you want a out of source build, clean your source directory and open the project again")); + "This prevents shadow builds, Qt Creator won't allow you to change the build directory. " + "If you want a shadow build, clean your source directory and open the project again.")); layout()->addWidget(label); } @@ -181,7 +181,7 @@ XmlFileUpToDatePage::XmlFileUpToDatePage(CMakeOpenProjectWizard *cmakeWizard) setLayout(new QVBoxLayout); QLabel *label = new QLabel(this); label->setWordWrap(true); - label->setText(tr("Qt Creator has found a recent cbp file, which Qt Creator parses to gather information about the project. " + label->setText(tr("Qt Creator has found a recent cbp file, which Qt Creator will parse to gather information about the project. " "You can change the command line arguments used to create this file in the project mode. " "Click finish to load the project")); layout()->addWidget(label); @@ -263,22 +263,23 @@ void CMakeRunPage::initializePage() if (m_presetBuildDirectory.isEmpty()) { m_buildDirectory = m_cmakeWizard->buildDirectory(); m_descriptionLabel->setText( - tr("The directory %1 does not contain a cbp file. Qt Creator needs to create this file, by running cmake. " + tr("The directory %1 does not contain a cbp file. Qt Creator needs to create this file by running cmake. " "Some projects require command line arguments to the initial cmake call.").arg(m_buildDirectory)); } else { m_buildDirectory = m_presetBuildDirectory; - // TODO tell the user more? if (m_update) m_descriptionLabel->setText(tr("The directory %1 contains an outdated .cbp file. Qt " "Creator needs to update this file by running cmake. " "If you want to add additional command line arguments, " - "add them in the below.").arg(m_buildDirectory)); + "add them in the below. Note, that cmake remembers command " + "line arguments from the former runs.").arg(m_buildDirectory)); else - m_descriptionLabel->setText(tr("The directory %1, specified in a buildconfiguration, " + m_descriptionLabel->setText(tr("The directory %1 specified in a buildconfiguration, " "does not contain a cbp file. Qt Creator needs to " "recreate this file, by running cmake. " "Some projects require command line arguments to " - "the initial cmake call.").arg(m_buildDirectory)); + "the initial cmake call. Note, that cmake remembers command " + "line arguments from the former runs.").arg(m_buildDirectory)); } } From 607f622cd5b92a27ce4221899aff59098957add0 Mon Sep 17 00:00:00 2001 From: dt Date: Tue, 7 Apr 2009 15:58:02 +0200 Subject: [PATCH 22/31] Add PKGCONFIG to highlighted variables. --- src/plugins/qt4projectmanager/profilehighlighter.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/plugins/qt4projectmanager/profilehighlighter.cpp b/src/plugins/qt4projectmanager/profilehighlighter.cpp index 2b75113ae30..3ab9e185801 100644 --- a/src/plugins/qt4projectmanager/profilehighlighter.cpp +++ b/src/plugins/qt4projectmanager/profilehighlighter.cpp @@ -36,7 +36,7 @@ using namespace Qt4ProjectManager::Internal; -#define MAX_VARIABLES 48 +#define MAX_VARIABLES 49 const char *const variables[MAX_VARIABLES] = { "CONFIG", "DEFINES", @@ -56,6 +56,7 @@ const char *const variables[MAX_VARIABLES] = { "OBJECTS", "OBJECTS_DIR", "OBJMOC", + "PKGCONFIG", "POST_TARGETDEPS", "PRECOMPILED_HEADER", "PRE_TARGETDEPS", From 6d0f973f75e6b483dbedd80e0aa54a519aa7f638 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thorbj=C3=B8rn=20Lindeijer?= Date: Tue, 7 Apr 2009 15:56:02 +0200 Subject: [PATCH 23/31] Better name for method to pick the completion collector isValid -> supportsEditor --- src/plugins/cpptools/cppcodecompletion.cpp | 5 +---- src/plugins/cpptools/cppcodecompletion.h | 2 +- src/plugins/find/searchresultwindow.h | 2 +- src/plugins/qtscripteditor/qtscriptcodecompletion.cpp | 2 +- src/plugins/qtscripteditor/qtscriptcodecompletion.h | 2 +- src/plugins/texteditor/completionsupport.cpp | 2 +- src/plugins/texteditor/icompletioncollector.h | 2 +- 7 files changed, 7 insertions(+), 10 deletions(-) diff --git a/src/plugins/cpptools/cppcodecompletion.cpp b/src/plugins/cpptools/cppcodecompletion.cpp index 981c48f01c8..398752891d0 100644 --- a/src/plugins/cpptools/cppcodecompletion.cpp +++ b/src/plugins/cpptools/cppcodecompletion.cpp @@ -508,14 +508,11 @@ static int startOfOperator(TextEditor::ITextEditable *editor, return start; } -bool CppCodeCompletion::isValid(TextEditor::ITextEditable *editor) +bool CppCodeCompletion::supportsEditor(TextEditor::ITextEditable *editor) { return m_manager->isCppEditor(editor); } bool CppCodeCompletion::triggersCompletion(TextEditor::ITextEditable *editor) { - if (! m_manager->isCppEditor(editor)) // ### remove me - return false; - const int pos = editor->position(); if (startOfOperator(editor, pos, /*token =*/ 0, /*want function call=*/ true) != pos) diff --git a/src/plugins/cpptools/cppcodecompletion.h b/src/plugins/cpptools/cppcodecompletion.h index 174e5d994f4..d95b9c825c9 100644 --- a/src/plugins/cpptools/cppcodecompletion.h +++ b/src/plugins/cpptools/cppcodecompletion.h @@ -58,7 +58,7 @@ class CppCodeCompletion : public TextEditor::ICompletionCollector public: explicit CppCodeCompletion(CppModelManager *manager); - bool isValid(TextEditor::ITextEditable *editor); + bool supportsEditor(TextEditor::ITextEditable *editor); bool triggersCompletion(TextEditor::ITextEditable *editor); int startCompletion(TextEditor::ITextEditable *editor); void completions(QList *completions); diff --git a/src/plugins/find/searchresultwindow.h b/src/plugins/find/searchresultwindow.h index e2336ba5f8c..c6022f951e9 100644 --- a/src/plugins/find/searchresultwindow.h +++ b/src/plugins/find/searchresultwindow.h @@ -84,7 +84,7 @@ public slots: private slots: void handleExpandCollapseToolButton(bool checked); void handleJumpToSearchResult(int index, const QString &fileName, int lineNumber, - int searchTermStart, int searchTermLength); + int searchTermStart, int searchTermLength); private: void readSettings(); diff --git a/src/plugins/qtscripteditor/qtscriptcodecompletion.cpp b/src/plugins/qtscripteditor/qtscriptcodecompletion.cpp index d08a3e175ef..1ecefda7f04 100644 --- a/src/plugins/qtscripteditor/qtscriptcodecompletion.cpp +++ b/src/plugins/qtscripteditor/qtscriptcodecompletion.cpp @@ -22,7 +22,7 @@ Qt::CaseSensitivity QtScriptCodeCompletion::caseSensitivity() const void QtScriptCodeCompletion::setCaseSensitivity(Qt::CaseSensitivity caseSensitivity) { m_caseSensitivity = caseSensitivity; } -bool QtScriptCodeCompletion::isValid(TextEditor::ITextEditable *editor) +bool QtScriptCodeCompletion::supportsEditor(TextEditor::ITextEditable *editor) { if (qobject_cast(editor->widget())) return true; diff --git a/src/plugins/qtscripteditor/qtscriptcodecompletion.h b/src/plugins/qtscripteditor/qtscriptcodecompletion.h index a0650d5266a..9d8677b7ba9 100644 --- a/src/plugins/qtscripteditor/qtscriptcodecompletion.h +++ b/src/plugins/qtscripteditor/qtscriptcodecompletion.h @@ -21,7 +21,7 @@ public: Qt::CaseSensitivity caseSensitivity() const; void setCaseSensitivity(Qt::CaseSensitivity caseSensitivity); - virtual bool isValid(TextEditor::ITextEditable *editor); + virtual bool supportsEditor(TextEditor::ITextEditable *editor); virtual bool triggersCompletion(TextEditor::ITextEditable *editor); virtual int startCompletion(TextEditor::ITextEditable *editor); virtual void completions(QList *completions); diff --git a/src/plugins/texteditor/completionsupport.cpp b/src/plugins/texteditor/completionsupport.cpp index ef4834c8088..0cc1918e645 100644 --- a/src/plugins/texteditor/completionsupport.cpp +++ b/src/plugins/texteditor/completionsupport.cpp @@ -94,7 +94,7 @@ void CompletionSupport::autoComplete(ITextEditable *editor, bool forced) m_completionCollector = 0; foreach (ICompletionCollector *collector, m_completionCollectors) { - if (collector->isValid(editor)) { + if (collector->supportsEditor(editor)) { m_completionCollector = collector; break; } diff --git a/src/plugins/texteditor/icompletioncollector.h b/src/plugins/texteditor/icompletioncollector.h index a151e4cf41f..f9e58721105 100644 --- a/src/plugins/texteditor/icompletioncollector.h +++ b/src/plugins/texteditor/icompletioncollector.h @@ -80,7 +80,7 @@ public: /* * Returns true if this completion collector can be used with the given editor. */ - virtual bool isValid(ITextEditable *editor) = 0; + virtual bool supportsEditor(ITextEditable *editor) = 0; /* This method should return whether the cursor is at a position which could * trigger an autocomplete. It will be called each time a character is typed in From 14eb3f6f2634049cb28ef7567df1639575c125be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thorbj=C3=B8rn=20Lindeijer?= Date: Tue, 7 Apr 2009 16:31:09 +0200 Subject: [PATCH 24/31] Fixed jumping to macro definitions --- src/plugins/cppeditor/cppeditor.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/cppeditor/cppeditor.cpp b/src/plugins/cppeditor/cppeditor.cpp index a6fbcfc0304..c616a7b8a93 100644 --- a/src/plugins/cppeditor/cppeditor.cpp +++ b/src/plugins/cppeditor/cppeditor.cpp @@ -632,10 +632,10 @@ CPPEditor::Link CPPEditor::findLinkAt(const QTextCursor &cursor, const int nameStart = tk.position(); const int nameLength = tk.length(); - const int endOfName = nameStart + nameLength; + const int endOfName = block.position() + nameStart + nameLength; const QString name = block.text().mid(nameStart, nameLength); - tc.setPosition(block.position() + endOfName); + tc.setPosition(endOfName); // Evaluate the type of the expression under the cursor ExpressionUnderCursor expressionUnderCursor; From bb3e6b720cf32ed758762f95061d5b9c6af706a7 Mon Sep 17 00:00:00 2001 From: hjk Date: Tue, 7 Apr 2009 16:39:17 +0200 Subject: [PATCH 25/31] debugger: rename data dumpers into "debugging helpers" --- src/plugins/debugger/debuggeractions.cpp | 20 +-- src/plugins/debugger/debuggeractions.h | 10 +- src/plugins/debugger/debuggerplugin.cpp | 48 +++---- src/plugins/debugger/debuggerplugin.h | 6 +- src/plugins/debugger/dumper.pro | 2 +- src/plugins/debugger/dumperoptionpage.ui | 24 ++-- src/plugins/debugger/gdbengine.cpp | 170 +++++++++++------------ src/plugins/debugger/gdbengine.h | 40 +++--- src/plugins/debugger/scriptengine.cpp | 48 +++++++ src/plugins/debugger/stackhandler.cpp | 2 +- src/plugins/debugger/stackhandler.h | 2 +- src/plugins/debugger/watchwindow.cpp | 4 +- tests/manual/gdbdebugger/script/math.js | 2 + 13 files changed, 214 insertions(+), 164 deletions(-) diff --git a/src/plugins/debugger/debuggeractions.cpp b/src/plugins/debugger/debuggeractions.cpp index fc963d0798f..8bfd4d9c7d4 100644 --- a/src/plugins/debugger/debuggeractions.cpp +++ b/src/plugins/debugger/debuggeractions.cpp @@ -161,35 +161,35 @@ DebuggerSettings *theDebuggerSettings() item->setText(QObject::tr("Collapse item")); // - // Dumpers + // DebuggingHelper // item = new SavedAction(instance); - instance->insertItem(UseDumpers, item); + instance->insertItem(UseDebuggingHelpers, item); item->setDefaultValue(true); - item->setSettingsKey("DebugMode", "UseDumpers"); + item->setSettingsKey("DebugMode", "UseDebuggingHelpers"); item->setText(QObject::tr("Use data dumpers")); item->setCheckable(true); item->setDefaultValue(true); item = new SavedAction(instance); - instance->insertItem(UseCustomDumperLocation, item); - item->setSettingsKey("DebugMode", "CustomDumperLocation"); + instance->insertItem(UseCustomDebuggingHelperLocation, item); + item->setSettingsKey("DebugMode", "CustomDebuggingHelperLocation"); item->setCheckable(true); item = new SavedAction(instance); - instance->insertItem(CustomDumperLocation, item); - item->setSettingsKey("DebugMode", "CustomDumperLocation"); + instance->insertItem(CustomDebuggingHelperLocation, item); + item->setSettingsKey("DebugMode", "CustomDebuggingHelperLocation"); item = new SavedAction(instance); - instance->insertItem(DebugDumpers, item); - item->setSettingsKey("DebugMode", "DebugDumpers"); + instance->insertItem(DebugDebuggingHelpers, item); + item->setSettingsKey("DebugMode", "DebugDebuggingHelpers"); item->setText(QObject::tr("Debug data dumpers")); item->setCheckable(true); item = new SavedAction(instance); item->setText(QObject::tr("Recheck custom dumper availability")); - instance->insertItem(RecheckDumpers, item); + instance->insertItem(RecheckDebuggingHelpers, item); // // Breakpoints diff --git a/src/plugins/debugger/debuggeractions.h b/src/plugins/debugger/debuggeractions.h index cb51e551aa0..44b9343c174 100644 --- a/src/plugins/debugger/debuggeractions.h +++ b/src/plugins/debugger/debuggeractions.h @@ -92,11 +92,11 @@ enum DebuggerActionCode ExpandItem, CollapseItem, - RecheckDumpers, - UseDumpers, - UseCustomDumperLocation, - CustomDumperLocation, - DebugDumpers, + RecheckDebuggingHelpers, + UseDebuggingHelpers, + UseCustomDebuggingHelperLocation, + CustomDebuggingHelperLocation, + DebugDebuggingHelpers, // Source List ListSourceFiles, diff --git a/src/plugins/debugger/debuggerplugin.cpp b/src/plugins/debugger/debuggerplugin.cpp index 29a1b19ab8b..7cff0f557ed 100644 --- a/src/plugins/debugger/debuggerplugin.cpp +++ b/src/plugins/debugger/debuggerplugin.cpp @@ -321,23 +321,23 @@ QWidget *GdbOptionPage::createPage(QWidget *parent) /////////////////////////////////////////////////////////////////////// // -// DumperOptionPage +// DebuggingHelperOptionPage // /////////////////////////////////////////////////////////////////////// namespace Debugger { namespace Internal { -class DumperOptionPage : public Core::IOptionsPage +class DebuggingHelperOptionPage : public Core::IOptionsPage { Q_OBJECT public: - DumperOptionPage() {} + DebuggingHelperOptionPage() {} // IOptionsPage - QString id() const { return QLatin1String("DataDumper"); } - QString trName() const { return tr("Data Dumper"); } + QString id() const { return QLatin1String("DebuggingHelper"); } + QString trName() const { return tr("Debugging Helper"); } QString category() const { return QLatin1String("Debugger"); } QString trCategory() const { return tr("Debugger"); } @@ -349,39 +349,39 @@ private: Q_SLOT void updateState(); friend class DebuggerPlugin; - Ui::DumperOptionPage m_ui; + Ui::DebuggingHelperOptionPage m_ui; Core::Utils::SavedActionSet m_group; }; -QWidget *DumperOptionPage::createPage(QWidget *parent) +QWidget *DebuggingHelperOptionPage::createPage(QWidget *parent) { QWidget *w = new QWidget(parent); m_ui.setupUi(w); m_ui.dumperLocationChooser->setExpectedKind(Core::Utils::PathChooser::Command); - m_ui.dumperLocationChooser->setPromptDialogTitle(tr("Choose Dumper Location")); + m_ui.dumperLocationChooser->setPromptDialogTitle(tr("Choose DebuggingHelper Location")); m_ui.dumperLocationChooser->setInitialBrowsePathBackup( Core::ICore::instance()->resourcePath() + "../../lib"); - connect(m_ui.checkBoxUseDumpers, SIGNAL(toggled(bool)), + connect(m_ui.checkBoxUseDebuggingHelpers, SIGNAL(toggled(bool)), this, SLOT(updateState())); - connect(m_ui.checkBoxUseCustomDumperLocation, SIGNAL(toggled(bool)), + connect(m_ui.checkBoxUseCustomDebuggingHelperLocation, SIGNAL(toggled(bool)), this, SLOT(updateState())); m_group.clear(); - m_group.insert(theDebuggerAction(UseDumpers), - m_ui.checkBoxUseDumpers); - m_group.insert(theDebuggerAction(UseCustomDumperLocation), - m_ui.checkBoxUseCustomDumperLocation); - m_group.insert(theDebuggerAction(CustomDumperLocation), + m_group.insert(theDebuggerAction(UseDebuggingHelpers), + m_ui.checkBoxUseDebuggingHelpers); + m_group.insert(theDebuggerAction(UseCustomDebuggingHelperLocation), + m_ui.checkBoxUseCustomDebuggingHelperLocation); + m_group.insert(theDebuggerAction(CustomDebuggingHelperLocation), m_ui.dumperLocationChooser); - m_group.insert(theDebuggerAction(DebugDumpers), - m_ui.checkBoxDebugDumpers); + m_group.insert(theDebuggerAction(DebugDebuggingHelpers), + m_ui.checkBoxDebugDebuggingHelpers); m_ui.dumperLocationChooser-> - setEnabled(theDebuggerAction(UseCustomDumperLocation)->value().toBool()); + setEnabled(theDebuggerAction(UseCustomDebuggingHelperLocation)->value().toBool()); #ifndef QT_DEBUG #if 0 @@ -396,13 +396,13 @@ QWidget *DumperOptionPage::createPage(QWidget *parent) return w; } -void DumperOptionPage::updateState() +void DebuggingHelperOptionPage::updateState() { - m_ui.checkBoxUseCustomDumperLocation->setEnabled( - m_ui.checkBoxUseDumpers->isChecked()); + m_ui.checkBoxUseCustomDebuggingHelperLocation->setEnabled( + m_ui.checkBoxUseDebuggingHelpers->isChecked()); m_ui.dumperLocationChooser->setEnabled( - m_ui.checkBoxUseDumpers->isChecked() - && m_ui.checkBoxUseCustomDumperLocation->isChecked()); + m_ui.checkBoxUseDebuggingHelpers->isChecked() + && m_ui.checkBoxUseCustomDebuggingHelperLocation->isChecked()); } } // namespace Internal @@ -652,7 +652,7 @@ bool DebuggerPlugin::initialize(const QStringList &arguments, QString *errorMess // FIXME: m_generalOptionPage = new GdbOptionPage; addObject(m_generalOptionPage); - m_dumperOptionPage = new DumperOptionPage; + m_dumperOptionPage = new DebuggingHelperOptionPage; addObject(m_dumperOptionPage); m_locationMark = 0; diff --git a/src/plugins/debugger/debuggerplugin.h b/src/plugins/debugger/debuggerplugin.h index 1d2b233b7a9..286ee5aa8bc 100644 --- a/src/plugins/debugger/debuggerplugin.h +++ b/src/plugins/debugger/debuggerplugin.h @@ -57,7 +57,7 @@ namespace Internal { class DebuggerManager; class DebugMode; class GdbOptionPage; -class DumperOptionPage; +class DebuggingHelperOptionPage; class LocationMark; class DebuggerPlugin : public ExtensionSystem::IPlugin @@ -102,14 +102,14 @@ private: friend class DebuggerManager; friend class GdbOptionPage; - friend class DumperOptionPage; + friend class DebuggingHelperOptionPage; friend class DebugMode; // FIXME: Just a hack now so that it can access the views DebuggerManager *m_manager; DebugMode *m_debugMode; GdbOptionPage *m_generalOptionPage; - DumperOptionPage *m_dumperOptionPage; + DebuggingHelperOptionPage *m_dumperOptionPage; QString m_previousMode; LocationMark *m_locationMark; diff --git a/src/plugins/debugger/dumper.pro b/src/plugins/debugger/dumper.pro index ff67af8743c..da23ccb7a4c 100644 --- a/src/plugins/debugger/dumper.pro +++ b/src/plugins/debugger/dumper.pro @@ -1,6 +1,6 @@ TEMPLATE = lib -TARGET = Dumper +TARGET = DebuggingHelper CONFIG += shared DESTDIR = ../../../bin include(../../qworkbenchlibrary.pri) diff --git a/src/plugins/debugger/dumperoptionpage.ui b/src/plugins/debugger/dumperoptionpage.ui index 43a6a1ae818..0359a39a2eb 100644 --- a/src/plugins/debugger/dumperoptionpage.ui +++ b/src/plugins/debugger/dumperoptionpage.ui @@ -1,7 +1,7 @@ - DumperOptionPage - + DebuggingHelperOptionPage + 0 @@ -15,7 +15,7 @@ - + This will enable nice display of Qt and Standard Library objects in the Locals&Watchers view @@ -43,7 +43,7 @@ - + This will load a dumper library @@ -73,7 +73,7 @@ - + Location: @@ -85,9 +85,9 @@ - + - This is an internal tool to make debugging the Custom Data Dumper code easier. Using this action is in general not needed unless you want do debug Qt Creator itself. + This is an internal tool to make debugging the debugging helper code easier. Using this action is in general not needed unless you want do debug Qt Creator itself. Debug custom dumpers @@ -108,13 +108,13 @@ - checkBoxDebugDumpers - checkBoxUseDumpers - checkBoxUseDefaultDumperLocation + checkBoxDebugDebuggingHelpers + checkBoxUseDebuggingHelpers + checkBoxUseDefaultDebuggingHelperLocation horizontalSpacer - labelDumperLocation + labelDebuggingHelperLocation horizontalSpacer_2 - labelDumperLocation + labelDebuggingHelperLocation diff --git a/src/plugins/debugger/gdbengine.cpp b/src/plugins/debugger/gdbengine.cpp index ec552df2fbf..1eba4009e88 100644 --- a/src/plugins/debugger/gdbengine.cpp +++ b/src/plugins/debugger/gdbengine.cpp @@ -115,7 +115,7 @@ enum GdbCommandType GdbInfoShared, GdbInfoProc, GdbInfoThreads, - GdbQueryDataDumper, + GdbQueryDebuggingHelper, GdbTemporaryContinue, GdbTargetCore, @@ -147,11 +147,11 @@ enum GdbCommandType WatchVarCreate, WatchEvaluateExpression, WatchToolTip, - WatchDumpCustomSetup, - WatchDumpCustomValue1, // waiting for gdb ack - WatchDumpCustomValue2, // waiting for actual data - WatchDumpCustomValue3, // macro based - WatchDumpCustomEditValue, + WatchDebuggingHelperSetup, + WatchDebuggingHelperValue1, // waiting for gdb ack + WatchDebuggingHelperValue2, // waiting for actual data + WatchDebuggingHelperValue3, // macro based + WatchDebuggingHelperEditValue, }; static int ¤tToken() @@ -211,12 +211,12 @@ void GdbEngine::initializeConnections() q, SLOT(showApplicationOutput(QString)), Qt::QueuedConnection); - connect(theDebuggerAction(UseDumpers), SIGNAL(valueChanged(QVariant)), - this, SLOT(setUseDumpers(QVariant))); - connect(theDebuggerAction(DebugDumpers), SIGNAL(valueChanged(QVariant)), - this, SLOT(setDebugDumpers(QVariant))); - connect(theDebuggerAction(RecheckDumpers), SIGNAL(triggered()), - this, SLOT(recheckCustomDumperAvailability())); + connect(theDebuggerAction(UseDebuggingHelpers), SIGNAL(valueChanged(QVariant)), + this, SLOT(setUseDebuggingHelpers(QVariant))); + connect(theDebuggerAction(DebugDebuggingHelpers), SIGNAL(valueChanged(QVariant)), + this, SLOT(setDebugDebuggingHelpers(QVariant))); + connect(theDebuggerAction(RecheckDebuggingHelpers), SIGNAL(triggered()), + this, SLOT(recheckDebuggingHelperAvailability())); connect(theDebuggerAction(FormatHexadecimal), SIGNAL(triggered()), this, SLOT(reloadRegisters())); @@ -237,7 +237,7 @@ void GdbEngine::initializeConnections() void GdbEngine::initializeVariables() { - m_dataDumperState = DataDumperUninitialized; + m_debuggingHelperState = DebuggingHelperUninitialized; m_gdbVersion = 100; m_gdbBuildVersion = -1; @@ -766,8 +766,8 @@ void GdbEngine::handleResult(const GdbResultRecord & record, int type, case GdbInfoShared: handleInfoShared(record); break; - case GdbQueryDataDumper: - handleQueryDataDumper(record); + case GdbQueryDebuggingHelper: + handleQueryDebuggingHelper(record); break; case GdbTemporaryContinue: continueInferior(); @@ -846,19 +846,19 @@ void GdbEngine::handleResult(const GdbResultRecord & record, int type, case WatchToolTip: handleToolTip(record, cookie.toString()); break; - case WatchDumpCustomValue1: - handleDumpCustomValue1(record, cookie.value()); + case WatchDebuggingHelperValue1: + handleDebuggingHelperValue1(record, cookie.value()); break; - case WatchDumpCustomValue2: - handleDumpCustomValue2(record, cookie.value()); + case WatchDebuggingHelperValue2: + handleDebuggingHelperValue2(record, cookie.value()); break; - case WatchDumpCustomValue3: - handleDumpCustomValue3(record, cookie.value()); + case WatchDebuggingHelperValue3: + handleDebuggingHelperValue3(record, cookie.value()); break; - case WatchDumpCustomSetup: - handleDumpCustomSetup(record); + case WatchDebuggingHelperSetup: + handleDebuggingHelperSetup(record); break; default: @@ -913,7 +913,7 @@ void GdbEngine::handleTargetCore(const GdbResultRecord &record) // qq->reloadRegisters(); - // Gdb-Macro based Dumpers + // Gdb-Macro based DebuggingHelpers sendCommand( "define qdumpqstring\n" "set $i = 0\n" @@ -1104,10 +1104,10 @@ void GdbEngine::handleAqcuiredInferior() #endif if (theDebuggerBoolSetting(ListSourceFiles)) reloadSourceFiles(); - tryLoadCustomDumpers(); + tryLoadDebuggingHelpers(); #ifndef Q_OS_MAC - // intentionally after tryLoadCustomDumpers(), + // intentionally after tryLoadDebuggingHelpers(), // otherwise we'd interupt solib loading. if (theDebuggerBoolSetting(AllPluginBreakpoints)) { sendCommand("set auto-solib-add on"); @@ -1216,7 +1216,7 @@ void GdbEngine::handleAsyncOutput(const GdbMi &data) return; } - //tryLoadCustomDumpers(); + //tryLoadDebuggingHelpers(); // jump over well-known frames static int stepCounter = 0; @@ -1523,7 +1523,7 @@ void GdbEngine::exitDebugger() m_outputCollector.shutdown(); initializeVariables(); - //q->settings()->m_debugDumpers = false; + //q->settings()->m_debugDebuggingHelpers = false; } @@ -1631,7 +1631,7 @@ bool GdbEngine::startDebugger() // otherwise program doesn't know. // Pass and Stop may be combined. // We need "print" as otherwise we would get no feedback whatsoever - // Custom Dumper crashs which happen regularily for when accessing + // Custom DebuggingHelper crashs which happen regularily for when accessing // uninitialized variables. sendCommand("handle SIGSEGV nopass stop print"); @@ -1755,7 +1755,7 @@ void GdbEngine::handleAttach() handleAqcuiredInferior(); q->resetLocation(); - recheckCustomDumperAvailability(); + recheckDebuggingHelperAvailability(); // // Stack @@ -1872,7 +1872,7 @@ void GdbEngine::setTokenBarrier() m_oldestAcceptableToken = currentToken(); } -void GdbEngine::setDebugDumpers(const QVariant &on) +void GdbEngine::setDebugDebuggingHelpers(const QVariant &on) { if (on.toBool()) { debugMessage("SWITCHING ON DUMPER DEBUGGING"); @@ -2698,7 +2698,7 @@ void GdbEngine::setToolTipExpression(const QPoint &pos, const QString &exp0) return; } - if (theDebuggerBoolSetting(DebugDumpers)) { + if (theDebuggerBoolSetting(DebugDebuggingHelpers)) { // minimize interference return; } @@ -2901,7 +2901,7 @@ static void setWatchDataSAddress(WatchData &data, const GdbMi &mi) data.saddr = mi.data(); } -void GdbEngine::setUseDumpers(const QVariant &on) +void GdbEngine::setUseDebuggingHelpers(const QVariant &on) { qDebug() << "SWITCHING ON/OFF DUMPER DEBUGGING:" << on; // FIXME: a bit too harsh, but otherwise the treeview sometimes look funny @@ -2910,9 +2910,9 @@ void GdbEngine::setUseDumpers(const QVariant &on) updateLocals(); } -bool GdbEngine::isCustomValueDumperAvailable(const QString &type) const +bool GdbEngine::hasDebuggingHelperForType(const QString &type) const { - if (!theDebuggerBoolSetting(UseDumpers)) + if (!theDebuggerBoolSetting(UseDebuggingHelpers)) return false; if (q->startMode() == AttachCore) { @@ -2921,15 +2921,15 @@ bool GdbEngine::isCustomValueDumperAvailable(const QString &type) const || type == "QStringList" || type.endsWith("::QStringList"); } - if (theDebuggerBoolSetting(DebugDumpers) - && qq->stackHandler()->isDebuggingDumpers()) + if (theDebuggerBoolSetting(DebugDebuggingHelpers) + && qq->stackHandler()->isDebuggingDebuggingHelpers()) return false; - if (m_dataDumperState != DataDumperAvailable) + if (m_debuggingHelperState != DebuggingHelperAvailable) return false; // simple types - if (m_availableSimpleDumpers.contains(type)) + if (m_availableSimpleDebuggingHelpers.contains(type)) return true; // templates @@ -2937,10 +2937,10 @@ bool GdbEngine::isCustomValueDumperAvailable(const QString &type) const QString inner; if (!extractTemplate(type, &tmplate, &inner)) return false; - return m_availableSimpleDumpers.contains(tmplate); + return m_availableSimpleDebuggingHelpers.contains(tmplate); } -void GdbEngine::runDirectDumper(const WatchData &data, bool dumpChildren) +void GdbEngine::runDirectDebuggingHelper(const WatchData &data, bool dumpChildren) { Q_UNUSED(dumpChildren); QString type = data.type; @@ -2953,17 +2953,17 @@ void GdbEngine::runDirectDumper(const WatchData &data, bool dumpChildren) QVariant var; var.setValue(data); - sendSynchronizedCommand(cmd, WatchDumpCustomValue3, var); + sendSynchronizedCommand(cmd, WatchDebuggingHelperValue3, var); q->showStatusMessage( tr("Retrieving data for watch view (%1 requests pending)...") .arg(m_pendingRequests + 1), 10000); } -void GdbEngine::runCustomDumper(const WatchData &data0, bool dumpChildren) +void GdbEngine::runDebuggingHelper(const WatchData &data0, bool dumpChildren) { if (q->startMode() == AttachCore) { - runDirectDumper(data0, dumpChildren); + runDirectDebuggingHelper(data0, dumpChildren); return; } WatchData data = data0; @@ -3112,14 +3112,14 @@ void GdbEngine::runCustomDumper(const WatchData &data0, bool dumpChildren) QVariant var; var.setValue(data); - sendSynchronizedCommand(cmd, WatchDumpCustomValue1, var); + sendSynchronizedCommand(cmd, WatchDebuggingHelperValue1, var); q->showStatusMessage( tr("Retrieving data for watch view (%1 requests pending)...") .arg(m_pendingRequests + 1), 10000); // retrieve response - sendSynchronizedCommand("p (char*)qDumpOutBuffer", WatchDumpCustomValue2, var); + sendSynchronizedCommand("p (char*)qDumpOutBuffer", WatchDebuggingHelperValue2, var); } void GdbEngine::createGdbVariable(const WatchData &data) @@ -3171,7 +3171,7 @@ void GdbEngine::updateSubItem(const WatchData &data0) // a common case that can be easily solved if (data.isChildrenNeeded() && isPointerType(data.type) - && !isCustomValueDumperAvailable(data.type)) { + && !hasDebuggingHelperForType(data.type)) { // We sometimes know what kind of children pointers have #if DEBUG_SUBITEM qDebug() << "IT'S A POINTER"; @@ -3189,11 +3189,11 @@ void GdbEngine::updateSubItem(const WatchData &data0) return; } - if (data.isValueNeeded() && isCustomValueDumperAvailable(data.type)) { + if (data.isValueNeeded() && hasDebuggingHelperForType(data.type)) { #if DEBUG_SUBITEM qDebug() << "UPDATE SUBITEM: CUSTOMVALUE"; #endif - runCustomDumper(data, qq->watchHandler()->isExpandedIName(data.iname)); + runDebuggingHelper(data, qq->watchHandler()->isExpandedIName(data.iname)); return; } @@ -3229,11 +3229,11 @@ void GdbEngine::updateSubItem(const WatchData &data0) return; } - if (data.isChildrenNeeded() && isCustomValueDumperAvailable(data.type)) { + if (data.isChildrenNeeded() && hasDebuggingHelperForType(data.type)) { #if DEBUG_SUBITEM qDebug() << "UPDATE SUBITEM: CUSTOMVALUE WITH CHILDREN"; #endif - runCustomDumper(data, true); + runDebuggingHelper(data, true); return; } @@ -3254,11 +3254,11 @@ void GdbEngine::updateSubItem(const WatchData &data0) return; } - if (data.isChildCountNeeded() && isCustomValueDumperAvailable(data.type)) { + if (data.isChildCountNeeded() && hasDebuggingHelperForType(data.type)) { #if DEBUG_SUBITEM qDebug() << "UPDATE SUBITEM: CUSTOMVALUE WITH CHILDREN"; #endif - runCustomDumper(data, qq->watchHandler()->isExpandedIName(data.iname)); + runDebuggingHelper(data, qq->watchHandler()->isExpandedIName(data.iname)); return; } @@ -3339,7 +3339,7 @@ void GdbEngine::updateWatchModel2() } } -void GdbEngine::handleQueryDataDumper(const GdbResultRecord &record) +void GdbEngine::handleQueryDebuggingHelper(const GdbResultRecord &record) { //qDebug() << "DATA DUMPER TRIAL:" << record.toString(); GdbMi output = record.data.findChild("consolestreamoutput"); @@ -3367,11 +3367,11 @@ void GdbEngine::handleQueryDataDumper(const GdbResultRecord &record) //qDebug() << "CONTENTS: " << contents.toString(); //qDebug() << "SIMPLE DUMPERS: " << simple.toString(); - m_availableSimpleDumpers.clear(); + m_availableSimpleDebuggingHelpers.clear(); foreach (const GdbMi &item, simple.children()) - m_availableSimpleDumpers.append(item.data()); - if (m_availableSimpleDumpers.isEmpty()) { - m_dataDumperState = DataDumperUnavailable; + m_availableSimpleDebuggingHelpers.append(item.data()); + if (m_availableSimpleDebuggingHelpers.isEmpty()) { + m_debuggingHelperState = DebuggingHelperUnavailable; QMessageBox::warning(q->mainWindow(), tr("Cannot find special data dumpers"), tr("The debugged binary does not contain information needed for " @@ -3381,11 +3381,11 @@ void GdbEngine::handleQueryDataDumper(const GdbResultRecord &record) "into your project directly.") ); } else { - m_dataDumperState = DataDumperAvailable; + m_debuggingHelperState = DebuggingHelperAvailable; q->showStatusMessage(tr("%1 custom dumpers found.") - .arg(m_availableSimpleDumpers.size())); + .arg(m_availableSimpleDebuggingHelpers.size())); } - //qDebug() << "DATA DUMPERS AVAILABLE" << m_availableSimpleDumpers; + //qDebug() << "DATA DUMPERS AVAILABLE" << m_availableSimpleDebuggingHelpers; } void GdbEngine::sendWatchParameters(const QByteArray ¶ms0) @@ -3436,7 +3436,7 @@ void GdbEngine::handleVarCreate(const GdbResultRecord &record, if (record.resultClass == GdbResultDone) { data.variable = data.iname; setWatchDataType(data, record.data.findChild("type")); - if (isCustomValueDumperAvailable(data.type)) { + if (hasDebuggingHelperForType(data.type)) { // we do not trust gdb if we have a custom dumper if (record.data.findChild("children").isValid()) data.setChildrenUnneeded(); @@ -3484,7 +3484,7 @@ void GdbEngine::handleEvaluateExpression(const GdbResultRecord &record, //updateWatchModel2(); } -void GdbEngine::handleDumpCustomSetup(const GdbResultRecord &record) +void GdbEngine::handleDebuggingHelperSetup(const GdbResultRecord &record) { //qDebug() << "CUSTOM SETUP RESULT: " << record.toString(); if (record.resultClass == GdbResultDone) { @@ -3495,7 +3495,7 @@ void GdbEngine::handleDumpCustomSetup(const GdbResultRecord &record) } } -void GdbEngine::handleDumpCustomValue1(const GdbResultRecord &record, +void GdbEngine::handleDebuggingHelperValue1(const GdbResultRecord &record, const WatchData &data0) { WatchData data = data0; @@ -3510,7 +3510,7 @@ void GdbEngine::handleDumpCustomValue1(const GdbResultRecord &record, //qDebug() << "CUSTOM DUMPER ERROR MESSAGE: " << msg; #ifdef QT_DEBUG // Make debugging of dumpers easier - if (theDebuggerBoolSetting(DebugDumpers) + if (theDebuggerBoolSetting(DebugDebuggingHelpers) && msg.startsWith("The program being debugged stopped while") && msg.contains("qDumpObjectData440")) { // Fake full stop @@ -3527,7 +3527,7 @@ void GdbEngine::handleDumpCustomValue1(const GdbResultRecord &record, } } -void GdbEngine::handleDumpCustomValue2(const GdbResultRecord &record, +void GdbEngine::handleDebuggingHelperValue2(const GdbResultRecord &record, const WatchData &data0) { WatchData data = data0; @@ -3627,7 +3627,7 @@ void GdbEngine::handleDumpCustomValue2(const GdbResultRecord &record, } } -void GdbEngine::handleDumpCustomValue3(const GdbResultRecord &record, +void GdbEngine::handleDebuggingHelperValue3(const GdbResultRecord &record, const WatchData &data0) { WatchData data = data0; @@ -3668,7 +3668,7 @@ void GdbEngine::handleDumpCustomValue3(const GdbResultRecord &record, QString cmd = "qdumpqstring (" + data1.exp + ")"; QVariant var; var.setValue(data1); - sendSynchronizedCommand(cmd, WatchDumpCustomValue3, var); + sendSynchronizedCommand(cmd, WatchDebuggingHelperValue3, var); } } else { data.setValue(""); @@ -3932,7 +3932,7 @@ void GdbEngine::handleVarListChildrenHelper(const GdbMi &item, data.exp = parent.exp + '.' + exp; } - if (isCustomValueDumperAvailable(data.type)) { + if (hasDebuggingHelperForType(data.type)) { // we do not trust gdb if we have a custom dumper data.setValueNeeded(); data.setChildCountNeeded(); @@ -3990,8 +3990,8 @@ void GdbEngine::handleToolTip(const GdbResultRecord &record, if (what == "create") { setWatchDataType(m_toolTip, record.data.findChild("type")); setWatchDataChildCount(m_toolTip, record.data.findChild("numchild")); - if (isCustomValueDumperAvailable(m_toolTip.type)) - runCustomDumper(m_toolTip, false); + if (hasDebuggingHelperForType(m_toolTip.type)) + runDebuggingHelper(m_toolTip, false); else q->showStatusMessage(tr("Retrieving data for tooltip..."), 10000); sendCommand("-data-evaluate-expression " + m_toolTip.exp, @@ -4041,18 +4041,18 @@ void GdbEngine::assignValueInDebugger(const QString &expression, const QString & QString GdbEngine::dumperLibraryName() const { - if (theDebuggerAction(UseCustomDumperLocation)->value().toBool()) - return theDebuggerAction(CustomDumperLocation)->value().toString(); + if (theDebuggerAction(UseCustomDebuggingHelperLocation)->value().toBool()) + return theDebuggerAction(CustomDebuggingHelperLocation)->value().toString(); return q->m_dumperLib; } -void GdbEngine::tryLoadCustomDumpers() +void GdbEngine::tryLoadDebuggingHelpers() { - if (m_dataDumperState != DataDumperUninitialized) + if (m_debuggingHelperState != DebuggingHelperUninitialized) return; PENDING_DEBUG("TRY LOAD CUSTOM DUMPERS"); - m_dataDumperState = DataDumperUnavailable; + m_debuggingHelperState = DebuggingHelperUnavailable; QString lib = dumperLibraryName(); //qDebug() << "DUMPERLIB: " << lib; @@ -4064,44 +4064,44 @@ void GdbEngine::tryLoadCustomDumpers() return; } - m_dataDumperState = DataDumperLoadTried; + m_debuggingHelperState = DebuggingHelperLoadTried; #if defined(Q_OS_WIN) sendCommand("sharedlibrary .*"); // for LoadLibraryA //sendCommand("handle SIGSEGV pass stop print"); //sendCommand("set unwindonsignal off"); sendCommand("call LoadLibraryA(\"" + lib + "\")", - WatchDumpCustomSetup); + WatchDebuggingHelperSetup); sendCommand("sharedlibrary " + dotEscape(lib)); #elif defined(Q_OS_MAC) //sendCommand("sharedlibrary libc"); // for malloc //sendCommand("sharedlibrary libdl"); // for dlopen QString flag = QString::number(RTLD_NOW); sendCommand("call (void)dlopen(\"" + lib + "\", " + flag + ")", - WatchDumpCustomSetup); + WatchDebuggingHelperSetup); //sendCommand("sharedlibrary " + dotEscape(lib)); - m_dataDumperState = DataDumperLoadTried; + m_debuggingHelperState = DebuggingHelperLoadTried; #else //sendCommand("p dlopen"); QString flag = QString::number(RTLD_NOW); sendCommand("sharedlibrary libc"); // for malloc sendCommand("sharedlibrary libdl"); // for dlopen sendCommand("call (void)dlopen(\"" + lib + "\", " + flag + ")", - WatchDumpCustomSetup); + WatchDebuggingHelperSetup); // some older systems like CentOS 4.6 prefer this: sendCommand("call (void)__dlopen(\"" + lib + "\", " + flag + ")", - WatchDumpCustomSetup); + WatchDebuggingHelperSetup); sendCommand("sharedlibrary " + dotEscape(lib)); #endif // retreive list of dumpable classes sendCommand("call qDumpObjectData440(1,%1+1,0,0,0,0,0,0)"); - sendCommand("p (char*)qDumpOutBuffer", GdbQueryDataDumper); + sendCommand("p (char*)qDumpOutBuffer", GdbQueryDebuggingHelper); } -void GdbEngine::recheckCustomDumperAvailability() +void GdbEngine::recheckDebuggingHelperAvailability() { // retreive list of dumpable classes sendCommand("call qDumpObjectData440(1,%1+1,0,0,0,0,0,0)"); - sendCommand("p (char*)qDumpOutBuffer", GdbQueryDataDumper); + sendCommand("p (char*)qDumpOutBuffer", GdbQueryDebuggingHelper); } IDebuggerEngine *createGdbEngine(DebuggerManager *parent) diff --git a/src/plugins/debugger/gdbengine.h b/src/plugins/debugger/gdbengine.h index 79d95f34fca..3b4b84fa59b 100644 --- a/src/plugins/debugger/gdbengine.h +++ b/src/plugins/debugger/gdbengine.h @@ -72,12 +72,12 @@ struct GdbCookie QVariant cookie; }; -enum DataDumperState +enum DebuggingHelperState { - DataDumperUninitialized, - DataDumperLoadTried, - DataDumperAvailable, - DataDumperUnavailable, + DebuggingHelperUninitialized, + DebuggingHelperLoadTried, + DebuggingHelperAvailable, + DebuggingHelperUnavailable, }; @@ -130,8 +130,8 @@ private: void loadSymbols(const QString &moduleName); void loadAllSymbols(); - Q_SLOT void setDebugDumpers(const QVariant &on); - Q_SLOT void setUseDumpers(const QVariant &on); + Q_SLOT void setDebugDebuggingHelpers(const QVariant &on); + Q_SLOT void setUseDebuggingHelpers(const QVariant &on); // // Own stuff @@ -306,11 +306,11 @@ private: void handleTypeContents(const QString &output); void maybeHandleInferiorPidChanged(const QString &pid); - void tryLoadCustomDumpers(); - Q_SLOT void recheckCustomDumperAvailability(); - void runCustomDumper(const WatchData &data, bool dumpChildren); - void runDirectDumper(const WatchData &data, bool dumpChildren); - bool isCustomValueDumperAvailable(const QString &type) const; + void tryLoadDebuggingHelpers(); + Q_SLOT void recheckDebuggingHelperAvailability(); + void runDebuggingHelper(const WatchData &data, bool dumpChildren); + void runDirectDebuggingHelper(const WatchData &data, bool dumpChildren); + bool hasDebuggingHelperForType(const QString &type) const; void handleVarListChildren(const GdbResultRecord &record, const WatchData &cookie); @@ -321,15 +321,15 @@ private: const WatchData &cookie); void handleToolTip(const GdbResultRecord &record, const QString &cookie); - void handleQueryDataDumper(const GdbResultRecord &record); - void handleDumpCustomValue1(const GdbResultRecord &record, + void handleQueryDebuggingHelper(const GdbResultRecord &record); + void handleDebuggingHelperValue1(const GdbResultRecord &record, const WatchData &cookie); - void handleDumpCustomValue2(const GdbResultRecord &record, + void handleDebuggingHelperValue2(const GdbResultRecord &record, const WatchData &cookie); - void handleDumpCustomValue3(const GdbResultRecord &record, + void handleDebuggingHelperValue3(const GdbResultRecord &record, const WatchData &cookie); - void handleDumpCustomEditValue(const GdbResultRecord &record); - void handleDumpCustomSetup(const GdbResultRecord &record); + void handleDebuggingHelperEditValue(const GdbResultRecord &record); + void handleDebuggingHelperSetup(const GdbResultRecord &record); void handleStackListLocals(const GdbResultRecord &record); void handleStackListArguments(const GdbResultRecord &record); void handleVarListChildrenHelper(const GdbMi &child, @@ -340,11 +340,11 @@ private: QString m_editedData; int m_pendingRequests; - QStringList m_availableSimpleDumpers; + QStringList m_availableSimpleDebuggingHelpers; QString m_namespace; // namespace used in "namespaced Qt"; int m_qtVersion; // Qt version used in the debugged program - DataDumperState m_dataDumperState; // state of qt creator dumpers + DebuggingHelperState m_debuggingHelperState; QList m_currentFunctionArgs; QString m_currentFrame; QMap m_varToType; diff --git a/src/plugins/debugger/scriptengine.cpp b/src/plugins/debugger/scriptengine.cpp index 413270bb673..55b21cc7cc7 100644 --- a/src/plugins/debugger/scriptengine.cpp +++ b/src/plugins/debugger/scriptengine.cpp @@ -240,7 +240,55 @@ void ScriptEngine::continueInferior() void ScriptEngine::runInferior() { + //QDir dir(QApplication::applicationDirPath()); + //if (dir.dirName() == QLatin1String("debug") || dir.dirName() == QLatin1String("release")) + // dir.cdUp(); + //dir.cdUp(); + //dir.cdUp(); + QDir dir("/home/apoenitz/dev/qtscriptgenerator"); + if (!dir.cd("plugins")) { + fprintf(stderr, "plugins folder does not exist -- did you build the bindings?\n"); + return; + } + QStringList paths = qApp->libraryPaths(); + paths << dir.absolutePath(); + qApp->setLibraryPaths(paths); + SDEBUG("ScriptEngine::runInferior()"); + QStringList extensions; + extensions << "qt.core" + << "qt.gui" + << "qt.xml" + << "qt.svg" + << "qt.network" + << "qt.sql" + << "qt.opengl" + << "qt.webkit" + << "qt.xmlpatterns" + << "qt.uitools"; + QStringList failExtensions; + foreach (const QString &ext, extensions) { + QScriptValue ret = m_scriptEngine->importExtension(ext); + if (ret.isError()) + failExtensions.append(ext); + } + if (!failExtensions.isEmpty()) { + if (failExtensions.size() == extensions.size()) { + qWarning("Failed to import Qt bindings!\n" + "Plugins directory searched: %s/script\n" + "Make sure that the bindings have been built, " + "and that this executable and the plugins are " + "using compatible Qt libraries.", qPrintable(dir.absolutePath())); + } else { + qWarning("Failed to import some Qt bindings: %s\n" + "Plugins directory searched: %s/script\n" + "Make sure that the bindings have been built, " + "and that this executable and the plugins are " + "using compatible Qt libraries.", + qPrintable(failExtensions.join(", ")), qPrintable(dir.absolutePath())); + } + } + QScriptValue result = m_scriptEngine->evaluate(m_scriptContents, m_scriptFileName); } diff --git a/src/plugins/debugger/stackhandler.cpp b/src/plugins/debugger/stackhandler.cpp index d8beb63a3e6..a02a80a3523 100644 --- a/src/plugins/debugger/stackhandler.cpp +++ b/src/plugins/debugger/stackhandler.cpp @@ -183,7 +183,7 @@ QList StackHandler::frames() const return m_stackFrames; } -bool StackHandler::isDebuggingDumpers() const +bool StackHandler::isDebuggingDebuggingHelpers() const { for (int i = m_stackFrames.size(); --i >= 0; ) if (m_stackFrames.at(i).function.startsWith("qDumpObjectData")) diff --git a/src/plugins/debugger/stackhandler.h b/src/plugins/debugger/stackhandler.h index c928a6fed92..920436deef2 100644 --- a/src/plugins/debugger/stackhandler.h +++ b/src/plugins/debugger/stackhandler.h @@ -74,7 +74,7 @@ public: // Called from StackHandler after a new stack list has been received void removeAll(); QAbstractItemModel *stackModel() { return this; } - bool isDebuggingDumpers() const; + bool isDebuggingDebuggingHelpers() const; private: // QAbstractTableModel diff --git a/src/plugins/debugger/watchwindow.cpp b/src/plugins/debugger/watchwindow.cpp index a4d65d6280b..75c9c8c1336 100644 --- a/src/plugins/debugger/watchwindow.cpp +++ b/src/plugins/debugger/watchwindow.cpp @@ -189,8 +189,8 @@ void WatchWindow::contextMenuEvent(QContextMenuEvent *ev) menu.addAction(act3); menu.addSeparator(); - menu.addAction(theDebuggerAction(RecheckDumpers)); - menu.addAction(theDebuggerAction(UseDumpers)); + menu.addAction(theDebuggerAction(RecheckDebuggingHelpers)); + menu.addAction(theDebuggerAction(UseDebuggingHelpers)); menu.addSeparator(); menu.addAction(theDebuggerAction(SettingsDialog)); diff --git a/tests/manual/gdbdebugger/script/math.js b/tests/manual/gdbdebugger/script/math.js index 240a0f078d5..0159f598de9 100644 --- a/tests/manual/gdbdebugger/script/math.js +++ b/tests/manual/gdbdebugger/script/math.js @@ -30,6 +30,8 @@ function cube(a) { var x = a * a * a; + x = x + 1; + x = x - 1; return x; } From a10dc593b088f20abbdd24cf65335737069f2f06 Mon Sep 17 00:00:00 2001 From: dt Date: Wed, 1 Apr 2009 18:18:26 +0200 Subject: [PATCH 26/31] Switching to the output mode now always gives focus to the output mode. Annoying --- src/plugins/coreplugin/mainwindow.cpp | 14 ++++++++++++++ src/plugins/coreplugin/mainwindow.h | 2 ++ 2 files changed, 16 insertions(+) diff --git a/src/plugins/coreplugin/mainwindow.cpp b/src/plugins/coreplugin/mainwindow.cpp index 9c489e7b96a..543111816b1 100644 --- a/src/plugins/coreplugin/mainwindow.cpp +++ b/src/plugins/coreplugin/mainwindow.cpp @@ -63,6 +63,7 @@ #include "editormanager/ieditorfactory.h" #include "baseview.h" #include "basefilewizard.h" +#include "ioutputpane.h" #include #include @@ -302,6 +303,9 @@ bool MainWindow::init(QString *errorMessage) outputModeWidget->layout()->addWidget(new Core::FindToolBarPlaceHolder(m_outputMode)); outputModeWidget->setFocusProxy(oph); + connect(m_modeManager, SIGNAL(currentModeChanged(Core::IMode*)), + this, SLOT(modeChanged(Core::IMode*)), Qt::QueuedConnection); + m_outputMode->setContext(m_globalContext); pm->addObject(m_outputMode); pm->addObject(m_generalSettings); @@ -317,6 +321,16 @@ bool MainWindow::init(QString *errorMessage) return true; } +void MainWindow::modeChanged(Core::IMode *mode) +{ + if (mode == m_outputMode) { + int idx = OutputPaneManager::instance()->m_widgetComboBox->itemData(OutputPaneManager::instance()->m_widgetComboBox->currentIndex()).toInt(); + IOutputPane *out = OutputPaneManager::instance()->m_pageMap.value(idx); + if (out && out->canFocus()) + out->setFocus(); + } +} + void MainWindow::extensionsInitialized() { m_editorManager->init(); diff --git a/src/plugins/coreplugin/mainwindow.h b/src/plugins/coreplugin/mainwindow.h index ea237f53bac..c28984e98f6 100644 --- a/src/plugins/coreplugin/mainwindow.h +++ b/src/plugins/coreplugin/mainwindow.h @@ -64,6 +64,7 @@ class UniqueIDManager; class VariableManager; class VCSManager; class ViewManagerInterface; +class IMode; namespace Internal { @@ -153,6 +154,7 @@ private slots: void updateFocusWidget(QWidget *old, QWidget *now); void setSidebarVisible(bool visible); void destroyVersionDialog(); + void modeChanged(Core::IMode *mode); private: void updateContextObject(IContext *context); From 0a91e21f4b08b77992409a1d7b3ffd3fa5802df4 Mon Sep 17 00:00:00 2001 From: con Date: Tue, 7 Apr 2009 17:15:37 +0200 Subject: [PATCH 27/31] More debugging helper renaming. --- src/plugins/debugger/debuggeractions.cpp | 8 ++++---- src/plugins/debugger/dumperoptionpage.ui | 11 +++-------- 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/src/plugins/debugger/debuggeractions.cpp b/src/plugins/debugger/debuggeractions.cpp index 8bfd4d9c7d4..ce5bc8e5277 100644 --- a/src/plugins/debugger/debuggeractions.cpp +++ b/src/plugins/debugger/debuggeractions.cpp @@ -166,8 +166,8 @@ DebuggerSettings *theDebuggerSettings() item = new SavedAction(instance); instance->insertItem(UseDebuggingHelpers, item); item->setDefaultValue(true); - item->setSettingsKey("DebugMode", "UseDebuggingHelpers"); - item->setText(QObject::tr("Use data dumpers")); + item->setSettingsKey("DebugMode", "UseDebuggingHelper"); + item->setText(QObject::tr("Use Debugging Helper")); item->setCheckable(true); item->setDefaultValue(true); @@ -183,12 +183,12 @@ DebuggerSettings *theDebuggerSettings() item = new SavedAction(instance); instance->insertItem(DebugDebuggingHelpers, item); item->setSettingsKey("DebugMode", "DebugDebuggingHelpers"); - item->setText(QObject::tr("Debug data dumpers")); + item->setText(QObject::tr("Debug debugging helper")); item->setCheckable(true); item = new SavedAction(instance); - item->setText(QObject::tr("Recheck custom dumper availability")); + item->setText(QObject::tr("Recheck debugging helper availability")); instance->insertItem(RecheckDebuggingHelpers, item); // diff --git a/src/plugins/debugger/dumperoptionpage.ui b/src/plugins/debugger/dumperoptionpage.ui index 0359a39a2eb..dc11cfac9d8 100644 --- a/src/plugins/debugger/dumperoptionpage.ui +++ b/src/plugins/debugger/dumperoptionpage.ui @@ -20,7 +20,7 @@ This will enable nice display of Qt and Standard Library objects in the Locals&Watchers view - Use data dumpers + Use debugging helper @@ -48,7 +48,7 @@ This will load a dumper library - Use dumpers from custom location + Use debugging helper from custom location @@ -90,7 +90,7 @@ This is an internal tool to make debugging the debugging helper code easier. Using this action is in general not needed unless you want do debug Qt Creator itself. - Debug custom dumpers + Debug debugging helper @@ -110,11 +110,6 @@ checkBoxDebugDebuggingHelpers checkBoxUseDebuggingHelpers - checkBoxUseDefaultDebuggingHelperLocation - horizontalSpacer - labelDebuggingHelperLocation - horizontalSpacer_2 - labelDebuggingHelperLocation From 173ae4d6b633534b4b0a3320ec89883db3c3e1eb Mon Sep 17 00:00:00 2001 From: mae Date: Tue, 7 Apr 2009 17:32:31 +0200 Subject: [PATCH 28/31] small fix to removeAllSplits() --- src/plugins/coreplugin/editormanager/editormanager.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/plugins/coreplugin/editormanager/editormanager.cpp b/src/plugins/coreplugin/editormanager/editormanager.cpp index 8e79b50f6aa..eda5a4926af 100644 --- a/src/plugins/coreplugin/editormanager/editormanager.cpp +++ b/src/plugins/coreplugin/editormanager/editormanager.cpp @@ -1811,7 +1811,10 @@ void EditorManager::removeCurrentSplit() void EditorManager::removeAllSplits() { + if (!m_d->m_splitter->isSplitter()) + return; IEditor *editor = m_d->m_currentEditor; + m_d->m_currentEditor = 0; // trigger update below if (editor && m_d->m_editorModel->isDuplicate(editor)) editor = m_d->m_editorModel->originalForDuplicate(editor); m_d->m_splitter->unsplitAll(); From 0d803c5da802a6cb44e4cbcee8c5dad57321dc53 Mon Sep 17 00:00:00 2001 From: hjk Date: Tue, 7 Apr 2009 17:13:15 +0200 Subject: [PATCH 29/31] fakevim: fix some target column related issues --- src/plugins/fakevim/fakevimhandler.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/plugins/fakevim/fakevimhandler.cpp b/src/plugins/fakevim/fakevimhandler.cpp index 9a4339fd192..44bb76028f1 100644 --- a/src/plugins/fakevim/fakevimhandler.cpp +++ b/src/plugins/fakevim/fakevimhandler.cpp @@ -605,7 +605,7 @@ EventResult FakeVimHandler::Private::handleKey(int key, int unmodified, void FakeVimHandler::Private::finishMovement(const QString &dotCommand) { - //qDebug() << "ANCHOR: " << m_anchor; + //qDebug() << "ANCHOR: " << position() << anchor(); if (m_submode == FilterSubMode) { int beginLine = lineForPosition(anchor()); int endLine = lineForPosition(position()); @@ -921,6 +921,7 @@ EventResult FakeVimHandler::Private::handleCommandMode(int key, int unmodified, } else if (key >= '0' && key <= '9') { if (key == '0' && m_mvcount.isEmpty()) { moveToStartOfLine(); + setTargetColumn(); finishMovement(); } else { m_mvcount.append(QChar(key)); @@ -971,9 +972,9 @@ EventResult FakeVimHandler::Private::handleCommandMode(int key, int unmodified, } else if (key == '\'') { m_subsubmode = TickSubSubMode; } else if (key == '|') { - setAnchor(); moveToStartOfLine(); moveRight(qMin(count(), rightDist()) - 1); + setTargetColumn(); finishMovement(); } else if (key == '!' && m_visualMode == NoVisualMode) { m_submode = FilterSubMode; @@ -992,14 +993,16 @@ EventResult FakeVimHandler::Private::handleCommandMode(int key, int unmodified, finishMovement(); } else if (key == Key_Home) { moveToStartOfLine(); + setTargetColumn(); finishMovement(); } else if (key == '$' || key == Key_End) { int submode = m_submode; moveToEndOfLine(); m_moveType = MoveExclusive; - finishMovement("$"); + setTargetColumn(); if (submode == NoSubMode) m_targetColumn = -1; + finishMovement("$"); } else if (key == ',') { // FIXME: use some other mechanism //m_passing = true; From cbcf5e48712d0e54b17b5d6c93ba84ebe843e99a Mon Sep 17 00:00:00 2001 From: hjk Date: Tue, 7 Apr 2009 17:35:45 +0200 Subject: [PATCH 30/31] debugger: fix debugging helpers for QHash --- src/plugins/debugger/gdbengine.cpp | 72 ++++++++++++++---------------- 1 file changed, 33 insertions(+), 39 deletions(-) diff --git a/src/plugins/debugger/gdbengine.cpp b/src/plugins/debugger/gdbengine.cpp index 1eba4009e88..ecab614f453 100644 --- a/src/plugins/debugger/gdbengine.cpp +++ b/src/plugins/debugger/gdbengine.cpp @@ -2812,40 +2812,35 @@ static QString quoteUnprintableLatin1(const QByteArray &ba) return res; } +static QString decodeData(QByteArray ba, int encoding) +{ + switch (encoding) { + case 0: // unencoded 8 bit data + return quoteUnprintableLatin1(ba); + case 1: // base64 encoded 8 bit data, used for QByteArray + ba = QByteArray::fromBase64(ba); + return '"' + quoteUnprintableLatin1(ba) + '"'; + case 2: // base64 encoded 16 bit data, used for QString + ba = QByteArray::fromBase64(ba); + return '"' + QString::fromUtf16((ushort *)ba.data(), ba.size() / 2) + '"'; + case 3: // base64 encoded 32 bit data + ba = QByteArray::fromBase64(ba); + return '"' + QString::fromUcs4((uint *)ba.data(), ba.size() / 4) + '"'; + break; + case 4: // base64 encoded 16 bit data, without quotes (see 2) + ba = QByteArray::fromBase64(ba); + return QString::fromUtf16((ushort *)ba.data(), ba.size() / 2); + } + return ""; +} + static void setWatchDataValue(WatchData &data, const GdbMi &mi, int encoding = 0) { - if (mi.isValid()) { - QByteArray ba; - QString str; - switch (encoding) { - case 0: // unencoded 8 bit data - ba = mi.data(); - str = quoteUnprintableLatin1(ba); - break; - case 1: // base64 encoded 8 bit data, used for QByteArray - ba = QByteArray::fromBase64(mi.data()); - str = '"' + quoteUnprintableLatin1(ba) + '"'; - break; - case 2: // base64 encoded 16 bit data, used for QString - ba = QByteArray::fromBase64(mi.data()); - str = QString::fromUtf16((ushort *)ba.data(), ba.size() / 2); - str = '"' + str + '"'; - break; - case 3: // base64 encoded 32 bit data - ba = QByteArray::fromBase64(mi.data()); - str = QString::fromUcs4((uint *)ba.data(), ba.size() / 4); - str = '"' + str + '"'; - break; - case 4: // base64 encoded 16 bit data, without quotes (see 2) - ba = QByteArray::fromBase64(mi.data()); - str = QString::fromUtf16((ushort *)ba.data(), ba.size() / 2); - break; - } - data.setValue(str); - } else { + if (mi.isValid()) + data.setValue(decodeData(mi.data(), encoding)); + else data.setValueNeeded(); - } } static void setWatchDataEditValue(WatchData &data, const GdbMi &mi) @@ -3599,17 +3594,16 @@ void GdbEngine::handleDebuggingHelperValue2(const GdbResultRecord &record, data1.iname = data.iname + "." + data1.name; if (!data1.name.isEmpty() && data1.name.at(0).isDigit()) data1.name = '[' + data1.name + ']'; - QString key = item.findChild("key").data(); + QByteArray key = item.findChild("key").data(); if (!key.isEmpty()) { - if (item.findChild("keyencoded").data()[0] == '1') { - key = '"' + QByteArray::fromBase64(key.toUtf8()) + '"'; - if (key.size() > 13) { - key = key.left(12); - key += "..."; - } + int encoding = item.findChild("keyencoded").data().toInt(); + QString skey = decodeData(key, encoding); + if (skey.size() > 13) { + skey = skey.left(12); + skey += "..."; } - //data1.name += " (" + key + ")"; - data1.name = key; + //data1.name += " (" + skey + ")"; + data1.name = skey; } setWatchDataType(data1, item.findChild("type")); setWatchDataExpression(data1, item.findChild("exp")); From 2e1ecb5c1be9c924cdebb2f49885889afa7fab8e Mon Sep 17 00:00:00 2001 From: con Date: Wed, 8 Apr 2009 10:26:56 +0200 Subject: [PATCH 31/31] Function argument widget was closing too early. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In case the completion shortcut contained the escape key (Mac xcode-like shortcut settings). Reviewed-by: Thorbjørn Lindeijer --- src/plugins/cpptools/cppcodecompletion.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/plugins/cpptools/cppcodecompletion.cpp b/src/plugins/cpptools/cppcodecompletion.cpp index 398752891d0..b9d880a067a 100644 --- a/src/plugins/cpptools/cppcodecompletion.cpp +++ b/src/plugins/cpptools/cppcodecompletion.cpp @@ -99,6 +99,7 @@ private: int m_startpos; int m_currentarg; int m_current; + bool m_escapePressed; TextEditor::ITextEditor *m_editor; @@ -197,7 +198,8 @@ using namespace CppTools::Internal; FunctionArgumentWidget::FunctionArgumentWidget(): m_startpos(-1), - m_current(0) + m_current(0), + m_escapePressed(false) { QObject *editorObject = Core::EditorManager::instance()->currentEditor(); m_editor = qobject_cast(editorObject); @@ -267,6 +269,7 @@ void FunctionArgumentWidget::showFunctionHint(QList functionSymbols, m_context = context; m_startpos = startPosition; m_current = 0; + m_escapePressed = false; // update the text m_currentarg = -1; @@ -326,7 +329,15 @@ void FunctionArgumentWidget::updateArgumentHighlight() bool FunctionArgumentWidget::eventFilter(QObject *obj, QEvent *e) { switch (e->type()) { + case QEvent::ShortcutOverride: + if (static_cast(e)->key() == Qt::Key_Escape) { + m_escapePressed = true; + } + break; case QEvent::KeyPress: + if (static_cast(e)->key() == Qt::Key_Escape) { + m_escapePressed = true; + } if (m_items.size() > 1) { QKeyEvent *ke = static_cast(e); if (ke->key() == Qt::Key_Up) { @@ -340,7 +351,7 @@ bool FunctionArgumentWidget::eventFilter(QObject *obj, QEvent *e) } break; case QEvent::KeyRelease: - if (static_cast(e)->key() == Qt::Key_Escape) { + if (static_cast(e)->key() == Qt::Key_Escape && m_escapePressed) { m_popupFrame->close(); return false; }