OSDN Git Service

Update license.
[qt-creator-jp/qt-creator-jp.git] / src / plugins / debugger / gdb / gdboptionspage.cpp
1 /**************************************************************************
2 **
3 ** This file is part of Qt Creator
4 **
5 ** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
6 **
7 ** Contact: Nokia Corporation (info@qt.nokia.com)
8 **
9 **
10 ** GNU Lesser General Public License Usage
11 **
12 ** This file may be used under the terms of the GNU Lesser General Public
13 ** License version 2.1 as published by the Free Software Foundation and
14 ** appearing in the file LICENSE.LGPL included in the packaging of this file.
15 ** Please review the following information to ensure the GNU Lesser General
16 ** Public License version 2.1 requirements will be met:
17 ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
18 **
19 ** In addition, as a special exception, Nokia gives you certain additional
20 ** rights. These rights are described in the Nokia Qt LGPL Exception
21 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
22 **
23 ** Other Usage
24 **
25 ** Alternatively, this file may be used in accordance with the terms and
26 ** conditions contained in a signed written agreement between you and Nokia.
27 **
28 ** If you have questions regarding the use of this file, please contact
29 ** Nokia at qt-info@nokia.com.
30 **
31 **************************************************************************/
32
33 #include "gdboptionspage.h"
34 #include "debuggeractions.h"
35 #include "debuggercore.h"
36
37 #include <coreplugin/icore.h>
38 #include <projectexplorer/projectexplorer.h>
39
40 #include <QtCore/QCoreApplication>
41 #include <QtCore/QDebug>
42 #include <QtCore/QTextStream>
43
44
45 namespace Debugger {
46 namespace Internal {
47
48 GdbOptionsPage::GdbOptionsPage()
49     : m_ui(0)
50 { }
51
52 QString GdbOptionsPage::settingsId()
53 {
54     return QLatin1String("M.Gdb");
55 }
56
57 QString GdbOptionsPage::displayName() const
58 {
59     return tr("GDB");
60 }
61
62 QString GdbOptionsPage::category() const
63 {
64     return QLatin1String(Constants::DEBUGGER_SETTINGS_CATEGORY);
65 }
66
67 QString GdbOptionsPage::displayCategory() const
68 {
69     return QCoreApplication::translate("Debugger", Constants::DEBUGGER_SETTINGS_TR_CATEGORY);
70 }
71
72 QIcon GdbOptionsPage::categoryIcon() const
73 {
74     return QIcon(QLatin1String(Constants::DEBUGGER_COMMON_SETTINGS_CATEGORY_ICON));
75 }
76
77 QWidget *GdbOptionsPage::createPage(QWidget *parent)
78 {
79     QWidget *w = new QWidget(parent);
80     m_ui = new Ui::GdbOptionsPage;
81     m_ui->setupUi(w);
82
83     m_ui->scriptFileChooser->setExpectedKind(Utils::PathChooser::File);
84     m_ui->scriptFileChooser->setPromptDialogTitle(
85         tr("Choose Location of Startup Script File"));
86
87     m_group.clear();
88     m_group.insert(debuggerCore()->action(GdbScriptFile),
89         m_ui->scriptFileChooser);
90     m_group.insert(debuggerCore()->action(LoadGdbInit),
91         m_ui->checkBoxLoadGdbInit);
92     m_group.insert(debuggerCore()->action(TargetAsync),
93         m_ui->checkBoxTargetAsync);
94     m_group.insert(debuggerCore()->action(AdjustBreakpointLocations),
95         m_ui->checkBoxAdjustBreakpointLocations);
96     m_group.insert(debuggerCore()->action(GdbWatchdogTimeout),
97         m_ui->spinBoxGdbWatchdogTimeout);
98
99     m_group.insert(debuggerCore()->action(UseMessageBoxForSignals),
100         m_ui->checkBoxUseMessageBoxForSignals);
101     m_group.insert(debuggerCore()->action(SkipKnownFrames),
102         m_ui->checkBoxSkipKnownFrames);
103     m_group.insert(debuggerCore()->action(EnableReverseDebugging),
104         m_ui->checkBoxEnableReverseDebugging);
105     m_group.insert(debuggerCore()->action(GdbWatchdogTimeout), 0);
106
107     m_ui->groupBoxPluginDebugging->hide();
108
109     m_ui->lineEditSelectedPluginBreakpointsPattern->
110         setEnabled(debuggerCore()->action(SelectedPluginBreakpoints)->value().toBool());
111     connect(m_ui->radioButtonSelectedPluginBreakpoints, SIGNAL(toggled(bool)),
112         m_ui->lineEditSelectedPluginBreakpointsPattern, SLOT(setEnabled(bool)));
113
114     if (m_searchKeywords.isEmpty()) {
115         QLatin1Char sep(' ');
116         QTextStream(&m_searchKeywords)
117                 << sep << m_ui->groupBoxLocations->title()
118                 << sep << m_ui->checkBoxLoadGdbInit->text()
119                 << sep << m_ui->checkBoxTargetAsync->text()
120                 << sep << m_ui->labelGdbStartupScript->text()
121                 << sep << m_ui->labelGdbWatchdogTimeout->text()
122                 << sep << m_ui->checkBoxEnableReverseDebugging->text()
123                 << sep << m_ui->checkBoxSkipKnownFrames->text()
124                 << sep << m_ui->checkBoxUseMessageBoxForSignals->text()
125                 << sep << m_ui->checkBoxAdjustBreakpointLocations->text()
126                 << sep << m_ui->groupBoxPluginDebugging->title()
127                 << sep << m_ui->radioButtonAllPluginBreakpoints->text()
128                 << sep << m_ui->radioButtonSelectedPluginBreakpoints->text()
129                 << sep << m_ui->labelSelectedPluginBreakpoints->text()
130                 << sep << m_ui->radioButtonNoPluginBreakpoints->text()
131                    ;
132         m_searchKeywords.remove(QLatin1Char('&'));
133     }
134     return w;
135 }
136
137 void GdbOptionsPage::apply()
138 {
139     m_group.apply(Core::ICore::instance()->settings());
140 }
141
142 void GdbOptionsPage::finish()
143 {
144     m_group.finish();
145 }
146
147 bool GdbOptionsPage::matches(const QString &s) const
148 {
149     return m_searchKeywords.contains(s, Qt::CaseInsensitive);
150 }
151
152 } // namespace Internal
153 } // namespace Debugger