# HG changeset patch # User Chris Cannam # Date 1562160042 -3600 # Node ID 9bf8aa2916e9cd3f7b20b9bab5d99ef4acd0a410 # Parent d39db46736762185742ab67a704d6dcc2bad821a Further ModelId updates diff -r d39db4673676 -r 9bf8aa2916e9 view/View.cpp --- a/view/View.cpp Wed Jul 03 08:55:02 2019 +0100 +++ b/view/View.cpp Wed Jul 03 14:20:42 2019 +0100 @@ -1378,7 +1378,7 @@ { if (!m_manager || !m_manager->getAlignMode() || - !m_manager->getPlaybackModel()) { + m_manager->getPlaybackModel().isNone()) { return {}; } diff -r d39db4673676 -r 9bf8aa2916e9 view/ViewManager.cpp --- a/view/ViewManager.cpp Wed Jul 03 08:55:02 2019 +0100 +++ b/view/ViewManager.cpp Wed Jul 03 14:20:42 2019 +0100 @@ -35,7 +35,6 @@ m_globalCentreFrame(0), m_globalZoom(ZoomLevel::FramesPerPixel, 1024), m_playbackFrame(0), - m_playbackModel(nullptr), m_mainModelSampleRate(0), m_lastLeft(0), m_lastRight(0), @@ -194,14 +193,14 @@ } } -Model * +ModelId ViewManager::getPlaybackModel() const { return m_playbackModel; } void -ViewManager::setPlaybackModel(Model *model) +ViewManager::setPlaybackModel(ModelId model) { m_playbackModel = model; } @@ -212,10 +211,14 @@ #ifdef DEBUG_VIEW_MANAGER cerr << "ViewManager::alignPlaybackFrameToReference(" << frame << "): playback model is " << m_playbackModel << endl; #endif - if (!m_playbackModel || !m_alignMode) { + if (m_playbackModel.isNone() || !m_alignMode) { return frame; } else { - sv_frame_t f = m_playbackModel->alignToReference(frame); + auto playbackModel = ModelById::get(m_playbackModel); + if (!playbackModel) { + return frame; + } + sv_frame_t f = playbackModel->alignToReference(frame); #ifdef DEBUG_VIEW_MANAGER cerr << "aligned frame = " << f << endl; #endif @@ -229,10 +232,14 @@ #ifdef DEBUG_VIEW_MANAGER cerr << "ViewManager::alignReferenceToPlaybackFrame(" << frame << "): playback model is " << m_playbackModel << endl; #endif - if (!m_playbackModel || !m_alignMode) { + if (m_playbackModel.isNone() || !m_alignMode) { return frame; } else { - sv_frame_t f = m_playbackModel->alignFromReference(frame); + auto playbackModel = ModelById::get(m_playbackModel); + if (!playbackModel) { + return frame; + } + sv_frame_t f = playbackModel->alignFromReference(frame); #ifdef DEBUG_VIEW_MANAGER cerr << "aligned frame = " << f << endl; #endif diff -r d39db4673676 -r 9bf8aa2916e9 view/ViewManager.h --- a/view/ViewManager.h Wed Jul 03 08:55:02 2019 +0100 +++ b/view/ViewManager.h Wed Jul 03 14:20:42 2019 +0100 @@ -29,6 +29,8 @@ #include "base/BaseTypes.h" #include "base/ZoomLevel.h" +#include "data/model/Model.h" + class AudioPlaySource; class AudioRecordTarget; class Model; @@ -93,8 +95,8 @@ sv_frame_t getPlaybackFrame() const; // the set method is a slot // Only meaningful in solo mode, and used for optional alignment feature - Model *getPlaybackModel() const; - void setPlaybackModel(Model *); + ModelId getPlaybackModel() const; + void setPlaybackModel(ModelId); sv_frame_t alignPlaybackFrameToReference(sv_frame_t) const override; sv_frame_t alignReferenceToPlaybackFrame(sv_frame_t) const override; @@ -347,7 +349,7 @@ sv_frame_t m_globalCentreFrame; ZoomLevel m_globalZoom; mutable sv_frame_t m_playbackFrame; - Model *m_playbackModel; //!!! + ModelId m_playbackModel; sv_samplerate_t m_mainModelSampleRate; float m_lastLeft; diff -r d39db4673676 -r 9bf8aa2916e9 widgets/ModelDataTableDialog.cpp --- a/widgets/ModelDataTableDialog.cpp Wed Jul 03 08:55:02 2019 +0100 +++ b/widgets/ModelDataTableDialog.cpp Wed Jul 03 14:20:42 2019 +0100 @@ -36,7 +36,7 @@ #include -ModelDataTableDialog::ModelDataTableDialog(TabularModel *model, +ModelDataTableDialog::ModelDataTableDialog(ModelId tabularModelId, QString title, QWidget *parent) : QMainWindow(parent), m_currentRow(0), @@ -119,7 +119,7 @@ m_tableView->setSortingEnabled(true); m_tableView->sortByColumn(0, Qt::AscendingOrder); - m_table = new ModelDataTableModel(model); + m_table = new ModelDataTableModel(tabularModelId); m_tableView->setModel(m_table); m_tableView->horizontalHeader()->setStretchLastSection(true); diff -r d39db4673676 -r 9bf8aa2916e9 widgets/ModelDataTableDialog.h --- a/widgets/ModelDataTableDialog.h Wed Jul 03 08:55:02 2019 +0100 +++ b/widgets/ModelDataTableDialog.h Wed Jul 03 14:20:42 2019 +0100 @@ -20,7 +20,8 @@ #include "base/BaseTypes.h" -class TabularModel; +#include "data/model/Model.h" + class ModelDataTableModel; class QTableView; class QModelIndex; @@ -33,7 +34,7 @@ Q_OBJECT public: - ModelDataTableDialog(TabularModel *model, + ModelDataTableDialog(ModelId tabularModelId, QString title, QWidget *parent =0); ~ModelDataTableDialog();