Change Dive Computer Configuration dialog

Changes the layout of the ConfigureDiveComputer dialog to use a
list of supported computers on the left, with a stacked widget
showing the configurable details.

Signed-off-by: Joseph W. Joshua <joejoshw@gmail.com>
Signed-off-by: Thiago Macieira <thiago@macieira.org>
This commit is contained in:
Joseph W. Joshua 2014-07-16 12:04:54 +03:00 committed by Thiago Macieira
parent 91ccd89048
commit a9b55d7f0d
5 changed files with 749 additions and 719 deletions

BIN
icons/ostc3.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

View file

@ -50,7 +50,8 @@ ConfigureDiveComputerDialog::ConfigureDiveComputerDialog(QWidget *parent) :
if (default_dive_computer_device)
ui->device->setEditText(default_dive_computer_device);
on_tabWidget_currentChanged(0);
ui->DiveComputerList->setCurrentRow(0);
on_DiveComputerList_currentRowChanged(0);
}
ConfigureDiveComputerDialog::~ConfigureDiveComputerDialog()
@ -435,23 +436,6 @@ void ConfigureDiveComputerDialog::on_restoreBackupButton_clicked()
}
}
void ConfigureDiveComputerDialog::on_tabWidget_currentChanged(int index)
{
switch (index) {
case 0:
selected_vendor = "Heinrichs Weikamp";
selected_product = "OSTC 3";
break;
}
int dcType = DC_TYPE_SERIAL;
if (selected_vendor == QString("Uemis"))
dcType = DC_TYPE_UEMIS;
fill_device_list(dcType);
}
void ConfigureDiveComputerDialog::on_updateFirmwareButton_clicked()
{
QString filename = existing_filename ?: prefs.default_filename;
@ -466,3 +450,20 @@ void ConfigureDiveComputerDialog::on_updateFirmwareButton_clicked()
config->startFirmwareUpdate(firmwarePath, &device_data, errText);
}
}
void ConfigureDiveComputerDialog::on_DiveComputerList_currentRowChanged(int currentRow)
{
switch (currentRow) {
case 0:
selected_vendor = "Heinrichs Weikamp";
selected_product = "OSTC 3";
break;
}
int dcType = DC_TYPE_SERIAL;
if (selected_vendor == QString("Uemis"))
dcType = DC_TYPE_UEMIS;
fill_device_list(dcType);
}

View file

@ -31,10 +31,11 @@ private slots:
void on_restoreBackupButton_clicked();
void on_tabWidget_currentChanged(int index);
void on_updateFirmwareButton_clicked();
void on_DiveComputerList_currentRowChanged(int currentRow);
private:
Ui::ConfigureDiveComputerDialog *ui;

View file

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>785</width>
<height>670</height>
<width>844</width>
<height>616</height>
</rect>
</property>
<property name="windowTitle">
@ -99,109 +99,75 @@
</layout>
</item>
<item>
<widget class="QTabWidget" name="tabWidget">
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="tab">
<attribute name="title">
<string>HW OSTC 3</string>
</attribute>
<layout class="QGridLayout" name="gridLayout">
<item row="6" column="3">
<widget class="QComboBox" name="unitsComboBox">
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<property name="text">
<string>m/°C</string>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="cancel">
<property name="text">
<string>ft/°F</string>
<string>Cancel</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QSplitter" name="splitter">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<widget class="QListWidget" name="DiveComputerList">
<property name="maximumSize">
<size>
<width>200</width>
<height>16777215</height>
</size>
</property>
<property name="font">
<font>
<pointsize>12</pointsize>
</font>
</property>
<property name="iconSize">
<size>
<width>64</width>
<height>64</height>
</size>
</property>
<item>
<property name="text">
<string>OSTC 3</string>
</property>
<property name="icon">
<iconset resource="../subsurface.qrc">
<normaloff>:/icons/ostc3.png</normaloff>:/icons/ostc3.png</iconset>
</property>
</item>
</widget>
</item>
<item row="7" column="2">
<widget class="QLabel" name="label_13">
<widget class="QStackedWidget" name="dcStackedWidget">
<widget class="QWidget" name="page_2">
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<widget class="QLabel" name="label_7">
<property name="text">
<string>Salinity (0-5%):</string>
<string>Serial No.</string>
</property>
<property name="buddy">
<cstring>salinitySpinBox</cstring>
<cstring>serialNoLineEdit</cstring>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_5">
<property name="text">
<string>Custom Text:</string>
</property>
<property name="buddy">
<cstring>customTextLlineEdit</cstring>
</property>
</widget>
</item>
<item row="4" column="3">
<widget class="QSpinBox" name="desaturationSpinBox">
<property name="suffix">
<string>%</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QSpinBox" name="saturationSpinBox">
<property name="suffix">
<string>%</string>
</property>
</widget>
</item>
<item row="7" column="3">
<widget class="QSpinBox" name="salinitySpinBox">
<property name="suffix">
<string>%</string>
</property>
<property name="maximum">
<number>5</number>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QSpinBox" name="lastDecoSpinBox">
<property name="suffix">
<string> m</string>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="label_10">
<property name="text">
<string>Last Deco:</string>
</property>
<property name="buddy">
<cstring>lastDecoSpinBox</cstring>
</property>
</widget>
</item>
<item row="5" column="3">
<widget class="QComboBox" name="brightnessComboBox">
<item>
<property name="text">
<string>Eco</string>
</property>
</item>
<item>
<property name="text">
<string>Medium</string>
</property>
</item>
<item>
<property name="text">
<string>High</string>
</property>
</item>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="serialNoLineEdit">
<property name="readOnly">
@ -209,7 +175,54 @@
</property>
</widget>
</item>
<item row="2" column="3">
<item row="0" column="2">
<widget class="QLabel" name="label_8">
<property name="text">
<string>Firmware Version:</string>
</property>
<property name="buddy">
<cstring>firmwareVersionLineEdit</cstring>
</property>
</widget>
</item>
<item row="0" column="3">
<widget class="QLineEdit" name="firmwareVersionLineEdit">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_5">
<property name="text">
<string>Custom Text:</string>
</property>
<property name="buddy">
<cstring>customTextLlineEdit</cstring>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="customTextLlineEdit">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>1</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QLabel" name="label_6">
<property name="text">
<string>Language:</string>
</property>
<property name="buddy">
<cstring>languageComboBox</cstring>
</property>
</widget>
</item>
<item row="1" column="3">
<widget class="QComboBox" name="languageComboBox">
<item>
<property name="text">
@ -233,27 +246,269 @@
</item>
</widget>
</item>
<item row="2" column="2">
<widget class="QLabel" name="label_6">
<item row="2" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Language:</string>
<string>Dive Mode:</string>
</property>
<property name="buddy">
<cstring>languageComboBox</cstring>
<cstring>diveModeComboBox</cstring>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLineEdit" name="customTextLlineEdit">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>1</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
<widget class="QComboBox" name="diveModeComboBox">
<item>
<property name="text">
<string>OC</string>
</property>
</item>
<item>
<property name="text">
<string>CC</string>
</property>
</item>
<item>
<property name="text">
<string>Gauge</string>
</property>
</item>
<item>
<property name="text">
<string>Apnea</string>
</property>
</item>
</widget>
</item>
<item row="2" column="2">
<widget class="QLabel" name="label_9">
<property name="text">
<string>Date Format:</string>
</property>
<property name="buddy">
<cstring>dateFormatComboBox</cstring>
</property>
</widget>
</item>
<item row="8" column="3">
<item row="2" column="3">
<widget class="QComboBox" name="dateFormatComboBox">
<item>
<property name="text">
<string>MMDDYY</string>
</property>
</item>
<item>
<property name="text">
<string>DDMMYY</string>
</property>
</item>
<item>
<property name="text">
<string>YYMMDD</string>
</property>
</item>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Saturation:</string>
</property>
<property name="buddy">
<cstring>saturationSpinBox</cstring>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QSpinBox" name="saturationSpinBox">
<property name="suffix">
<string>%</string>
</property>
</widget>
</item>
<item row="3" column="2">
<widget class="QLabel" name="label_16">
<property name="text">
<string>Desaturation:</string>
</property>
<property name="buddy">
<cstring>desaturationSpinBox</cstring>
</property>
</widget>
</item>
<item row="3" column="3">
<widget class="QSpinBox" name="desaturationSpinBox">
<property name="suffix">
<string>%</string>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label_10">
<property name="text">
<string>Last Deco:</string>
</property>
<property name="buddy">
<cstring>lastDecoSpinBox</cstring>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QSpinBox" name="lastDecoSpinBox">
<property name="suffix">
<string> m</string>
</property>
</widget>
</item>
<item row="4" column="2">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Brightness:</string>
</property>
<property name="buddy">
<cstring>brightnessComboBox</cstring>
</property>
</widget>
</item>
<item row="4" column="3">
<widget class="QComboBox" name="brightnessComboBox">
<item>
<property name="text">
<string>Eco</string>
</property>
</item>
<item>
<property name="text">
<string>Medium</string>
</property>
</item>
<item>
<property name="text">
<string>High</string>
</property>
</item>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="label_12">
<property name="text">
<string>Sampling Rate:</string>
</property>
<property name="buddy">
<cstring>samplingRateComboBox</cstring>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QComboBox" name="samplingRateComboBox">
<item>
<property name="text">
<string>2s</string>
</property>
</item>
<item>
<property name="text">
<string>10s</string>
</property>
</item>
</widget>
</item>
<item row="5" column="2">
<widget class="QLabel" name="label_11">
<property name="text">
<string>Units:</string>
</property>
<property name="buddy">
<cstring>unitsComboBox</cstring>
</property>
</widget>
</item>
<item row="5" column="3">
<widget class="QComboBox" name="unitsComboBox">
<item>
<property name="text">
<string>m/°C</string>
</property>
</item>
<item>
<property name="text">
<string>ft/°F</string>
</property>
</item>
</widget>
</item>
<item row="6" column="0">
<widget class="QLabel" name="label_14">
<property name="text">
<string>Dive Mode Colour:</string>
</property>
<property name="buddy">
<cstring>diveModeColour</cstring>
</property>
</widget>
</item>
<item row="6" column="1">
<widget class="QComboBox" name="diveModeColour">
<item>
<property name="text">
<string>Standard</string>
</property>
</item>
<item>
<property name="text">
<string>Red</string>
</property>
</item>
<item>
<property name="text">
<string>Green</string>
</property>
</item>
<item>
<property name="text">
<string>Blue</string>
</property>
</item>
</widget>
</item>
<item row="6" column="2">
<widget class="QLabel" name="label_13">
<property name="text">
<string>Salinity (0-5%):</string>
</property>
<property name="buddy">
<cstring>salinitySpinBox</cstring>
</property>
</widget>
</item>
<item row="6" column="3">
<widget class="QSpinBox" name="salinitySpinBox">
<property name="suffix">
<string>%</string>
</property>
<property name="maximum">
<number>5</number>
</property>
</widget>
</item>
<item row="7" column="0" colspan="2">
<widget class="QCheckBox" name="dateTimeSyncCheckBox">
<property name="text">
<string>Sync dive computer time with PC</string>
</property>
</widget>
</item>
<item row="7" column="2">
<widget class="QLabel" name="label_15">
<property name="text">
<string>Compass Gain:</string>
</property>
<property name="buddy">
<cstring>compassGainComboBox</cstring>
</property>
</widget>
</item>
<item row="7" column="3">
<widget class="QComboBox" name="compassGainComboBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
@ -303,186 +558,7 @@
</item>
</widget>
</item>
<item row="8" column="2">
<widget class="QLabel" name="label_15">
<property name="text">
<string>Compass Gain:</string>
</property>
<property name="buddy">
<cstring>compassGainComboBox</cstring>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Dive Mode:</string>
</property>
<property name="buddy">
<cstring>diveModeComboBox</cstring>
</property>
</widget>
</item>
<item row="9" column="2" colspan="2">
<widget class="QTableWidget" name="ostc3DilTable">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>2</verstretch>
</sizepolicy>
</property>
<row>
<property name="text">
<string/>
</property>
</row>
<row>
<property name="text">
<string/>
</property>
</row>
<row>
<property name="text">
<string/>
</property>
</row>
<row>
<property name="text">
<string/>
</property>
</row>
<row>
<property name="text">
<string/>
</property>
</row>
<column>
<property name="text">
<string/>
</property>
</column>
<column>
<property name="text">
<string>%He</string>
</property>
</column>
<column>
<property name="text">
<string>%O2</string>
</property>
</column>
<column>
<property name="text">
<string>Type</string>
</property>
</column>
<column>
<property name="text">
<string>Change Depth</string>
</property>
</column>
<item row="0" column="0">
<property name="text">
<string>Dil 1</string>
</property>
</item>
<item row="1" column="0">
<property name="text">
<string>Dil 2</string>
</property>
</item>
<item row="2" column="0">
<property name="text">
<string>Dil 3</string>
</property>
</item>
<item row="3" column="0">
<property name="text">
<string>Dil 4</string>
</property>
</item>
<item row="4" column="0">
<property name="text">
<string>Dil 5</string>
</property>
</item>
</widget>
</item>
<item row="6" column="2">
<widget class="QLabel" name="label_11">
<property name="text">
<string>Units:</string>
</property>
<property name="buddy">
<cstring>unitsComboBox</cstring>
</property>
</widget>
</item>
<item row="4" column="2">
<widget class="QLabel" name="label_16">
<property name="text">
<string>Desaturation:</string>
</property>
<property name="buddy">
<cstring>desaturationSpinBox</cstring>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QComboBox" name="diveModeComboBox">
<item>
<property name="text">
<string>OC</string>
</property>
</item>
<item>
<property name="text">
<string>CC</string>
</property>
</item>
<item>
<property name="text">
<string>Gauge</string>
</property>
</item>
<item>
<property name="text">
<string>Apnea</string>
</property>
</item>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_7">
<property name="text">
<string>Serial No.</string>
</property>
<property name="buddy">
<cstring>serialNoLineEdit</cstring>
</property>
</widget>
</item>
<item row="5" column="2">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Brightness:</string>
</property>
<property name="buddy">
<cstring>brightnessComboBox</cstring>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Saturation:</string>
</property>
<property name="buddy">
<cstring>saturationSpinBox</cstring>
</property>
</widget>
</item>
<item row="9" column="0" colspan="2">
<item row="8" column="0" colspan="2">
<widget class="QTableWidget" name="ostc3GasTable">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
@ -567,118 +643,92 @@
</item>
</widget>
</item>
<item row="3" column="3">
<widget class="QComboBox" name="dateFormatComboBox">
<item>
<item row="8" column="2" colspan="2">
<widget class="QTableWidget" name="ostc3DilTable">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>2</verstretch>
</sizepolicy>
</property>
<row>
<property name="text">
<string>MMDDYY</string>
<string/>
</property>
</row>
<row>
<property name="text">
<string/>
</property>
</row>
<row>
<property name="text">
<string/>
</property>
</row>
<row>
<property name="text">
<string/>
</property>
</row>
<row>
<property name="text">
<string/>
</property>
</row>
<column>
<property name="text">
<string/>
</property>
</column>
<column>
<property name="text">
<string>%He</string>
</property>
</column>
<column>
<property name="text">
<string>%O2</string>
</property>
</column>
<column>
<property name="text">
<string>Type</string>
</property>
</column>
<column>
<property name="text">
<string>Change Depth</string>
</property>
</column>
<item row="0" column="0">
<property name="text">
<string>Dil 1</string>
</property>
</item>
<item>
<item row="1" column="0">
<property name="text">
<string>DDMMYY</string>
<string>Dil 2</string>
</property>
</item>
<item>
<item row="2" column="0">
<property name="text">
<string>YYMMDD</string>
<string>Dil 3</string>
</property>
</item>
<item row="3" column="0">
<property name="text">
<string>Dil 4</string>
</property>
</item>
<item row="4" column="0">
<property name="text">
<string>Dil 5</string>
</property>
</item>
</widget>
</item>
<item row="0" column="3">
<widget class="QLineEdit" name="firmwareVersionLineEdit">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QLabel" name="label_8">
<property name="text">
<string>Firmware Version:</string>
</property>
<property name="buddy">
<cstring>firmwareVersionLineEdit</cstring>
</property>
</widget>
</item>
<item row="3" column="2">
<widget class="QLabel" name="label_9">
<property name="text">
<string>Date Format:</string>
</property>
<property name="buddy">
<cstring>dateFormatComboBox</cstring>
</property>
</widget>
</item>
<item row="7" column="1">
<widget class="QComboBox" name="diveModeColour">
<item>
<property name="text">
<string>Standard</string>
</property>
</item>
<item>
<property name="text">
<string>Red</string>
</property>
</item>
<item>
<property name="text">
<string>Green</string>
</property>
</item>
<item>
<property name="text">
<string>Blue</string>
</property>
</item>
</widget>
</item>
<item row="6" column="0">
<widget class="QLabel" name="label_12">
<property name="text">
<string>Sampling Rate:</string>
</property>
<property name="buddy">
<cstring>samplingRateComboBox</cstring>
</property>
</widget>
</item>
<item row="8" column="0" colspan="2">
<widget class="QCheckBox" name="dateTimeSyncCheckBox">
<property name="text">
<string>Sync dive computer time with PC</string>
</property>
</widget>
</item>
<item row="6" column="1">
<widget class="QComboBox" name="samplingRateComboBox">
<item>
<property name="text">
<string>2s</string>
</property>
</item>
<item>
<property name="text">
<string>10s</string>
</property>
</item>
</widget>
</item>
<item row="7" column="0">
<widget class="QLabel" name="label_14">
<property name="text">
<string>Dive Mode Colour:</string>
</property>
<property name="buddy">
<cstring>diveModeColour</cstring>
</property>
</widget>
</item>
<item row="10" column="0" colspan="2">
<item row="9" column="0" colspan="2">
<widget class="QTableWidget" name="ostc3SetPointTable">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
@ -756,6 +806,7 @@
</layout>
</widget>
</widget>
</widget>
</item>
<item>
<widget class="QLabel" name="errorLabel">
@ -774,30 +825,6 @@
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="cancel">
<property name="text">
<string>Cancel</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<tabstops>
@ -807,27 +834,27 @@
<tabstop>saveSettingsPushButton</tabstop>
<tabstop>backupButton</tabstop>
<tabstop>restoreBackupButton</tabstop>
<tabstop>tabWidget</tabstop>
<tabstop>serialNoLineEdit</tabstop>
<tabstop>firmwareVersionLineEdit</tabstop>
<tabstop>customTextLlineEdit</tabstop>
<tabstop>languageComboBox</tabstop>
<tabstop>diveModeComboBox</tabstop>
<tabstop>dateFormatComboBox</tabstop>
<tabstop>saturationSpinBox</tabstop>
<tabstop>desaturationSpinBox</tabstop>
<tabstop>lastDecoSpinBox</tabstop>
<tabstop>brightnessComboBox</tabstop>
<tabstop>samplingRateComboBox</tabstop>
<tabstop>unitsComboBox</tabstop>
<tabstop>diveModeColour</tabstop>
<tabstop>salinitySpinBox</tabstop>
<tabstop>dateTimeSyncCheckBox</tabstop>
<tabstop>compassGainComboBox</tabstop>
<tabstop>ostc3GasTable</tabstop>
<tabstop>ostc3DilTable</tabstop>
<tabstop>cancel</tabstop>
</tabstops>
<resources/>
<connections/>
<resources>
<include location="../subsurface.qrc"/>
</resources>
<connections>
<connection>
<sender>DiveComputerList</sender>
<signal>currentRowChanged(int)</signal>
<receiver>dcStackedWidget</receiver>
<slot>setCurrentIndex(int)</slot>
<hints>
<hint type="sourcelabel">
<x>258</x>
<y>130</y>
</hint>
<hint type="destinationlabel">
<x>292</x>
<y>118</y>
</hint>
</hints>
</connection>
</connections>
</ui>

View file

@ -64,5 +64,6 @@
<file>icons/subsurface/32x32/actions/go-down.png</file>
<file>icons/subsurface/32x32/actions/go-up.png</file>
<file>icons/subsurface/32x32/actions/window-close.png</file>
<file>icons/ostc3.png</file>
</qresource>
</RCC>