Commit 65969bad authored by dt's avatar dt
Browse files

Merge branch 'master' of git@scm.dev.nokia.troll.no:creator/mainline

parents 28dacdfd fae2cb49
......@@ -88,6 +88,7 @@ void FileWizardPage::setName(const QString &name)
void FileWizardPage::changeEvent(QEvent *e)
{
QWizardPage::changeEvent(e);
switch (e->type()) {
case QEvent::LanguageChange:
m_d->m_ui.retranslateUi(this);
......
......@@ -113,6 +113,7 @@ void ProjectIntroPage::setDescription(const QString &description)
void ProjectIntroPage::changeEvent(QEvent *e)
{
QWizardPage::changeEvent(e);
switch (e->type()) {
case QEvent::LanguageChange:
m_d->m_ui.retranslateUi(this);
......
......@@ -366,6 +366,7 @@ bool SubmitEditorWidget::hasCheckedFiles() const
void SubmitEditorWidget::changeEvent(QEvent *e)
{
QWidget::changeEvent(e);
switch (e->type()) {
case QEvent::LanguageChange:
m_d->m_ui.retranslateUi(this);
......
......@@ -986,6 +986,7 @@ void MainWindow::removeContextObject(IContext *context)
void MainWindow::changeEvent(QEvent *e)
{
QMainWindow::changeEvent(e);
if (e->type() == QEvent::ActivationChange) {
if (isActiveWindow()) {
if (debugMainWindow)
......
......@@ -185,6 +185,7 @@ CPPEditor::CPPEditor(QWidget *parent)
{
setParenthesesMatchingEnabled(true);
setMarksVisible(true);
setCodeFoldingSupported(true);
setCodeFoldingVisible(true);
baseTextDocument()->setSyntaxHighlighter(new CppHighlighter);
// new QShortcut(QKeySequence("Ctrl+Alt+M"), this, SLOT(foo()), 0, Qt::WidgetShortcut);
......
......@@ -8,7 +8,6 @@ include(../../qworkbenchplugin.pri)
include(cppeditor_dependencies.pri)
HEADERS += cppplugin.h \
cppeditor.h \
cppeditoractionhandler.h \
cpphighlighter.h \
cpphoverhandler.h \
cppfilewizard.h \
......@@ -16,13 +15,10 @@ HEADERS += cppplugin.h \
cppeditorenums.h \
cppeditor_global.h \
cppclasswizard.h
SOURCES += cppplugin.cpp \
cppeditoractionhandler.cpp \
cppeditor.cpp \
cpphighlighter.cpp \
cpphoverhandler.cpp \
cppfilewizard.cpp \
cppclasswizard.cpp
RESOURCES += cppeditor.qrc
......@@ -30,7 +30,6 @@
#include "cppplugin.h"
#include "cppclasswizard.h"
#include "cppeditor.h"
#include "cppeditoractionhandler.h"
#include "cppeditorconstants.h"
#include "cppeditorenums.h"
#include "cppfilewizard.h"
......@@ -47,6 +46,8 @@
#include <texteditor/completionsupport.h>
#include <texteditor/fontsettings.h>
#include <texteditor/storagesettings.h>
#include <texteditor/texteditoractionhandler.h>
#include <texteditor/texteditorplugin.h>
#include <texteditor/texteditorsettings.h>
#include <cpptools/cpptoolsconstants.h>
......@@ -60,9 +61,9 @@ static const char *sourceSuffixKeyC = "CppEditor/SourceSuffix";
using namespace CppEditor::Internal;
//////////////////////////// CppPluginEditorFactory /////////////////////////////
//////////////////////////// CppEditorFactory /////////////////////////////
CppPluginEditorFactory::CppPluginEditorFactory(CppPlugin *owner) :
CppEditorFactory::CppEditorFactory(CppPlugin *owner) :
m_kind(QLatin1String(CppEditor::Constants::CPPEDITOR_KIND)),
m_owner(owner)
{
......@@ -77,18 +78,18 @@ CppPluginEditorFactory::CppPluginEditorFactory(CppPlugin *owner) :
QLatin1String("h"));
}
QString CppPluginEditorFactory::kind() const
QString CppEditorFactory::kind() const
{
return m_kind;
}
Core::IFile *CppPluginEditorFactory::open(const QString &fileName)
Core::IFile *CppEditorFactory::open(const QString &fileName)
{
Core::IEditor *iface = Core::EditorManager::instance()->openEditor(fileName, kind());
return iface ? iface->file() : 0;
}
Core::IEditor *CppPluginEditorFactory::createEditor(QWidget *parent)
Core::IEditor *CppEditorFactory::createEditor(QWidget *parent)
{
CPPEditor *editor = new CPPEditor(parent);
editor->setRevisionsVisible(true);
......@@ -97,7 +98,7 @@ Core::IEditor *CppPluginEditorFactory::createEditor(QWidget *parent)
return editor->editableInterface();
}
QStringList CppPluginEditorFactory::mimeTypes() const
QStringList CppEditorFactory::mimeTypes() const
{
return m_mimeTypes;
}
......@@ -128,25 +129,9 @@ CppPlugin *CppPlugin::instance()
void CppPlugin::initializeEditor(CPPEditor *editor)
{
// common actions
m_actionHandler->setupActions(editor);
// settings
TextEditor::TextEditorSettings *settings = TextEditor::TextEditorSettings::instance();
connect(settings, SIGNAL(fontSettingsChanged(TextEditor::FontSettings)),
editor, SLOT(setFontSettings(TextEditor::FontSettings)));
connect(settings, SIGNAL(tabSettingsChanged(TextEditor::TabSettings)),
editor, SLOT(setTabSettings(TextEditor::TabSettings)));
connect(settings, SIGNAL(storageSettingsChanged(TextEditor::StorageSettings)),
editor, SLOT(setStorageSettings(TextEditor::StorageSettings)));
connect(settings, SIGNAL(displaySettingsChanged(TextEditor::DisplaySettings)),
editor, SLOT(setDisplaySettings(TextEditor::DisplaySettings)));
// tab settings rely on font settings
editor->setFontSettings(settings->fontSettings());
editor->setTabSettings(settings->tabSettings());
editor->setStorageSettings(settings->storageSettings());
editor->setDisplaySettings(settings->displaySettings());
TextEditor::TextEditorSettings::instance()->initializeEditor(editor);
// auto completion
connect(editor, SIGNAL(requestAutoCompletion(ITextEditable*, bool)),
......@@ -159,7 +144,7 @@ bool CppPlugin::initialize(const QStringList & /*arguments*/, QString *errorMess
if (!core->mimeDatabase()->addMimeTypes(QLatin1String(":/cppeditor/CppEditor.mimetypes.xml"), errorMessage))
return false;
m_factory = new CppPluginEditorFactory(this);
m_factory = new CppEditorFactory(this);
addObject(m_factory);
addAutoReleasedObject(new CppHoverHandler);
......@@ -207,7 +192,7 @@ bool CppPlugin::initialize(const QStringList & /*arguments*/, QString *errorMess
am->actionContainer(CppEditor::Constants::M_CONTEXT)->addAction(cmd);
am->actionContainer(CppTools::Constants::M_TOOLS_CPP)->addAction(cmd);
m_actionHandler = new CPPEditorActionHandler(CppEditor::Constants::C_CPPEDITOR,
m_actionHandler = new TextEditor::TextEditorActionHandler(CppEditor::Constants::C_CPPEDITOR,
TextEditor::TextEditorActionHandler::Format
| TextEditor::TextEditorActionHandler::UnCommentSelection
| TextEditor::TextEditorActionHandler::UnCollapseAll);
......
......@@ -44,8 +44,7 @@ namespace CppEditor {
namespace Internal {
class CPPEditor;
class CPPEditorActionHandler;
class CppPluginEditorFactory;
class CppEditorFactory;
class CppPlugin : public ExtensionSystem::IPlugin
{
......@@ -68,21 +67,21 @@ private slots:
void jumpToDefinition();
private:
friend class CppPluginEditorFactory;
friend class CppEditorFactory;
Core::IEditor *createEditor(QWidget *parent);
static CppPlugin *m_instance;
CPPEditorActionHandler *m_actionHandler;
CppPluginEditorFactory *m_factory;
TextEditor::TextEditorActionHandler *m_actionHandler;
CppEditorFactory *m_factory;
};
class CppPluginEditorFactory : public Core::IEditorFactory
class CppEditorFactory : public Core::IEditorFactory
{
Q_OBJECT
public:
CppPluginEditorFactory(CppPlugin *owner);
CppEditorFactory(CppPlugin *owner);
virtual QStringList mimeTypes() const;
......
......@@ -29,6 +29,7 @@
#include "breakwindow.h"
#include "debuggeractions.h"
#include "ui_breakcondition.h"
#include <QAction>
......@@ -93,7 +94,7 @@ void BreakWindow::contextMenuEvent(QContextMenuEvent *ev)
QAction *act3 = new QAction("Edit condition...", &menu);
act0->setEnabled(index.isValid());
QAction *act4 = new QAction("Syncronize breakpoints", &menu);
QAction *act5 = new QAction("Debugger properties...", &menu);
QAction *act5 = action(SettingsDialog);
menu.addAction(act0);
menu.addAction(act3);
......@@ -116,7 +117,7 @@ void BreakWindow::contextMenuEvent(QContextMenuEvent *ev)
else if (act == act4)
emit breakpointSynchronizationRequested();
else if (act == act5)
emit settingsDialogRequested();
act->trigger();
}
void BreakWindow::deleteBreakpoint(const QModelIndex &idx)
......
......@@ -50,7 +50,6 @@ signals:
void breakpointDeleted(int index);
void breakpointActivated(int index);
void breakpointSynchronizationRequested();
void settingsDialogRequested();
private slots:
void rowActivated(const QModelIndex &index);
......
......@@ -45,6 +45,8 @@
#include <QtCore/QDir>
#include <QtCore/QLibrary>
#include <QtCore/QCoreApplication>
#include <QtGui/QMessageBox>
#include <QtGui/QMainWindow>
#define DBGHELP_TRANSLATE_TCHAR
#include <inc/Dbghelp.h>
......@@ -218,6 +220,10 @@ CdbDebugEngine::CdbDebugEngine(DebuggerManager *parent) :
IDebuggerEngine(parent),
m_d(new CdbDebugEnginePrivate(parent, this))
{
// m_d->m_consoleStubProc.setDebug(true);
connect(&m_d->m_consoleStubProc, SIGNAL(processError(QString)), this, SLOT(slotConsoleStubError(QString)));
connect(&m_d->m_consoleStubProc, SIGNAL(processStarted()), this, SLOT(slotConsoleStubStarted()));
connect(&m_d->m_consoleStubProc, SIGNAL(wrapperStopped()), this, SLOT(slotConsoleStubTerminated()));
}
CdbDebugEngine::~CdbDebugEngine()
......@@ -260,14 +266,24 @@ bool CdbDebugEngine::startDebugger()
QString errorMessage;
bool rc = false;
m_d->m_bIgnoreNextDebugEvent = false;
m_d->m_mode = m_d->m_debuggerManager->startMode();
switch (m_d->m_mode) {
const DebuggerStartMode mode = m_d->m_debuggerManager->startMode();
switch (mode) {
case AttachExternal:
rc = startAttachDebugger(m_d->m_debuggerManager->m_attachedPID, &errorMessage);
break;
case StartInternal:
case StartExternal:
rc = startDebuggerWithExecutable(&errorMessage);
if (m_d->m_debuggerManager->m_useTerminal) {
// Launch console stub and wait for its startup
m_d->m_consoleStubProc.stop(); // We leave the console open, so recycle it now.
m_d->m_consoleStubProc.setWorkingDirectory(m_d->m_debuggerManager->m_workingDir);
m_d->m_consoleStubProc.setEnvironment(m_d->m_debuggerManager->m_environment);
rc = m_d->m_consoleStubProc.start(m_d->m_debuggerManager->m_executable, m_d->m_debuggerManager->m_processArgs);
if (!rc)
errorMessage = tr("The console stub process was unable to start '%1'.").arg(m_d->m_debuggerManager->m_executable);
} else {
rc = startDebuggerWithExecutable(mode, &errorMessage);
}
break;
case AttachCore:
errorMessage = tr("CdbDebugEngine: Attach to core not supported!");
......@@ -282,7 +298,7 @@ bool CdbDebugEngine::startDebugger()
return rc;
}
bool CdbDebugEngine::startAttachDebugger(unsigned long pid, QString *errorMessage)
bool CdbDebugEngine::startAttachDebugger(qint64 pid, QString *errorMessage)
{
// Need to aatrach invasively, otherwise, no notification signals
// for for CreateProcess/ExitProcess occur.
......@@ -293,11 +309,13 @@ bool CdbDebugEngine::startAttachDebugger(unsigned long pid, QString *errorMessag
if (FAILED(hr)) {
*errorMessage = tr("AttachProcess failed for pid %1: %2").arg(pid).arg(msgDebugEngineComResult(hr));
return false;
} else {
m_d->m_mode = AttachExternal;
}
return true;
}
bool CdbDebugEngine::startDebuggerWithExecutable(QString *errorMessage)
bool CdbDebugEngine::startDebuggerWithExecutable(DebuggerStartMode sm, QString *errorMessage)
{
m_d->m_debuggerManager->showStatusMessage("Starting Debugger", -1);
......@@ -335,6 +353,8 @@ bool CdbDebugEngine::startDebuggerWithExecutable(QString *errorMessage)
*errorMessage = tr("CreateProcess2Wide failed for '%1': %2").arg(cmd, msgDebugEngineComResult(hr));
m_d->m_debuggerManagerAccess->notifyInferiorExited();
return false;
} else {
m_d->m_mode = sm;
}
m_d->m_debuggerManagerAccess->notifyInferiorRunning();
return true;
......@@ -790,6 +810,31 @@ void CdbDebugEngine::timerEvent(QTimerEvent* te)
}
}
void CdbDebugEngine::slotConsoleStubStarted()
{
const qint64 appPid = m_d->m_consoleStubProc.applicationPID();
if (debugCDB)
qDebug() << Q_FUNC_INFO << appPid;
// Attach to console process
QString errorMessage;
if (startAttachDebugger(appPid, &errorMessage)) {
m_d->m_debuggerManager->m_attachedPID = appPid;
m_d->m_debuggerManagerAccess->notifyInferiorPidChanged(appPid);
} else {
QMessageBox::critical(m_d->m_debuggerManager->mainWindow(), tr("Debugger Error"), errorMessage);
}
}
void CdbDebugEngine::slotConsoleStubError(const QString &msg)
{
QMessageBox::critical(m_d->m_debuggerManager->mainWindow(), tr("Debugger Error"), msg);
}
void CdbDebugEngine::slotConsoleStubTerminated()
{
exitDebugger();
}
void CdbDebugEnginePrivate::handleDebugEvent()
{
if (debugCDB)
......@@ -931,6 +976,7 @@ void CdbDebugEnginePrivate::updateStackTrace()
void CdbDebugEnginePrivate::handleDebugOutput(const char* szOutputString)
{
qDebug() << Q_FUNC_INFO << szOutputString;
m_debuggerManagerAccess->showApplicationOutput(QString::fromLocal8Bit(szOutputString));
}
......@@ -941,16 +987,6 @@ void CdbDebugEnginePrivate::handleBreakpointEvent(PDEBUG_BREAKPOINT pBP)
qDebug() << Q_FUNC_INFO;
}
void CdbDebugEngine::setDebugDumpers(bool on)
{
Q_UNUSED(on)
}
void CdbDebugEngine::setUseCustomDumpers(bool on)
{
Q_UNUSED(on)
}
void CdbDebugEngine::reloadSourceFiles()
{
}
......
......@@ -31,6 +31,7 @@
#define DEBUGGER_CDBENGINE_H
#include "idebuggerengine.h"
#include "debuggermanager.h"
namespace Debugger {
namespace Internal {
......@@ -88,18 +89,19 @@ public:
virtual void loadAllSymbols();
virtual void reloadRegisters();
virtual void setDebugDumpers(bool on);
virtual void setUseCustomDumpers(bool on);
virtual void reloadSourceFiles();
protected:
void timerEvent(QTimerEvent*);
private slots:
void slotConsoleStubStarted();
void slotConsoleStubError(const QString &msg);
void slotConsoleStubTerminated();
private:
bool startAttachDebugger(unsigned long pid, QString *errorMessage);
bool startDebuggerWithExecutable(QString *errorMessage);
bool startAttachDebugger(qint64 pid, QString *errorMessage);
bool startDebuggerWithExecutable(DebuggerStartMode sm, QString *errorMessage);
void startWatchTimer();
void killWatchTimer();
......
......@@ -34,6 +34,7 @@
#include "cdbdebugoutput.h"
#include "stackhandler.h"
#include "debuggermanager.h"
#include <utils/consoleprocess.h>
namespace Debugger {
namespace Internal {
......@@ -106,6 +107,7 @@ struct CdbDebugEnginePrivate
DebuggerManager *m_debuggerManager;
IDebuggerManagerAccessForEngines *m_debuggerManagerAccess;
DebuggerStartMode m_mode;
Core::Utils::ConsoleProcess m_consoleStubProc;
};
enum { debugCDB = 0 };
......
......@@ -17,6 +17,7 @@ QT += gui network script
HEADERS += \
breakhandler.h \
breakwindow.h \
debuggeractions.h \
debuggerconstants.h \
debuggerdialogs.h \
debuggermanager.h \
......@@ -47,6 +48,7 @@ SOURCES += \
breakhandler.cpp \
breakwindow.cpp \
breakwindow.h \
debuggeractions.cpp \
debuggerdialogs.cpp \
debuggermanager.cpp \
debuggeroutputwindow.cpp \
......
......@@ -27,27 +27,77 @@
**
**************************************************************************/
#include "cppeditoractionhandler.h"
#include "cppeditorconstants.h"
#include "cppeditor.h"
#include <QAction>
#include "debuggeractions.h"
using namespace CppEditor::Internal;
#include <QtGui/QAction>
#include <QtGui/QApplication>
CPPEditorActionHandler::CPPEditorActionHandler(const QString &context,
uint optionalActions)
: TextEditor::TextEditorActionHandler(context, optionalActions)
{ }
namespace Debugger {
namespace Internal {
CPPEditorActionHandler::~CPPEditorActionHandler()
{ }
void CPPEditorActionHandler::createActions()
//////////////////////////////////////////////////////////////////////////
//
// Debugger specific stuff
//
//////////////////////////////////////////////////////////////////////////
struct ActionData
{
TextEditor::TextEditorActionHandler::createActions();
}
ActionCode code;
const char *text;
bool checkable;
};
static ActionData data[] =
{
//
// General
//
{ AdjustColumnWidths,
QT_TR_NOOP("Adjust column widths to contents"), false },
{ AlwaysAdjustColumnWidths,
QT_TR_NOOP("Adjust column widths to contents"), true },
//
// Locals & Watchers
//
{ WatchExpression,
QT_TR_NOOP("Watch expression '%1'"), false },
{ WatchExpression,
QT_TR_NOOP("Watch expression '%1'"), false },
{ SettingsDialog,
QT_TR_NOOP("Debugger properties..."), false },
{ UseDumpers,
QT_TR_NOOP("Use custom dumpers"), true },
{ DebugDumpers,
QT_TR_NOOP("Debug custom dumpers"), true },
{ RecheckDumpers,
QT_TR_NOOP("Recheck custom dumper availability"), true },
void CPPEditorActionHandler::updateActions(UpdateMode um)
//
// Breakpoints
//
{ SynchronizeBreakpoints,
QT_TR_NOOP("Syncronize breakpoints"), false },
};
QAction *action(ActionCode code)
{
TextEditor::TextEditorActionHandler::updateActions(um);
static QHash<ActionCode, QAction *> actions;
if (actions.isEmpty()) {
for (int i = 0; i != sizeof(data)/sizeof(data[0]); ++i) {
const ActionData &d = data[i];
QAction *act = new QAction(QObject::tr(d.text), 0);
act->setCheckable(d.checkable);
actions[d.code] = act;
}
}
return actions.value(code);
}
} // namespace Internal
} // namespace Debugger
......@@ -27,31 +27,57 @@
**
**************************************************************************/
#ifndef CPPEDITORACTIONHANDLER_H
#define CPPEDITORACTIONHANDLER_H
#ifndef DEBUGGER_ACTIONS_H
#define DEBUGGER_ACTIONS_H
#include <texteditor/texteditoractionhandler.h>
#include <QtGui/QAction>
namespace CppEditor {
namespace Debugger {
namespace Internal {
class CPPEditorActionHandler : public TextEditor::TextEditorActionHandler
enum ActionCode
{
Q_OBJECT
// General
SettingsDialog,
AdjustColumnWidths,
AlwaysAdjustColumnWidths,
public:
CPPEditorActionHandler(const QString &context,
uint optionalActions = None);
virtual ~CPPEditorActionHandler();
LockView,
using TextEditor::TextEditorActionHandler::updateActions;
// Gdb
GdbLocation,
GdbEnvironment,
GdbScriptFile,
GdbAutoRun,
GdbAutoQuit,
protected:
virtual void createActions();
virtual void updateActions(UpdateMode um);
// Watchers & Locals
WatchExpression,
RemoveWatchExpression,
WatchModelUpdate,
RecheckDumpers,
UseDumpers,
DebugDumpers,
UseToolTips,
// Source List
ListSourceFiles,
// Running
SkipKnowFrames,
// Breakpoints
SynchronizeBreakpoints,
AllPluginBreakpoints,
SelectedPluginBreakpoints,
NoPluginBreakpoints,
SelectedPluginBreakpointsPattern,
};
QAction *action(ActionCode code);
} // namespace Internal
} // namespace CppEditor
} // namespace Debugger
#endif // CPPEDITORACTIONHANDLER_H
#endif // DEBUGGER_WATCHWINDOW_H