comparison src/MainWindow.cpp @ 260:46d59edfd18a

Much fiddling toward getting sessions and individual audio files to load cleanly when they need quite different handling after load
author Chris Cannam
date Wed, 02 Apr 2014 21:25:56 +0100
parents fa329ca6d75e
children 2dccb28a421f
comparison
equal deleted inserted replaced
259:fa329ca6d75e 260:46d59edfd18a
364 connect(CommandHistory::getInstance(), SIGNAL(activity(QString)), 364 connect(CommandHistory::getInstance(), SIGNAL(activity(QString)),
365 m_activityLog, SLOT(activityHappened(QString))); 365 m_activityLog, SLOT(activityHappened(QString)));
366 connect(this, SIGNAL(activity(QString)), 366 connect(this, SIGNAL(activity(QString)),
367 m_activityLog, SLOT(activityHappened(QString))); 367 m_activityLog, SLOT(activityHappened(QString)));
368 connect(this, SIGNAL(replacedDocument()), this, SLOT(documentReplaced())); 368 connect(this, SIGNAL(replacedDocument()), this, SLOT(documentReplaced()));
369 connect(this, SIGNAL(sessionLoaded()), this, SLOT(analyseNewMainModel()));
370 connect(this, SIGNAL(audioFileLoaded()), this, SLOT(analyseNewMainModel()));
369 m_activityLog->hide(); 371 m_activityLog->hide();
370 372
371 newSession(); 373 newSession();
372 374
373 settings.beginGroup("MainWindow"); 375 settings.beginGroup("MainWindow");
2595 } else { 2597 } else {
2596 m_myStatusMessage = tr("Visible: %1 to %2 (duration %3)") 2598 m_myStatusMessage = tr("Visible: %1 to %2 (duration %3)")
2597 .arg(startStr).arg(endStr).arg(durationStr); 2599 .arg(startStr).arg(endStr).arg(durationStr);
2598 } 2600 }
2599 2601
2600 // scale Y axis
2601 FlexiNoteLayer *fnl = dynamic_cast<FlexiNoteLayer *>(p->getLayer(2));
2602 if (fnl) {
2603 fnl->setVerticalRangeToNoteRange(p);
2604 }
2605
2606 statusBar()->showMessage(m_myStatusMessage); 2602 statusBar()->showMessage(m_myStatusMessage);
2607 } 2603 }
2608 2604
2609 void 2605 void
2610 MainWindow::updatePositionStatusDisplays() const 2606 MainWindow::updatePositionStatusDisplays() const
2683 2679
2684 if (m_playTarget) { 2680 if (m_playTarget) {
2685 connect(m_fader, SIGNAL(valueChanged(float)), 2681 connect(m_fader, SIGNAL(valueChanged(float)),
2686 m_playTarget, SLOT(setOutputGain(float))); 2682 m_playTarget, SLOT(setOutputGain(float)));
2687 } 2683 }
2688
2689 analyseNewMainModel();
2690 } 2684 }
2691 2685
2692 void 2686 void
2693 MainWindow::analyseNewMainModel() 2687 MainWindow::analyseNewMainModel()
2694 { 2688 {
2695 WaveFileModel *model = getMainModel(); 2689 WaveFileModel *model = getMainModel();
2690
2691 cerr << "MainWindow::analyseNewMainModel: main model is " << model << endl;
2692
2693 cerr << "(document is " << m_document << ", it says main model is " << m_document->getMainModel() << ")" << endl;
2696 2694
2697 if (model) { 2695 if (model) {
2696 cerr << "pane stack is " << m_paneStack << " with " << m_paneStack->getPaneCount() << " panes" << endl;
2697
2698 if (m_paneStack) { 2698 if (m_paneStack) {
2699 2699
2700 int pc = m_paneStack->getPaneCount(); 2700 int pc = m_paneStack->getPaneCount();
2701 Pane *pane = 0; 2701 Pane *pane = 0;
2702 2702 Pane *selectionStrip = 0;
2703 if (pc < 1) { 2703
2704 if (pc < 2) {
2704 pane = m_paneStack->addPane(); 2705 pane = m_paneStack->addPane();
2705 2706 selectionStrip = m_paneStack->addPane();
2706 Pane *selectionStrip = m_paneStack->addPane();
2707 selectionStrip->setFixedHeight(26);
2708 m_document->addLayerToView 2707 m_document->addLayerToView
2709 (selectionStrip, 2708 (selectionStrip,
2710 m_document->createMainModelLayer(LayerFactory::TimeRuler)); 2709 m_document->createMainModelLayer(LayerFactory::TimeRuler));
2710 } else {
2711 pane = m_paneStack->getPane(0);
2712 selectionStrip = m_paneStack->getPane(1);
2713 }
2714
2715 if (selectionStrip) {
2716 selectionStrip->setFixedHeight(26);
2711 m_paneStack->sizePanesEqually(); 2717 m_paneStack->sizePanesEqually();
2712
2713 m_viewManager->clearToolModeOverrides(); 2718 m_viewManager->clearToolModeOverrides();
2714 m_viewManager->setToolModeFor(selectionStrip, 2719 m_viewManager->setToolModeFor(selectionStrip,
2715 ViewManager::SelectMode); 2720 ViewManager::SelectMode);
2716 } else {
2717 pane = m_paneStack->getPane(0);
2718 } 2721 }
2719 2722
2720 if (pane) { 2723 if (pane) {
2721 2724
2722 disconnect(pane, SIGNAL(regionOutlined(QRect)), 2725 disconnect(pane, SIGNAL(regionOutlined(QRect)),