Reduce to single history graph header

This commit is contained in:
Peter L Jones 2019-05-26 19:00:09 +01:00
parent 450fe4b530
commit ea022759b2
7 changed files with 63 additions and 83 deletions

View file

@ -174,9 +174,7 @@ HEADERS += src/audiomixerboard.h \
src/recorder/jamrecorder.h \
src/recorder/creaperproject.h \
src/recorder/cwavestream.h \
src/historygraph.h \
src/jpeghistorygraph.h \
src/svghistorygraph.h
src/historygraph.h
HEADERS_OPUS = libs/opus/include/opus.h \
libs/opus/include/opus_multistream.h \

View file

@ -9,11 +9,19 @@
#include "global.h"
#include "util.h"
// for CJpegHistoryGraph
#include <QImage>
#include <QPainter>
// for CSvgHistoryGraph
#include <QXmlStreamWriter>
#include <QXmlStreamAttributes>
/* Definitions ****************************************************************/
// number of history items to store
#define NUM_ITEMS_HISTORY 600
/* Interface ********************************************************************/
/* Interface ******************************************************************/
class AHistoryGraph
{
public:
@ -97,4 +105,54 @@ protected:
QTimer TimerDailyUpdate;
};
/* Implementations ************************************************************/
class CJpegHistoryGraph : public QObject, virtual public AHistoryGraph
{
Q_OBJECT
public:
CJpegHistoryGraph();
virtual void Update ( );
protected:
virtual void Save ( const QString sFileName );
virtual void rect ( const unsigned int x, const unsigned int y, const unsigned int width, const unsigned int height );
virtual void text ( const unsigned int x, const unsigned int y, const QString& value );
virtual void line ( const unsigned int x1, const unsigned int y1, const unsigned int x2, const unsigned int y2, const unsigned int strokeWidth = 1 );
virtual void point ( const unsigned int x, const unsigned int y, const unsigned int size, const QString& colour );
private:
QImage PlotPixmap;
int iAxisFontWeight;
public slots:
void OnTimerDailyUpdate() { Update(); }
};
class CSvgHistoryGraph : public QObject, virtual public AHistoryGraph
{
Q_OBJECT
public:
CSvgHistoryGraph();
virtual void Update();
protected:
virtual void Save ( const QString sFileName );
virtual void rect ( const unsigned int x, const unsigned int y, const unsigned int width, const unsigned int height );
virtual void text ( const unsigned int x, const unsigned int y, const QString& value );
virtual void line ( const unsigned int x1, const unsigned int y1, const unsigned int x2, const unsigned int y2, const unsigned int strokeWidth = 1 );
virtual void point ( const unsigned int x, const unsigned int y, const unsigned int size, const QString& colour );
private:
QXmlStreamAttributes svgRootAttributes;
QString svgImage;
QXmlStreamWriter svgStreamWriter;
public slots:
void OnTimerDailyUpdate() { Update(); }
};
#endif // HISTORYGRAPH_H

View file

@ -1,4 +1,4 @@
#include "jpeghistorygraph.h"
#include "historygraph.h"
CJpegHistoryGraph::CJpegHistoryGraph() :
AHistoryGraph(),

View file

@ -1,34 +0,0 @@
#ifndef JPEGHISTORYGRAPH_H
#define JPEGHISTORYGRAPH_H
#include "historygraph.h"
#include <QImage>
#include <QPainter>
/* Classes ********************************************************************/
class CJpegHistoryGraph : public QObject, virtual public AHistoryGraph
{
Q_OBJECT
public:
CJpegHistoryGraph();
virtual void Update ( );
protected:
virtual void Save ( const QString sFileName );
virtual void rect ( const unsigned int x, const unsigned int y, const unsigned int width, const unsigned int height );
virtual void text ( const unsigned int x, const unsigned int y, const QString& value );
virtual void line ( const unsigned int x1, const unsigned int y1, const unsigned int x2, const unsigned int y2, const unsigned int strokeWidth = 1 );
virtual void point ( const unsigned int x, const unsigned int y, const unsigned int size, const QString& colour );
private:
QImage PlotPixmap;
int iAxisFontWeight;
public slots:
void OnTimerDailyUpdate() { Update(); }
};
#endif // JPEGHISTORYGRAPH_H

View file

@ -33,8 +33,7 @@
#include "global.h"
#include "util.h"
#include "jpeghistorygraph.h"
#include "svghistorygraph.h"
#include "historygraph.h"
/* Classes ********************************************************************/
class CServerLogging

View file

@ -1,4 +1,4 @@
#include "svghistorygraph.h"
#include "historygraph.h"
CSvgHistoryGraph::CSvgHistoryGraph() :
AHistoryGraph(),

View file

@ -1,41 +0,0 @@
#ifndef SVGHISTORYGRAPH_H
#define SVGHISTORYGRAPH_H
#include "historygraph.h"
#include <QXmlStreamWriter>
#include <QXmlStreamAttributes>
/* Definitions ****************************************************************/
// number of history items to store
#ifndef NUM_ITEMS_HISTORY
#define NUM_ITEMS_HISTORY 600
#endif
/* Classes ********************************************************************/
class CSvgHistoryGraph : public QObject, virtual public AHistoryGraph
{
Q_OBJECT
public:
CSvgHistoryGraph();
virtual void Update();
protected:
virtual void Save ( const QString sFileName );
virtual void rect ( const unsigned int x, const unsigned int y, const unsigned int width, const unsigned int height );
virtual void text ( const unsigned int x, const unsigned int y, const QString& value );
virtual void line ( const unsigned int x1, const unsigned int y1, const unsigned int x2, const unsigned int y2, const unsigned int strokeWidth = 1 );
virtual void point ( const unsigned int x, const unsigned int y, const unsigned int size, const QString& colour );
private:
QXmlStreamAttributes svgRootAttributes;
QString svgImage;
QXmlStreamWriter svgStreamWriter;
public slots:
void OnTimerDailyUpdate() { Update(); }
};
#endif // SVGHISTORYGRAPH_H