LibreVNA/Software/PC_Application/Traces/tracemodel.h

60 lines
1.6 KiB
C
Raw Normal View History

#ifndef TRACEMODEL_H
#define TRACEMODEL_H
#include <QAbstractTableModel>
#include "trace.h"
#include <vector>
#include "Device/device.h"
2020-12-05 06:49:52 +08:00
#include "savable.h"
2020-12-05 06:49:52 +08:00
class TraceModel : public QAbstractTableModel, public Savable
{
Q_OBJECT
public:
TraceModel(QObject *parent = 0);
~TraceModel();
enum {
ColIndexVisible = 0,
ColIndexPlayPause = 1,
ColIndexMath = 2,
ColIndexName = 3,
ColIndexLast,
};
void addTrace(Trace *t);
void removeTrace(unsigned int index);
Trace *trace(unsigned int index);
void toggleVisibility(unsigned int index);
void togglePause(unsigned int index);
void toggleMath(unsigned int index);
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
int columnCount(const QModelIndex &parent = QModelIndex()) const override;
QVariant data(const QModelIndex &index, int role) const override;
std::vector<Trace*> getTraces() const;
bool PortExcitationRequired(int port);
2020-12-05 06:49:52 +08:00
virtual nlohmann::json toJSON() override;
virtual void fromJSON(nlohmann::json j) override;
signals:
void SpanChanged(double fmin, double fmax);
void traceAdded(Trace *t);
void traceRemoved(Trace *t);
void requiredExcitation(bool excitePort1, bool excitePort2);
2020-11-02 05:56:31 +08:00
void traceNameChanged(Trace *t);
public slots:
void clearVNAData();
2020-11-09 04:28:47 +08:00
void addVNAData(const Protocol::Datapoint& d, const Protocol::SweepSettings& settings);
void addSAData(const Protocol::SpectrumAnalyzerResult& d, const Protocol::SpectrumAnalyzerSettings& settings);
private:
std::vector<Trace*> traces;
};
#endif // TRACEMODEL_H