diff options
-rw-r--r-- | profile.c | 20 | ||||
-rw-r--r-- | qt-gui.cpp | 8 | ||||
-rw-r--r-- | qt-ui/about.cpp | 4 | ||||
-rw-r--r-- | qt-ui/divelistview.cpp | 9 | ||||
-rw-r--r-- | qt-ui/maintab.cpp | 14 | ||||
-rw-r--r-- | qt-ui/maintab.ui | 23 | ||||
-rw-r--r-- | qt-ui/models.cpp | 12 | ||||
-rw-r--r-- | qt-ui/profilegraphics.cpp | 11 | ||||
-rw-r--r-- | qt-ui/shifttimes.ui | 40 | ||||
-rw-r--r-- | qt-ui/subsurfacewebservices.cpp | 2 | ||||
-rw-r--r-- | statistics.c | 1 |
11 files changed, 71 insertions, 73 deletions
@@ -1334,7 +1334,7 @@ void compare_samples(struct plot_data *e1, struct plot_data *e2, char *buf, int struct plot_data *start, *stop, *data; const char *depth_unit, *pressure_unit, *vertical_speed_unit; char *buf2 = malloc(bufsize); - int avg_speed, max_speed, min_speed; + int avg_speed, max_asc_speed, max_desc_speed; int delta_depth, avg_depth, max_depth, min_depth; int bar_used, last_pressure, pressurevalue; int count, last_sec, delta_time; @@ -1357,8 +1357,8 @@ void compare_samples(struct plot_data *e1, struct plot_data *e2, char *buf, int } count = 0; avg_speed = 0; - max_speed = 0; - min_speed = INT_MAX; + max_asc_speed = 0; + max_desc_speed = 0; delta_depth = abs(start->depth-stop->depth); delta_time = abs(start->sec-stop->sec); @@ -1379,10 +1379,10 @@ void compare_samples(struct plot_data *e1, struct plot_data *e2, char *buf, int avg_speed += data->speed*(data->sec-last_sec); avg_depth += data->depth*(data->sec-last_sec); - if (abs(data->speed) < min_speed) - min_speed = abs(data->speed); - if (abs(data->speed) > max_speed) - max_speed = abs(data->speed); + if (data->speed > max_desc_speed) + max_desc_speed = data->speed; + if (data->speed < max_asc_speed) + max_asc_speed = data->speed; if (data->depth < min_depth) min_depth = data->depth; @@ -1414,18 +1414,18 @@ void compare_samples(struct plot_data *e1, struct plot_data *e2, char *buf, int memcpy(buf2, buf, bufsize); depthvalue = get_depth_units(max_depth, NULL, &depth_unit); - snprintf(buf, bufsize, translate("gettextFromC","%s %sD:%.1f %s"), buf2, UTF8_UPWARDS_ARROW, depthvalue, depth_unit); + snprintf(buf, bufsize, translate("gettextFromC","%s %sD:%.1f%s"), buf2, UTF8_UPWARDS_ARROW, depthvalue, depth_unit); memcpy(buf2, buf, bufsize); depthvalue = get_depth_units(avg_depth, NULL, &depth_unit); snprintf(buf, bufsize, translate("gettextFromC","%s %sD:%.1f%s\n"), buf2, UTF8_AVERAGE, depthvalue, depth_unit); memcpy(buf2, buf, bufsize); - speedvalue = get_vertical_speed_units(abs(min_speed), NULL, &vertical_speed_unit); + speedvalue = get_vertical_speed_units(abs(max_desc_speed), NULL, &vertical_speed_unit); snprintf(buf, bufsize, translate("gettextFromC","%s%sV:%.2f%s"), buf2, UTF8_DOWNWARDS_ARROW, speedvalue, vertical_speed_unit); memcpy(buf2, buf, bufsize); - speedvalue = get_vertical_speed_units(abs(max_speed), NULL, &vertical_speed_unit); + speedvalue = get_vertical_speed_units(abs(max_asc_speed), NULL, &vertical_speed_unit); snprintf(buf, bufsize, translate("gettextFromC","%s %sV:%.2f%s"), buf2, UTF8_UPWARDS_ARROW, speedvalue, vertical_speed_unit); memcpy(buf2, buf, bufsize); diff --git a/qt-gui.cpp b/qt-gui.cpp index c4624c666..b3dff800b 100644 --- a/qt-gui.cpp +++ b/qt-gui.cpp @@ -218,9 +218,9 @@ QString get_depth_string(depth_t depth, bool showunit, bool showdecimal) QString get_depth_unit() { if (prefs.units.length == units::METERS) - return "m"; + return QString("%1").arg(translate("gettextFromC","m")); else - return "ft"; + return QString("%1").arg(translate("gettextFromC","ft")); } QString get_weight_string(weight_t weight, bool showunit) @@ -237,9 +237,9 @@ QString get_weight_string(weight_t weight, bool showunit) QString get_weight_unit() { if (prefs.units.weight == units::KG) - return "kg"; + return QString("%1").arg(translate("gettextFromC","kg")); else - return "lbs"; + return QString("%1").arg(translate("gettextFromC","lbs")); } /* these methods retrieve used gas per cylinder */ diff --git a/qt-ui/about.cpp b/qt-ui/about.cpp index 29abf6334..132f496de 100644 --- a/qt-ui/about.cpp +++ b/qt-ui/about.cpp @@ -16,9 +16,9 @@ SubsurfaceAbout::SubsurfaceAbout(QWidget* parent, Qt::WindowFlags f) { ui.setupUi(this); ui.aboutLabel->setText(tr("<span style='font-size: 18pt; font-weight: bold;'>" \ - "Subsurface " VERSION_STRING "</span><br><br>" \ + "Subsurface %1 </span><br><br>" \ "Multi-platform divelog software<br>" \ - "<span style='font-size: 8pt'>Linus Torvalds, Dirk Hohndel, and others, 2011, 2012, 2013</span>")); + "<span style='font-size: 8pt'>Linus Torvalds, Dirk Hohndel, and others, 2011, 2012, 2013</span>").arg(VERSION_STRING)); licenseButton = new QPushButton(tr("&License")); websiteButton = new QPushButton(tr("&Website")); ui.buttonBox->addButton(licenseButton, QDialogButtonBox::ActionRole); diff --git a/qt-ui/divelistview.cpp b/qt-ui/divelistview.cpp index d8538a5fd..2e0811b63 100644 --- a/qt-ui/divelistview.cpp +++ b/qt-ui/divelistview.cpp @@ -575,7 +575,7 @@ void DiveListView::addToTripAbove() void DiveListView::deleteDive() { - int i, nr; + int i; struct dive *d = (struct dive *) contextMenuIndex.data(DiveTripModel::DIVE_ROLE).value<void*>(); if (!d) return; @@ -592,10 +592,7 @@ void DiveListView::deleteDive() lastDiveNr = i; } if (amount_selected == 0) { - if (i > 0) - select_dive(nr - 1); - else - mainWindow()->cleanUpEmpty(); + mainWindow()->cleanUpEmpty(); } mark_divelist_changed(TRUE); mainWindow()->refreshDisplay(); @@ -637,7 +634,7 @@ void DiveListView::contextMenuEvent(QContextMenuEvent *event) if (d) { popup.addAction(tr("remove dive(s) from trip"), this, SLOT(removeFromTrip())); popup.addAction(tr("create new trip above"), this, SLOT(newTripAbove())); - popup.addAction(tr("add dive(s) to trip immideately above"), this, SLOT(addToTripAbove())); + popup.addAction(tr("add dive(s) to trip immediately above"), this, SLOT(addToTripAbove())); } if (trip) { popup.addAction(tr("merge trip with trip above"), this, SLOT(mergeTripAbove())); diff --git a/qt-ui/maintab.cpp b/qt-ui/maintab.cpp index ca0aba926..cf9a30c21 100644 --- a/qt-ui/maintab.cpp +++ b/qt-ui/maintab.cpp @@ -213,7 +213,7 @@ void MainTab::enableEdition(EditMode newEditMode) notesBackup[mydive].coordinates = ui.coordinates->text(); notesBackup[mydive].airtemp = get_temperature_string(mydive->airtemp, true); notesBackup[mydive].watertemp = get_temperature_string(mydive->watertemp, true); - notesBackup[mydive].datetime = QDateTime::fromTime_t(mydive->when - gettimezoneoffset()).toString(); + notesBackup[mydive].datetime = QDateTime::fromTime_t(mydive->when).toUTC().toString(); char buf[1024]; taglist_get_tagstring(mydive->tag_list, buf, 1024); notesBackup[mydive].tags = QString(buf); @@ -334,7 +334,7 @@ void MainTab::updateDiveInfo(int dive) UPDATE_TEMP(d, watertemp); if (d) { updateGpsCoordinates(d); - ui.dateTimeEdit->setDateTime(QDateTime::fromTime_t(d->when - gettimezoneoffset())); + ui.dateTimeEdit->setDateTime(QDateTime::fromTime_t(d->when).toUTC()); if (mainWindow() && mainWindow()->dive_list()->selectedTrips().count() == 1) { setTabText(0, tr("Trip Notes")); // only use trip relevant fields @@ -352,8 +352,9 @@ void MainTab::updateDiveInfo(int dive) ui.visibilityLabel->setVisible(false); ui.tagWidget->setVisible(false); ui.TagLabel->setVisible(false); - ui.TemperaturesLabel->setVisible(false); + ui.airTempLabel->setVisible(false); ui.airtemp->setVisible(false); + ui.waterTempLabel->setVisible(false); ui.watertemp->setVisible(false); // rename the remaining fields and fill data from selected trip dive_trip_t *currentTrip = *mainWindow()->dive_list()->selectedTrips().begin(); @@ -378,8 +379,9 @@ void MainTab::updateDiveInfo(int dive) ui.DivemasterLabel->setVisible(true); ui.TagLabel->setVisible(true); ui.tagWidget->setVisible(true); - ui.TemperaturesLabel->setVisible(true); + ui.airTempLabel->setVisible(true); ui.airtemp->setVisible(true); + ui.waterTempLabel->setVisible(true); ui.watertemp->setVisible(true); /* and fill them from the dive */ ui.rating->setCurrentStars(d->rating); @@ -772,7 +774,9 @@ void MainTab::on_watertemp_textChanged(const QString& text) void MainTab::on_dateTimeEdit_dateTimeChanged(const QDateTime& datetime) { - EDIT_SELECTED_DIVES( mydive->when = datetime.toTime_t() + gettimezoneoffset() ); + QDateTime dateTimeUtc(datetime); + dateTimeUtc.setTimeSpec(Qt::UTC); + EDIT_SELECTED_DIVES( mydive->when = dateTimeUtc.toTime_t() ); markChangedWidget(ui.dateTimeEdit); } diff --git a/qt-ui/maintab.ui b/qt-ui/maintab.ui index 413953b5e..90bcf57b7 100644 --- a/qt-ui/maintab.ui +++ b/qt-ui/maintab.ui @@ -60,16 +60,27 @@ <item row="1" column="0"> <widget class="QLabel" name="DateTimeLabel"> <property name="text"> - <string>Starttime</string> + <string>Start time</string> </property> </widget> </item> <item row="1" column="1"> - <widget class="QLabel" name="TemperaturesLabel"> - <property name="text"> - <string>air / water Temperatures</string> - </property> - </widget> + <layout class="QHBoxLayout" name="temperatureLabels"> + <item> + <widget class="QLabel" name="airTempLabel"> + <property name="text"> + <string>Air temp</string> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="waterTempLabel"> + <property name="text"> + <string>Water temp</string> + </property> + </widget> + </item> + </layout> </item> <item row="2" column="0"> <widget class="QDateTimeEdit" name="dateTimeEdit"> diff --git a/qt-ui/models.cpp b/qt-ui/models.cpp index 36ee916e3..9be7dc5d9 100644 --- a/qt-ui/models.cpp +++ b/qt-ui/models.cpp @@ -62,7 +62,7 @@ void CleanerTableModel::setHeaderDataStrings(const QStringList& newHeaders) CylindersModel::CylindersModel(QObject* parent): current(0), rows(0) { // enum{REMOVE, TYPE, SIZE, WORKINGPRESS, START, END, O2, HE, DEPTH}; - setHeaderDataStrings( QStringList() << "" << tr("Type") << tr("Size") << tr("WorkPress") << tr("StartPress") << tr("EndPress") << tr("O2%") << tr("HE") << tr("Switch at")); + setHeaderDataStrings( QStringList() << "" << tr("Type") << tr("Size") << tr("WorkPress") << tr("StartPress") << tr("EndPress") << tr("O2%") << tr("He%") << tr("Switch at")); } CylindersModel *CylindersModel::instance() @@ -1137,19 +1137,19 @@ QVariant DiveTripModel::headerData(int section, Qt::Orientation orientation, int case Qt::DisplayRole : switch (section) { case NR: ret = tr("#"); break; - case DATE: ret = tr("Date"); break; + case DATE: ret = tr("date"); break; case RATING: ret = UTF8_BLACKSTAR; break; case DEPTH: ret = (get_units()->length == units::METERS) ? tr("m") : tr("ft"); break; case DURATION: ret = tr("min"); break; case TEMPERATURE:ret = QString("%1%2").arg(UTF8_DEGREE).arg((get_units()->temperature == units::CELSIUS) ? "C" : "F"); break; case TOTALWEIGHT:ret = (get_units()->weight == units::KG) ? tr("kg") : tr("lbs"); break; - case SUIT: ret = tr("Suit"); break; - case CYLINDER: ret = tr("Cyl"); break; + case SUIT: ret = tr("suit"); break; + case CYLINDER: ret = tr("cyl"); break; case NITROX: ret = QString("O%1%").arg(UTF8_SUBSCRIPT_2); break; case SAC: ret = tr("SAC"); break; case OTU: ret = tr("OTU"); break; case MAXCNS: ret = tr("maxCNS"); break; - case LOCATION: ret = tr("Location"); break; + case LOCATION: ret = tr("location"); break; }break; } @@ -1448,7 +1448,7 @@ void YearlyStatisticsModel::update_yearly_stats() } - if (stats_by_trip != NULL ) { + if (stats_by_trip != NULL && stats_by_trip[0].is_trip == TRUE) { YearStatisticsItem *item = new YearStatisticsItem(stats_by_trip[0]); for (i = 1; stats_by_trip != NULL && stats_by_trip[i].is_trip; ++i) { YearStatisticsItem *iChild = new YearStatisticsItem(stats_by_trip[i]); diff --git a/qt-ui/profilegraphics.cpp b/qt-ui/profilegraphics.cpp index 9192f4973..7645cba88 100644 --- a/qt-ui/profilegraphics.cpp +++ b/qt-ui/profilegraphics.cpp @@ -130,7 +130,7 @@ void ProfileGraphicsView::contextMenuEvent(QContextMenuEvent* event) if(selected_dive == -1) return; QMenu m; - QMenu *gasChange = m.addMenu("Add Gas Change"); + QMenu *gasChange = m.addMenu(tr("Add Gas Change")); GasSelectionModel *model = GasSelectionModel::instance(); model->repopulate(); int rowCount = model->rowCount(); @@ -141,7 +141,7 @@ void ProfileGraphicsView::contextMenuEvent(QContextMenuEvent* event) action->setData(event->globalPos()); gasChange->addAction(action); } - QAction *action = m.addAction("Add Bookmark", this, SLOT(addBookmark())); + QAction *action = m.addAction(tr("Add Bookmark"), this, SLOT(addBookmark())); action->setData(event->globalPos()); QList<QGraphicsItem*> itemsAtPos = scene()->items(mapToScene(mapFromGlobal(event->globalPos()))); Q_FOREACH(QGraphicsItem *i, itemsAtPos){ @@ -149,12 +149,12 @@ void ProfileGraphicsView::contextMenuEvent(QContextMenuEvent* event) if(!item) continue; QAction *action = new QAction(&m); - action->setText("Remove Event"); + action->setText(tr("Remove Event")); action->setData(QVariant::fromValue<void*>(item)); // so we know what to remove. connect(action, SIGNAL(triggered(bool)), this, SLOT(removeEvent())); m.addAction(action); action = new QAction(&m); - action->setText("Hide similar events"); + action->setText(tr("Hide similar events")); action->setData(QVariant::fromValue<void*>(item)); connect(action, SIGNAL(triggered(bool)), this, SLOT(hideEvents())); m.addAction(action); @@ -244,7 +244,6 @@ void ProfileGraphicsView::mouseMoveEvent(QMouseEvent* event) toolTip->refresh(&gc, mapToScene(event->pos())); QPoint toolTipPos = mapFromScene(toolTip->pos()); - QPoint toolBarPos = mapFromScene(toolBarProxy->pos()); scrollViewTo(event->pos()); if (zoomLevel == 0) @@ -1604,7 +1603,7 @@ QColor EventItem::getColor(const color_indice_t i) return profile_color[i].at((isGrayscale) ? 1 : 0); } -EventItem::EventItem(struct event *ev, QGraphicsItem* parent, bool grayscale): QGraphicsPolygonItem(parent), isGrayscale(grayscale), ev(ev) +EventItem::EventItem(struct event *ev, QGraphicsItem* parent, bool grayscale): QGraphicsPolygonItem(parent), ev(ev), isGrayscale(grayscale) { setFlag(ItemIgnoresTransformations); setFlag(ItemIsFocusable); diff --git a/qt-ui/shifttimes.ui b/qt-ui/shifttimes.ui index b3c8c958f..7fba6375c 100644 --- a/qt-ui/shifttimes.ui +++ b/qt-ui/shifttimes.ui @@ -7,48 +7,36 @@ <x>0</x> <y>0</y> <width>343</width> - <height>226</height> + <height>177</height> </rect> </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> <property name="windowTitle"> <string>Shift selected times</string> </property> <layout class="QVBoxLayout" name="verticalLayout_2"> <property name="spacing"> - <number>0</number> - </property> - <property name="leftMargin"> - <number>14</number> - </property> - <property name="topMargin"> - <number>0</number> - </property> - <property name="rightMargin"> - <number>0</number> + <number>6</number> </property> - <property name="bottomMargin"> - <number>0</number> + <property name="margin"> + <number>9</number> </property> - <item> + <item alignment="Qt::AlignTop"> <widget class="QGroupBox" name="groupBox"> <property name="title"> <string>Shift times of selected dives by</string> </property> <layout class="QVBoxLayout" name="verticalLayout"> <property name="spacing"> - <number>0</number> - </property> - <property name="leftMargin"> - <number>0</number> - </property> - <property name="topMargin"> - <number>23</number> - </property> - <property name="rightMargin"> - <number>0</number> + <number>6</number> </property> - <property name="bottomMargin"> - <number>0</number> + <property name="margin"> + <number>9</number> </property> <item> <widget class="QTimeEdit" name="timeEdit"> diff --git a/qt-ui/subsurfacewebservices.cpp b/qt-ui/subsurfacewebservices.cpp index 7362255c3..e4bfea7a4 100644 --- a/qt-ui/subsurfacewebservices.cpp +++ b/qt-ui/subsurfacewebservices.cpp @@ -112,7 +112,7 @@ void SubsurfaceWebServices::startDownload() request.setUrl(url); request.setRawHeader("Accept", "text/xml"); reply = manager->get(request); - ui.status->setText(tr("Wait a bit untill we have something...")); + ui.status->setText(tr("Wait a bit until we have something...")); ui.progressBar->setRange(0,0); // this makes the progressbar do an 'infinite spin' ui.download->setEnabled(false); ui.buttonBox->button(QDialogButtonBox::Apply)->setEnabled(false); diff --git a/statistics.c b/statistics.c index 807539f2a..18666bda0 100644 --- a/statistics.c +++ b/statistics.c @@ -127,7 +127,6 @@ void process_all_dives(struct dive *dive, struct dive **prev_dive) memset(stats_monthly, 0, size); memset(stats_by_trip, 0, size); stats_yearly[0].is_year = TRUE; - stats_by_trip[0].is_trip = TRUE; /* this relies on the fact that the dives in the dive_table * are in chronological order */ |