~ubuntu-branches/ubuntu/saucy/goldencheetah/saucy

« back to all changes in this revision

Viewing changes to src/HrPwWindow.h

  • Committer: Package Import Robot
  • Author(s): KURASHIKI Satoru
  • Date: 2013-08-18 07:02:45 UTC
  • mfrom: (4.1.8 sid)
  • Revision ID: package-import@ubuntu.com-20130818070245-zgdvb47e1k3mtgil
Tags: 3.0-3
debian/control: remove needless dependency. (Closes: #719571)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright (c) 2011 Damien Grauser
 
3
 *
 
4
 * This program is free software; you can redistribute it and/or modify it
 
5
 * under the terms of the GNU General Public License as published by the Free
 
6
 * Software Foundation; either version 2 of the License, or (at your option)
 
7
 * any later version.
 
8
 *
 
9
 * This program is distributed in the hope that it will be useful, but WITHOUT
 
10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 
11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
 
12
 * more details.
 
13
 *
 
14
 * You should have received a copy of the GNU General Public License along
 
15
 * with this program; if not, write to the Free Software Foundation, Inc., 51
 
16
 * Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 
17
 */
 
18
 
 
19
#ifndef _GC_HrPwWindow_h
 
20
#define _GC_HrPwWindow_h 1
 
21
 
 
22
#include <QWidget>
 
23
#include "GoldenCheetah.h"
 
24
 
 
25
 
 
26
class QCheckBox;
 
27
class QLineEdit;
 
28
class RideItem;
 
29
class HrPwPlot;
 
30
class MainWindow;
 
31
class SmallPlot;
 
32
class QSlider;
 
33
 
 
34
#include "LTMWindow.h" // for tooltip/canvaspicker
 
35
 
 
36
 
 
37
class HrPwWindow : public GcChartWindow
 
38
{
 
39
    Q_OBJECT
 
40
    G_OBJECT
 
41
 
 
42
    Q_PROPERTY(int shadeZones READ isShadeZones WRITE setShadeZones USER true)
 
43
    Q_PROPERTY(int joinLine READ isJoinLine WRITE setJoinLine USER true)
 
44
    Q_PROPERTY(int fullplot READ showFullplot WRITE setFullplot USER true)
 
45
 
 
46
    int isJoinLine() const { return joinlineCheckBox->checkState(); }
 
47
    void setJoinLine(int x) { joinlineCheckBox->setCheckState(x ? Qt::Checked : Qt::Unchecked); }
 
48
    int isShadeZones() const { return shadeZones->checkState(); }
 
49
    void setShadeZones(int x) { shadeZones->setCheckState(x ? Qt::Checked : Qt::Unchecked); }
 
50
    int showFullplot() const { return fullplot->checkState(); }
 
51
    void setFullplot(int x) { fullplot->setCheckState(x ? Qt::Checked : Qt::Unchecked); }
 
52
 
 
53
    public:
 
54
 
 
55
        HrPwWindow(MainWindow *mainWindow);
 
56
        void setData(RideItem *item);
 
57
        int findDelay(QVector<double> &wattsArray, QVector<double> &hrArray, int rideTimeSecs);
 
58
 
 
59
        // Maths functions used by HrPwPlot
 
60
        double pente(QVector<double> &Xi,QVector<double> &Yi,int n);
 
61
        double ordonnee(QVector<double> &Xi,QVector<double> &Yi,int n);
 
62
        double corr(QVector<double> &Xi, QVector<double> &Yi,int n);
 
63
        double moyenne(QVector<double> &Xi,int n);
 
64
 
 
65
        // reveal
 
66
        bool hasReveal() { return true; }
 
67
 
 
68
        int smooth;
 
69
 
 
70
    public slots:
 
71
        void rideSelected();
 
72
 
 
73
    protected slots:
 
74
        void setJoinLineFromCheckBox();
 
75
        void setDelayFromLineEdit();
 
76
        void setDelayFromSlider();
 
77
        void setSmoothingFromLineEdit();
 
78
        void setSmoothingFromSlider();
 
79
        void setrDelayFromLineEdit();
 
80
        void setrDelayFromSlider();
 
81
        void setrSmoothingFromLineEdit();
 
82
        void setrSmoothingFromSlider();
 
83
        void setShadeZones();
 
84
        void setSmooth(int);
 
85
        void showHidePlot();
 
86
        void setDelay(int);
 
87
 
 
88
    protected:
 
89
        MainWindow *mainWindow;
 
90
        HrPwPlot  *hrPwPlot;
 
91
        SmallPlot *smallPlot;
 
92
 
 
93
        RideItem *current;
 
94
 
 
95
        QCheckBox *joinlineCheckBox;
 
96
        QCheckBox *shadeZones;
 
97
        QCheckBox *fullplot;
 
98
 
 
99
        QSlider *delaySlider;
 
100
        QLineEdit *delayEdit;
 
101
 
 
102
        QSlider *smoothSlider;
 
103
        QLineEdit *smoothEdit;
 
104
 
 
105
    private:
 
106
        // reveal controls
 
107
        QLabel *rSmooth;
 
108
        QSlider *rSmoothSlider;
 
109
        QLineEdit *rSmoothEdit;
 
110
        QLabel *rDelay;
 
111
        QSlider *rDelaySlider;
 
112
        QLineEdit *rDelayEdit;
 
113
 
 
114
        // Maths functions used by the plots
 
115
        QVector<double> tab_temp; //Déclaration d'un tableau temporaire
 
116
        int test_zero(QVector<double> &tab,int n);
 
117
        int test_negatif(QVector<double> &tab,int n);
 
118
        void logtab(QVector<double> &tab,QVector<double> &tabTemp,int n);
 
119
        void lntab(QVector<double> &tab,QVector<double> &tabTemp,int n);
 
120
        void invtab(QVector<double> &tab,QVector<double> &tabTemp,int n);
 
121
        int ajustement(QVector<double> &Xi,QVector<double> &Yi,int n);
 
122
        double moyenne(QVector<int> &tab,int n);
 
123
        double moyenne2(double somme,int n);
 
124
        double val_abs(double x);
 
125
        int rmax(QVector<double> &r);
 
126
        int somme(QVector<int> &tab,int n);
 
127
        double somme(QVector<double> &tab,int n);
 
128
        void produittab(QVector<double> &tab1,QVector<double> &tab2,int n);
 
129
        void ecart_a_moyenne(QVector<double> &tab,double Moyenne,int n);
 
130
        double covariance(QVector<double> &Xi, QVector<double> &Yi,int n);
 
131
        double variance(QVector<double> &val,int n);
 
132
        double ecarttype(QVector<double> &val,int n);
 
133
};
 
134
 
 
135
#endif // _GC_HrPwWindow_h