Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 28 additions & 14 deletions src/library/analysisfeature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,20 +86,34 @@ void AnalysisFeature::bindWidget(WLibrary* libraryWidget,
m_pAnalysisView = new DlgAnalysis(libraryWidget,
m_pConfig,
m_library);
connect(m_pAnalysisView, SIGNAL(loadTrack(TrackPointer)),
this, SIGNAL(loadTrack(TrackPointer)));
connect(m_pAnalysisView, SIGNAL(loadTrackToPlayer(TrackPointer, QString)),
this, SIGNAL(loadTrackToPlayer(TrackPointer, QString)));
connect(m_pAnalysisView, SIGNAL(analyzeTracks(QList<TrackId>)),
this, SLOT(analyzeTracks(QList<TrackId>)));
connect(m_pAnalysisView, SIGNAL(stopAnalysis()),
this, SLOT(stopAnalysis()));

connect(m_pAnalysisView, SIGNAL(trackSelected(TrackPointer)),
this, SIGNAL(trackSelected(TrackPointer)));

connect(this, SIGNAL(analysisActive(bool)),
m_pAnalysisView, SLOT(slotAnalysisActive(bool)));
connect(m_pAnalysisView,
&DlgAnalysis::loadTrack,
this,
&AnalysisFeature::loadTrack);
connect(m_pAnalysisView,
&DlgAnalysis::loadTrackToPlayer,
this,
[=](TrackPointer track, QString group) {
emit loadTrackToPlayer(track, group, false);
});
connect(m_pAnalysisView,
&DlgAnalysis::analyzeTracks,
this,
&AnalysisFeature::analyzeTracks);
connect(m_pAnalysisView,
&DlgAnalysis::stopAnalysis,
this,
&AnalysisFeature::stopAnalysis);

connect(m_pAnalysisView,
&DlgAnalysis::trackSelected,
this,
&AnalysisFeature::trackSelected);

connect(this,
&AnalysisFeature::analysisActive,
m_pAnalysisView,
&DlgAnalysis::slotAnalysisActive);

m_pAnalysisView->installEventFilter(keyboard);

Expand Down
85 changes: 55 additions & 30 deletions src/library/autodj/autodjfeature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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");

Expand Down Expand Up @@ -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.
Expand All @@ -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() {
Expand All @@ -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() {
Expand Down Expand Up @@ -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();
}
Expand Down
95 changes: 63 additions & 32 deletions src/library/autodj/dlgautodj.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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!
Expand All @@ -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();
Expand Down
18 changes: 12 additions & 6 deletions src/library/baseexternallibraryfeature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,22 @@ BaseExternalLibraryFeature::BaseExternalLibraryFeature(QObject* pParent,
: LibraryFeature(pParent),
m_pTrackCollection(pCollection) {
m_pAddToAutoDJAction = new QAction(tr("Add to Auto DJ Queue (bottom)"), this);
connect(m_pAddToAutoDJAction, SIGNAL(triggered()),
this, SLOT(slotAddToAutoDJ()));
connect(m_pAddToAutoDJAction,
&QAction::triggered,
this,
&BaseExternalLibraryFeature::slotAddToAutoDJ);

m_pAddToAutoDJTopAction = new QAction(tr("Add to Auto DJ Queue (top)"), this);
connect(m_pAddToAutoDJTopAction, SIGNAL(triggered()),
this, SLOT(slotAddToAutoDJTop()));
connect(m_pAddToAutoDJTopAction,
&QAction::triggered,
this,
&BaseExternalLibraryFeature::slotAddToAutoDJTop);

m_pImportAsMixxxPlaylistAction = new QAction(tr("Import Playlist"), this);
connect(m_pImportAsMixxxPlaylistAction, SIGNAL(triggered()),
this, SLOT(slotImportAsMixxxPlaylist()));
connect(m_pImportAsMixxxPlaylistAction,
&QAction::triggered,
this,
&BaseExternalLibraryFeature::slotImportAsMixxxPlaylist);
}

BaseExternalLibraryFeature::~BaseExternalLibraryFeature() {
Expand Down
Loading