~bzoltan/kubuntu-packaging/decouple_cmake_plugin

« back to all changes in this revision

Viewing changes to src/plugins/debugger/debuggerkitconfigwidget.h

  • Committer: Timo Jyrinki
  • Date: 2013-11-15 12:25:23 UTC
  • mfrom: (1.1.28)
  • Revision ID: timo.jyrinki@canonical.com-20131115122523-i2kyamsu4gs2mu1m
New upstream release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
30
30
#ifndef DEBUGGER_DEBUGGERKITCONFIGWIDGET_H
31
31
#define DEBUGGER_DEBUGGERKITCONFIGWIDGET_H
32
32
 
 
33
#include "debuggerkitinformation.h"
 
34
 
 
35
#include <coreplugin/dialogs/ioptionspage.h>
33
36
#include <projectexplorer/kitconfigwidget.h>
34
 
 
35
 
#include "debuggerkitinformation.h"
 
37
#include <projectexplorer/abi.h>
 
38
#include <utils/detailswidget.h>
 
39
#include <utils/fileutils.h>
 
40
#include <utils/pathchooser.h>
36
41
 
37
42
#include <QDialog>
 
43
#include <QStandardItemModel>
 
44
#include <QTreeView>
38
45
 
39
46
QT_BEGIN_NAMESPACE
 
47
class QComboBox;
40
48
class QLabel;
41
 
class QComboBox;
42
49
class QPushButton;
43
50
QT_END_NAMESPACE
44
51
 
45
 
namespace ProjectExplorer { class Kit; }
46
 
namespace Utils {
47
 
class PathChooser;
48
 
class FileName;
49
 
}
50
 
 
51
52
namespace Debugger {
52
 
 
53
53
namespace Internal {
54
 
// -----------------------------------------------------------------------
55
 
// DebuggerKitConfigWidget:
 
54
 
 
55
class DebuggerItemConfigWidget;
 
56
class DebuggerKitConfigWidget;
 
57
 
 
58
// -----------------------------------------------------------------------
 
59
// DebuggerItemModel
 
60
//------------------------------------------------------------------------
 
61
class DebuggerItemModel : public QStandardItemModel
 
62
{
 
63
    Q_OBJECT
 
64
 
 
65
public:
 
66
    DebuggerItemModel(QObject *parent);
 
67
 
 
68
    QModelIndex currentIndex() const;
 
69
    QModelIndex lastIndex() const;
 
70
    void setCurrentIndex(const QModelIndex &index);
 
71
    QVariant currentDebugger() const { return m_currentDebugger; }
 
72
    void addDebugger(const DebuggerItem &item);
 
73
    void removeDebugger(const QVariant &id);
 
74
    void updateDebugger(const QVariant &id);
 
75
 
 
76
public slots:
 
77
    void markCurrentDirty();
 
78
 
 
79
signals:
 
80
    void debuggerAdded(const QVariant &id, const QString &display);
 
81
    void debuggerUpdated(const QVariant &id, const QString &display);
 
82
    void debuggerRemoved(const QVariant &id);
 
83
 
 
84
private:
 
85
    friend class Debugger::DebuggerKitInformation;
 
86
    friend class DebuggerKitConfigWidget;
 
87
    friend class DebuggerItemConfigWidget;
 
88
    friend class DebuggerOptionsPage;
 
89
 
 
90
    QStandardItem *currentStandardItem() const;
 
91
    QStandardItem *findStandardItemById(const QVariant &id) const;
 
92
    QVariant headerData(int section, Qt::Orientation orientation, int role) const;
 
93
 
 
94
    QVariant m_currentDebugger;
 
95
 
 
96
    QStandardItem *m_autoRoot;
 
97
    QStandardItem *m_manualRoot;
 
98
    QStringList removed;
 
99
};
 
100
 
 
101
// -----------------------------------------------------------------------
 
102
// DebuggerKitConfigWidget
56
103
// -----------------------------------------------------------------------
57
104
 
58
105
class DebuggerKitConfigWidget : public ProjectExplorer::KitConfigWidget
60
107
    Q_OBJECT
61
108
 
62
109
public:
63
 
    DebuggerKitConfigWidget(ProjectExplorer::Kit *workingCopy, bool sticky);
 
110
    DebuggerKitConfigWidget(ProjectExplorer::Kit *workingCopy,
 
111
                            const ProjectExplorer::KitInformation *ki);
 
112
    ~DebuggerKitConfigWidget();
64
113
 
65
114
    QString displayName() const;
66
115
    QString toolTip() const;
67
 
 
68
116
    void makeReadOnly();
69
 
 
70
117
    void refresh();
71
 
 
72
118
    QWidget *buttonWidget() const;
73
119
    QWidget *mainWidget() const;
74
120
 
75
121
private slots:
76
 
    void autoDetectDebugger();
77
 
    void showDialog();
78
 
 
79
 
private:
80
 
    QWidget *m_main;
81
 
    QLabel *m_label;
82
 
    QPushButton *m_autoDetectButton;
83
 
    QPushButton *m_editButton;
84
 
};
85
 
 
86
 
class DebuggerKitConfigDialog : public QDialog
87
 
{
88
 
    Q_OBJECT
89
 
public:
90
 
    explicit DebuggerKitConfigDialog(QWidget *parent =  0);
91
 
 
92
 
    void setDebuggerItem(const DebuggerKitInformation::DebuggerItem &item);
93
 
    DebuggerKitInformation::DebuggerItem item() const
94
 
        { return DebuggerKitInformation::DebuggerItem(engineType(), fileName()); }
95
 
 
96
 
private slots:
97
 
    void refreshLabel();
98
 
 
99
 
private:
100
 
    DebuggerEngineType engineType() const;
101
 
    void setEngineType(DebuggerEngineType et);
102
 
 
103
 
    Utils::FileName fileName() const;
104
 
    void setFileName(const Utils::FileName &fn);
105
 
 
 
122
    void manageDebuggers();
 
123
    void currentDebuggerChanged(int idx);
 
124
    void onDebuggerAdded(const QVariant &id, const QString &displayName);
 
125
    void onDebuggerUpdated(const QVariant &id, const QString &displayName);
 
126
    void onDebuggerRemoved(const QVariant &id);
 
127
 
 
128
private:
 
129
    int indexOf(const QVariant &id);
 
130
    QVariant currentId() const;
 
131
    void updateComboBox(const QVariant &id);
 
132
 
 
133
    bool m_isReadOnly;
106
134
    QComboBox *m_comboBox;
107
 
    QLabel *m_label;
108
 
    Utils::PathChooser *m_chooser;
 
135
    QPushButton *m_manageButton;
 
136
};
 
137
 
 
138
// --------------------------------------------------------------------------
 
139
// DebuggerOptionsPage
 
140
// --------------------------------------------------------------------------
 
141
 
 
142
class DebuggerOptionsPage : public Core::IOptionsPage
 
143
{
 
144
    Q_OBJECT
 
145
 
 
146
public:
 
147
    DebuggerOptionsPage();
 
148
 
 
149
    QWidget *createPage(QWidget *parent);
 
150
    void apply();
 
151
    void finish();
 
152
    bool matches(const QString &) const;
 
153
 
 
154
private slots:
 
155
    void debuggerSelectionChanged();
 
156
    void debuggerModelChanged();
 
157
    void updateState();
 
158
    void cloneDebugger();
 
159
    void addDebugger();
 
160
    void removeDebugger();
 
161
 
 
162
private:
 
163
    QWidget *m_configWidget;
 
164
    QString m_searchKeywords;
 
165
 
 
166
    DebuggerItemModel *m_model;
 
167
    DebuggerItemConfigWidget *m_itemConfigWidget;
 
168
    QTreeView *m_debuggerView;
 
169
    Utils::DetailsWidget *m_container;
 
170
    QPushButton *m_addButton;
 
171
    QPushButton *m_cloneButton;
 
172
    QPushButton *m_delButton;
109
173
};
110
174
 
111
175
} // namespace Internal