More MSVC fixes plus cleanup warnings a bit

This commit is contained in:
Mark Watkins 2014-05-08 14:46:23 +10:00
parent 7d33a2c053
commit 38a8c7b1d0
29 changed files with 82 additions and 333 deletions

View File

@ -1,100 +0,0 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
* vim: set ts=8 sts=4 et sw=4 tw=99:
*
* Copyright (c) 2011-2014 Mark Watkins <jedimark@users.sourceforge.net>
*
* This file is subject to the terms and conditions of the GNU General Public
* License. See the file COPYING in the main directory of the Linux
* distribution for more details. */
#ifndef graphs_glbuffer_h
#define graphs_glbuffer_h
#include <QColor>
#include <QGLWidget>
#include <QMutex>
/*! \class GLBuffer
\brief Base Object to hold an OpenGL draw list
*/
class GLBuffer
{
public:
GLBuffer(int max = 2048, int type = GL_LINES, bool stippled = false)
: m_max(max), m_type(type), m_cnt(0), m_colcnt(0), m_size(1),
s1(0), s2(0), s3(0), s4(0),
m_scissor(false),
m_antialias(true),
m_forceantialias(false),
m_stippled(stippled),
m_blendfunc1(GL_SRC_ALPHA),
m_blendfunc2(GL_ONE_MINUS_SRC_ALPHA)
{ }
virtual ~GLBuffer() {}
void scissor(GLshort x1, GLshort y1, GLshort x2, GLshort y2) {
s1 = x1;
s2 = y1;
s3 = x2;
s4 = y2;
m_scissor = true;
}
int Max() const { return m_max; }
int cnt() const { return m_cnt; }
bool full() const { return m_cnt >= m_max; }
float size() const { return m_size; }
int type() const { return m_type; }
void reset() { m_cnt = 0; }
void setSize(float f) { m_size = f; }
void setAntiAlias(bool b) { m_antialias = b; }
void forceAntiAlias(bool b) { m_forceantialias = b; }
void setColor(QColor col) { m_color = col; }
void setBlendFunc(GLuint b1, GLuint b2) { m_blendfunc1 = b1; m_blendfunc2 = b2; }
virtual void draw() {}
protected:
int m_max;
int m_type; // type (GL_LINES, GL_QUADS, etc)
int m_cnt; // cnt
int m_colcnt;
QColor m_color;
float m_size;
int s1, s2, s3, s4;
bool m_scissor;
bool m_antialias;
bool m_forceantialias;
QMutex mutex;
bool m_stippled;
GLuint m_blendfunc1, m_blendfunc2;
};
/*! \class GLFloatBuffer
\brief Holds an OpenGL draw list composed of 32bit GLfloat objects and vertex colors
*/
class GLFloatBuffer : public GLBuffer
{
public:
GLFloatBuffer(int max = 2048, int type = GL_LINES, bool stippled = false);
virtual ~GLFloatBuffer();
// Add with vertex color(s).
void add(GLfloat x, GLfloat y, QColor &col);
void add(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2, QColor &col);
void add(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2,
GLfloat x3, GLfloat y3, GLfloat x4, GLfloat y4, QColor &col);
void quadGrTB(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2,
GLfloat x3, GLfloat y3, GLfloat x4, GLfloat y4, QColor &col, QColor &col2);
void quadGrLR(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2,
GLfloat x3, GLfloat y3, GLfloat x4, GLfloat y4, QColor &col, QColor &col2);
virtual void draw();
protected:
GLfloat *buffer;
GLubyte *colors;
};
#endif // graphs_glbuffer_h

View File

@ -14,7 +14,6 @@
#include <cmath>
#include "Graphs/gGraph.h"
#include "Graphs/gVertexBuffer.h"
#include "Graphs/gYAxis.h"
gShadowArea::gShadowArea(QColor shadow_color, QColor line_color)
@ -58,10 +57,11 @@ gFooBar::~gFooBar()
}
void gFooBar::paint(QPainter &painter, gGraph &w, int left, int top, int width, int height)
{
Q_UNUSED(top);
Q_UNUSED(left);
Q_UNUSED(width);
Q_UNUSED(height);
Q_UNUSED(top)
Q_UNUSED(left)
Q_UNUSED(width)
Q_UNUSED(height)
Q_UNUSED(painter)
if (!m_visible) { return; }

View File

@ -12,7 +12,6 @@
#ifndef GFOOBAR_H
#define GFOOBAR_H
#include "Graphs/gVertexBuffer.h"
#include "Graphs/layer.h"
/*! \class gShadowArea

View File

@ -893,9 +893,9 @@ void gGraphView::initializeGL()
{
setAutoFillBackground(false);
setAutoBufferSwap(false);
glDisable(GL_LIGHTING);
glDisable(GL_DEPTH_TEST);
glDisable(GL_TEXTURE_2D);
// glDisable(GL_LIGHTING);
// glDisable(GL_DEPTH_TEST);
// glDisable(GL_TEXTURE_2D);
if (cubeimg.size() > 0) {
cubetex = bindTexture(*cubeimg[0]);
@ -906,30 +906,32 @@ void gGraphView::initializeGL()
// texid[i]=bindTexture(*images[i]);
// }
glBindTexture(GL_TEXTURE_2D, 0);
// glBindTexture(GL_TEXTURE_2D, 0);
// glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR);
}
void gGraphView::resizeGL(int w, int h)
{
#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
float dpr = devicePixelRatio();
#else
float dpr = 1;
#endif
//void gGraphView::resizeGL(int w, int h)
//{
glViewport(0, 0, w / dpr, h / dpr);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
//#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
// float dpr = devicePixelRatio();
//#else
// float dpr = 1;
//#endif
glOrtho(0, w / dpr, h / dpr, 0, -1, 1);
// glViewport(0, 0, w / dpr, h / dpr);
// glMatrixMode(GL_PROJECTION);
// glLoadIdentity();
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
}
// glOrtho(0, w / dpr, h / dpr, 0, -1, 1);
// glMatrixMode(GL_MODELVIEW);
// glLoadIdentity();
//}
void gGraphView::renderCube(QPainter &painter, float alpha)
{
if (cubeimg.size() == 0) { return; }
// glPushMatrix();

View File

@ -323,8 +323,8 @@ class gGraphView : public QGLWidget
//! \brief Set up the OpenGL basics for the QGLWidget underneath
virtual void initializeGL();
//! \brief Resize the OpenGL ViewPort prior to redrawing
virtual void resizeGL(int width, int height);
// //! \brief Resize the OpenGL ViewPort prior to redrawing
//virtual void resizeGL(int width, int height);
//! \brief The heart of the OpenGL drawing code
virtual void paintGL();

View File

@ -14,7 +14,6 @@
#include <QVector>
#include "Graphs/gVertexBuffer.h"
#include "Graphs/layer.h"
#include "SleepLib/event.h"
#include "SleepLib/day.h"

View File

@ -291,7 +291,7 @@ void gLineOverlaySummary::paint(QPainter &painter, gGraph &w, int left, int top,
if (sph > 100) { sph = 100; }
}
a += " " + QObject::tr("(\%%1 in events)").arg(sph, 0, 'f',
a += " " + QObject::tr("(%%%1 in events)").arg(sph, 0, 'f',
2); // eg: %num of time in a span, like Periodic Breathing
}

View File

@ -19,6 +19,8 @@ gStatsLine::gStatsLine(ChannelID code, QString label, QColor textcolor)
}
void gStatsLine::paint(QPainter &painter, gGraph &w, int left, int top, int width, int height)
{
Q_UNUSED(painter)
if (!m_visible) { return; }
//if (m_empty) return;

View File

@ -43,8 +43,8 @@ void SummaryChart::SetDay(Day *nullday)
m_days.clear();
m_hours.clear();
m_goodcodes.clear();
m_miny = 999999999;
m_maxy = -999999999;
m_miny = 999999999.0F;
m_maxy = -999999999.0F;
m_physmaxy = 0;
m_physminy = 0;
m_minx = 0;
@ -382,8 +382,6 @@ void SummaryChart::paint(QPainter &painter, gGraph &w, int left, int top, int wi
{
if (!m_visible) { return; }
points->setSize(10);
GraphType graphtype = m_graphtype;
if (graphtype == GT_LINE || graphtype == GT_POINTS) {
@ -421,8 +419,6 @@ void SummaryChart::paint(QPainter &painter, gGraph &w, int left, int top, int wi
barw = (float(width) / float(days));
float dpr = w.graphView()->devicePixelRatio();
graph = &w;
float px = left;
l_left = w.marginLeft() + gYAxis::Margin;
@ -744,7 +740,7 @@ void SummaryChart::paint(QPainter &painter, gGraph &w, int left, int top, int wi
}
if (zd == hl_day) {
painter.setPen(QPen(col2,5));
painter.setPen(QPen(col2,10));
painter.drawPoint(px2 - barw / 2, py2);
}
@ -915,10 +911,7 @@ jumpnext:
w.renderText(a, legendx, top - 4);
// legendx-=bw/2;
int tp = top - 5 - bh / 2;
painter.fillRect(legendx - bw, top-w.marginTop()-1, bh, w.marginTop(), QBrush(m_colors[j]));
// w.quads()->add(legendx - bw, tp + bh / 2, legendx, tp + bh / 2, legendx, tp - bh / 2, legendx - bw,
// tp - bh / 2, m_colors[j].rgba());
legendx -= bw * 2;

View File

@ -79,10 +79,6 @@ class SummaryChart: public Layer
QHash<int, EventDataType> m_hours;
QHash<int, Day *> m_days;
gVertexBuffer *quads;
gVertexBuffer *lines;
gVertexBuffer *outlines;
gVertexBuffer *points;
bool m_empty;
int m_fday;
QString m_label;

View File

@ -1,128 +0,0 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
* vim: set ts=8 sts=4 et sw=4 tw=99:
*
* Copyright (c) 2011-2014 Mark Watkins <jedimark@users.sourceforge.net>
*
* This file is subject to the terms and conditions of the GNU General Public
* License. See the file COPYING in the main directory of the Linux
* distribution for more details. */
#ifndef graphs_gvertexbuffer_h
#define graphs_gvertexbuffer_h
#include <QtGlobal>
#include <QGLWidget>
#include "Graphs/glcommon.h"
typedef quint32 RGBA;
#ifdef BUILD_WITH_MSVC
__declspec(align(1))
#endif
struct gVertex {
gVertex(GLshort _x, GLshort _y, GLuint _c) { x = _x; y = _y; color = _c; }
GLshort x;
GLshort y;
RGBA color;
}
#ifndef BUILD_WITH_MSVC
__attribute__((packed))
#endif
;
class gVertexBuffer
{
public:
gVertexBuffer(int max = 2048, int type = GL_LINES)
: m_max(max), m_type(type), m_cnt(0), m_size(1),
m_scissor(false), m_antialias(false), m_forceantialias(false), m_stippled(false),
buffer(nullptr),
s_x(0), s_y(0), s_width(0), s_height(0),
m_color(0),
m_stipple(0xffff),
m_blendfunc1(GL_SRC_ALPHA),
m_blendfunc2(GL_ONE_MINUS_SRC_ALPHA)
{
// FIXME: sstangl: Really should not allocate in constructor.
buffer = (gVertex *)calloc(max, sizeof(gVertex));
}
~gVertexBuffer() {
if (buffer) {
free(buffer);
}
}
void add(GLshort x1, GLshort y1, RGBA color);
void add(GLshort x1, GLshort y1, GLshort x2, GLshort y2, RGBA color);
void add(GLshort x1, GLshort y1, GLshort x2, GLshort y2,
GLshort x3, GLshort y3, GLshort x4, GLshort y4, RGBA color);
void add(GLshort x1, GLshort y1, GLshort x2, GLshort y2,
GLshort x3, GLshort y3, GLshort x4, GLshort y4, RGBA color, RGBA color2);
void add(GLshort x1, GLshort y1);
void add(GLshort x1, GLshort y1, GLshort x2, GLshort y2);
void add(GLshort x1, GLshort y1, GLshort x2, GLshort y2,
GLshort x3, GLshort y3, GLshort x4, GLshort y4);
void unsafe_add(GLshort x1, GLshort y1);
void unsafe_add(GLshort x1, GLshort y1, GLshort x2, GLshort y2);
void unsafe_add(GLshort x1, GLshort y1, GLshort x2, GLshort y2,
GLshort x3, GLshort y3, GLshort x4, GLshort y4);
void draw();
void scissor(GLshort x, GLshort y, GLshort width, GLshort height) {
s_x = x;
s_y = y;
s_width = width;
s_height = height;
m_scissor = true;
}
int Max() const { return m_max; }
int cnt() const { return m_cnt; }
GLuint type() const { return m_type; }
float size() const { return m_size; }
bool full() const { return m_cnt >= m_max; }
void reset() { m_cnt = 0; }
void forceAntiAlias(bool b) { m_forceantialias = b; }
void setSize(float f) { m_size = f; }
void setAntiAlias(bool b) { m_antialias = b; }
void setStipple(GLshort stipple) { m_stipple = stipple; }
void setStippleOn(bool b) { m_stippled = b; }
void setBlendFunc(GLuint b1, GLuint b2) { m_blendfunc1 = b1; m_blendfunc2 = b2; }
void setColor(QColor col);
protected:
//! \brief Maximum number of gVertex points contained in buffer
int m_max;
//! \brief Indicates type of GL vertex information (GL_LINES, GL_QUADS, etc)
GLuint m_type;
//! \brief Count of Vertex points used this draw cycle.
int m_cnt;
//! \brief Line/Point thickness
float m_size;
bool m_scissor;
bool m_antialias;
bool m_forceantialias;
bool m_stippled;
//! \brief Contains list of Vertex & Color points
gVertex *buffer;
//! \brief GL Scissor parameters
GLshort s_x, s_y, s_width, s_height;
//! \brief Current drawing color
GLuint m_color;
//! \brief Stipple bitfield
GLshort m_stipple;
//! \brief Source GL Blend Function
GLuint m_blendfunc1;
//! \brief Destination GL Blend Function
GLuint m_blendfunc2;
};
#endif // graphs_gvertexbuffer_h

View File

@ -40,7 +40,6 @@ gXAxis::gXAxis(QColor col, bool fadeout)
m_show_major_ticks = true;
m_utcfix = false;
m_fadeout = fadeout;
m_textureID = 0;
// QDateTime d=QDateTime::currentDateTime();
// QTime t1=d.time();
// QTime t2=d.toUTC().time();
@ -75,9 +74,6 @@ void gXAxis::paint(QPainter &painter, gGraph &w, int left, int top, int width, i
if (!usepixmap || (usepixmap && w.invalidate_xAxisImage)) {
if (usepixmap) {
// Unbind any previous texture
if (m_textureID) { w.graphView()->deleteTexture(m_textureID); }
m_image = QImage(width + 22, height + 4, QImage::Format_ARGB32_Premultiplied);
m_image.fill(Qt::transparent);
painter2.begin(&m_image);

View File

@ -12,6 +12,7 @@
#ifndef GXAXIS_H
#define GXAXIS_H
#include <QImage>
#include "Graphs/layer.h"
/*! \class gXAxis
@ -51,6 +52,5 @@ class gXAxis: public Layer
float tz_hours;
QImage m_image;
GLuint m_textureID;
};
#endif // GXAXIS_H

View File

@ -143,8 +143,6 @@ gYAxis::gYAxis(QColor col)
{
m_line_color = col;
m_text_color = col;
m_textureID = 0;
m_yaxis_scale = 1;
}
gYAxis::~gYAxis()

View File

@ -12,6 +12,7 @@
#ifndef GYAXIS_H
#define GYAXIS_H
#include <QImage>
#include "Graphs/layer.h"
/*! \class gXGrid
@ -100,8 +101,6 @@ class gYAxis: public Layer
virtual bool mouseDoubleClickEvent(QMouseEvent *event, gGraph *graph);
QImage m_image;
GLuint m_textureID;
};
/*! \class gYAxisTime

View File

@ -16,8 +16,6 @@
#include <QVector>
#include <QWheelEvent>
#include "Graphs/GLBuffer.h"
#include "Graphs/gVertexBuffer.h"
#include "SleepLib/common.h"
#include "SleepLib/day.h"
#include "SleepLib/machine_common.h"

View File

@ -367,7 +367,7 @@ void FlowParser::calc(bool calcResp, bool calcTv, bool calcTi, bool calcTe, bool
if (calcResp) {
RR = m_session->AddEventList(CPAP_RespRate, EVL_Event);
minrr = RR->Min(), maxrr = RR->Max();
RR->setGain(0.2);
RR->setGain(0.2F);
RR->setFirst(time + minute);
RR->getData().resize(nm);
RR->getTime().resize(nm);
@ -391,12 +391,12 @@ void FlowParser::calc(bool calcResp, bool calcTv, bool calcTi, bool calcTe, bool
if (calcTi) {
Ti = m_session->AddEventList(CPAP_Ti, EVL_Event);
Ti->setGain(0.02);
Ti->setGain(0.02F);
}
if (calcTe) {
Te = m_session->AddEventList(CPAP_Te, EVL_Event);
Te->setGain(0.02);
Te->setGain(0.02F);
}
@ -641,13 +641,13 @@ void FlowParser::flagEvents()
//EventList * uf2=m_session->AddEventList(CPAP_UserFlag2,EVL_Event);
//EventList * uf3=m_session->AddEventList(CPAP_UserFlag3,EVL_Event);
const EventDataType perc = 0.6;
const EventDataType perc = 0.6F;
int idx = float(br.size()) * perc;
nth_element(br.begin(), br.begin() + idx, br.end() - 1);
EventDataType peak = br[idx]; //*(br.begin()+idx);
EventDataType cutoffval = peak * (PROFILE.cpap->userFlowRestriction() / 100.0);
EventDataType cutoffval = peak * (PROFILE.cpap->userFlowRestriction() / 100.0F);
int bs, bm, be, bs1, bm1, be1;
@ -906,14 +906,14 @@ int calcAHIGraph(Session *session)
f;
EventList *AHI = new EventList(EVL_Event);
AHI->setGain(0.02);
AHI->setGain(0.02F);
session->eventlist[CPAP_AHI].push_back(AHI);
EventList *RDI = nullptr;
if (calcrdi) {
RDI = new EventList(EVL_Event);
RDI->setGain(0.02);
RDI->setGain(0.02F);
session->eventlist[CPAP_RDI].push_back(RDI);
}
@ -926,7 +926,7 @@ int calcAHIGraph(Session *session)
int cnt = 0;
double events;
double hours = (window_size / 60.0);
double hours = (window_size / 60.0F);
if (zeroreset) {
// I personally don't see the point of resetting each hour.

View File

@ -305,7 +305,7 @@ EventDataType Day::percentile(ChannelID code, EventDataType percentile)
EventDataType Day::p90(ChannelID code)
{
return percentile(code, 0.90);
return percentile(code, 0.90F);
}
EventDataType Day::avg(ChannelID code)

View File

@ -22,8 +22,8 @@ EventList::EventList(EventListType et, EventDataType gain, EventDataType offset,
if (min == max) { // Update Min & Max unless forceably set here..
m_update_minmax = true;
m_min2 = m_min = 999999999;
m_max2 = m_max = -999999999;
m_min2 = m_min = 999999999.0F;
m_max2 = m_max = -999999999.0F;
} else {
m_update_minmax = false;
}
@ -35,8 +35,8 @@ EventList::EventList(EventListType et, EventDataType gain, EventDataType offset,
void EventList::clear()
{
m_min2 = m_min = 999999999;
m_max2 = m_max = -999999999;
m_min2 = m_min = 999999999.0F;
m_max2 = m_max = -999999999.0F;
m_update_minmax = true;
m_first = m_last = 0;
m_count = 0;
@ -310,7 +310,7 @@ void EventList::AddWaveform(qint64 start, char *data, int recs, qint64 duration)
if (m_update_minmax) {
for (sp = data; sp < ep; sp++) {
raw = *sp;
val = EventDataType(val) * m_gain + m_offset;
val = EventDataType(raw) * m_gain + m_offset;
if (m_min > val) { m_min = val; }
@ -321,7 +321,7 @@ void EventList::AddWaveform(qint64 start, char *data, int recs, qint64 duration)
} else {
for (sp = data; sp < ep; sp++) {
raw = *sp;
val = EventDataType(val) * m_gain + m_offset;
val = EventDataType(raw) * m_gain + m_offset;
*dp++ = raw;
}
}

View File

@ -121,6 +121,7 @@ int FPIconLoader::Open(QString &path, Profile *profile)
try {
if (m) { OpenMachine(m, npath, profile); }
} catch (OneTypePerDay e) {
Q_UNUSED(e)
profile->DelMachine(m);
MachList.erase(MachList.find(sn));
QMessageBox::warning(nullptr, "Import Error",
@ -477,9 +478,9 @@ bool FPIconLoader::OpenFLW(Machine *mach, QString filename, Profile *profile)
const double rate = 1000.0 / double(samples_per_block);
// F&P Overwrites this file, not appends to it.
flow = new EventList(EVL_Waveform, 1.0, 0, 0, 0, rate);
flow = new EventList(EVL_Waveform, 1.0F, 0, 0, 0, rate);
//leak=new EventList(EVL_Event,1.0,0,0,0,rate*double(samples_per_block)); // 1 per second
pressure = new EventList(EVL_Event, 0.01, 0, 0, 0,
pressure = new EventList(EVL_Event, 0.01F, 0, 0, 0,
rate * double(samples_per_block)); // 1 per second
flow->setFirst(ti);

View File

@ -288,6 +288,7 @@ int PRS1Loader::Open(QString &path, Profile *profile)
OpenMachine(m, newpath + "/" + (*sn), profile);
}
} catch (OneTypePerDay e) {
Q_UNUSED(e)
profile->DelMachine(m);
PRS1List.erase(PRS1List.find(s));
QMessageBox::warning(nullptr, QObject::tr("Import Error"),
@ -726,8 +727,6 @@ bool PRS1Loader::ParseSummary(Machine *mach, qint32 sequence, quint32 timestamp,
// Summary files vary too much between Families/versions
unsigned duration;
if (size < 59) {
// duration = data[offset + 0x12] | (data[offset + 0x13] << 8);
// duration *= 2;
@ -849,16 +848,16 @@ bool PRS1Loader::Parse002v5(qint32 sequence, quint32 timestamp, unsigned char *b
EventList *CSR = session->AddEventList(CPAP_CSR, EVL_Event);
EventList *LEAK = session->AddEventList(CPAP_LeakTotal, EVL_Event);
EventList *SNORE = session->AddEventList(CPAP_Snore, EVL_Event);
EventList *IPAP = session->AddEventList(CPAP_IPAP, EVL_Event, 0.1);
EventList *EPAP = session->AddEventList(CPAP_EPAP, EVL_Event, 0.1);
EventList *PS = session->AddEventList(CPAP_PS, EVL_Event, 0.1);
EventList *IPAPLo = session->AddEventList(CPAP_IPAPLo, EVL_Event, 0.1);
EventList *IPAPHi = session->AddEventList(CPAP_IPAPHi, EVL_Event, 0.1);
EventList *IPAP = session->AddEventList(CPAP_IPAP, EVL_Event, 0.1F);
EventList *EPAP = session->AddEventList(CPAP_EPAP, EVL_Event, 0.1F);
EventList *PS = session->AddEventList(CPAP_PS, EVL_Event, 0.1F);
EventList *IPAPLo = session->AddEventList(CPAP_IPAPLo, EVL_Event, 0.1F);
EventList *IPAPHi = session->AddEventList(CPAP_IPAPHi, EVL_Event, 0.1F);
EventList *RR = session->AddEventList(CPAP_RespRate, EVL_Event);
EventList *PTB = session->AddEventList(CPAP_PTB, EVL_Event);
EventList *MV = session->AddEventList(CPAP_MinuteVent, EVL_Event);
EventList *TV = session->AddEventList(CPAP_TidalVolume, EVL_Event, 10);
EventList *TV = session->AddEventList(CPAP_TidalVolume, EVL_Event, 10.0F);
EventList *CA = nullptr; //session->AddEventList(CPAP_ClearAirway, EVL_Event);
EventList *VS = nullptr, * FL = nullptr; //,* RE=nullptr,* VS2=nullptr;
@ -934,7 +933,7 @@ bool PRS1Loader::Parse002v5(qint32 sequence, quint32 timestamp, unsigned char *b
case 0x01: // Unknown
if (!Code[1]) {
if (!(Code[1] = session->AddEventList(cpapcode, EVL_Event, 0.1))) { return false; }
if (!(Code[1] = session->AddEventList(cpapcode, EVL_Event, 0.1F))) { return false; }
}
Code[1]->AddEvent(t, 0);
@ -1176,7 +1175,7 @@ bool PRS1Loader::Parse002(qint32 sequence, quint32 timestamp, unsigned char *buf
return false;
}
unsigned char code;
unsigned char code=0;
EventList *Code[0x20] = {0};
EventDataType data[10];
int cnt = 0;
@ -1263,7 +1262,7 @@ bool PRS1Loader::Parse002(qint32 sequence, quint32 timestamp, unsigned char *buf
if (family == 0 && familyVersion >= 4) {
if (!PRESSURE) {
PRESSURE = session->AddEventList(CPAP_Pressure, EVL_Event, 0.1);
PRESSURE = session->AddEventList(CPAP_Pressure, EVL_Event, 0.1F);
if (!PRESSURE) { return false; }
}
@ -1276,11 +1275,11 @@ bool PRS1Loader::Parse002(qint32 sequence, quint32 timestamp, unsigned char *buf
case 0x02: // Pressure
if (family == 0 && familyVersion >= 4) { // BiPAP Pressure
if (!EPAP) {
if (!(EPAP = session->AddEventList(CPAP_EPAP, EVL_Event, 0.1))) { return false; }
if (!(EPAP = session->AddEventList(CPAP_EPAP, EVL_Event, 0.1F))) { return false; }
if (!(IPAP = session->AddEventList(CPAP_IPAP, EVL_Event, 0.1))) { return false; }
if (!(IPAP = session->AddEventList(CPAP_IPAP, EVL_Event, 0.1F))) { return false; }
if (!(PS = session->AddEventList(CPAP_PS, EVL_Event, 0.1))) { return false; }
if (!(PS = session->AddEventList(CPAP_PS, EVL_Event, 0.1F))) { return false; }
}
EPAP->AddEvent(t, data[0] = buffer[pos++]);
@ -1288,7 +1287,7 @@ bool PRS1Loader::Parse002(qint32 sequence, quint32 timestamp, unsigned char *buf
PS->AddEvent(t, data[1] - data[0]);
} else {
if (!PRESSURE) {
PRESSURE = session->AddEventList(CPAP_Pressure, EVL_Event, 0.1);
PRESSURE = session->AddEventList(CPAP_Pressure, EVL_Event, 0.1F);
if (!PRESSURE) { return false; }
}
@ -1300,11 +1299,11 @@ bool PRS1Loader::Parse002(qint32 sequence, quint32 timestamp, unsigned char *buf
case 0x03: // BIPAP Pressure
if (!EPAP) {
if (!(EPAP = session->AddEventList(CPAP_EPAP, EVL_Event, 0.1))) { return false; }
if (!(EPAP = session->AddEventList(CPAP_EPAP, EVL_Event, 0.1F))) { return false; }
if (!(IPAP = session->AddEventList(CPAP_IPAP, EVL_Event, 0.1))) { return false; }
if (!(IPAP = session->AddEventList(CPAP_IPAP, EVL_Event, 0.1F))) { return false; }
if (!(PS = session->AddEventList(CPAP_PS, EVL_Event, 0.1))) { return false; }
if (!(PS = session->AddEventList(CPAP_PS, EVL_Event, 0.1F))) { return false; }
}
EPAP->AddEvent(t, data[0] = buffer[pos++]);
@ -1663,11 +1662,6 @@ bool PRS1Loader::OpenFile(Machine *mach, QString filename)
bool PRS1Loader::OpenWaveforms(SessionID sid, QString filename)
{
if (sid == 1532) {
int i=5;
}
Session *session = new_sessions[sid];
//int sequence,seconds,br,htype,version,numsignals;
QFile file(filename);

View File

@ -149,7 +149,7 @@ qint16 EDFParser::Read16()
QString EDFParser::Read(unsigned n)
{
if ((pos + n) > filesize) {
if ((pos + long(n)) > filesize) {
return "";
}

View File

@ -167,6 +167,7 @@ void Profile::LoadMachineData()
try {
m->Load();
} catch (OldDBVersion e) {
Q_UNUSED(e)
DataFormatError(m);
}
}

View File

@ -900,9 +900,9 @@ QString Daily::getOximeterInformation(Day * oxi)
html+="<tr><td colspan=5 align=center>&nbsp;</td></tr>";
html+="<tr><td colspan=5 align=center>"+oxi->machine->properties[STR_PROP_Brand]+" "+oxi->machine->properties[STR_PROP_Model]+"</td></tr>\n";
html+="<tr><td colspan=5 align=center>&nbsp;</td></tr>";
html+=QString("<tr><td colspan=5 align=center>%1: %2 (%3)\%</td></tr>").arg(tr("SpO2 Desaturations")).arg(oxi->count(OXI_SPO2Drop)).arg((100.0/oxi->hours()) * (oxi->sum(OXI_SPO2Drop)/3600.0),0,'f',2);
html+=QString("<tr><td colspan=5 align=center>%1: %2 (%3)\%</td></tr>").arg(tr("Pulse Change events")).arg(oxi->count(OXI_PulseChange)).arg((100.0/oxi->hours()) * (oxi->sum(OXI_PulseChange)/3600.0),0,'f',2);
html+=QString("<tr><td colspan=5 align=center>%1: %2\%</td></tr>").arg(tr("SpO2 Baseline Used")).arg(oxi->settings_wavg(OXI_SPO2Drop),0,'f',2); // CHECKME: Should this value be wavg OXI_SPO2 isntead?
html+=QString("<tr><td colspan=5 align=center>%1: %2 (%3)%%</td></tr>").arg(tr("SpO2 Desaturations")).arg(oxi->count(OXI_SPO2Drop)).arg((100.0/oxi->hours()) * (oxi->sum(OXI_SPO2Drop)/3600.0),0,'f',2);
html+=QString("<tr><td colspan=5 align=center>%1: %2 (%3)%%</td></tr>").arg(tr("Pulse Change events")).arg(oxi->count(OXI_PulseChange)).arg((100.0/oxi->hours()) * (oxi->sum(OXI_PulseChange)/3600.0),0,'f',2);
html+=QString("<tr><td colspan=5 align=center>%1: %2%%</td></tr>").arg(tr("SpO2 Baseline Used")).arg(oxi->settings_wavg(OXI_SPO2Drop),0,'f',2); // CHECKME: Should this value be wavg OXI_SPO2 isntead?
html+="</table>\n";
html+="<hr/>\n";
}

View File

@ -53,6 +53,7 @@ void MyOutputHandler(QtMsgType type, const char *msgtxt)
#else
void MyOutputHandler(QtMsgType type, const QMessageLogContext &context, const QString &msgtxt)
{
Q_UNUSED(context)
#endif
if (!mainwin) {

View File

@ -285,11 +285,14 @@ void MainWindow::Notify(QString s, QString title, int ms)
// As a workaround, add an extra line to bump the message back
// into the visible area.
QString msg = s;
#ifdef Q_OS_UNIX
char *desktop = getenv("DESKTOP_SESSION");
if (desktop && !strncmp(desktop, "gnome", 5)) {
msg += "\n";
}
#endif
systray->showMessage(title, msg, QSystemTrayIcon::Information, ms);
} else {

View File

@ -291,7 +291,7 @@ void Report::PrintReport(gGraphView *gv, QString name, QDate date)
2);
if (cpap->machine->GetClass() == STR_MACH_PRS1) {
stats += QObject::tr("REI=%1 VSI=%2 FLI=%3 PB/CSR=%4\%")
stats += QObject::tr("REI=%1 VSI=%2 FLI=%3 PB/CSR=%4%%")
.arg(rei, 0, 'f', 2).arg(vsi, 0, 'f', 2)
.arg(fli, 0, 'f', 2).arg(csr, 0, 'f', 2);
} else if (cpap->machine->GetClass() == STR_MACH_ResMed) {
@ -532,9 +532,6 @@ void Report::PrintReport(gGraphView *gv, QString name, QDate date)
int page = 1;
int gcnt = 0;
#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
float dpr = gv->devicePixelRatio();
#endif
for (int i = 0; i < graphs.size(); i++) {

View File

@ -153,7 +153,6 @@ HEADERS += \
Graphs/gFooBar.h \
Graphs/gGraph.h \
Graphs/gGraphView.h \
Graphs/GLBuffer.h \
Graphs/glcommon.h \
Graphs/gLineChart.h \
Graphs/gLineOverlay.h \
@ -161,7 +160,6 @@ HEADERS += \
Graphs/gspacer.h \
Graphs/gStatsLine.h \
Graphs/gSummaryChart.h \
Graphs/gVertexBuffer.h \
Graphs/gXAxis.h \
Graphs/gYAxis.h \
Graphs/layer.h \

View File

@ -1215,10 +1215,10 @@ QString StatisticsRow::value(QDate start, QDate end)
value = QString("%1").arg(p_profile->calcWavg(code, type, start, end), 0, 'f', decimals);
break;
case SC_MEDIAN:
value = QString("%1").arg(p_profile->calcPercentile(code, 0.5, type, start, end), 0, 'f', decimals);
value = QString("%1").arg(p_profile->calcPercentile(code, 0.5F, type, start, end), 0, 'f', decimals);
break;
case SC_90P:
value = QString("%1").arg(p_profile->calcPercentile(code, 0.9, type, start, end), 0, 'f', decimals);
value = QString("%1").arg(p_profile->calcPercentile(code, 0.9F, type, start, end), 0, 'f', decimals);
break;
case SC_MIN:
value = QString("%1").arg(p_profile->calcMin(code, type, start, end), 0, 'f', decimals);