Changeset - 44b35d64abfa
[Not reviewed]
recording
0 6 0
Hasan Yavuz Ă–ZDERYA - 9 years ago 2017-02-14 10:13:31
hy@ozderya.net
write channel names to file
6 files changed with 26 insertions and 13 deletions:
0 comments (0 inline, 0 general)
src/channelinfomodel.cpp
Show inline comments
 
@@ -98,21 +98,31 @@ ChannelInfoModel::ChannelInfo::ChannelIn
 
    color = colors[index % NUMOF_COLORS];
 
}
 

	
 
QString ChannelInfoModel::name(unsigned i)
 
QString ChannelInfoModel::name(unsigned i) const
 
{
 
    return infos[i].name;
 
}
 

	
 
QColor ChannelInfoModel::color(unsigned i)
 
QColor ChannelInfoModel::color(unsigned i) const
 
{
 
    return infos[i].color;
 
}
 

	
 
bool ChannelInfoModel::isVisible(unsigned i)
 
bool ChannelInfoModel::isVisible(unsigned i) const
 
{
 
    return infos[i].visibility;
 
}
 

	
 
QStringList ChannelInfoModel::channelNames() const
 
{
 
    QStringList r;
 
    for (unsigned ci = 0; ci < _numOfChannels; ci++)
 
    {
 
        r << name(ci);
 
    }
 
    return r;
 
}
 

	
 
int ChannelInfoModel::rowCount(const QModelIndex &parent) const
 
{
 
    return _numOfChannels;
src/channelinfomodel.h
Show inline comments
 
@@ -41,9 +41,11 @@ public:
 
    ChannelInfoModel(const ChannelInfoModel& other);
 
    explicit ChannelInfoModel(const QStringList& channelNames);
 

	
 
    QString name     (unsigned i);
 
    QColor  color    (unsigned i);
 
    bool    isVisible(unsigned i);
 
    QString name     (unsigned i) const;
 
    QColor  color    (unsigned i) const;
 
    bool    isVisible(unsigned i) const;
 
    /// Returns a list of channel names
 
    QStringList channelNames() const;
 

	
 
    // implemented from QAbstractItemModel
 
    int           rowCount(const QModelIndex &parent = QModelIndex()) const;
src/channelmanager.h
Show inline comments
 
@@ -39,7 +39,6 @@ public:
 
    unsigned numOfChannels();
 
    unsigned numOfSamples();
 
    FrameBuffer* channelBuffer(unsigned channel);
 
    // QStringListModel* channelNames();
 
    QString channelName(unsigned channel);
 
    /// Stores channel names into a `QSettings`
 
    void saveSettings(QSettings* settings);
src/mainwindow.cpp
Show inline comments
 
@@ -63,7 +63,7 @@ MainWindow::MainWindow(QWidget *parent) 
 
    snapshotMan(this, &channelMan),
 
    commandPanel(&serialPort),
 
    dataFormatPanel(&serialPort, &channelMan, &recorder),
 
    recordPanel(&recorder)
 
    recordPanel(&recorder, &channelMan)
 
{
 
    ui->setupUi(this);
 

	
src/recordpanel.cpp
Show inline comments
 
@@ -29,7 +29,7 @@
 

	
 
#include <QtDebug>
 

	
 
RecordPanel::RecordPanel(DataRecorder* recorder, QWidget *parent) :
 
RecordPanel::RecordPanel(DataRecorder* recorder, ChannelManager* channelMan, QWidget *parent) :
 
    QWidget(parent),
 
    ui(new Ui::RecordPanel),
 
    recordToolBar(tr("Record Toolbar")),
 
@@ -37,6 +37,7 @@ RecordPanel::RecordPanel(DataRecorder* r
 
{
 
    overwriteSelected = false;
 
    _recorder = recorder;
 
    _channelMan = channelMan;
 

	
 
    ui->setupUi(this);
 

	
 
@@ -216,9 +217,7 @@ bool RecordPanel::confirmOverwrite(QStri
 

	
 
void RecordPanel::startRecording(void)
 
{
 
    // TODO: channel names
 
    QStringList cn;
 
    _recorder->startRecording(selectedFile, cn);
 
    _recorder->startRecording(selectedFile, _channelMan->infoModel()->channelNames());
 
    emit recordStarted();
 
}
 

	
src/recordpanel.h
Show inline comments
 
@@ -26,6 +26,7 @@
 
#include <QAction>
 

	
 
#include "datarecorder.h"
 
#include "channelmanager.h"
 

	
 
namespace Ui {
 
class RecordPanel;
 
@@ -36,7 +37,8 @@ class RecordPanel : public QWidget
 
    Q_OBJECT
 

	
 
public:
 
    explicit RecordPanel(DataRecorder* recorder, QWidget* parent = 0);
 
    explicit RecordPanel(DataRecorder* recorder, ChannelManager* channelMan,
 
                         QWidget* parent = 0);
 
    ~RecordPanel();
 

	
 
    QToolBar* toolbar();
 
@@ -60,6 +62,7 @@ private:
 
    QString selectedFile;
 
    bool overwriteSelected;
 
    DataRecorder* _recorder;
 
    ChannelManager* _channelMan;
 

	
 
    /**
 
     * @brief Increments the file name.
0 comments (0 inline, 0 general)