Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Tobias Hunger
qt-creator
Commits
c110da75
Commit
c110da75
authored
Mar 19, 2009
by
hjk
Browse files
debugger: make QAction a base class of DebuggerAction
parent
5999c35d
Changes
8
Hide whitespace changes
Inline
Side-by-side
src/plugins/debugger/breakwindow.cpp
View file @
c110da75
...
...
@@ -101,7 +101,7 @@ void BreakWindow::contextMenuEvent(QContextMenuEvent *ev)
menu
.
addAction
(
act1
);
menu
.
addAction
(
act2
);
menu
.
addAction
(
act4
);
menu
.
addAction
(
theDebuggerAction
(
SettingsDialog
)
->
action
()
);
menu
.
addAction
(
theDebuggerAction
(
SettingsDialog
));
QAction
*
act
=
menu
.
exec
(
ev
->
globalPos
());
...
...
src/plugins/debugger/debuggeractions.cpp
View file @
c110da75
...
...
@@ -49,10 +49,9 @@ namespace Internal {
//////////////////////////////////////////////////////////////////////////
DebuggerAction
::
DebuggerAction
(
QObject
*
parent
)
:
Q
Object
(
parent
)
:
Q
Action
(
parent
)
{
m_action
=
new
QAction
(
this
);
connect
(
m_action
,
SIGNAL
(
triggered
(
bool
)),
this
,
SLOT
(
actionTriggered
(
bool
)));
connect
(
this
,
SIGNAL
(
triggered
(
bool
)),
this
,
SLOT
(
actionTriggered
(
bool
)));
}
QVariant
DebuggerAction
::
value
()
const
...
...
@@ -64,8 +63,8 @@ void DebuggerAction::setValue(const QVariant &value, bool doemit)
{
if
(
value
!=
m_value
)
{
m_value
=
value
;
if
(
m_action
->
isCheckable
())
m_action
->
setChecked
(
m_value
.
toBool
());
if
(
this
->
isCheckable
())
this
->
setChecked
(
m_value
.
toBool
());
if
(
doemit
)
{
emit
valueChanged
(
m_value
);
emit
boolValueChanged
(
m_value
.
toBool
());
...
...
@@ -110,16 +109,6 @@ void DebuggerAction::setSettingsGroup(const QString &group)
m_settingsGroup
=
group
;
}
QString
DebuggerAction
::
text
()
const
{
return
m_action
->
text
();
}
void
DebuggerAction
::
setText
(
const
QString
&
value
)
{
m_action
->
setText
(
value
);
}
QString
DebuggerAction
::
textPattern
()
const
{
return
m_textPattern
;
...
...
@@ -144,10 +133,10 @@ QAction *DebuggerAction::updatedAction(const QString &text0)
text
=
m_textPattern
.
arg
(
text0
);
}
}
m_action
->
setEnabled
(
enabled
);
m_action
->
setData
(
text0
);
m_action
->
setText
(
text
);
return
m_action
;
this
->
setEnabled
(
enabled
);
this
->
setData
(
text0
);
this
->
setText
(
text
);
return
this
;
}
void
DebuggerAction
::
readSettings
(
QSettings
*
settings
)
...
...
@@ -170,11 +159,6 @@ void DebuggerAction::writeSettings(QSettings *settings)
settings
->
endGroup
();
}
QAction
*
DebuggerAction
::
action
()
{
return
m_action
;
}
void
DebuggerAction
::
connectWidget
(
QWidget
*
widget
,
ApplyMode
applyMode
)
{
using
namespace
Core
::
Utils
;
...
...
@@ -218,7 +202,7 @@ void DebuggerAction::uncheckableButtonClicked()
QAbstractButton
*
button
=
qobject_cast
<
QAbstractButton
*>
(
sender
());
QTC_ASSERT
(
button
,
return
);
//qDebug() << "UNCHECKABLE BUTTON: " << sender();
m_a
ction
->
trigger
();
QA
ction
::
trigger
();
}
void
DebuggerAction
::
checkableButtonClicked
(
bool
)
...
...
@@ -255,19 +239,16 @@ void DebuggerAction::pathChooserEditingFinished()
setValue
(
pathChooser
->
path
());
}
void
DebuggerAction
::
actionTriggered
(
bool
on
)
void
DebuggerAction
::
actionTriggered
(
bool
)
{
Q_UNUSED
(
on
);
if
(
QAction
*
action
=
qobject_cast
<
QAction
*>
(
sender
()))
{
if
(
action
->
isCheckable
())
setValue
(
action
->
isChecked
());
}
if
(
this
->
isCheckable
())
setValue
(
this
->
isChecked
());
}
void
DebuggerAction
::
trigger
(
const
QVariant
&
data
)
const
void
DebuggerAction
::
trigger
(
const
QVariant
&
data
)
{
m_action
->
setData
(
data
);
m_a
ction
->
trigger
();
setData
(
data
);
QA
ction
::
trigger
();
}
//////////////////////////////////////////////////////////////////////////
...
...
@@ -345,7 +326,7 @@ DebuggerSettings *theDebuggerSettings()
item
=
new
DebuggerAction
(
instance
);
instance
->
insertItem
(
AlwaysAdjustColumnWidths
,
item
);
item
->
setText
(
QObject
::
tr
(
"Always adjust column widths to contents"
));
item
->
action
()
->
setCheckable
(
true
);
item
->
setCheckable
(
true
);
item
=
new
DebuggerAction
(
instance
);
instance
->
insertItem
(
WatchExpression
,
item
);
...
...
@@ -372,7 +353,7 @@ DebuggerSettings *theDebuggerSettings()
item
=
new
DebuggerAction
(
instance
);
instance
->
insertItem
(
DebugDumpers
,
item
);
item
->
setText
(
QObject
::
tr
(
"Debug custom dumpers"
));
item
->
action
()
->
setCheckable
(
true
);
item
->
setCheckable
(
true
);
item
=
new
DebuggerAction
(
instance
);
instance
->
insertItem
(
RecheckDumpers
,
item
);
...
...
@@ -389,22 +370,22 @@ DebuggerSettings *theDebuggerSettings()
item
=
new
DebuggerAction
(
instance
);
instance
->
insertItem
(
AutoQuit
,
item
);
item
->
setText
(
QObject
::
tr
(
"Automatically quit debugger"
));
item
->
action
()
->
setCheckable
(
true
);
item
->
setCheckable
(
true
);
item
=
new
DebuggerAction
(
instance
);
instance
->
insertItem
(
SkipKnownFrames
,
item
);
item
->
setText
(
QObject
::
tr
(
"Skip known frames"
));
item
->
action
()
->
setCheckable
(
true
);
item
->
setCheckable
(
true
);
item
=
new
DebuggerAction
(
instance
);
instance
->
insertItem
(
UseToolTips
,
item
);
item
->
setText
(
QObject
::
tr
(
"Use tooltips when debugging"
));
item
->
action
()
->
setCheckable
(
true
);
item
->
setCheckable
(
true
);
item
=
new
DebuggerAction
(
instance
);
instance
->
insertItem
(
ListSourceFiles
,
item
);
item
->
setText
(
QObject
::
tr
(
"List source files"
));
item
->
action
()
->
setCheckable
(
true
);
item
->
setCheckable
(
true
);
//
...
...
@@ -438,7 +419,7 @@ DebuggerSettings *theDebuggerSettings()
instance
->
insertItem
(
UseDumpers
,
item
);
item
->
setSettingsKey
(
"DebugMode"
,
"UseCustomDumpers"
);
item
->
setText
(
QObject
::
tr
(
"Use custom dumpers"
));
item
->
action
()
->
setCheckable
(
true
);
item
->
setCheckable
(
true
);
item
=
new
DebuggerAction
(
instance
);
...
...
src/plugins/debugger/debuggeractions.h
View file @
c110da75
...
...
@@ -35,8 +35,9 @@
#include
<QtCore/QVariant>
#include
<QtCore/QList>
#include
<QtGui/QAction>
QT_BEGIN_NAMESPACE
class
QAction
;
class
QSettings
;
QT_END_NAMESPACE
...
...
@@ -46,7 +47,7 @@ namespace Internal {
enum
ApplyMode
{
ImmediateApply
,
DeferedApply
};
class
DebuggerAction
:
public
Q
Object
class
DebuggerAction
:
public
Q
Action
{
Q_OBJECT
...
...
@@ -59,9 +60,8 @@ public:
virtual
QVariant
defaultValue
()
const
;
Q_SLOT
virtual
void
setDefaultValue
(
const
QVariant
&
value
);
virtual
QAction
*
action
();
virtual
QAction
*
updatedAction
(
const
QString
&
newText
);
Q_SLOT
virtual
void
trigger
(
const
QVariant
&
data
)
const
;
Q_SLOT
virtual
void
trigger
(
const
QVariant
&
data
);
// used for persistency
virtual
QString
settingsKey
()
const
;
...
...
@@ -77,9 +77,6 @@ public:
virtual
void
connectWidget
(
QWidget
*
widget
,
ApplyMode
applyMode
=
DeferedApply
);
Q_SLOT
virtual
void
apply
(
QSettings
*
settings
);
virtual
QString
text
()
const
;
Q_SLOT
virtual
void
setText
(
const
QString
&
value
);
virtual
QString
textPattern
()
const
;
Q_SLOT
virtual
void
setTextPattern
(
const
QString
&
value
);
...
...
@@ -102,7 +99,6 @@ private:
QString
m_settingsGroup
;
QString
m_textPattern
;
QString
m_textData
;
QAction
*
m_action
;
QHash
<
QObject
*
,
ApplyMode
>
m_applyModes
;
};
...
...
src/plugins/debugger/debuggermanager.cpp
View file @
c110da75
...
...
@@ -267,7 +267,7 @@ void DebuggerManager::init()
this
,
SIGNAL
(
sessionValueRequested
(
QString
,
QVariant
*
)));
connect
(
m_watchHandler
,
SIGNAL
(
setSessionValueRequested
(
QString
,
QVariant
)),
this
,
SIGNAL
(
setSessionValueRequested
(
QString
,
QVariant
)));
connect
(
theDebuggerAction
(
AssignValue
)
->
action
()
,
SIGNAL
(
triggered
()),
connect
(
theDebuggerAction
(
AssignValue
),
SIGNAL
(
triggered
()),
this
,
SLOT
(
assignValueInDebugger
()));
// Tooltip
...
...
src/plugins/debugger/debuggerplugin.cpp
View file @
c110da75
...
...
@@ -715,7 +715,7 @@ bool DebuggerPlugin::initialize(const QStringList &arguments, QString *errorMess
connect
(
m_manager
,
SIGNAL
(
debugModeRequested
()),
this
,
SLOT
(
activateDebugMode
()));
connect
(
theDebuggerAction
(
SettingsDialog
)
->
action
()
,
SIGNAL
(
triggered
()),
connect
(
theDebuggerAction
(
SettingsDialog
),
SIGNAL
(
triggered
()),
this
,
SLOT
(
showSettingsDialog
()));
return
true
;
...
...
src/plugins/debugger/gdbengine.cpp
View file @
c110da75
...
...
@@ -289,7 +289,7 @@ void GdbEngine::initializeConnections()
this
,
SLOT
(
setUseDumpers
(
bool
)));
connect
(
theDebuggerAction
(
DebugDumpers
),
SIGNAL
(
boolValueChanged
(
bool
)),
this
,
SLOT
(
setDebugDumpers
(
bool
)));
connect
(
theDebuggerAction
(
RecheckDumpers
)
->
action
()
,
SIGNAL
(
triggered
()),
connect
(
theDebuggerAction
(
RecheckDumpers
),
SIGNAL
(
triggered
()),
this
,
SLOT
(
recheckCustomDumperAvailability
()));
}
...
...
src/plugins/debugger/watchhandler.cpp
View file @
c110da75
...
...
@@ -368,10 +368,10 @@ WatchHandler::WatchHandler()
m_incompleteSet
.
clear
();
m_displaySet
=
m_completeSet
;
connect
(
theDebuggerAction
(
WatchExpression
)
->
action
()
,
connect
(
theDebuggerAction
(
WatchExpression
),
SIGNAL
(
triggered
()),
this
,
SLOT
(
watchExpression
()));
connect
(
theDebuggerAction
(
RemoveWatchExpression
)
->
action
()
,
connect
(
theDebuggerAction
(
RemoveWatchExpression
),
SIGNAL
(
triggered
()),
this
,
SLOT
(
removeWatchExpression
()));
}
...
...
src/plugins/debugger/watchwindow.cpp
View file @
c110da75
...
...
@@ -185,10 +185,10 @@ void WatchWindow::contextMenuEvent(QContextMenuEvent *ev)
//menu.addAction(act3);
menu
.
addSeparator
();
menu
.
addAction
(
theDebuggerAction
(
RecheckDumpers
)
->
action
()
);
menu
.
addAction
(
theDebuggerAction
(
UseDumpers
)
->
action
()
);
menu
.
addAction
(
theDebuggerAction
(
RecheckDumpers
));
menu
.
addAction
(
theDebuggerAction
(
UseDumpers
));
menu
.
addSeparator
();
menu
.
addAction
(
theDebuggerAction
(
SettingsDialog
)
->
action
()
);
menu
.
addAction
(
theDebuggerAction
(
SettingsDialog
));
QAction
*
act
=
menu
.
exec
(
ev
->
globalPos
());
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment