mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-05-01 22:55:41 +08:00
Ref T152, the fix for the issue reported: everything was prepared, but the setting not changed in the UI. Now excluded models can be added to model set.
This commit is contained in:
committed by
Mathew Sutcliffe
parent
8b8bc9b994
commit
2f577b7209
@@ -15,6 +15,7 @@
|
|||||||
#include <QValidator>
|
#include <QValidator>
|
||||||
|
|
||||||
using namespace BlackMisc;
|
using namespace BlackMisc;
|
||||||
|
using namespace BlackMisc::Simulation::Settings;
|
||||||
using namespace BlackGui::Settings;
|
using namespace BlackGui::Settings;
|
||||||
|
|
||||||
namespace BlackGui
|
namespace BlackGui
|
||||||
@@ -29,12 +30,14 @@ namespace BlackGui
|
|||||||
ui->le_ConsolidateSecs->setValidator(new QIntValidator(0, TBackgroundConsolidation::maxSecs(), ui->le_ConsolidateSecs));
|
ui->le_ConsolidateSecs->setValidator(new QIntValidator(0, TBackgroundConsolidation::maxSecs(), ui->le_ConsolidateSecs));
|
||||||
|
|
||||||
this->cacheChanged();
|
this->cacheChanged();
|
||||||
connect(ui->le_ConsolidateSecs, &QLineEdit::returnPressed, this, &CSettingsModelComponent::consolidationEntered);
|
|
||||||
const QString lbl("Consolidate (%1-%2s):");
|
const QString lbl("Consolidate (%1-%2s):");
|
||||||
ui->lbl_Consolidate->setText(lbl.arg(TBackgroundConsolidation::minSecs()).arg(TBackgroundConsolidation::maxSecs()));
|
ui->lbl_Consolidate->setText(lbl.arg(TBackgroundConsolidation::minSecs()).arg(TBackgroundConsolidation::maxSecs()));
|
||||||
|
|
||||||
|
connect(ui->le_ConsolidateSecs, &QLineEdit::returnPressed, this, &CSettingsModelComponent::consolidationEntered);
|
||||||
|
connect(ui->cb_AllowExcludeModels, &QCheckBox::toggled, this, &CSettingsModelComponent::allowExcludedModelsChanged);
|
||||||
|
|
||||||
// start updater if not yet done
|
// start updater if not yet done
|
||||||
QTimer::singleShot(2000, this, &CSettingsModelComponent::consolidationEntered);
|
QTimer::singleShot(2500, this, &CSettingsModelComponent::consolidationEntered);
|
||||||
}
|
}
|
||||||
|
|
||||||
CSettingsModelComponent::~CSettingsModelComponent()
|
CSettingsModelComponent::~CSettingsModelComponent()
|
||||||
@@ -64,6 +67,15 @@ namespace BlackGui
|
|||||||
this->cacheChanged();
|
this->cacheChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CSettingsModelComponent::allowExcludedModelsChanged(bool allow)
|
||||||
|
{
|
||||||
|
CModelSettings ms = m_modelSettings.get();
|
||||||
|
if (ms.getAllowExcludedModels() == allow) { return; }
|
||||||
|
ms.setAllowExcludedModels(allow);
|
||||||
|
const CStatusMessage msg = m_modelSettings.setAndSave(ms);
|
||||||
|
CLogMessage::preformatted(msg);
|
||||||
|
}
|
||||||
|
|
||||||
void CSettingsModelComponent::cacheChanged()
|
void CSettingsModelComponent::cacheChanged()
|
||||||
{
|
{
|
||||||
const int v = m_consolidationSetting.get();
|
const int v = m_consolidationSetting.get();
|
||||||
@@ -76,6 +88,13 @@ namespace BlackGui
|
|||||||
sApp && !sApp->isShuttingDown() &&
|
sApp && !sApp->isShuttingDown() &&
|
||||||
this->m_updater && this->m_updater->isEnabled();
|
this->m_updater && this->m_updater->isEnabled();
|
||||||
ui->comp_Led->setOn(updater);
|
ui->comp_Led->setOn(updater);
|
||||||
|
|
||||||
|
// avoid unnecessary roundtrips
|
||||||
|
const CModelSettings ms = m_modelSettings.get();
|
||||||
|
if (ui->cb_AllowExcludeModels->isChecked() != ms.getAllowExcludedModels())
|
||||||
|
{
|
||||||
|
ui->cb_AllowExcludeModels->setChecked(ms.getAllowExcludedModels());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} // ns
|
} // ns
|
||||||
} // ns
|
} // ns
|
||||||
|
|||||||
@@ -13,6 +13,7 @@
|
|||||||
#define BLACKGUI_COMPONENTS_SETTINGSMODELCOMPONENT_H
|
#define BLACKGUI_COMPONENTS_SETTINGSMODELCOMPONENT_H
|
||||||
|
|
||||||
#include "blackgui/settings/guisettings.h"
|
#include "blackgui/settings/guisettings.h"
|
||||||
|
#include "blackmisc/simulation/settings/modelsettings.h"
|
||||||
#include <QFrame>
|
#include <QFrame>
|
||||||
|
|
||||||
namespace Ui { class CSettingsModelComponent; }
|
namespace Ui { class CSettingsModelComponent; }
|
||||||
@@ -43,12 +44,16 @@ namespace BlackGui
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
QScopedPointer<Ui::CSettingsModelComponent> ui;
|
QScopedPointer<Ui::CSettingsModelComponent> ui;
|
||||||
BlackMisc::CSetting<BlackGui::Settings::TBackgroundConsolidation> m_consolidationSetting { this, &CSettingsModelComponent::cacheChanged }; //!< consolidation time
|
BlackMisc::CSetting<Settings::TBackgroundConsolidation> m_consolidationSetting { this, &CSettingsModelComponent::cacheChanged }; //!< consolidation time
|
||||||
|
BlackMisc::CSetting<BlackMisc::Simulation::Settings::TModel> m_modelSettings { this, &CSettingsModelComponent::cacheChanged }; //!< model setting
|
||||||
const BlackCore::Db::CBackgroundDataUpdater *m_updater = nullptr; //!< externally (i.e. other component) provided existing updater
|
const BlackCore::Db::CBackgroundDataUpdater *m_updater = nullptr; //!< externally (i.e. other component) provided existing updater
|
||||||
|
|
||||||
//! Consolidation time entered
|
//! Consolidation time entered
|
||||||
void consolidationEntered();
|
void consolidationEntered();
|
||||||
|
|
||||||
|
//! Allow excluded models changed
|
||||||
|
void allowExcludedModelsChanged(bool allow);
|
||||||
|
|
||||||
//! Cache has been changed
|
//! Cache has been changed
|
||||||
void cacheChanged();
|
void cacheChanged();
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -2,6 +2,14 @@
|
|||||||
<ui version="4.0">
|
<ui version="4.0">
|
||||||
<class>CSettingsModelComponent</class>
|
<class>CSettingsModelComponent</class>
|
||||||
<widget class="QFrame" name="CSettingsModelComponent">
|
<widget class="QFrame" name="CSettingsModelComponent">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>390</width>
|
||||||
|
<height>28</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>Models settings</string>
|
<string>Models settings</string>
|
||||||
</property>
|
</property>
|
||||||
@@ -24,7 +32,7 @@
|
|||||||
<string>Hint: This can cause wrong behaviour or violate 3rd parties copyright. You need to know what you are doing enabling the feature.</string>
|
<string>Hint: This can cause wrong behaviour or violate 3rd parties copyright. You need to know what you are doing enabling the feature.</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>allow "exclude" models in set</string>
|
<string>allow "excluded" models in set</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
|||||||
Reference in New Issue
Block a user