From 3d3ff54ddfe108a5438457d9d414d703b84c07f0 Mon Sep 17 00:00:00 2001 From: Fred Emmott Date: Tue, 13 Jan 2009 23:12:54 +0000 Subject: [PATCH 01/23] Make ":w" work in fakevim without needing a filename to be specified when file is not new. Unfortunately, the "this file has been edited outside of Qt Creator" dialog pops up. --- src/plugins/fakevim/fakevimhandler.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/plugins/fakevim/fakevimhandler.cpp b/src/plugins/fakevim/fakevimhandler.cpp index 3f6bb103c59..5093303ceae 100644 --- a/src/plugins/fakevim/fakevimhandler.cpp +++ b/src/plugins/fakevim/fakevimhandler.cpp @@ -35,6 +35,8 @@ #include "fakevimconstants.h" +#include + #include #include #include @@ -1485,6 +1487,9 @@ void FakeVimHandler::Private::setWidget(QWidget *ob) { m_textedit = qobject_cast(ob); m_plaintextedit = qobject_cast(ob); + TextEditor::BaseTextEditor* editor = qobject_cast(ob); + if (editor) + m_currentFileName = editor->file()->fileName(); } /////////////////////////////////////////////////////////////////////// From ed61e0b5bd0254a38563b52450d6b2e8edd676c9 Mon Sep 17 00:00:00 2001 From: Fred Emmott Date: Tue, 13 Jan 2009 23:31:08 +0000 Subject: [PATCH 02/23] Block the "this file has been changed outside of qt creator" popup in the fakevim ":w" command. --- src/plugins/fakevim/fakevimhandler.cpp | 30 +++++++++++++++++++------- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/src/plugins/fakevim/fakevimhandler.cpp b/src/plugins/fakevim/fakevimhandler.cpp index 5093303ceae..379b7eb42b5 100644 --- a/src/plugins/fakevim/fakevimhandler.cpp +++ b/src/plugins/fakevim/fakevimhandler.cpp @@ -35,6 +35,8 @@ #include "fakevimconstants.h" +#include +#include #include #include @@ -206,6 +208,7 @@ public: bool m_wasReadOnly; // saves read-only state of document FakeVimHandler *q; + Core::ICore *m_core; Mode m_mode; SubMode m_submode; SubSubMode m_subsubmode; @@ -225,6 +228,7 @@ public: QString m_commandBuffer; QString m_currentFileName; + Core::IFile* m_currentFile; QString m_currentMessage; bool m_lastSearchForward; @@ -282,6 +286,8 @@ FakeVimHandler::Private::Private(FakeVimHandler *parent) m_plaintextedit = 0; m_visualMode = NoVisualMode; + m_core = ExtensionSystem::PluginManager::instance()->getObject(); + m_config[ConfigStartOfLine] = ConfigOn; m_config[ConfigTabStop] = "8"; m_config[ConfigSmartTab] = ConfigOff; @@ -1050,12 +1056,18 @@ void FakeVimHandler::Private::handleExCommand(const QString &cmd0) bool exists = file.exists(); if (exists && !forced && !noArgs) { showRedMessage(tr("File '%1' exists (add ! to override)").arg(fileName)); - } else if (file.open(QIODevice::ReadWrite)) { - QTextCursor tc = selectRange(beginLine, endLine); - qDebug() << "ANCHOR: " << tc.position() << tc.anchor() - << tc.selection().toPlainText(); - { QTextStream ts(&file); ts << tc.selection().toPlainText(); } - file.close(); + } else if (m_currentFile || file.open(QIODevice::ReadWrite)) { + if(m_currentFile) { + m_core->fileManager()->blockFileChange(m_currentFile); + m_currentFile->save(fileName); + m_core->fileManager()->unblockFileChange(m_currentFile); + } else { + QTextCursor tc = selectRange(beginLine, endLine); + qDebug() << "ANCHOR: " << tc.position() << tc.anchor() + << tc.selection().toPlainText(); + { QTextStream ts(&file); ts << tc.selection().toPlainText(); } + file.close(); + } file.open(QIODevice::ReadOnly); QByteArray ba = file.readAll(); showBlackMessage(tr("\"%1\" %2 %3L, %4C written") @@ -1488,8 +1500,10 @@ void FakeVimHandler::Private::setWidget(QWidget *ob) m_textedit = qobject_cast(ob); m_plaintextedit = qobject_cast(ob); TextEditor::BaseTextEditor* editor = qobject_cast(ob); - if (editor) - m_currentFileName = editor->file()->fileName(); + if (editor) { + m_currentFile = editor->file(); + m_currentFileName = m_currentFile->fileName(); + } } /////////////////////////////////////////////////////////////////////// From 3908528fe49803b3ff65a1a7b8054eb8e48fbc1f Mon Sep 17 00:00:00 2001 From: Daniel Molkentin Date: Wed, 14 Jan 2009 17:57:19 +0100 Subject: [PATCH 03/23] fix doc target. this does still not solve the problem that qdoc has to be build in release mode if you use windows. --- doc/doc.pri | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/doc/doc.pri b/doc/doc.pri index e9e34fe733b..2e8d7e5e906 100644 --- a/doc/doc.pri +++ b/doc/doc.pri @@ -2,7 +2,8 @@ unix { QDOC = SRCDIR=$$PWD OUTDIR=$$OUT_PWD/doc/html $$(QTDIR)/tools/qdoc3/qdoc3 HELPGENERATOR = $$(QTDIR)/bin/qhelpgenerator } else { - QDOC = set SRCDIR=$$PWD&& set OUTDIR=$$OUT_PWD/doc/html&& $$(QTDIR)\tools\qdoc3\release\qdoc3.exe + QDOC = set SRCDIR=$$PWD&& set OUTDIR=$$OUT_PWD/doc/html&& cmd /k $$(QTDIR)\tools\qdoc3\release\qdoc3.exe + QDOC = $$replace(QDOC, "/", "\\\\") HELPGENERATOR = $$(QTDIR)\bin\qhelpgenerator.exe } From 7f8473f4698be74f686d5fa8674b4125ca7b2492 Mon Sep 17 00:00:00 2001 From: hjk Date: Wed, 14 Jan 2009 18:09:02 +0100 Subject: [PATCH 04/23] move debugger options to configuration dialog --- src/plugins/debugger/debugger.pro | 2 - src/plugins/debugger/debuggermanager.cpp | 97 ++--------- src/plugins/debugger/debuggermanager.h | 45 +++-- src/plugins/debugger/debuggerplugin.cpp | 210 ++++++++++++++++++----- src/plugins/debugger/debuggerplugin.h | 2 +- src/plugins/debugger/gdbengine.cpp | 39 ++--- src/plugins/debugger/gdbengine.h | 17 -- src/plugins/debugger/gdboptionpage.cpp | 145 ---------------- src/plugins/debugger/gdboptionpage.h | 109 ------------ src/plugins/debugger/gdboptionpage.ui | 56 +++++- 10 files changed, 281 insertions(+), 441 deletions(-) delete mode 100644 src/plugins/debugger/gdboptionpage.cpp delete mode 100644 src/plugins/debugger/gdboptionpage.h diff --git a/src/plugins/debugger/debugger.pro b/src/plugins/debugger/debugger.pro index c9256caaa5f..5a21d6a42d7 100644 --- a/src/plugins/debugger/debugger.pro +++ b/src/plugins/debugger/debugger.pro @@ -26,7 +26,6 @@ HEADERS += attachexternaldialog.h \ disassemblerwindow.h \ gdbengine.h \ gdbmi.h \ - gdboptionpage.h \ idebuggerengine.h \ imports.h \ moduleshandler.h \ @@ -55,7 +54,6 @@ SOURCES += attachexternaldialog.cpp \ disassemblerwindow.cpp \ gdbengine.cpp \ gdbmi.cpp \ - gdboptionpage.cpp \ gdbengine.h \ moduleshandler.cpp \ moduleswindow.cpp \ diff --git a/src/plugins/debugger/debuggermanager.cpp b/src/plugins/debugger/debuggermanager.cpp index f268fbb3dda..ea0e6623b06 100644 --- a/src/plugins/debugger/debuggermanager.cpp +++ b/src/plugins/debugger/debuggermanager.cpp @@ -86,6 +86,18 @@ using namespace Debugger::Constants; static const QString tooltipIName = "tooltip"; + +DebuggerSettings::DebuggerSettings() +{ + m_autoRun = false; + m_autoQuit = false; + m_skipKnownFrames = false; + m_debugDumpers = false; + m_useToolTips = false; + m_useToolTips = false; + m_useCustomDumpers = true; +} + /////////////////////////////////////////////////////////////////////// // // BreakByFunctionDialog @@ -322,56 +334,6 @@ void DebuggerManager::init() m_breakAtMainAction = new QAction(this); m_breakAtMainAction->setText(tr("Set Breakpoint at Function 'main'")); - m_debugDumpersAction = new QAction(this); - m_debugDumpersAction->setText(tr("Debug Custom Dumpers")); - m_debugDumpersAction->setToolTip(tr("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.")); - m_debugDumpersAction->setCheckable(true); - - m_skipKnownFramesAction = new QAction(this); - m_skipKnownFramesAction->setText(tr("Skip Known Frames When Stepping")); - m_skipKnownFramesAction->setToolTip(tr("After checking this option" - "'Step Into' combines in certain situations several steps, " - "leading to 'less noisy' debugging. So will, e.g., the atomic " - "reference counting code be skipped, and a single 'Step Into' " - "for a signal emission will end up directly in the slot connected " - "to it")); - m_skipKnownFramesAction->setCheckable(true); - - m_useCustomDumpersAction = new QAction(this); - m_useCustomDumpersAction->setText(tr("Use Custom Display for Qt Objects")); - m_useCustomDumpersAction->setToolTip(tr("Checking this will make the debugger " - "try to use code to format certain data (QObject, QString, ...) nicely. ")); - m_useCustomDumpersAction->setCheckable(true); - m_useCustomDumpersAction->setChecked(true); - - m_useFastStartAction = new QAction(this); - m_useFastStartAction->setText(tr("Fast Debugger Start")); - m_useFastStartAction->setToolTip(tr("Checking this will make the debugger " - "start fast by loading only very few debug symbols on start up. This " - "might lead to situations where breakpoints can not be set properly. " - "So uncheck this option if you experience breakpoint related problems.")); - m_useFastStartAction->setCheckable(true); - m_useFastStartAction->setChecked(true); - - m_useToolTipsAction = new QAction(this); - m_useToolTipsAction->setText(tr("Use Tooltips While Debugging")); - m_useToolTipsAction->setToolTip(tr("Checking this will make enable " - "tooltips for variable values during debugging. Since this can slow " - "down debugging and does not provide reliable information as it does " - "not use scope information, it is switched off by default.")); - m_useToolTipsAction->setCheckable(true); - m_useToolTipsAction->setChecked(false); - - // FIXME - m_useFastStartAction->setChecked(false); - m_useFastStartAction->setEnabled(false); - - m_dumpLogAction = new QAction(this); - m_dumpLogAction->setText(tr("Dump Log File for Debugging Purposes")); - m_watchAction = new QAction(this); m_watchAction->setText(tr("Add to Watch Window")); @@ -416,14 +378,6 @@ void DebuggerManager::init() connect(m_breakAtMainAction, SIGNAL(triggered()), this, SLOT(breakAtMain())); - connect(m_useFastStartAction, SIGNAL(triggered()), - this, SLOT(saveSessionData())); - connect(m_useCustomDumpersAction, SIGNAL(triggered()), - this, SLOT(saveSessionData())); - connect(m_skipKnownFramesAction, SIGNAL(triggered()), - this, SLOT(saveSessionData())); - connect(m_dumpLogAction, SIGNAL(triggered()), - this, SLOT(dumpLog())); connect(m_statusTimer, SIGNAL(timeout()), this, SLOT(clearStatusMessage())); @@ -947,16 +901,6 @@ void DebuggerManager::loadSessionData() { m_breakHandler->loadSessionData(); m_watchHandler->loadSessionData(); - - QVariant value; - querySessionValue(QLatin1String("UseFastStart"), &value); - m_useFastStartAction->setChecked(value.toBool()); - querySessionValue(QLatin1String("UseToolTips"), &value); - m_useToolTipsAction->setChecked(value.toBool()); - querySessionValue(QLatin1String("UseCustomDumpers"), &value); - m_useCustomDumpersAction->setChecked(!value.isValid() || value.toBool()); - querySessionValue(QLatin1String("SkipKnownFrames"), &value); - m_skipKnownFramesAction->setChecked(value.toBool()); engine()->loadSessionData(); } @@ -964,15 +908,6 @@ void DebuggerManager::saveSessionData() { m_breakHandler->saveSessionData(); m_watchHandler->saveSessionData(); - - setSessionValue(QLatin1String("UseFastStart"), - m_useFastStartAction->isChecked()); - setSessionValue(QLatin1String("UseToolTips"), - m_useToolTipsAction->isChecked()); - setSessionValue(QLatin1String("UseCustomDumpers"), - m_useCustomDumpersAction->isChecked()); - setSessionValue(QLatin1String("SkipKnownFrames"), - m_skipKnownFramesAction->isChecked()); engine()->saveSessionData(); } @@ -1139,22 +1074,22 @@ void DebuggerManager::setBusyCursor(bool busy) bool DebuggerManager::skipKnownFrames() const { - return m_skipKnownFramesAction->isChecked(); + return m_settings.m_skipKnownFrames; } bool DebuggerManager::debugDumpers() const { - return m_debugDumpersAction->isChecked(); + return m_settings.m_debugDumpers; } bool DebuggerManager::useCustomDumpers() const { - return m_useCustomDumpersAction->isChecked(); + return m_settings.m_useCustomDumpers; } bool DebuggerManager::useFastStart() const { - return 0; // && m_useFastStartAction->isChecked(); + return 0; // && m_settings.m_useFastStart; } void DebuggerManager::queryCurrentTextEditor(QString *fileName, int *lineNumber, diff --git a/src/plugins/debugger/debuggermanager.h b/src/plugins/debugger/debuggermanager.h index bde8ce449b1..9a5b5da37d3 100644 --- a/src/plugins/debugger/debuggermanager.h +++ b/src/plugins/debugger/debuggermanager.h @@ -167,8 +167,8 @@ private: virtual WatchHandler *watchHandler() = 0; virtual void showApplicationOutput(const QString &prefix, const QString &data) = 0; - virtual QAction *useCustomDumpersAction() const = 0; - virtual QAction *debugDumpersAction() const = 0; + //virtual QAction *useCustomDumpersAction() const = 0; + //virtual QAction *debugDumpersAction() const = 0; virtual bool skipKnownFrames() const = 0; virtual bool debugDumpers() const = 0; virtual bool useCustomDumpers() const = 0; @@ -180,6 +180,30 @@ private: }; +// +// DebuggerSettings +// + +class DebuggerSettings +{ +public: + DebuggerSettings(); + +public: + QString m_gdbCmd; + QString m_gdbEnv; + bool m_autoRun; + bool m_autoQuit; + + bool m_useCustomDumpers; + bool m_skipKnownFrames; + bool m_debugDumpers; + bool m_useFastStart; + bool m_useToolTips; + + QString m_scriptFile; +}; + // // DebuggerManager // @@ -196,6 +220,7 @@ public: IDebuggerManagerAccessForEngines *engineInterface(); QMainWindow *mainWindow() const { return m_mainWindow; } QLabel *statusLabel() const { return m_statusLabel; } + DebuggerSettings *settings() { return &m_settings; } enum StartMode { startInternal, startExternal, attachExternal }; enum DebuggerType { GdbDebugger, ScriptDebugger, WinDebugger }; @@ -286,9 +311,9 @@ private: StackHandler *stackHandler() { return m_stackHandler; } ThreadsHandler *threadsHandler() { return m_threadsHandler; } WatchHandler *watchHandler() { return m_watchHandler; } - QAction *useCustomDumpersAction() const { return m_useCustomDumpersAction; } - QAction *useToolTipsAction() const { return m_useToolTipsAction; } - QAction *debugDumpersAction() const { return m_debugDumpersAction; } + //QAction *useCustomDumpersAction() const { return m_useCustomDumpersAction; } + //QAction *useToolTipsAction() const { return m_useToolTipsAction; } + //QAction *debugDumpersAction() const { return m_debugDumpersAction; } bool skipKnownFrames() const; bool debugDumpers() const; bool useCustomDumpers() const; @@ -342,7 +367,6 @@ signals: void setConfigValueRequested(const QString &name, const QVariant &value); void applicationOutputAvailable(const QString &prefix, const QString &msg); - public: // FIXME: make private QString m_executable; @@ -406,13 +430,6 @@ private: QAction *m_sepAction; QAction *m_stepIAction; QAction *m_nextIAction; - QAction *m_skipKnownFramesAction; - - QAction *m_debugDumpersAction; - QAction *m_useCustomDumpersAction; - QAction *m_useFastStartAction; - QAction *m_useToolTipsAction; - QAction *m_dumpLogAction; QWidget *m_breakWindow; QWidget *m_disassemblerWindow; @@ -432,9 +449,9 @@ private: IDebuggerEngine *engine(); IDebuggerEngine *m_engine; + DebuggerSettings m_settings; }; - } // namespace Internal } // namespace Debugger diff --git a/src/plugins/debugger/debuggerplugin.cpp b/src/plugins/debugger/debuggerplugin.cpp index 80acb59b92f..bf8edf404e2 100644 --- a/src/plugins/debugger/debuggerplugin.cpp +++ b/src/plugins/debugger/debuggerplugin.cpp @@ -36,12 +36,14 @@ #include "debuggerconstants.h" #include "debuggermanager.h" #include "debuggerrunner.h" -#include "gdboptionpage.h" #include "gdbengine.h" +#include "ui_gdboptionpage.h" + #include #include #include +#include #include #include #include @@ -53,6 +55,8 @@ #include #include +#include + #include #include @@ -73,6 +77,7 @@ #include #include +#include #include #include #include @@ -80,6 +85,8 @@ #include +namespace ExtensionSystem { class PluginManager; } + using namespace Core; using namespace Debugger::Constants; using namespace Debugger::Internal; @@ -143,6 +150,12 @@ const char * const ADD_TO_WATCH_KEY = "Ctrl+Alt+Q"; } // namespace Debugger +/////////////////////////////////////////////////////////////////////// +// +// DebugMode +// +/////////////////////////////////////////////////////////////////////// + namespace Debugger { namespace Internal { @@ -159,9 +172,6 @@ public: void shutdown() {} }; -} // namespace Internal -} // namespace Debugger - DebugMode::DebugMode(QObject *parent) : BaseMode(parent) { @@ -177,6 +187,9 @@ DebugMode::~DebugMode() EditorManager::instance()->setParent(0); } +} // namespace Internal +} // namespace Debugger + /////////////////////////////////////////////////////////////////////// // @@ -184,8 +197,10 @@ DebugMode::~DebugMode() // /////////////////////////////////////////////////////////////////////// -class Debugger::Internal::LocationMark - : public TextEditor::BaseTextMark +namespace Debugger { +namespace Internal { + +class LocationMark : public TextEditor::BaseTextMark { Q_OBJECT @@ -212,6 +227,112 @@ QIcon LocationMark::icon() const return icon; } +} // namespace Internal +} // namespace Debugger + + +/////////////////////////////////////////////////////////////////////// +// +// GdbOptionPage +// +/////////////////////////////////////////////////////////////////////// + +namespace Debugger { +namespace Internal { + +class GdbOptionPage : public Core::IOptionsPage +{ + Q_OBJECT + +public: + GdbOptionPage(DebuggerPlugin *plugin) : m_plugin(plugin) {} + + // IOptionsPage + QString name() const { return tr("Gdb"); } + QString category() const { return "Debugger"; } + QString trCategory() const { return tr("Debugger"); } + + QWidget *createPage(QWidget *parent); + void apply(); + void finish() {} // automatically calls "apply" + +private: + Ui::GdbOptionPage m_ui; + + DebuggerSettings m_settings; + DebuggerPlugin *m_plugin; +}; + +QWidget *GdbOptionPage::createPage(QWidget *parent) +{ + QWidget *w = new QWidget(parent); + m_settings = *m_plugin->m_manager->settings(); + m_ui.setupUi(w); + m_ui.gdbLocationChooser->setExpectedKind(Core::Utils::PathChooser::Command); + m_ui.gdbLocationChooser->setPromptDialogTitle(tr("Choose Gdb Location")); + m_ui.gdbLocationChooser->setPath(m_settings.m_gdbCmd); + m_ui.scriptFileChooser->setExpectedKind(Core::Utils::PathChooser::File); + m_ui.scriptFileChooser->setPromptDialogTitle(tr("Choose Location of Startup Script File")); + m_ui.scriptFileChooser->setPath(m_settings.m_scriptFile); + m_ui.environmentEdit->setText(m_settings.m_gdbEnv); + m_ui.autoStartBox->setChecked(m_settings.m_autoRun); + m_ui.autoQuitBox->setChecked(m_settings.m_autoQuit); + + m_ui.checkBoxSkipKnownFrames->setChecked(m_settings.m_skipKnownFrames); + m_ui.checkBoxDebugDumpers->setChecked(m_settings.m_debugDumpers); + m_ui.checkBoxUseCustomDumpers->setChecked(m_settings.m_useCustomDumpers); + m_ui.checkBoxFastStart->setChecked(m_settings.m_useFastStart); + m_ui.checkBoxUseToolTips->setChecked(m_settings.m_useToolTips); + +#ifndef QT_DEBUG +#if 0 + cmd = am->registerAction(m_manager->m_dumpLogAction, + Constants::DUMP_LOG, globalcontext); + //cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+D,Ctrl+L"))); + cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+Shift+F11"))); + mdebug->addAction(cmd); + + cmd = am->registerAction(m_manager->m_debugDumpersAction, + Constants::DEBUG_DUMPERS, debuggercontext); + mdebug->addAction(cmd); +#endif +#endif + + // FIXME + m_ui.autoStartBox->hide(); + m_ui.autoQuitBox->hide(); + m_ui.environmentEdit->hide(); + m_ui.labelEnvironment->hide(); + + m_ui.checkBoxFastStart->setChecked(false); + m_ui.checkBoxFastStart->hide(); + + //m_dumpLogAction = new QAction(this); + //m_dumpLogAction->setText(tr("Dump Log File for Debugging Purposes")); + return w; +} + +void GdbOptionPage::apply() +{ + m_settings.m_gdbCmd = m_ui.gdbLocationChooser->path(); + m_settings.m_gdbEnv = m_ui.environmentEdit->text(); + m_settings.m_autoRun = m_ui.autoStartBox->isChecked(); + m_settings.m_autoQuit = m_ui.autoQuitBox->isChecked(); + m_settings.m_scriptFile = m_ui.scriptFileChooser->path(); + + m_settings.m_skipKnownFrames = m_ui.checkBoxSkipKnownFrames->isChecked(); + m_settings.m_debugDumpers = m_ui.checkBoxDebugDumpers->isChecked(); + m_settings.m_useCustomDumpers = m_ui.checkBoxUseCustomDumpers->isChecked(); + m_settings.m_useFastStart = m_ui.checkBoxFastStart->isChecked(); + m_settings.m_useToolTips = m_ui.checkBoxUseToolTips->isChecked(); + + *m_plugin->m_manager->settings() = m_settings; + m_plugin->writeSettings(); +} + +} // namespace Internal +} // namespace Debugger + /////////////////////////////////////////////////////////////////////// // @@ -409,34 +530,6 @@ bool DebuggerPlugin::initialize(const QStringList &arguments, QString *error_mes cmd = am->registerAction(sep, QLatin1String("Debugger.Sep2"), globalcontext); mdebug->addAction(cmd); - cmd = am->registerAction(m_manager->m_skipKnownFramesAction, - Constants::SKIP_KNOWN_FRAMES, globalcontext); - mdebug->addAction(cmd); - - cmd = am->registerAction(m_manager->m_useCustomDumpersAction, - Constants::USE_CUSTOM_DUMPERS, globalcontext); - mdebug->addAction(cmd); - - cmd = am->registerAction(m_manager->m_useFastStartAction, - Constants::USE_FAST_START, globalcontext); - mdebug->addAction(cmd); - - cmd = am->registerAction(m_manager->m_useToolTipsAction, - Constants::USE_TOOL_TIPS, globalcontext); - mdebug->addAction(cmd); - -#ifdef QT_DEBUG - cmd = am->registerAction(m_manager->m_dumpLogAction, - Constants::DUMP_LOG, globalcontext); - //cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+D,Ctrl+L"))); - cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+Shift+F11"))); - mdebug->addAction(cmd); - - cmd = am->registerAction(m_manager->m_debugDumpersAction, - Constants::DEBUG_DUMPERS, debuggercontext); - mdebug->addAction(cmd); -#endif - sep = new QAction(this); sep->setSeparator(true); cmd = am->registerAction(sep, QLatin1String("Debugger.Sep4"), globalcontext); @@ -479,7 +572,7 @@ bool DebuggerPlugin::initialize(const QStringList &arguments, QString *error_mes m_generalOptionPage = 0; // FIXME: - m_generalOptionPage = new GdbOptionPage(&theGdbSettings()); + m_generalOptionPage = new GdbOptionPage(this); addObject(m_generalOptionPage); m_locationMark = 0; @@ -711,7 +804,7 @@ void DebuggerPlugin::requestMark(TextEditor::ITextEditor *editor, int lineNumber void DebuggerPlugin::showToolTip(TextEditor::ITextEditor *editor, const QPoint &point, int pos) { - if (!m_manager->useToolTipsAction()->isChecked()) + if (!m_manager->settings()->m_useToolTips) return; QPlainTextEdit *plaintext = qobject_cast(editor->widget()); @@ -799,22 +892,57 @@ void DebuggerPlugin::changeStatus(int status) void DebuggerPlugin::writeSettings() const { - QSettings *s = settings(); QTC_ASSERT(m_manager, return); QTC_ASSERT(m_manager->mainWindow(), return); + + QSettings *s = settings(); + DebuggerSettings *m = m_manager->settings(); s->beginGroup(QLatin1String("DebugMode")); - s->setValue(QLatin1String("State"), m_manager->mainWindow()->saveState()); - s->setValue(QLatin1String("Locked"), m_toggleLockedAction->isChecked()); + s->setValue("State", m_manager->mainWindow()->saveState()); + s->setValue("Locked", m_toggleLockedAction->isChecked()); + s->setValue("Location", m->m_gdbCmd); + s->setValue("Environment", m->m_gdbEnv); + s->setValue("AutoRun", m->m_autoRun); + s->setValue("AutoQuit", m->m_autoQuit); + + s->setValue("UseFastStart", m->m_useFastStart); + s->setValue("UseToolTips", m->m_useToolTips); + s->setValue("UseCustomDumpers", m->m_useCustomDumpers); + s->setValue("SkipKnowFrames", m->m_skipKnownFrames); + s->setValue("DebugDumpers", m->m_debugDumpers); s->endGroup(); } void DebuggerPlugin::readSettings() { QSettings *s = settings(); + DebuggerSettings *m = &m_manager->m_settings; + + QString defaultCommand("gdb"); +#if defined(Q_OS_WIN32) + defaultCommand.append(".exe"); +#endif + Core::ICore *coreIFace = m_pm->getObject(); + QString defaultScript = coreIFace->resourcePath() + + QLatin1String("/gdb/qt4macros"); + s->beginGroup(QLatin1String("DebugMode")); - m_manager->mainWindow()->restoreState(s->value(QLatin1String("State"), QByteArray()).toByteArray()); - m_toggleLockedAction->setChecked(s->value(QLatin1String("Locked"), true).toBool()); + QByteArray ba = s->value("State", QByteArray()).toByteArray(); + m_toggleLockedAction->setChecked(s->value("Locked", true).toBool()); + m->m_gdbCmd = s->value("Location", defaultCommand).toString(); + m->m_scriptFile= s->value("ScriptFile", defaultScript).toString(); + m->m_gdbEnv = s->value("Environment", "").toString(); + m->m_autoRun = s->value("AutoRun", true).toBool(); + m->m_autoQuit = s->value("AutoQuit", true).toBool(); + + m->m_skipKnownFrames = s->value("SkipKnownFrames", false).toBool(); + m->m_debugDumpers = s->value("DebugDumpers", false).toBool(); + m->m_useCustomDumpers = s->value("UseCustomDupers", false).toBool(); + m->m_useFastStart = s->value("UseFastStart", false).toBool(); + m->m_useToolTips = s->value("UseToolTips", false).toBool(); s->endGroup(); + + m_manager->mainWindow()->restoreState(ba); } void DebuggerPlugin::focusCurrentEditor(IMode *mode) diff --git a/src/plugins/debugger/debuggerplugin.h b/src/plugins/debugger/debuggerplugin.h index 53f8490cfc3..4ab9c5b89f8 100644 --- a/src/plugins/debugger/debuggerplugin.h +++ b/src/plugins/debugger/debuggerplugin.h @@ -78,7 +78,6 @@ private slots: void changeStatus(int status); void requestMark(TextEditor::ITextEditor *editor, int lineNumber); void showToolTip(TextEditor::ITextEditor *editor, const QPoint &pnt, int pos); - void querySessionValue(const QString &name, QVariant *value); void setSessionValue(const QString &name, const QVariant &value); void queryConfigValue(const QString &name, QVariant *value); @@ -97,6 +96,7 @@ private: void writeSettings() const; friend class DebuggerManager; + friend class GdbOptionPage; friend class DebugMode; // FIXME: Just a hack now so that it can access the views ProjectExplorer::ProjectExplorerPlugin *projectExplorer() const; diff --git a/src/plugins/debugger/gdbengine.cpp b/src/plugins/debugger/gdbengine.cpp index 3190d1612a3..2370a55eed2 100644 --- a/src/plugins/debugger/gdbengine.cpp +++ b/src/plugins/debugger/gdbengine.cpp @@ -84,19 +84,6 @@ Q_DECLARE_METATYPE(Debugger::Internal::GdbMi); static const QString tooltipIName = "tooltip"; -/////////////////////////////////////////////////////////////////////// -// -// GdbSettings -// -/////////////////////////////////////////////////////////////////////// - -GdbSettings &Debugger::Internal::theGdbSettings() -{ - static GdbSettings settings; - return settings; -} - - /////////////////////////////////////////////////////////////////////// // // GdbCommandType @@ -265,7 +252,6 @@ void GdbEngine::init() m_pendingRequests = 0; m_gdbVersion = 100; m_shared = 0; - qq->debugDumpersAction()->setChecked(false); m_oldestAcceptableToken = -1; @@ -279,11 +265,6 @@ void GdbEngine::init() connect(&m_gdbProc, SIGNAL(finished(int, QProcess::ExitStatus)), q, SLOT(exitDebugger())); - connect(qq->debugDumpersAction(), SIGNAL(toggled(bool)), - this, SLOT(setDebugDumpers(bool))); - connect(qq->useCustomDumpersAction(), SIGNAL(toggled(bool)), - this, SLOT(setCustomDumpersWanted(bool))); - // Output connect(this, SIGNAL(gdbResponseAvailable()), this, SLOT(handleResponse()), Qt::QueuedConnection); @@ -306,7 +287,7 @@ void GdbEngine::gdbProcError(QProcess::ProcessError error) case QProcess::FailedToStart: msg = QString(tr("The Gdb process failed to start. Either the " "invoked program '%1' is missing, or you may have insufficient " - "permissions to invoke the program.")).arg(theGdbSettings().m_gdbCmd); + "permissions to invoke the program.")).arg(q->settings()->m_gdbCmd); break; case QProcess::Crashed: msg = tr("The Gdb process crashed some time after starting " @@ -1503,7 +1484,7 @@ void GdbEngine::exitDebugger() m_varToType.clear(); m_dataDumperState = DataDumperUninitialized; m_shared = 0; - qq->debugDumpersAction()->setChecked(false); + //q->settings()->m_debugDumpers = false; } @@ -1535,7 +1516,7 @@ bool GdbEngine::startDebugger() m_gdbProc.setEnvironment(q->m_environment); #if 0 - qDebug() << "Command: " << theGdbSettings().m_gdbCmd; + qDebug() << "Command: " << q->settings()->m_gdbCmd; qDebug() << "WorkingDirectory: " << m_gdbProc.workingDirectory(); qDebug() << "Environment: " << m_gdbProc.environment(); qDebug() << "Arguments: " << gdbArgs; @@ -1544,9 +1525,9 @@ bool GdbEngine::startDebugger() #endif q->showStatusMessage(tr("Starting Debugger")); - emit gdbInputAvailable(QString(), theGdbSettings().m_gdbCmd + ' ' + gdbArgs.join(" ")); + emit gdbInputAvailable(QString(), q->settings()->m_gdbCmd + ' ' + gdbArgs.join(" ")); - m_gdbProc.start(theGdbSettings().m_gdbCmd, gdbArgs); + m_gdbProc.start(q->settings()->m_gdbCmd, gdbArgs); m_gdbProc.waitForStarted(); if (m_gdbProc.state() != QProcess::Running) @@ -2589,7 +2570,7 @@ void GdbEngine::setToolTipExpression(const QPoint &pos, const QString &exp0) return; } - if (qq->debugDumpersAction()->isChecked()) { + if (q->settings()->m_debugDumpers) { // minimize interference return; } @@ -2909,10 +2890,10 @@ void GdbEngine::setCustomDumpersWanted(bool on) bool GdbEngine::isCustomValueDumperAvailable(const QString &type) const { - if (!qq->useCustomDumpers()) + DebuggerSettings *s = q->settings(); + if (!s->m_useCustomDumpers) return false; - if (qq->debugDumpersAction()->isChecked() - && qq->stackHandler()->isDebuggingDumpers()) + if (s->m_debugDumpers && qq->stackHandler()->isDebuggingDumpers()) return false; if (m_dataDumperState != DataDumperAvailable) return false; @@ -3470,7 +3451,7 @@ void GdbEngine::handleDumpCustomValue1(const GdbResultRecord &record, //qDebug() << "CUSTOM DUMPER ERROR MESSAGE: " << msg; #ifdef QT_DEBUG // Make debugging of dumers easier - if (qq->debugDumpersAction()->isChecked() + if (q->settings()->m_debugDumpers && msg.startsWith("The program being debugged stopped while") && msg.contains("qDumpObjectData440")) { // Fake full stop diff --git a/src/plugins/debugger/gdbengine.h b/src/plugins/debugger/gdbengine.h index f5a7c658b76..e07e6a228c3 100644 --- a/src/plugins/debugger/gdbengine.h +++ b/src/plugins/debugger/gdbengine.h @@ -81,23 +81,6 @@ enum DataDumperState }; -class GdbSettings -{ -public: - GdbSettings() { m_autoRun = m_autoQuit = false; } - -public: - QString m_gdbCmd; - QString m_gdbEnv; - bool m_autoRun; - bool m_autoQuit; - - QString m_scriptFile; - QMap m_typeMacros; -}; - -GdbSettings &theGdbSettings(); - class GdbEngine : public IDebuggerEngine { Q_OBJECT diff --git a/src/plugins/debugger/gdboptionpage.cpp b/src/plugins/debugger/gdboptionpage.cpp deleted file mode 100644 index 7c7a2700b6a..00000000000 --- a/src/plugins/debugger/gdboptionpage.cpp +++ /dev/null @@ -1,145 +0,0 @@ -/*************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Qt Software Information (qt-info@nokia.com) -** -** -** Non-Open Source Usage -** -** Licensees may use this file in accordance with the Qt Beta Version -** License Agreement, Agreement version 2.2 provided with the Software or, -** alternatively, in accordance with the terms contained in a written -** agreement between you and Nokia. -** -** GNU General Public License Usage -** -** Alternatively, this file may be used under the terms of the GNU General -** Public License versions 2.0 or 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the packaging -** of this file. Please review the following information to ensure GNU -** General Public Licensing requirements will be met: -** -** http://www.fsf.org/licensing/licenses/info/GPLv2.html and -** http://www.gnu.org/copyleft/gpl.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt GPL Exception -** version 1.3, included in the file GPL_EXCEPTION.txt in this package. -** -***************************************************************************/ - -#include "gdboptionpage.h" - -#include "gdbengine.h" - -#include -#include - -#include -#include -#include - -using namespace Debugger::Internal; - -GdbOptionPage::GdbOptionPage(GdbSettings *settings) -{ - m_pm = ExtensionSystem::PluginManager::instance(); - m_settings = settings; - - Core::ICore *coreIFace = m_pm->getObject(); - if (!coreIFace || !coreIFace->settings()) - return; - QSettings *s = coreIFace->settings(); - s->beginGroup("GdbOptions"); - QString defaultCommand("gdb"); -#if defined(Q_OS_WIN32) - defaultCommand.append(".exe"); -#endif - QString defaultScript = coreIFace->resourcePath() + - QLatin1String("/gdb/qt4macros"); - - m_settings->m_gdbCmd = s->value("Location", defaultCommand).toString(); - m_settings->m_scriptFile= s->value("ScriptFile", defaultScript).toString(); - m_settings->m_gdbEnv = s->value("Environment", "").toString(); - m_settings->m_autoRun = s->value("AutoRun", true).toBool(); - m_settings->m_autoQuit = s->value("AutoQuit", true).toBool(); - s->endGroup(); -} - -QString GdbOptionPage::name() const -{ - return tr("Gdb"); -} - -QString GdbOptionPage::category() const -{ - return "Debugger"; -} - -QString GdbOptionPage::trCategory() const -{ - return tr("Debugger"); -} - -QWidget *GdbOptionPage::createPage(QWidget *parent) -{ - QWidget *w = new QWidget(parent); - m_ui.setupUi(w); - m_ui.gdbLocationChooser->setExpectedKind(Core::Utils::PathChooser::Command); - m_ui.gdbLocationChooser->setPromptDialogTitle(tr("Choose Gdb Location")); - m_ui.gdbLocationChooser->setPath(m_settings->m_gdbCmd); - m_ui.scriptFileChooser->setExpectedKind(Core::Utils::PathChooser::File); - m_ui.scriptFileChooser->setPromptDialogTitle(tr("Choose Location of Startup Script File")); - m_ui.scriptFileChooser->setPath(m_settings->m_scriptFile); - m_ui.environmentEdit->setText(m_settings->m_gdbEnv); - m_ui.autoStartBox->setChecked(m_settings->m_autoRun); - m_ui.autoQuitBox->setChecked(m_settings->m_autoQuit); - - // FIXME - m_ui.autoStartBox->hide(); - m_ui.autoQuitBox->hide(); - m_ui.environmentEdit->hide(); - m_ui.labelEnvironment->hide(); - - connect(m_ui.gdbLocationChooser, SIGNAL(changed()), - this, SLOT(onGdbLocationChanged())); - connect(m_ui.scriptFileChooser, SIGNAL(changed()), - this, SLOT(onScriptFileChanged())); - - return w; -} - -void GdbOptionPage::onGdbLocationChanged() -{ - m_settings->m_gdbCmd = m_ui.gdbLocationChooser->path(); -} - -void GdbOptionPage::onScriptFileChanged() -{ - m_settings->m_scriptFile = m_ui.scriptFileChooser->path(); -} - -void GdbOptionPage::apply() -{ - m_settings->m_gdbCmd = m_ui.gdbLocationChooser->path(); - m_settings->m_gdbEnv = m_ui.environmentEdit->text(); - m_settings->m_autoRun = m_ui.autoStartBox->isChecked(); - m_settings->m_autoQuit = m_ui.autoQuitBox->isChecked(); - m_settings->m_scriptFile = m_ui.scriptFileChooser->path(); - - Core::ICore *coreIFace = m_pm->getObject(); - if (!coreIFace || !coreIFace->settings()) - return; - - QSettings *s = coreIFace->settings(); - - s->beginGroup("GdbOptions"); - s->setValue("Location", m_settings->m_gdbCmd); - s->setValue("Environment", m_settings->m_gdbEnv); - s->setValue("AutoRun", m_settings->m_autoRun); - s->setValue("AutoQuit", m_settings->m_autoQuit); - s->endGroup(); -} diff --git a/src/plugins/debugger/gdboptionpage.h b/src/plugins/debugger/gdboptionpage.h deleted file mode 100644 index c4c3ade9e31..00000000000 --- a/src/plugins/debugger/gdboptionpage.h +++ /dev/null @@ -1,109 +0,0 @@ -/*************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Qt Software Information (qt-info@nokia.com) -** -** -** Non-Open Source Usage -** -** Licensees may use this file in accordance with the Qt Beta Version -** License Agreement, Agreement version 2.2 provided with the Software or, -** alternatively, in accordance with the terms contained in a written -** agreement between you and Nokia. -** -** GNU General Public License Usage -** -** Alternatively, this file may be used under the terms of the GNU General -** Public License versions 2.0 or 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the packaging -** of this file. Please review the following information to ensure GNU -** General Public Licensing requirements will be met: -** -** http://www.fsf.org/licensing/licenses/info/GPLv2.html and -** http://www.gnu.org/copyleft/gpl.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt GPL Exception -** version 1.3, included in the file GPL_EXCEPTION.txt in this package. -** -***************************************************************************/ - -#ifndef GDBOPTIONPAGE_H -#define GDBOPTIONPAGE_H - -#include "ui_gdboptionpage.h" - -#include - -#include - -namespace ExtensionSystem { class PluginManager; } - -namespace Debugger { -namespace Internal { - -class GdbSettings; - -class GdbOptionPage : public Core::IOptionsPage -{ - Q_OBJECT - -public: - GdbOptionPage(GdbSettings *settings); - - QString name() const; - QString category() const; - QString trCategory() const; - - QWidget *createPage(QWidget *parent); - void apply(); - void finish() { } - -public slots: - void onGdbLocationChanged(); - void onScriptFileChanged(); - -private: - ExtensionSystem::PluginManager *m_pm; - Ui::GdbOptionPage m_ui; - - GdbSettings *m_settings; -}; - -#if 0 -class TypeMacroPage : public Core::IOptionsPage -{ - Q_OBJECT - -public: - TypeMacroPage(GdbSettings *settings); - - QString name() const; - QString category() const; - QString trCategory() const; - - QWidget *createPage(QWidget *parent); - void finished(bool accepted); - -private slots: - void onAddButton(); - void onDelButton(); - void currentItemChanged(QTreeWidgetItem *item); - void updateButtonState(); - -private: - ExtensionSystem::PluginManager *m_pm; - Ui::TypeMacroPage m_ui; - - GdbSettings *m_settings; - QWidget *m_widget; -}; -#endif - -} // namespace Internal -} // namespace Debugger - -#endif // GDBOPTIONPAGE_H diff --git a/src/plugins/debugger/gdboptionpage.ui b/src/plugins/debugger/gdboptionpage.ui index 580f13c0d66..354eb64233f 100644 --- a/src/plugins/debugger/gdboptionpage.ui +++ b/src/plugins/debugger/gdboptionpage.ui @@ -6,8 +6,8 @@ 0 0 - 433 - 233 + 465 + 372 @@ -74,6 +74,58 @@ + + + + Checking this will make the debugger try to use code to format certain data (QObject, QString, std::string etc.) nicely. + + + Use custom display for Qt and Standard Library objects + + + + + + + Checking this will make the debugger start fast by loading only very few debug symbols on start up. This might lead to situations where breakpoints can not be set properly. So uncheck this option if you experience breakpoint related problems. + + + Fast debugger start + + + + + + + fter checking this option 'Step Into' combines in certain situations several steps, leading to 'less noisy' debugging. So will, e.g., the atomic +reference counting code be skipped, and a single 'Step Into' for a signal emission will end up directly in the slot connected to it. + + + + Skip known frames when stepping + + + + + + + Checking this will make enable tooltips for variable values during debugging. Since this can slow down debugging and does not provide reliable information as it does not use scope information, it is switched off by default. + + + Use tooltips while debugging + + + + + + + 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. + + + Debug Custom Dumpers + + + From 8ba0eb21481edbfaf521fd07c8266a84b80153b4 Mon Sep 17 00:00:00 2001 From: Daniel Molkentin Date: Wed, 14 Jan 2009 18:10:59 +0100 Subject: [PATCH 05/23] Revert improper commit --- doc/doc.pri | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/doc/doc.pri b/doc/doc.pri index 2e8d7e5e906..e9e34fe733b 100644 --- a/doc/doc.pri +++ b/doc/doc.pri @@ -2,8 +2,7 @@ unix { QDOC = SRCDIR=$$PWD OUTDIR=$$OUT_PWD/doc/html $$(QTDIR)/tools/qdoc3/qdoc3 HELPGENERATOR = $$(QTDIR)/bin/qhelpgenerator } else { - QDOC = set SRCDIR=$$PWD&& set OUTDIR=$$OUT_PWD/doc/html&& cmd /k $$(QTDIR)\tools\qdoc3\release\qdoc3.exe - QDOC = $$replace(QDOC, "/", "\\\\") + QDOC = set SRCDIR=$$PWD&& set OUTDIR=$$OUT_PWD/doc/html&& $$(QTDIR)\tools\qdoc3\release\qdoc3.exe HELPGENERATOR = $$(QTDIR)\bin\qhelpgenerator.exe } From f60b69eb6ec48e28d8399f82ac29a908b1939442 Mon Sep 17 00:00:00 2001 From: Daniel Molkentin Date: Wed, 14 Jan 2009 19:21:23 +0100 Subject: [PATCH 06/23] Fixes: make docs target with nmake --- doc/doc.pri | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/doc.pri b/doc/doc.pri index e9e34fe733b..e51280c4236 100644 --- a/doc/doc.pri +++ b/doc/doc.pri @@ -9,7 +9,7 @@ unix { QHP_FILE = $$OUT_PWD/doc/html/qtcreator.qhp QCH_FILE = $$OUT_PWD/doc/qtcreator.qch -html_docs.commands =$$QDOC $$PWD/qtcreator.qdocconf +html_docs.commands = "$$QDOC $$PWD/qtcreator.qdocconf" html_docs.depends += $$PWD/qtcreator.qdoc $$PWD/qtcreator.qdocconf html_docs.files = $$QHP_FILE From 86b70b6a988efd037658753422323d709ba7b2a2 Mon Sep 17 00:00:00 2001 From: Daniel Molkentin Date: Wed, 14 Jan 2009 19:39:11 +0100 Subject: [PATCH 07/23] Fixes: Refine fix for nmake doc issue --- doc/doc.pri | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/doc.pri b/doc/doc.pri index e51280c4236..a41b68ec873 100644 --- a/doc/doc.pri +++ b/doc/doc.pri @@ -9,7 +9,7 @@ unix { QHP_FILE = $$OUT_PWD/doc/html/qtcreator.qhp QCH_FILE = $$OUT_PWD/doc/qtcreator.qch -html_docs.commands = "$$QDOC $$PWD/qtcreator.qdocconf" +html_docs.commands = \"$$QDOC $$PWD/qtcreator.qdocconf\" html_docs.depends += $$PWD/qtcreator.qdoc $$PWD/qtcreator.qdocconf html_docs.files = $$QHP_FILE From dc9ad66d36af8e220bce3f21fca1ab3bc465f163 Mon Sep 17 00:00:00 2001 From: Daniel Molkentin Date: Wed, 14 Jan 2009 20:08:39 +0100 Subject: [PATCH 08/23] Fixes: Regression for make docs on unix --- doc/doc.pri | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/doc/doc.pri b/doc/doc.pri index a41b68ec873..4207e364c76 100644 --- a/doc/doc.pri +++ b/doc/doc.pri @@ -9,7 +9,11 @@ unix { QHP_FILE = $$OUT_PWD/doc/html/qtcreator.qhp QCH_FILE = $$OUT_PWD/doc/qtcreator.qch +unix { +html_docs.commands = $$QDOC $$PWD/qtcreator.qdocconf +} else { html_docs.commands = \"$$QDOC $$PWD/qtcreator.qdocconf\" +} html_docs.depends += $$PWD/qtcreator.qdoc $$PWD/qtcreator.qdocconf html_docs.files = $$QHP_FILE From 5fcc57e531bc8838edfeb392485ade240c0abf81 Mon Sep 17 00:00:00 2001 From: hjk Date: Thu, 15 Jan 2009 12:54:33 +0100 Subject: [PATCH 09/23] fix typo in ui file --- src/plugins/debugger/debuggerplugin.cpp | 10 ---------- src/plugins/debugger/gdboptionpage.ui | 2 +- 2 files changed, 1 insertion(+), 11 deletions(-) diff --git a/src/plugins/debugger/debuggerplugin.cpp b/src/plugins/debugger/debuggerplugin.cpp index bf8edf404e2..3f12a029106 100644 --- a/src/plugins/debugger/debuggerplugin.cpp +++ b/src/plugins/debugger/debuggerplugin.cpp @@ -106,13 +106,7 @@ const char * const JUMP_TO_LINE = "Debugger.JumpToLine"; const char * const TOGGLE_BREAK = "Debugger.ToggleBreak"; const char * const BREAK_BY_FUNCTION = "Debugger.BreakByFunction"; const char * const BREAK_AT_MAIN = "Debugger.BreakAtMain"; -const char * const DEBUG_DUMPERS = "Debugger.DebugDumpers"; const char * const ADD_TO_WATCH = "Debugger.AddToWatch"; -const char * const USE_CUSTOM_DUMPERS = "Debugger.UseCustomDumpers"; -const char * const USE_FAST_START = "Debugger.UseFastStart"; -const char * const USE_TOOL_TIPS = "Debugger.UseToolTips"; -const char * const SKIP_KNOWN_FRAMES = "Debugger.SkipKnownFrames"; -const char * const DUMP_LOG = "Debugger.DumpLog"; #ifdef Q_OS_MAC const char * const INTERRUPT_KEY = "Shift+F5"; @@ -291,10 +285,6 @@ QWidget *GdbOptionPage::createPage(QWidget *parent) //cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+D,Ctrl+L"))); cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+Shift+F11"))); mdebug->addAction(cmd); - - cmd = am->registerAction(m_manager->m_debugDumpersAction, - Constants::DEBUG_DUMPERS, debuggercontext); - mdebug->addAction(cmd); #endif #endif diff --git a/src/plugins/debugger/gdboptionpage.ui b/src/plugins/debugger/gdboptionpage.ui index 354eb64233f..757ed1d7023 100644 --- a/src/plugins/debugger/gdboptionpage.ui +++ b/src/plugins/debugger/gdboptionpage.ui @@ -36,7 +36,7 @@ - + This is either a full abolute path leading to the gdb binary you intend to use or the name of a gdb binary that wiull be searched in your PATH. From 8ddd2647665b06c4df5aeeccdcbfc6de6ea592c3 Mon Sep 17 00:00:00 2001 From: Kavindra Palaraja Date: Thu, 15 Jan 2009 13:07:25 +0100 Subject: [PATCH 10/23] Fixes: Documentation - some documentation on Qt Creator's support for version control systems RevBy: Provided by fkleint --- doc/qtcreator.qdoc | 48 ++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 46 insertions(+), 2 deletions(-) diff --git a/doc/qtcreator.qdoc b/doc/qtcreator.qdoc index 4918da9f61a..0d2fa7b6216 100644 --- a/doc/qtcreator.qdoc +++ b/doc/qtcreator.qdoc @@ -237,10 +237,14 @@ \i \row - \i Indenting + \i Indenting Blocks \i \row - \i Commenting or Uncommenting + \i Commenting or Uncommenting Blocks + \i + + \row + \i Switch between Header and Source \i \endtable @@ -265,6 +269,11 @@ */ +/*! + +*/ + + /*! \contentspage index.html @@ -756,6 +765,41 @@ \note By default, if you press \key{Ctrl+K} and do not use a prefix to specify a filter, three filters will be enabled: \c{o}, \c{l}, and \c{a}. +*/ + +/*! + \contentspage index.html + \previouspage creator-navigation.html + \page creator-version-control.html + \nextpage creator-debugging.html + + \title Qt Creator and Version Control Systems + + \table + \caption Version control systems supported by Qt Creator + \row + \i \bold{git} + \i \l{http://git-scm.com/} + \row + \i \bold{Subversion} + \i \l{http://subversion.tigris.org/} + \row + \i \bold{Perforce} + \i \l{http://www.perforce.com} + \endtable + + + \section1 Setup + + Qt Creator uses the version control system's command line clients to + access your repositories. To set it up, you must ensure that these command + line clients can be located via the \c{PATH} environment variable. You can + specify the path to the command line client's executable in the settings + pages that can be found under \gui{Options...} in the \gui{Tools} menu. + + + + */ From 68b28bb3b67d9409ab7338ec8cd46cf8f3aca790 Mon Sep 17 00:00:00 2001 From: hjk Date: Thu, 15 Jan 2009 13:32:36 +0100 Subject: [PATCH 11/23] fakevim: add a comment regarding unwanted dependencies --- src/plugins/fakevim/fakevimhandler.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/plugins/fakevim/fakevimhandler.cpp b/src/plugins/fakevim/fakevimhandler.cpp index 72c68c1654d..a56fad81d51 100644 --- a/src/plugins/fakevim/fakevimhandler.cpp +++ b/src/plugins/fakevim/fakevimhandler.cpp @@ -35,10 +35,17 @@ #include "fakevimconstants.h" +// Please do not add any direct dependencies to other Qt Creator code here. +// Instead emit signals and let the FakeVimPlugin channel the information to +// Qt Creator. The idea is to keep this file here in a "clean" state that +// allows easy reuse with any QTextEdit or QPlainTextEdit derived class. + #include #include #include +//#include + #include #include #include @@ -57,11 +64,6 @@ #include #include -//#include -//#include -//#include - -//#include using namespace FakeVim::Internal; using namespace FakeVim::Constants; From 334b1c4b2e07afffcb0b695f12c5350ed497acec Mon Sep 17 00:00:00 2001 From: Kavindra Palaraja Date: Thu, 15 Jan 2009 13:50:22 +0100 Subject: [PATCH 12/23] Fixes: Documentation - more on the VCS integration --- doc/qtcreator.qdoc | 46 ++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 44 insertions(+), 2 deletions(-) diff --git a/doc/qtcreator.qdoc b/doc/qtcreator.qdoc index 0d2fa7b6216..cf84bb151dd 100644 --- a/doc/qtcreator.qdoc +++ b/doc/qtcreator.qdoc @@ -797,9 +797,51 @@ specify the path to the command line client's executable in the settings pages that can be found under \gui{Options...} in the \gui{Tools} menu. - - + \section1 Usage + + You can find the version control menu entires in a sub-menu of the + \gui{Tools} menu. The version control system displayed here is the system + that manages the current project. + + Each version control system adds a pane to the \gui{Application Output} + panes within which it will log the commands it executes, prepended by a + timestamp and the relevant output. + + \image qtcreator-vcs-pane.png + + + \section2 Addings Files + + When you create a new file or a new project, the wizards will display page + requesting whether the files should be added to a version control system. + This depends on whether the parent directory or the project is already + under version control and the system supports the concept of adding files, + e.g., \bold{Perforce} and \bold{Subversion}. Alternatively, you can also + add files later on using the version control tool menus. + + With \bold{git}, there is no concept of adding files. Instead, all modified + files must be \e{staged} for a commit. + + + \section2 Viewing Diff Output + + All version control systems provide menu options to \e{diff} the current + file or project - comparing with the latest version stored in the + repository and displaying the differences. In Qt Creator, a diff is + displayed in a read-only editor. If the file is accessible, you can double + -click on a selected diff chunk and Qt Creator will open an editor + displaying the file, scrolled to the line in question. + + \image qtcreator-vcs-diff.png + + + \section2 Viewing Versioning History and Change Details + + The versioning history of a file can be displayed by selecting the + \gui{Log} (for \bold{git}) or \gui{Filelog (for \bold{Perforce} and + \bold{Subversion})} option. Typically, + */ From f5ab36c15690c2b4bbdb73f00c2e6201faacdc54 Mon Sep 17 00:00:00 2001 From: Kavindra Palaraja Date: Thu, 15 Jan 2009 14:30:18 +0100 Subject: [PATCH 13/23] Fixes: Documentation - even more on VCS --- doc/qtcreator.qdoc | 45 ++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 44 insertions(+), 1 deletion(-) diff --git a/doc/qtcreator.qdoc b/doc/qtcreator.qdoc index cf84bb151dd..c8125fabd85 100644 --- a/doc/qtcreator.qdoc +++ b/doc/qtcreator.qdoc @@ -840,7 +840,50 @@ The versioning history of a file can be displayed by selecting the \gui{Log} (for \bold{git}) or \gui{Filelog (for \bold{Perforce} and - \bold{Subversion})} option. Typically, + \bold{Subversion})} option. Typically, the log output will contain the + date, the commit message, and a change or revision identifier. If you + click on the identifier, a description of the change including the diff + will be displayed. + + \image qtcreator-vcs-log.png + \image qtcreaotr-vcs-describe.png + + + \section2 Annotating Files + + Annotation views are obtained by selecting \gui{Annotate} or \gui{Blame}. + This will display the lines of the file prepended by the change identifier + they originate from. Clicking on the change identifier shows a detailed + description of the file. + + + \section2 Committing Changes + + Once you have finished making changes, you can submit them to the version + control system by choosing \gui{Commit} or \gui{Submit}. Qt Creator will + display a commit page containing a text editor, where you can enter your + commit message, and a checkable list of modified files to be included. + When you are done, click \gui{Commit} to start committing. In addition, + there is a \gui{Diff selected} button that brings up a diff view of the + files selected in the file list. Since the commit page is just another + editor, you can go back to it by closing the diff view. Alternatively, you + can view it from the editor combo box showing the \gui{Opened files}. + + \image qtcreator-vcs-commit.png + + + \section2 Menu Entries Specific to git + + The git sub-menu contains additional entries: + + \table + \row + \i \gui{Stash} + \i Stash local changes prior to executing a \bold{pull}. + \row + \i + \i + \endtable */ From 6027ef37dfd1f33dc21fc47a14595f07518ea7a8 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Thu, 15 Jan 2009 14:48:54 +0100 Subject: [PATCH 14/23] Fixes: rename qtestlib -> testlib module RevBy: Marco --- src/plugins/qt4projectmanager/speinfo.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/qt4projectmanager/speinfo.cpp b/src/plugins/qt4projectmanager/speinfo.cpp index 04df918bb51..16fa5874127 100644 --- a/src/plugins/qt4projectmanager/speinfo.cpp +++ b/src/plugins/qt4projectmanager/speinfo.cpp @@ -491,7 +491,7 @@ public: class InfoItemModulesTest : public SPEInfoItem { public: - InfoItemModulesTest(): SPEInfoItem("qtestlib", QtModule) + InfoItemModulesTest(): SPEInfoItem("testlib", QtModule) { m_data.insert(keyIncludedByDefault, false); } From 399f8d63ebc9ee245fc0c320dc64bf2a9a6070c3 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Thu, 15 Jan 2009 14:19:13 +0100 Subject: [PATCH 15/23] cleanup --- src/plugins/debugger/debugger.pro | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/plugins/debugger/debugger.pro b/src/plugins/debugger/debugger.pro index 5a21d6a42d7..80521765fe3 100644 --- a/src/plugins/debugger/debugger.pro +++ b/src/plugins/debugger/debugger.pro @@ -40,7 +40,7 @@ HEADERS += attachexternaldialog.h \ threadswindow.h \ watchhandler.h \ watchwindow.h - + SOURCES += attachexternaldialog.cpp \ attachremotedialog.cpp \ breakhandler.cpp \ @@ -54,7 +54,6 @@ SOURCES += attachexternaldialog.cpp \ disassemblerwindow.cpp \ gdbengine.cpp \ gdbmi.cpp \ - gdbengine.h \ moduleshandler.cpp \ moduleswindow.cpp \ procinterrupt.cpp \ From a5f6281f1af6ceb39149661c57e0716235788ed1 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Wed, 14 Jan 2009 21:12:58 +0100 Subject: [PATCH 16/23] improve messages --- src/plugins/projectexplorer/applicationrunconfiguration.cpp | 2 +- tests/manual/gdbdebugger/simple/plugin.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/projectexplorer/applicationrunconfiguration.cpp b/src/plugins/projectexplorer/applicationrunconfiguration.cpp index fc936d2c431..2e4789170a7 100644 --- a/src/plugins/projectexplorer/applicationrunconfiguration.cpp +++ b/src/plugins/projectexplorer/applicationrunconfiguration.cpp @@ -141,7 +141,7 @@ void ApplicationRunControl::start() m_executable, rc->commandLineArguments()); emit started(); - emit addToOutputWindow(this, tr("Starting %1").arg(m_executable)); + emit addToOutputWindow(this, tr("Starting %1...").arg(m_executable)); } void ApplicationRunControl::stop() diff --git a/tests/manual/gdbdebugger/simple/plugin.cpp b/tests/manual/gdbdebugger/simple/plugin.cpp index 4e02c7f9f7e..5e140d5811e 100644 --- a/tests/manual/gdbdebugger/simple/plugin.cpp +++ b/tests/manual/gdbdebugger/simple/plugin.cpp @@ -39,6 +39,6 @@ extern "C" Q_DECL_EXPORT int pluginTest() int s = 0; for (int i = 1; i != 2000; ++i) s += i; - fprintf(stderr, "in plugin test"); + fprintf(stderr, "in plugin test\n"); return s; } From edefcfe4aa8fee0848cdca2eb376669a9c3fc135 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Thu, 15 Jan 2009 14:38:28 +0100 Subject: [PATCH 17/23] error messagebox upon failure to start up dbg --- src/plugins/debugger/gdbengine.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/plugins/debugger/gdbengine.cpp b/src/plugins/debugger/gdbengine.cpp index 2370a55eed2..b3cee40aaf4 100644 --- a/src/plugins/debugger/gdbengine.cpp +++ b/src/plugins/debugger/gdbengine.cpp @@ -1530,8 +1530,11 @@ bool GdbEngine::startDebugger() m_gdbProc.start(q->settings()->m_gdbCmd, gdbArgs); m_gdbProc.waitForStarted(); - if (m_gdbProc.state() != QProcess::Running) + if (m_gdbProc.state() != QProcess::Running) { + QMessageBox::critical(q->mainWindow(), tr("Debugger Startup Failure"), + tr("Cannot start debugger: %1").arg(m_gdbProc.errorString())); return false; + } q->showStatusMessage(tr("Gdb Running")); From 72b6a105b7b01f29bdce06709e5029ed6748364a Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Thu, 15 Jan 2009 14:30:49 +0100 Subject: [PATCH 18/23] app output window reorga - drop prefix magic - avoid inserting stray newlines this also fixes the overquoting of app output. --- src/plugins/debugger/debuggermanager.cpp | 4 ++-- src/plugins/debugger/debuggermanager.h | 6 +++--- src/plugins/debugger/debuggerrunner.cpp | 11 ++++------- src/plugins/debugger/debuggerrunner.h | 2 +- src/plugins/debugger/gdbengine.cpp | 10 +++++----- src/plugins/debugger/gdbengine.h | 2 +- .../projectexplorer/applicationlauncher.h | 8 ++++++++ .../projectexplorer/applicationlauncher_win.cpp | 5 +---- .../projectexplorer/applicationlauncher_x11.cpp | 11 ++++------- .../applicationrunconfiguration.cpp | 2 +- src/plugins/projectexplorer/outputwindow.cpp | 17 ++++++++++++++++- src/plugins/projectexplorer/outputwindow.h | 2 ++ src/plugins/projectexplorer/projectexplorer.cpp | 7 +++++++ src/plugins/projectexplorer/projectexplorer.h | 1 + src/plugins/projectexplorer/runconfiguration.h | 1 + 15 files changed, 57 insertions(+), 32 deletions(-) diff --git a/src/plugins/debugger/debuggermanager.cpp b/src/plugins/debugger/debuggermanager.cpp index ea0e6623b06..e2840fb7180 100644 --- a/src/plugins/debugger/debuggermanager.cpp +++ b/src/plugins/debugger/debuggermanager.cpp @@ -590,9 +590,9 @@ void DebuggerManager::notifyInferiorPidChanged(int pid) emit inferiorPidChanged(pid); } -void DebuggerManager::showApplicationOutput(const QString &prefix, const QString &str) +void DebuggerManager::showApplicationOutput(const QString &str) { - emit applicationOutputAvailable(prefix, str); + emit applicationOutputAvailable(str); } void DebuggerManager::shutdown() diff --git a/src/plugins/debugger/debuggermanager.h b/src/plugins/debugger/debuggermanager.h index 9a5b5da37d3..f3d76bb531e 100644 --- a/src/plugins/debugger/debuggermanager.h +++ b/src/plugins/debugger/debuggermanager.h @@ -166,7 +166,7 @@ private: virtual ThreadsHandler *threadsHandler() = 0; virtual WatchHandler *watchHandler() = 0; - virtual void showApplicationOutput(const QString &prefix, const QString &data) = 0; + virtual void showApplicationOutput(const QString &data) = 0; //virtual QAction *useCustomDumpersAction() const = 0; //virtual QAction *debugDumpersAction() const = 0; virtual bool skipKnownFrames() const = 0; @@ -285,7 +285,7 @@ public slots: private slots: void showDebuggerOutput(const QString &prefix, const QString &msg); void showDebuggerInput(const QString &prefix, const QString &msg); - void showApplicationOutput(const QString &prefix, const QString &msg); + void showApplicationOutput(const QString &data); void reloadDisassembler(); void disassemblerDockToggled(bool on); @@ -365,7 +365,7 @@ signals: void setSessionValueRequested(const QString &name, const QVariant &value); void configValueRequested(const QString &name, QVariant *value); void setConfigValueRequested(const QString &name, const QVariant &value); - void applicationOutputAvailable(const QString &prefix, const QString &msg); + void applicationOutputAvailable(const QString &output); public: // FIXME: make private diff --git a/src/plugins/debugger/debuggerrunner.cpp b/src/plugins/debugger/debuggerrunner.cpp index 45eecd6514e..7f3e42f47fa 100644 --- a/src/plugins/debugger/debuggerrunner.cpp +++ b/src/plugins/debugger/debuggerrunner.cpp @@ -108,8 +108,8 @@ DebuggerRunControl::DebuggerRunControl(DebuggerManager *manager, { connect(m_manager, SIGNAL(debuggingFinished()), this, SLOT(debuggingFinished())); - connect(m_manager, SIGNAL(applicationOutputAvailable(QString, QString)), - this, SLOT(slotAddToOutputWindow(QString, QString))); + connect(m_manager, SIGNAL(applicationOutputAvailable(QString)), + this, SLOT(slotAddToOutputWindowInline(QString))); connect(m_manager, SIGNAL(inferiorPidChanged(qint64)), this, SLOT(bringApplicationToForeground(qint64))); } @@ -138,12 +138,9 @@ void DebuggerRunControl::start() debuggingFinished(); } -void DebuggerRunControl::slotAddToOutputWindow(const QString &prefix, const QString &line) +void DebuggerRunControl::slotAddToOutputWindowInline(const QString &data) { - Q_UNUSED(prefix); - foreach (const QString &l, line.split('\n')) - emit addToOutputWindow(this, prefix + Qt::escape(l)); - //emit addToOutputWindow(this, prefix + Qt::escape(line)); + emit addToOutputWindowInline(this, data); } void DebuggerRunControl::stop() diff --git a/src/plugins/debugger/debuggerrunner.h b/src/plugins/debugger/debuggerrunner.h index c10a84e4795..0c6d979c010 100644 --- a/src/plugins/debugger/debuggerrunner.h +++ b/src/plugins/debugger/debuggerrunner.h @@ -84,7 +84,7 @@ public: private slots: void debuggingFinished(); - void slotAddToOutputWindow(const QString &prefix, const QString &line); + void slotAddToOutputWindowInline(const QString &output); private: DebuggerManager *m_manager; diff --git a/src/plugins/debugger/gdbengine.cpp b/src/plugins/debugger/gdbengine.cpp index b3cee40aaf4..b9792717348 100644 --- a/src/plugins/debugger/gdbengine.cpp +++ b/src/plugins/debugger/gdbengine.cpp @@ -275,8 +275,8 @@ void GdbEngine::init() connect(this, SIGNAL(gdbInputAvailable(QString,QString)), q, SLOT(showDebuggerInput(QString,QString)), Qt::QueuedConnection); - connect(this, SIGNAL(applicationOutputAvailable(QString,QString)), - q, SLOT(showApplicationOutput(QString,QString)), + connect(this, SIGNAL(applicationOutputAvailable(QString)), + q, SLOT(showApplicationOutput(QString)), Qt::QueuedConnection); } @@ -419,7 +419,7 @@ void GdbEngine::handleResponse() //s += '\n'; m_inbuffer = QByteArray(from, to - from); - emit applicationOutputAvailable("app-stdout: ", s); + emit applicationOutputAvailable(s); continue; } @@ -591,7 +591,7 @@ static void fixMac(QByteArray &out) void GdbEngine::readGdbStandardError() { QByteArray err = m_gdbProc.readAllStandardError(); - emit applicationOutputAvailable("app-stderr:", err); + emit applicationOutputAvailable(err); } void GdbEngine::readGdbStandardOutput() @@ -1078,7 +1078,7 @@ void GdbEngine::handleStreamOutput(const QString &data, char code) // On Windows, the contents seem to depend on the debugger // version and/or OS version used. if (data.startsWith("warning:")) - qq->showApplicationOutput(QString(), data); + qq->showApplicationOutput(data); break; } diff --git a/src/plugins/debugger/gdbengine.h b/src/plugins/debugger/gdbengine.h index e07e6a228c3..abf920c91e9 100644 --- a/src/plugins/debugger/gdbengine.h +++ b/src/plugins/debugger/gdbengine.h @@ -93,7 +93,7 @@ signals: void gdbResponseAvailable(); void gdbInputAvailable(const QString &prefix, const QString &msg); void gdbOutputAvailable(const QString &prefix, const QString &msg); - void applicationOutputAvailable(const QString &prefix, const QString &msg); + void applicationOutputAvailable(const QString &output); private: // diff --git a/src/plugins/projectexplorer/applicationlauncher.h b/src/plugins/projectexplorer/applicationlauncher.h index ead2799453e..82876e61f76 100644 --- a/src/plugins/projectexplorer/applicationlauncher.h +++ b/src/plugins/projectexplorer/applicationlauncher.h @@ -37,6 +37,9 @@ #include #include #include +#ifndef Q_OS_WIN +#include +#endif namespace ProjectExplorer { namespace Internal { @@ -88,7 +91,12 @@ private: ConsoleProcess *m_consoleProcess; Mode m_currentMode; +#ifdef Q_OS_WIN WinGuiProcess *m_winGuiProcess; +#else + QTextCodec *m_outputCodec; + QTextCodec::ConverterState m_outputCodecState; +#endif }; } // namespace Internal diff --git a/src/plugins/projectexplorer/applicationlauncher_win.cpp b/src/plugins/projectexplorer/applicationlauncher_win.cpp index c6279b4c3cf..374d26c97b1 100644 --- a/src/plugins/projectexplorer/applicationlauncher_win.cpp +++ b/src/plugins/projectexplorer/applicationlauncher_win.cpp @@ -116,10 +116,7 @@ qint64 ApplicationLauncher::applicationPID() const void ApplicationLauncher::readWinDebugOutput(const QString &output) { - QString s = output; - if (s.endsWith(QLatin1Char('\n'))) - s.chop(1); - emit appendOutput(s); + emit appendOutput(output); } void ApplicationLauncher::processStopped() diff --git a/src/plugins/projectexplorer/applicationlauncher_x11.cpp b/src/plugins/projectexplorer/applicationlauncher_x11.cpp index 79933d4518b..78214746a2e 100644 --- a/src/plugins/projectexplorer/applicationlauncher_x11.cpp +++ b/src/plugins/projectexplorer/applicationlauncher_x11.cpp @@ -41,6 +41,7 @@ using namespace ProjectExplorer::Internal; ApplicationLauncher::ApplicationLauncher(QObject *parent) : QObject(parent) { + m_outputCodec = QTextCodec::codecForLocale(); m_currentMode = Gui; m_guiProcess = new QProcess(this); m_guiProcess->setReadChannelMode(QProcess::MergedChannels); @@ -132,13 +133,9 @@ void ApplicationLauncher::guiProcessError() void ApplicationLauncher::readStandardOutput() { - m_guiProcess->setReadChannel(QProcess::StandardOutput); - while (m_guiProcess->canReadLine()) { - QString line = QString::fromLocal8Bit(m_guiProcess->readLine()); - if (line.endsWith(QLatin1Char('\n'))) - line.chop(1); - emit appendOutput(line); - } + QByteArray data = m_guiProcess->readAllStandardOutput(); + emit appendOutput(m_outputCodec->toUnicode( + data.constData(), data.length(), &m_outputCodecState)); } void ApplicationLauncher::processStopped() diff --git a/src/plugins/projectexplorer/applicationrunconfiguration.cpp b/src/plugins/projectexplorer/applicationrunconfiguration.cpp index 2e4789170a7..0eeae6e8eef 100644 --- a/src/plugins/projectexplorer/applicationrunconfiguration.cpp +++ b/src/plugins/projectexplorer/applicationrunconfiguration.cpp @@ -162,7 +162,7 @@ void ApplicationRunControl::slotError(const QString & err) void ApplicationRunControl::slotAddToOutputWindow(const QString &line) { - emit addToOutputWindow(this, Qt::escape(line)); + emit addToOutputWindowInline(this, line); } void ApplicationRunControl::processExited(int exitCode) diff --git a/src/plugins/projectexplorer/outputwindow.cpp b/src/plugins/projectexplorer/outputwindow.cpp index c02f21ff34b..d34c3f2bb0e 100644 --- a/src/plugins/projectexplorer/outputwindow.cpp +++ b/src/plugins/projectexplorer/outputwindow.cpp @@ -215,6 +215,12 @@ void OutputPane::appendOutput(RunControl *rc, const QString &out) ow->appendOutput(out); } +void OutputPane::appendOutputInline(RunControl *rc, const QString &out) +{ + OutputWindow *ow = m_outputWindows.value(rc); + ow->appendOutputInline(out); +} + void OutputPane::showTabFor(RunControl *rc) { OutputWindow *ow = m_outputWindows.value(rc); @@ -318,7 +324,16 @@ OutputWindow::~OutputWindow() void OutputWindow::appendOutput(const QString &out) { - appendPlainText(out); + if (out.endsWith('\n')) + appendPlainText(out); + else + appendPlainText(out + '\n'); +} + +void OutputWindow::appendOutputInline(const QString &out) +{ + moveCursor(QTextCursor::End); + insertPlainText(out); } void OutputWindow::insertLine() diff --git a/src/plugins/projectexplorer/outputwindow.h b/src/plugins/projectexplorer/outputwindow.h index 6bda6121af6..674f25cd51d 100644 --- a/src/plugins/projectexplorer/outputwindow.h +++ b/src/plugins/projectexplorer/outputwindow.h @@ -83,6 +83,7 @@ public: // ApplicationOutputspecifics void createNewOutputWindow(RunControl *rc); void appendOutput(RunControl *rc, const QString &out); + void appendOutputInline(RunControl *rc, const QString &out); void showTabFor(RunControl *rc); public slots: @@ -119,6 +120,7 @@ public: ~OutputWindow(); void appendOutput(const QString &out); + void appendOutputInline(const QString &out); void insertLine(); }; diff --git a/src/plugins/projectexplorer/projectexplorer.cpp b/src/plugins/projectexplorer/projectexplorer.cpp index 2d6224bbdda..c6cb624fb86 100644 --- a/src/plugins/projectexplorer/projectexplorer.cpp +++ b/src/plugins/projectexplorer/projectexplorer.cpp @@ -1084,6 +1084,8 @@ void ProjectExplorerPlugin::buildQueueFinished(bool success) connect(control, SIGNAL(addToOutputWindow(RunControl *, const QString &)), this, SLOT(addToApplicationOutputWindow(RunControl *, const QString &))); + connect(control, SIGNAL(addToOutputWindowInline(RunControl *, const QString &)), + this, SLOT(addToApplicationOutputWindowInline(RunControl *, const QString &))); connect(control, SIGNAL(error(RunControl *, const QString &)), this, SLOT(addErrorToApplicationOutputWindow(RunControl *, const QString &))); connect(control, SIGNAL(finished()), @@ -1379,6 +1381,11 @@ void ProjectExplorerPlugin::addToApplicationOutputWindow(RunControl *rc, const Q m_outputPane->appendOutput(rc, line); } +void ProjectExplorerPlugin::addToApplicationOutputWindowInline(RunControl *rc, const QString &line) +{ + m_outputPane->appendOutputInline(rc, line); +} + void ProjectExplorerPlugin::addErrorToApplicationOutputWindow(RunControl *rc, const QString &error) { m_outputPane->appendOutput(rc, error); diff --git a/src/plugins/projectexplorer/projectexplorer.h b/src/plugins/projectexplorer/projectexplorer.h index 2c1127ff5c6..1d270226d1a 100644 --- a/src/plugins/projectexplorer/projectexplorer.h +++ b/src/plugins/projectexplorer/projectexplorer.h @@ -180,6 +180,7 @@ private slots: void updateRunAction(); void addToApplicationOutputWindow(RunControl *, const QString &line); + void addToApplicationOutputWindowInline(RunControl *, const QString &line); void addErrorToApplicationOutputWindow(RunControl *, const QString &error); void updateTaskActions(); diff --git a/src/plugins/projectexplorer/runconfiguration.h b/src/plugins/projectexplorer/runconfiguration.h index acc11cd932a..0bd593c20e2 100644 --- a/src/plugins/projectexplorer/runconfiguration.h +++ b/src/plugins/projectexplorer/runconfiguration.h @@ -143,6 +143,7 @@ public: QSharedPointer runConfiguration(); signals: void addToOutputWindow(RunControl *, const QString &line); + void addToOutputWindowInline(RunControl *, const QString &line); void error(RunControl *, const QString &error); void started(); void finished(); From 20eb6a1b82f2a5b88d15cf438420789d81d1704b Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Thu, 15 Jan 2009 14:47:14 +0100 Subject: [PATCH 19/23] user gdb's --tty option for collecting app output --- src/plugins/debugger/debugger.pro | 2 + src/plugins/debugger/gdbengine.cpp | 39 ++--- src/plugins/debugger/gdbengine.h | 7 + src/plugins/debugger/outputcollector.cpp | 179 +++++++++++++++++++++++ src/plugins/debugger/outputcollector.h | 91 ++++++++++++ 5 files changed, 300 insertions(+), 18 deletions(-) create mode 100644 src/plugins/debugger/outputcollector.cpp create mode 100644 src/plugins/debugger/outputcollector.h diff --git a/src/plugins/debugger/debugger.pro b/src/plugins/debugger/debugger.pro index 80521765fe3..469ea346011 100644 --- a/src/plugins/debugger/debugger.pro +++ b/src/plugins/debugger/debugger.pro @@ -30,6 +30,7 @@ HEADERS += attachexternaldialog.h \ imports.h \ moduleshandler.h \ moduleswindow.h \ + outputcollector.h \ procinterrupt.h \ registerhandler.h \ registerwindow.h \ @@ -56,6 +57,7 @@ SOURCES += attachexternaldialog.cpp \ gdbmi.cpp \ moduleshandler.cpp \ moduleswindow.cpp \ + outputcollector.cpp \ procinterrupt.cpp \ registerhandler.cpp \ registerwindow.cpp \ diff --git a/src/plugins/debugger/gdbengine.cpp b/src/plugins/debugger/gdbengine.cpp index b9792717348..78d2522639b 100644 --- a/src/plugins/debugger/gdbengine.cpp +++ b/src/plugins/debugger/gdbengine.cpp @@ -252,6 +252,7 @@ void GdbEngine::init() m_pendingRequests = 0; m_gdbVersion = 100; m_shared = 0; + m_outputCodec = QTextCodec::codecForLocale(); m_oldestAcceptableToken = -1; @@ -266,6 +267,8 @@ void GdbEngine::init() SLOT(exitDebugger())); // Output + connect(&m_outputCollector, SIGNAL(byteDelivery(QByteArray)), + SLOT(readDebugeeOutput(QByteArray))); connect(this, SIGNAL(gdbResponseAvailable()), this, SLOT(handleResponse()), Qt::QueuedConnection); @@ -355,6 +358,12 @@ static void skipTerminator(const char *&from, const char *to) skipSpaces(from, to); } +void GdbEngine::readDebugeeOutput(const QByteArray &data) +{ + emit applicationOutputAvailable(m_outputCodec->toUnicode( + data.constData(), data.length(), &m_outputCodecState)); +} + // called asyncronously as response to Gdb stdout output in // gdbResponseAvailable() void GdbEngine::handleResponse() @@ -407,22 +416,6 @@ void GdbEngine::handleResponse() break; } - if (token == -1 && *from != '&' && *from != '~' && *from != '*') { - // FIXME: On Linux the application's std::out is merged in here. - // High risk of falsely interpreting this as MI output. - // We assume that we _always_ use tokens, so not finding a token - // is a positive indication for the presence of application output. - QString s; - while (from != to && *from != '\n') - s += *from++; - //qDebug() << "UNREQUESTED DATA " << s << " TAKEN AS APPLICATION OUTPUT"; - //s += '\n'; - - m_inbuffer = QByteArray(from, to - from); - emit applicationOutputAvailable(s); - continue; - } - // next char decides kind of record const char c = *from++; //qDebug() << "CODE:" << c; @@ -590,8 +583,7 @@ static void fixMac(QByteArray &out) void GdbEngine::readGdbStandardError() { - QByteArray err = m_gdbProc.readAllStandardError(); - emit applicationOutputAvailable(err); + qWarning() << "Unexpected gdb stderr:" << m_gdbProc.readAllStandardError(); } void GdbEngine::readGdbStandardOutput() @@ -1484,6 +1476,7 @@ void GdbEngine::exitDebugger() m_varToType.clear(); m_dataDumperState = DataDumperUninitialized; m_shared = 0; + m_outputCollector.shutdown(); //q->settings()->m_debugDumpers = false; } @@ -1506,6 +1499,15 @@ bool GdbEngine::startDebugger() return false; } + if (!m_outputCollector.listen()) { + QMessageBox::critical(q->mainWindow(), tr("Debugger Startup Failure"), + tr("Cannot set up communication with child process: %1") + .arg(m_outputCollector.errorString())); + return false; + } + + gdbArgs.prepend(QLatin1String("--tty=") + m_outputCollector.serverName()); + //gdbArgs.prepend(QLatin1String("--quiet")); gdbArgs.prepend(QLatin1String("mi")); gdbArgs.prepend(QLatin1String("-i")); @@ -1533,6 +1535,7 @@ bool GdbEngine::startDebugger() if (m_gdbProc.state() != QProcess::Running) { QMessageBox::critical(q->mainWindow(), tr("Debugger Startup Failure"), tr("Cannot start debugger: %1").arg(m_gdbProc.errorString())); + m_outputCollector.shutdown(); return false; } diff --git a/src/plugins/debugger/gdbengine.h b/src/plugins/debugger/gdbengine.h index abf920c91e9..60493a53e58 100644 --- a/src/plugins/debugger/gdbengine.h +++ b/src/plugins/debugger/gdbengine.h @@ -36,6 +36,7 @@ #include "idebuggerengine.h" #include "gdbmi.h" +#include "outputcollector.h" #include #include @@ -43,6 +44,7 @@ #include #include #include +#include #include QT_BEGIN_NAMESPACE @@ -173,6 +175,7 @@ private slots: void gdbProcError(QProcess::ProcessError error); void readGdbStandardOutput(); void readGdbStandardError(); + void readDebugeeOutput(const QByteArray &data); private: int terminationIndex(const QByteArray &buffer, int &length); @@ -190,6 +193,10 @@ private: void handleQueryPwd(const GdbResultRecord &response); void handleQuerySources(const GdbResultRecord &response); + OutputCollector m_outputCollector; + QTextCodec *m_outputCodec; + QTextCodec::ConverterState m_outputCodecState; + QByteArray m_inbuffer; QProcess m_gdbProc; diff --git a/src/plugins/debugger/outputcollector.cpp b/src/plugins/debugger/outputcollector.cpp new file mode 100644 index 00000000000..9efb18c95a3 --- /dev/null +++ b/src/plugins/debugger/outputcollector.cpp @@ -0,0 +1,179 @@ +/*************************************************************************** +** +** 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) +** +** +** Non-Open Source Usage +** +** Licensees may use this file in accordance with the Qt Beta Version +** License Agreement, Agreement version 2.2 provided with the Software or, +** alternatively, in accordance with the terms contained in a written +** agreement between you and Nokia. +** +** GNU General Public License Usage +** +** Alternatively, this file may be used under the terms of the GNU General +** Public License versions 2.0 or 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the packaging +** of this file. Please review the following information to ensure GNU +** General Public Licensing requirements will be met: +** +** http://www.fsf.org/licensing/licenses/info/GPLv2.html and +** http://www.gnu.org/copyleft/gpl.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt GPL Exception +** version 1.3, included in the file GPL_EXCEPTION.txt in this package. +** +***************************************************************************/ + +#include "outputcollector.h" + +#ifdef Q_OS_WIN + +#include +#include + +#else + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#endif + +namespace Debugger { +namespace Internal { + +OutputCollector::OutputCollector(QObject *parent) + : QObject(parent) +{ +#ifdef Q_OS_WIN + m_server = 0; + m_socket = 0; +#endif +} + +OutputCollector::~OutputCollector() +{ + shutdown(); +} + +bool OutputCollector::listen() +{ +#ifdef Q_OS_WIN + if (m_server) + return m_server->isListening(); + m_server = new QLocalServer(this); + connect(m_server, SIGNAL(newConnection()), SLOT(newConnectionAvailable())); + return m_server->listen(QLatin1String("creator-") + QCoreApplication::applicationPid()); // XXX how to make that secure? +#else + if (!m_serverPath.isEmpty()) + return true; + QByteArray codedServerPath; + forever { + { + QTemporaryFile tf; + if (!tf.open()) { + m_errorString = tr("Cannot create temporary file: %2").arg(tf.errorString()); + m_serverPath.clear(); + return false; + } + m_serverPath = tf.fileName(); + } + // By now the temp file was deleted again + codedServerPath = QFile::encodeName(m_serverPath); + if (!::mkfifo(codedServerPath.constData(), 0600)) + break; + if (errno != EEXIST) { + m_errorString = tr("Cannot create FiFo %1: %2").arg(m_serverPath, strerror(errno)); + m_serverPath.clear(); + return false; + } + } + if ((m_serverFd = ::open(codedServerPath.constData(), O_RDONLY|O_NONBLOCK)) < 0) { + m_errorString = tr("Cannot open FiFo %1: %2").arg(m_serverPath, strerror(errno)); + m_serverPath.clear(); + return false; + } + m_serverNotifier = new QSocketNotifier(m_serverFd, QSocketNotifier::Read, this); + connect(m_serverNotifier, SIGNAL(activated(int)), SLOT(bytesAvailable())); + return true; +#endif +} + +void OutputCollector::shutdown() +{ +#ifdef Q_OS_WIN + delete m_server; // Deletes socket as well (QObject parent) + m_server = 0; + m_socket = 0; +#else + if (!m_serverPath.isEmpty()) { + ::close(m_serverFd); + ::unlink(QFile::encodeName(m_serverPath).constData()); + delete m_serverNotifier; + m_serverPath.clear(); + } +#endif +} + +QString OutputCollector::errorString() const +{ +#ifdef Q_OS_WIN + return m_socket ? m_socket->errorString() : m_server->errorString(); +#else + return m_errorString; +#endif +} + +QString OutputCollector::serverName() const +{ +#ifdef Q_OS_WIN + return m_server->fullServerPath(); +#else + return m_serverPath; +#endif +} + +#ifdef Q_OS_WIN +void OutputCollector::newConnectionAvailable() +{ + if (m_socket) + return; + m_socket = m_server->nextPendingConnection(); + connect(m_socket, SIGNAL(bytesAvailable()), SLOT(bytesAvailable())); +} +#endif + +void OutputCollector::bytesAvailable() +{ +#ifdef Q_OS_WIN + emit byteDelivery(m_socket->readAll()); +#else + size_t nbytes = 0; + if (::ioctl(m_serverFd, FIONREAD, (char *) &nbytes) < 0) + return; + QVarLengthArray buff(nbytes); + if (::read(m_serverFd, buff.data(), nbytes) != (int)nbytes) + return; + if (nbytes) // Skip EOF notifications + emit byteDelivery(QByteArray::fromRawData(buff.data(), nbytes)); +#endif +} + +} // namespace Internal +} // namespace Debugger diff --git a/src/plugins/debugger/outputcollector.h b/src/plugins/debugger/outputcollector.h new file mode 100644 index 00000000000..b84a1b36100 --- /dev/null +++ b/src/plugins/debugger/outputcollector.h @@ -0,0 +1,91 @@ +/*************************************************************************** +** +** 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) +** +** +** Non-Open Source Usage +** +** Licensees may use this file in accordance with the Qt Beta Version +** License Agreement, Agreement version 2.2 provided with the Software or, +** alternatively, in accordance with the terms contained in a written +** agreement between you and Nokia. +** +** GNU General Public License Usage +** +** Alternatively, this file may be used under the terms of the GNU General +** Public License versions 2.0 or 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the packaging +** of this file. Please review the following information to ensure GNU +** General Public Licensing requirements will be met: +** +** http://www.fsf.org/licensing/licenses/info/GPLv2.html and +** http://www.gnu.org/copyleft/gpl.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt GPL Exception +** version 1.3, included in the file GPL_EXCEPTION.txt in this package. +** +***************************************************************************/ + +#ifndef OUTPUT_COLLECTOR_H +#define OUTPUT_COLLECTOR_H + +#include +#include + +QT_BEGIN_NAMESPACE +class QLocalServer; +class QLocalSocket; +class QSocketNotifier; +QT_END_NAMESPACE + +namespace Debugger { +namespace Internal { + +/////////////////////////////////////////////////////////////////////// +// +// OutputCollector +// +/////////////////////////////////////////////////////////////////////// + +class OutputCollector : public QObject +{ + Q_OBJECT + +public: + OutputCollector(QObject *parent = 0); + ~OutputCollector(); + bool listen(); + void shutdown(); + QString serverName() const; + QString errorString() const; + +signals: + void byteDelivery(const QByteArray &data); + +private slots: + void bytesAvailable(); +#ifdef Q_OS_WIN + void newConnectionAvailable(); +#endif + +private: +#ifdef Q_OS_WIN + QLocalServer *m_server; + QLocalSocket *m_socket; +#else + QString m_serverPath; + int m_serverFd; + QSocketNotifier *m_serverNotifier; + QString m_errorString; +#endif +}; + +} // namespace Internal +} // namespace Debugger + +#endif // OUTPUT_COLLECTOR_H From f08c67b465ef3da20f1e804aa6a28686ec892757 Mon Sep 17 00:00:00 2001 From: hjk Date: Thu, 15 Jan 2009 15:27:14 +0100 Subject: [PATCH 20/23] fakevim: remove core dependencies from fakevimhandler.cpp. breaks writing of partial files for now. --- src/plugins/fakevim/fakevimhandler.cpp | 31 +++++++++----------------- src/plugins/fakevim/fakevimhandler.h | 2 ++ src/plugins/fakevim/fakevimplugin.cpp | 29 ++++++++++++++++++++++++ 3 files changed, 41 insertions(+), 21 deletions(-) diff --git a/src/plugins/fakevim/fakevimhandler.cpp b/src/plugins/fakevim/fakevimhandler.cpp index a56fad81d51..c438a9ac265 100644 --- a/src/plugins/fakevim/fakevimhandler.cpp +++ b/src/plugins/fakevim/fakevimhandler.cpp @@ -40,10 +40,6 @@ // Qt Creator. The idea is to keep this file here in a "clean" state that // allows easy reuse with any QTextEdit or QPlainTextEdit derived class. -#include -#include -#include - //#include #include @@ -1200,18 +1196,11 @@ void FakeVimHandler::Private::handleExCommand(const QString &cmd0) bool exists = file.exists(); if (exists && !forced && !noArgs) { showRedMessage(tr("File '%1' exists (add ! to override)").arg(fileName)); - } else if (m_currentFile || file.open(QIODevice::ReadWrite)) { - if(m_currentFile) { - m_core->fileManager()->blockFileChange(m_currentFile); - m_currentFile->save(fileName); - m_core->fileManager()->unblockFileChange(m_currentFile); - } else { - QTextCursor tc = selectRange(beginLine, endLine); - qDebug() << "ANCHOR: " << tc.position() << tc.anchor() - << tc.selection().toPlainText(); - { QTextStream ts(&file); ts << tc.selection().toPlainText(); } - file.close(); - } + } else if (file.open(QIODevice::ReadWrite)) { + QTextCursor tc = selectRange(beginLine, endLine); + QString contents = tc.selection().toPlainText(); + emit q->writeFile(fileName, contents); + // check by reading back file.open(QIODevice::ReadOnly); QByteArray ba = file.readAll(); showBlackMessage(tr("\"%1\" %2 %3L, %4C written") @@ -1741,11 +1730,6 @@ void FakeVimHandler::Private::setWidget(QWidget *ob) { m_textedit = qobject_cast(ob); m_plaintextedit = qobject_cast(ob); - TextEditor::BaseTextEditor* editor = qobject_cast(ob); - if (editor) { - m_currentFile = editor->file(); - m_currentFileName = m_currentFile->fileName(); - } } /////////////////////////////////////////////////////////////////////// @@ -1834,3 +1818,8 @@ void FakeVimHandler::quit() { d->quit(); } + +void FakeVimHandler::setCurrentFileName(const QString &fileName) +{ + d->m_currentFileName = fileName; +} diff --git a/src/plugins/fakevim/fakevimhandler.h b/src/plugins/fakevim/fakevimhandler.h index 08df6d21b12..aeba5ace870 100644 --- a/src/plugins/fakevim/fakevimhandler.h +++ b/src/plugins/fakevim/fakevimhandler.h @@ -58,6 +58,7 @@ public slots: // FIXME: good idea? void addWidget(QWidget *widget); void removeWidget(QWidget *widget); + void setCurrentFileName(const QString &fileName); // This executes an "ex" style command taking context // information from \p widget; @@ -72,6 +73,7 @@ signals: void quitRequested(QWidget *); void selectionChanged(QWidget *widget, const QList &selection); + void writeFile(const QString &fileName, const QString &contents); private: bool eventFilter(QObject *ob, QEvent *ev); diff --git a/src/plugins/fakevim/fakevimplugin.cpp b/src/plugins/fakevim/fakevimplugin.cpp index 0a06fe7c112..e809eaae481 100644 --- a/src/plugins/fakevim/fakevimplugin.cpp +++ b/src/plugins/fakevim/fakevimplugin.cpp @@ -39,7 +39,9 @@ #include #include #include +#include #include +#include #include #include #include @@ -117,12 +119,14 @@ private slots: void editorAboutToClose(Core::IEditor *); void changeSelection(QWidget *widget, const QList &selections); + void writeFile(const QString &fileName, const QString &contents); private: FakeVimPlugin *q; FakeVimHandler *m_handler; QAction *m_installHandlerAction; Core::ICore *m_core; + Core::IFile *m_currentFile; }; } // namespace Internal @@ -134,6 +138,7 @@ FakeVimPluginPrivate::FakeVimPluginPrivate(FakeVimPlugin *plugin) m_handler = 0; m_installHandlerAction = 0; m_core = 0; + m_currentFile = 0; } FakeVimPluginPrivate::~FakeVimPluginPrivate() @@ -206,6 +211,12 @@ void FakeVimPluginPrivate::installHandler(QWidget *widget) this, SLOT(changeSelection(QWidget*,QList))); m_handler->addWidget(widget); + TextEditor::BaseTextEditor* editor = + qobject_cast(widget); + if (editor) { + m_currentFile = editor->file(); + m_handler->setCurrentFileName(editor->file()->fileName()); + } BaseTextEditor *bt = qobject_cast(widget); if (bt) { @@ -225,12 +236,30 @@ void FakeVimPluginPrivate::installHandler(QWidget *widget) } } +void FakeVimPluginPrivate::writeFile(const QString &fileName, + const QString &contents) +{ + if (m_currentFile && fileName == m_currentFile->fileName()) { + // handle that as a special case for nicer interation with + // Creator core + m_core->fileManager()->blockFileChange(m_currentFile); + m_currentFile->save(fileName); + m_core->fileManager()->unblockFileChange(m_currentFile); + } else { + QFile file(fileName); + file.open(QIODevice::ReadWrite); + { QTextStream ts(&file); ts << contents; } + file.close(); + } +} + void FakeVimPluginPrivate::removeHandler(QWidget *widget) { Q_UNUSED(widget); m_handler->removeWidget(widget); Core::EditorManager::instance()->hideEditorInfoBar( QLatin1String(Constants::MINI_BUFFER)); + m_currentFile = 0; } void FakeVimPluginPrivate::editorOpened(Core::IEditor *editor) From 50d06fe7c141c5bcad59df547d3df1eab7e76553 Mon Sep 17 00:00:00 2001 From: hjk Date: Thu, 15 Jan 2009 15:34:35 +0100 Subject: [PATCH 21/23] fakevim: compile fix --- src/plugins/fakevim/fakevimhandler.cpp | 4 ---- src/plugins/fakevim/fakevimplugin.cpp | 3 +-- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/src/plugins/fakevim/fakevimhandler.cpp b/src/plugins/fakevim/fakevimhandler.cpp index c438a9ac265..75fdef9168d 100644 --- a/src/plugins/fakevim/fakevimhandler.cpp +++ b/src/plugins/fakevim/fakevimhandler.cpp @@ -222,7 +222,6 @@ public: bool m_wasReadOnly; // saves read-only state of document FakeVimHandler *q; - Core::ICore *m_core; Mode m_mode; SubMode m_submode; SubSubMode m_subsubmode; @@ -242,7 +241,6 @@ public: QString m_commandBuffer; QString m_currentFileName; - Core::IFile* m_currentFile; QString m_currentMessage; bool m_lastSearchForward; @@ -305,8 +303,6 @@ FakeVimHandler::Private::Private(FakeVimHandler *parent) m_visualMode = NoVisualMode; m_desiredColumn = 0; - m_core = ExtensionSystem::PluginManager::instance()->getObject(); - m_config[ConfigStartOfLine] = ConfigOn; m_config[ConfigTabStop] = "8"; m_config[ConfigSmartTab] = ConfigOff; diff --git a/src/plugins/fakevim/fakevimplugin.cpp b/src/plugins/fakevim/fakevimplugin.cpp index e809eaae481..a27e988f4b4 100644 --- a/src/plugins/fakevim/fakevimplugin.cpp +++ b/src/plugins/fakevim/fakevimplugin.cpp @@ -240,8 +240,7 @@ void FakeVimPluginPrivate::writeFile(const QString &fileName, const QString &contents) { if (m_currentFile && fileName == m_currentFile->fileName()) { - // handle that as a special case for nicer interation with - // Creator core + // Handle that as a special case for nicer interaction with core m_core->fileManager()->blockFileChange(m_currentFile); m_currentFile->save(fileName); m_core->fileManager()->unblockFileChange(m_currentFile); From f6712bd67f2575c8cf6437c9d18987cf6b9f64c6 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Thu, 15 Jan 2009 15:36:20 +0100 Subject: [PATCH 22/23] fix build on windows --- src/plugins/debugger/outputcollector.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/plugins/debugger/outputcollector.cpp b/src/plugins/debugger/outputcollector.cpp index 9efb18c95a3..f091ca92084 100644 --- a/src/plugins/debugger/outputcollector.cpp +++ b/src/plugins/debugger/outputcollector.cpp @@ -37,6 +37,7 @@ #include #include +#include #else @@ -143,7 +144,7 @@ QString OutputCollector::errorString() const QString OutputCollector::serverName() const { #ifdef Q_OS_WIN - return m_server->fullServerPath(); + return m_server->fullServerName(); #else return m_serverPath; #endif From f5cd469d18714f9fe3670eb8038c39f84ae38a81 Mon Sep 17 00:00:00 2001 From: hjk Date: Thu, 15 Jan 2009 15:52:14 +0100 Subject: [PATCH 23/23] fakevim: fix access to ConfigStartOfLine --- src/plugins/fakevim/fakevimhandler.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/fakevim/fakevimhandler.cpp b/src/plugins/fakevim/fakevimhandler.cpp index 75fdef9168d..29f8c323d1f 100644 --- a/src/plugins/fakevim/fakevimhandler.cpp +++ b/src/plugins/fakevim/fakevimhandler.cpp @@ -726,7 +726,7 @@ bool FakeVimHandler::Private::handleCommandMode(int key, const QString &text) } else if (key == 'G') { int n = m_mvcount.isEmpty() ? linesInDocument() : count(); m_tc.setPosition(positionForLine(n), KeepAnchor); - if (m_config.contains(ConfigStartOfLine)) + if (m_config[ConfigStartOfLine] == ConfigOn) moveToFirstNonBlankOnLine(); finishMovement(); } else if (key == 'h' || key == Key_Left) {