- MacOS case-insensitive file system confuses our Time.h with

/usr/include/time.h, so renamed the former.
- Bug fixes for when there is no power.zones file
This commit is contained in:
Sean C. Rhea
2007-04-26 20:10:21 +00:00
parent e103824538
commit 43cf7e0126
7 changed files with 29 additions and 24 deletions

View File

@@ -18,6 +18,7 @@
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <time.h>
#include "AllPlot.h"
#include "RawFile.h"
#include "Settings.h"

View File

@@ -5,14 +5,16 @@
TEMPLATE = app
TARGET +=
DEPENDPATH += .
INCLUDEPATH += /home/srhea/src/qwt-5.0.1/src ../lib ../srm ../cpint
INCLUDEPATH += /usr/local/qwt/include ../lib ../srm ../cpint
CONFIG += static debug
LIBS += /home/srhea/src/qwt-5.0.1/lib/libqwt.a
LIBS += /usr/local/qwt/lib/libqwt.a
LIBS += ../lib/libgc.a ../cpint/libcpint.a ../srm/libsrm.a
LIBS += -lm -lz
macx {
LIBS += -framework Carbon
}
QMAKE_CC=/usr/bin/gcc-4.0
QMAKE_CXX=/usr/bin/g++-4.0
# Input
HEADERS += \
@@ -26,7 +28,7 @@ HEADERS += \
PowerHist.h \
RawFile.h \
RideItem.h \
Time.h \
TimeUtils.h \
Zones.h
SOURCES += \
@@ -40,7 +42,7 @@ SOURCES += \
PowerHist.cpp \
RawFile.cpp \
RideItem.cpp \
Time.cpp \
TimeUtils.cpp \
Zones.cpp \
\
main.cpp

View File

@@ -27,7 +27,7 @@
#include "RawFile.h"
#include "RideItem.h"
#include "Settings.h"
#include "Time.h"
#include "TimeUtils.h"
#include "Zones.h"
#include <assert.h>
#include <QApplication>
@@ -44,7 +44,7 @@ static char *rideFileRegExp = ("^(\\d\\d\\d\\d)_(\\d\\d)_(\\d\\d)"
"_(\\d\\d)_(\\d\\d)_(\\d\\d)\\.(raw|srm)$");
MainWindow::MainWindow(const QDir &home) :
home(home), settings(GC_SETTINGS_CO, GC_SETTINGS_APP)
home(home), settings(GC_SETTINGS_CO, GC_SETTINGS_APP), zones(NULL)
{
setWindowTitle(home.dirName());
settings.setValue(GC_SETTINGS_LAST, home.dirName());
@@ -462,8 +462,8 @@ MainWindow::rideSelected()
double weeklyDistance = 0.0;
double weeklyWork = 0.0;
double *time_in_zone = NULL;
int zone_range = -1;
double *time_in_zone = NULL;
int num_zones = -1;
bool zones_ok = true;
@@ -475,17 +475,19 @@ MainWindow::rideSelected()
weeklySeconds += item->secsMovingOrPedaling();
weeklyDistance += item->totalDistance();
weeklyWork += item->totalWork();
if (zone_range == -1) {
zone_range = item->zoneRange();
num_zones = item->numZones();
time_in_zone = new double[num_zones];
}
else if (item->zoneRange() != zone_range) {
zones_ok = false;
}
if (zone_range != -1) {
for (int j = 0; j < num_zones; ++j)
time_in_zone[j] += item->timeInZone(j);
if (zones) {
if (zone_range == -1) {
zone_range = item->zoneRange();
num_zones = item->numZones();
time_in_zone = new double[num_zones];
}
else if (item->zoneRange() != zone_range) {
zones_ok = false;
}
if (zone_range != -1) {
for (int j = 0; j < num_zones; ++j)
time_in_zone[j] += item->timeInZone(j);
}
}
}
}

View File

@@ -21,7 +21,7 @@
#include "RideItem.h"
#include "RawFile.h"
#include "Settings.h"
#include "Time.h"
#include "TimeUtils.h"
#include "Zones.h"
#include <assert.h>
#include <math.h>

View File

@@ -1,5 +1,5 @@
#include "Time.h"
#include "TimeUtils.h"
#include <math.h>
QString time_to_string(double secs)

View File

@@ -18,13 +18,13 @@
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef _Time_h
#define _Time_h
#ifndef _TimeUtils_h
#define _TimeUtils_h
#include <QString>
QString interval_to_str(double secs); // output like 1h 2m 3s
QString time_to_string(double secs); // output like 1:02:03
#endif // _Time_h
#endif // _TimeUtils_h

View File

@@ -19,7 +19,7 @@
*/
#include "Zones.h"
#include "Time.h"
#include "TimeUtils.h"
#include <assert.h>
#include <math.h>