Save columnwith of Ostc3 settings tables

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Anton Lundin 2014-10-16 01:13:54 +02:00 committed by Dirk Hohndel
parent 5a394aaff6
commit 882986dfdf

View file

@ -8,6 +8,7 @@
#include "configuredivecomputer.h" #include "configuredivecomputer.h"
#include <QFileDialog> #include <QFileDialog>
#include <QMessageBox> #include <QMessageBox>
#include <QSettings>
struct product { struct product {
const char *product; const char *product;
dc_descriptor_t *descriptor; dc_descriptor_t *descriptor;
@ -50,10 +51,50 @@ ConfigureDiveComputerDialog::ConfigureDiveComputerDialog(QWidget *parent) :
ui.DiveComputerList->setCurrentRow(0); ui.DiveComputerList->setCurrentRow(0);
on_DiveComputerList_currentRowChanged(0); on_DiveComputerList_currentRowChanged(0);
QSettings settings;
settings.beginGroup("ConfigureDiveComputerDialog");
settings.beginGroup("ostc3GasTable");
for (int i = 0; i < ui.ostc3GasTable->columnCount(); i++) {
QVariant width = settings.value(QString("colwidth%1").arg(i));
if (width.isValid())
ui.ostc3GasTable->setColumnWidth(i, width.toInt());
}
settings.endGroup();
settings.beginGroup("ostc3DilTable");
for (int i = 0; i < ui.ostc3DilTable->columnCount(); i++) {
QVariant width = settings.value(QString("colwidth%1").arg(i));
if (width.isValid())
ui.ostc3DilTable->setColumnWidth(i, width.toInt());
}
settings.endGroup();
settings.beginGroup("ostc3SetPointTable");
for (int i = 0; i < ui.ostc3SetPointTable->columnCount(); i++) {
QVariant width = settings.value(QString("colwidth%1").arg(i));
if (width.isValid())
ui.ostc3SetPointTable->setColumnWidth(i, width.toInt());
}
settings.endGroup();
settings.endGroup();
} }
ConfigureDiveComputerDialog::~ConfigureDiveComputerDialog() ConfigureDiveComputerDialog::~ConfigureDiveComputerDialog()
{ {
QSettings settings;
settings.beginGroup("ConfigureDiveComputerDialog");
settings.beginGroup("ostc3GasTable");
for (int i = 0; i < ui.ostc3GasTable->columnCount(); i++)
settings.setValue(QString("colwidth%1").arg(i), ui.ostc3GasTable->columnWidth(i));
settings.endGroup();
settings.beginGroup("ostc3DilTable");
for (int i = 0; i < ui.ostc3DilTable->columnCount(); i++)
settings.setValue(QString("colwidth%1").arg(i), ui.ostc3DilTable->columnWidth(i));
settings.endGroup();
settings.beginGroup("ostc3SetPointTable");
for (int i = 0; i < ui.ostc3SetPointTable->columnCount(); i++)
settings.setValue(QString("colwidth%1").arg(i), ui.ostc3SetPointTable->columnWidth(i));
settings.endGroup();
settings.endGroup();
} }