Skip to content

Commit

Permalink
Adding the support for recorded and paused time (#25)
Browse files Browse the repository at this point in the history
* Proof of concept for Elapsed Time

* Numbers for POC

* Support for pauses for the fitlog format

* It is fully working for fitlog files

* First stab at the fit pauses

* Pause time for Suunto 9 files but the recorded time is wrong

* TODOs

* Revert of BreakTimeTool.java

* WIP Storing tourTimerPauses differently in the database

* Fixed the database design issue.

* Adding the paused time in the Calendar view

* Misc

* Formatting

* Rearranged value formats preferences with all the times

* Added all the time values in the Tour Tooltip

* Added all the time values in the Calendar view and added the property
tourRecordedTime in TourData

* done and todo

* WIP : Paused times for fit files

* WIP : Fit pauses imports

* Revert

* FIT : Suunto and maybe others don't have events for pauses but the
recorded time is available

* Formatting

* Revert

* Suunto Ambit XML pauses import

* Bugfix for Suunto Ambit import introduced in last commit

* done

* Suunto Ambit SML pauses import

* todo

* Bugfix : We need to set the tourdata for each tourtimerpause

* TODO

* TODO

* TODO

* Adding the ability to reimport only tour timer pauses

* Alphabetical order

* When updating to the new DB, by default, the recorded time will be the
elapsed time (hence the pause time will be 0)

* Some fit files don't have the detailed pauses information but they have
the total recorded time

* Adding the Recorded time column in the TourBookView

* Adding strings for paused time

* Added the paused time in the TourBookView

* When reimporting, we set the recorded time (if any) before setting the
timer pauses

* Adding the paused time and recorded time as sums

* Icon fix

* WIP

* TODO

* Readme update

* When reimporting a tour and only importing the tour timer pauses, we
display the previous vs new data. We should do that for the other
reimport menus

* TODO

* DB version change

* We need to save the previous data

* Changing header icons

* Setting the recorded time and paused time when importing pauses as a
list

* CSV Import

* Misc

* Revert

* Only setting the paused time when the recorded time is not 0

* Polar HRM

* Fit log import fixes

* GPX Import

* Misc

* Headers

* Done and checked

* Renaming

* Renaming

* Renaming

* French translation

* TODO

* WIP UI update when manually modifying elapsed recorded paused moving and
break time

* DONE UI update when manually modifying elapsed recorded paused moving
and
break time

* More info

* Adding Recorded and Paused Time in the Statistics tooltip

* Renaming computeTourDrivingTime to computeTourMovingTime

* WIP Displaying the pause durations on the 2D Map

* Misc code beautifying

* 2d map Added the ability to display/hide the location and duration of
the tour pauses

* Small fix

* Adding the icon for showing/hiding tour pauses

* Fix for Fitlog import

* Setting the tour recorded time

* Comments

* TODOs

* Add the PR number when created

* Checking that every file import sets correctly the tour recorded time

* Exporting/importing recorded and paused time for the GPX format

* Beautifying

* Added the new time Tourbookview columns in CSV Export

* WIP TCS Pauses import

* Formatting

* Pause import for TCX files

* Merge part 2

* TODO Fix unknown regression

* Added the ability to display recorded and paused time in the
Day/Week/Month/Year Summaries

* DONE AND TODOs

* Readme update

* TODO

* TODO

* WIP Added the ability to display/hide the tour pauses in the chart

* Removing Unused action

* WIP Display pauses in the tour chart

* S9 Import: We need to take into account when the user starts and stops
the activity to have a correct elapsed time

* XML tags
  • Loading branch information
FJBDev committed Aug 26, 2020
1 parent a3e959c commit 6bdffff
Show file tree
Hide file tree
Showing 139 changed files with 8,557 additions and 6,068 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (C) 2005, 2019 Wolfgang Schramm and Contributors
* Copyright (C) 2005, 2020 Wolfgang Schramm and Contributors
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
Expand Down Expand Up @@ -45,14 +45,20 @@ public class FormatManager {
private static IValueFormatter _pulseFormatter;
private static IValueFormatter _speedFormatter;

private static IValueFormatter _drivingTimeFormatter;
private static IValueFormatter _elapsedTimeFormatter;
private static IValueFormatter _recordedTimeFormatter;
private static IValueFormatter _pausedTimeFormatter;
private static IValueFormatter _recordingTimeFormatter;
private static IValueFormatter _movingTimeFormatter;
private static IValueFormatter _breakTimeFormatter;

public static String formatAltitude(final float value) {
return _altitudeFormatter.printDouble(value);
}

public static String formatBreakTime(final long value) {
return _breakTimeFormatter.printLong(value);
}

public static String formatCadence(final double value) {
return _cadenceFormatter.printDouble(value);
}
Expand All @@ -61,8 +67,12 @@ public static String formatDistance(final double value) {
return _distanceFormatter.printDouble(value);
}

public static String formatDrivingTime(final long value) {
return _drivingTimeFormatter.printLong(value);
public static String formatElapsedTime(final long value) {
return _elapsedTimeFormatter.printLong(value);
}

public static String formatMovingTime(final long value) {
return _movingTimeFormatter.printLong(value);
}

public static String formatNumber_0(final double value) {
Expand Down Expand Up @@ -90,8 +100,8 @@ public static String formatPulse(final double value) {
return _pulseFormatter.printDouble(value);
}

public static String formatRecordingTime(final long value) {
return _recordingTimeFormatter.printLong(value);
public static String formatRecordedTime(final long value) {
return _recordedTimeFormatter.printLong(value);
}

public static String formatSpeed(final double value) {
Expand Down Expand Up @@ -195,9 +205,11 @@ public static void updateDisplayFormats() {
final String pulse = _prefStore.getString(ICommonPreferences.DISPLAY_FORMAT_PULSE);
final String speed = _prefStore.getString(ICommonPreferences.DISPLAY_FORMAT_SPEED);

final String drivingTime = _prefStore.getString(ICommonPreferences.DISPLAY_FORMAT_DRIVING_TIME);
final String elapsedTime = _prefStore.getString(ICommonPreferences.DISPLAY_FORMAT_ELAPSED_TIME);
final String recordedTime = _prefStore.getString(ICommonPreferences.DISPLAY_FORMAT_RECORDED_TIME);
final String pausedTime = _prefStore.getString(ICommonPreferences.DISPLAY_FORMAT_PAUSED_TIME);
final String recordingTime = _prefStore.getString(ICommonPreferences.DISPLAY_FORMAT_RECORDING_TIME);
final String movingTime = _prefStore.getString(ICommonPreferences.DISPLAY_FORMAT_MOVING_TIME);
final String breakTime = _prefStore.getString(ICommonPreferences.DISPLAY_FORMAT_BREAK_TIME);

_altitudeFormatter = getNumberFormatter(altitude);
_cadenceFormatter = getNumberFormatter(cadence);
Expand All @@ -206,8 +218,10 @@ public static void updateDisplayFormats() {
_pulseFormatter = getNumberFormatter(pulse);
_speedFormatter = getNumberFormatter(speed);

_drivingTimeFormatter = getTimeFormatter(drivingTime);
_elapsedTimeFormatter = getTimeFormatter(elapsedTime);
_recordedTimeFormatter = getTimeFormatter(recordedTime);
_pausedTimeFormatter = getTimeFormatter(pausedTime);
_recordingTimeFormatter = getTimeFormatter(recordingTime);
_movingTimeFormatter = getTimeFormatter(movingTime);
_breakTimeFormatter = getTimeFormatter(breakTime);
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (C) 2005, 2016 Wolfgang Schramm and Contributors
* Copyright (C) 2005, 2020 Wolfgang Schramm and Contributors
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
Expand Down Expand Up @@ -32,66 +32,68 @@
*/
public class CommonPreferenceInitializer extends AbstractPreferenceInitializer {

@Override
public void initializeDefaultPreferences() {

final IPreferenceStore store = CommonActivator.getPrefStore();

/*
* graph color preferences
*/
for (final ColorDefinition colorDefinition : GraphColorManager.getInstance().getGraphColorDefinitions()) {

PreferenceConverter.setDefault(
store,
colorDefinition.getGraphPrefName(GraphColorManager.PREF_COLOR_BRIGHT),
colorDefinition.getGradientBright_Default());

PreferenceConverter.setDefault(
store,
colorDefinition.getGraphPrefName(GraphColorManager.PREF_COLOR_DARK),
colorDefinition.getGradientDark_Default());

PreferenceConverter.setDefault(
store,
colorDefinition.getGraphPrefName(GraphColorManager.PREF_COLOR_LINE),
colorDefinition.getLineColor_Default());
}

/*
* Display formats
*/
store.setDefault(ICommonPreferences.DISPLAY_FORMAT_IS_LIVE_UPDATE, true);

store.setDefault(ICommonPreferences.DISPLAY_FORMAT_ALTITUDE, ValueFormat.NUMBER_1_0.name());
store.setDefault(ICommonPreferences.DISPLAY_FORMAT_CADENCE, ValueFormat.NUMBER_1_0.name());
store.setDefault(ICommonPreferences.DISPLAY_FORMAT_DISTANCE, ValueFormat.NUMBER_1_0.name());
store.setDefault(ICommonPreferences.DISPLAY_FORMAT_POWER, ValueFormat.NUMBER_1_0.name());
store.setDefault(ICommonPreferences.DISPLAY_FORMAT_PULSE, ValueFormat.NUMBER_1_0.name());
store.setDefault(ICommonPreferences.DISPLAY_FORMAT_SPEED, ValueFormat.NUMBER_1_0.name());

store.setDefault(ICommonPreferences.DISPLAY_FORMAT_DRIVING_TIME, ValueFormat.TIME_HH_MM.name());
store.setDefault(ICommonPreferences.DISPLAY_FORMAT_PAUSED_TIME, ValueFormat.TIME_HH_MM.name());
store.setDefault(ICommonPreferences.DISPLAY_FORMAT_RECORDING_TIME, ValueFormat.TIME_HH_MM.name());

/*
* Time zone
*/
final ZoneId defaultZoneId = ZoneId.systemDefault();
final String defaultId = defaultZoneId.getId();

store.setDefault(ICommonPreferences.TIME_ZONE_SELECTED_CUSTOM_ZONE, 1);
store.setDefault(ICommonPreferences.TIME_ZONE_IS_LIVE_UPDATE, true);
store.setDefault(ICommonPreferences.TIME_ZONE_IS_USE_SYSTEM_TIME_ZONE, true);
store.setDefault(ICommonPreferences.TIME_ZONE_LOCAL_ID, defaultId);
store.setDefault(ICommonPreferences.TIME_ZONE_LOCAL_ID_1, defaultId);
store.setDefault(ICommonPreferences.TIME_ZONE_LOCAL_ID_2, defaultId);
store.setDefault(ICommonPreferences.TIME_ZONE_LOCAL_ID_3, defaultId);

/*
* calendar week
*/
store.setDefault(ICommonPreferences.CALENDAR_WEEK_FIRST_DAY_OF_WEEK, DayOfWeek.MONDAY.getValue());
store.setDefault(ICommonPreferences.CALENDAR_WEEK_MIN_DAYS_IN_FIRST_WEEK, 4);
}
@Override
public void initializeDefaultPreferences() {

final IPreferenceStore store = CommonActivator.getPrefStore();

/*
* graph color preferences
*/
for (final ColorDefinition colorDefinition : GraphColorManager.getInstance().getGraphColorDefinitions()) {

PreferenceConverter.setDefault(
store,
colorDefinition.getGraphPrefName(GraphColorManager.PREF_COLOR_BRIGHT),
colorDefinition.getGradientBright_Default());

PreferenceConverter.setDefault(
store,
colorDefinition.getGraphPrefName(GraphColorManager.PREF_COLOR_DARK),
colorDefinition.getGradientDark_Default());

PreferenceConverter.setDefault(
store,
colorDefinition.getGraphPrefName(GraphColorManager.PREF_COLOR_LINE),
colorDefinition.getLineColor_Default());
}

/*
* Display formats
*/
store.setDefault(ICommonPreferences.DISPLAY_FORMAT_IS_LIVE_UPDATE, true);

store.setDefault(ICommonPreferences.DISPLAY_FORMAT_ALTITUDE, ValueFormat.NUMBER_1_0.name());
store.setDefault(ICommonPreferences.DISPLAY_FORMAT_CADENCE, ValueFormat.NUMBER_1_0.name());
store.setDefault(ICommonPreferences.DISPLAY_FORMAT_DISTANCE, ValueFormat.NUMBER_1_0.name());
store.setDefault(ICommonPreferences.DISPLAY_FORMAT_POWER, ValueFormat.NUMBER_1_0.name());
store.setDefault(ICommonPreferences.DISPLAY_FORMAT_PULSE, ValueFormat.NUMBER_1_0.name());
store.setDefault(ICommonPreferences.DISPLAY_FORMAT_SPEED, ValueFormat.NUMBER_1_0.name());

store.setDefault(ICommonPreferences.DISPLAY_FORMAT_ELAPSED_TIME, ValueFormat.TIME_HH_MM.name());
store.setDefault(ICommonPreferences.DISPLAY_FORMAT_RECORDED_TIME, ValueFormat.TIME_HH_MM.name());
store.setDefault(ICommonPreferences.DISPLAY_FORMAT_PAUSED_TIME, ValueFormat.TIME_HH_MM.name());
store.setDefault(ICommonPreferences.DISPLAY_FORMAT_MOVING_TIME, ValueFormat.TIME_HH_MM.name());
store.setDefault(ICommonPreferences.DISPLAY_FORMAT_BREAK_TIME, ValueFormat.TIME_HH_MM.name());

/*
* Time zone
*/
final ZoneId defaultZoneId = ZoneId.systemDefault();
final String defaultId = defaultZoneId.getId();

store.setDefault(ICommonPreferences.TIME_ZONE_SELECTED_CUSTOM_ZONE, 1);
store.setDefault(ICommonPreferences.TIME_ZONE_IS_LIVE_UPDATE, true);
store.setDefault(ICommonPreferences.TIME_ZONE_IS_USE_SYSTEM_TIME_ZONE, true);
store.setDefault(ICommonPreferences.TIME_ZONE_LOCAL_ID, defaultId);
store.setDefault(ICommonPreferences.TIME_ZONE_LOCAL_ID_1, defaultId);
store.setDefault(ICommonPreferences.TIME_ZONE_LOCAL_ID_2, defaultId);
store.setDefault(ICommonPreferences.TIME_ZONE_LOCAL_ID_3, defaultId);

/*
* calendar week
*/
store.setDefault(ICommonPreferences.CALENDAR_WEEK_FIRST_DAY_OF_WEEK, DayOfWeek.MONDAY.getValue());
store.setDefault(ICommonPreferences.CALENDAR_WEEK_MIN_DAYS_IN_FIRST_WEEK, 4);
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (C) 2005, 2016 Wolfgang Schramm and Contributors
* Copyright (C) 2005, 2020 Wolfgang Schramm and Contributors
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
Expand All @@ -17,40 +17,42 @@

public interface ICommonPreferences {

/*
* Colors
*/
public static final String GRAPH_COLORS = "graph.colors."; //$NON-NLS-1$

public static final String DISPLAY_FORMAT_ALTITUDE = "DISPLAY_FORMAT_ALTITUDE"; //$NON-NLS-1$
public static final String DISPLAY_FORMAT_CADENCE = "DISPLAY_FORMAT_CADENCE"; //$NON-NLS-1$
public static final String DISPLAY_FORMAT_DISTANCE = "DISPLAY_FORMAT_DISTANCE"; //$NON-NLS-1$
public static final String DISPLAY_FORMAT_POWER = "DISPLAY_FORMAT_POWER"; //$NON-NLS-1$
public static final String DISPLAY_FORMAT_PULSE = "DISPLAY_FORMAT_PULSE"; //$NON-NLS-1$
public static final String DISPLAY_FORMAT_SPEED = "DISPLAY_FORMAT_SPEED"; //$NON-NLS-1$

public static final String DISPLAY_FORMAT_DRIVING_TIME = "DISPLAY_FORMAT_DRIVING_TIME"; //$NON-NLS-1$
public static final String DISPLAY_FORMAT_PAUSED_TIME = "DISPLAY_FORMAT_PAUSED_TIME"; //$NON-NLS-1$
public static final String DISPLAY_FORMAT_RECORDING_TIME = "DISPLAY_FORMAT_RECORDING_TIME"; //$NON-NLS-1$

public static final String DISPLAY_FORMAT_IS_LIVE_UPDATE = "DISPLAY_FORMAT_IS_LIVE_UPDATE"; //$NON-NLS-1$

/*
* Timezone
*/
public static final String TIME_ZONE_IS_LIVE_UPDATE = "TIME_ZONE_IS_LIVE_UPDATE"; //$NON-NLS-1$
public static final String TIME_ZONE_IS_USE_SYSTEM_TIME_ZONE = "TIME_ZONE_IS_USE_SYSTEM_TIME_ZONE"; //$NON-NLS-1$
public static final String TIME_ZONE_LOCAL_ID = "TIME_ZONE_LOCAL_ID"; //$NON-NLS-1$
public static final String TIME_ZONE_LOCAL_ID_1 = "TIME_ZONE_LOCAL_ID_1"; //$NON-NLS-1$
public static final String TIME_ZONE_LOCAL_ID_2 = "TIME_ZONE_LOCAL_ID_2"; //$NON-NLS-1$
public static final String TIME_ZONE_LOCAL_ID_3 = "TIME_ZONE_LOCAL_ID_3"; //$NON-NLS-1$
public static final String TIME_ZONE_SELECTED_CUSTOM_ZONE = "TIME_ZONE_SELECTED_CUSTOM_ZONE"; //$NON-NLS-1$

/*
* Calendar week
*/
/** MO=1 .. SO=7 */
public static final String CALENDAR_WEEK_FIRST_DAY_OF_WEEK = "CALENDAR_WEEK_FIRST_DAY_OF_WEEK"; //$NON-NLS-1$
public static final String CALENDAR_WEEK_MIN_DAYS_IN_FIRST_WEEK = "CALENDAR_WEEK_MIN_DAYS_IN_FIRST_WEEK"; //$NON-NLS-1$
/*
* Colors
*/
public static final String GRAPH_COLORS = "graph.colors."; //$NON-NLS-1$

public static final String DISPLAY_FORMAT_ALTITUDE = "DISPLAY_FORMAT_ALTITUDE"; //$NON-NLS-1$
public static final String DISPLAY_FORMAT_CADENCE = "DISPLAY_FORMAT_CADENCE"; //$NON-NLS-1$
public static final String DISPLAY_FORMAT_DISTANCE = "DISPLAY_FORMAT_DISTANCE"; //$NON-NLS-1$
public static final String DISPLAY_FORMAT_POWER = "DISPLAY_FORMAT_POWER"; //$NON-NLS-1$
public static final String DISPLAY_FORMAT_PULSE = "DISPLAY_FORMAT_PULSE"; //$NON-NLS-1$
public static final String DISPLAY_FORMAT_SPEED = "DISPLAY_FORMAT_SPEED"; //$NON-NLS-1$

public static final String DISPLAY_FORMAT_ELAPSED_TIME = "DISPLAY_FORMAT_ELAPSED_TIME"; //$NON-NLS-1$
public static final String DISPLAY_FORMAT_RECORDED_TIME = "DISPLAY_FORMAT_RECORDED_TIME"; //$NON-NLS-1$
public static final String DISPLAY_FORMAT_PAUSED_TIME = "DISPLAY_FORMAT_PAUSED_TIME"; //$NON-NLS-1$
public static final String DISPLAY_FORMAT_MOVING_TIME = "DISPLAY_FORMAT_MOVING_TIME"; //$NON-NLS-1$
public static final String DISPLAY_FORMAT_BREAK_TIME = "DISPLAY_FORMAT_BREAK_TIME"; //$NON-NLS-1$

public static final String DISPLAY_FORMAT_IS_LIVE_UPDATE = "DISPLAY_FORMAT_IS_LIVE_UPDATE"; //$NON-NLS-1$

/*
* Timezone
*/
public static final String TIME_ZONE_IS_LIVE_UPDATE = "TIME_ZONE_IS_LIVE_UPDATE"; //$NON-NLS-1$
public static final String TIME_ZONE_IS_USE_SYSTEM_TIME_ZONE = "TIME_ZONE_IS_USE_SYSTEM_TIME_ZONE"; //$NON-NLS-1$
public static final String TIME_ZONE_LOCAL_ID = "TIME_ZONE_LOCAL_ID"; //$NON-NLS-1$
public static final String TIME_ZONE_LOCAL_ID_1 = "TIME_ZONE_LOCAL_ID_1"; //$NON-NLS-1$
public static final String TIME_ZONE_LOCAL_ID_2 = "TIME_ZONE_LOCAL_ID_2"; //$NON-NLS-1$
public static final String TIME_ZONE_LOCAL_ID_3 = "TIME_ZONE_LOCAL_ID_3"; //$NON-NLS-1$
public static final String TIME_ZONE_SELECTED_CUSTOM_ZONE = "TIME_ZONE_SELECTED_CUSTOM_ZONE"; //$NON-NLS-1$

/*
* Calendar week
*/
/** MO=1 .. SO=7 */
public static final String CALENDAR_WEEK_FIRST_DAY_OF_WEEK = "CALENDAR_WEEK_FIRST_DAY_OF_WEEK"; //$NON-NLS-1$
public static final String CALENDAR_WEEK_MIN_DAYS_IN_FIRST_WEEK = "CALENDAR_WEEK_MIN_DAYS_IN_FIRST_WEEK"; //$NON-NLS-1$

}
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,7 @@ private void actionOnProfile_Rename() {
*
* @param isSetDefaults
* When <code>true</code> then column properties are set from the default settings
* otherwiese they are copied from {@link #_columnViewerModel}
* otherwise they are copied from {@link #_columnViewerModel}
* @return Returns all {@link ColumnDefinition}s in default order/selection.
*/
private ArrayList<ColumnDefinition> cloneAllColumns(final boolean isSetDefaults) {
Expand Down Expand Up @@ -1033,7 +1033,7 @@ public boolean performDrop(final Object data) {
final Table filterTable = _columnViewer.getTable();

/*
* check if drag was startet from this item, remove the item before the new item
* check if drag was started from this item, remove the item before the new item
* is inserted
*/
if (LocalSelectionTransfer.getTransfer().getSelectionSetTime() == _dndDragStartViewerLeft) {
Expand Down Expand Up @@ -1663,7 +1663,7 @@ private void onProfileViewer_Select(final SelectionChangedEvent event) {
final ColumnProfile selectedProfile = getSelectedProfile();

if (selectedProfile == _selectedProfile) {
// no new selection, this occures when another profile is checked
// no new selection, this occurs when another profile is checked
return;
}

Expand Down

0 comments on commit 6bdffff

Please sign in to comment.