comparison main/MainWindow.cpp @ 206:b4167bb2d2d4

* Add Align button to main window; use it
author Chris Cannam
date Thu, 25 Oct 2007 15:45:12 +0000
parents 0511f41a7ba7
children bb7faed0b2be
comparison
equal deleted inserted replaced
205:0511f41a7ba7 206:b4167bb2d2d4
1604 connect(m_viewManager, SIGNAL(playSoloModeChanged(bool)), 1604 connect(m_viewManager, SIGNAL(playSoloModeChanged(bool)),
1605 soAction, SLOT(setChecked(bool))); 1605 soAction, SLOT(setChecked(bool)));
1606 connect(soAction, SIGNAL(triggered()), this, SLOT(playSoloToggled())); 1606 connect(soAction, SIGNAL(triggered()), this, SLOT(playSoloToggled()));
1607 connect(this, SIGNAL(canPlay(bool)), soAction, SLOT(setEnabled(bool))); 1607 connect(this, SIGNAL(canPlay(bool)), soAction, SLOT(setEnabled(bool)));
1608 1608
1609 QAction *alAction = toolbar->addAction(il.load("align"),
1610 tr("Align File Timelines"));
1611 alAction->setCheckable(true);
1612 alAction->setChecked(m_viewManager->getAlignMode());
1613 //!!! alAction->setStatusTip(tr("Align audio files as //!!!??? what?
1614 connect(m_viewManager, SIGNAL(alignModeChanged(bool)),
1615 alAction, SLOT(setChecked(bool)));
1616 connect(alAction, SIGNAL(triggered()), this, SLOT(alignToggled()));
1617 connect(this, SIGNAL(canAlign(bool)), alAction, SLOT(setEnabled(bool)));
1618
1609 m_keyReference->registerShortcut(playAction); 1619 m_keyReference->registerShortcut(playAction);
1610 m_keyReference->registerShortcut(psAction); 1620 m_keyReference->registerShortcut(psAction);
1611 m_keyReference->registerShortcut(plAction); 1621 m_keyReference->registerShortcut(plAction);
1612 m_keyReference->registerShortcut(soAction); 1622 m_keyReference->registerShortcut(soAction);
1623 m_keyReference->registerShortcut(alAction);
1613 m_keyReference->registerShortcut(m_rwdAction); 1624 m_keyReference->registerShortcut(m_rwdAction);
1614 m_keyReference->registerShortcut(m_ffwdAction); 1625 m_keyReference->registerShortcut(m_ffwdAction);
1615 m_keyReference->registerShortcut(rwdStartAction); 1626 m_keyReference->registerShortcut(rwdStartAction);
1616 m_keyReference->registerShortcut(ffwdEndAction); 1627 m_keyReference->registerShortcut(ffwdEndAction);
1617 1628
1618 menu->addAction(playAction); 1629 menu->addAction(playAction);
1619 menu->addAction(psAction); 1630 menu->addAction(psAction);
1620 menu->addAction(plAction); 1631 menu->addAction(plAction);
1621 menu->addAction(soAction); 1632 menu->addAction(soAction);
1633 menu->addAction(alAction);
1622 menu->addSeparator(); 1634 menu->addSeparator();
1623 menu->addAction(m_rwdAction); 1635 menu->addAction(m_rwdAction);
1624 menu->addAction(m_ffwdAction); 1636 menu->addAction(m_ffwdAction);
1625 menu->addSeparator(); 1637 menu->addSeparator();
1626 menu->addAction(rwdStartAction); 1638 menu->addAction(rwdStartAction);
1629 1641
1630 m_rightButtonPlaybackMenu->addAction(playAction); 1642 m_rightButtonPlaybackMenu->addAction(playAction);
1631 m_rightButtonPlaybackMenu->addAction(psAction); 1643 m_rightButtonPlaybackMenu->addAction(psAction);
1632 m_rightButtonPlaybackMenu->addAction(plAction); 1644 m_rightButtonPlaybackMenu->addAction(plAction);
1633 m_rightButtonPlaybackMenu->addAction(soAction); 1645 m_rightButtonPlaybackMenu->addAction(soAction);
1646 m_rightButtonPlaybackMenu->addAction(alAction);
1634 m_rightButtonPlaybackMenu->addSeparator(); 1647 m_rightButtonPlaybackMenu->addSeparator();
1635 m_rightButtonPlaybackMenu->addAction(m_rwdAction); 1648 m_rightButtonPlaybackMenu->addAction(m_rwdAction);
1636 m_rightButtonPlaybackMenu->addAction(m_ffwdAction); 1649 m_rightButtonPlaybackMenu->addAction(m_ffwdAction);
1637 m_rightButtonPlaybackMenu->addSeparator(); 1650 m_rightButtonPlaybackMenu->addSeparator();
1638 m_rightButtonPlaybackMenu->addAction(rwdStartAction); 1651 m_rightButtonPlaybackMenu->addAction(rwdStartAction);
1754 bool haveCurrentPane = 1767 bool haveCurrentPane =
1755 (currentPane != 0); 1768 (currentPane != 0);
1756 bool haveCurrentLayer = 1769 bool haveCurrentLayer =
1757 (haveCurrentPane && 1770 (haveCurrentPane &&
1758 (currentLayer != 0)); 1771 (currentLayer != 0));
1772 bool havePlayTarget =
1773 (m_playTarget != 0);
1759 bool haveSelection = 1774 bool haveSelection =
1760 (m_viewManager && 1775 (m_viewManager &&
1761 !m_viewManager->getSelections().empty()); 1776 !m_viewManager->getSelections().empty());
1762 bool haveCurrentEditableLayer = 1777 bool haveCurrentEditableLayer =
1763 (haveCurrentLayer && 1778 (haveCurrentLayer &&
1766 (haveCurrentLayer && 1781 (haveCurrentLayer &&
1767 dynamic_cast<TimeInstantLayer *>(currentLayer)); 1782 dynamic_cast<TimeInstantLayer *>(currentLayer));
1768 bool haveCurrentTimeValueLayer = 1783 bool haveCurrentTimeValueLayer =
1769 (haveCurrentLayer && 1784 (haveCurrentLayer &&
1770 dynamic_cast<TimeValueLayer *>(currentLayer)); 1785 dynamic_cast<TimeValueLayer *>(currentLayer));
1786
1787 emit canAlign(havePlayTarget); //!!! only if Match plugin present
1771 1788
1772 emit canChangePlaybackSpeed(true); 1789 emit canChangePlaybackSpeed(true);
1773 int v = m_playSpeed->value(); 1790 int v = m_playSpeed->value();
1774 emit canSpeedUpPlayback(v < m_playSpeed->maximum()); 1791 emit canSpeedUpPlayback(v < m_playSpeed->maximum());
1775 emit canSlowDownPlayback(v > m_playSpeed->minimum()); 1792 emit canSlowDownPlayback(v > m_playSpeed->minimum());
2882 layer->setObjectName(newName); 2899 layer->setObjectName(newName);
2883 setupExistingLayersMenus(); 2900 setupExistingLayersMenus();
2884 } 2901 }
2885 } 2902 }
2886 } 2903 }
2904 }
2905
2906 void
2907 MainWindow::alignToggled()
2908 {
2909 QAction *action = dynamic_cast<QAction *>(sender());
2910
2911 if (action) {
2912 m_viewManager->setAlignMode(action->isChecked());
2913 } else {
2914 m_viewManager->setAlignMode(!m_viewManager->getAlignMode());
2915 }
2916
2917 if (m_viewManager->getAlignMode()) {
2918 m_document->alignModels();
2919 m_document->setAutoAlignment(true);
2920 } else {
2921 m_document->setAutoAlignment(false);
2922 }
2923
2924 for (int i = 0; i < m_paneStack->getPaneCount(); ++i) {
2925
2926 Pane *pane = m_paneStack->getPane(i);
2927 if (!pane) continue;
2928
2929 pane->update();
2930 }
2931
2932 //!!! and need solo enabled
2887 } 2933 }
2888 2934
2889 void 2935 void
2890 MainWindow::playSpeedChanged(int position) 2936 MainWindow::playSpeedChanged(int position)
2891 { 2937 {