summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--core/dive.c12
-rw-r--r--core/dive.h1
-rw-r--r--core/statistics.c8
-rw-r--r--desktop-widgets/diveplanner.cpp3
-rw-r--r--desktop-widgets/tab-widgets/maintab.cpp5
-rw-r--r--profile-widget/diveeventitem.cpp2
-rw-r--r--profile-widget/profilewidget2.cpp8
7 files changed, 27 insertions, 12 deletions
diff --git a/core/dive.c b/core/dive.c
index 255631ec3..c0a034280 100644
--- a/core/dive.c
+++ b/core/dive.c
@@ -35,7 +35,17 @@ static const char *default_tags[] = {
const char *cylinderuse_text[] = {
QT_TRANSLATE_NOOP("gettextFromC", "OC-gas"), QT_TRANSLATE_NOOP("gettextFromC", "diluent"), QT_TRANSLATE_NOOP("gettextFromC", "oxygen"), QT_TRANSLATE_NOOP("gettextFromC", "not used")
};
-const char *divemode_text[] = { "OC", "CCR", "PSCR", "Freedive" };
+
+// For user visible text
+const char *divemode_text_ui[] = {
+ QT_TRANSLATE_NOOP("gettextFromC", "Open circuit"),
+ QT_TRANSLATE_NOOP("gettextFromC", "CCR"),
+ QT_TRANSLATE_NOOP("gettextFromC", "pSCR"),
+ QT_TRANSLATE_NOOP("gettextFromC", "Freedive")
+};
+
+// For writing/reading files.
+const char *divemode_text[] = {"OC", "CCR", "pSCR", "Freedive"};
/*
* Adding a cylinder pressure sample field is not quite as trivial as it
diff --git a/core/dive.h b/core/dive.h
index 31a568667..5c7b74395 100644
--- a/core/dive.h
+++ b/core/dive.h
@@ -31,6 +31,7 @@ enum divemode_t {OC, CCR, PSCR, FREEDIVE, NUM_DIVEMODE, UNDEF_COMP_TYPE}; // Fla
enum cylinderuse {OC_GAS, DILUENT, OXYGEN, NOT_USED, NUM_GAS_USE}; // The different uses for cylinders
extern const char *cylinderuse_text[];
+extern const char *divemode_text_ui[];
extern const char *divemode_text[];
struct gasmix {
diff --git a/core/statistics.c b/core/statistics.c
index d8ddf914c..ab3d0b628 100644
--- a/core/statistics.c
+++ b/core/statistics.c
@@ -140,13 +140,13 @@ void process_all_dives(struct dive *dive, struct dive **prev_dive)
* field in the statistics window */
stats_by_type[0].location = strdup(translate("gettextFromC", "All (by type stats)"));
stats_by_type[0].is_trip = true;
- stats_by_type[1].location = strdup(translate("gettextFromC","OC"));
+ stats_by_type[1].location = strdup(divemode_text_ui[OC]);
stats_by_type[1].is_trip = true;
- stats_by_type[2].location = strdup(translate("gettextFromC","CCR"));
+ stats_by_type[2].location = strdup(divemode_text_ui[CCR]);
stats_by_type[2].is_trip = true;
- stats_by_type[3].location = strdup(translate("gettextFromC","pSCR"));
+ stats_by_type[3].location = strdup(divemode_text_ui[PSCR]);
stats_by_type[3].is_trip = true;
- stats_by_type[4].location = strdup(translate("gettextFromC","Freedive"));
+ stats_by_type[4].location = strdup(divemode_text_ui[FREEDIVE]);
stats_by_type[4].is_trip = true;
/* this relies on the fact that the dives in the dive_table
diff --git a/desktop-widgets/diveplanner.cpp b/desktop-widgets/diveplanner.cpp
index b22d268d8..bbaf8dc7f 100644
--- a/desktop-widgets/diveplanner.cpp
+++ b/desktop-widgets/diveplanner.cpp
@@ -447,7 +447,8 @@ PlannerSettingsWidget::PlannerSettingsWidget(QWidget *parent, Qt::WindowFlags f)
disableDecoElements((int) prefs.planner_deco_mode);
// should be the same order as in dive_comp_type!
- rebreather_modes << tr("Open circuit") << tr("CCR") << tr("pSCR");
+ for (int i=0; i < FREEDIVE; i++)
+ rebreather_modes.append(QString(divemode_text_ui[i]));
ui.rebreathermode->insertItems(0, rebreather_modes);
modeMapper = new QSignalMapper(this);
diff --git a/desktop-widgets/tab-widgets/maintab.cpp b/desktop-widgets/tab-widgets/maintab.cpp
index 0f50800c9..c9dccc7ea 100644
--- a/desktop-widgets/tab-widgets/maintab.cpp
+++ b/desktop-widgets/tab-widgets/maintab.cpp
@@ -109,7 +109,10 @@ MainTab::MainTab(QWidget *parent) : QTabWidget(parent),
connect(ui.weights, SIGNAL(addButtonClicked()), this, SLOT(addWeight_clicked()));
// This needs to be the same order as enum dive_comp_type in dive.h!
- ui.DiveType->insertItems(0, QStringList() << tr("OC") << tr("CCR") << tr("pSCR") << tr("Freedive"));
+ QStringList types = QStringList();
+ for (int i = 0; i < NUM_DIVEMODE; i++)
+ types.append(QString(divemode_text_ui[i]));
+ ui.DiveType->insertItems(0, types);
connect(ui.DiveType, SIGNAL(currentIndexChanged(int)), this, SLOT(divetype_Changed(int)));
connect(ui.cylinders->view(), SIGNAL(clicked(QModelIndex)), this, SLOT(editCylinderWidget(QModelIndex)));
diff --git a/profile-widget/diveeventitem.cpp b/profile-widget/diveeventitem.cpp
index ebb91b463..c9fe4bf08 100644
--- a/profile-widget/diveeventitem.cpp
+++ b/profile-widget/diveeventitem.cpp
@@ -194,7 +194,7 @@ void DiveEventItem::setupToolTipString(struct gasmix *lastgasmix)
}
*lastgasmix = *mix;
} else if (same_string(internalEvent->name, "modechange")) {
- name += tr(": %1").arg(divemode_text[internalEvent->value]);
+ name += tr(": %1").arg(divemode_text_ui[internalEvent->value]);
} else if (value) {
if (type == SAMPLE_EVENT_PO2 && same_string(internalEvent->name, "SP change")) {
name += QString(": %1bar").arg((double)value / 1000, 0, 'f', 1);
diff --git a/profile-widget/profilewidget2.cpp b/profile-widget/profilewidget2.cpp
index 4909f5dbe..dc26ea520 100644
--- a/profile-widget/profilewidget2.cpp
+++ b/profile-widget/profilewidget2.cpp
@@ -1433,21 +1433,21 @@ void ProfileWidget2::contextMenuEvent(QContextMenuEvent *event)
QMenu *changeMode = m.addMenu(tr("Change divemode"));
if (divemode != OC) {
QAction *action = new QAction(&m);
- action->setText("OC");
+ action->setText(divemode_text_ui[OC]);
connect(action, SIGNAL(triggered(bool)), this, SLOT(addDivemodeSwith()));
action->setData(event->globalPos());
changeMode->addAction(action);
}
if (divemode != CCR) {
QAction *action = new QAction(&m);
- action->setText("CCR");
+ action->setText(divemode_text_ui[CCR]);
connect(action, SIGNAL(triggered(bool)), this, SLOT(addDivemodeSwith()));
action->setData(event->globalPos());
changeMode->addAction(action);
}
if (divemode != PSCR) {
QAction *action = new QAction(&m);
- action->setText("PSCR");
+ action->setText(divemode_text_ui[PSCR]);
connect(action, SIGNAL(triggered(bool)), this, SLOT(addDivemodeSwith()));
action->setData(event->globalPos());
changeMode->addAction(action);
@@ -1619,7 +1619,7 @@ void ProfileWidget2::addDivemodeSwith()
QAction *action = qobject_cast<QAction *>(sender());
QPointF scenePos = mapToScene(mapFromGlobal(action->data().toPoint()));
for (i = 0; i < UNDEF_COMP_TYPE; i++)
- if (QString(divemode_text[i]) == action->text())
+ if (QString(divemode_text_ui[i]) == action->text())
add_event(current_dc, lrint(timeAxis->valueAt(scenePos)), 8, 0, i, "modechange");
invalidate_dive_cache(current_dive);
mark_divelist_changed(true);