-
-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathtoolsettingswidget.h
More file actions
55 lines (45 loc) · 1.41 KB
/
toolsettingswidget.h
File metadata and controls
55 lines (45 loc) · 1.41 KB
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
#pragma once
#include <utils/aspects.h>
#include <utils/layoutbuilder.h>
#include <utils/treemodel.h>
#include <QCheckBox>
#include <QTextEdit>
#include <QTreeView>
#include <QWidget>
#include <coreplugin/dialogs/ioptionspage.h>
namespace LlamaCpp {
class ToolsSettingsWidget : public Core::IOptionsPageWidget
{
Q_OBJECT
public:
explicit ToolsSettingsWidget();
void apply();
void cancel();
private:
void fillModel();
void updateEnabledToolsFromModel();
void updateModelFromEnabledTools();
void showToolDefinition(const QModelIndex ¤t, const QModelIndex & /*previous*/);
// UI
QTreeView *m_view = nullptr;
Utils::TreeModel<> *m_model = nullptr;
QTextEdit *m_detailEdit = nullptr;
// Helper item that holds a tool name and a check‑state
class ToolItem : public Utils::TreeItem
{
public:
explicit ToolItem(const QString &toolName,
const QString &description,
const QString &tooltip);
QVariant data(int column, int role) const override;
Qt::ItemFlags flags(int column) const override;
bool setData(int column, const QVariant &value, int role) override;
QString name() const { return m_name; }
private:
QString m_name;
QString m_description;
QString m_tooltip;
Qt::CheckState m_checkState = Qt::Unchecked;
};
};
} // namespace LlamaCpp