Commit 50cabb92 authored by hjk's avatar hjk
Browse files

debugger: progress in action reorganisation

parent 889fe3eb
......@@ -117,10 +117,7 @@ QString QtcSettingsItem::text() const
void QtcSettingsItem::setText(const QString &value)
{
if (!value.isEmpty() && !m_textPattern.isEmpty())
m_action->setText(m_textPattern.arg(value));
else
m_action->setText(value);
m_action->setText(value);
}
QString QtcSettingsItem::textPattern() const
......@@ -133,6 +130,25 @@ void QtcSettingsItem::setTextPattern(const QString &value)
m_textPattern = value;
}
QAction *QtcSettingsItem::updatedAction(const QString &text0)
{
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);
}
}
m_action->setEnabled(enabled);
m_action->setText(text);
return m_action;
}
void QtcSettingsItem::readSettings(QSettings *settings)
{
if (m_settingsGroup.isEmpty() || m_settingsKey.isEmpty())
......@@ -153,7 +169,7 @@ void QtcSettingsItem::writeSettings(QSettings *settings)
settings->endGroup();
}
QAction *QtcSettingsItem::action() const
QAction *QtcSettingsItem::action()
{
return m_action;
}
......@@ -355,6 +371,13 @@ QtcSettingsPool *theDebuggerSettings()
instance->insertItem(RemoveWatchExpression, item);
item->setTextPattern(QObject::tr("Remove watch expression \"%1\""));
item = new QtcSettingsItem(instance);
instance->insertItem(WatchExpressionInWindow, item);
item->setTextPattern(QObject::tr("Watch expression \"%1\" in separate window"));
//
// Dumpers
//
item = new QtcSettingsItem(instance);
instance->insertItem(SettingsDialog, item);
item->setText(QObject::tr("Debugger properties..."));
......
......@@ -59,7 +59,8 @@ public:
virtual QVariant defaultValue() const;
Q_SLOT virtual void setDefaultValue(const QVariant &value);
virtual QAction *action() const;
virtual QAction *action();
virtual QAction *updatedAction(const QString &newText);
// used for persistency
virtual QString settingsKey() const;
......@@ -99,6 +100,7 @@ private:
QString m_settingsKey;
QString m_settingsGroup;
QString m_textPattern;
QString m_textData;
QAction *m_action;
QHash<QObject *, ApplyMode> m_applyModes;
};
......@@ -145,6 +147,7 @@ enum DebuggerSettingsCode
// Watchers & Locals
WatchExpression,
WatchExpressionInWindow,
RemoveWatchExpression,
WatchModelUpdate,
RecheckDumpers,
......
......@@ -115,19 +115,17 @@ void WatchWindow::contextMenuEvent(QContextMenuEvent *ev)
QModelIndex mi1 = idx.sibling(idx.row(), 0);
QString value = model()->data(mi1).toString();
bool visual = false;
if (idx.isValid()) {
menu.addSeparator();
int type = (m_type == LocalsType) ? WatchExpression : RemoveWatchExpression;
QAction *act3 = theDebuggerSetting(type)->action();
act3->setText(exp);
menu.addAction(act3);
visual = model()->data(mi0, VisualRole).toBool();
act4 = new QAction("Watch expression '" + exp + "' in separate widget", &menu);
act4->setCheckable(true);
act4->setChecked(visual);
// FIXME: menu.addAction(act4);
}
menu.addSeparator();
int type = (m_type == LocalsType) ? WatchExpression : RemoveWatchExpression;
menu.addAction(theDebuggerSetting(type)->updatedAction(exp));
visual = model()->data(mi0, VisualRole).toBool();
//act4 = theDebuggerSetting(WatchExpressionInWindow)->action();
//act4->setCheckable(true);
//act4->setChecked(visual);
// FIXME: menu.addAction(act4);
menu.addSeparator();
menu.addAction(theDebuggerSetting(RecheckDumpers)->action());
menu.addAction(theDebuggerSetting(UseDumpers)->action());
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment