From 06cb85b771cc9936279ce330b60caa1a774f3bd2 Mon Sep 17 00:00:00 2001 From: Amadeus Folego Date: Wed, 14 Jan 2015 16:46:36 -0200 Subject: [PATCH] Move FX assignment/creation logic to InsTrackView --- include/InstrumentTrack.h | 8 ++++++++ include/Track.h | 2 -- src/core/Track.cpp | 27 ++------------------------- src/tracks/InstrumentTrack.cpp | 24 ++++++++++++++++++++++++ 4 files changed, 34 insertions(+), 27 deletions(-) diff --git a/include/InstrumentTrack.h b/include/InstrumentTrack.h index ffbb61ccc..f172e6094 100644 --- a/include/InstrumentTrack.h +++ b/include/InstrumentTrack.h @@ -322,6 +322,9 @@ private slots: void midiConfigChanged(); void muteChanged(); + void assignFxLine( int channelIndex ); + void createFxLine(); + private: InstrumentTrackWindow * m_window; @@ -375,6 +378,11 @@ public: void setInstrumentTrackView( InstrumentTrackView * _tv ); + InstrumentTrackView * instrumentTrackView() + { + return m_itv; + } + PianoView * pianoView() { return m_pianoView; diff --git a/include/Track.h b/include/Track.h index b766b6056..91aadfde2 100644 --- a/include/Track.h +++ b/include/Track.h @@ -391,8 +391,6 @@ private slots: void recordingOn(); void recordingOff(); void clearTrack(); - void assignFxLine( int channelIndex ); - void createFxLine(); private: static QPixmap * s_grip; diff --git a/src/core/Track.cpp b/src/core/Track.cpp index a6f98e1df..524bc3837 100644 --- a/src/core/Track.cpp +++ b/src/core/Track.cpp @@ -1711,29 +1711,6 @@ void TrackOperationsWidget::clearTrack() -/*! \brief Create and assign a new FX Channel for this track */ -void TrackOperationsWidget::createFxLine() -{ - int channelIndex = gui->fxMixerView()->addNewChannel(); - - Engine::fxMixer()->effectChannel( channelIndex )->m_name = m_trackView->getTrack()->name(); - - assignFxLine(channelIndex); -} - - - -/*! \brief Assign a specific FX Channel for this track */ -void TrackOperationsWidget::assignFxLine(int channelIndex) -{ - Track * track = m_trackView->getTrack(); - dynamic_cast( track )->effectChannelModel()->setValue( channelIndex ); - - gui->fxMixerView()->setCurrentFxLine( channelIndex ); -} - - - /*! \brief Remove this track from the track list * */ @@ -1777,7 +1754,7 @@ void TrackOperationsWidget::updateMenu() QMenu * fxMenu = new QMenu( tr( "FX %1: %2" ).arg( channelIndex ).arg( fxChannel->m_name ), to_menu ); QSignalMapper * fxMenuSignalMapper = new QSignalMapper(this); - fxMenu->addAction("Assign to new FX Channel" , this, SLOT( createFxLine() ) ); + fxMenu->addAction( tr( "Assign to new FX Channel" ), trackView, SLOT( createFxLine() ) ); fxMenu->addSeparator(); @@ -1794,7 +1771,7 @@ void TrackOperationsWidget::updateMenu() } to_menu->addMenu(fxMenu); - connect(fxMenuSignalMapper, SIGNAL(mapped(int)), this, SLOT(assignFxLine(int))); + connect(fxMenuSignalMapper, SIGNAL(mapped(int)), trackView, SLOT(assignFxLine(int))); to_menu->addSeparator(); to_menu->addMenu( trackView->midiMenu() ); diff --git a/src/tracks/InstrumentTrack.cpp b/src/tracks/InstrumentTrack.cpp index e9317dc52..a4bef2828 100644 --- a/src/tracks/InstrumentTrack.cpp +++ b/src/tracks/InstrumentTrack.cpp @@ -963,6 +963,30 @@ InstrumentTrackWindow * InstrumentTrackView::topLevelInstrumentTrackWindow() + +/*! \brief Create and assign a new FX Channel for this track */ +void InstrumentTrackView::createFxLine() +{ + int channelIndex = gui->fxMixerView()->addNewChannel(); + + Engine::fxMixer()->effectChannel( channelIndex )->m_name = getTrack()->name(); + + assignFxLine(channelIndex); +} + + + + +/*! \brief Assign a specific FX Channel for this track */ +void InstrumentTrackView::assignFxLine(int channelIndex) +{ + model()->effectChannelModel()->setValue( channelIndex ); + + gui->fxMixerView()->setCurrentFxLine( channelIndex ); +} + + + // TODO: Add windows to free list on freeInstrumentTrackWindow. // But, don't NULL m_window or disconnect signals. This will allow windows // that are being show/hidden frequently to stay connected.