mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Don't translate the fake DC models
Since the model name is written into the XML file it has to be a literal string that isn't translated. Otherwise a datafile written in one locale behaves differently when opened by Subsurface under a different locale. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
f11b2274ec
commit
f2035bcd79
3 changed files with 5 additions and 6 deletions
|
@ -214,7 +214,7 @@ struct dive *create_dive_from_plan(struct diveplan *diveplan, const char **error
|
||||||
dive->when = diveplan->when;
|
dive->when = diveplan->when;
|
||||||
dive->dc.surface_pressure.mbar = diveplan->surface_pressure;
|
dive->dc.surface_pressure.mbar = diveplan->surface_pressure;
|
||||||
dc = &dive->dc;
|
dc = &dive->dc;
|
||||||
dc->model = strdup(translate("gettextFromC","Simulated Dive"));
|
dc->model = "planned dive"; /* do not translate here ! */
|
||||||
dp = diveplan->dp;
|
dp = diveplan->dp;
|
||||||
|
|
||||||
/* let's start with the gas given on the first segment */
|
/* let's start with the gas given on the first segment */
|
||||||
|
|
|
@ -280,8 +280,7 @@ void MainWindow::on_actionAddDive_triggered()
|
||||||
// now cheat - create one dive that we use to store the info tab data in
|
// now cheat - create one dive that we use to store the info tab data in
|
||||||
struct dive *dive = alloc_dive();
|
struct dive *dive = alloc_dive();
|
||||||
dive->when = QDateTime::currentMSecsSinceEpoch() / 1000L + gettimezoneoffset();
|
dive->when = QDateTime::currentMSecsSinceEpoch() / 1000L + gettimezoneoffset();
|
||||||
const char* model = strdup(tr("manually added dive").toLocal8Bit().constData());
|
dive->dc.model = "manually added dive"; // don't translate! this is stored in the XML file
|
||||||
dive->dc.model = model; // do not use tr here since it expects a char*.
|
|
||||||
record_dive(dive);
|
record_dive(dive);
|
||||||
select_dive(get_divenr(dive));
|
select_dive(get_divenr(dive));
|
||||||
ui.InfoWidget->updateDiveInfo(selected_dive);
|
ui.InfoWidget->updateDiveInfo(selected_dive);
|
||||||
|
@ -826,7 +825,7 @@ void MainWindow::editCurrentDive()
|
||||||
struct dive *d = current_dive;
|
struct dive *d = current_dive;
|
||||||
QString defaultDC(d->dc.model);
|
QString defaultDC(d->dc.model);
|
||||||
|
|
||||||
if (defaultDC == tr("manually added dive")){
|
if (defaultDC == "manually added dive"){
|
||||||
disableDcShortcuts();
|
disableDcShortcuts();
|
||||||
DivePlannerPointsModel::instance()->setPlanMode(false);
|
DivePlannerPointsModel::instance()->setPlanMode(false);
|
||||||
ui.stackedWidget->setCurrentIndex(PLANNERPROFILE); // Planner.
|
ui.stackedWidget->setCurrentIndex(PLANNERPROFILE); // Planner.
|
||||||
|
@ -834,7 +833,7 @@ void MainWindow::editCurrentDive()
|
||||||
DivePlannerPointsModel::instance()->loadFromDive(d);
|
DivePlannerPointsModel::instance()->loadFromDive(d);
|
||||||
ui.InfoWidget->enableEdition(MainTab::MANUALLY_ADDED_DIVE);
|
ui.InfoWidget->enableEdition(MainTab::MANUALLY_ADDED_DIVE);
|
||||||
}
|
}
|
||||||
else if (defaultDC == tr("Simulated Dive")){
|
else if (defaultDC == "planned dive"){
|
||||||
// this looks like something is missing here
|
// this looks like something is missing here
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -394,7 +394,7 @@ void ProfileGraphicsView::addControlItems(struct dive *d)
|
||||||
//Put it into the lower right corner of the profile
|
//Put it into the lower right corner of the profile
|
||||||
|
|
||||||
QString defaultDC(d->dc.model);
|
QString defaultDC(d->dc.model);
|
||||||
if (defaultDC == tr("manually added dive") || defaultDC == tr("Simulated Dive")) {
|
if (defaultDC == "manually added dive" || defaultDC == "planned dive") {
|
||||||
QAction *editAction = new QAction(QIcon(":edit"), tr("Edit"), this);
|
QAction *editAction = new QAction(QIcon(":edit"), tr("Edit"), this);
|
||||||
toolBar->addAction(editAction);
|
toolBar->addAction(editAction);
|
||||||
connect(editAction, SIGNAL(triggered()), mainWindow(), SLOT(editCurrentDive()));
|
connect(editAction, SIGNAL(triggered()), mainWindow(), SLOT(editCurrentDive()));
|
||||||
|
|
Loading…
Add table
Reference in a new issue