Changeset - e421d52f198e
[Not reviewed]
snapshots
0 3 0
Hasan Yavuz Ă–ZDERYA - 10 years ago 2015-09-20 09:56:52
hy@ozderya.net
code cleanup and remove test messages
3 files changed with 1 insertions and 12 deletions:
0 comments (0 inline, 0 general)
mainwindow.cpp
Show inline comments
 
@@ -724,25 +724,24 @@ void MainWindow::messageHandler(QtMsgTyp
 

	
 
    if (ui != NULL) ui->ptLog->appendPlainText(logString);
 
    std::cerr << logString.toStdString() << std::endl;
 

	
 
    if (type != QtDebugMsg && ui != NULL)
 
    {
 
        ui->statusBar->showMessage(msg, 5000);
 
    }
 
}
 

	
 
void MainWindow::takeSnapShot()
 
{
 
    qDebug() << "taking a snopshot yay!";
 
    QString name = QTime::currentTime().toString("'Snapshot ['HH:mm:ss']'");
 
    auto snapShot = new SnapShot(this, name);
 

	
 
    for (unsigned ci = 0; ci < numOfChannels; ci++)
 
    {
 
        snapShot->data.append(QVector<QPointF>(numOfSamples));
 
        for (unsigned i = 0; i < numOfSamples; i++)
 
        {
 
            snapShot->data[ci][i] = channelBuffers[ci]->sample(i);
 
        }
 
    }
 
    snapshots.append(snapShot);
snapshot.cpp
Show inline comments
 
@@ -34,42 +34,35 @@ QAction* SnapShot::showAction()
 
    return &_showAction;
 
}
 

	
 
QAction* SnapShot::deleteAction()
 
{
 
    return &_deleteAction;
 
}
 

	
 
void SnapShot::show()
 
{
 
    if (view == NULL)
 
    {
 
        qDebug() << "view == NULL";
 
        view = new SnapShotView(mainWindow, this);
 
        connect(view, &SnapShotView::closed, this, &SnapShot::viewClosed);
 
    }
 
    view->show();
 
    view->activateWindow();
 
    view->raise();
 
}
 

	
 
void SnapShot::hide()
 
{
 

	
 
}
 

	
 
void SnapShot::viewClosed()
 
{
 
    delete view;
 
    view = NULL;
 
}
 

	
 

	
 
void SnapShot::onDeleteTriggered()
 
{
 
    emit deleteRequested(this);
 
}
 

	
 
QString SnapShot::name()
 
{
 
    return _name;
 
}
snapshot.h
Show inline comments
 
@@ -13,33 +13,30 @@ class SnapShot : public QObject
 
    Q_OBJECT
 

	
 
public:
 
    SnapShot(QMainWindow* parent, QString name);
 
    ~SnapShot();
 

	
 
    QVector<QVector<QPointF>> data;
 
    QAction* showAction();
 
    QAction* deleteAction();
 

	
 
    QString name();
 

	
 
public slots:
 
    void show();
 
    void hide();
 

	
 
signals:
 
    void deleteRequested(SnapShot*);
 

	
 
private:
 
    QString _name;
 
    QAction _showAction;
 
    QAction _deleteAction;
 
    QMainWindow* mainWindow;
 
    SnapShotView* view;
 

	
 
private slots:
 
    void show();
 
    void viewClosed();
 

	
 
    void onDeleteTriggered();
 
};
 

	
 
#endif /* SNAPSHOT_H */
0 comments (0 inline, 0 general)