reformat in uvosstyle
This commit is contained in:
@ -9,57 +9,57 @@
|
||||
#include <qlabel.h>
|
||||
|
||||
KateAiConfigPage::KateAiConfigPage(QWidget *parent, KateAiPlugin *plugin)
|
||||
: KTextEditor::ConfigPage(parent)
|
||||
, m_plugin(plugin)
|
||||
: KTextEditor::ConfigPage(parent)
|
||||
, m_plugin(plugin)
|
||||
{
|
||||
QVBoxLayout* layout = new QVBoxLayout(this);
|
||||
layout->setContentsMargins(0, 0, 0, 0);
|
||||
QVBoxLayout* layout = new QVBoxLayout(this);
|
||||
layout->setContentsMargins(0, 0, 0, 0);
|
||||
|
||||
QHBoxLayout* lineLayout = new QHBoxLayout(this);
|
||||
QLabel* lineEditLabel = new QLabel(i18n("Url for the WebSockets ExLlama Ai server:"), this);
|
||||
lineEditLabel->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed));
|
||||
lineLayout->addWidget(lineEditLabel);
|
||||
lineLayout->addWidget(&lineUrl);
|
||||
layout->addLayout(lineLayout);
|
||||
QHBoxLayout* lineLayout = new QHBoxLayout(this);
|
||||
QLabel* lineEditLabel = new QLabel(i18n("Url for the WebSockets ExLlama Ai server:"), this);
|
||||
lineEditLabel->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed));
|
||||
lineLayout->addWidget(lineEditLabel);
|
||||
lineLayout->addWidget(&lineUrl);
|
||||
layout->addLayout(lineLayout);
|
||||
|
||||
btnCompletion.setText(i18n("Use the Ai to generate a completion"));
|
||||
btnInstruct.setText(i18n("Use the Ai to insert a response to a instruction"));
|
||||
layout->addWidget(&btnCompletion);
|
||||
layout->addWidget(&btnInstruct);
|
||||
layout->addStretch();
|
||||
btnCompletion.setText(i18n("Use the Ai to generate a completion"));
|
||||
btnInstruct.setText(i18n("Use the Ai to insert a response to a instruction"));
|
||||
layout->addWidget(&btnCompletion);
|
||||
layout->addWidget(&btnInstruct);
|
||||
layout->addStretch();
|
||||
|
||||
reset();
|
||||
reset();
|
||||
}
|
||||
|
||||
QString KateAiConfigPage::name() const
|
||||
{
|
||||
return i18n("Ai");
|
||||
return i18n("Ai");
|
||||
}
|
||||
|
||||
QString KateAiConfigPage::fullName() const
|
||||
{
|
||||
return i18n("Ai Settings");
|
||||
return i18n("Ai Settings");
|
||||
}
|
||||
|
||||
QIcon KateAiConfigPage::icon() const
|
||||
{
|
||||
return QIcon::fromTheme(QStringLiteral("text-x-generic"));
|
||||
return QIcon::fromTheme(QStringLiteral("text-x-generic"));
|
||||
}
|
||||
|
||||
void KateAiConfigPage::apply()
|
||||
{
|
||||
KConfigGroup config(KSharedConfig::openConfig(), "Ai");
|
||||
config.writeEntry("Url", lineUrl.text());
|
||||
config.writeEntry("Instruct", btnInstruct.isChecked());
|
||||
KConfigGroup config(KSharedConfig::openConfig(), "Ai");
|
||||
config.writeEntry("Url", lineUrl.text());
|
||||
config.writeEntry("Instruct", btnInstruct.isChecked());
|
||||
|
||||
config.sync();
|
||||
m_plugin->readConfig();
|
||||
config.sync();
|
||||
m_plugin->readConfig();
|
||||
}
|
||||
|
||||
void KateAiConfigPage::reset()
|
||||
{
|
||||
KConfigGroup config(KSharedConfig::openConfig(), "Ai");
|
||||
lineUrl.setText(config.readEntry("Url", "ws://localhost:8642"));
|
||||
btnInstruct.setChecked(config.readEntry("Instruct", false));
|
||||
btnCompletion.setChecked(!btnInstruct.isChecked());
|
||||
KConfigGroup config(KSharedConfig::openConfig(), "Ai");
|
||||
lineUrl.setText(config.readEntry("Url", "ws://localhost:8642"));
|
||||
btnInstruct.setChecked(config.readEntry("Instruct", false));
|
||||
btnCompletion.setChecked(!btnInstruct.isChecked());
|
||||
}
|
||||
|
Reference in New Issue
Block a user