mirror of
https://github.com/subsurface/subsurface.git
synced 2025-01-19 14:25:27 +00:00
Use a slightly shorter date string for Info tab
This way the spacing of the elements looks nicer. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
5c2a2691fd
commit
9a65798daf
3 changed files with 22 additions and 3 deletions
22
divelist.c
22
divelist.c
|
@ -566,7 +566,8 @@ void get_suit(struct dive *dive, char **str)
|
|||
|
||||
#define MAX_DATE_STRING 256
|
||||
/* caller needs to free the string */
|
||||
char *get_dive_date_string(timestamp_t when) {
|
||||
char *get_dive_date_string(timestamp_t when)
|
||||
{
|
||||
char *buffer = malloc(MAX_DATE_STRING);
|
||||
if (buffer) {
|
||||
struct tm tm;
|
||||
|
@ -582,8 +583,25 @@ char *get_dive_date_string(timestamp_t when) {
|
|||
return buffer;
|
||||
}
|
||||
|
||||
char *get_short_dive_date_string(timestamp_t when)
|
||||
{
|
||||
char *buffer = malloc(MAX_DATE_STRING);
|
||||
if (buffer) {
|
||||
struct tm tm;
|
||||
utc_mkdate(when, &tm);
|
||||
snprintf(buffer, MAX_DATE_STRING,
|
||||
/*++GETTEXT 40 char buffer monthname, day of month, year, hour:min */
|
||||
_("%1$s %2$d, %3$d\n%4$02d:%5$02d"),
|
||||
monthname(tm.tm_mon),
|
||||
tm.tm_mday, tm.tm_year +1900,
|
||||
tm.tm_hour, tm.tm_min);
|
||||
}
|
||||
return buffer;
|
||||
}
|
||||
|
||||
/* caller needs to free the string */
|
||||
char *get_trip_date_string(timestamp_t when, int nr) {
|
||||
char *get_trip_date_string(timestamp_t when, int nr)
|
||||
{
|
||||
char *buffer = malloc(MAX_DATE_STRING);
|
||||
if (buffer) {
|
||||
struct tm tm;
|
||||
|
|
|
@ -26,6 +26,7 @@ extern void upload_all_dives_divelogs_cb();
|
|||
/* divelist core logic functions */
|
||||
extern void process_dives(bool imported, bool prefer_imported);
|
||||
extern char *get_dive_date_string(timestamp_t when);
|
||||
extern char *get_short_dive_date_string(timestamp_t when);
|
||||
extern char *get_trip_date_string(timestamp_t when, int nr);
|
||||
extern char *get_nitrox_string(struct dive *dive);
|
||||
extern void clear_trip_indexes(void);
|
||||
|
|
|
@ -203,7 +203,7 @@ void MainTab::updateDiveInfo(int dive)
|
|||
ui->airTemperatureText->setText(get_temperature_string(d->airtemp, TRUE));
|
||||
ui->gasUsedText->setText(get_volume_string(get_gas_used(d), TRUE));
|
||||
ui->oxygenHeliumText->setText(get_gaslist(d));
|
||||
ui->dateText->setText(get_dive_date_string(d->when));
|
||||
ui->dateText->setText(get_short_dive_date_string(d->when));
|
||||
ui->diveTimeText->setText(QString::number((int)((d->duration.seconds + 30) / 60)));
|
||||
if (prevd)
|
||||
ui->surfaceIntervalText->setText(get_time_string(d->when - (prevd->when + prevd->duration.seconds), 4));
|
||||
|
|
Loading…
Add table
Reference in a new issue