This commit is contained in:
Alejandro Martinez
2025-01-22 16:30:48 -03:00
10 changed files with 49 additions and 25 deletions

View File

@@ -75,7 +75,7 @@ const ant_sensor_type_t ANT::ant_sensor_types[] = {
{ true, ANTChannel::CHANNEL_TYPE_TEMPE, ANT_SPORT_TEMPE_PERIOD, ANT_SPORT_TEMPE_TYPE,
ANT_SPORT_FREQUENCY, ANT_SPORT_NETWORK_NUMBER, "Tempe", 't', ":images/IconTemp.png" },
{ true, ANTChannel::CHANNEL_TYPE_CORETEMP, ANT_SPORT_CORETEMP_PERIOD, ANT_SPORT_CORETEMP_TYPE,
ANT_SPORT_FREQUENCY, ANT_SPORT_NETWORK_NUMBER, "CoreTemp", 't', ":images/IconCore.png" },
ANT_SPORT_FREQUENCY, ANT_SPORT_NETWORK_NUMBER, "CoreTemp", 'e', ":images/IconCore.png" },
{ false, ANTChannel::CHANNEL_TYPE_GUARD, 0, 0, 0, 0, "", '\0', "" }
};

View File

@@ -904,7 +904,6 @@ void ANTChannel::broadcastEvent(unsigned char *ant_message)
case CHANNEL_TYPE_CORETEMP:
{
// Quality alternates messages so will need to remember last quality message
// only use core temp if data is 'good' or better (just use >0 for now)
if ( antMessage.coreTemp > 0 )
{

View File

@@ -621,12 +621,15 @@ ANTMessage::ANTMessage(ANT *parent, const unsigned char *message) {
case ANTChannel::CHANNEL_TYPE_CORETEMP:
{
static int tmpQual=0;
switch (data_page)
{
case 0:
tempQual = (message[6]&0x3);
// Quality only on intermittent messages so need to remember last quality message
tmpQual = (message[6]&0x3);
break;
case 1:
tempQual = tmpQual;
uint16_t val=(message[7]+((message[8] & 0xf0)<<4));
if (val>0 && val != 0x800)
skinTemp = val/20.0;

View File

@@ -286,6 +286,8 @@ QString GcCrashDialog::versionHTML()
.arg("quicktime")
#elif defined GC_VIDEO_QT5
.arg("qt5")
#elif defined GC_VIDEO_QT6
.arg("qt6")
#elif defined GC_VIDEO_VLC
.arg("vlc")
#else

View File

@@ -45,6 +45,7 @@ RealtimeData::RealtimeData()
trainerConfigRequired = false;
trainerBrakeFault = false;
memset(spinScan, 0, 24);
temp = 0.0;
}
void RealtimeData::setName(char *name)
@@ -530,7 +531,7 @@ double RealtimeData::value(DataSeries series) const
case Temp: return temp;
break;
case CoreTemp: return coreTemp;
break;

View File

@@ -23,11 +23,13 @@
#include <QString>
#include <QDebug>
#include "Context.h"
#include "VideoLayoutParser.h"
#include "MeterWidget.h"
VideoLayoutParser::VideoLayoutParser (QList<MeterWidget*>* metersWidget, QList<QString>* layoutNames, QWidget* VideoContainer)
: metersWidget(metersWidget), layoutNames(layoutNames), VideoContainer(VideoContainer)
VideoLayoutParser::VideoLayoutParser (QList<MeterWidget*>* metersWidget, QList<QString>* layoutNames, QWidget* VideoContainer, Context* context)
: metersWidget(metersWidget), layoutNames(layoutNames), VideoContainer(VideoContainer), context(context)
{
nonameindex = 0;
skipLayout = false;
@@ -191,7 +193,7 @@ bool VideoLayoutParser::startElement( const QString&, const QString&,
}
else if (meterType == QString("LiveMap"))
{
meterWidget = new LiveMapWidget(meterName, containerWidget, source);
meterWidget = new LiveMapWidget(meterName, containerWidget, source, context);
}
else
{

View File

@@ -23,6 +23,7 @@
#ifndef _VideoLayoutParser_h
#define _VideoLayoutParser_h
#include "GoldenCheetah.h"
class Context;
#include <QString>
#include <QXmlDefaultHandler>
@@ -32,7 +33,7 @@
class VideoLayoutParser : public QXmlDefaultHandler
{
public:
VideoLayoutParser(QList<MeterWidget*>* metersWidget, QList<QString>* layoutNames, QWidget* VideoContainer);
VideoLayoutParser(QList<MeterWidget*>* metersWidget, QList<QString>* layoutNames, QWidget* VideoContainer, Context* context);
bool startElement( const QString&, const QString&, const QString&, const QXmlAttributes& );
bool endElement( const QString&, const QString&, const QString& );
@@ -42,6 +43,8 @@ public:
int layoutPositionSelected;
private:
Context *context;
QList<MeterWidget*>* metersWidget;
QList<QString>* layoutNames;
QWidget* VideoContainer;

View File

@@ -142,7 +142,7 @@ VideoWindow::VideoWindow(Context *context) :
}
#endif
#ifdef GC_VIDEO_QT5
#if defined(GC_VIDEO_QT5)||defined(GC_VIDEO_QT6)
// USE QT VIDEO PLAYER
wd = new QVideoWidget(this);
wd->show();
@@ -198,7 +198,7 @@ VideoWindow::~VideoWindow()
vlcDispatch.Drain();
#endif
#ifdef GC_VIDEO_QT5
#if defined(GC_VIDEO_QT5)||defined(GC_VIDEO_QT6)
// QT MEDIA
delete mp;
delete wd;
@@ -225,6 +225,10 @@ bool VideoWindow::hasActiveVideo() const
if (mp->state() != QMediaPlayer::StoppedState)
return true;
#endif
#ifdef GC_VIDEO_QT6
if (mp->playbackState() != QMediaPlayer::StoppedState)
return true;
#endif
return false;
}
@@ -267,7 +271,7 @@ void VideoWindow::readVideoLayout(int pos, bool useDefault)
}
layoutNames.clear();
VideoLayoutParser handler(&m_metersWidget, &layoutNames, container);
VideoLayoutParser handler(&m_metersWidget, &layoutNames, container, context);
QXmlInputSource source(&file);
QXmlSimpleReader reader;
handler.layoutPositionSelected = pos;
@@ -342,7 +346,7 @@ void VideoWindow::startPlayback()
m_MediaChanged = false;
#endif
#ifdef GC_VIDEO_QT5
#if defined(GC_VIDEO_QT5)||defined(GC_VIDEO_QT6)
// open the media object
mp->play();
#endif
@@ -398,7 +402,7 @@ void VideoWindow::startPlayback()
}
}
#endif
#ifdef GC_VIDEO_QT5
#if defined(GC_VIDEO_QT5)||defined(GC_VIDEO_QT6)
// QT doesn't expose media frame rate so make due with duration.
double videoSyncDuration = currentVideoSyncFile->duration();
if (videoSyncDuration > 0) {
@@ -455,7 +459,7 @@ void VideoWindow::stopPlayback()
vlcDispatch.AsyncCall([capture_mp]{ libvlc_media_player_stop(capture_mp); });
#endif
#ifdef GC_VIDEO_QT5
#if defined(GC_VIDEO_QT5)||defined(GC_VIDEO_QT6)
mp->stop();
#endif
}
@@ -476,7 +480,7 @@ void VideoWindow::pausePlayback()
vlcDispatch.AsyncCall([capture_mp]{libvlc_media_player_set_pause(capture_mp, true); });
#endif
#ifdef GC_VIDEO_QT5
#if defined(GC_VIDEO_QT5)||defined(GC_VIDEO_QT6)
mp->pause();
#endif
}
@@ -499,7 +503,7 @@ void VideoWindow::resumePlayback()
}
#endif
#ifdef GC_VIDEO_QT5
#if defined(GC_VIDEO_QT5)||defined(GC_VIDEO_QT6)
mp->play();
#endif
@@ -798,7 +802,7 @@ void VideoWindow::telemetryUpdate(RealtimeData rtd)
}
#endif
#ifdef GC_VIDEO_QT5
#if defined(GC_VIDEO_QT5)||defined(GC_VIDEO_QT6)
//TODO
// // seek to ms position in current file
// mp->setPosition(ms);
@@ -831,7 +835,7 @@ void VideoWindow::seekPlayback(long ms)
}
#endif
#ifdef GC_VIDEO_QT5
#if defined(GC_VIDEO_QT5)||defined(GC_VIDEO_QT6)
Q_UNUSED(ms)
//TODO
// // seek to ms position in current file
@@ -891,6 +895,10 @@ void VideoWindow::mediaSelected(QString filename)
// QT MEDIA
mc = QMediaContent(QUrl::fromLocalFile(filename));
mp->setMedia(mc);
#endif
#ifdef GC_VIDEO_QT6
// QT MEDIA
mp->setSource(QUrl::fromLocalFile(filename));
#endif
if(context->isRunning) startPlayback();
}

View File

@@ -40,7 +40,7 @@
#ifdef Q_OS_MAC
// if we aint chosen one or the other then use quicktime
#if !defined GC_VIDEO_QUICKTIME && !defined GC_VIDEO_NONE && !defined GC_VIDEO_QT5 && !defined GC_VIDEO_VLC
#if !defined GC_VIDEO_QUICKTIME && !defined GC_VIDEO_NONE && !defined GC_VIDEO_QT5 && !defined GC_VIDEO_QT6 && !defined GC_VIDEO_VLC
#define GC_VIDEO_QUICKTIME
#endif
@@ -50,8 +50,8 @@
#endif
// but qt5 *is* supported, but use at your own risk!
#if defined GC_VIDEO_QT5
#warning "QT 5 video is supported experimentally in this version"
#if defined (GC_VIDEO_QT5) || defined (GC_VIDEO_QT6)
#warning "QT 5/6 video is supported experimentally in this version"
#endif
#endif //Q_OS_MAC
@@ -63,14 +63,14 @@
#if defined Q_OS_LINUX || defined Q_OS_WIN
// did the user specify location for VLC but not GC_VIDEO_XXXX
#if defined GC_HAVE_VLC && !defined GC_VIDEO_NONE && !defined GC_VIDEO_QT5
#if defined GC_HAVE_VLC && !defined GC_VIDEO_NONE && !defined GC_VIDEO_QT5 && !defined GC_VIDEO_QT6
#if !defined GC_VIDEO_VLC
#define GC_VIDEO_VLC
#endif
#endif
// if we aint chosen one or the other then use QT5
#if !defined GC_VIDEO_NONE && !defined GC_VIDEO_QT5 && !defined GC_VIDEO_VLC
#if !defined GC_VIDEO_NONE && !defined GC_VIDEO_QT5 && !defined GC_VIDEO_QT6 && !defined GC_VIDEO_VLC
#define GC_VIDEO_QT5
#endif
@@ -103,9 +103,12 @@ extern "C" {
#endif // VLC
#ifdef GC_VIDEO_QT5 // QT5 Video Stuff
#if defined(GC_VIDEO_QT5)||defined(GC_VIDEO_QT6) // QT5/6 Video Stuff
#include <QVideoWidget>
#include <QMediaPlayer>
#endif
#ifdef GC_VIDEO_QT5
#include <QMediaContent>
#endif
@@ -308,8 +311,10 @@ class VideoWindow : public GcChartWindow
#endif
#ifdef GC_VIDEO_QT5
// QT native
QMediaContent mc;
#endif
#if defined(GC_VIDEO_QT5) || defined(GC_VIDEO_QT6)
// QT native
QVideoWidget *wd;
QMediaPlayer *mp;
#endif

View File

@@ -246,6 +246,7 @@ macx {
DEFINES += GC_VIDEO_NONE # dont add any video playback support
#DEFINES += GC_VIDEO_QUICKTIME # mac only and the default
#DEFINES += GC_VIDEO_QT5 # use QT5 qvideowidget if QT > 5.2.1
#DEFINES += GC_VIDEO_QT6 # qt6 videowidget
#DEFINES += GC_VIDEO_VLC # use VideoLan library needs VLC_INSTALL defined above
#DEFINES += GC_VIDEO_AV # use AV Foundation on Mac now QTKit is deprecated