diff options
Diffstat (limited to 'src/library/autodj')
-rw-r--r-- | src/library/autodj/autodjfeature.cpp | 85 | ||||
-rw-r--r-- | src/library/autodj/dlgautodj.cpp | 95 |
2 files changed, 118 insertions, 62 deletions
diff --git a/src/library/autodj/autodjfeature.cpp b/src/library/autodj/autodjfeature.cpp index 3ec62d7d6b..9bba9e0221 100644 --- a/src/library/autodj/autodjfeature.cpp +++ b/src/library/autodj/autodjfeature.cpp @@ -8,18 +8,19 @@ #include "library/autodj/autodjfeature.h" +#include "controllers/keyboard/keyboardeventfilter.h" +#include "library/autodj/autodjprocessor.h" +#include "library/autodj/dlgautodj.h" +#include "library/crate/cratestorage.h" #include "library/library.h" #include "library/parser.h" -#include "mixer/playermanager.h" -#include "library/autodj/autodjprocessor.h" #include "library/trackcollection.h" -#include "library/autodj/dlgautodj.h" #include "library/treeitem.h" -#include "library/crate/cratestorage.h" -#include "widget/wlibrary.h" -#include "controllers/keyboard/keyboardeventfilter.h" +#include "mixer/playermanager.h" #include "sources/soundsourceproxy.h" +#include "util/compatibility.h" #include "util/dnd.h" +#include "widget/wlibrary.h" const QString AutoDJFeature::m_sAutoDJViewName = QString("Auto DJ"); @@ -58,8 +59,10 @@ AutoDJFeature::AutoDJFeature(Library* pLibrary, qRegisterMetaType<AutoDJProcessor::AutoDJState>("AutoDJState"); m_pAutoDJProcessor = new AutoDJProcessor( this, m_pConfig, pPlayerManager, m_iAutoDJPlaylistId, m_pTrackCollection); - connect(m_pAutoDJProcessor, SIGNAL(loadTrackToPlayer(TrackPointer, QString, bool)), - this, SIGNAL(loadTrackToPlayer(TrackPointer, QString, bool))); + connect(m_pAutoDJProcessor, + &AutoDJProcessor::loadTrackToPlayer, + this, + &AutoDJFeature::loadTrackToPlayer); m_playlistDao.setAutoDJProcessor(m_pAutoDJProcessor); // Create the "Crates" tree-item under the root item. @@ -73,20 +76,30 @@ AutoDJFeature::AutoDJFeature(Library* pLibrary, m_childModel.setRootItem(std::move(pRootItem)); // Be notified when the status of crates changes. - connect(m_pTrackCollection, SIGNAL(crateInserted(CrateId)), - this, SLOT(slotCrateChanged(CrateId))); - connect(m_pTrackCollection, SIGNAL(crateUpdated(CrateId)), - this, SLOT(slotCrateChanged(CrateId))); - connect(m_pTrackCollection, SIGNAL(crateDeleted(CrateId)), - this, SLOT(slotCrateChanged(CrateId))); + connect(m_pTrackCollection, + &TrackCollection::crateInserted, + this, + &AutoDJFeature::slotCrateChanged); + connect(m_pTrackCollection, + &TrackCollection::crateUpdated, + this, + &AutoDJFeature::slotCrateChanged); + connect(m_pTrackCollection, + &TrackCollection::crateDeleted, + this, + &AutoDJFeature::slotCrateChanged); // Create context-menu items to allow crates to be added to, and removed // from, the auto-DJ queue. - connect(&m_crateMapper, SIGNAL(mapped(int)), - this, SLOT(slotAddCrateToAutoDj(int))); + connect(&m_crateMapper, + QOverload<int>::of(&QSignalMapper::mapped), + this, + &AutoDJFeature::slotAddCrateToAutoDj); m_pRemoveCrateFromAutoDj = new QAction(tr("Remove Crate as Track Source"), this); - connect(m_pRemoveCrateFromAutoDj, SIGNAL(triggered()), - this, SLOT(slotRemoveCrateFromAutoDj())); + connect(m_pRemoveCrateFromAutoDj, + &QAction::triggered, + this, + &AutoDJFeature::slotRemoveCrateFromAutoDj); } AutoDJFeature::~AutoDJFeature() { @@ -111,19 +124,29 @@ void AutoDJFeature::bindWidget(WLibrary* libraryWidget, m_pTrackCollection, keyboard); libraryWidget->registerView(m_sAutoDJViewName, m_pAutoDJView); - connect(m_pAutoDJView, SIGNAL(loadTrack(TrackPointer)), - this, SIGNAL(loadTrack(TrackPointer))); - connect(m_pAutoDJView, SIGNAL(loadTrackToPlayer(TrackPointer, QString, bool)), - this, SIGNAL(loadTrackToPlayer(TrackPointer, QString, bool))); - - connect(m_pAutoDJView, SIGNAL(trackSelected(TrackPointer)), - this, SIGNAL(trackSelected(TrackPointer))); + connect(m_pAutoDJView, + &DlgAutoDJ::loadTrack, + this, + &AutoDJFeature::loadTrack); + connect(m_pAutoDJView, + &DlgAutoDJ::loadTrackToPlayer, + this, + &AutoDJFeature::loadTrackToPlayer); + + connect(m_pAutoDJView, + &DlgAutoDJ::trackSelected, + this, + &AutoDJFeature::trackSelected); // Be informed when the user wants to add another random track. - connect(m_pAutoDJProcessor,SIGNAL(randomTrackRequested(int)), - this,SLOT(slotRandomQueue(int))); - connect(m_pAutoDJView, SIGNAL(addRandomButton(bool)), - this, SLOT(slotAddRandomTrack())); + connect(m_pAutoDJProcessor, + &AutoDJProcessor::randomTrackRequested, + this, + &AutoDJFeature::slotRandomQueue); + connect(m_pAutoDJView, + &DlgAutoDJ::addRandomButton, + this, + &AutoDJFeature::slotAddRandomTrack); } TreeItemModel* AutoDJFeature::getChildModel() { @@ -280,7 +303,9 @@ void AutoDJFeature::onRightClickChild(const QPoint& globalPos, while (nonAutoDjCrates.populateNext(&crate)) { auto pAction = std::make_unique<QAction>(crate.getName(), &crateMenu); m_crateMapper.setMapping(pAction.get(), crate.getId().value()); - connect(pAction.get(), SIGNAL(triggered()), &m_crateMapper, SLOT(map())); + connect(pAction.get(), + &QAction::triggered, + [=](bool) { m_crateMapper.map(); }); crateMenu.addAction(pAction.get()); pAction.release(); } diff --git a/src/library/autodj/dlgautodj.cpp b/src/library/autodj/dlgautodj.cpp index 311bbf6d38..d03de12e68 100644 --- a/src/library/autodj/dlgautodj.cpp +++ b/src/library/autodj/dlgautodj.cpp @@ -3,9 +3,10 @@ #include "library/autodj/dlgautodj.h" #include "library/playlisttablemodel.h" -#include "widget/wtracktableview.h" #include "util/assert.h" +#include "util/compatibility.h" #include "util/duration.h" +#include "widget/wtracktableview.h" DlgAutoDJ::DlgAutoDJ(QWidget* parent, UserSettingsPointer pConfig, @@ -23,21 +24,35 @@ DlgAutoDJ::DlgAutoDJ(QWidget* parent, setupUi(this); m_pTrackTableView->installEventFilter(pKeyboard); - connect(m_pTrackTableView, SIGNAL(loadTrack(TrackPointer)), - this, SIGNAL(loadTrack(TrackPointer))); - connect(m_pTrackTableView, SIGNAL(loadTrackToPlayer(TrackPointer, QString, bool)), - this, SIGNAL(loadTrackToPlayer(TrackPointer, QString, bool))); - connect(m_pTrackTableView, SIGNAL(trackSelected(TrackPointer)), - this, SIGNAL(trackSelected(TrackPointer))); - connect(m_pTrackTableView, SIGNAL(trackSelected(TrackPointer)), - this, SLOT(updateSelectionInfo())); - - connect(pLibrary, SIGNAL(setTrackTableFont(QFont)), - m_pTrackTableView, SLOT(setTrackTableFont(QFont))); - connect(pLibrary, SIGNAL(setTrackTableRowHeight(int)), - m_pTrackTableView, SLOT(setTrackTableRowHeight(int))); - connect(pLibrary, SIGNAL(setSelectedClick(bool)), - m_pTrackTableView, SLOT(setSelectedClick(bool))); + connect(m_pTrackTableView, + &WTrackTableView::loadTrack, + this, + &DlgAutoDJ::loadTrack); + connect(m_pTrackTableView, + &WTrackTableView::loadTrackToPlayer, + this, + &DlgAutoDJ::loadTrackToPlayer); + connect(m_pTrackTableView, + &WTrackTableView::trackSelected, + this, + &DlgAutoDJ::trackSelected); + connect(m_pTrackTableView, + &WTrackTableView::trackSelected, + this, + &DlgAutoDJ::updateSelectionInfo); + + connect(pLibrary, + &Library::setTrackTableFont, + m_pTrackTableView, + &WTrackTableView::setTrackTableFont); + connect(pLibrary, + &Library::setTrackTableRowHeight, + m_pTrackTableView, + &WTrackTableView::setTrackTableRowHeight); + connect(pLibrary, + &Library::setSelectedClick, + m_pTrackTableView, + &WTrackTableView::setSelectedClick); QBoxLayout* box = dynamic_cast<QBoxLayout*>(layout()); VERIFY_OR_DEBUG_ASSERT(box) { //Assumes the form layout is a QVBox/QHBoxLayout! @@ -56,32 +71,48 @@ DlgAutoDJ::DlgAutoDJ(QWidget* parent, // Do not set this because it disables auto-scrolling //m_pTrackTableView->setDragDropMode(QAbstractItemView::InternalMove); - connect(pushButtonShuffle, SIGNAL(clicked(bool)), - this, SLOT(shufflePlaylistButton(bool))); + connect(pushButtonShuffle, + &QPushButton::clicked, + this, + &DlgAutoDJ::shufflePlaylistButton); - connect(pushButtonSkipNext, SIGNAL(clicked(bool)), - this, SLOT(skipNextButton(bool))); + connect(pushButtonSkipNext, + &QPushButton::clicked, + this, + &DlgAutoDJ::skipNextButton); - connect(pushButtonAddRandom, SIGNAL(clicked(bool)), - this, SIGNAL(addRandomButton(bool))); + connect(pushButtonAddRandom, + &QPushButton::clicked, + this, + &DlgAutoDJ::addRandomButton); - connect(pushButtonFadeNow, SIGNAL(clicked(bool)), - this, SLOT(fadeNowButton(bool))); + connect(pushButtonFadeNow, + &QPushButton::clicked, + this, + &DlgAutoDJ::fadeNowButton); - connect(spinBoxTransition, SIGNAL(valueChanged(int)), - this, SLOT(transitionSliderChanged(int))); + connect(spinBoxTransition, + QOverload<int>::of(&QSpinBox::valueChanged), + this, + &DlgAutoDJ::transitionSliderChanged); - connect(pushButtonAutoDJ, SIGNAL(toggled(bool)), - this, SLOT(toggleAutoDJButton(bool))); + connect(pushButtonAutoDJ, + &QPushButton::toggled, + this, + &DlgAutoDJ::toggleAutoDJButton); // Setup DlgAutoDJ UI based on the current AutoDJProcessor state. Keep in // mind that AutoDJ may already be active when DlgAutoDJ is created (due to // skin changes, etc.). spinBoxTransition->setValue(m_pAutoDJProcessor->getTransitionTime()); - connect(m_pAutoDJProcessor, SIGNAL(transitionTimeChanged(int)), - this, SLOT(transitionTimeChanged(int))); - connect(m_pAutoDJProcessor, SIGNAL(autoDJStateChanged(AutoDJProcessor::AutoDJState)), - this, SLOT(autoDJStateChanged(AutoDJProcessor::AutoDJState))); + connect(m_pAutoDJProcessor, + &AutoDJProcessor::transitionTimeChanged, + this, + &DlgAutoDJ::transitionTimeChanged); + connect(m_pAutoDJProcessor, + &AutoDJProcessor::autoDJStateChanged, + this, + &DlgAutoDJ::autoDJStateChanged); autoDJStateChanged(m_pAutoDJProcessor->getState()); updateSelectionInfo(); |