mirror of
https://gitlab.com/pholy/OSCAR-code.git
synced 2025-04-05 10:40:42 +00:00
Dynamic Scaling
This commit is contained in:
parent
2b0845a32c
commit
f63bb39d54
@ -143,34 +143,10 @@ some messages from Apnea Board.
|
||||
//#define MAP_LOG_EVENTS
|
||||
//#define ENABLE_UNEVEN_MACHINE_MIN_MAX_TEST
|
||||
|
||||
// <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
|
||||
/ <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
|
||||
// Define Display macros to enhance displays
|
||||
|
||||
|
||||
#define DEBUGQ qDebug()
|
||||
#define DEBUGT qDebug()<<QDateTime::currentDateTime().time().toString("hh:mm:ss.zzz") << QString(basename( __FILE__)).remove(QRegularExpression("\\..*$")) << __LINE__
|
||||
#define DEBUGF qDebug()<<QString(basename( __FILE__)).remove(QRegularExpression("\\..*$")) << __LINE__ << __func__
|
||||
#define DEBUGTF qDebug()<<QDateTime::currentDateTime().time().toString("hh:mm:ss.zzz") << QString(basename( __FILE__)).remove(QRegularExpression("\\..*$")) << __LINE__ << __func__
|
||||
|
||||
#include <QRegularExpression>
|
||||
#define DEBUG qDebug()<<QString(basename( __FILE__)).remove(QRegularExpression("\\..*$")) << __LINE__
|
||||
#define TIMEO( DD , XX ) " " #DD ":" << QDateTime::fromMSecsSinceEpoch( XX ).time().toString("hh:mm:ss.zzz")
|
||||
#define TIME( XX ) QDateTime::fromMSecsSinceEpoch( XX ).time().toString("hh:mm:ss.zzz")
|
||||
#define O( XX ) " " #XX ":" << XX
|
||||
#define OO( XX , YY ) " " #XX ":" << YY
|
||||
#define FULLNAME( id) schema::channel[ id ].fullname()
|
||||
#define PLACE (QString(basename( __FILE__)).remove(QRegularExpression("\\..*$"))) << __LINE__
|
||||
|
||||
#define DATETIME( XX ) QDateTime::fromMSecsSinceEpoch( XX ).toString("dd MMM yyyy hh:mm:ss.zzz")
|
||||
#define DATE( XX ) QDateTime::fromMSecsSinceEpoch( XX ).toString("dd MMM yyyy")
|
||||
#define DATEO( XX ) " " #XX ":" << QDateTime::fromMSecsSinceEpoch( XX ).toString("dd MMM yyyy")
|
||||
#define TIME2( XX ) " " #XX ":" << XX << QDateTime::fromMSecsSinceEpoch( XX ).time().toString("hh:mm:ss.zzz")
|
||||
#define NAME( id) schema::channel[ id ].label()
|
||||
|
||||
//#define ENABLE_TEST_NODATA // no valid samples.
|
||||
//#define ENABLE_TEST_SINGLE // a single value.
|
||||
//#define ENABLE_TEST_CPAP // change all values to a single value.
|
||||
//#define ENABLE_TEST_SAWTOOTH // change all sample time and value to a sawtooth
|
||||
#endif
|
||||
// <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
|
||||
|
||||
@ -180,6 +156,9 @@ some messages from Apnea Board.
|
||||
#define test_data(A,B,C,D,E,F,G,H)
|
||||
#endif
|
||||
|
||||
#define TEST_MACROS_ENABLEDoff
|
||||
#include "test_macros.h"
|
||||
|
||||
// <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
|
||||
// <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
|
||||
// <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
|
||||
@ -553,7 +532,6 @@ void RecalcMAP::updateTimesValues(qint64 d1,qint64 d2, int key,PressureInfo & in
|
||||
|
||||
//! \brief Updates Time At Pressure from session *sess
|
||||
void RecalcMAP::updateTimes(PressureInfo & info) {
|
||||
//DEBUGF <<DATETIME(sessStartTime) << "CALLED" <<TIME(sessStartTime) <<TIME(sessEndTime);
|
||||
qint64 d1,d2;
|
||||
qint64 minx=0,maxx=0;
|
||||
//qint64 prevSessDuration=info.totalDuration;
|
||||
@ -1080,7 +1058,6 @@ void MinutesAtPressure::setEnabled(gGraph &graph) {
|
||||
} else {
|
||||
value &= pressureGraphLC->m_flags_enabled[ch];
|
||||
}
|
||||
//DEBUGF << FULLNAME(ch) << O(value);
|
||||
m_enabled[ch]=value;
|
||||
}
|
||||
};
|
||||
|
@ -7,6 +7,9 @@
|
||||
* License. See the file COPYING in the main directory of the source code
|
||||
* for more details. */
|
||||
|
||||
#define TEST_MACROS_ENABLEDoff
|
||||
#include "test_macros.h"
|
||||
|
||||
#include "Graphs/gGraph.h"
|
||||
|
||||
#include <QLabel>
|
||||
@ -131,6 +134,7 @@ gGraph::gGraph(QString name, gGraphView *graphview, QString title, QString units
|
||||
m_units(units),
|
||||
m_visible(true)
|
||||
{
|
||||
// DEBUGF Q(name) Q(title) QQ("UNITS",units) Q(height) Q(group);
|
||||
if (height == 0) {
|
||||
height = AppSetting->graphHeight();
|
||||
Q_UNUSED(height)
|
||||
@ -153,7 +157,7 @@ gGraph::gGraph(QString name, gGraphView *graphview, QString title, QString units
|
||||
min_x = min_y = 0;
|
||||
rec_miny = rec_maxy = 0;
|
||||
rphysmax_y = rphysmin_y = 0;
|
||||
m_zoomY = 0;
|
||||
m_zoomY = ZS_AUTO_FIT;
|
||||
m_selectedDuration = 0;
|
||||
|
||||
if (graphview) {
|
||||
@ -281,9 +285,23 @@ void gGraph::setDay(Day *day)
|
||||
// ResetBounds();
|
||||
}
|
||||
|
||||
void gGraph::setZoomY(short zoom)
|
||||
{
|
||||
m_zoomY = zoom;
|
||||
void gGraph::setZoomY(ZoomyScaling zoomy) {
|
||||
m_zoomY = zoomy;
|
||||
dynamicScalingOn =false;
|
||||
timedRedraw(0);
|
||||
}
|
||||
|
||||
void gGraph::mouseDoubleClickYAxis(QMouseEvent * ) {
|
||||
if ( isDynamicScalingEnabled() ) {
|
||||
dynamicScalingOn = !dynamicScalingOn;
|
||||
} else {
|
||||
dynamicScalingOn =false;
|
||||
if (m_zoomY == ZS_AUTO_FIT ) {
|
||||
m_zoomY = ZS_DEFAULT;
|
||||
} else if (m_zoomY == ZS_DEFAULT) {
|
||||
m_zoomY = ZS_AUTO_FIT ;
|
||||
}
|
||||
}
|
||||
timedRedraw(0);
|
||||
}
|
||||
|
||||
@ -564,22 +582,67 @@ void gGraph::ToolTip(QString text, int x, int y, ToolTipAlignment align, int tim
|
||||
m_graphview->m_tooltip->display(text, x, y, align, timeout);
|
||||
}
|
||||
|
||||
bool gGraph::isDynamicScalingEnabled() {
|
||||
return ((m_lineChart_layer!=nullptr) && AppSetting->allowYAxisScaling() );
|
||||
}
|
||||
|
||||
QString gGraph::unitsTooltip() {
|
||||
if (isDynamicScalingEnabled()) {
|
||||
if(dynamicScalingOn) {
|
||||
if (zoomY() == ZS_AUTO_FIT ) {
|
||||
return QString("%1%2%3").arg(m_units).arg("\n").arg(tr("Double click Y-axis: Return to AUTO-FIT Scaling"));
|
||||
} else if (zoomY() == ZS_DEFAULT ) {
|
||||
return QString("%1%2%3").arg(m_units).arg("\n").arg(tr("Double click Y-axis: Return to DEFAULT Scaling"));
|
||||
} else {
|
||||
return QString("%1%2%3").arg(m_units).arg("\n").arg(tr("Double click Y-axis: Return to OVERRIDE Scaling"));
|
||||
}
|
||||
} else {
|
||||
return QString("%1%2%3").arg(m_units).arg("\n").arg(tr("Double click Y-axis: For Dynamic Scaling"));
|
||||
}
|
||||
} else {
|
||||
if (zoomY() == ZS_AUTO_FIT ) {
|
||||
return QString("%1%2%3").arg(m_units).arg("\n").arg(tr("Double click Y-axis: Select DEFAULT Scaling"));
|
||||
} else if (zoomY() == ZS_DEFAULT ) {
|
||||
return QString("%1%2%3").arg(m_units).arg("\n").arg(tr("Double click Y-axis: Select AUTO-FIT Scaling"));
|
||||
}
|
||||
}
|
||||
return m_units;
|
||||
}
|
||||
|
||||
void gGraph::dynamicScaling(EventDataType &miny, EventDataType &maxy) {
|
||||
// Have new Dynamic mode;
|
||||
miny = m_lineChart_layer->actualMinY();
|
||||
maxy = m_lineChart_layer->actualMaxY();
|
||||
EventDataType diff= (maxy-miny);
|
||||
maxy += diff*0.08; // more space at top for event ticks.
|
||||
miny -= diff*0.04;
|
||||
if (m_saved_minY!=m_lineChart_layer->actualMinY() || m_saved_maxY!=m_lineChart_layer->actualMaxY() ) {
|
||||
// DEBUGF O(m_name) Q(m_saved_minY) QQ("==>",m_lineChart_layer->actualMinY() ) QQ("==>",miny) Q(m_saved_maxY) QQ("==>",m_lineChart_layer->actualMaxY() ) QQ("==>",maxy);
|
||||
m_saved_minY=m_lineChart_layer->actualMinY();
|
||||
m_saved_maxY=m_lineChart_layer->actualMaxY();
|
||||
}
|
||||
}
|
||||
|
||||
// YAxis Autoscaling code
|
||||
void gGraph::roundY(EventDataType &miny, EventDataType &maxy)
|
||||
{
|
||||
|
||||
if (zoomY() == 2) {
|
||||
if (dynamicScalingOn) {
|
||||
dynamicScaling(miny, maxy) ;
|
||||
if (maxy > miny) return;
|
||||
};
|
||||
if (zoomY() == ZS_OVERRIDE) { // Have override mode
|
||||
// set min and max to override values.
|
||||
miny = rec_miny;
|
||||
maxy = rec_maxy;
|
||||
if (maxy > miny) return;
|
||||
} else if (zoomY() ==1) {
|
||||
if (maxy > miny) return; // Not Autoscaling
|
||||
} else if (zoomY() ==ZS_DEFAULT) { // Have Default mode
|
||||
// set min and max to physical Min / max values.
|
||||
miny = physMinY();
|
||||
maxy = physMaxY();
|
||||
if (maxy > miny) return;
|
||||
if (maxy > miny) return; // Not Autoscaling
|
||||
}
|
||||
miny = MinY();
|
||||
maxy = MaxY();
|
||||
|
||||
int m, t;
|
||||
bool ymin_good = false, ymax_good = false;
|
||||
|
||||
@ -685,6 +748,11 @@ void gGraph::AddLayer(Layer *l, LayerPosition position, short width, short heigh
|
||||
l->setPos(x, y);
|
||||
l->addref();
|
||||
m_layers.push_back(l);
|
||||
|
||||
if (l->layerType()==LT_LineChart) {
|
||||
m_lineChart_layer = dynamic_cast<gLineChart *>(l);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void gGraph::dataChanged()
|
||||
@ -1111,24 +1179,6 @@ void gGraph::mouseDoubleClickEvent(QMouseEvent *event)
|
||||
layer->mouseDoubleClickEvent(event, this);
|
||||
}
|
||||
}
|
||||
|
||||
//int w=m_lastbounds.width()-(m_marginleft+left+right+m_marginright);
|
||||
//int h=m_lastbounds.height()-(bottom+m_marginbottom);
|
||||
//int x2=m_graphview->pointClicked().x(),y2=m_graphview->pointClicked().y();
|
||||
// if ((m_graphview->horizTravel()<mouse_movement_threshold) && (x>left+m_marginleft && x<w+m_marginleft+left && y>top+m_margintop && y<h)) { // normal click in main area
|
||||
// if (event->button() & Qt::RightButton) {
|
||||
// ZoomX(1.66,x); // Zoon out
|
||||
// return;
|
||||
// } else if (event->button() & Qt::LeftButton) {
|
||||
// ZoomX(0.75/2.0,x); // zoom in.
|
||||
// return;
|
||||
// }
|
||||
// } else {
|
||||
// Propagate the events to graph Layers
|
||||
// }
|
||||
//mousePressEvent(event);
|
||||
//mouseReleaseEvent(event);
|
||||
//qDebug() << m_title << "Double Clicked" << event->x() << event->y();
|
||||
}
|
||||
void gGraph::keyPressEvent(QKeyEvent *event)
|
||||
{
|
||||
@ -1416,16 +1466,14 @@ void gGraph::SetMaxY(EventDataType v)
|
||||
|
||||
Layer *gGraph::getLineChart()
|
||||
{
|
||||
gLineChart *lc;
|
||||
|
||||
if (m_lineChart_layer) return m_lineChart_layer;
|
||||
for (auto & layer : m_layers) {
|
||||
lc = dynamic_cast<gLineChart *>(layer);
|
||||
|
||||
if (lc) { return lc; }
|
||||
Layer *tmp = dynamic_cast<gLineChart *>(layer);
|
||||
if (tmp) m_lineChart_layer = tmp;
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
int gGraph::minHeight()
|
||||
{
|
||||
int minheight = m_min_height;
|
||||
|
@ -35,6 +35,8 @@ void DestroyGraphGlobals();
|
||||
|
||||
const int mouse_movement_threshold = 6;
|
||||
|
||||
enum ZoomyScaling {ZS_AUTO_FIT =0 , ZS_DEFAULT =1 , ZS_OVERRIDE =2};
|
||||
|
||||
float CatmullRomSpline(float p0, float p1, float p2, float p3, float t = 0.5);
|
||||
|
||||
inline void GetTextExtent(QString text, int &width, int &height, QFont *font)
|
||||
@ -164,6 +166,9 @@ class gGraph : public QObject
|
||||
//! \brief Returns the measurement Units the Y scale is referring to
|
||||
QString units() { return m_units; }
|
||||
|
||||
//! \brief Returns the measurement Units the Y scale is referring to plus tooltip.
|
||||
QString unitsTooltip() ;
|
||||
|
||||
//! \brief Sets the measurement Units the Y scale is referring to
|
||||
void setUnits(const QString units) { m_units = units; }
|
||||
|
||||
@ -303,9 +308,14 @@ class gGraph : public QObject
|
||||
bool isSnapshot() { return m_snapshot; }
|
||||
void setSnapshot(bool b) { m_snapshot = b; }
|
||||
|
||||
// returns if graph is a daily line chart with Dynamic Scaling mode enabled.
|
||||
bool isDynamicScalingEnabled();
|
||||
|
||||
short left, right, top, bottom; // dirty magin hacks..
|
||||
|
||||
Layer *getLineChart();
|
||||
Layer *m_lineChart_layer =nullptr ;
|
||||
bool dynamicScalingOn =false;
|
||||
QTimer *timer;
|
||||
|
||||
// This gets set to true to force a redraw of the yAxis tickers when graphs are resized.
|
||||
@ -318,10 +328,8 @@ class gGraph : public QObject
|
||||
gGraphView *graphView() { return m_graphview; }
|
||||
short m_marginleft, m_marginright, m_margintop, m_marginbottom;
|
||||
|
||||
inline short zoomY() { return m_zoomY; }
|
||||
void setZoomY(short zoom);
|
||||
|
||||
static const short maxZoomY = 2;
|
||||
inline ZoomyScaling zoomY() { return m_zoomY; }
|
||||
void setZoomY(ZoomyScaling zoomy);
|
||||
|
||||
inline qint64 selectedDuration() const { return m_selectedDuration; }
|
||||
inline QString selDurString() const { return m_selDurString; }
|
||||
@ -331,6 +339,8 @@ class gGraph : public QObject
|
||||
|
||||
inline bool printing() const { return m_printing; }
|
||||
|
||||
void mouseDoubleClickYAxis(QMouseEvent *event);
|
||||
|
||||
protected:
|
||||
//! \brief Mouse Wheel events
|
||||
virtual void wheelEvent(QWheelEvent *event);
|
||||
@ -353,6 +363,8 @@ class gGraph : public QObject
|
||||
//! \brief Key Pressed event
|
||||
virtual void keyReleaseEvent(QKeyEvent *event);
|
||||
|
||||
void dynamicScaling(EventDataType &miny, EventDataType &maxy);
|
||||
|
||||
void cancelSelection() {
|
||||
m_selecting_area = false;
|
||||
m_selection = QRect(0,0,0,0);
|
||||
@ -389,7 +401,7 @@ class gGraph : public QObject
|
||||
bool m_showTitle;
|
||||
bool m_printing;
|
||||
bool m_pinned;
|
||||
short m_zoomY;
|
||||
ZoomyScaling m_zoomY;
|
||||
bool m_block_select;
|
||||
QRect m_rect;
|
||||
|
||||
@ -401,6 +413,8 @@ class gGraph : public QObject
|
||||
QString m_selDurString;
|
||||
|
||||
bool m_snapshot;
|
||||
EventDataType m_saved_minY=0;
|
||||
EventDataType m_saved_maxY=0;
|
||||
|
||||
protected slots:
|
||||
//! \brief Deselects any highlights, and schedules a main gGraphView redraw
|
||||
|
@ -7,21 +7,9 @@
|
||||
* License. See the file COPYING in the main directory of the source code
|
||||
* for more details. */
|
||||
|
||||
#define xDEBUG_FUNCTIONS
|
||||
#ifdef DEBUG_FUNCTIONS
|
||||
#include <QRegularExpression>
|
||||
#define DEBUG qDebug()<<QString(basename( __FILE__)).remove(QRegularExpression("\\..*$")) << __LINE__
|
||||
#define DEBUGTF qDebug()<<QDateTime::currentDateTime().time().toString("hh:mm:ss.zzz") << QString(basename( __FILE__)).remove(QRegularExpression("\\..*$")) << __LINE__ << __func__
|
||||
#define DEBUGF qDebug()<< QString("%1[%2]%3").arg( QString(basename( __FILE__)).remove(QRegularExpression("\\..*$")) ).arg(__LINE__).arg(__func__)
|
||||
#define TEST_MACROS_ENABLEDoff
|
||||
#include "test_macros.h"
|
||||
|
||||
#define O( XX ) " " #XX ":" << XX
|
||||
#define Q( XX ) << #XX ":" << XX
|
||||
#define R( XX )
|
||||
#define OO( XX , YY ) " " #XX ":" << YY
|
||||
#define NAME( id) schema::channel[ id ].label()
|
||||
#define DATE( XX ) QDateTime::fromMSecsSinceEpoch(XX).toString("dd MMM yyyy")
|
||||
#define DATETIME( XX ) QDateTime::fromMSecsSinceEpoch(XX).toString("dd MMM yyyy hh:mm:ss.zzz")
|
||||
#endif
|
||||
|
||||
#include "Graphs/gGraphView.h"
|
||||
|
||||
@ -198,13 +186,13 @@ QRect gToolTip::calculateRect(QPainter &painter)
|
||||
rect.setTop(rect.top()-bot);
|
||||
rect.setBottom(m_graphview->height());
|
||||
}
|
||||
return rect;
|
||||
return rect;
|
||||
}
|
||||
|
||||
void gToolTip::paint(QPainter &painter) //actually paints it.
|
||||
{
|
||||
if (!m_visible) { return; }
|
||||
QRect a_rect=calculateRect(painter);
|
||||
QRect a_rect=calculateRect(painter);
|
||||
|
||||
QBrush brush(QColor(255, 255, 128, 230));
|
||||
brush.setStyle(Qt::SolidPattern);
|
||||
@ -233,22 +221,22 @@ void gToolTip::timerDone()
|
||||
locate tool tips in an appropiate location.
|
||||
*/
|
||||
gParentToolTip::gParentToolTip(gGraphView *graphview)
|
||||
: gToolTip(graphview) {
|
||||
m_parent_visible=false;
|
||||
: gToolTip(graphview) {
|
||||
m_parent_visible=false;
|
||||
}
|
||||
|
||||
gParentToolTip::~gParentToolTip() {
|
||||
}
|
||||
|
||||
void gParentToolTip::display(gGraphView* gv,QString text, int verticalOffset, int alignOffset, ToolTipAlignment align , int timeout ,QFont *font ) {
|
||||
m_text=text;
|
||||
m_verticalOffset=verticalOffset;
|
||||
m_alignOffset=alignOffset;
|
||||
m_alignment=align;
|
||||
m_timeout=timeout;
|
||||
m_font=font;
|
||||
m_parent_visible=true;
|
||||
gv->timedRedraw(0);
|
||||
m_text=text;
|
||||
m_verticalOffset=verticalOffset;
|
||||
m_alignOffset=alignOffset;
|
||||
m_alignment=align;
|
||||
m_timeout=timeout;
|
||||
m_font=font;
|
||||
m_parent_visible=true;
|
||||
gv->timedRedraw(0);
|
||||
};
|
||||
|
||||
|
||||
@ -257,52 +245,52 @@ QRect gParentToolTip::calculateRect(QPainter& painter ) {
|
||||
painter.setFont(*m_font);
|
||||
rect = painter.boundingRect(rect, m_alignment, m_text);
|
||||
|
||||
// update space arround text
|
||||
int space=2*m_spacer;
|
||||
rect.setHeight(space+rect.height());
|
||||
rect.setWidth(space+rect.width());
|
||||
// update space arround text
|
||||
int space=2*m_spacer;
|
||||
rect.setHeight(space+rect.height());
|
||||
rect.setWidth(space+rect.width());
|
||||
|
||||
rect.moveTo(m_alignOffset,m_height-(m_verticalOffset+rect.height()));
|
||||
rect.moveTo(m_alignOffset,m_height-(m_verticalOffset+rect.height()));
|
||||
|
||||
// move rect accounding to alignment. default is left.
|
||||
// move rect accounding to alignment. default is left.
|
||||
|
||||
if (m_alignment == TT_AlignRight) {
|
||||
// move rect left by width of rect. if <0 use 0;
|
||||
rect.moveLeft(rect.left()-rect.width());
|
||||
} else if (m_alignment == TT_AlignCenter) {
|
||||
// left by 1/2 width of rect. if < 0 then use 0
|
||||
rect.moveLeft(rect.left()-rect.width()/2);
|
||||
}
|
||||
if (m_alignment == TT_AlignRight) {
|
||||
// move rect left by width of rect. if <0 use 0;
|
||||
rect.moveLeft(rect.left()-rect.width());
|
||||
} else if (m_alignment == TT_AlignCenter) {
|
||||
// left by 1/2 width of rect. if < 0 then use 0
|
||||
rect.moveLeft(rect.left()-rect.width()/2);
|
||||
}
|
||||
|
||||
if (rect.top()<0) {rect.setTop(0);};
|
||||
if (rect.left()<0) {rect.setLeft(0);};
|
||||
if (rect.top()<0) {rect.setTop(0);};
|
||||
if (rect.left()<0) {rect.setLeft(0);};
|
||||
|
||||
return rect;
|
||||
return rect;
|
||||
}
|
||||
|
||||
void gParentToolTip::paint(QPainter &painter,int width,int height) {
|
||||
if (!m_parent_visible) {return ;};
|
||||
m_width=width;
|
||||
m_height=height;
|
||||
gToolTip::display(m_text, 0, 0,m_alignment, m_timeout);
|
||||
gToolTip::paint(painter);
|
||||
if (!m_parent_visible) {return ;};
|
||||
m_width=width;
|
||||
m_height=height;
|
||||
gToolTip::display(m_text, 0, 0,m_alignment, m_timeout);
|
||||
gToolTip::paint(painter);
|
||||
};
|
||||
|
||||
void gParentToolTip::timerDone() {
|
||||
gToolTip::timerDone();
|
||||
if (m_parent_visible) {
|
||||
m_graphview->timedRedraw(0);
|
||||
}
|
||||
m_parent_visible=false;
|
||||
gToolTip::timerDone();
|
||||
if (m_parent_visible) {
|
||||
m_graphview->timedRedraw(0);
|
||||
}
|
||||
m_parent_visible=false;
|
||||
};
|
||||
|
||||
void gParentToolTip::cancel() {
|
||||
gToolTip::cancel();
|
||||
m_parent_visible=false;
|
||||
gToolTip::cancel();
|
||||
m_parent_visible=false;
|
||||
};
|
||||
|
||||
bool gParentToolTip::visible() {
|
||||
return gToolTip::visible() && m_parent_visible;
|
||||
return gToolTip::visible() && m_parent_visible;
|
||||
};
|
||||
|
||||
|
||||
@ -560,7 +548,6 @@ void gGraphView::popoutGraph()
|
||||
dock->resize(width(),0);
|
||||
// QScrollArea
|
||||
}
|
||||
|
||||
//////// Create dock widget and resize dock to hold new widget
|
||||
QDockWidget * newDockWidget = new QDockWidget(dock);
|
||||
newDockWidget->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
|
||||
@ -2061,8 +2048,8 @@ void MinMaxWidget::onMaxChanged(double d)
|
||||
}
|
||||
void MinMaxWidget::onResetClicked()
|
||||
{
|
||||
int tmp = graph->zoomY();
|
||||
graph->setZoomY(0);
|
||||
ZoomyScaling tmp = graph->zoomY();
|
||||
graph->setZoomY(ZS_AUTO_FIT);
|
||||
EventDataType miny = graph->MinY(),
|
||||
maxy = graph->MaxY();
|
||||
|
||||
@ -2084,15 +2071,16 @@ void MinMaxWidget::onResetClicked()
|
||||
graph->setZoomY(tmp);
|
||||
}
|
||||
|
||||
void MinMaxWidget::onComboChanged(int idx)
|
||||
void MinMaxWidget::onComboChanged(int _idx)
|
||||
{
|
||||
minbox->setEnabled(idx == 2);
|
||||
maxbox->setEnabled(idx == 2);
|
||||
reset->setEnabled(idx == 2);
|
||||
ZoomyScaling idx = static_cast<ZoomyScaling>(_idx) ;
|
||||
minbox->setEnabled(idx == ZS_OVERRIDE);
|
||||
maxbox->setEnabled(idx == ZS_OVERRIDE);
|
||||
reset->setEnabled(idx == ZS_OVERRIDE);
|
||||
|
||||
graph->setZoomY(idx);
|
||||
|
||||
if (idx == 2) {
|
||||
if (idx == ZS_OVERRIDE) {
|
||||
if (qAbs(graph->rec_maxy - graph->rec_miny) < 0.0001) {
|
||||
onResetClicked();
|
||||
}
|
||||
@ -2106,9 +2094,9 @@ void MinMaxWidget::createLayout()
|
||||
layout->setSpacing(4);
|
||||
|
||||
combobox = new QComboBox(this);
|
||||
combobox->addItem(tr("Auto-Fit"), 0);
|
||||
combobox->addItem(tr("Defaults"), 1);
|
||||
combobox->addItem(tr("Override"), 2);
|
||||
combobox->addItem(tr("Auto-Fit"), ZS_AUTO_FIT);
|
||||
combobox->addItem(tr("Defaults"), ZS_DEFAULT);
|
||||
combobox->addItem(tr("Override"), ZS_OVERRIDE);
|
||||
combobox->setToolTip(tr("The Y-Axis scaling mode, 'Auto-Fit' for automatic scaling, 'Defaults' for settings according to manufacturer, and 'Override' to choose your own."));
|
||||
connect(combobox, SIGNAL(activated(int)), this, SLOT(onComboChanged(int)));
|
||||
|
||||
@ -3533,7 +3521,7 @@ void gGraphView::SaveSettings(QString title)
|
||||
out << graph->visible();
|
||||
out << graph->RecMinY();
|
||||
out << graph->RecMaxY();
|
||||
out << graph->zoomY();
|
||||
out << (short)graph->zoomY(); // the return type of zoomY was changed from a short to an enum (int) so much type cast it here
|
||||
out << (bool)graph->isPinned();
|
||||
|
||||
gLineChart * lc = dynamic_cast<gLineChart *>(findLayer(graph, LT_LineChart));
|
||||
@ -3663,7 +3651,7 @@ bool gGraphView::LoadSettings(QString title)
|
||||
g->setVisible(vis);
|
||||
g->setRecMinY(recminy);
|
||||
g->setRecMaxY(recmaxy);
|
||||
g->setZoomY(zoomy);
|
||||
g->setZoomY(static_cast<ZoomyScaling>(zoomy));
|
||||
g->setPinned(pinned);
|
||||
|
||||
if (gvversion >= 4) {
|
||||
|
@ -267,26 +267,26 @@ class gToolTip : public QObject
|
||||
|
||||
class gParentToolTip : public gToolTip
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_OBJECT
|
||||
public:
|
||||
gParentToolTip(gGraphView *graphview);
|
||||
~gParentToolTip();
|
||||
using gToolTip::display;
|
||||
virtual void display(gGraphView* gv,QString text,int verticalOffset, int alignOffset , ToolTipAlignment align = TT_AlignCenter, int timeout = 0,QFont *font = defaultfont) ;
|
||||
virtual void cancel();
|
||||
virtual bool visible();
|
||||
gParentToolTip(gGraphView *graphview);
|
||||
~gParentToolTip();
|
||||
using gToolTip::display;
|
||||
virtual void display(gGraphView* gv,QString text,int verticalOffset, int alignOffset , ToolTipAlignment align = TT_AlignCenter, int timeout = 0,QFont *font = defaultfont) ;
|
||||
virtual void cancel();
|
||||
virtual bool visible();
|
||||
virtual QRect calculateRect(QPainter &painter);
|
||||
using gToolTip::paint;
|
||||
virtual void paint(QPainter &paint,int width,int height) ;
|
||||
using gToolTip::paint;
|
||||
virtual void paint(QPainter &paint,int width,int height) ;
|
||||
private:
|
||||
int m_verticalOffset;
|
||||
int m_alignOffset;
|
||||
int m_width;
|
||||
int m_height;
|
||||
bool m_parent_visible;
|
||||
int m_timeout;
|
||||
int m_verticalOffset;
|
||||
int m_alignOffset;
|
||||
int m_width;
|
||||
int m_height;
|
||||
bool m_parent_visible;
|
||||
int m_timeout;
|
||||
protected slots:
|
||||
virtual void timerDone();
|
||||
virtual void timerDone();
|
||||
};
|
||||
|
||||
struct SelectionHistoryItem {
|
||||
|
@ -7,6 +7,10 @@
|
||||
* License. See the file COPYING in the main directory of the source code
|
||||
* for more details. */
|
||||
|
||||
|
||||
#define TEST_MACROS_ENABLEDoff
|
||||
#include "test_macros.h"
|
||||
|
||||
#include "Graphs/gLineChart.h"
|
||||
|
||||
#include <QString>
|
||||
@ -275,6 +279,7 @@ skipcheck:
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
EventDataType gLineChart::Miny()
|
||||
{
|
||||
if (m_codes.size() == 0) return 0;
|
||||
@ -373,6 +378,7 @@ QString gLineChart::getMetaString(qint64 time)
|
||||
// Time Domain Line Chart
|
||||
void gLineChart::paint(QPainter &painter, gGraph &w, const QRegion ®ion)
|
||||
{
|
||||
EventDataType actual_min_y, actual_max_y;
|
||||
QRectF rect = region.boundingRect();
|
||||
rect.translate(0.0f, 0.001f);
|
||||
// TODO: Just use QRect directly.
|
||||
@ -395,6 +401,8 @@ void gLineChart::paint(QPainter &painter, gGraph &w, const QRegion ®ion)
|
||||
return;
|
||||
}
|
||||
|
||||
actual_min_y = INT_MAX;
|
||||
actual_max_y = -INT_MAX;
|
||||
|
||||
top++;
|
||||
|
||||
@ -551,6 +559,7 @@ void gLineChart::paint(QPainter &painter, gGraph &w, const QRegion ®ion)
|
||||
painter.setPen(QPen(QBrush(color), lineThickness, Qt::DotLine));
|
||||
EventDataType y=top + height + 1 - ((dot.value - miny) * ymult);
|
||||
painter.drawLine(left + 1, y, left + 1 + width, y);
|
||||
DEBUGF NAME(dot.code) Q(dot.type) QQ(y,(int)y) Q(ratioX) O(QLine(left + 1, y, left + 1 + width, y)) Q(legendx) O(dot.value) ;
|
||||
|
||||
}
|
||||
}
|
||||
@ -742,6 +751,8 @@ void gLineChart::paint(QPainter &painter, gGraph &w, const QRegion ®ion)
|
||||
time += rate;
|
||||
// This is much faster than QVector access.
|
||||
data = *ptr * gain;
|
||||
if (actual_min_y>data) { actual_min_y=data; }
|
||||
if (actual_max_y<data) { actual_max_y=data; }
|
||||
|
||||
// Scale the time scale X to pixel scale X
|
||||
px = ((time - minx) * xmult);
|
||||
@ -822,6 +833,8 @@ void gLineChart::paint(QPainter &painter, gGraph &w, const QRegion ®ion)
|
||||
time += rate;
|
||||
|
||||
data = (*ptr + el.offset()) * gain;
|
||||
if (actual_min_y>data) { actual_min_y=data; }
|
||||
if (actual_max_y<data) { actual_max_y=data; }
|
||||
|
||||
px = xst + ((time - minx) * xmult); // Scale the time scale X to pixel scale X
|
||||
py = yst - ((data - miny) * ymult); // Same for Y scale, with precomputed gain
|
||||
@ -880,6 +893,8 @@ void gLineChart::paint(QPainter &painter, gGraph &w, const QRegion ®ion)
|
||||
|
||||
time = start + *tptr++;
|
||||
data = (*dptr++ + el.offset()) * gain;
|
||||
if (actual_min_y>data) { actual_min_y=data; }
|
||||
if (actual_max_y<data) { actual_max_y=data; }
|
||||
|
||||
idx++;
|
||||
|
||||
@ -897,75 +912,44 @@ void gLineChart::paint(QPainter &painter, gGraph &w, const QRegion ®ion)
|
||||
// Unrolling square plot outside of loop to gain a minor speed improvement.
|
||||
EventStoreType *eptr = dptr + siz;
|
||||
|
||||
if (square_plot) {
|
||||
for (; dptr < eptr; dptr++) {
|
||||
time = start + *tptr++;
|
||||
data = gain * (*dptr + el.offset());
|
||||
for (; dptr < eptr; dptr++) {
|
||||
time = start + *tptr++;
|
||||
data = gain * (*dptr + el.offset());
|
||||
if (actual_min_y>data) { actual_min_y=data; }
|
||||
if (actual_max_y<data) { actual_max_y=data; }
|
||||
|
||||
px = xst + ((time - minx) * xmult); // Scale the time scale X to pixel scale X
|
||||
py = yst - ((data - miny) * ymult); // Same for Y scale without precomputed gain
|
||||
px = xst + ((time - minx) * xmult); // Scale the time scale X to pixel scale X
|
||||
py = yst - ((data - miny) * ymult); // Same for Y scale without precomputed gain
|
||||
|
||||
// Horizontal lines are easy to cap
|
||||
if (py == lastpy) {
|
||||
// Cap px to left margin
|
||||
if (lastpx < xst) { lastpx = xst; }
|
||||
// Horizontal lines are easy to cap
|
||||
if (py == lastpy) {
|
||||
// Cap px to left margin
|
||||
if (lastpx < xst) { lastpx = xst; }
|
||||
|
||||
// Cap px to right margin
|
||||
if (px > xst + width) { px = xst + width; }
|
||||
|
||||
// lines.append(QLine(lastpx, lastpy, px, lastpy));
|
||||
// lines.append(QLine(px, lastpy, px, py));
|
||||
} // else {
|
||||
// Letting the scissor do the dirty work for non horizontal lines
|
||||
// This really should be changed, as it might be cause that weird
|
||||
// display glitch on Linux..
|
||||
|
||||
lines.append(QLine(lastpx, lastpy, px, lastpy));
|
||||
lines.append(QLine(px, lastpy, px, py));
|
||||
// }
|
||||
|
||||
lastpx = px;
|
||||
lastpy = py;
|
||||
|
||||
if (time > maxx) {
|
||||
done = true; // Let this iteration finish.. (This point will be in far clipping)
|
||||
break;
|
||||
}
|
||||
// Cap px to right margin
|
||||
if (px > xst + width) { px = xst + width; }
|
||||
}
|
||||
//else {
|
||||
// Letting the scissor do the dirty work for non horizontal lines
|
||||
// This really should be changed, as it might be cause that weird
|
||||
// display glitch on Linux..
|
||||
//}
|
||||
if (square_plot) {
|
||||
lines.append(QLine(lastpx, lastpy, px, lastpy));
|
||||
lines.append(QLine(px, lastpy, px, py));
|
||||
} else {
|
||||
lines.append(QLine(lastpx, lastpy, px, py));
|
||||
}
|
||||
} else {
|
||||
for (; dptr < eptr; dptr++) {
|
||||
//for (int i=0;i<siz;i++) {
|
||||
time = start + *tptr++;
|
||||
data = gain * (*dptr + el.offset());
|
||||
|
||||
px = xst + ((time - minx) * xmult); // Scale the time scale X to pixel scale X
|
||||
py = yst - ((data - miny) * ymult); // Same for Y scale without precomputed gain
|
||||
lastpx = px;
|
||||
lastpy = py;
|
||||
|
||||
// Horizontal lines are easy to cap
|
||||
if (py == lastpy) {
|
||||
// Cap px to left margin
|
||||
if (lastpx < xst) { lastpx = xst; }
|
||||
|
||||
// Cap px to right margin
|
||||
if (px > xst + width) { px = xst + width; }
|
||||
|
||||
// lines.append(QLine(lastpx, lastpy, px, py));
|
||||
} //else {
|
||||
// Letting the scissor do the dirty work for non horizontal lines
|
||||
// This really should be changed, as it might be cause that weird
|
||||
// display glitch on Linux..
|
||||
lines.append(QLine(lastpx, lastpy, px, py));
|
||||
//}
|
||||
|
||||
lastpx = px;
|
||||
lastpy = py;
|
||||
|
||||
if (time > maxx) { // Past right edge, abort further drawing..
|
||||
done = true;
|
||||
break;
|
||||
}
|
||||
if (time > maxx) { // Past right edge, abort further drawing..
|
||||
done = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (w.printing() && AppSetting->monochromePrinting()) {
|
||||
painter.setPen(QPen(Qt::black, lineThickness + 0.5));
|
||||
} else {
|
||||
@ -1127,9 +1111,7 @@ void gLineChart::paint(QPainter &painter, gGraph &w, const QRegion ®ion)
|
||||
|
||||
double f = double(cnt) / hours; // / (sum / 3600.0);
|
||||
QString txt = QObject::tr("Duration %1:%2:%3").arg(h,2,10,QChar('0')).arg(m,2,10,QChar('0')).arg(s,2,10,QChar('0')) + " "+
|
||||
QObject::tr("AHI %1").arg(f,0,'f',2);// +" " +
|
||||
// QObject::tr("Events %1").arg(cnt) + " " +
|
||||
// QObject::tr("Hours %1").arg(hours,0,'f',2);
|
||||
QObject::tr("AHI %1").arg(f,0,'f',2);// +" "
|
||||
|
||||
if (linecursormode) txt+=lasttext;
|
||||
|
||||
@ -1138,4 +1120,9 @@ void gLineChart::paint(QPainter &painter, gGraph &w, const QRegion ®ion)
|
||||
|
||||
|
||||
// painter.setRenderHint(QPainter::Antialiasing, false);
|
||||
|
||||
if (actual_max_y>0) {
|
||||
m_actual_min_y=actual_min_y;
|
||||
m_actual_max_y=actual_max_y;
|
||||
}
|
||||
}
|
||||
|
@ -112,6 +112,12 @@ class gLineChart: public Layer
|
||||
//! \brief Returns Maximum Y-axis value for this layer
|
||||
virtual EventDataType Maxy();
|
||||
|
||||
//! \brief Returns Minimum Y-axis value for this layer
|
||||
virtual EventDataType actualMinY() {return m_actual_min_y;};
|
||||
|
||||
//! \brief Returns Maximum Y-axis value for this layer
|
||||
virtual EventDataType actualMaxY() {return m_actual_max_y;};
|
||||
|
||||
//! \brief Returns true if all subplots contain no data
|
||||
virtual bool isEmpty();
|
||||
|
||||
@ -164,6 +170,7 @@ class gLineChart: public Layer
|
||||
bool m_report_empty;
|
||||
bool m_square_plot;
|
||||
bool m_disable_accel;
|
||||
EventDataType m_actual_min_y=0,m_actual_max_y=0;
|
||||
|
||||
//! \brief Used by accelerated waveform plots. Must be >= Screen Resolution (or at least graph width)
|
||||
static const int max_drawlist_size = 10000;
|
||||
|
@ -7,19 +7,8 @@
|
||||
* License. See the file COPYING in the main directory of the source code
|
||||
* for more details. */
|
||||
|
||||
#define xDEBUG_FUNCTIONS
|
||||
#ifdef DEBUG_FUNCTIONS
|
||||
#include <QRegularExpression>
|
||||
#define DEBUG qDebug()<<QString(basename( __FILE__)).remove(QRegularExpression("\\..*$")) << __LINE__
|
||||
#define DEBUGF qDebug()<<QString(basename( __FILE__)).remove(QRegularExpression("\\..*$")) << __LINE__ << __func__
|
||||
#define DEBUGTF qDebug()<<QDateTime::currentDateTime().time().toString("hh:mm:ss.zzz") << QString(basename( __FILE__)).remove(QRegularExpression("\\..*$")) << __LINE__ << __func__
|
||||
|
||||
#define O( XX ) " " #XX ":" << XX
|
||||
#define OO( XX , YY ) " " #XX ":" << YY
|
||||
#define NAME( id) schema::channel[ id ].label()
|
||||
#define DATE( XX ) QDateTime::fromMSecsSinceEpoch(XX).toString("dd MMM yyyy")
|
||||
#define DATETIME( XX ) QDateTime::fromMSecsSinceEpoch(XX).toString("dd MMM yyyy hh:mm:ss.zzz")
|
||||
#endif
|
||||
#define TEST_MACROS_ENABLEDoff
|
||||
#include "test_macros.h"
|
||||
|
||||
#include <math.h>
|
||||
#include <QLabel>
|
||||
|
@ -7,6 +7,9 @@
|
||||
* License. See the file COPYING in the main directory of the source code
|
||||
* for more details. */
|
||||
|
||||
#define TEST_MACROS_ENABLEDoff
|
||||
#include <test_macros.h>
|
||||
|
||||
#include "Graphs/gYAxis.h"
|
||||
|
||||
#include <QDebug>
|
||||
@ -20,6 +23,7 @@
|
||||
|
||||
#include <QFontMetrics>
|
||||
|
||||
|
||||
gXGrid::gXGrid(QColor col)
|
||||
: Layer(NoChannel)
|
||||
{
|
||||
@ -306,7 +310,7 @@ bool gYAxis::mouseMoveEvent(QMouseEvent *event, gGraph *graph)
|
||||
int y = event->y();
|
||||
|
||||
if (!graph->units().isEmpty()) {
|
||||
graph->ToolTip(graph->units(), x+10, y+10, TT_AlignLeft);
|
||||
graph->ToolTip(graph->unitsTooltip(), x+10, y+10, TT_AlignLeft);
|
||||
// graph->redraw();
|
||||
}
|
||||
|
||||
@ -316,14 +320,8 @@ bool gYAxis::mouseMoveEvent(QMouseEvent *event, gGraph *graph)
|
||||
bool gYAxis::mouseDoubleClickEvent(QMouseEvent *event, gGraph *graph)
|
||||
{
|
||||
if (graph) {
|
||||
// int x=event->x();
|
||||
// int y=event->y();
|
||||
short z = (graph->zoomY() + 1) % gGraph::maxZoomY;
|
||||
graph->setZoomY(z);
|
||||
qDebug() << "Mouse double clicked for" << graph->name() << z;
|
||||
graph->mouseDoubleClickYAxis(event);
|
||||
}
|
||||
|
||||
Q_UNUSED(event);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -7,6 +7,9 @@
|
||||
* License. See the file COPYING in the main directory of the source code
|
||||
* for more details. */
|
||||
|
||||
#define TEST_MACROS_ENABLEDoff
|
||||
#include "test_macros.h"
|
||||
|
||||
#include "Graphs/layer.h"
|
||||
|
||||
Layer::~Layer()
|
||||
|
@ -230,6 +230,10 @@ public:
|
||||
Q_UNUSED(graph);
|
||||
return false;
|
||||
}
|
||||
|
||||
virtual EventDataType actualMinY() {return 0;};
|
||||
virtual EventDataType actualMaxY() {return 0;};
|
||||
|
||||
};
|
||||
|
||||
/*! \class LayerGroup
|
||||
|
119
oscar/test_macros.h
Normal file
119
oscar/test_macros.h
Normal file
@ -0,0 +1,119 @@
|
||||
/* Test macros Implemntation
|
||||
*
|
||||
* Copyright (c) 2019-2022 The OSCAR Team
|
||||
* Copyright (c) 2011-2018 Mark Watkins <mark@jedimark.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 source code
|
||||
* for more details. */
|
||||
|
||||
/*
|
||||
These functions will display formatted debug information.
|
||||
The macro TEST_MACROS_ENABLED will enable these macros to display information
|
||||
When The macro TEST_MACROS_ENABLED is undefined then these marcos will expand to white space.
|
||||
|
||||
When these macos are used then debugging is disabled
|
||||
When only these macos are used then debugging is disabled.
|
||||
SO for production code rename TEST_MACROS_ENABLED to TEST_MACROS_ENABLEDoff
|
||||
|
||||
###########################################
|
||||
The the following to source cpp files
|
||||
to turn on the debug macros for use.
|
||||
|
||||
#define TEST_MACROS_ENABLED
|
||||
#include <test_macros.h>
|
||||
|
||||
To turn off the the test macros.
|
||||
#define TEST_MACROS_ENABLEDoff
|
||||
#include <test_macros.h>
|
||||
###########################################
|
||||
|
||||
|
||||
*/
|
||||
|
||||
#ifndef TEST_MACROS_ENABLED_ONCE
|
||||
#define TEST_MACROS_ENABLED_ONCE
|
||||
|
||||
#ifdef TEST_MACROS_ENABLED
|
||||
#include <QRegularExpression>
|
||||
#include <QFileInfo>
|
||||
|
||||
#define DEBUGL qDebug() <<QString("%1[%2]").arg(QFileInfo( __FILE__).baseName()).arg(__LINE__)
|
||||
//example:
|
||||
//12361: Debug: "gGraphView[572]"
|
||||
|
||||
|
||||
#define DEBUGF qDebug() <<QString("%1[%2]%3").arg(QFileInfo( __FILE__).baseName()).arg(__LINE__).arg(__func__)
|
||||
//example:
|
||||
//12361: Debug: "gGraphView[572]popoutGraph"
|
||||
|
||||
|
||||
#define DEBUGT qDebug() <<QString("%1 %2[%3]%4").arg(QDateTime::currentDateTime().time().toString("hh:mm:ss.zzz")).arg(QFileInfo( __FILE__).baseName()).arg(__LINE__)
|
||||
//example:
|
||||
//12645: Debug: "06:00:18.284 gGraphView[622]"
|
||||
|
||||
#define DEBUGTF qDebug() <<QString("%1 %2[%3]%4").arg(QDateTime::currentDateTime().time().toString("hh:mm:ss.zzz")).arg(QFileInfo( __FILE__).baseName()).arg(__LINE__).arg(__func__)
|
||||
//example:
|
||||
//12645: Debug: "06:00:18.284 gGraphView[622]popoutGraph"
|
||||
|
||||
// Macros to display variables
|
||||
#define O( EXPRESSION ) << EXPRESSION
|
||||
|
||||
// return values from functions donr't work - QQ macro instead
|
||||
#define Q( VALUE ) << "" #VALUE ":" << VALUE
|
||||
//example:
|
||||
|
||||
//
|
||||
#define QQ( TEXT , EXPRESSION) << #TEXT ":" << EXPRESSION
|
||||
//example:
|
||||
|
||||
#define NAME( SCHEMECODE ) << schema::channel[ SCHEMECODE ].label()
|
||||
//example:
|
||||
|
||||
#define FULLNAME( SCHEMECODE ) << schema::channel[ SCHEMEcODE ].fullname()
|
||||
//example:
|
||||
|
||||
//display the date of an epoch time stamp "qint64"
|
||||
#define DATE( EPOCH ) << QDateTime::fromMSecsSinceEpoch( EPOCH ).toString("dd MMM yyyy")
|
||||
|
||||
//display the date and Time of an epoch time stamp "qint64"
|
||||
#define DATETIME( EPOCH ) << QDateTime::fromMSecsSinceEpoch( EPOCH ).toString("dd MMM yyyy hh:mm:ss.zzz")
|
||||
|
||||
/*
|
||||
sample Lines.
|
||||
|
||||
code
|
||||
DEBUGF Q(name) Q(title) QQ("UNITS",units) Q(height) Q(group);
|
||||
output
|
||||
00791: Debug: "gGraph[137]gGraph" name: "RespRate" title: "Respiratory Rate" "UNITS": "Rate of breaths per minute" height: 180 group: 0
|
||||
|
||||
|
||||
DEBUGTF Q(newname);
|
||||
12645: Debug: "06:00:18.284 gGraphView[622]popoutGraph" newname: "Pressure - Friday, April 15, 2022"
|
||||
|
||||
|
||||
DEBUGF NAME(dot.code) Q(dot.type) QQ(y,(int)y) Q(ratioX) O(QLine(left + 1, y, left + 1 + width, y)) Q(legendx) O(dot.value) ;
|
||||
92 00917: Debug: "gLineChart[568]paint" "Pressure" dot.type: 4 y: 341 ratioX: 1 QLine(QPoint(91,341),QPoint(464,341)) legendx: 463 12.04
|
||||
|
||||
|
||||
*/
|
||||
|
||||
#else
|
||||
// Turn debugging off. macros expands to white space
|
||||
|
||||
#define DEBUGL
|
||||
#define DEBUGF
|
||||
#define DEBUGT
|
||||
#define DEBUGTF
|
||||
|
||||
#define O( XX )
|
||||
#define Q( XX )
|
||||
#define QQ( XX , YY )
|
||||
#define NAME( id)
|
||||
#define FULLNAME( id)
|
||||
#define DATE( XX )
|
||||
#define DATETIME( XX )
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user