mirror of
https://github.com/Palm1r/QodeAssist.git
synced 2025-05-28 03:10:28 -04:00
fix: Crash in open General Settings after another settings tab
This commit is contained in:
parent
9d58565de3
commit
2ad0117498
@ -47,9 +47,9 @@ void ConfigurationManager::updateTemplateDescription(const Utils::StringAspect &
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (&templateAspect == &m_generalSettings.ccTemplate) {
|
if (&templateAspect == &m_generalSettings.ccTemplate) {
|
||||||
m_generalSettings.updateCCTemplateDescription(templ->description());
|
m_generalSettings.ccTemplateDescription.setValue(templ->description());
|
||||||
} else if (&templateAspect == &m_generalSettings.caTemplate) {
|
} else if (&templateAspect == &m_generalSettings.caTemplate) {
|
||||||
m_generalSettings.updateCATemplateDescription(templ->description());
|
m_generalSettings.caTemplateDescription.setValue(templ->description());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -90,6 +90,10 @@ GeneralSettings::GeneralSettings()
|
|||||||
ccStatus.setDefaultValue("");
|
ccStatus.setDefaultValue("");
|
||||||
ccTest.m_buttonText = TrConstants::TEST;
|
ccTest.m_buttonText = TrConstants::TEST;
|
||||||
|
|
||||||
|
ccTemplateDescription.setDisplayStyle(Utils::StringAspect::TextEditDisplay);
|
||||||
|
ccTemplateDescription.setReadOnly(true);
|
||||||
|
ccTemplateDescription.setDefaultValue("");
|
||||||
|
|
||||||
// preset1
|
// preset1
|
||||||
specifyPreset1.setSettingsKey(Constants::CC_SPECIFY_PRESET1);
|
specifyPreset1.setSettingsKey(Constants::CC_SPECIFY_PRESET1);
|
||||||
specifyPreset1.setLabelText(TrConstants::ADD_NEW_PRESET);
|
specifyPreset1.setLabelText(TrConstants::ADD_NEW_PRESET);
|
||||||
@ -145,8 +149,9 @@ GeneralSettings::GeneralSettings()
|
|||||||
caStatus.setDefaultValue("");
|
caStatus.setDefaultValue("");
|
||||||
caTest.m_buttonText = TrConstants::TEST;
|
caTest.m_buttonText = TrConstants::TEST;
|
||||||
|
|
||||||
m_ccTemplateDescription = new QLabel();
|
caTemplateDescription.setDisplayStyle(Utils::StringAspect::TextEditDisplay);
|
||||||
m_caTemplateDescription = new QLabel();
|
caTemplateDescription.setReadOnly(true);
|
||||||
|
caTemplateDescription.setDefaultValue("");
|
||||||
|
|
||||||
readSettings();
|
readSettings();
|
||||||
|
|
||||||
@ -159,16 +164,6 @@ GeneralSettings::GeneralSettings()
|
|||||||
setLayouter([this]() {
|
setLayouter([this]() {
|
||||||
using namespace Layouting;
|
using namespace Layouting;
|
||||||
|
|
||||||
auto ccTemplateInfoCCSection = new Utils::DetailsWidget();
|
|
||||||
ccTemplateInfoCCSection->setState(Utils::DetailsWidget::Collapsed);
|
|
||||||
ccTemplateInfoCCSection->setSummaryText("Template Format Details");
|
|
||||||
ccTemplateInfoCCSection->setWidget(m_ccTemplateDescription);
|
|
||||||
|
|
||||||
auto caTemplateInfoCASection = new Utils::DetailsWidget();
|
|
||||||
caTemplateInfoCASection->setState(Utils::DetailsWidget::Collapsed);
|
|
||||||
caTemplateInfoCASection->setSummaryText("Template Format Details");
|
|
||||||
caTemplateInfoCASection->setWidget(m_caTemplateDescription);
|
|
||||||
|
|
||||||
auto ccGrid = Grid{};
|
auto ccGrid = Grid{};
|
||||||
ccGrid.addRow({ccProvider, ccSelectProvider});
|
ccGrid.addRow({ccProvider, ccSelectProvider});
|
||||||
ccGrid.addRow({ccUrl, ccSetUrl});
|
ccGrid.addRow({ccUrl, ccSetUrl});
|
||||||
@ -191,11 +186,11 @@ GeneralSettings::GeneralSettings()
|
|||||||
title(TrConstants::CODE_COMPLETION),
|
title(TrConstants::CODE_COMPLETION),
|
||||||
Column{
|
Column{
|
||||||
ccGrid,
|
ccGrid,
|
||||||
ccTemplateInfoCCSection,
|
ccTemplateDescription,
|
||||||
Row{specifyPreset1, preset1Language, Stretch{1}},
|
Row{specifyPreset1, preset1Language, Stretch{1}},
|
||||||
ccPreset1Grid}};
|
ccPreset1Grid}};
|
||||||
auto caGroup
|
auto caGroup
|
||||||
= Group{title(TrConstants::CHAT_ASSISTANT), Column{caGrid, caTemplateInfoCASection}};
|
= Group{title(TrConstants::CHAT_ASSISTANT), Column{caGrid, caTemplateDescription}};
|
||||||
|
|
||||||
auto rootLayout = Column{
|
auto rootLayout = Column{
|
||||||
Row{enableQodeAssist, Stretch{1}, Row{checkUpdate, resetToDefaults}},
|
Row{enableQodeAssist, Stretch{1}, Row{checkUpdate, resetToDefaults}},
|
||||||
@ -371,18 +366,6 @@ void GeneralSettings::updatePreset1Visiblity(bool state)
|
|||||||
ccPreset1SelectTemplate.updateVisibility(specifyPreset1.volatileValue());
|
ccPreset1SelectTemplate.updateVisibility(specifyPreset1.volatileValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
void GeneralSettings::updateCCTemplateDescription(const QString &text)
|
|
||||||
{
|
|
||||||
if (text != m_ccTemplateDescription->text())
|
|
||||||
m_ccTemplateDescription->setText(text);
|
|
||||||
}
|
|
||||||
|
|
||||||
void GeneralSettings::updateCATemplateDescription(const QString &text)
|
|
||||||
{
|
|
||||||
if (text != m_caTemplateDescription->text())
|
|
||||||
m_caTemplateDescription->setText(text);
|
|
||||||
}
|
|
||||||
|
|
||||||
void GeneralSettings::setupConnections()
|
void GeneralSettings::setupConnections()
|
||||||
{
|
{
|
||||||
connect(&enableLogging, &Utils::BoolAspect::volatileValueChanged, this, [this]() {
|
connect(&enableLogging, &Utils::BoolAspect::volatileValueChanged, this, [this]() {
|
||||||
|
@ -55,6 +55,8 @@ public:
|
|||||||
Utils::StringAspect ccStatus{this};
|
Utils::StringAspect ccStatus{this};
|
||||||
ButtonAspect ccTest{this};
|
ButtonAspect ccTest{this};
|
||||||
|
|
||||||
|
Utils::StringAspect ccTemplateDescription{this};
|
||||||
|
|
||||||
// TODO create dynamic presets system
|
// TODO create dynamic presets system
|
||||||
// preset1 for code completion settings
|
// preset1 for code completion settings
|
||||||
Utils::BoolAspect specifyPreset1{this};
|
Utils::BoolAspect specifyPreset1{this};
|
||||||
@ -88,6 +90,8 @@ public:
|
|||||||
Utils::StringAspect caStatus{this};
|
Utils::StringAspect caStatus{this};
|
||||||
ButtonAspect caTest{this};
|
ButtonAspect caTest{this};
|
||||||
|
|
||||||
|
Utils::StringAspect caTemplateDescription{this};
|
||||||
|
|
||||||
void showSelectionDialog(const QStringList &data,
|
void showSelectionDialog(const QStringList &data,
|
||||||
Utils::StringAspect &aspect,
|
Utils::StringAspect &aspect,
|
||||||
const QString &title = {},
|
const QString &title = {},
|
||||||
@ -101,15 +105,9 @@ public:
|
|||||||
|
|
||||||
void updatePreset1Visiblity(bool state);
|
void updatePreset1Visiblity(bool state);
|
||||||
|
|
||||||
void updateCCTemplateDescription(const QString &text);
|
|
||||||
void updateCATemplateDescription(const QString &text);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void setupConnections();
|
void setupConnections();
|
||||||
void resetPageToDefaults();
|
void resetPageToDefaults();
|
||||||
|
|
||||||
QLabel *m_ccTemplateDescription = nullptr;
|
|
||||||
QLabel *m_caTemplateDescription = nullptr;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
GeneralSettings &generalSettings();
|
GeneralSettings &generalSettings();
|
||||||
|
Loading…
Reference in New Issue
Block a user