Cleanup: move CSVApps into .cpp file

No point in having this in the header file as it is not used
outside.

Remove the CSVAPPS macro, as this was never used. One thing less
to maintain.

Remove the sentinel with name = NULL, as we can simply use
range-based for.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2018-10-01 15:05:11 +02:00 committed by Dirk Hohndel
parent a4051749fd
commit 3f51849dc3
2 changed files with 20 additions and 24 deletions

View file

@ -15,7 +15,24 @@ static QString subsurface_index = "subsurface/csvindex";
#define SILENCE_WARNING 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "" #define SILENCE_WARNING 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ""
const DiveLogImportDialog::CSVAppConfig DiveLogImportDialog::CSVApps[CSVAPPS] = { struct CSVAppConfig {
QString name;
int time;
int depth;
int temperature;
int po2;
int sensor1;
int sensor2;
int sensor3;
int cns;
int ndl;
int tts;
int stopdepth;
int pressure;
int setpoint;
QString separator;
};
static const CSVAppConfig CSVApps[] = {
// time, depth, temperature, po2, sensor1, sensor2, sensor3, cns, ndl, tts, stopdepth, pressure, setpoint // time, depth, temperature, po2, sensor1, sensor2, sensor3, cns, ndl, tts, stopdepth, pressure, setpoint
// indices are 0 based, -1 means the column doesn't exist // indices are 0 based, -1 means the column doesn't exist
{ "Manual import", SILENCE_WARNING }, { "Manual import", SILENCE_WARNING },
@ -28,7 +45,6 @@ const DiveLogImportDialog::CSVAppConfig DiveLogImportDialog::CSVApps[CSVAPPS] =
{ "SubsurfaceCSV", -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, "Tab" }, { "SubsurfaceCSV", -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, "Tab" },
{ "AV1", 0, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, " " }, { "AV1", 0, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, " " },
{ "Poseidon MkVI", 0, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, "," }, { "Poseidon MkVI", 0, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, "," },
{ NULL, SILENCE_WARNING }
}; };
enum Known { enum Known {
@ -347,8 +363,8 @@ DiveLogImportDialog::DiveLogImportDialog(QStringList fn, QWidget *parent) : QDia
specialCSV << AV1; specialCSV << AV1;
specialCSV << POSEIDON; specialCSV << POSEIDON;
for (int i = 0; !CSVApps[i].name.isNull(); ++i) for (const CSVAppConfig &conf: CSVApps)
ui->knownImports->addItem(CSVApps[i].name); ui->knownImports->addItem(conf.name);
ui->CSVSeparator->addItems( QStringList() << tr("Tab") << "," << ";" << "|"); ui->CSVSeparator->addItems( QStringList() << tr("Tab") << "," << ";" << "|");

View file

@ -103,26 +103,6 @@ private:
QString hw; QString hw;
bool txtLog; bool txtLog;
struct CSVAppConfig {
QString name;
int time;
int depth;
int temperature;
int po2;
int sensor1;
int sensor2;
int sensor3;
int cns;
int ndl;
int tts;
int stopdepth;
int pressure;
int setpoint;
QString separator;
};
#define CSVAPPS 11
static const CSVAppConfig CSVApps[CSVAPPS];
}; };
class TagDragDelegate : public QStyledItemDelegate { class TagDragDelegate : public QStyledItemDelegate {