-
-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathllamaprojectpanel.cpp
More file actions
73 lines (57 loc) · 1.88 KB
/
llamaprojectpanel.cpp
File metadata and controls
73 lines (57 loc) · 1.88 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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#include "llamaprojectpanel.h"
#include "llamaconstants.h"
#include "llamasettings.h"
#include "llamatr.h"
#include <projectexplorer/project.h>
#include <projectexplorer/projectpanelfactory.h>
#include <projectexplorer/projectsettingswidget.h>
#include <utils/layoutbuilder.h>
using namespace ProjectExplorer;
namespace LlamaCpp {
class LlamaCppProjectSettingsWidget final : public ProjectSettingsWidget
{
public:
LlamaCppProjectSettingsWidget()
{
setGlobalSettingsId(Constants::LLAMACPP_GENERAL_OPTIONS_ID);
setUseGlobalSettingsCheckBoxVisible(true);
}
};
static ProjectSettingsWidget *createLlamaCppProjectPanel(Project *project)
{
using namespace Layouting;
auto widget = new LlamaCppProjectSettingsWidget;
auto settings = new LlamaProjectSettings(project);
settings->setParent(widget);
QObject::connect(widget,
&ProjectSettingsWidget::useGlobalSettingsChanged,
settings,
&LlamaProjectSettings::setUseGlobalSettings);
widget->setUseGlobalSettings(settings->useGlobalSettings());
widget->setEnabled(!settings->useGlobalSettings());
QObject::connect(widget,
&ProjectSettingsWidget::useGlobalSettingsChanged,
widget,
[widget](bool useGlobal) { widget->setEnabled(!useGlobal); });
// clang-format off
Column {
settings->enableLlamaCpp,
}.attachTo(widget);
// clang-format on
return widget;
}
class LlamaCppProjectPanelFactory final : public ProjectPanelFactory
{
public:
LlamaCppProjectPanelFactory()
{
setPriority(1000);
setDisplayName(Tr::tr("llama.cpp"));
setCreateWidgetFunction(&createLlamaCppProjectPanel);
}
};
void setupLlamaCppProjectPanel()
{
static LlamaCppProjectPanelFactory theLlamaCppProjectPanelFactory;
}
} // namespace LlamaCpp