aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/debugger/gdb/gdboptionspage.cpp
blob: 6683a6bad6557cf26fc921e2fcaed0ba4ee4cccb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
#include "gdboptionspage.h"
#include "debuggeractions.h"
#include "debuggerconstants.h"

#include <coreplugin/icore.h>
#include <QtCore/QCoreApplication>
#include <QtCore/QTextStream>

const char * const GDB_SETTINGS_ID = QT_TRANSLATE_NOOP("Debugger::Internal::GdbOptionsPage", "Gdb");

namespace Debugger {
namespace Internal {

GdbOptionsPage::GdbOptionsPage()
{
}

QString GdbOptionsPage::settingsId()
{
    return QLatin1String(GDB_SETTINGS_ID);
}

QString GdbOptionsPage::trName() const
{
    return tr(GDB_SETTINGS_ID);
}

QString GdbOptionsPage::category() const
{
    return QLatin1String(Debugger::Constants::DEBUGGER_SETTINGS_CATEGORY);
}

QString GdbOptionsPage::trCategory() const
{
    return QCoreApplication::translate("Debugger", Debugger::Constants::DEBUGGER_SETTINGS_CATEGORY);
}

QWidget *GdbOptionsPage::createPage(QWidget *parent)
{
    QWidget *w = new QWidget(parent);
    m_ui.setupUi(w);
    m_ui.gdbLocationChooser->setExpectedKind(Utils::PathChooser::Command);
    m_ui.gdbLocationChooser->setPromptDialogTitle(tr("Choose Gdb Location"));
    m_ui.scriptFileChooser->setExpectedKind(Utils::PathChooser::File);
    m_ui.scriptFileChooser->setPromptDialogTitle(tr("Choose Location of Startup Script File"));

    m_group.clear();
    m_group.insert(theDebuggerAction(GdbLocation),
        m_ui.gdbLocationChooser);
    m_group.insert(theDebuggerAction(GdbScriptFile),
        m_ui.scriptFileChooser);
    m_group.insert(theDebuggerAction(GdbEnvironment),
        m_ui.environmentEdit);

#if 1
    m_ui.groupBoxPluginDebugging->hide();
#else // The related code (handleAqcuiredInferior()) is disabled as well.
    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);
#endif

    m_ui.lineEditSelectedPluginBreakpointsPattern->
        setEnabled(theDebuggerAction(SelectedPluginBreakpoints)->value().toBool());
    connect(m_ui.radioButtonSelectedPluginBreakpoints, SIGNAL(toggled(bool)),
        m_ui.lineEditSelectedPluginBreakpointsPattern, SLOT(setEnabled(bool)));

    // FIXME
    m_ui.environmentEdit->hide();
    m_ui.labelEnvironment->hide();

    if (m_searchKeywords.isEmpty()) {
        // TODO: Add breakpoints, environment?
        QTextStream(&m_searchKeywords) << ' ' << m_ui.labelGdbLocation->text()
                << ' ' << m_ui.labelEnvironment->text()
                << ' ' << m_ui.labelGdbStartupScript->text();
        m_searchKeywords.remove(QLatin1Char('&'));
    }
    return w;
}
void GdbOptionsPage::apply()
{
    m_group.apply(Core::ICore::instance()->settings());
}

void GdbOptionsPage::finish()
{
    m_group.finish();
}

bool GdbOptionsPage::matches(const QString &s) const
{
    return m_searchKeywords.contains(s, Qt::CaseInsensitive);
}

} // namespace Internal
} // namespace Debugger