# HG changeset patch # User Chris Cannam # Date 1193932921 0 # Node ID bb7faed0b2be08a1a0ba9bf251a448805061cf57 # Parent b4167bb2d2d4fcfd662eccd4bfb8daccc2303b1a * Fix availability of alignment button and relative align/solo button state diff -r b4167bb2d2d4 -r bb7faed0b2be main/MainWindow.cpp --- a/main/MainWindow.cpp Thu Oct 25 15:45:12 2007 +0000 +++ b/main/MainWindow.cpp Thu Nov 01 16:02:01 2007 +0000 @@ -127,6 +127,9 @@ m_rightButtonLayerMenu(0), m_rightButtonTransformsMenu(0), m_rightButtonPlaybackMenu(0), + m_soloAction(0), + m_soloModified(false), + m_prevSolo(false), m_ffwdAction(0), m_rwdAction(0), m_preferencesDialog(0), @@ -1595,16 +1598,17 @@ connect(plAction, SIGNAL(triggered()), this, SLOT(playLoopToggled())); connect(this, SIGNAL(canPlay(bool)), plAction, SLOT(setEnabled(bool))); - QAction *soAction = toolbar->addAction(il.load("solo"), + m_soloAction = toolbar->addAction(il.load("solo"), tr("Solo Current Pane")); - soAction->setCheckable(true); - soAction->setChecked(m_viewManager->getPlaySoloMode()); - soAction->setShortcut(tr("o")); - soAction->setStatusTip(tr("Solo the current pane during playback")); + m_soloAction->setCheckable(true); + m_soloAction->setChecked(m_viewManager->getPlaySoloMode()); + m_prevSolo = m_viewManager->getPlaySoloMode(); + m_soloAction->setShortcut(tr("o")); + m_soloAction->setStatusTip(tr("Solo the current pane during playback")); connect(m_viewManager, SIGNAL(playSoloModeChanged(bool)), - soAction, SLOT(setChecked(bool))); - connect(soAction, SIGNAL(triggered()), this, SLOT(playSoloToggled())); - connect(this, SIGNAL(canPlay(bool)), soAction, SLOT(setEnabled(bool))); + m_soloAction, SLOT(setChecked(bool))); + connect(m_soloAction, SIGNAL(triggered()), this, SLOT(playSoloToggled())); + connect(this, SIGNAL(canChangeSolo(bool)), m_soloAction, SLOT(setEnabled(bool))); QAction *alAction = toolbar->addAction(il.load("align"), tr("Align File Timelines")); @@ -1619,7 +1623,7 @@ m_keyReference->registerShortcut(playAction); m_keyReference->registerShortcut(psAction); m_keyReference->registerShortcut(plAction); - m_keyReference->registerShortcut(soAction); + m_keyReference->registerShortcut(m_soloAction); m_keyReference->registerShortcut(alAction); m_keyReference->registerShortcut(m_rwdAction); m_keyReference->registerShortcut(m_ffwdAction); @@ -1629,7 +1633,7 @@ menu->addAction(playAction); menu->addAction(psAction); menu->addAction(plAction); - menu->addAction(soAction); + menu->addAction(m_soloAction); menu->addAction(alAction); menu->addSeparator(); menu->addAction(m_rwdAction); @@ -1642,7 +1646,7 @@ m_rightButtonPlaybackMenu->addAction(playAction); m_rightButtonPlaybackMenu->addAction(psAction); m_rightButtonPlaybackMenu->addAction(plAction); - m_rightButtonPlaybackMenu->addAction(soAction); + m_rightButtonPlaybackMenu->addAction(m_soloAction); m_rightButtonPlaybackMenu->addAction(alAction); m_rightButtonPlaybackMenu->addSeparator(); m_rightButtonPlaybackMenu->addAction(m_rwdAction); @@ -1783,8 +1787,9 @@ bool haveCurrentTimeValueLayer = (haveCurrentLayer && dynamic_cast(currentLayer)); - - emit canAlign(havePlayTarget); //!!! only if Match plugin present + + emit canChangeSolo(havePlayTarget); + emit canAlign(havePlayTarget && m_document && m_document->canAlign()); emit canChangePlaybackSpeed(true); int v = m_playSpeed->value(); @@ -2573,7 +2578,7 @@ int button = QMessageBox::warning(this, tr("Session modified"), - tr("Session modified

The current session has been modified.
Do you want to save it?
"), + tr("Session modified

The current session has been modified.
Do you want to save it?"), QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel, QMessageBox::Yes); @@ -2904,10 +2909,19 @@ } void +MainWindow::playSoloToggled() +{ + MainWindowBase::playSoloToggled(); + m_soloModified = true; +} + +void MainWindow::alignToggled() { QAction *action = dynamic_cast(sender()); + if (!m_viewManager) return; + if (action) { m_viewManager->setAlignMode(action->isChecked()); } else { @@ -2915,9 +2929,19 @@ } if (m_viewManager->getAlignMode()) { + m_prevSolo = m_soloAction->isChecked(); + m_soloAction->setChecked(true); + m_viewManager->setPlaySoloMode(true); + m_soloModified = false; + emit canChangeSolo(false); m_document->alignModels(); m_document->setAutoAlignment(true); } else { + if (!m_soloModified) { + m_soloAction->setChecked(m_prevSolo); + m_viewManager->setPlaySoloMode(m_prevSolo); + } + emit canChangeSolo(true); m_document->setAutoAlignment(false); } @@ -2928,8 +2952,6 @@ pane->update(); } - - //!!! and need solo enabled } void diff -r b4167bb2d2d4 -r bb7faed0b2be main/MainWindow.h --- a/main/MainWindow.h Thu Oct 25 15:45:12 2007 +0000 +++ b/main/MainWindow.h Thu Nov 01 16:02:01 2007 +0000 @@ -68,6 +68,7 @@ virtual ~MainWindow(); signals: + virtual void canChangeSolo(bool); virtual void canAlign(bool); public slots: @@ -131,6 +132,7 @@ virtual void playSpeedChanged(int); virtual void playSharpenToggled(); virtual void playMonoToggled(); + virtual void playSoloToggled(); virtual void alignToggled(); virtual void speedUpPlayback(); @@ -180,9 +182,13 @@ QMenu *m_rightButtonPlaybackMenu; QAction *m_deleteSelectedAction; + QAction *m_soloAction; QAction *m_ffwdAction; QAction *m_rwdAction; + bool m_soloModified; + bool m_prevSolo; + QPointer m_preferencesDialog; QPointer m_layerTreeView;