comparison src/MainWindow.cpp @ 324:ac662fca8058

Small tidy
author Chris Cannam
date Fri, 13 Jun 2014 14:21:53 +0100
parents 8a884e1e3912
children ef75afbe4c67
comparison
equal deleted inserted replaced
323:8a884e1e3912 324:ac662fca8058
2997 2997
2998 cerr << "MainWindow::analyseNewMainModel: main model is " << model << endl; 2998 cerr << "MainWindow::analyseNewMainModel: main model is " << model << endl;
2999 2999
3000 cerr << "(document is " << m_document << ", it says main model is " << m_document->getMainModel() << ")" << endl; 3000 cerr << "(document is " << m_document << ", it says main model is " << m_document->getMainModel() << ")" << endl;
3001 3001
3002 if (model) { 3002 if (!model) {
3003 cerr << "pane stack is " << m_paneStack << " with " << m_paneStack->getPaneCount() << " panes" << endl; 3003 cerr << "no main model!" << endl;
3004 3004 return;
3005 if (m_paneStack) { 3005 }
3006 3006
3007 int pc = m_paneStack->getPaneCount(); 3007 if (!m_paneStack) {
3008 Pane *pane = 0; 3008 cerr << "no pane stack!" << endl;
3009 Pane *selectionStrip = 0; 3009 return;
3010 3010 }
3011 if (pc < 2) { 3011
3012 pane = m_paneStack->addPane(); 3012 int pc = m_paneStack->getPaneCount();
3013 selectionStrip = m_paneStack->addPane(); 3013 Pane *pane = 0;
3014 m_document->addLayerToView 3014 Pane *selectionStrip = 0;
3015 (selectionStrip, 3015
3016 m_document->createMainModelLayer(LayerFactory::TimeRuler)); 3016 if (pc < 2) {
3017 } else { 3017 pane = m_paneStack->addPane();
3018 pane = m_paneStack->getPane(0); 3018 selectionStrip = m_paneStack->addPane();
3019 selectionStrip = m_paneStack->getPane(1); 3019 m_document->addLayerToView
3020 } 3020 (selectionStrip,
3021 3021 m_document->createMainModelLayer(LayerFactory::TimeRuler));
3022 if (selectionStrip) { 3022 } else {
3023 selectionStrip->setFixedHeight(26); 3023 pane = m_paneStack->getPane(0);
3024 m_paneStack->sizePanesEqually(); 3024 selectionStrip = m_paneStack->getPane(1);
3025 m_viewManager->clearToolModeOverrides(); 3025 }
3026 m_viewManager->setToolModeFor(selectionStrip, 3026
3027 ViewManager::SelectMode); 3027 if (selectionStrip) {
3028 } 3028 selectionStrip->setFixedHeight(26);
3029 3029 m_paneStack->sizePanesEqually();
3030 if (pane) { 3030 m_viewManager->clearToolModeOverrides();
3031 3031 m_viewManager->setToolModeFor(selectionStrip,
3032 disconnect(pane, SIGNAL(regionOutlined(QRect)), 3032 ViewManager::SelectMode);
3033 pane, SLOT(zoomToRegion(QRect))); 3033 }
3034 connect(pane, SIGNAL(regionOutlined(QRect)), 3034
3035 this, SLOT(regionOutlined(QRect))); 3035 if (pane) {
3036 3036
3037 QString error = m_analyser->newFileLoaded 3037 disconnect(pane, SIGNAL(regionOutlined(QRect)),
3038 (m_document, getMainModel(), m_paneStack, pane); 3038 pane, SLOT(zoomToRegion(QRect)));
3039 if (error != "") { 3039 connect(pane, SIGNAL(regionOutlined(QRect)),
3040 QMessageBox::warning 3040 this, SLOT(regionOutlined(QRect)));
3041 (this, 3041
3042 tr("Failed to analyse audio"), 3042 QString error = m_analyser->newFileLoaded
3043 tr("<b>Analysis failed</b><p>%1</p>").arg(error), 3043 (m_document, getMainModel(), m_paneStack, pane);
3044 QMessageBox::Ok); 3044 if (error != "") {
3045 } 3045 QMessageBox::warning
3046 } 3046 (this,
3047 tr("Failed to analyse audio"),
3048 tr("<b>Analysis failed</b><p>%1</p>").arg(error),
3049 QMessageBox::Ok);
3047 } 3050 }
3048 } 3051 }
3049 } 3052 }
3050 3053
3051 void 3054 void