Update the entire program to use QVector. This should make the performance better. Still trying to preallocate enough space for 10,000,000 frames which should be more than plenty.
This commit is contained in:
+1
-1
@@ -156,7 +156,7 @@ void CANFrameModel::clearFrames()
|
|||||||
//Is this safe? Maybe not but if we don't change it then that's OK
|
//Is this safe? Maybe not but if we don't change it then that's OK
|
||||||
//Is it the best C++ practice? Probably not. This breaks the MVC paradigm
|
//Is it the best C++ practice? Probably not. This breaks the MVC paradigm
|
||||||
//but, it's for a good cause.
|
//but, it's for a good cause.
|
||||||
QList<CANFrame>* CANFrameModel::getListReference()
|
QVector<CANFrame>* CANFrameModel::getListReference()
|
||||||
{
|
{
|
||||||
return &frames;
|
return &frames;
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-2
@@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
#include <QAbstractTableModel>
|
#include <QAbstractTableModel>
|
||||||
#include <QList>
|
#include <QList>
|
||||||
|
#include <QVector>
|
||||||
#include "can_structs.h"
|
#include "can_structs.h"
|
||||||
#include "dbchandler.h"
|
#include "dbchandler.h"
|
||||||
|
|
||||||
@@ -26,11 +27,11 @@ public:
|
|||||||
void setDBCHandler(DBCHandler *);
|
void setDBCHandler(DBCHandler *);
|
||||||
void setInterpetMode(bool);
|
void setInterpetMode(bool);
|
||||||
void setOverwriteMode(bool);
|
void setOverwriteMode(bool);
|
||||||
QList<CANFrame> *getListReference();
|
QVector<CANFrame> *getListReference();
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QList<CANFrame> frames;
|
QVector<CANFrame> frames;
|
||||||
DBCHandler *dbcHandler;
|
DBCHandler *dbcHandler;
|
||||||
bool interpretFrames; //should we use the dbcHandler?
|
bool interpretFrames; //should we use the dbcHandler?
|
||||||
bool overwriteDups; //should we display all frames or only the newest for each ID?
|
bool overwriteDups; //should we display all frames or only the newest for each ID?
|
||||||
|
|||||||
+1
-1
@@ -5,7 +5,7 @@ const QColor FlowViewWindow::graphColors[8] = {Qt::blue, Qt::green, Qt::black, Q
|
|||||||
Qt::gray, Qt::yellow, Qt::cyan, Qt::darkMagenta};
|
Qt::gray, Qt::yellow, Qt::cyan, Qt::darkMagenta};
|
||||||
|
|
||||||
|
|
||||||
FlowViewWindow::FlowViewWindow(QList<CANFrame> *frames, QWidget *parent) :
|
FlowViewWindow::FlowViewWindow(QVector<CANFrame> *frames, QWidget *parent) :
|
||||||
QDialog(parent),
|
QDialog(parent),
|
||||||
ui(new Ui::FlowViewWindow)
|
ui(new Ui::FlowViewWindow)
|
||||||
{
|
{
|
||||||
|
|||||||
+2
-2
@@ -13,7 +13,7 @@ class FlowViewWindow : public QDialog
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit FlowViewWindow(QList<CANFrame> *frames, QWidget *parent = 0);
|
explicit FlowViewWindow(QVector<CANFrame> *frames, QWidget *parent = 0);
|
||||||
~FlowViewWindow();
|
~FlowViewWindow();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
@@ -32,7 +32,7 @@ private:
|
|||||||
Ui::FlowViewWindow *ui;
|
Ui::FlowViewWindow *ui;
|
||||||
QList<int> foundID;
|
QList<int> foundID;
|
||||||
QList<CANFrame> frameCache;
|
QList<CANFrame> frameCache;
|
||||||
QList<CANFrame> *modelFrames;
|
QVector<CANFrame> *modelFrames;
|
||||||
unsigned char refBytes[8];
|
unsigned char refBytes[8];
|
||||||
unsigned char currBytes[8];
|
unsigned char currBytes[8];
|
||||||
int currentPosition;
|
int currentPosition;
|
||||||
|
|||||||
+1
-1
@@ -2,7 +2,7 @@
|
|||||||
#include "ui_frameinfowindow.h"
|
#include "ui_frameinfowindow.h"
|
||||||
#include <QtDebug>
|
#include <QtDebug>
|
||||||
|
|
||||||
FrameInfoWindow::FrameInfoWindow(QList<CANFrame> *frames, QWidget *parent) :
|
FrameInfoWindow::FrameInfoWindow(QVector<CANFrame> *frames, QWidget *parent) :
|
||||||
QDialog(parent),
|
QDialog(parent),
|
||||||
ui(new Ui::FrameInfoWindow)
|
ui(new Ui::FrameInfoWindow)
|
||||||
{
|
{
|
||||||
|
|||||||
+2
-2
@@ -14,7 +14,7 @@ class FrameInfoWindow : public QDialog
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit FrameInfoWindow(QList<CANFrame> *frames, QWidget *parent = 0);
|
explicit FrameInfoWindow(QVector<CANFrame> *frames, QWidget *parent = 0);
|
||||||
~FrameInfoWindow();
|
~FrameInfoWindow();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
@@ -25,7 +25,7 @@ private:
|
|||||||
|
|
||||||
QList<int> foundID;
|
QList<int> foundID;
|
||||||
QList<CANFrame> frameCache;
|
QList<CANFrame> frameCache;
|
||||||
QList<CANFrame> *modelFrames;
|
QVector<CANFrame> *modelFrames;
|
||||||
|
|
||||||
void refreshIDList();
|
void refreshIDList();
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
#include "ui_frameplaybackwindow.h"
|
#include "ui_frameplaybackwindow.h"
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
|
||||||
FramePlaybackWindow::FramePlaybackWindow(QList<CANFrame> *frames, QWidget *parent) :
|
FramePlaybackWindow::FramePlaybackWindow(QVector<CANFrame> *frames, QWidget *parent) :
|
||||||
QDialog(parent),
|
QDialog(parent),
|
||||||
ui(new Ui::FramePlaybackWindow)
|
ui(new Ui::FramePlaybackWindow)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ class FramePlaybackWindow : public QDialog
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit FramePlaybackWindow(QList<CANFrame> *frames, QWidget *parent = 0);
|
explicit FramePlaybackWindow(QVector<CANFrame> *frames, QWidget *parent = 0);
|
||||||
~FramePlaybackWindow();
|
~FramePlaybackWindow();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
@@ -40,7 +40,7 @@ private:
|
|||||||
Ui::FramePlaybackWindow *ui;
|
Ui::FramePlaybackWindow *ui;
|
||||||
QList<int> foundID;
|
QList<int> foundID;
|
||||||
QList<CANFrame> frameCache;
|
QList<CANFrame> frameCache;
|
||||||
QList<CANFrame> *modelFrames;
|
QVector<CANFrame> *modelFrames;
|
||||||
int currentPosition;
|
int currentPosition;
|
||||||
QTimer *playbackTimer;
|
QTimer *playbackTimer;
|
||||||
bool playbackActive;
|
bool playbackActive;
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
#include "ui_framesenderwindow.h"
|
#include "ui_framesenderwindow.h"
|
||||||
#include "utility.h"
|
#include "utility.h"
|
||||||
|
|
||||||
FrameSenderWindow::FrameSenderWindow(QList<CANFrame> *frames, QWidget *parent) :
|
FrameSenderWindow::FrameSenderWindow(QVector<CANFrame> *frames, QWidget *parent) :
|
||||||
QDialog(parent),
|
QDialog(parent),
|
||||||
ui(new Ui::FrameSenderWindow)
|
ui(new Ui::FrameSenderWindow)
|
||||||
{
|
{
|
||||||
|
|||||||
+2
-2
@@ -15,7 +15,7 @@ class FrameSenderWindow : public QDialog
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit FrameSenderWindow(QList<CANFrame> *frames, QWidget *parent = 0);
|
explicit FrameSenderWindow(QVector<CANFrame> *frames, QWidget *parent = 0);
|
||||||
~FrameSenderWindow();
|
~FrameSenderWindow();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
@@ -26,7 +26,7 @@ private:
|
|||||||
Ui::FrameSenderWindow *ui;
|
Ui::FrameSenderWindow *ui;
|
||||||
QList<FrameSendData> sendingData;
|
QList<FrameSendData> sendingData;
|
||||||
QList<CANFrame> frameCache;
|
QList<CANFrame> frameCache;
|
||||||
QList<CANFrame> *modelFrames;
|
QVector<CANFrame> *modelFrames;
|
||||||
QTimer *intervalTimer;
|
QTimer *intervalTimer;
|
||||||
|
|
||||||
void doModifiers(int);
|
void doModifiers(int);
|
||||||
|
|||||||
+1
-1
@@ -3,7 +3,7 @@
|
|||||||
#include "newgraphdialog.h"
|
#include "newgraphdialog.h"
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
|
||||||
GraphingWindow::GraphingWindow(QList<CANFrame> *frames, QWidget *parent) :
|
GraphingWindow::GraphingWindow(QVector<CANFrame> *frames, QWidget *parent) :
|
||||||
QDialog(parent),
|
QDialog(parent),
|
||||||
ui(new Ui::GraphingWindow)
|
ui(new Ui::GraphingWindow)
|
||||||
{
|
{
|
||||||
|
|||||||
+2
-2
@@ -29,7 +29,7 @@ class GraphingWindow : public QDialog
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit GraphingWindow(QList<CANFrame> *, QWidget *parent = 0);
|
explicit GraphingWindow(QVector<CANFrame> *, QWidget *parent = 0);
|
||||||
~GraphingWindow();
|
~GraphingWindow();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
@@ -50,7 +50,7 @@ private slots:
|
|||||||
private:
|
private:
|
||||||
Ui::GraphingWindow *ui;
|
Ui::GraphingWindow *ui;
|
||||||
QList<CANFrame> frameCache;
|
QList<CANFrame> frameCache;
|
||||||
QList<CANFrame> *modelFrames;
|
QVector<CANFrame> *modelFrames;
|
||||||
QList<GraphParams> graphParams;
|
QList<GraphParams> graphParams;
|
||||||
QPen selectedPen;
|
QPen selectedPen;
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -248,7 +248,7 @@ void MainWindow::loadCRTDFile(QString filename)
|
|||||||
void MainWindow::saveCRTDFile(QString filename)
|
void MainWindow::saveCRTDFile(QString filename)
|
||||||
{
|
{
|
||||||
QFile *outFile = new QFile(filename);
|
QFile *outFile = new QFile(filename);
|
||||||
QList<CANFrame> *frames = model->getListReference();
|
QVector<CANFrame> *frames = model->getListReference();
|
||||||
|
|
||||||
if (!outFile->open(QIODevice::WriteOnly | QIODevice::Text))
|
if (!outFile->open(QIODevice::WriteOnly | QIODevice::Text))
|
||||||
return;
|
return;
|
||||||
@@ -328,7 +328,7 @@ void MainWindow::loadNativeCSVFile(QString filename)
|
|||||||
void MainWindow::saveNativeCSVFile(QString filename)
|
void MainWindow::saveNativeCSVFile(QString filename)
|
||||||
{
|
{
|
||||||
QFile *outFile = new QFile(filename);
|
QFile *outFile = new QFile(filename);
|
||||||
QList<CANFrame> *frames = model->getListReference();
|
QVector<CANFrame> *frames = model->getListReference();
|
||||||
|
|
||||||
if (!outFile->open(QIODevice::WriteOnly | QIODevice::Text))
|
if (!outFile->open(QIODevice::WriteOnly | QIODevice::Text))
|
||||||
return;
|
return;
|
||||||
|
|||||||
Reference in New Issue
Block a user