Now doing custom sorting for main display. It now actually sorts the
frame list itself which will sort for all windows. Much faster, and sorts properly for all columns. Also re-added custom display for timestamp. Still needs to be fixed in Windows.
This commit is contained in:
@@ -10,6 +10,19 @@
|
||||
#include "dbc/dbchandler.h"
|
||||
#include "connections/canconnection.h"
|
||||
|
||||
enum class Column {
|
||||
TimeStamp = 0, ///< The timestamp when the frame was transmitted or received
|
||||
FrameId = 1, ///< The frames CAN identifier (Standard: 11 or Extended: 29 bit)
|
||||
Extended = 2, ///< True if the frames CAN identifier is 29 bit
|
||||
Remote = 3, ///< True if the frames is a remote frame
|
||||
Direction = 4, ///< Whether the frame was transmitted or received
|
||||
Bus = 5, ///< The bus where the frame was transmitted or received
|
||||
Length = 6, ///< The frames payload data length
|
||||
ASCII = 7, ///< The payload interpreted as ASCII characters
|
||||
Data = 8, ///< The frames payload data
|
||||
NUM_COLUMN
|
||||
};
|
||||
|
||||
class CANFrameModel: public QAbstractTableModel
|
||||
{
|
||||
Q_OBJECT
|
||||
@@ -43,6 +56,7 @@ public:
|
||||
void recalcOverwrite();
|
||||
bool needsFilterRefresh();
|
||||
void insertFrames(const QVector<CANFrame> &newFrames);
|
||||
void sortByColumn(int column);
|
||||
int getIndexFromTimeID(unsigned int ID, double timestamp);
|
||||
const QVector<CANFrame> *getListReference() const; //thou shalt not modify these frames externally!
|
||||
const QVector<CANFrame> *getFilteredListReference() const; //Thus saith the Lord, NO.
|
||||
@@ -56,6 +70,10 @@ signals:
|
||||
void updatedFiltersList();
|
||||
|
||||
private:
|
||||
void qSortCANFrameAsc(QVector<CANFrame>* frames, Column column, int lowerBound, int upperBound);
|
||||
void qSortCANFrameDesc(QVector<CANFrame>* frames, Column column, int lowerBound, int upperBound);
|
||||
uint64_t getCANFrameVal(int row, Column col);
|
||||
|
||||
QVector<CANFrame> frames;
|
||||
QVector<CANFrame> filteredFrames;
|
||||
QMap<int, bool> filters;
|
||||
@@ -71,6 +89,7 @@ private:
|
||||
uint64_t timeOffset;
|
||||
int lastUpdateNumFrames;
|
||||
uint32_t preallocSize;
|
||||
bool sortDirAsc;
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user