1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2024-11-29 07:24:13 +01:00

Fixed export double confirmation dialogues.

git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@2724 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
pip 2011-02-04 18:06:01 +00:00 committed by pip
parent 901b6f3882
commit d377b417df
2 changed files with 14 additions and 8 deletions

View File

@ -462,7 +462,7 @@
<set>Qt::AlignCenter</set> <set>Qt::AlignCenter</set>
</property> </property>
<property name="textVisible"> <property name="textVisible">
<bool>false</bool> <bool>true</bool>
</property> </property>
<property name="textDirection"> <property name="textDirection">
<enum>QProgressBar::TopToBottom</enum> <enum>QProgressBar::TopToBottom</enum>

View File

@ -1243,9 +1243,7 @@ void PipXtremeGadgetWidget::importSettings()
options options
).trimmed(); ).trimmed();
if (filename.isEmpty()) if (filename.isEmpty())
{
return; return;
}
if (!QFileInfo(filename).isReadable()) if (!QFileInfo(filename).isReadable())
{ {
@ -1257,6 +1255,12 @@ void PipXtremeGadgetWidget::importSettings()
QSettings settings(filename, QSettings::IniFormat); QSettings settings(filename, QSettings::IniFormat);
uint32_t serial_number = settings.value("details/serial_number", 0).toUInt();
if (serial_number && serial_number != pipx_config_details.serial_number)
{
// return;
}
pipx_config_settings.destination_id = settings.value("settings/paired_serial_number", 0).toUInt(); pipx_config_settings.destination_id = settings.value("settings/paired_serial_number", 0).toUInt();
pipx_config_settings.rf_xtal_cap = settings.value("settings/frequency_calibration", 0x7f).toUInt(); pipx_config_settings.rf_xtal_cap = settings.value("settings/frequency_calibration", 0x7f).toUInt();
pipx_config_settings.frequency_Hz = settings.value("settings/frequency", (pipx_config_details.min_frequency_Hz + pipx_config_details.max_frequency_Hz) / 2).toUInt(); pipx_config_settings.frequency_Hz = settings.value("settings/frequency", (pipx_config_details.min_frequency_Hz + pipx_config_details.max_frequency_Hz) / 2).toUInt();
@ -1291,10 +1295,8 @@ void PipXtremeGadgetWidget::exportSettings()
tr("PipX settings (*.ini)") tr("PipX settings (*.ini)")
).trimmed(); ).trimmed();
if (filename.isEmpty()) if (filename.isEmpty())
{
return; return;
} /*
if (QFileInfo(filename).exists()) if (QFileInfo(filename).exists())
{ {
QMessageBox msgBox; QMessageBox msgBox;
@ -1307,16 +1309,20 @@ void PipXtremeGadgetWidget::exportSettings()
else else
return; return;
} }
QDir dir = QFileInfo(filename).absoluteDir(); */ QDir dir = QFileInfo(filename).absoluteDir();
if (!dir.exists()) if (!dir.exists())
{ {
QMessageBox msgBox; QMessageBox msgBox;
msgBox.setText(tr("Can't write file ") + QFileInfo(filename).absoluteFilePath() + " since directory "+ dir.absolutePath() + " doesn't exist!"); msgBox.setText(tr("Can't write file ") + QFileInfo(filename).absoluteFilePath() + " since directory " + dir.absolutePath() + " doesn't exist!");
msgBox.exec(); msgBox.exec();
return; return;
} }
QSettings settings(filename, QSettings::IniFormat); QSettings settings(filename, QSettings::IniFormat);
settings.setValue("details/serial_number", pipx_config_details.serial_number);
settings.setValue("details/min_frequency", pipx_config_details.min_frequency_Hz);
settings.setValue("details/max_frequency", pipx_config_details.max_frequency_Hz);
settings.setValue("details/frequency_band", pipx_config_details.frequency_band);
settings.setValue("settings/paired_serial_number", pipx_config_settings.destination_id); settings.setValue("settings/paired_serial_number", pipx_config_settings.destination_id);
settings.setValue("settings/frequency_calibration", pipx_config_settings.rf_xtal_cap); settings.setValue("settings/frequency_calibration", pipx_config_settings.rf_xtal_cap);
settings.setValue("settings/frequency", pipx_config_settings.frequency_Hz); settings.setValue("settings/frequency", pipx_config_settings.frequency_Hz);