Mercurial > hg > sonic-visualiser
comparison main/MainWindow.cpp @ 207:bb7faed0b2be
* Fix availability of alignment button and relative align/solo button state
author | Chris Cannam |
---|---|
date | Thu, 01 Nov 2007 16:02:01 +0000 |
parents | b4167bb2d2d4 |
children | 0b4d563d7469 |
comparison
equal
deleted
inserted
replaced
206:b4167bb2d2d4 | 207:bb7faed0b2be |
---|---|
125 m_recentTransformsMenu(0), | 125 m_recentTransformsMenu(0), |
126 m_rightButtonMenu(0), | 126 m_rightButtonMenu(0), |
127 m_rightButtonLayerMenu(0), | 127 m_rightButtonLayerMenu(0), |
128 m_rightButtonTransformsMenu(0), | 128 m_rightButtonTransformsMenu(0), |
129 m_rightButtonPlaybackMenu(0), | 129 m_rightButtonPlaybackMenu(0), |
130 m_soloAction(0), | |
131 m_soloModified(false), | |
132 m_prevSolo(false), | |
130 m_ffwdAction(0), | 133 m_ffwdAction(0), |
131 m_rwdAction(0), | 134 m_rwdAction(0), |
132 m_preferencesDialog(0), | 135 m_preferencesDialog(0), |
133 m_layerTreeView(0), | 136 m_layerTreeView(0), |
134 m_keyReference(new KeyReference()) | 137 m_keyReference(new KeyReference()) |
1593 connect(m_viewManager, SIGNAL(playLoopModeChanged(bool)), | 1596 connect(m_viewManager, SIGNAL(playLoopModeChanged(bool)), |
1594 plAction, SLOT(setChecked(bool))); | 1597 plAction, SLOT(setChecked(bool))); |
1595 connect(plAction, SIGNAL(triggered()), this, SLOT(playLoopToggled())); | 1598 connect(plAction, SIGNAL(triggered()), this, SLOT(playLoopToggled())); |
1596 connect(this, SIGNAL(canPlay(bool)), plAction, SLOT(setEnabled(bool))); | 1599 connect(this, SIGNAL(canPlay(bool)), plAction, SLOT(setEnabled(bool))); |
1597 | 1600 |
1598 QAction *soAction = toolbar->addAction(il.load("solo"), | 1601 m_soloAction = toolbar->addAction(il.load("solo"), |
1599 tr("Solo Current Pane")); | 1602 tr("Solo Current Pane")); |
1600 soAction->setCheckable(true); | 1603 m_soloAction->setCheckable(true); |
1601 soAction->setChecked(m_viewManager->getPlaySoloMode()); | 1604 m_soloAction->setChecked(m_viewManager->getPlaySoloMode()); |
1602 soAction->setShortcut(tr("o")); | 1605 m_prevSolo = m_viewManager->getPlaySoloMode(); |
1603 soAction->setStatusTip(tr("Solo the current pane during playback")); | 1606 m_soloAction->setShortcut(tr("o")); |
1607 m_soloAction->setStatusTip(tr("Solo the current pane during playback")); | |
1604 connect(m_viewManager, SIGNAL(playSoloModeChanged(bool)), | 1608 connect(m_viewManager, SIGNAL(playSoloModeChanged(bool)), |
1605 soAction, SLOT(setChecked(bool))); | 1609 m_soloAction, SLOT(setChecked(bool))); |
1606 connect(soAction, SIGNAL(triggered()), this, SLOT(playSoloToggled())); | 1610 connect(m_soloAction, SIGNAL(triggered()), this, SLOT(playSoloToggled())); |
1607 connect(this, SIGNAL(canPlay(bool)), soAction, SLOT(setEnabled(bool))); | 1611 connect(this, SIGNAL(canChangeSolo(bool)), m_soloAction, SLOT(setEnabled(bool))); |
1608 | 1612 |
1609 QAction *alAction = toolbar->addAction(il.load("align"), | 1613 QAction *alAction = toolbar->addAction(il.load("align"), |
1610 tr("Align File Timelines")); | 1614 tr("Align File Timelines")); |
1611 alAction->setCheckable(true); | 1615 alAction->setCheckable(true); |
1612 alAction->setChecked(m_viewManager->getAlignMode()); | 1616 alAction->setChecked(m_viewManager->getAlignMode()); |
1617 connect(this, SIGNAL(canAlign(bool)), alAction, SLOT(setEnabled(bool))); | 1621 connect(this, SIGNAL(canAlign(bool)), alAction, SLOT(setEnabled(bool))); |
1618 | 1622 |
1619 m_keyReference->registerShortcut(playAction); | 1623 m_keyReference->registerShortcut(playAction); |
1620 m_keyReference->registerShortcut(psAction); | 1624 m_keyReference->registerShortcut(psAction); |
1621 m_keyReference->registerShortcut(plAction); | 1625 m_keyReference->registerShortcut(plAction); |
1622 m_keyReference->registerShortcut(soAction); | 1626 m_keyReference->registerShortcut(m_soloAction); |
1623 m_keyReference->registerShortcut(alAction); | 1627 m_keyReference->registerShortcut(alAction); |
1624 m_keyReference->registerShortcut(m_rwdAction); | 1628 m_keyReference->registerShortcut(m_rwdAction); |
1625 m_keyReference->registerShortcut(m_ffwdAction); | 1629 m_keyReference->registerShortcut(m_ffwdAction); |
1626 m_keyReference->registerShortcut(rwdStartAction); | 1630 m_keyReference->registerShortcut(rwdStartAction); |
1627 m_keyReference->registerShortcut(ffwdEndAction); | 1631 m_keyReference->registerShortcut(ffwdEndAction); |
1628 | 1632 |
1629 menu->addAction(playAction); | 1633 menu->addAction(playAction); |
1630 menu->addAction(psAction); | 1634 menu->addAction(psAction); |
1631 menu->addAction(plAction); | 1635 menu->addAction(plAction); |
1632 menu->addAction(soAction); | 1636 menu->addAction(m_soloAction); |
1633 menu->addAction(alAction); | 1637 menu->addAction(alAction); |
1634 menu->addSeparator(); | 1638 menu->addSeparator(); |
1635 menu->addAction(m_rwdAction); | 1639 menu->addAction(m_rwdAction); |
1636 menu->addAction(m_ffwdAction); | 1640 menu->addAction(m_ffwdAction); |
1637 menu->addSeparator(); | 1641 menu->addSeparator(); |
1640 menu->addSeparator(); | 1644 menu->addSeparator(); |
1641 | 1645 |
1642 m_rightButtonPlaybackMenu->addAction(playAction); | 1646 m_rightButtonPlaybackMenu->addAction(playAction); |
1643 m_rightButtonPlaybackMenu->addAction(psAction); | 1647 m_rightButtonPlaybackMenu->addAction(psAction); |
1644 m_rightButtonPlaybackMenu->addAction(plAction); | 1648 m_rightButtonPlaybackMenu->addAction(plAction); |
1645 m_rightButtonPlaybackMenu->addAction(soAction); | 1649 m_rightButtonPlaybackMenu->addAction(m_soloAction); |
1646 m_rightButtonPlaybackMenu->addAction(alAction); | 1650 m_rightButtonPlaybackMenu->addAction(alAction); |
1647 m_rightButtonPlaybackMenu->addSeparator(); | 1651 m_rightButtonPlaybackMenu->addSeparator(); |
1648 m_rightButtonPlaybackMenu->addAction(m_rwdAction); | 1652 m_rightButtonPlaybackMenu->addAction(m_rwdAction); |
1649 m_rightButtonPlaybackMenu->addAction(m_ffwdAction); | 1653 m_rightButtonPlaybackMenu->addAction(m_ffwdAction); |
1650 m_rightButtonPlaybackMenu->addSeparator(); | 1654 m_rightButtonPlaybackMenu->addSeparator(); |
1781 (haveCurrentLayer && | 1785 (haveCurrentLayer && |
1782 dynamic_cast<TimeInstantLayer *>(currentLayer)); | 1786 dynamic_cast<TimeInstantLayer *>(currentLayer)); |
1783 bool haveCurrentTimeValueLayer = | 1787 bool haveCurrentTimeValueLayer = |
1784 (haveCurrentLayer && | 1788 (haveCurrentLayer && |
1785 dynamic_cast<TimeValueLayer *>(currentLayer)); | 1789 dynamic_cast<TimeValueLayer *>(currentLayer)); |
1786 | 1790 |
1787 emit canAlign(havePlayTarget); //!!! only if Match plugin present | 1791 emit canChangeSolo(havePlayTarget); |
1792 emit canAlign(havePlayTarget && m_document && m_document->canAlign()); | |
1788 | 1793 |
1789 emit canChangePlaybackSpeed(true); | 1794 emit canChangePlaybackSpeed(true); |
1790 int v = m_playSpeed->value(); | 1795 int v = m_playSpeed->value(); |
1791 emit canSpeedUpPlayback(v < m_playSpeed->maximum()); | 1796 emit canSpeedUpPlayback(v < m_playSpeed->maximum()); |
1792 emit canSlowDownPlayback(v > m_playSpeed->minimum()); | 1797 emit canSlowDownPlayback(v > m_playSpeed->minimum()); |
2571 if (!m_documentModified) return true; | 2576 if (!m_documentModified) return true; |
2572 | 2577 |
2573 int button = | 2578 int button = |
2574 QMessageBox::warning(this, | 2579 QMessageBox::warning(this, |
2575 tr("Session modified"), | 2580 tr("Session modified"), |
2576 tr("<b>Session modified</b><p>The current session has been modified.<br>Do you want to save it?<br>"), | 2581 tr("<b>Session modified</b><p>The current session has been modified.<br>Do you want to save it?"), |
2577 QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel, | 2582 QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel, |
2578 QMessageBox::Yes); | 2583 QMessageBox::Yes); |
2579 | 2584 |
2580 if (button == QMessageBox::Yes) { | 2585 if (button == QMessageBox::Yes) { |
2581 saveSession(); | 2586 saveSession(); |
2902 } | 2907 } |
2903 } | 2908 } |
2904 } | 2909 } |
2905 | 2910 |
2906 void | 2911 void |
2912 MainWindow::playSoloToggled() | |
2913 { | |
2914 MainWindowBase::playSoloToggled(); | |
2915 m_soloModified = true; | |
2916 } | |
2917 | |
2918 void | |
2907 MainWindow::alignToggled() | 2919 MainWindow::alignToggled() |
2908 { | 2920 { |
2909 QAction *action = dynamic_cast<QAction *>(sender()); | 2921 QAction *action = dynamic_cast<QAction *>(sender()); |
2910 | 2922 |
2923 if (!m_viewManager) return; | |
2924 | |
2911 if (action) { | 2925 if (action) { |
2912 m_viewManager->setAlignMode(action->isChecked()); | 2926 m_viewManager->setAlignMode(action->isChecked()); |
2913 } else { | 2927 } else { |
2914 m_viewManager->setAlignMode(!m_viewManager->getAlignMode()); | 2928 m_viewManager->setAlignMode(!m_viewManager->getAlignMode()); |
2915 } | 2929 } |
2916 | 2930 |
2917 if (m_viewManager->getAlignMode()) { | 2931 if (m_viewManager->getAlignMode()) { |
2932 m_prevSolo = m_soloAction->isChecked(); | |
2933 m_soloAction->setChecked(true); | |
2934 m_viewManager->setPlaySoloMode(true); | |
2935 m_soloModified = false; | |
2936 emit canChangeSolo(false); | |
2918 m_document->alignModels(); | 2937 m_document->alignModels(); |
2919 m_document->setAutoAlignment(true); | 2938 m_document->setAutoAlignment(true); |
2920 } else { | 2939 } else { |
2940 if (!m_soloModified) { | |
2941 m_soloAction->setChecked(m_prevSolo); | |
2942 m_viewManager->setPlaySoloMode(m_prevSolo); | |
2943 } | |
2944 emit canChangeSolo(true); | |
2921 m_document->setAutoAlignment(false); | 2945 m_document->setAutoAlignment(false); |
2922 } | 2946 } |
2923 | 2947 |
2924 for (int i = 0; i < m_paneStack->getPaneCount(); ++i) { | 2948 for (int i = 0; i < m_paneStack->getPaneCount(); ++i) { |
2925 | 2949 |
2926 Pane *pane = m_paneStack->getPane(i); | 2950 Pane *pane = m_paneStack->getPane(i); |
2927 if (!pane) continue; | 2951 if (!pane) continue; |
2928 | 2952 |
2929 pane->update(); | 2953 pane->update(); |
2930 } | 2954 } |
2931 | |
2932 //!!! and need solo enabled | |
2933 } | 2955 } |
2934 | 2956 |
2935 void | 2957 void |
2936 MainWindow::playSpeedChanged(int position) | 2958 MainWindow::playSpeedChanged(int position) |
2937 { | 2959 { |