OSDN Git Service

Update license.
[qt-creator-jp/qt-creator-jp.git] / src / plugins / debugger / lldb / lldboptionspage.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 "lldboptionspage.h"
34 #include "debuggerconstants.h"
35
36 #include <coreplugin/icore.h>
37
38 #include <QtCore/QCoreApplication>
39 #include <QtCore/QUrl>
40 #include <QtCore/QTextStream>
41 #include <QtGui/QMessageBox>
42 #include <QtGui/QDesktopServices>
43
44 namespace Debugger {
45 namespace Internal {
46
47 LldbOptionsPageWidget::LldbOptionsPageWidget(QWidget *parent, QSettings *s_)
48     : QWidget(parent)
49     , s(s_)
50 {
51     m_ui.setupUi(this);
52     load();
53 }
54
55 void LldbOptionsPageWidget::save()
56 {
57     s->beginGroup(QLatin1String("LLDB"));
58     s->setValue(QLatin1String("enabled"), m_ui.enableLldb->isChecked ());
59     s->setValue(QLatin1String("gdbEmu"), m_ui.gdbEmu->isChecked ());
60     s->endGroup();
61 }
62
63 void LldbOptionsPageWidget::load()
64 {
65     s->beginGroup(QLatin1String("LLDB"));
66     m_ui.enableLldb->setChecked(s->value(QLatin1String("enabled"), false).toBool());
67     m_ui.gdbEmu->setChecked(s->value(QLatin1String("gdbEmu"), true).toBool());
68     s->endGroup();
69 }
70
71 // ---------- LldbOptionsPage
72 LldbOptionsPage::LldbOptionsPage()
73 {
74 //    m_options->fromSettings(Core::ICore::instance()->settings());
75 }
76
77 LldbOptionsPage::~LldbOptionsPage()
78 {
79 }
80
81 QString LldbOptionsPage::settingsId()
82 {
83     return QLatin1String("F.Lldb");
84 }
85
86 QString LldbOptionsPage::displayName() const
87 {
88     return tr("LLDB");
89 }
90
91 QString LldbOptionsPage::category() const
92 {
93     return QLatin1String(Debugger::Constants::DEBUGGER_SETTINGS_CATEGORY);
94 }
95
96 QString LldbOptionsPage::displayCategory() const
97 {
98     return QCoreApplication::translate("Debugger", Debugger::Constants::DEBUGGER_SETTINGS_TR_CATEGORY);
99 }
100
101 QIcon LldbOptionsPage::categoryIcon() const
102 {
103     return QIcon(QLatin1String(Debugger::Constants::DEBUGGER_COMMON_SETTINGS_CATEGORY_ICON));
104 }
105
106 QWidget *LldbOptionsPage::createPage(QWidget *parent)
107 {
108     m_widget = new LldbOptionsPageWidget(parent, Core::ICore::instance()->settings());
109     return m_widget;
110 }
111
112 void LldbOptionsPage::apply()
113 {
114     if (!m_widget)
115         return;
116     m_widget->save();
117 }
118
119 void LldbOptionsPage::finish()
120 {
121 }
122
123 bool LldbOptionsPage::matches(const QString &s) const
124 {
125     return QString(s.toLower()).contains("lldb");
126 }
127
128 void addLldbOptionPages(QList<Core::IOptionsPage *> *opts)
129 {
130     opts->push_back(new LldbOptionsPage);
131 }
132
133
134 } // namespace Internal
135 } // namespace Debugger