mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-04 16:56:53 +08:00
Ref T411, confirmation before values are overridden
This commit is contained in:
@@ -14,6 +14,7 @@
|
||||
#include "blackmisc/logmessage.h"
|
||||
#include "blackconfig/buildconfig.h"
|
||||
|
||||
#include <QMessageBox>
|
||||
#include <QRegularExpression>
|
||||
|
||||
using namespace BlackMisc;
|
||||
@@ -64,6 +65,13 @@ namespace BlackGui
|
||||
ui->comp_SimulatorSelector->setVisible(show);
|
||||
}
|
||||
|
||||
bool CSettingsSimulatorBasicsComponent::hasAnyValues() const
|
||||
{
|
||||
return !ui->le_SimulatorDirectory->text().isEmpty() ||
|
||||
!ui->pte_ModelDirectories->toPlainText().isEmpty() ||
|
||||
!ui->pte_ExcludeDirectories->toPlainText().isEmpty();
|
||||
}
|
||||
|
||||
void CSettingsSimulatorBasicsComponent::setSimulator(const CSimulatorInfo &simulator)
|
||||
{
|
||||
Q_ASSERT_X(simulator.isSingleSimulator(), Q_FUNC_INFO, "Need single simulator");
|
||||
@@ -137,6 +145,13 @@ namespace BlackGui
|
||||
void CSettingsSimulatorBasicsComponent::copyDefaults()
|
||||
{
|
||||
const CSimulatorInfo simulator(ui->comp_SimulatorSelector->getValue());
|
||||
const bool anyValues = this->hasAnyValues();
|
||||
if (anyValues)
|
||||
{
|
||||
QMessageBox::StandardButton reply = QMessageBox::question(this, "Override", "Override existing values?", QMessageBox::Yes | QMessageBox::No);
|
||||
if (reply != QMessageBox::Yes) { return; }
|
||||
}
|
||||
|
||||
const QString sd(m_settings.defaultSimulatorDirectory(simulator));
|
||||
ui->le_SimulatorDirectory->setText(CFileUtils::normalizeFilePathToQtStandard(sd));
|
||||
const QStringList md(m_settings.defaultModelDirectories(simulator));
|
||||
|
||||
Reference in New Issue
Block a user