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
Marco Bubke
flatpak-qt-creator
Commits
f54440b4
Commit
f54440b4
authored
Mar 26, 2009
by
hjk
Browse files
debugger: work on generalizing the new debugger actions
parent
b9689320
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/plugins/debugger/debuggeractions.cpp
View file @
f54440b4
...
...
@@ -172,6 +172,8 @@ void DebuggerAction::writeSettings(QSettings *settings)
void
DebuggerAction
::
connectWidget
(
QWidget
*
widget
,
ApplyMode
applyMode
)
{
using
namespace
Core
::
Utils
;
QTC_ASSERT
(
!
m_widget
,
qDebug
()
<<
"ALREADY CONNECTED: "
<<
widget
<<
m_widget
<<
toString
();
return
);
m_widget
=
widget
;
m_applyMode
=
applyMode
;
...
...
@@ -200,6 +202,12 @@ void DebuggerAction::connectWidget(QWidget *widget, ApplyMode applyMode)
}
}
void
DebuggerAction
::
disconnectWidget
()
{
QTC_ASSERT
(
m_widget
,
qDebug
()
<<
"ALREADY DISCONNECTED: "
<<
m_widget
<<
toString
();
return
);
m_widget
=
0
;
}
void
DebuggerAction
::
apply
(
QSettings
*
s
)
{
using
namespace
Core
::
Utils
;
...
...
@@ -209,7 +217,6 @@ void DebuggerAction::apply(QSettings *s)
setValue
(
lineEdit
->
text
());
else
if
(
PathChooser
*
pathChooser
=
qobject_cast
<
PathChooser
*>
(
m_widget
))
setValue
(
pathChooser
->
path
());
m_widget
=
0
;
if
(
s
)
writeSettings
(
s
);
}
...
...
@@ -270,6 +277,31 @@ void DebuggerAction::trigger(const QVariant &data)
}
//////////////////////////////////////////////////////////////////////////
//
// 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
();
}
//////////////////////////////////////////////////////////////////////////
//
// DebuggerSettings
...
...
src/plugins/debugger/debuggeractions.h
View file @
f54440b4
...
...
@@ -75,6 +75,7 @@ public:
Q_SLOT
virtual
void
writeSettings
(
QSettings
*
settings
);
virtual
void
connectWidget
(
QWidget
*
widget
,
ApplyMode
applyMode
=
DeferedApply
);
virtual
void
disconnectWidget
();
Q_SLOT
virtual
void
apply
(
QSettings
*
settings
);
virtual
QString
textPattern
()
const
;
...
...
@@ -102,6 +103,21 @@ private:
ApplyMode
m_applyMode
;
};
class
DebuggerSettingsGroup
{
public:
DebuggerSettingsGroup
()
{}
~
DebuggerSettingsGroup
()
{}
void
insert
(
DebuggerAction
*
action
,
QWidget
*
widget
);
void
apply
(
QSettings
*
settings
);
void
finish
();
private:
QList
<
DebuggerAction
*>
m_list
;
};
class
DebuggerSettings
:
public
QObject
{
Q_OBJECT
...
...
src/plugins/debugger/debuggerplugin.cpp
View file @
f54440b4
...
...
@@ -251,14 +251,15 @@ public:
QString
trCategory
()
const
{
return
tr
(
"Debugger"
);
}
QWidget
*
createPage
(
QWidget
*
parent
);
void
apply
()
;
void
finish
()
{
}
// automatically calls "apply"
void
apply
()
{
m_group
.
apply
(
ICore
::
instance
()
->
settings
());
}
void
finish
()
{
m_group
.
finish
();
}
private:
friend
class
DebuggerPlugin
;
Ui
::
GdbOptionPage
m_ui
;
DebuggerPlugin
*
m_plugin
;
DebuggerSettingsGroup
m_group
;
};
QWidget
*
GdbOptionPage
::
createPage
(
QWidget
*
parent
)
...
...
@@ -272,30 +273,28 @@ QWidget *GdbOptionPage::createPage(QWidget *parent)
m_ui
.
terminalChooser
->
setExpectedKind
(
Core
::
Utils
::
PathChooser
::
Command
);
m_ui
.
terminalChooser
->
setPromptDialogTitle
(
tr
(
"Choose Location of Terminal Application"
));
theDebuggerAction
(
GdbLocation
)
->
connectWidget
(
m_ui
.
gdbLocationChooser
);
theDebuggerAction
(
GdbScriptFile
)
->
connectWidget
(
m_ui
.
scriptFileChooser
);
theDebuggerAction
(
GdbEnvironment
)
->
connectWidget
(
m_ui
.
environmentEdit
);
theDebuggerAction
(
TerminalApplication
)
->
connectWidget
(
m_ui
.
terminalChooser
);
theDebuggerAction
(
AllPluginBreakpoints
)
->
connectWidget
(
m_ui
.
radioButtonAllPluginBreakpoints
);
theDebuggerAction
(
SelectedPluginBreakpoints
)
->
connectWidget
(
m_ui
.
radioButtonSelectedPluginBreakpoints
);
theDebuggerAction
(
NoPluginBreakpoints
)
->
connectWidget
(
m_ui
.
radioButtonNoPluginBreakpoints
);
theDebuggerAction
(
SelectedPluginBreakpointsPattern
)
->
connectWidget
(
m_ui
.
lineEditSelectedPluginBreakpointsPattern
);
theDebuggerAction
(
SkipKnownFrames
)
->
connectWidget
(
m_ui
.
checkBoxSkipKnownFrames
);
theDebuggerAction
(
UseToolTips
)
->
connectWidget
(
m_ui
.
checkBoxUseToolTips
);
theDebuggerAction
(
SelectedPluginBreakpointsPattern
)
->
connectWidget
(
m_ui
.
lineEditSelectedPluginBreakpointsPattern
);
m_group
.
insert
(
theDebuggerAction
(
GdbLocation
),
m_ui
.
gdbLocationChooser
);
m_group
.
insert
(
theDebuggerAction
(
GdbScriptFile
),
m_ui
.
scriptFileChooser
);
m_group
.
insert
(
theDebuggerAction
(
GdbEnvironment
),
m_ui
.
environmentEdit
);
m_group
.
insert
(
theDebuggerAction
(
TerminalApplication
),
m_ui
.
terminalChooser
);
m_group
.
insert
(
theDebuggerAction
(
AllPluginBreakpoints
),
m_ui
.
radioButtonAllPluginBreakpoints
);
m_group
.
insert
(
theDebuggerAction
(
SelectedPluginBreakpoints
),
m_ui
.
radioButtonSelectedPluginBreakpoints
);
m_group
.
insert
(
theDebuggerAction
(
NoPluginBreakpoints
),
m_ui
.
radioButtonNoPluginBreakpoints
);
m_group
.
insert
(
theDebuggerAction
(
SelectedPluginBreakpointsPattern
),
m_ui
.
lineEditSelectedPluginBreakpointsPattern
);
m_group
.
insert
(
theDebuggerAction
(
SkipKnownFrames
),
m_ui
.
checkBoxSkipKnownFrames
);
m_group
.
insert
(
theDebuggerAction
(
UseToolTips
),
m_ui
.
checkBoxUseToolTips
);
m_ui
.
lineEditSelectedPluginBreakpointsPattern
->
setEnabled
(
theDebuggerAction
(
SelectedPluginBreakpoints
)
->
value
().
toBool
());
...
...
@@ -312,25 +311,6 @@ QWidget *GdbOptionPage::createPage(QWidget *parent)
return
w
;
}
void
GdbOptionPage
::
apply
()
{
QSettings
*
s
=
ICore
::
instance
()
->
settings
();
theDebuggerAction
(
GdbLocation
)
->
apply
(
s
);
theDebuggerAction
(
GdbScriptFile
)
->
apply
(
s
);
theDebuggerAction
(
GdbEnvironment
)
->
apply
(
s
);
theDebuggerAction
(
TerminalApplication
)
->
apply
(
s
);
theDebuggerAction
(
AllPluginBreakpoints
)
->
apply
(
s
);
theDebuggerAction
(
SelectedPluginBreakpoints
)
->
apply
(
s
);
theDebuggerAction
(
NoPluginBreakpoints
)
->
apply
(
s
);
theDebuggerAction
(
SelectedPluginBreakpointsPattern
)
->
apply
(
s
);
theDebuggerAction
(
SkipKnownFrames
)
->
apply
(
s
);
theDebuggerAction
(
UseToolTips
)
->
apply
(
s
);
theDebuggerAction
(
SelectedPluginBreakpointsPattern
)
->
apply
(
s
);
}
}
// namespace Internal
}
// namespace Debugger
...
...
@@ -358,14 +338,15 @@ public:
QString
trCategory
()
const
{
return
tr
(
"Debugger"
);
}
QWidget
*
createPage
(
QWidget
*
parent
);
void
apply
()
;
void
finish
()
{
}
// automatically calls "apply"
void
apply
()
{
m_group
.
apply
(
ICore
::
instance
()
->
settings
());
}
void
finish
()
{
m_group
.
finish
();
}
private:
friend
class
DebuggerPlugin
;
Ui
::
DumperOptionPage
m_ui
;
DebuggerPlugin
*
m_plugin
;
DebuggerSettingsGroup
m_group
;
};
QWidget
*
DumperOptionPage
::
createPage
(
QWidget
*
parent
)
...
...
@@ -381,19 +362,19 @@ QWidget *DumperOptionPage::createPage(QWidget *parent)
connect
(
m_ui
.
radioButtonUsePrebuiltDumpers
,
SIGNAL
(
toggled
(
bool
)),
m_ui
.
dumperLocationChooser
,
SLOT
(
setEnabled
(
bool
)));
theDebuggerAction
(
UseQtDumpers
)
->
connectWidget
(
m_ui
.
radioButtonUseQtDumpers
);
theDebuggerAction
(
UsePrebuiltDumpers
)
->
connectWidget
(
m_ui
.
radioButtonUsePrebuiltDumpers
);
theDebuggerAction
(
BuildDumpersOnTheFly
)
->
connectWidget
(
m_ui
.
radioButtonBuildDumpersOnTheFly
);
theDebuggerAction
(
PrebuiltDumpersLocation
)
->
connectWidget
(
m_ui
.
dumperLocationChooser
);
m_group
.
insert
(
theDebuggerAction
(
UseQtDumpers
)
,
m_ui
.
radioButtonUseQtDumpers
);
m_group
.
insert
(
theDebuggerAction
(
UsePrebuiltDumpers
)
,
m_ui
.
radioButtonUsePrebuiltDumpers
);
m_group
.
insert
(
theDebuggerAction
(
BuildDumpersOnTheFly
)
,
m_ui
.
radioButtonBuildDumpersOnTheFly
);
m_group
.
insert
(
theDebuggerAction
(
PrebuiltDumpersLocation
)
,
m_ui
.
dumperLocationChooser
);
theDebuggerAction
(
UseDumpers
)
->
connectWidget
(
m_ui
.
checkBoxUseDumpers
);
theDebuggerAction
(
DebugDumpers
)
->
connectWidget
(
m_ui
.
checkBoxDebugDumpers
);
m_group
.
insert
(
theDebuggerAction
(
UseDumpers
)
,
m_ui
.
checkBoxUseDumpers
);
m_group
.
insert
(
theDebuggerAction
(
DebugDumpers
)
,
m_ui
.
checkBoxDebugDumpers
);
m_ui
.
dumperLocationChooser
->
setEnabled
(
theDebuggerAction
(
UsePrebuiltDumpers
)
->
value
().
toBool
());
...
...
@@ -411,18 +392,6 @@ QWidget *DumperOptionPage::createPage(QWidget *parent)
return
w
;
}
void
DumperOptionPage
::
apply
()
{
QSettings
*
s
=
ICore
::
instance
()
->
settings
();
theDebuggerAction
(
UseDumpers
)
->
apply
(
s
);
theDebuggerAction
(
UseQtDumpers
)
->
apply
(
s
);
theDebuggerAction
(
UsePrebuiltDumpers
)
->
apply
(
s
);
theDebuggerAction
(
BuildDumpersOnTheFly
)
->
apply
(
s
);
theDebuggerAction
(
PrebuiltDumpersLocation
)
->
apply
(
s
);
theDebuggerAction
(
DebugDumpers
)
->
apply
(
s
);
}
}
// namespace Internal
}
// namespace Debugger
...
...
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