mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Fix broken windows build with latest MXE
Replaces some enums with names that do not clash with windows #defines. Specifically: ERROR -> ERRORED, PASCAL->PASCALS, IGNORE->IGNORED,FLOAT->FLOATVAL Signed-off-by: Paul Buxton <paulbuxton.mail@googlemail.com>
This commit is contained in:
parent
193c456f06
commit
3c4fd5d599
9 changed files with 38 additions and 41 deletions
|
@ -26,7 +26,7 @@ public:
|
||||||
FWUPDATE,
|
FWUPDATE,
|
||||||
CANCELLING,
|
CANCELLING,
|
||||||
CANCELLED,
|
CANCELLED,
|
||||||
ERROR,
|
ERRORED,
|
||||||
DONE,
|
DONE,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -3404,7 +3404,7 @@ void set_informational_units(const char *units)
|
||||||
if (strstr(units, "PSI"))
|
if (strstr(units, "PSI"))
|
||||||
git_prefs.units.pressure = PSI;
|
git_prefs.units.pressure = PSI;
|
||||||
if (strstr(units, "PASCAL"))
|
if (strstr(units, "PASCAL"))
|
||||||
git_prefs.units.pressure = PASCAL;
|
git_prefs.units.pressure = PASCALS;
|
||||||
if (strstr(units, "CELSIUS"))
|
if (strstr(units, "CELSIUS"))
|
||||||
git_prefs.units.temperature = CELSIUS;
|
git_prefs.units.temperature = CELSIUS;
|
||||||
if (strstr(units, "FAHRENHEIT"))
|
if (strstr(units, "FAHRENHEIT"))
|
||||||
|
|
|
@ -145,7 +145,7 @@ static void divetags(char *buffer, struct tag_entry **tags)
|
||||||
|
|
||||||
enum number_type {
|
enum number_type {
|
||||||
NEITHER,
|
NEITHER,
|
||||||
FLOAT
|
FLOATVAL
|
||||||
};
|
};
|
||||||
|
|
||||||
static enum number_type parse_float(const char *buffer, double *res, const char **endp)
|
static enum number_type parse_float(const char *buffer, double *res, const char **endp)
|
||||||
|
@ -172,7 +172,7 @@ static enum number_type parse_float(const char *buffer, double *res, const char
|
||||||
}
|
}
|
||||||
|
|
||||||
*res = val;
|
*res = val;
|
||||||
return FLOAT;
|
return FLOATVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
union int_or_float {
|
union int_or_float {
|
||||||
|
@ -191,12 +191,12 @@ static void pressure(char *buffer, pressure_t *pressure, struct parser_state *st
|
||||||
union int_or_float val;
|
union int_or_float val;
|
||||||
|
|
||||||
switch (integer_or_float(buffer, &val)) {
|
switch (integer_or_float(buffer, &val)) {
|
||||||
case FLOAT:
|
case FLOATVAL:
|
||||||
/* Just ignore zero values */
|
/* Just ignore zero values */
|
||||||
if (!val.fp)
|
if (!val.fp)
|
||||||
break;
|
break;
|
||||||
switch (state->xml_parsing_units.pressure) {
|
switch (state->xml_parsing_units.pressure) {
|
||||||
case PASCAL:
|
case PASCALS:
|
||||||
mbar = val.fp / 100;
|
mbar = val.fp / 100;
|
||||||
break;
|
break;
|
||||||
case BAR:
|
case BAR:
|
||||||
|
@ -233,7 +233,7 @@ static void salinity(char *buffer, int *salinity)
|
||||||
{
|
{
|
||||||
union int_or_float val;
|
union int_or_float val;
|
||||||
switch (integer_or_float(buffer, &val)) {
|
switch (integer_or_float(buffer, &val)) {
|
||||||
case FLOAT:
|
case FLOATVAL:
|
||||||
*salinity = lrint(val.fp * 10.0);
|
*salinity = lrint(val.fp * 10.0);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -246,7 +246,7 @@ static void depth(char *buffer, depth_t *depth, struct parser_state *state)
|
||||||
union int_or_float val;
|
union int_or_float val;
|
||||||
|
|
||||||
switch (integer_or_float(buffer, &val)) {
|
switch (integer_or_float(buffer, &val)) {
|
||||||
case FLOAT:
|
case FLOATVAL:
|
||||||
switch (state->xml_parsing_units.length) {
|
switch (state->xml_parsing_units.length) {
|
||||||
case METERS:
|
case METERS:
|
||||||
depth->mm = lrint(val.fp * 1000);
|
depth->mm = lrint(val.fp * 1000);
|
||||||
|
@ -281,7 +281,7 @@ static void weight(char *buffer, weight_t *weight, struct parser_state *state)
|
||||||
union int_or_float val;
|
union int_or_float val;
|
||||||
|
|
||||||
switch (integer_or_float(buffer, &val)) {
|
switch (integer_or_float(buffer, &val)) {
|
||||||
case FLOAT:
|
case FLOATVAL:
|
||||||
switch (state->xml_parsing_units.weight) {
|
switch (state->xml_parsing_units.weight) {
|
||||||
case KG:
|
case KG:
|
||||||
weight->grams = lrint(val.fp * 1000);
|
weight->grams = lrint(val.fp * 1000);
|
||||||
|
@ -301,7 +301,7 @@ static void temperature(char *buffer, temperature_t *temperature, struct parser_
|
||||||
union int_or_float val;
|
union int_or_float val;
|
||||||
|
|
||||||
switch (integer_or_float(buffer, &val)) {
|
switch (integer_or_float(buffer, &val)) {
|
||||||
case FLOAT:
|
case FLOATVAL:
|
||||||
switch (state->xml_parsing_units.temperature) {
|
switch (state->xml_parsing_units.temperature) {
|
||||||
case KELVIN:
|
case KELVIN:
|
||||||
temperature->mkelvin = lrint(val.fp * 1000);
|
temperature->mkelvin = lrint(val.fp * 1000);
|
||||||
|
@ -383,7 +383,7 @@ static void percent(char *buffer, fraction_t *fraction)
|
||||||
const char *end;
|
const char *end;
|
||||||
|
|
||||||
switch (parse_float(buffer, &val, &end)) {
|
switch (parse_float(buffer, &val, &end)) {
|
||||||
case FLOAT:
|
case FLOATVAL:
|
||||||
/* Turn fractions into percent unless explicit.. */
|
/* Turn fractions into percent unless explicit.. */
|
||||||
if (val <= 1.0) {
|
if (val <= 1.0) {
|
||||||
while (isspace(*end))
|
while (isspace(*end))
|
||||||
|
@ -424,7 +424,7 @@ static void cylindersize(char *buffer, volume_t *volume)
|
||||||
union int_or_float val;
|
union int_or_float val;
|
||||||
|
|
||||||
switch (integer_or_float(buffer, &val)) {
|
switch (integer_or_float(buffer, &val)) {
|
||||||
case FLOAT:
|
case FLOATVAL:
|
||||||
volume->mliter = lrint(val.fp * 1000);
|
volume->mliter = lrint(val.fp * 1000);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -600,7 +600,7 @@ static void fahrenheit(char *buffer, temperature_t *temperature)
|
||||||
union int_or_float val;
|
union int_or_float val;
|
||||||
|
|
||||||
switch (integer_or_float(buffer, &val)) {
|
switch (integer_or_float(buffer, &val)) {
|
||||||
case FLOAT:
|
case FLOATVAL:
|
||||||
if (IS_FP_SAME(val.fp, 32.0))
|
if (IS_FP_SAME(val.fp, 32.0))
|
||||||
break;
|
break;
|
||||||
if (val.fp < 32.0)
|
if (val.fp < 32.0)
|
||||||
|
@ -638,7 +638,7 @@ static void psi_or_bar(char *buffer, pressure_t *pressure)
|
||||||
union int_or_float val;
|
union int_or_float val;
|
||||||
|
|
||||||
switch (integer_or_float(buffer, &val)) {
|
switch (integer_or_float(buffer, &val)) {
|
||||||
case FLOAT:
|
case FLOATVAL:
|
||||||
if (val.fp > 400)
|
if (val.fp > 400)
|
||||||
pressure->mbar = psi_to_mbar(val.fp);
|
pressure->mbar = psi_to_mbar(val.fp);
|
||||||
else
|
else
|
||||||
|
@ -1530,7 +1530,7 @@ static void uddf_importer(struct parser_state *state)
|
||||||
{
|
{
|
||||||
state->import_source = UDDF;
|
state->import_source = UDDF;
|
||||||
state->xml_parsing_units = SI_units;
|
state->xml_parsing_units = SI_units;
|
||||||
state->xml_parsing_units.pressure = PASCAL;
|
state->xml_parsing_units.pressure = PASCALS;
|
||||||
state->xml_parsing_units.temperature = KELVIN;
|
state->xml_parsing_units.temperature = KELVIN;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@ int get_pressure_units(int mb, const char **units)
|
||||||
const struct units *units_p = get_units();
|
const struct units *units_p = get_units();
|
||||||
|
|
||||||
switch (units_p->pressure) {
|
switch (units_p->pressure) {
|
||||||
case PASCAL:
|
case PASCALS:
|
||||||
pressure = mb * 100;
|
pressure = mb * 100;
|
||||||
unit = translate("gettextFromC", "pascal");
|
unit = translate("gettextFromC", "pascal");
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -271,9 +271,6 @@ static inline int32_t pressure_to_altitude(int32_t pressure) // pressure in mbar
|
||||||
* keeps track of those units.
|
* keeps track of those units.
|
||||||
*/
|
*/
|
||||||
/* turns out in Win32 PASCAL is defined as a calling convention */
|
/* turns out in Win32 PASCAL is defined as a calling convention */
|
||||||
#ifdef WIN32
|
|
||||||
#undef PASCAL
|
|
||||||
#endif
|
|
||||||
struct units {
|
struct units {
|
||||||
enum LENGTH {
|
enum LENGTH {
|
||||||
METERS,
|
METERS,
|
||||||
|
@ -286,7 +283,7 @@ struct units {
|
||||||
enum PRESSURE {
|
enum PRESSURE {
|
||||||
BAR,
|
BAR,
|
||||||
PSI,
|
PSI,
|
||||||
PASCAL
|
PASCALS
|
||||||
} pressure;
|
} pressure;
|
||||||
enum TEMPERATURE {
|
enum TEMPERATURE {
|
||||||
CELSIUS,
|
CELSIUS,
|
||||||
|
|
|
@ -244,7 +244,7 @@ void DownloadFromDCWidget::updateState(states state)
|
||||||
|
|
||||||
// user pressed cancel but the application isn't doing anything.
|
// user pressed cancel but the application isn't doing anything.
|
||||||
// means close the window
|
// means close the window
|
||||||
else if ((currentState == INITIAL || currentState == DONE || currentState == ERROR) && state == CANCELLING) {
|
else if ((currentState == INITIAL || currentState == DONE || currentState == ERRORED) && state == CANCELLING) {
|
||||||
timer->stop();
|
timer->stop();
|
||||||
reject();
|
reject();
|
||||||
}
|
}
|
||||||
|
@ -294,7 +294,7 @@ void DownloadFromDCWidget::updateState(states state)
|
||||||
}
|
}
|
||||||
|
|
||||||
// got an error
|
// got an error
|
||||||
else if (state == ERROR) {
|
else if (state == ERRORED) {
|
||||||
timer->stop();
|
timer->stop();
|
||||||
|
|
||||||
QMessageBox::critical(this, TITLE_OR_TEXT(tr("Error"), thread.error), QMessageBox::Ok);
|
QMessageBox::critical(this, TITLE_OR_TEXT(tr("Error"), thread.error), QMessageBox::Ok);
|
||||||
|
@ -503,7 +503,7 @@ void DownloadFromDCWidget::onDownloadThreadFinished()
|
||||||
if (thread.error.isEmpty())
|
if (thread.error.isEmpty())
|
||||||
updateState(DONE);
|
updateState(DONE);
|
||||||
else
|
else
|
||||||
updateState(ERROR);
|
updateState(ERRORED);
|
||||||
} else if (currentState == CANCELLING) {
|
} else if (currentState == CANCELLING) {
|
||||||
updateState(DONE);
|
updateState(DONE);
|
||||||
}
|
}
|
||||||
|
@ -524,7 +524,7 @@ void DownloadFromDCWidget::on_cancel_clicked()
|
||||||
|
|
||||||
void DownloadFromDCWidget::on_ok_clicked()
|
void DownloadFromDCWidget::on_ok_clicked()
|
||||||
{
|
{
|
||||||
if (currentState != DONE && currentState != ERROR)
|
if (currentState != DONE && currentState != ERRORED)
|
||||||
return;
|
return;
|
||||||
struct dive_table *table = thread.table();
|
struct dive_table *table = thread.table();
|
||||||
struct dive_site_table *sites = thread.sites();
|
struct dive_site_table *sites = thread.sites();
|
||||||
|
|
|
@ -32,7 +32,7 @@ public:
|
||||||
INITIAL,
|
INITIAL,
|
||||||
DOWNLOADING,
|
DOWNLOADING,
|
||||||
CANCELLING,
|
CANCELLING,
|
||||||
ERROR,
|
ERRORED,
|
||||||
DONE,
|
DONE,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -438,7 +438,7 @@ void MainTab::updateDiveInfo()
|
||||||
for (int i = 0; i < extraWidgets.size() - 1; ++i)
|
for (int i = 0; i < extraWidgets.size() - 1; ++i)
|
||||||
extraWidgets[i]->setEnabled(enabled);
|
extraWidgets[i]->setEnabled(enabled);
|
||||||
|
|
||||||
editMode = IGNORE; // don't trigger on changes to the widgets
|
editMode = IGNORE_MODE; // don't trigger on changes to the widgets
|
||||||
|
|
||||||
for (TabBase *widget: extraWidgets)
|
for (TabBase *widget: extraWidgets)
|
||||||
widget->updateData();
|
widget->updateData();
|
||||||
|
@ -619,7 +619,7 @@ void MainTab::acceptChanges()
|
||||||
stealFocus();
|
stealFocus();
|
||||||
|
|
||||||
EditMode lastMode = editMode;
|
EditMode lastMode = editMode;
|
||||||
editMode = IGNORE;
|
editMode = IGNORE_MODE;
|
||||||
tabBar()->setTabIcon(0, QIcon()); // Notes
|
tabBar()->setTabIcon(0, QIcon()); // Notes
|
||||||
tabBar()->setTabIcon(1, QIcon()); // Equipment
|
tabBar()->setTabIcon(1, QIcon()); // Equipment
|
||||||
ui.dateEdit->setEnabled(true);
|
ui.dateEdit->setEnabled(true);
|
||||||
|
@ -746,7 +746,7 @@ static QStringList stringToList(const QString &s)
|
||||||
|
|
||||||
void MainTab::on_buddy_editingFinished()
|
void MainTab::on_buddy_editingFinished()
|
||||||
{
|
{
|
||||||
if (editMode == IGNORE || !current_dive)
|
if (editMode == IGNORE_MODE || !current_dive)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
divesEdited(Command::editBuddies(stringToList(ui.buddy->toPlainText()), false));
|
divesEdited(Command::editBuddies(stringToList(ui.buddy->toPlainText()), false));
|
||||||
|
@ -754,7 +754,7 @@ void MainTab::on_buddy_editingFinished()
|
||||||
|
|
||||||
void MainTab::on_divemaster_editingFinished()
|
void MainTab::on_divemaster_editingFinished()
|
||||||
{
|
{
|
||||||
if (editMode == IGNORE || !current_dive)
|
if (editMode == IGNORE_MODE || !current_dive)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
divesEdited(Command::editDiveMaster(stringToList(ui.divemaster->toPlainText()), false));
|
divesEdited(Command::editDiveMaster(stringToList(ui.divemaster->toPlainText()), false));
|
||||||
|
@ -762,7 +762,7 @@ void MainTab::on_divemaster_editingFinished()
|
||||||
|
|
||||||
void MainTab::on_duration_editingFinished()
|
void MainTab::on_duration_editingFinished()
|
||||||
{
|
{
|
||||||
if (editMode == IGNORE || !current_dive)
|
if (editMode == IGNORE_MODE || !current_dive)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Duration editing is special: we only edit the current dive.
|
// Duration editing is special: we only edit the current dive.
|
||||||
|
@ -771,7 +771,7 @@ void MainTab::on_duration_editingFinished()
|
||||||
|
|
||||||
void MainTab::on_depth_editingFinished()
|
void MainTab::on_depth_editingFinished()
|
||||||
{
|
{
|
||||||
if (editMode == IGNORE || !current_dive)
|
if (editMode == IGNORE_MODE || !current_dive)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Depth editing is special: we only edit the current dive.
|
// Depth editing is special: we only edit the current dive.
|
||||||
|
@ -783,14 +783,14 @@ void MainTab::on_airtemp_editingFinished()
|
||||||
// If the field wasn't modified by the user, don't post a new undo command.
|
// If the field wasn't modified by the user, don't post a new undo command.
|
||||||
// Owing to rounding errors, this might lead to undo commands that have
|
// Owing to rounding errors, this might lead to undo commands that have
|
||||||
// no user visible effects. These can be very confusing.
|
// no user visible effects. These can be very confusing.
|
||||||
if (editMode == IGNORE || !ui.airtemp->isModified() || !current_dive)
|
if (editMode == IGNORE_MODE || !ui.airtemp->isModified() || !current_dive)
|
||||||
return;
|
return;
|
||||||
divesEdited(Command::editAirTemp(parseTemperatureToMkelvin(ui.airtemp->text()), false));
|
divesEdited(Command::editAirTemp(parseTemperatureToMkelvin(ui.airtemp->text()), false));
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainTab::divetype_Changed(int index)
|
void MainTab::divetype_Changed(int index)
|
||||||
{
|
{
|
||||||
if (editMode == IGNORE || !current_dive)
|
if (editMode == IGNORE_MODE || !current_dive)
|
||||||
return;
|
return;
|
||||||
divesEdited(Command::editMode(dc_number, (enum divemode_t)index, false));
|
divesEdited(Command::editMode(dc_number, (enum divemode_t)index, false));
|
||||||
}
|
}
|
||||||
|
@ -800,7 +800,7 @@ void MainTab::on_watertemp_editingFinished()
|
||||||
// If the field wasn't modified by the user, don't post a new undo command.
|
// If the field wasn't modified by the user, don't post a new undo command.
|
||||||
// Owing to rounding errors, this might lead to undo commands that have
|
// Owing to rounding errors, this might lead to undo commands that have
|
||||||
// no user visible effects. These can be very confusing.
|
// no user visible effects. These can be very confusing.
|
||||||
if (editMode == IGNORE || !ui.watertemp->isModified() || !current_dive)
|
if (editMode == IGNORE_MODE || !ui.watertemp->isModified() || !current_dive)
|
||||||
return;
|
return;
|
||||||
divesEdited(Command::editWaterTemp(parseTemperatureToMkelvin(ui.watertemp->text()), false));
|
divesEdited(Command::editWaterTemp(parseTemperatureToMkelvin(ui.watertemp->text()), false));
|
||||||
}
|
}
|
||||||
|
@ -826,7 +826,7 @@ static void shiftTime(QDateTime &dateTime)
|
||||||
|
|
||||||
void MainTab::on_dateEdit_dateChanged(const QDate &date)
|
void MainTab::on_dateEdit_dateChanged(const QDate &date)
|
||||||
{
|
{
|
||||||
if (editMode == IGNORE || !current_dive)
|
if (editMode == IGNORE_MODE || !current_dive)
|
||||||
return;
|
return;
|
||||||
QDateTime dateTime = QDateTime::fromMSecsSinceEpoch(1000*current_dive->when, Qt::UTC);
|
QDateTime dateTime = QDateTime::fromMSecsSinceEpoch(1000*current_dive->when, Qt::UTC);
|
||||||
dateTime.setTimeSpec(Qt::UTC);
|
dateTime.setTimeSpec(Qt::UTC);
|
||||||
|
@ -836,7 +836,7 @@ void MainTab::on_dateEdit_dateChanged(const QDate &date)
|
||||||
|
|
||||||
void MainTab::on_timeEdit_timeChanged(const QTime &time)
|
void MainTab::on_timeEdit_timeChanged(const QTime &time)
|
||||||
{
|
{
|
||||||
if (editMode == IGNORE || !current_dive)
|
if (editMode == IGNORE_MODE || !current_dive)
|
||||||
return;
|
return;
|
||||||
QDateTime dateTime = QDateTime::fromMSecsSinceEpoch(1000*current_dive->when, Qt::UTC);
|
QDateTime dateTime = QDateTime::fromMSecsSinceEpoch(1000*current_dive->when, Qt::UTC);
|
||||||
dateTime.setTimeSpec(Qt::UTC);
|
dateTime.setTimeSpec(Qt::UTC);
|
||||||
|
@ -846,7 +846,7 @@ void MainTab::on_timeEdit_timeChanged(const QTime &time)
|
||||||
|
|
||||||
void MainTab::on_tagWidget_editingFinished()
|
void MainTab::on_tagWidget_editingFinished()
|
||||||
{
|
{
|
||||||
if (editMode == IGNORE || !current_dive)
|
if (editMode == IGNORE_MODE || !current_dive)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
divesEdited(Command::editTags(ui.tagWidget->getBlockStringList(), false));
|
divesEdited(Command::editTags(ui.tagWidget->getBlockStringList(), false));
|
||||||
|
@ -854,7 +854,7 @@ void MainTab::on_tagWidget_editingFinished()
|
||||||
|
|
||||||
void MainTab::on_location_diveSiteSelected()
|
void MainTab::on_location_diveSiteSelected()
|
||||||
{
|
{
|
||||||
if (editMode == IGNORE || !current_dive)
|
if (editMode == IGNORE_MODE || !current_dive)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
struct dive_site *newDs = ui.location->currDiveSite();
|
struct dive_site *newDs = ui.location->currDiveSite();
|
||||||
|
@ -892,7 +892,7 @@ void MainTab::on_notes_editingFinished()
|
||||||
|
|
||||||
void MainTab::on_rating_valueChanged(int value)
|
void MainTab::on_rating_valueChanged(int value)
|
||||||
{
|
{
|
||||||
if (editMode == IGNORE || !current_dive)
|
if (editMode == IGNORE_MODE || !current_dive)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
divesEdited(Command::editRating(value, false));
|
divesEdited(Command::editRating(value, false));
|
||||||
|
@ -900,7 +900,7 @@ void MainTab::on_rating_valueChanged(int value)
|
||||||
|
|
||||||
void MainTab::on_visibility_valueChanged(int value)
|
void MainTab::on_visibility_valueChanged(int value)
|
||||||
{
|
{
|
||||||
if (editMode == IGNORE || !current_dive)
|
if (editMode == IGNORE_MODE || !current_dive)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
divesEdited(Command::editVisibility(value, false));
|
divesEdited(Command::editVisibility(value, false));
|
||||||
|
|
|
@ -30,7 +30,7 @@ public:
|
||||||
NONE,
|
NONE,
|
||||||
DIVE,
|
DIVE,
|
||||||
MANUALLY_ADDED_DIVE,
|
MANUALLY_ADDED_DIVE,
|
||||||
IGNORE
|
IGNORE_MODE
|
||||||
};
|
};
|
||||||
|
|
||||||
MainTab(QWidget *parent = 0);
|
MainTab(QWidget *parent = 0);
|
||||||
|
|
Loading…
Add table
Reference in a new issue