Reduce to single history graph header
This commit is contained in:
parent
450fe4b530
commit
ea022759b2
7 changed files with 63 additions and 83 deletions
|
@ -174,9 +174,7 @@ HEADERS += src/audiomixerboard.h \
|
||||||
src/recorder/jamrecorder.h \
|
src/recorder/jamrecorder.h \
|
||||||
src/recorder/creaperproject.h \
|
src/recorder/creaperproject.h \
|
||||||
src/recorder/cwavestream.h \
|
src/recorder/cwavestream.h \
|
||||||
src/historygraph.h \
|
src/historygraph.h
|
||||||
src/jpeghistorygraph.h \
|
|
||||||
src/svghistorygraph.h
|
|
||||||
|
|
||||||
HEADERS_OPUS = libs/opus/include/opus.h \
|
HEADERS_OPUS = libs/opus/include/opus.h \
|
||||||
libs/opus/include/opus_multistream.h \
|
libs/opus/include/opus_multistream.h \
|
||||||
|
|
|
@ -9,11 +9,19 @@
|
||||||
#include "global.h"
|
#include "global.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
|
||||||
|
// for CJpegHistoryGraph
|
||||||
|
#include <QImage>
|
||||||
|
#include <QPainter>
|
||||||
|
|
||||||
|
// for CSvgHistoryGraph
|
||||||
|
#include <QXmlStreamWriter>
|
||||||
|
#include <QXmlStreamAttributes>
|
||||||
|
|
||||||
/* Definitions ****************************************************************/
|
/* Definitions ****************************************************************/
|
||||||
// number of history items to store
|
// number of history items to store
|
||||||
#define NUM_ITEMS_HISTORY 600
|
#define NUM_ITEMS_HISTORY 600
|
||||||
|
|
||||||
/* Interface ********************************************************************/
|
/* Interface ******************************************************************/
|
||||||
class AHistoryGraph
|
class AHistoryGraph
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -97,4 +105,54 @@ protected:
|
||||||
QTimer TimerDailyUpdate;
|
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
|
#endif // HISTORYGRAPH_H
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#include "jpeghistorygraph.h"
|
#include "historygraph.h"
|
||||||
|
|
||||||
CJpegHistoryGraph::CJpegHistoryGraph() :
|
CJpegHistoryGraph::CJpegHistoryGraph() :
|
||||||
AHistoryGraph(),
|
AHistoryGraph(),
|
||||||
|
|
|
@ -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
|
|
|
@ -33,8 +33,7 @@
|
||||||
#include "global.h"
|
#include "global.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
|
||||||
#include "jpeghistorygraph.h"
|
#include "historygraph.h"
|
||||||
#include "svghistorygraph.h"
|
|
||||||
|
|
||||||
/* Classes ********************************************************************/
|
/* Classes ********************************************************************/
|
||||||
class CServerLogging
|
class CServerLogging
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#include "svghistorygraph.h"
|
#include "historygraph.h"
|
||||||
|
|
||||||
CSvgHistoryGraph::CSvgHistoryGraph() :
|
CSvgHistoryGraph::CSvgHistoryGraph() :
|
||||||
AHistoryGraph(),
|
AHistoryGraph(),
|
||||||
|
|
|
@ -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
|
|
Loading…
Reference in a new issue