2023-01-20 07:09:01 +01:00
|
|
|
// Copyright (C) 2023 The Qt Company Ltd.
|
|
|
|
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
|
|
|
|
|
|
|
|
|
|
#include "copilotoptionspage.h"
|
|
|
|
|
|
2023-02-22 14:35:18 +01:00
|
|
|
#include "authwidget.h"
|
|
|
|
|
#include "copilotsettings.h"
|
2023-01-20 07:09:01 +01:00
|
|
|
#include "copilotsettings.h"
|
|
|
|
|
|
|
|
|
|
#include <coreplugin/icore.h>
|
|
|
|
|
|
2023-02-22 14:35:18 +01:00
|
|
|
#include <utils/layoutbuilder.h>
|
|
|
|
|
#include <utils/pathchooser.h>
|
|
|
|
|
|
|
|
|
|
using namespace Utils;
|
|
|
|
|
using namespace LanguageClient;
|
|
|
|
|
|
2023-01-20 07:09:01 +01:00
|
|
|
namespace Copilot {
|
|
|
|
|
|
2023-02-22 14:35:18 +01:00
|
|
|
class CopilotOptionsPageWidget : public QWidget
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
CopilotOptionsPageWidget(QWidget *parent = nullptr)
|
|
|
|
|
: QWidget(parent)
|
|
|
|
|
{
|
|
|
|
|
using namespace Layouting;
|
|
|
|
|
|
|
|
|
|
auto authWidget = new AuthWidget();
|
|
|
|
|
|
|
|
|
|
// clang-format off
|
|
|
|
|
Column {
|
|
|
|
|
authWidget, br,
|
|
|
|
|
CopilotSettings::instance().nodeJsPath, br,
|
|
|
|
|
CopilotSettings::instance().distPath, br,
|
|
|
|
|
st
|
|
|
|
|
}.attachTo(this);
|
|
|
|
|
// clang-format on
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
2023-01-20 07:09:01 +01:00
|
|
|
CopilotOptionsPage::CopilotOptionsPage()
|
|
|
|
|
{
|
|
|
|
|
setId("Copilot.General");
|
|
|
|
|
setDisplayName("Copilot");
|
|
|
|
|
setCategory("ZY.Copilot");
|
|
|
|
|
setDisplayCategory("Copilot");
|
2023-02-27 18:22:57 +01:00
|
|
|
setCategoryIconPath(":/copilot/images/settingscategory_copilot.png");
|
2023-01-20 07:09:01 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
CopilotOptionsPage::~CopilotOptionsPage() {}
|
|
|
|
|
|
|
|
|
|
void CopilotOptionsPage::init() {}
|
|
|
|
|
|
|
|
|
|
QWidget *CopilotOptionsPage::widget()
|
|
|
|
|
{
|
|
|
|
|
return new CopilotOptionsPageWidget();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CopilotOptionsPage::apply()
|
|
|
|
|
{
|
|
|
|
|
CopilotSettings::instance().apply();
|
|
|
|
|
CopilotSettings::instance().writeSettings(Core::ICore::settings());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CopilotOptionsPage::finish() {}
|
|
|
|
|
|
|
|
|
|
CopilotOptionsPage &CopilotOptionsPage::instance()
|
|
|
|
|
{
|
|
|
|
|
static CopilotOptionsPage settingsPage;
|
|
|
|
|
return settingsPage;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} // namespace Copilot
|