Changeset - 14367aaacba1
[Not reviewed]
stream
0 2 0
Hasan Yavuz ÖZDERYA - 7 years ago 2018-05-13 12:36:25
hy@ozderya.net
updated framebuffer to reference "Stream" instead of infoModel
2 files changed with 14 insertions and 13 deletions:
0 comments (0 inline, 0 general)
src/plotmanager.cpp
Show inline comments
 
/*
 
  Copyright © 2017 Hasan Yavuz Özderya
 
  Copyright © 2018 Hasan Yavuz Özderya
 

	
 
  This file is part of serialplot.
 

	
 
@@ -28,7 +28,7 @@
 
#include "setting_defines.h"
 

	
 
PlotManager::PlotManager(QWidget* plotArea, PlotMenu* menu,
 
                         ChannelInfoModel* infoModel, QObject* parent) :
 
                         const Stream* stream, QObject* parent) :
 
    QObject(parent)
 
{
 
    _menu = menu;
 
@@ -38,7 +38,7 @@ PlotManager::PlotManager(QWidget* plotAr
 
    _yMax = 1;
 
    _xAxisAsIndex = true;
 
    isDemoShown = false;
 
    _infoModel = infoModel;
 
    _stream = stream;
 
    _numOfSamples = 1;
 
    _plotWidth = 1;
 
    showSymbols = Plot::ShowSymbolsAuto;
 
@@ -74,16 +74,17 @@ PlotManager::PlotManager(QWidget* plotAr
 
    setMulti(menu->showMultiAction.isChecked());
 

	
 
    // connect to channel info model
 
    if (_infoModel != NULL)     // TODO: remove when snapshots have infomodel
 
    if (_stream != NULL)
 
    {
 
        connect(_infoModel, &QAbstractItemModel::dataChanged,
 
        auto infoModel = _stream->infoModel();
 
        connect(infoModel, &QAbstractItemModel::dataChanged,
 
                this, &PlotManager::onChannelInfoChanged);
 

	
 
        connect(_infoModel, &QAbstractItemModel::modelReset,
 
        connect(infoModel, &QAbstractItemModel::modelReset,
 
                [this]()
 
                {
 
                    onChannelInfoChanged(_infoModel->index(0, 0), // start
 
                                         _infoModel->index(_infoModel->rowCount()-1, 0), // end
 
                    onChannelInfoChanged(infoModel->index(0, 0), // start
 
                                         infoModel->index(infoModel->rowCount()-1, 0), // end
 
                                         {}); // roles ignored
 
                });
 
    }
 
@@ -297,7 +298,7 @@ void PlotManager::_addCurve(QwtPlotCurve
 
    curves.append(curve);
 

	
 
    unsigned index = curves.size()-1;
 
    auto color = _infoModel->color(index);
 
    auto color = _stream->channel(index)->color();
 
    curve->setPen(color);
 

	
 
    // create the plot for the curve if we are on multi display
src/plotmanager.h
Show inline comments
 
/*
 
  Copyright © 2017 Hasan Yavuz Özderya
 
  Copyright © 2018 Hasan Yavuz Özderya
 

	
 
  This file is part of serialplot.
 

	
 
@@ -31,7 +31,7 @@
 
#include <qwt_plot_curve.h>
 
#include "plot.h"
 
#include "framebufferseries.h"
 
#include "channelinfomodel.h"
 
#include "stream.h"
 
#include "plotmenu.h"
 

	
 
class PlotManager : public QObject
 
@@ -40,7 +40,7 @@ class PlotManager : public QObject
 

	
 
public:
 
    explicit PlotManager(QWidget* plotArea, PlotMenu* menu,
 
                         ChannelInfoModel* infoModel = NULL,
 
                         const Stream* stream = NULL,
 
                         QObject *parent = 0);
 
    ~PlotManager();
 
    /// Add a new curve with title and buffer. A color is
 
@@ -80,7 +80,7 @@ private:
 
    QList<QwtPlotCurve*> curves;
 
    QList<Plot*> plotWidgets;
 
    Plot* emptyPlot;  ///< for displaying when all channels are hidden
 
    ChannelInfoModel* _infoModel;
 
    const Stream* stream;       ///< attached stream, can be `NULL`
 
    bool isDemoShown;
 
    bool _autoScaled;
 
    double _yMin;
0 comments (0 inline, 0 general)