1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116
|
#ifndef GRAPHINGWINDOW_H
#define GRAPHINGWINDOW_H
#include "qcustomplot.h"
#include "can_structs.h"
#include "dbc/dbchandler.h"
#include <QDialog>
namespace Ui {
class GraphingWindow;
}
class GraphParams
{
public:
GraphParams();
uint32_t ID;
int startBit, numBits;
bool intelFormat;
bool isSigned;
uint64_t mask;
double bias;
double scale;
int stride;
int strideSoFar;
int bus;
QColor lineColor;
QColor fillColor;
int lineWidth;
bool drawOnlyPoints;
int pointType;
QCPGraph *ref;
QString graphName;
DBC_SIGNAL *associatedSignal;
//the below stuff is used for internal purposes only - code should be refactored so these can be private
QVector<double> x, y;
double xbias;
int64_t prevValTable;
QPointF prevValLocation;
QString prevValStr;
QCPItemBracket *lastBracket;
QList<QCPItemBracket *> brackets;
QList<QCPItemText *> bracketTexts;
};
class GraphingWindow : public QDialog
{
Q_OBJECT
public:
explicit GraphingWindow(const QVector<CANFrame> *, QWidget *parent = 0);
~GraphingWindow();
void showEvent(QShowEvent*);
public slots:
void createGraph(GraphParams ¶ms, bool createGraphParam = true);
private slots:
void titleDoubleClick(QMouseEvent *event, QCPTextElement *title);
void axisDoubleClick(QCPAxis* axis, QCPAxis::SelectablePart part);
void legendDoubleClick(QCPLegend* legend, QCPAbstractLegendItem* item);
void legendSingleClick(QCPLegend* legend, QCPAbstractLegendItem* item);
void plottableDoubleClick(QCPAbstractPlottable* plottable,int dataIdx, QMouseEvent* event);
void plottableClick(QCPAbstractPlottable* plottable, int dataIdx, QMouseEvent* event);
void selectionChanged();
void mousePress();
void mouseWheel();
void removeSelectedGraph();
void removeAllGraphs();
void contextMenuRequest(QPoint pos);
void moveLegend();
void saveGraphs();
void saveSpreadsheet();
void saveDefinitions();
void loadDefinitions();
void rescaleAxis(QCPAxis* axis);
void rescaleToData();
void toggleFollowMode();
void addNewGraph();
void appendToGraph(GraphParams ¶ms, CANFrame &frame, QVector<double> &x, QVector<double> &y);
void editSelectedGraph();
void updatedFrames(int);
void gotCenterTimeID(uint32_t ID, double timestamp);
void resetView();
void zoomIn();
void zoomOut();
signals:
void sendCenterTimeID(uint32_t ID, double timestamp);
private:
Ui::GraphingWindow *ui;
DBCHandler *dbcHandler;
QList<CANFrame> frameCache;
const QVector<CANFrame> *modelFrames;
QList<GraphParams> graphParams;
QPen selectedPen;
QCPSelectionDecorator *selDecorator;
QCPItemText *locationText;
QCPItemTracer *itemTracer;
bool needScaleSetup; //do we need to set x,y graphing extents?
bool useOpenGL;
bool followGraphEnd;
void showParamsDialog(int idx);
void closeEvent(QCloseEvent *event);
void readSettings();
void writeSettings();
bool eventFilter(QObject *obj, QEvent *event);
void changeEvent(QEvent *event);
};
#endif // GRAPHINGWINDOW_H
|