Changeset - 110ac52a6894
[Not reviewed]
Hasan Yavuz Ă–ZDERYA - 10 years ago 2016-04-03 14:53:24
hy@ozderya.net
added legend (channel names) to snapshot view
4 files changed with 16 insertions and 1 deletions:
0 comments (0 inline, 0 general)
src/snapshot.cpp
Show inline comments
 
@@ -92,6 +92,16 @@ void Snapshot::setName(QString name)
 
    emit nameChanged(this);
 
}
 

	
 
void Snapshot::setChannelNames(QStringList names)
 
{
 
    _channelNames = names;
 
}
 

	
 
QString Snapshot::channelName(unsigned channel)
 
{
 
    return _channelNames[channel];
 
}
 

	
 
void Snapshot::save(QString fileName)
 
{
 
    // TODO: remove code duplication (MainWindow::onExportCsv)
src/snapshot.h
Show inline comments
 
@@ -25,6 +25,7 @@
 
#include <QAction>
 
#include <QVector>
 
#include <QString>
 
#include <QStringList>
 

	
 
class SnapshotView;
 

	
 
@@ -42,6 +43,8 @@ public:
 

	
 
    QString name();
 
    void setName(QString name);
 
    void setChannelNames(QStringList names); // must be called when setting data!
 
    QString channelName(unsigned channel);
 

	
 
    void save(QString fileName); /// save snapshot data as CSV
 

	
 
@@ -51,6 +54,7 @@ signals:
 

	
 
private:
 
    QString _name;
 
    QStringList _channelNames;
 
    QAction _showAction;
 
    QAction _deleteAction;
 
    QMainWindow* mainWindow;
src/snapshotmanager.cpp
Show inline comments
 
@@ -76,6 +76,7 @@ void SnapshotManager::takeSnapshot()
 
            snapshot->data[ci][i] = QPointF(i, _channelMan->channelBuffer(ci)->sample(i));
 
        }
 
    }
 
    snapshot->setChannelNames(_channelMan->channelNames()->stringList());
 

	
 
    addSnapshot(snapshot);
 
}
src/snapshotview.cpp
Show inline comments
 
@@ -35,7 +35,7 @@ SnapshotView::SnapshotView(QWidget *pare
 

	
 
    for (unsigned ci = 0; ci < numOfChannels; ci++)
 
    {
 
        QwtPlotCurve* curve = new QwtPlotCurve();
 
        QwtPlotCurve* curve = new QwtPlotCurve(snapshot->channelName(ci));
 
        curves.append(curve);
 
        curve->setSamples(snapshot->data[ci]);
 
        curve->setPen(Plot::makeColor(ci));
0 comments (0 inline, 0 general)