Mercurial > hg > svapp
diff framework/MainWindowBase.cpp @ 644:6fd0ebfd2bbe
Merge from branch fix-static-analysis
author | Chris Cannam |
---|---|
date | Wed, 09 Jan 2019 15:25:09 +0000 |
parents | 713b9a6b284a 8c5379570f36 |
children | 3168deb50199 |
line wrap: on
line diff
--- a/framework/MainWindowBase.cpp Wed Jan 09 14:42:25 2019 +0000 +++ b/framework/MainWindowBase.cpp Wed Jan 09 15:25:09 2019 +0000 @@ -137,32 +137,32 @@ #endif MainWindowBase::MainWindowBase(SoundOptions options) : - m_document(0), - m_paneStack(0), - m_viewManager(0), - m_timeRulerLayer(0), + m_document(nullptr), + m_paneStack(nullptr), + m_viewManager(nullptr), + m_timeRulerLayer(nullptr), m_soundOptions(options), - m_playSource(0), - m_recordTarget(0), - m_resamplerWrapper(0), - m_playTarget(0), - m_audioIO(0), - m_oscQueue(0), - m_oscQueueStarter(0), - m_midiInput(0), + m_playSource(nullptr), + m_recordTarget(nullptr), + m_resamplerWrapper(nullptr), + m_playTarget(nullptr), + m_audioIO(nullptr), + m_oscQueue(nullptr), + m_oscQueueStarter(nullptr), + m_midiInput(nullptr), m_recentFiles("RecentFiles", 20), m_recentTransforms("RecentTransforms", 20), m_documentModified(false), m_openingAudioFile(false), m_abandoning(false), - m_labeller(0), + m_labeller(nullptr), m_lastPlayStatusSec(0), m_initialDarkBackground(false), m_defaultFfwdRwdStep(2, 0), m_audioRecordMode(RecordCreateAdditionalModel), - m_statusLabel(0), + m_statusLabel(nullptr), m_iconsVisibleInMenus(true), - m_menuShortcutMapper(0) + m_menuShortcutMapper(nullptr) { Profiler profiler("MainWindowBase::MainWindowBase"); @@ -219,7 +219,7 @@ } #endif - m_paneStack = new PaneStack(0, m_viewManager); + m_paneStack = new PaneStack(nullptr, m_viewManager); connect(m_paneStack, SIGNAL(currentPaneChanged(Pane *)), this, SLOT(currentPaneChanged(Pane *))); connect(m_paneStack, SIGNAL(currentLayerChanged(Pane *, Layer *)), @@ -329,7 +329,7 @@ delete m_midiInput; if (m_oscQueueStarter) { - disconnect(m_oscQueueStarter, 0, 0, 0); + disconnect(m_oscQueueStarter, nullptr, nullptr, nullptr); m_oscQueueStarter->wait(1000); if (m_oscQueueStarter->isRunning()) { m_oscQueueStarter->terminate(); @@ -355,7 +355,7 @@ SVDEBUG << "MainWindowBase::finaliseMenus called" << endl; delete m_menuShortcutMapper; - m_menuShortcutMapper = 0; + m_menuShortcutMapper = nullptr; foreach (QShortcut *sc, m_appShortcuts) { delete sc; @@ -526,9 +526,9 @@ FileFinder *ff = FileFinder::getInstance(); if (type == FileFinder::AnyFile) { - if (getMainModel() != 0 && - m_paneStack != 0 && - m_paneStack->getCurrentPane() != 0) { // can import a layer + if (getMainModel() != nullptr && + m_paneStack != nullptr && + m_paneStack->getCurrentPane() != nullptr) { // can import a layer return ff->getOpenFileName(FileFinder::AnyFile, m_sessionFile); } else { return ff->getOpenFileName(FileFinder::SessionOrAudioFile, @@ -586,8 +586,8 @@ void MainWindowBase::updateMenuStates() { - Pane *currentPane = 0; - Layer *currentLayer = 0; + Pane *currentPane = nullptr; + Layer *currentLayer = nullptr; if (m_paneStack) currentPane = m_paneStack->getCurrentPane(); if (currentPane) currentLayer = currentPane->getSelectedLayer(); @@ -614,14 +614,14 @@ } bool haveCurrentPane = - (currentPane != 0); + (currentPane != nullptr); bool haveCurrentLayer = (haveCurrentPane && - (currentLayer != 0)); + (currentLayer != nullptr)); bool haveMainModel = - (getMainModel() != 0); + (getMainModel() != nullptr); bool havePlayTarget = - (m_playTarget != 0 || m_audioIO != 0); + (m_playTarget != nullptr || m_audioIO != nullptr); bool haveSelection = (m_viewManager && !m_viewManager->getSelections().empty()); @@ -766,7 +766,7 @@ if (m_viewManager->getPlaySoloMode()) { currentPaneChanged(m_paneStack->getCurrentPane()); } else { - m_viewManager->setPlaybackModel(0); + m_viewManager->setPlaybackModel(nullptr); if (m_playSource) { m_playSource->clearSoloModelSet(); } @@ -784,7 +784,7 @@ if (!(m_viewManager && m_playSource && m_viewManager->getPlaySoloMode())) { - if (m_viewManager) m_viewManager->setPlaybackModel(0); + if (m_viewManager) m_viewManager->setPlaybackModel(nullptr); return; } @@ -1168,7 +1168,7 @@ } m_labeller->label<SparseOneDimensionalModel::Point> - (point, havePrevPoint ? &prevPoint : 0); + (point, havePrevPoint ? &prevPoint : nullptr); if (m_labeller->actingOnPrevPoint() && havePrevPoint) { command->addPoint(prevPoint); @@ -1218,7 +1218,7 @@ if (alignedStart >= alignedEnd) return; sv_frame_t alignedDuration = alignedEnd - alignedStart; - Command *c = 0; + Command *c = nullptr; QString name = tr("Add Item at %1 s") .arg(RealTime::frame2RealTime @@ -1379,9 +1379,9 @@ if (!source.isAvailable()) return FileOpenFailed; source.waitForData(); - bool canImportLayer = (getMainModel() != 0 && - m_paneStack != 0 && - m_paneStack->getCurrentPane() != 0); + bool canImportLayer = (getMainModel() != nullptr && + m_paneStack != nullptr && + m_paneStack->getCurrentPane() != nullptr); bool rdf = (source.getExtension().toLower() == "rdf" || source.getExtension().toLower() == "n3" || @@ -1709,7 +1709,7 @@ // know whether the pane contains a waveform model at all. Pane *pane = m_paneStack->getCurrentPane(); - Layer *replace = 0; + Layer *replace = nullptr; for (int i = 0; i < pane->getLayerCount(); ++i) { Layer *layer = pane->getLayer(i); @@ -2076,9 +2076,9 @@ } } - QXmlInputSource *inputSource = 0; - BZipFileDevice *bzFile = 0; - QFile *rawFile = 0; + QXmlInputSource *inputSource = nullptr; + BZipFileDevice *bzFile = nullptr; + QFile *rawFile = nullptr; if (source.getExtension().toLower() == sessionExt) { bzFile = new BZipFileDevice(source.getLocalFilename()); @@ -2202,8 +2202,8 @@ if (!source.isAvailable()) return FileOpenFailed; source.waitForData(); - QXmlInputSource *inputSource = 0; - QFile *file = 0; + QXmlInputSource *inputSource = nullptr; + QFile *file = nullptr; file = new QFile(source.getLocalFilename()); inputSource = new QXmlInputSource(file); @@ -2346,7 +2346,7 @@ if (w) { Pane *pane = addPaneToStack(); - Layer *layer = 0; + Layer *layer = nullptr; if (m_timeRulerLayer) { m_document->addLayerToView(pane, m_timeRulerLayer); @@ -2565,8 +2565,8 @@ { // First prevent this trying to call target. if (m_playSource) { - m_playSource->setSystemPlaybackTarget(0); - m_playSource->setResamplerWrapper(0); + m_playSource->setSystemPlaybackTarget(nullptr); + m_playSource->setResamplerWrapper(nullptr); } // Then delete the breakfastquay::System object. @@ -2579,9 +2579,9 @@ // of the use cases for recreateAudioIO() calling this delete m_resamplerWrapper; - m_audioIO = 0; - m_playTarget = 0; - m_resamplerWrapper = 0; + m_audioIO = nullptr; + m_playTarget = nullptr; + m_resamplerWrapper = nullptr; } void @@ -2608,14 +2608,14 @@ WaveFileModel * MainWindowBase::getMainModel() { - if (!m_document) return 0; + if (!m_document) return nullptr; return m_document->getMainModel(); } const WaveFileModel * MainWindowBase::getMainModel() const { - if (!m_document) return 0; + if (!m_document) return nullptr; return m_document->getMainModel(); } @@ -2909,7 +2909,7 @@ if (m_timeRulerLayer) { SVCERR << "WARNING: Time ruler layer was not reset to 0 before session template loaded?" << endl; delete m_timeRulerLayer; - m_timeRulerLayer = 0; + m_timeRulerLayer = nullptr; } } @@ -3434,7 +3434,7 @@ MainWindowBase::getSnapLayer() const { Pane *pane = m_paneStack->getCurrentPane(); - if (!pane) return 0; + if (!pane) return nullptr; Layer *layer = pane->getSelectedLayer(); @@ -3443,7 +3443,7 @@ !dynamic_cast<RegionLayer *>(layer) && !dynamic_cast<TimeRulerLayer *>(layer)) { - layer = 0; + layer = nullptr; for (int i = pane->getLayerCount(); i > 0; --i) { Layer *l = pane->getLayer(i-1); @@ -3484,8 +3484,8 @@ MainWindowBase::AddPaneCommand::AddPaneCommand(MainWindowBase *mw) : m_mw(mw), - m_pane(0), - m_prevCurrentPane(0), + m_pane(nullptr), + m_prevCurrentPane(nullptr), m_added(false) { } @@ -3531,7 +3531,7 @@ MainWindowBase::RemovePaneCommand::RemovePaneCommand(MainWindowBase *mw, Pane *pane) : m_mw(mw), m_pane(pane), - m_prevCurrentPane(0), + m_prevCurrentPane(nullptr), m_added(true) { } @@ -3607,7 +3607,7 @@ void MainWindowBase::editCurrentLayer() { - Layer *layer = 0; + Layer *layer = nullptr; Pane *pane = m_paneStack->getCurrentPane(); if (pane) layer = pane->getSelectedLayer(); if (!layer) return; @@ -3727,7 +3727,7 @@ if (currentPane->getFixedOrderLayer(i) == currentLayer) { if (i == 0) { m_paneStack->setCurrentLayer - (currentPane, 0); // pane + (currentPane, nullptr); // pane } else { m_paneStack->setCurrentLayer (currentPane, currentPane->getFixedOrderLayer(i-1)); @@ -3762,7 +3762,7 @@ if (currentPane->getFixedOrderLayer(i) == currentLayer) { if (i == currentPane->getLayerCount()-1) { m_paneStack->setCurrentLayer - (currentPane, 0); // pane + (currentPane, nullptr); // pane } else { m_paneStack->setCurrentLayer (currentPane, currentPane->getFixedOrderLayer(i+1)); @@ -3826,7 +3826,7 @@ MainWindowBase::globalCentreFrameChanged(sv_frame_t ) { if ((m_playSource && m_playSource->isPlaying()) || !getMainModel()) return; - Pane *p = 0; + Pane *p = nullptr; if (!m_paneStack || !(p = m_paneStack->getCurrentPane())) return; if (!p->getFollowGlobalPan()) return; updateVisibleRangeDisplay(p); @@ -3844,7 +3844,7 @@ } } if ((m_playSource && m_playSource->isPlaying()) || !getMainModel()) return; - Pane *p = 0; + Pane *p = nullptr; if (!m_paneStack || !(p = m_paneStack->getCurrentPane())) return; if (v == p) updateVisibleRangeDisplay(p); } @@ -3853,7 +3853,7 @@ MainWindowBase::viewZoomLevelChanged(View *v, ZoomLevel, bool ) { if ((m_playSource && m_playSource->isPlaying()) || !getMainModel()) return; - Pane *p = 0; + Pane *p = nullptr; if (!m_paneStack || !(p = m_paneStack->getCurrentPane())) return; if (v == p) updateVisibleRangeDisplay(p); } @@ -3881,7 +3881,7 @@ if (m_timeRulerLayer && (layer == m_timeRulerLayer)) { // cerr << "(this is the time ruler layer)" << endl; - m_timeRulerLayer = 0; + m_timeRulerLayer = nullptr; } } @@ -3964,7 +3964,7 @@ { // SVDEBUG << "MainWindowBase::modelAboutToBeDeleted(" << model << ")" << endl; if (model == m_viewManager->getPlaybackModel()) { - m_viewManager->setPlaybackModel(0); + m_viewManager->setPlaybackModel(nullptr); } m_playSource->removeModel(model); } @@ -4031,7 +4031,7 @@ void MainWindowBase::inProgressSelectionChanged() { - Pane *currentPane = 0; + Pane *currentPane = nullptr; if (m_paneStack) currentPane = m_paneStack->getCurrentPane(); if (currentPane) { //cerr << "JTEST: mouse event on selection pane" << endl;