From 882986dfdf7da5861d0037f7bc54d75c0356ac40 Mon Sep 17 00:00:00 2001 From: Anton Lundin Date: Thu, 16 Oct 2014 01:13:54 +0200 Subject: [PATCH] Save columnwith of Ostc3 settings tables Signed-off-by: Anton Lundin Signed-off-by: Dirk Hohndel --- qt-ui/configuredivecomputerdialog.cpp | 41 +++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/qt-ui/configuredivecomputerdialog.cpp b/qt-ui/configuredivecomputerdialog.cpp index 346d0b1ca..f4c5a6123 100644 --- a/qt-ui/configuredivecomputerdialog.cpp +++ b/qt-ui/configuredivecomputerdialog.cpp @@ -8,6 +8,7 @@ #include "configuredivecomputer.h" #include #include +#include struct product { const char *product; dc_descriptor_t *descriptor; @@ -50,10 +51,50 @@ ConfigureDiveComputerDialog::ConfigureDiveComputerDialog(QWidget *parent) : ui.DiveComputerList->setCurrentRow(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() { + 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(); }