2009-03-18 10:04:02 +01:00
|
|
|
/**************************************************************************
|
|
|
|
**
|
|
|
|
** This file is part of Qt Creator
|
|
|
|
**
|
|
|
|
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
|
|
|
**
|
|
|
|
** Contact: Qt Software Information (qt-info@nokia.com)
|
|
|
|
**
|
|
|
|
** Commercial Usage
|
|
|
|
**
|
|
|
|
** Licensees holding valid Qt Commercial licenses may use this file in
|
|
|
|
** accordance with the Qt Commercial License Agreement provided with the
|
|
|
|
** Software or, alternatively, in accordance with the terms contained in
|
|
|
|
** a written agreement between you and Nokia.
|
|
|
|
**
|
|
|
|
** GNU Lesser General Public License Usage
|
|
|
|
**
|
|
|
|
** Alternatively, this file may be used under the terms of the GNU Lesser
|
|
|
|
** General Public License version 2.1 as published by the Free Software
|
|
|
|
** Foundation and appearing in the file LICENSE.LGPL included in the
|
|
|
|
** packaging of this file. Please review the following information to
|
|
|
|
** ensure the GNU Lesser General Public License version 2.1 requirements
|
|
|
|
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
|
|
|
**
|
|
|
|
** If you are unsure which license is appropriate for your use, please
|
|
|
|
** contact the sales department at qt-sales@nokia.com.
|
|
|
|
**
|
|
|
|
**************************************************************************/
|
|
|
|
|
|
|
|
#include "debuggeractions.h"
|
|
|
|
|
2009-03-19 09:32:09 +01:00
|
|
|
#include <utils/qtcassert.h>
|
|
|
|
#include <utils/pathchooser.h>
|
|
|
|
|
2009-03-23 14:34:01 +01:00
|
|
|
#include <QtCore/QDebug>
|
2009-03-19 09:32:09 +01:00
|
|
|
#include <QtCore/QSettings>
|
2009-03-24 16:39:01 +01:00
|
|
|
|
2009-03-18 10:04:02 +01:00
|
|
|
#include <QtGui/QAction>
|
2009-03-24 16:39:01 +01:00
|
|
|
#include <QtGui/QActionGroup>
|
2009-03-19 09:32:09 +01:00
|
|
|
#include <QtGui/QAbstractButton>
|
|
|
|
#include <QtGui/QRadioButton>
|
|
|
|
#include <QtGui/QCheckBox>
|
|
|
|
#include <QtGui/QLineEdit>
|
2009-03-18 10:04:02 +01:00
|
|
|
|
2009-03-23 14:34:01 +01:00
|
|
|
|
2009-03-18 10:04:02 +01:00
|
|
|
namespace Debugger {
|
|
|
|
namespace Internal {
|
|
|
|
|
2009-03-23 14:34:01 +01:00
|
|
|
|
2009-03-19 09:32:09 +01:00
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
2009-03-19 15:44:26 +01:00
|
|
|
// DebuggerAction
|
2009-03-19 09:32:09 +01:00
|
|
|
//
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2009-03-19 15:44:26 +01:00
|
|
|
DebuggerAction::DebuggerAction(QObject *parent)
|
2009-03-19 15:54:52 +01:00
|
|
|
: QAction(parent)
|
2009-03-19 09:32:09 +01:00
|
|
|
{
|
2009-03-24 12:50:08 +01:00
|
|
|
m_widget = 0;
|
2009-03-19 15:54:52 +01:00
|
|
|
connect(this, SIGNAL(triggered(bool)), this, SLOT(actionTriggered(bool)));
|
2009-03-19 09:32:09 +01:00
|
|
|
}
|
|
|
|
|
2009-03-19 15:44:26 +01:00
|
|
|
QVariant DebuggerAction::value() const
|
2009-03-19 09:32:09 +01:00
|
|
|
{
|
|
|
|
return m_value;
|
|
|
|
}
|
|
|
|
|
2009-03-19 15:44:26 +01:00
|
|
|
void DebuggerAction::setValue(const QVariant &value, bool doemit)
|
2009-03-19 09:32:09 +01:00
|
|
|
{
|
2009-03-26 15:14:17 +01:00
|
|
|
if (value == m_value)
|
|
|
|
return;
|
|
|
|
m_value = value;
|
|
|
|
if (this->isCheckable())
|
|
|
|
this->setChecked(m_value.toBool());
|
|
|
|
if (doemit)
|
|
|
|
emit valueChanged(m_value);
|
2009-03-19 09:32:09 +01:00
|
|
|
}
|
|
|
|
|
2009-03-19 15:44:26 +01:00
|
|
|
QVariant DebuggerAction::defaultValue() const
|
2009-03-19 09:32:09 +01:00
|
|
|
{
|
|
|
|
return m_defaultValue;
|
|
|
|
}
|
|
|
|
|
2009-03-19 15:44:26 +01:00
|
|
|
void DebuggerAction::setDefaultValue(const QVariant &value)
|
2009-03-19 09:32:09 +01:00
|
|
|
{
|
|
|
|
m_defaultValue = value;
|
|
|
|
}
|
|
|
|
|
2009-03-19 15:44:26 +01:00
|
|
|
QString DebuggerAction::settingsKey() const
|
2009-03-19 09:32:09 +01:00
|
|
|
{
|
|
|
|
return m_settingsKey;
|
|
|
|
}
|
|
|
|
|
2009-03-19 15:44:26 +01:00
|
|
|
void DebuggerAction::setSettingsKey(const QString &key)
|
2009-03-19 09:32:09 +01:00
|
|
|
{
|
|
|
|
m_settingsKey = key;
|
|
|
|
}
|
|
|
|
|
2009-03-19 15:44:26 +01:00
|
|
|
void DebuggerAction::setSettingsKey(const QString &group, const QString &key)
|
2009-03-19 09:32:09 +01:00
|
|
|
{
|
|
|
|
m_settingsKey = key;
|
|
|
|
m_settingsGroup = group;
|
|
|
|
}
|
|
|
|
|
2009-03-19 15:44:26 +01:00
|
|
|
QString DebuggerAction::settingsGroup() const
|
2009-03-19 09:32:09 +01:00
|
|
|
{
|
|
|
|
return m_settingsGroup;
|
|
|
|
}
|
|
|
|
|
2009-03-19 15:44:26 +01:00
|
|
|
void DebuggerAction::setSettingsGroup(const QString &group)
|
2009-03-19 09:32:09 +01:00
|
|
|
{
|
|
|
|
m_settingsGroup = group;
|
|
|
|
}
|
|
|
|
|
2009-03-19 15:44:26 +01:00
|
|
|
QString DebuggerAction::textPattern() const
|
2009-03-19 09:32:09 +01:00
|
|
|
{
|
|
|
|
return m_textPattern;
|
|
|
|
}
|
|
|
|
|
2009-03-19 15:44:26 +01:00
|
|
|
void DebuggerAction::setTextPattern(const QString &value)
|
2009-03-19 09:32:09 +01:00
|
|
|
{
|
|
|
|
m_textPattern = value;
|
|
|
|
}
|
|
|
|
|
2009-03-23 14:34:01 +01:00
|
|
|
QString DebuggerAction::toString() const
|
|
|
|
{
|
|
|
|
return "value: " + m_value.toString()
|
|
|
|
+ " defaultvalue: " + m_defaultValue.toString()
|
2009-03-24 12:50:08 +01:00
|
|
|
+ " settingskey: " + m_settingsGroup + '/' + m_settingsKey;
|
2009-03-23 14:34:01 +01:00
|
|
|
}
|
|
|
|
|
2009-03-19 15:44:26 +01:00
|
|
|
QAction *DebuggerAction::updatedAction(const QString &text0)
|
2009-03-19 12:24:04 +01:00
|
|
|
{
|
|
|
|
QString text = text0;
|
|
|
|
bool enabled = true;
|
|
|
|
if (!m_textPattern.isEmpty()) {
|
|
|
|
if (text.isEmpty()) {
|
|
|
|
text = m_textPattern;
|
|
|
|
text.remove("\"%1\"");
|
|
|
|
text.remove("%1");
|
|
|
|
enabled = false;
|
|
|
|
} else {
|
|
|
|
text = m_textPattern.arg(text0);
|
|
|
|
}
|
|
|
|
}
|
2009-03-19 15:54:52 +01:00
|
|
|
this->setEnabled(enabled);
|
|
|
|
this->setData(text0);
|
|
|
|
this->setText(text);
|
|
|
|
return this;
|
2009-03-19 12:24:04 +01:00
|
|
|
}
|
|
|
|
|
2009-03-19 15:44:26 +01:00
|
|
|
void DebuggerAction::readSettings(QSettings *settings)
|
2009-03-19 09:32:09 +01:00
|
|
|
{
|
|
|
|
if (m_settingsGroup.isEmpty() || m_settingsKey.isEmpty())
|
|
|
|
return;
|
|
|
|
settings->beginGroup(m_settingsGroup);
|
|
|
|
setValue(settings->value(m_settingsKey, m_defaultValue), false);
|
2009-03-19 11:43:59 +01:00
|
|
|
//qDebug() << "READING: " << m_settingsKey << " -> " << m_value;
|
2009-03-19 09:32:09 +01:00
|
|
|
settings->endGroup();
|
|
|
|
}
|
|
|
|
|
2009-03-19 15:44:26 +01:00
|
|
|
void DebuggerAction::writeSettings(QSettings *settings)
|
2009-03-19 09:32:09 +01:00
|
|
|
{
|
|
|
|
if (m_settingsGroup.isEmpty() || m_settingsKey.isEmpty())
|
|
|
|
return;
|
|
|
|
settings->beginGroup(m_settingsGroup);
|
|
|
|
settings->setValue(m_settingsKey, m_value);
|
2009-03-23 14:34:01 +01:00
|
|
|
//qDebug() << "WRITING: " << m_settingsKey << " -> " << toString();
|
2009-03-19 09:32:09 +01:00
|
|
|
settings->endGroup();
|
|
|
|
}
|
|
|
|
|
2009-03-19 15:44:26 +01:00
|
|
|
void DebuggerAction::connectWidget(QWidget *widget, ApplyMode applyMode)
|
2009-03-19 09:32:09 +01:00
|
|
|
{
|
|
|
|
using namespace Core::Utils;
|
2009-03-26 15:56:16 +01:00
|
|
|
QTC_ASSERT(!m_widget,
|
|
|
|
qDebug() << "ALREADY CONNECTED: " << widget << m_widget << toString(); return);
|
2009-03-24 12:50:08 +01:00
|
|
|
m_widget = widget;
|
|
|
|
m_applyMode = applyMode;
|
|
|
|
|
2009-03-19 09:32:09 +01:00
|
|
|
if (QAbstractButton *button = qobject_cast<QAbstractButton *>(widget)) {
|
|
|
|
if (button->isCheckable()) {
|
|
|
|
button->setChecked(m_value.toBool());
|
|
|
|
connect(button, SIGNAL(clicked(bool)),
|
|
|
|
this, SLOT(checkableButtonClicked(bool)));
|
|
|
|
} else {
|
|
|
|
connect(button, SIGNAL(clicked()),
|
|
|
|
this, SLOT(uncheckableButtonClicked()));
|
|
|
|
}
|
|
|
|
} else if (QLineEdit *lineEdit = qobject_cast<QLineEdit *>(widget)) {
|
|
|
|
lineEdit->setText(m_value.toString());
|
|
|
|
//qDebug() << "SETTING TEXT" << lineEdit->text();
|
|
|
|
connect(lineEdit, SIGNAL(editingFinished()),
|
|
|
|
this, SLOT(lineEditEditingFinished()));
|
|
|
|
} else if (PathChooser *pathChooser = qobject_cast<PathChooser *>(widget)) {
|
|
|
|
pathChooser->setPath(m_value.toString());
|
|
|
|
connect(pathChooser, SIGNAL(editingFinished()),
|
|
|
|
this, SLOT(pathChooserEditingFinished()));
|
|
|
|
connect(pathChooser, SIGNAL(browsingFinished()),
|
|
|
|
this, SLOT(pathChooserEditingFinished()));
|
|
|
|
} else {
|
|
|
|
qDebug() << "CANNOT CONNECT WIDGET " << widget;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-03-26 15:56:16 +01:00
|
|
|
void DebuggerAction::disconnectWidget()
|
|
|
|
{
|
|
|
|
QTC_ASSERT(m_widget,
|
|
|
|
qDebug() << "ALREADY DISCONNECTED: " << m_widget << toString(); return);
|
|
|
|
m_widget = 0;
|
|
|
|
}
|
2009-03-19 15:44:26 +01:00
|
|
|
void DebuggerAction::apply(QSettings *s)
|
2009-03-19 09:32:09 +01:00
|
|
|
{
|
2009-03-24 12:50:08 +01:00
|
|
|
using namespace Core::Utils;
|
|
|
|
if (QAbstractButton *button = qobject_cast<QAbstractButton *>(m_widget))
|
|
|
|
setValue(button->isChecked());
|
|
|
|
else if (QLineEdit *lineEdit = qobject_cast<QLineEdit *>(m_widget))
|
|
|
|
setValue(lineEdit->text());
|
|
|
|
else if (PathChooser *pathChooser = qobject_cast<PathChooser *>(m_widget))
|
|
|
|
setValue(pathChooser->path());
|
2009-03-19 10:54:27 +01:00
|
|
|
if (s)
|
2009-03-24 12:50:08 +01:00
|
|
|
writeSettings(s);
|
2009-03-19 09:32:09 +01:00
|
|
|
}
|
|
|
|
|
2009-03-19 15:44:26 +01:00
|
|
|
void DebuggerAction::uncheckableButtonClicked()
|
2009-03-19 09:32:09 +01:00
|
|
|
{
|
|
|
|
QAbstractButton *button = qobject_cast<QAbstractButton *>(sender());
|
|
|
|
QTC_ASSERT(button, return);
|
2009-03-19 11:43:59 +01:00
|
|
|
//qDebug() << "UNCHECKABLE BUTTON: " << sender();
|
2009-03-19 15:54:52 +01:00
|
|
|
QAction::trigger();
|
2009-03-19 09:32:09 +01:00
|
|
|
}
|
|
|
|
|
2009-03-19 15:44:26 +01:00
|
|
|
void DebuggerAction::checkableButtonClicked(bool)
|
2009-03-19 09:32:09 +01:00
|
|
|
{
|
|
|
|
QAbstractButton *button = qobject_cast<QAbstractButton *>(sender());
|
|
|
|
QTC_ASSERT(button, return);
|
2009-03-19 11:43:59 +01:00
|
|
|
//qDebug() << "CHECKABLE BUTTON: " << sender();
|
2009-03-24 12:50:08 +01:00
|
|
|
if (m_applyMode == ImmediateApply)
|
2009-03-19 09:32:09 +01:00
|
|
|
setValue(button->isChecked());
|
|
|
|
}
|
|
|
|
|
2009-03-19 15:44:26 +01:00
|
|
|
void DebuggerAction::lineEditEditingFinished()
|
2009-03-19 09:32:09 +01:00
|
|
|
{
|
|
|
|
QLineEdit *lineEdit = qobject_cast<QLineEdit *>(sender());
|
|
|
|
QTC_ASSERT(lineEdit, return);
|
2009-03-19 11:43:59 +01:00
|
|
|
//qDebug() << "LINEEDIT: " << sender() << lineEdit->text();
|
2009-03-24 12:50:08 +01:00
|
|
|
if (m_applyMode == ImmediateApply)
|
2009-03-19 09:32:09 +01:00
|
|
|
setValue(lineEdit->text());
|
|
|
|
}
|
|
|
|
|
2009-03-19 15:44:26 +01:00
|
|
|
void DebuggerAction::pathChooserEditingFinished()
|
2009-03-19 09:32:09 +01:00
|
|
|
{
|
|
|
|
using namespace Core::Utils;
|
|
|
|
PathChooser *pathChooser = qobject_cast<PathChooser *>(sender());
|
|
|
|
QTC_ASSERT(pathChooser, return);
|
2009-03-19 11:43:59 +01:00
|
|
|
//qDebug() << "PATHCHOOSER: " << sender() << pathChooser->path();
|
2009-03-24 12:50:08 +01:00
|
|
|
if (m_applyMode == ImmediateApply)
|
2009-03-19 09:32:09 +01:00
|
|
|
setValue(pathChooser->path());
|
|
|
|
}
|
|
|
|
|
2009-03-19 15:54:52 +01:00
|
|
|
void DebuggerAction::actionTriggered(bool)
|
2009-03-19 09:32:09 +01:00
|
|
|
{
|
2009-03-24 16:39:01 +01:00
|
|
|
//qDebug() << "TRIGGERING" << this << actionGroup();
|
|
|
|
if (isCheckable())
|
|
|
|
setValue(isChecked());
|
|
|
|
if (actionGroup() && actionGroup()->isExclusive()) {
|
|
|
|
// FIXME: should be taken care of more directly
|
|
|
|
foreach (QAction *act, actionGroup()->actions())
|
|
|
|
if (DebuggerAction *dact = qobject_cast<DebuggerAction *>(act))
|
|
|
|
dact->setValue(bool(act == this));
|
|
|
|
}
|
2009-03-19 09:32:09 +01:00
|
|
|
}
|
|
|
|
|
2009-03-19 15:54:52 +01:00
|
|
|
void DebuggerAction::trigger(const QVariant &data)
|
2009-03-19 15:24:18 +01:00
|
|
|
{
|
2009-03-19 15:54:52 +01:00
|
|
|
setData(data);
|
|
|
|
QAction::trigger();
|
2009-03-19 15:24:18 +01:00
|
|
|
}
|
2009-03-18 10:04:02 +01:00
|
|
|
|
2009-03-24 12:50:08 +01:00
|
|
|
|
2009-03-26 15:56:16 +01:00
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
|
|
|
// DebuggerSettingsGroup
|
|
|
|
//
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
void DebuggerSettingsGroup::insert(DebuggerAction *action, QWidget *widget)
|
|
|
|
{
|
|
|
|
m_list.append(action);
|
|
|
|
action->connectWidget(widget);
|
|
|
|
}
|
|
|
|
|
|
|
|
void DebuggerSettingsGroup::apply(QSettings *settings)
|
|
|
|
{
|
|
|
|
foreach (DebuggerAction *action, m_list)
|
|
|
|
action->apply(settings);
|
|
|
|
}
|
|
|
|
|
|
|
|
void DebuggerSettingsGroup::finish()
|
|
|
|
{
|
|
|
|
foreach (DebuggerAction *action, m_list)
|
|
|
|
action->disconnectWidget();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-03-18 10:04:02 +01:00
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
2009-03-19 15:44:26 +01:00
|
|
|
// DebuggerSettings
|
2009-03-18 10:04:02 +01:00
|
|
|
//
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2009-03-19 15:44:26 +01:00
|
|
|
DebuggerSettings::DebuggerSettings(QObject *parent)
|
2009-03-19 09:32:09 +01:00
|
|
|
: QObject(parent)
|
|
|
|
{}
|
|
|
|
|
2009-03-19 15:44:26 +01:00
|
|
|
DebuggerSettings::~DebuggerSettings()
|
2009-03-18 10:04:02 +01:00
|
|
|
{
|
2009-03-19 09:32:09 +01:00
|
|
|
qDeleteAll(m_items);
|
|
|
|
}
|
|
|
|
|
2009-03-19 15:44:26 +01:00
|
|
|
void DebuggerSettings::insertItem(int code, DebuggerAction *item)
|
2009-03-18 10:04:02 +01:00
|
|
|
{
|
2009-03-19 09:32:09 +01:00
|
|
|
m_items[code] = item;
|
|
|
|
}
|
|
|
|
|
2009-03-19 15:44:26 +01:00
|
|
|
void DebuggerSettings::readSettings(QSettings *settings)
|
2009-03-19 09:32:09 +01:00
|
|
|
{
|
2009-03-19 15:44:26 +01:00
|
|
|
foreach (DebuggerAction *item, m_items)
|
2009-03-19 09:32:09 +01:00
|
|
|
item->readSettings(settings);
|
|
|
|
}
|
|
|
|
|
2009-03-19 15:44:26 +01:00
|
|
|
void DebuggerSettings::writeSettings(QSettings *settings)
|
2009-03-19 09:32:09 +01:00
|
|
|
{
|
2009-03-19 15:44:26 +01:00
|
|
|
foreach (DebuggerAction *item, m_items)
|
2009-03-19 09:32:09 +01:00
|
|
|
item->writeSettings(settings);
|
|
|
|
}
|
|
|
|
|
2009-03-19 15:44:26 +01:00
|
|
|
DebuggerAction *DebuggerSettings::item(int code)
|
2009-03-19 09:32:09 +01:00
|
|
|
{
|
|
|
|
QTC_ASSERT(m_items.value(code, 0), return 0);
|
|
|
|
return m_items.value(code, 0);
|
|
|
|
}
|
|
|
|
|
2009-03-19 15:44:26 +01:00
|
|
|
QString DebuggerSettings::dump()
|
2009-03-19 09:32:09 +01:00
|
|
|
{
|
|
|
|
QString out;
|
|
|
|
QTextStream ts(&out);
|
|
|
|
ts << "Debugger settings: ";
|
2009-03-19 15:44:26 +01:00
|
|
|
foreach (DebuggerAction *item, m_items)
|
2009-03-19 09:32:09 +01:00
|
|
|
ts << "\n" << item->value().toString();
|
|
|
|
return out;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
2009-03-19 15:44:26 +01:00
|
|
|
// Debugger specific actions and settings
|
2009-03-19 09:32:09 +01:00
|
|
|
//
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
2009-03-19 15:44:26 +01:00
|
|
|
DebuggerSettings *theDebuggerSettings()
|
2009-03-19 09:32:09 +01:00
|
|
|
{
|
2009-03-19 15:44:26 +01:00
|
|
|
static DebuggerSettings *instance = 0;
|
2009-03-19 09:32:09 +01:00
|
|
|
if (instance)
|
|
|
|
return instance;
|
|
|
|
|
2009-03-19 15:44:26 +01:00
|
|
|
instance = new DebuggerSettings;
|
2009-03-19 09:32:09 +01:00
|
|
|
|
2009-03-19 15:44:26 +01:00
|
|
|
DebuggerAction *item = 0;
|
2009-03-19 09:32:09 +01:00
|
|
|
|
2009-03-25 12:30:13 +01:00
|
|
|
//
|
|
|
|
// View
|
|
|
|
//
|
2009-03-19 15:44:26 +01:00
|
|
|
item = new DebuggerAction(instance);
|
2009-03-19 10:54:27 +01:00
|
|
|
instance->insertItem(AdjustColumnWidths, item);
|
2009-03-19 09:32:09 +01:00
|
|
|
item->setText(QObject::tr("Adjust column widths to contents"));
|
|
|
|
|
2009-03-19 15:44:26 +01:00
|
|
|
item = new DebuggerAction(instance);
|
2009-03-19 10:54:27 +01:00
|
|
|
instance->insertItem(AlwaysAdjustColumnWidths, item);
|
2009-03-19 09:32:09 +01:00
|
|
|
item->setText(QObject::tr("Always adjust column widths to contents"));
|
2009-03-19 15:54:52 +01:00
|
|
|
item->setCheckable(true);
|
2009-03-19 09:32:09 +01:00
|
|
|
|
2009-03-25 12:30:13 +01:00
|
|
|
//
|
|
|
|
// Locals & Watchers
|
|
|
|
//
|
2009-03-19 15:44:26 +01:00
|
|
|
item = new DebuggerAction(instance);
|
2009-03-19 10:54:27 +01:00
|
|
|
instance->insertItem(WatchExpression, item);
|
2009-03-19 09:32:09 +01:00
|
|
|
item->setTextPattern(QObject::tr("Watch expression \"%1\""));
|
|
|
|
|
2009-03-19 15:44:26 +01:00
|
|
|
item = new DebuggerAction(instance);
|
2009-03-19 10:54:27 +01:00
|
|
|
instance->insertItem(RemoveWatchExpression, item);
|
2009-03-19 09:32:09 +01:00
|
|
|
item->setTextPattern(QObject::tr("Remove watch expression \"%1\""));
|
|
|
|
|
2009-03-19 15:44:26 +01:00
|
|
|
item = new DebuggerAction(instance);
|
2009-03-19 12:24:04 +01:00
|
|
|
instance->insertItem(WatchExpressionInWindow, item);
|
|
|
|
item->setTextPattern(QObject::tr("Watch expression \"%1\" in separate window"));
|
2009-03-19 16:19:44 +01:00
|
|
|
//item->setCheckable(true);
|
2009-03-19 15:24:18 +01:00
|
|
|
|
2009-03-19 15:44:26 +01:00
|
|
|
item = new DebuggerAction(instance);
|
2009-03-19 15:24:18 +01:00
|
|
|
instance->insertItem(AssignValue, item);
|
2009-03-19 12:24:04 +01:00
|
|
|
|
2009-03-25 12:30:13 +01:00
|
|
|
item = new DebuggerAction(instance);
|
|
|
|
instance->insertItem(ExpandItem, item);
|
|
|
|
item->setText(QObject::tr("Expand item"));
|
|
|
|
|
|
|
|
item = new DebuggerAction(instance);
|
|
|
|
instance->insertItem(CollapseItem, item);
|
|
|
|
item->setText(QObject::tr("Collapse item"));
|
|
|
|
|
2009-03-19 12:24:04 +01:00
|
|
|
//
|
|
|
|
// Dumpers
|
|
|
|
//
|
2009-03-19 15:44:26 +01:00
|
|
|
item = new DebuggerAction(instance);
|
2009-03-19 10:54:27 +01:00
|
|
|
instance->insertItem(SettingsDialog, item);
|
2009-03-19 09:32:09 +01:00
|
|
|
item->setText(QObject::tr("Debugger properties..."));
|
|
|
|
|
2009-03-19 15:44:26 +01:00
|
|
|
item = new DebuggerAction(instance);
|
2009-03-19 10:54:27 +01:00
|
|
|
instance->insertItem(DebugDumpers, item);
|
2009-03-19 09:32:09 +01:00
|
|
|
item->setText(QObject::tr("Debug custom dumpers"));
|
2009-03-19 15:54:52 +01:00
|
|
|
item->setCheckable(true);
|
2009-03-19 09:32:09 +01:00
|
|
|
|
2009-03-19 15:44:26 +01:00
|
|
|
item = new DebuggerAction(instance);
|
2009-03-19 09:32:09 +01:00
|
|
|
item->setText(QObject::tr("Recheck custom dumper availability"));
|
2009-03-24 16:39:01 +01:00
|
|
|
instance->insertItem(RecheckDumpers, item);
|
2009-03-18 10:04:02 +01:00
|
|
|
|
|
|
|
//
|
2009-03-19 09:32:09 +01:00
|
|
|
// Breakpoints
|
2009-03-18 10:04:02 +01:00
|
|
|
//
|
2009-03-19 15:44:26 +01:00
|
|
|
item = new DebuggerAction(instance);
|
2009-03-19 09:32:09 +01:00
|
|
|
item->setText(QObject::tr("Syncronize breakpoints"));
|
2009-03-24 16:39:01 +01:00
|
|
|
instance->insertItem(SynchronizeBreakpoints, item);
|
2009-03-18 10:04:02 +01:00
|
|
|
|
2009-03-24 16:39:01 +01:00
|
|
|
//
|
|
|
|
// Registers
|
|
|
|
//
|
|
|
|
|
|
|
|
QActionGroup *registerFormatGroup = new QActionGroup(instance);
|
|
|
|
registerFormatGroup->setExclusive(true);
|
|
|
|
|
|
|
|
item = new DebuggerAction(instance);
|
|
|
|
item->setText(QObject::tr("Hexadecimal"));
|
|
|
|
item->setCheckable(true);
|
|
|
|
item->setSettingsKey("DebugMode", "FormatHexadecimal");
|
|
|
|
item->setChecked(true);
|
|
|
|
instance->insertItem(FormatHexadecimal, item);
|
|
|
|
registerFormatGroup->addAction(item);
|
|
|
|
|
|
|
|
item = new DebuggerAction(instance);
|
|
|
|
item->setText(QObject::tr("Decimal"));
|
|
|
|
item->setCheckable(true);
|
|
|
|
item->setSettingsKey("DebugMode", "FormatDecimal");
|
|
|
|
instance->insertItem(FormatDecimal, item);
|
|
|
|
registerFormatGroup->addAction(item);
|
|
|
|
|
|
|
|
item = new DebuggerAction(instance);
|
|
|
|
item->setText(QObject::tr("Octal"));
|
|
|
|
item->setCheckable(true);
|
|
|
|
item->setSettingsKey("DebugMode", "FormatOctal");
|
|
|
|
instance->insertItem(FormatOctal, item);
|
|
|
|
registerFormatGroup->addAction(item);
|
|
|
|
|
|
|
|
item = new DebuggerAction(instance);
|
|
|
|
item->setText(QObject::tr("Binary"));
|
|
|
|
item->setCheckable(true);
|
|
|
|
item->setSettingsKey("DebugMode", "FormatBinary");
|
|
|
|
instance->insertItem(FormatBinary, item);
|
|
|
|
registerFormatGroup->addAction(item);
|
|
|
|
|
|
|
|
item = new DebuggerAction(instance);
|
|
|
|
item->setText(QObject::tr("Raw"));
|
|
|
|
item->setCheckable(true);
|
|
|
|
item->setSettingsKey("DebugMode", "FormatRaw");
|
|
|
|
instance->insertItem(FormatRaw, item);
|
|
|
|
registerFormatGroup->addAction(item);
|
|
|
|
|
|
|
|
item = new DebuggerAction(instance);
|
|
|
|
item->setText(QObject::tr("Natural"));
|
|
|
|
item->setCheckable(true);
|
|
|
|
item->setSettingsKey("DebugMode", "FormatNatural");
|
|
|
|
instance->insertItem(FormatNatural, item);
|
|
|
|
registerFormatGroup->addAction(item);
|
|
|
|
|
|
|
|
//
|
|
|
|
// Misc
|
2009-03-18 10:04:02 +01:00
|
|
|
//
|
2009-03-19 09:32:09 +01:00
|
|
|
|
2009-03-19 15:44:26 +01:00
|
|
|
item = new DebuggerAction(instance);
|
2009-03-19 10:54:27 +01:00
|
|
|
instance->insertItem(SkipKnownFrames, item);
|
2009-03-19 09:32:09 +01:00
|
|
|
item->setText(QObject::tr("Skip known frames"));
|
2009-03-19 15:54:52 +01:00
|
|
|
item->setCheckable(true);
|
2009-03-19 09:32:09 +01:00
|
|
|
|
2009-03-19 15:44:26 +01:00
|
|
|
item = new DebuggerAction(instance);
|
2009-03-19 10:54:27 +01:00
|
|
|
instance->insertItem(UseToolTips, item);
|
2009-03-19 09:32:09 +01:00
|
|
|
item->setText(QObject::tr("Use tooltips when debugging"));
|
2009-03-19 15:54:52 +01:00
|
|
|
item->setCheckable(true);
|
2009-03-19 09:32:09 +01:00
|
|
|
|
2009-03-19 15:44:26 +01:00
|
|
|
item = new DebuggerAction(instance);
|
2009-03-19 10:54:27 +01:00
|
|
|
instance->insertItem(ListSourceFiles, item);
|
2009-03-19 09:32:09 +01:00
|
|
|
item->setText(QObject::tr("List source files"));
|
2009-03-19 15:54:52 +01:00
|
|
|
item->setCheckable(true);
|
2009-03-19 09:32:09 +01:00
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
// Settings
|
2009-03-18 10:04:02 +01:00
|
|
|
//
|
2009-03-19 15:44:26 +01:00
|
|
|
item = new DebuggerAction(instance);
|
2009-03-19 10:54:27 +01:00
|
|
|
instance->insertItem(GdbLocation, item);
|
2009-03-19 09:32:09 +01:00
|
|
|
item->setSettingsKey("DebugMode", "Location");
|
2009-03-18 10:04:02 +01:00
|
|
|
|
2009-03-19 15:44:26 +01:00
|
|
|
item = new DebuggerAction(instance);
|
2009-03-19 10:54:27 +01:00
|
|
|
instance->insertItem(GdbEnvironment, item);
|
2009-03-19 09:32:09 +01:00
|
|
|
item->setSettingsKey("DebugMode", "Environment");
|
2009-03-18 10:04:02 +01:00
|
|
|
|
2009-03-19 15:44:26 +01:00
|
|
|
item = new DebuggerAction(instance);
|
2009-03-19 10:54:27 +01:00
|
|
|
instance->insertItem(GdbScriptFile, item);
|
2009-03-19 09:32:09 +01:00
|
|
|
item->setSettingsKey("DebugMode", "ScriptFile");
|
|
|
|
|
2009-03-19 15:44:26 +01:00
|
|
|
item = new DebuggerAction(instance);
|
2009-03-19 09:32:09 +01:00
|
|
|
item->setSettingsKey("DebugMode", "AutoQuit");
|
2009-03-24 15:01:35 +01:00
|
|
|
item->setText(QObject::tr("Automatically quit debugger"));
|
|
|
|
item->setCheckable(true);
|
|
|
|
instance->insertItem(AutoQuit, item);
|
2009-03-19 09:32:09 +01:00
|
|
|
|
2009-03-19 15:44:26 +01:00
|
|
|
item = new DebuggerAction(instance);
|
2009-03-19 10:54:27 +01:00
|
|
|
instance->insertItem(UseToolTips, item);
|
2009-03-19 09:32:09 +01:00
|
|
|
item->setSettingsKey("DebugMode", "UseToolTips");
|
|
|
|
|
2009-03-19 15:44:26 +01:00
|
|
|
item = new DebuggerAction(instance);
|
2009-03-19 10:54:27 +01:00
|
|
|
instance->insertItem(UseDumpers, item);
|
2009-03-19 09:32:09 +01:00
|
|
|
item->setSettingsKey("DebugMode", "UseCustomDumpers");
|
|
|
|
item->setText(QObject::tr("Use custom dumpers"));
|
2009-03-19 15:54:52 +01:00
|
|
|
item->setCheckable(true);
|
2009-03-19 09:32:09 +01:00
|
|
|
|
2009-03-23 12:28:02 +01:00
|
|
|
item = new DebuggerAction(instance);
|
|
|
|
instance->insertItem(BuildDumpersOnTheFly, item);
|
2009-03-23 13:02:50 +01:00
|
|
|
item->setDefaultValue(true);
|
2009-03-23 12:28:02 +01:00
|
|
|
item->setSettingsKey("DebugMode", "BuildDumpersOnTheFly");
|
|
|
|
item->setCheckable(true);
|
2009-03-26 08:42:27 +01:00
|
|
|
|
|
|
|
item = new DebuggerAction(instance);
|
|
|
|
instance->insertItem(UseQtDumpers, item);
|
|
|
|
item->setSettingsKey("DebugMode", "UseQtDumpers");
|
|
|
|
item->setCheckable(true);
|
2009-03-23 12:28:02 +01:00
|
|
|
|
|
|
|
item = new DebuggerAction(instance);
|
|
|
|
instance->insertItem(UsePrebuiltDumpers, item);
|
|
|
|
item->setSettingsKey("DebugMode", "UsePrebuiltDumpers");
|
|
|
|
item->setCheckable(true);
|
|
|
|
|
|
|
|
item = new DebuggerAction(instance);
|
|
|
|
instance->insertItem(PrebuiltDumpersLocation, item);
|
|
|
|
item->setSettingsKey("DebugMode", "PrebuiltDumpersLocation");
|
|
|
|
|
2009-03-20 09:53:02 +01:00
|
|
|
item = new DebuggerAction(instance);
|
2009-03-24 15:01:35 +01:00
|
|
|
instance->insertItem(TerminalApplication, item);
|
2009-03-20 09:53:02 +01:00
|
|
|
item->setDefaultValue("xterm");
|
|
|
|
item->setSettingsKey("DebugMode", "Terminal");
|
2009-03-19 09:32:09 +01:00
|
|
|
|
2009-03-19 15:44:26 +01:00
|
|
|
item = new DebuggerAction(instance);
|
2009-03-19 10:54:27 +01:00
|
|
|
instance->insertItem(ListSourceFiles, item);
|
2009-03-19 09:32:09 +01:00
|
|
|
item->setSettingsKey("DebugMode", "ListSourceFiles");
|
|
|
|
|
2009-03-19 15:44:26 +01:00
|
|
|
item = new DebuggerAction(instance);
|
2009-03-19 10:54:27 +01:00
|
|
|
instance->insertItem(SkipKnownFrames, item);
|
2009-03-19 09:32:09 +01:00
|
|
|
item->setSettingsKey("DebugMode", "SkipKnownFrames");
|
|
|
|
|
2009-03-19 15:44:26 +01:00
|
|
|
item = new DebuggerAction(instance);
|
2009-03-19 10:54:27 +01:00
|
|
|
instance->insertItem(DebugDumpers, item);
|
2009-03-19 09:32:09 +01:00
|
|
|
item->setSettingsKey("DebugMode", "DebugDumpers");
|
|
|
|
|
2009-03-19 15:44:26 +01:00
|
|
|
item = new DebuggerAction(instance);
|
2009-03-19 10:54:27 +01:00
|
|
|
instance->insertItem(AllPluginBreakpoints, item);
|
2009-03-19 09:32:09 +01:00
|
|
|
item->setSettingsKey("DebugMode", "AllPluginBreakpoints");
|
|
|
|
|
2009-03-19 15:44:26 +01:00
|
|
|
item = new DebuggerAction(instance);
|
2009-03-19 10:54:27 +01:00
|
|
|
instance->insertItem(SelectedPluginBreakpoints, item);
|
2009-03-19 09:32:09 +01:00
|
|
|
item->setSettingsKey("DebugMode", "SelectedPluginBreakpoints");
|
|
|
|
|
2009-03-19 15:44:26 +01:00
|
|
|
item = new DebuggerAction(instance);
|
2009-03-19 10:54:27 +01:00
|
|
|
instance->insertItem(NoPluginBreakpoints, item);
|
2009-03-19 09:32:09 +01:00
|
|
|
item->setSettingsKey("DebugMode", "NoPluginBreakpoints");
|
|
|
|
|
2009-03-19 15:44:26 +01:00
|
|
|
item = new DebuggerAction(instance);
|
2009-03-19 10:54:27 +01:00
|
|
|
instance->insertItem(SelectedPluginBreakpointsPattern, item);
|
2009-03-19 09:32:09 +01:00
|
|
|
item->setSettingsKey("DebugMode", "SelectedPluginBreakpointsPattern");
|
2009-03-18 10:04:02 +01:00
|
|
|
|
2009-03-19 09:32:09 +01:00
|
|
|
return instance;
|
2009-03-18 10:04:02 +01:00
|
|
|
}
|
|
|
|
|
2009-03-19 15:44:26 +01:00
|
|
|
DebuggerAction *theDebuggerAction(int code)
|
2009-03-19 10:54:27 +01:00
|
|
|
{
|
|
|
|
return theDebuggerSettings()->item(code);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool theDebuggerBoolSetting(int code)
|
|
|
|
{
|
|
|
|
return theDebuggerSettings()->item(code)->value().toBool();
|
|
|
|
}
|
|
|
|
|
|
|
|
QString theDebuggerStringSetting(int code)
|
|
|
|
{
|
|
|
|
return theDebuggerSettings()->item(code)->value().toString();
|
|
|
|
}
|
|
|
|
|
2009-03-18 10:04:02 +01:00
|
|
|
} // namespace Internal
|
|
|
|
} // namespace Debugger
|
|
|
|
|