diff --git a/src/library/analysisfeature.cpp b/src/library/analysisfeature.cpp index 779eed475dbc..2eeff2b019b2 100644 --- a/src/library/analysisfeature.cpp +++ b/src/library/analysisfeature.cpp @@ -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)), - this, SLOT(analyzeTracks(QList))); - 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); diff --git a/src/library/autodj/autodjfeature.cpp b/src/library/autodj/autodjfeature.cpp index 3ec62d7d6ba1..9bba9e022130 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("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::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(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 311bbf6d3857..d03de12e6875 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(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::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(); diff --git a/src/library/baseexternallibraryfeature.cpp b/src/library/baseexternallibraryfeature.cpp index b527c119d36a..8eee4928bdcc 100644 --- a/src/library/baseexternallibraryfeature.cpp +++ b/src/library/baseexternallibraryfeature.cpp @@ -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() { diff --git a/src/library/baseplaylistfeature.cpp b/src/library/baseplaylistfeature.cpp index 0c910be770ee..ba12a351d16b 100644 --- a/src/library/baseplaylistfeature.cpp +++ b/src/library/baseplaylistfeature.cpp @@ -30,73 +30,111 @@ BasePlaylistFeature::BasePlaylistFeature(QObject* parent, m_pPlaylistTableModel(NULL), m_rootViewName(rootViewName) { m_pCreatePlaylistAction = new QAction(tr("Create New Playlist"),this); - connect(m_pCreatePlaylistAction, SIGNAL(triggered()), - this, SLOT(slotCreatePlaylist())); + connect(m_pCreatePlaylistAction, + &QAction::triggered, + this, + &BasePlaylistFeature::slotCreatePlaylist); 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, + &BasePlaylistFeature::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, + &BasePlaylistFeature::slotAddToAutoDJTop); m_pDeletePlaylistAction = new QAction(tr("Remove"),this); - connect(m_pDeletePlaylistAction, SIGNAL(triggered()), - this, SLOT(slotDeletePlaylist())); + connect(m_pDeletePlaylistAction, + &QAction::triggered, + this, + &BasePlaylistFeature::slotDeletePlaylist); m_pRenamePlaylistAction = new QAction(tr("Rename"),this); - connect(m_pRenamePlaylistAction, SIGNAL(triggered()), - this, SLOT(slotRenamePlaylist())); + connect(m_pRenamePlaylistAction, + &QAction::triggered, + this, + &BasePlaylistFeature::slotRenamePlaylist); m_pLockPlaylistAction = new QAction(tr("Lock"),this); - connect(m_pLockPlaylistAction, SIGNAL(triggered()), - this, SLOT(slotTogglePlaylistLock())); + connect(m_pLockPlaylistAction, + &QAction::triggered, + this, + &BasePlaylistFeature::slotTogglePlaylistLock); m_pDuplicatePlaylistAction = new QAction(tr("Duplicate"), this); - connect(m_pDuplicatePlaylistAction, SIGNAL(triggered()), - this, SLOT(slotDuplicatePlaylist())); + connect(m_pDuplicatePlaylistAction, + &QAction::triggered, + this, + &BasePlaylistFeature::slotDuplicatePlaylist); m_pImportPlaylistAction = new QAction(tr("Import Playlist"),this); - connect(m_pImportPlaylistAction, SIGNAL(triggered()), - this, SLOT(slotImportPlaylist())); + connect(m_pImportPlaylistAction, + &QAction::triggered, + this, + &BasePlaylistFeature::slotImportPlaylist); m_pCreateImportPlaylistAction = new QAction(tr("Import Playlist"), this); - connect(m_pCreateImportPlaylistAction, SIGNAL(triggered()), - this, SLOT(slotCreateImportPlaylist())); + connect(m_pCreateImportPlaylistAction, + &QAction::triggered, + this, + &BasePlaylistFeature::slotCreateImportPlaylist); m_pExportPlaylistAction = new QAction(tr("Export Playlist"), this); - connect(m_pExportPlaylistAction, SIGNAL(triggered()), - this, SLOT(slotExportPlaylist())); + connect(m_pExportPlaylistAction, + &QAction::triggered, + this, + &BasePlaylistFeature::slotExportPlaylist); m_pExportTrackFilesAction = new QAction(tr("Export Track Files"), this); - connect(m_pExportTrackFilesAction, SIGNAL(triggered()), - this, SLOT(slotExportTrackFiles())); + connect(m_pExportTrackFilesAction, + &QAction::triggered, + this, + &BasePlaylistFeature::slotExportTrackFiles); m_pAnalyzePlaylistAction = new QAction(tr("Analyze entire Playlist"), this); - connect(m_pAnalyzePlaylistAction, SIGNAL(triggered()), - this, SLOT(slotAnalyzePlaylist())); - - connect(&m_playlistDao, SIGNAL(added(int)), - this, SLOT(slotPlaylistTableChanged(int))); - - connect(&m_playlistDao, SIGNAL(deleted(int)), - this, SLOT(slotPlaylistTableChanged(int))); - - connect(&m_playlistDao, SIGNAL(renamed(int,QString)), - this, SLOT(slotPlaylistTableRenamed(int,QString))); - - connect(&m_playlistDao, SIGNAL(changed(int)), - this, SLOT(slotPlaylistContentChanged(int))); - - connect(&m_playlistDao, SIGNAL(lockChanged(int)), - this, SLOT(slotPlaylistTableChanged(int))); + connect(m_pAnalyzePlaylistAction, + &QAction::triggered, + this, + &BasePlaylistFeature::slotAnalyzePlaylist); + + connect(&m_playlistDao, + &PlaylistDAO::added, + this, + &BasePlaylistFeature::slotPlaylistTableChanged); + + connect(&m_playlistDao, + &PlaylistDAO::deleted, + this, + &BasePlaylistFeature::slotPlaylistTableChanged); + + connect(&m_playlistDao, + &PlaylistDAO::renamed, + this, + &BasePlaylistFeature::slotPlaylistTableRenamed); + + connect(&m_playlistDao, + &PlaylistDAO::changed, + this, + &BasePlaylistFeature::slotPlaylistContentChanged); + + connect(&m_playlistDao, + &PlaylistDAO::lockChanged, + this, + &BasePlaylistFeature::slotPlaylistTableChanged); Library* pLibrary = static_cast(parent); - connect(pLibrary, SIGNAL(trackSelected(TrackPointer)), - this, SLOT(slotTrackSelected(TrackPointer))); - connect(pLibrary, SIGNAL(switchToView(const QString&)), - this, SLOT(slotResetSelectedTrack())); + connect(pLibrary, + &Library::trackSelected, + this, + &BasePlaylistFeature::slotTrackSelected); + connect(pLibrary, + &Library::switchToView, + this, + &BasePlaylistFeature::slotResetSelectedTrack); } BasePlaylistFeature::~BasePlaylistFeature() { @@ -599,8 +637,10 @@ void BasePlaylistFeature::bindWidget(WLibrary* libraryWidget, WLibraryTextBrowser* edit = new WLibraryTextBrowser(libraryWidget); edit->setHtml(getRootViewHtml()); edit->setOpenLinks(false); - connect(edit, SIGNAL(anchorClicked(const QUrl)), - this, SLOT(htmlLinkClicked(const QUrl))); + connect(edit, + &WLibraryTextBrowser::anchorClicked, + this, + &BasePlaylistFeature::htmlLinkClicked); libraryWidget->registerView(m_rootViewName, edit); } diff --git a/src/library/basesqltablemodel.cpp b/src/library/basesqltablemodel.cpp index ff3d5dd92356..96270efa87f8 100644 --- a/src/library/basesqltablemodel.cpp +++ b/src/library/basesqltablemodel.cpp @@ -2,7 +2,6 @@ #include #include -#include #include "library/basesqltablemodel.h" @@ -21,6 +20,7 @@ #include "util/duration.h" #include "util/assert.h" #include "util/performancetimer.h" +#include "widget/wlibrarytableview.h" static const bool sDebug = false; @@ -44,10 +44,14 @@ BaseSqlTableModel::BaseSqlTableModel(QObject* pParent, m_bInitialized(false), m_currentSearch("") { DEBUG_ASSERT(m_pTrackCollection); - connect(&PlayerInfo::instance(), SIGNAL(trackLoaded(QString, TrackPointer)), - this, SLOT(trackLoaded(QString, TrackPointer))); - connect(&m_pTrackCollection->getTrackDAO(), SIGNAL(forceModelUpdate()), - this, SLOT(select())); + connect(&PlayerInfo::instance(), + &PlayerInfo::trackLoaded, + this, + &BaseSqlTableModel::trackLoaded); + connect(&m_pTrackCollection->getTrackDAO(), + &TrackDAO::forceModelUpdate, + this, + &BaseSqlTableModel::select); // TODO(rryan): This is a virtual function call from a constructor. trackLoaded(m_previewDeckGroup, PlayerInfo::instance().getTrackInfo(m_previewDeckGroup)); } @@ -412,8 +416,10 @@ void BaseSqlTableModel::setTable(const QString& tableName, m_tableColumns = tableColumns; if (m_trackSource) { - disconnect(m_trackSource.data(), SIGNAL(tracksChanged(QSet)), - this, SLOT(tracksChanged(QSet))); + disconnect(m_trackSource.data(), + &BaseTrackCache::tracksChanged, + this, + &BaseSqlTableModel::tracksChanged); } m_trackSource = trackSource; if (m_trackSource) { @@ -424,8 +430,11 @@ void BaseSqlTableModel::setTable(const QString& tableName, // TODO: A better fix is to have cache and trackpointers defer saving // and deleting, so those operations only take place at the top of // the call stack. - connect(m_trackSource.data(), SIGNAL(tracksChanged(QSet)), - this, SLOT(tracksChanged(QSet)), Qt::QueuedConnection); + connect(m_trackSource.data(), + &BaseTrackCache::tracksChanged, + this, + &BaseSqlTableModel::tracksChanged, + Qt::QueuedConnection); } // Build a map from the column names to their indices, used by fieldIndex() @@ -1104,7 +1113,7 @@ QMimeData* BaseSqlTableModel::mimeData(const QModelIndexList &indexes) const { } QAbstractItemDelegate* BaseSqlTableModel::delegateForColumn(const int i, QObject* pParent) { - QTableView* pTableView = qobject_cast(pParent); + auto* pTableView = qobject_cast(pParent); DEBUG_ASSERT(pTableView); if (i == fieldIndex(ColumnCache::COLUMN_LIBRARYTABLE_RATING)) { @@ -1117,11 +1126,13 @@ QAbstractItemDelegate* BaseSqlTableModel::delegateForColumn(const int i, QObject return new LocationDelegate(pTableView); } else if (i == fieldIndex(ColumnCache::COLUMN_LIBRARYTABLE_COVERART)) { CoverArtDelegate* pCoverDelegate = new CoverArtDelegate(pTableView); - connect(pCoverDelegate, SIGNAL(coverReadyForCell(int, int)), - this, SLOT(refreshCell(int, int))); + connect(pCoverDelegate, + &CoverArtDelegate::coverReadyForCell, + this, + &BaseSqlTableModel::refreshCell); return pCoverDelegate; } - return NULL; + return nullptr; } void BaseSqlTableModel::refreshCell(int row, int column) { diff --git a/src/library/basetrackcache.h b/src/library/basetrackcache.h index a009618b285b..1d77420d6be7 100644 --- a/src/library/basetrackcache.h +++ b/src/library/basetrackcache.h @@ -79,7 +79,7 @@ class BaseTrackCache : public QObject { signals: void tracksChanged(QSet trackIds); - private slots: + public slots: void slotTracksAdded(QSet trackId); void slotTracksRemoved(QSet trackId); void slotTrackDirty(TrackId trackId); diff --git a/src/library/browse/browsefeature.cpp b/src/library/browse/browsefeature.cpp index b5757e226b4f..b5c20f836d6b 100644 --- a/src/library/browse/browsefeature.cpp +++ b/src/library/browse/browsefeature.cpp @@ -1,32 +1,32 @@ // browsefeature.cpp // Created 9/8/2009 by RJ Ryan (rryan@mit.edu) -#include -#include +#include #include -#include #include -#include -#include #include #include +#include +#include +#include -#include "track/track.h" -#include "library/treeitem.h" +#include "controllers/keyboard/keyboardeventfilter.h" #include "library/browse/browsefeature.h" +#include "library/library.h" #include "library/trackcollection.h" -#include "widget/wlibrarytextbrowser.h" -#include "widget/wlibrary.h" -#include "controllers/keyboard/keyboardeventfilter.h" -#include "util/sandbox.h" +#include "library/treeitem.h" +#include "track/track.h" #include "util/memory.h" +#include "util/sandbox.h" +#include "widget/wlibrary.h" +#include "widget/wlibrarytextbrowser.h" const QString kQuickLinksSeparator = "-+-"; -BrowseFeature::BrowseFeature(QObject* parent, - UserSettingsPointer pConfig, - TrackCollection* pTrackCollection, - RecordingManager* pRecordingManager) +BrowseFeature::BrowseFeature(Library* parent, + UserSettingsPointer pConfig, + TrackCollection* pTrackCollection, + RecordingManager* pRecordingManager) : LibraryFeature(parent), m_pConfig(pConfig), m_browseModel(this, pTrackCollection, pRecordingManager), @@ -34,18 +34,28 @@ BrowseFeature::BrowseFeature(QObject* parent, m_pTrackCollection(pTrackCollection), m_pLastRightClickedItem(NULL), m_icon(":/images/library/ic_library_computer.svg") { - connect(this, SIGNAL(requestAddDir(QString)), - parent, SLOT(slotRequestAddDir(QString))); + connect(this, + &BrowseFeature::requestAddDir, + parent, + &Library::slotRequestAddDir); m_pAddQuickLinkAction = new QAction(tr("Add to Quick Links"),this); - connect(m_pAddQuickLinkAction, SIGNAL(triggered()), this, SLOT(slotAddQuickLink())); + connect(m_pAddQuickLinkAction, + &QAction::triggered, + this, + &BrowseFeature::slotAddQuickLink); m_pRemoveQuickLinkAction = new QAction(tr("Remove from Quick Links"),this); - connect(m_pRemoveQuickLinkAction, SIGNAL(triggered()), this, SLOT(slotRemoveQuickLink())); + connect(m_pRemoveQuickLinkAction, + &QAction::triggered, + this, + &BrowseFeature::slotRemoveQuickLink); m_pAddtoLibraryAction = new QAction(tr("Add to Library"),this); - connect(m_pAddtoLibraryAction, SIGNAL(triggered()), - this, SLOT(slotAddToLibrary())); + connect(m_pAddtoLibraryAction, + &QAction::triggered, + this, + &BrowseFeature::slotAddToLibrary); m_proxyModel.setFilterCaseSensitivity(Qt::CaseInsensitive); m_proxyModel.setSortCaseSensitivity(Qt::CaseInsensitive); diff --git a/src/library/browse/browsefeature.h b/src/library/browse/browsefeature.h index a41461475937..76994191bc09 100644 --- a/src/library/browse/browsefeature.h +++ b/src/library/browse/browsefeature.h @@ -22,15 +22,16 @@ #define QUICK_LINK_NODE "::mixxx_quick_lnk_node::" #define DEVICE_NODE "::mixxx_device_node::" +class Library; class TrackCollection; class BrowseFeature : public LibraryFeature { Q_OBJECT public: - BrowseFeature(QObject* parent, - UserSettingsPointer pConfig, - TrackCollection* pTrackCollection, - RecordingManager* pRec); + BrowseFeature(Library* parent, + UserSettingsPointer pConfig, + TrackCollection* pTrackCollection, + RecordingManager* pRecordingManager); virtual ~BrowseFeature(); QVariant title(); diff --git a/src/library/browse/browsetablemodel.cpp b/src/library/browse/browsetablemodel.cpp index abd06a574f47..a7a7d52df22e 100644 --- a/src/library/browse/browsetablemodel.cpp +++ b/src/library/browse/browsetablemodel.cpp @@ -6,13 +6,14 @@ #include #include +#include "control/controlobject.h" #include "library/browse/browsetablemodel.h" #include "library/browse/browsethread.h" +#include "library/dao/trackdao.h" #include "library/previewbuttondelegate.h" #include "mixer/playerinfo.h" #include "mixer/playermanager.h" -#include "control/controlobject.h" -#include "library/dao/trackdao.h" +#include "widget/wlibrarytableview.h" BrowseTableModel::BrowseTableModel(QObject* parent, TrackCollection* pTrackCollection, @@ -103,18 +104,22 @@ BrowseTableModel::BrowseTableModel(QObject* parent, qRegisterMetaType("BrowseTableModel*"); m_pBrowseThread = BrowseThread::getInstanceRef(); - connect(m_pBrowseThread.data(), SIGNAL(clearModel(BrowseTableModel*)), - this, SLOT(slotClear(BrowseTableModel*)), + connect(m_pBrowseThread.data(), + &BrowseThread::clearModel, + this, + &BrowseTableModel::slotClear, Qt::QueuedConnection); connect(m_pBrowseThread.data(), - SIGNAL(rowsAppended(const QList< QList >&, BrowseTableModel*)), + &BrowseThread::rowsAppended, this, - SLOT(slotInsert(const QList< QList >&, BrowseTableModel*)), + &BrowseTableModel::slotInsert, Qt::QueuedConnection); - connect(&PlayerInfo::instance(), SIGNAL(trackLoaded(QString, TrackPointer)), - this, SLOT(trackLoaded(QString, TrackPointer))); + connect(&PlayerInfo::instance(), + &PlayerInfo::trackLoaded, + this, + &BrowseTableModel::trackLoaded); trackLoaded(m_previewDeckGroup, PlayerInfo::instance().getTrackInfo(m_previewDeckGroup)); } @@ -413,10 +418,10 @@ bool BrowseTableModel::isColumnSortable(int column) { } QAbstractItemDelegate* BrowseTableModel::delegateForColumn(const int i, QObject* pParent) { - QTableView* pTableView = qobject_cast(pParent); + WLibraryTableView* pTableView = qobject_cast(pParent); DEBUG_ASSERT(pTableView); if (PlayerManager::numPreviewDecks() > 0 && i == COLUMN_PREVIEW) { return new PreviewButtonDelegate(pTableView, i); } - return NULL; + return nullptr; } diff --git a/src/library/coverartcache.cpp b/src/library/coverartcache.cpp index 446761c28232..6aeaa1107400 100644 --- a/src/library/coverartcache.cpp +++ b/src/library/coverartcache.cpp @@ -99,7 +99,10 @@ QPixmap CoverArtCache::requestCover(const CoverInfo& requestInfo, QFuture future = QtConcurrent::run( this, &CoverArtCache::loadCover, requestInfo, pRequestor, desiredWidth, signalWhenDone); - connect(watcher, SIGNAL(finished()), this, SLOT(coverLoaded())); + connect(watcher, + &QFutureWatcher::finished, + this, + &CoverArtCache::coverLoaded); watcher->setFuture(future); return QPixmap(); } diff --git a/src/library/coverartdelegate.cpp b/src/library/coverartdelegate.cpp index 871807d2e8e4..db399862bba2 100644 --- a/src/library/coverartdelegate.cpp +++ b/src/library/coverartdelegate.cpp @@ -1,12 +1,16 @@ -#include #include #include "library/coverartdelegate.h" #include "library/coverartcache.h" #include "library/dao/trackschema.h" +#include "library/trackmodel.h" + +#include "widget/wlibrarytableview.h" + #include "util/math.h" -CoverArtDelegate::CoverArtDelegate(QTableView* parent) + +CoverArtDelegate::CoverArtDelegate(WLibraryTableView* parent) : TableItemDelegate(parent), m_pTableView(parent), m_bOnlyCachedCover(false), @@ -18,21 +22,22 @@ CoverArtDelegate::CoverArtDelegate(QTableView* parent) m_iTrackLocationColumn(-1), m_iIdColumn(-1) { // This assumes that the parent is wtracktableview - connect(parent, SIGNAL(onlyCachedCoverArt(bool)), - this, SLOT(slotOnlyCachedCoverArt(bool))); + connect(parent, + &WLibraryTableView::onlyCachedCoverArt, + this, + &CoverArtDelegate::slotOnlyCachedCoverArt); CoverArtCache* pCache = CoverArtCache::instance(); if (pCache) { - connect(pCache, SIGNAL(coverFound(const QObject*, const CoverInfoRelative&, - QPixmap, bool)), - this, SLOT(slotCoverFound(const QObject*, const CoverInfoRelative&, - QPixmap, bool))); + connect(pCache, + &CoverArtCache::coverFound, + this, + &CoverArtDelegate::slotCoverFound); } - TrackModel* pTrackModel = NULL; - QTableView* pTableView = NULL; - if (QTableView *tableView = qobject_cast(parent)) { - pTableView = tableView; + TrackModel* pTrackModel = nullptr; + QTableView* pTableView = qobject_cast(parent); + if (pTableView) { pTrackModel = dynamic_cast(pTableView->model()); } @@ -54,9 +59,6 @@ CoverArtDelegate::CoverArtDelegate(QTableView* parent) } } -CoverArtDelegate::~CoverArtDelegate() { -} - void CoverArtDelegate::slotOnlyCachedCoverArt(bool b) { m_bOnlyCachedCover = b; diff --git a/src/library/coverartdelegate.h b/src/library/coverartdelegate.h index d5031c76fc31..2713555bd445 100644 --- a/src/library/coverartdelegate.h +++ b/src/library/coverartdelegate.h @@ -2,16 +2,20 @@ #define COVERARTDELEGATE_H #include +#include #include #include "library/tableitemdelegate.h" -#include "library/trackmodel.h" + +class CoverInfoRelative; +class TrackModel; +class WLibraryTableView; class CoverArtDelegate : public TableItemDelegate { Q_OBJECT public: - explicit CoverArtDelegate(QTableView* pTableView); - virtual ~CoverArtDelegate(); + explicit CoverArtDelegate(WLibraryTableView* parent); + ~CoverArtDelegate() override = default; void paintItem(QPainter* painter, const QStyleOptionViewItem& option, diff --git a/src/library/crate/cratefeature.cpp b/src/library/crate/cratefeature.cpp index bcc5cd83fc58..d6d52dd32c41 100644 --- a/src/library/crate/cratefeature.cpp +++ b/src/library/crate/cratefeature.cpp @@ -63,69 +63,105 @@ CrateFeature::~CrateFeature() { void CrateFeature::initActions() { m_pCreateCrateAction = make_parented(tr("Create New Crate"), this); - connect(m_pCreateCrateAction.get(), SIGNAL(triggered()), - this, SLOT(slotCreateCrate())); + connect(m_pCreateCrateAction.get(), + &QAction::triggered, + this, + &CrateFeature::slotCreateCrate); m_pDeleteCrateAction = make_parented(tr("Remove"), this); - connect(m_pDeleteCrateAction.get(), SIGNAL(triggered()), - this, SLOT(slotDeleteCrate())); + connect(m_pDeleteCrateAction.get(), + &QAction::triggered, + this, + &CrateFeature::slotDeleteCrate); m_pRenameCrateAction = make_parented(tr("Rename"), this); - connect(m_pRenameCrateAction.get(), SIGNAL(triggered()), - this, SLOT(slotRenameCrate())); + connect(m_pRenameCrateAction.get(), + &QAction::triggered, + this, + &CrateFeature::slotRenameCrate); m_pLockCrateAction = make_parented(tr("Lock"), this); - connect(m_pLockCrateAction.get(), SIGNAL(triggered()), - this, SLOT(slotToggleCrateLock())); + connect(m_pLockCrateAction.get(), + &QAction::triggered, + this, + &CrateFeature::slotToggleCrateLock); m_pImportPlaylistAction = make_parented(tr("Import Crate"), this); - connect(m_pImportPlaylistAction.get(), SIGNAL(triggered()), - this, SLOT(slotImportPlaylist())); + connect(m_pImportPlaylistAction.get(), + &QAction::triggered, + this, + &CrateFeature::slotImportPlaylist); m_pCreateImportPlaylistAction = make_parented(tr("Import Crate"), this); - connect(m_pCreateImportPlaylistAction.get(), SIGNAL(triggered()), - this, SLOT(slotCreateImportCrate())); + connect(m_pCreateImportPlaylistAction.get(), + &QAction::triggered, + this, + &CrateFeature::slotCreateImportCrate); m_pExportPlaylistAction = make_parented(tr("Export Crate"), this); - connect(m_pExportPlaylistAction.get(), SIGNAL(triggered()), - this, SLOT(slotExportPlaylist())); + connect(m_pExportPlaylistAction.get(), + &QAction::triggered, + this, + &CrateFeature::slotExportPlaylist); m_pExportTrackFilesAction = make_parented(tr("Export Track Files"), this); - connect(m_pExportTrackFilesAction.get(), SIGNAL(triggered()), - this, SLOT(slotExportTrackFiles())); + connect(m_pExportTrackFilesAction.get(), + &QAction::triggered, + this, + &CrateFeature::slotExportTrackFiles); m_pDuplicateCrateAction = make_parented(tr("Duplicate"), this); - connect(m_pDuplicateCrateAction.get(), SIGNAL(triggered()), - this, SLOT(slotDuplicateCrate())); + connect(m_pDuplicateCrateAction.get(), + &QAction::triggered, + this, + &CrateFeature::slotDuplicateCrate); m_pAnalyzeCrateAction = make_parented(tr("Analyze entire Crate"), this); - connect(m_pAnalyzeCrateAction.get(), SIGNAL(triggered()), - this, SLOT(slotAnalyzeCrate())); + connect(m_pAnalyzeCrateAction.get(), + &QAction::triggered, + this, + &CrateFeature::slotAnalyzeCrate); m_pAutoDjTrackSourceAction = make_parented(tr("Auto DJ Track Source"), this); m_pAutoDjTrackSourceAction->setCheckable(true); - connect(m_pAutoDjTrackSourceAction.get(), SIGNAL(changed()), - this, SLOT(slotAutoDjTrackSourceChanged())); + connect(m_pAutoDjTrackSourceAction.get(), + &QAction::changed, + this, + &CrateFeature::slotAutoDjTrackSourceChanged); } void CrateFeature::connectLibrary(Library* pLibrary) { - connect(pLibrary, SIGNAL(trackSelected(TrackPointer)), - this, SLOT(slotTrackSelected(TrackPointer))); - connect(pLibrary, SIGNAL(switchToView(const QString&)), - this, SLOT(slotResetSelectedTrack())); + connect(pLibrary, + &Library::trackSelected, + this, + &CrateFeature::slotTrackSelected); + connect(pLibrary, + &Library::switchToView, + this, + &CrateFeature::slotResetSelectedTrack); } void CrateFeature::connectTrackCollection() { - connect(m_pTrackCollection, SIGNAL(crateInserted(CrateId)), - this, SLOT(slotCrateTableChanged(CrateId))); - connect(m_pTrackCollection, SIGNAL(crateUpdated(CrateId)), - this, SLOT(slotCrateTableChanged(CrateId))); - connect(m_pTrackCollection, SIGNAL(crateDeleted(CrateId)), - this, SLOT(slotCrateTableChanged(CrateId))); - connect(m_pTrackCollection, SIGNAL(crateTracksChanged(CrateId, QList, QList)), - this, SLOT(slotCrateContentChanged(CrateId))); - connect(m_pTrackCollection, SIGNAL(crateSummaryChanged(QSet)), - this, SLOT(slotUpdateCrateLabels(QSet))); + connect(m_pTrackCollection, + &TrackCollection::crateInserted, + this, + &CrateFeature::slotCrateTableChanged); + connect(m_pTrackCollection, + &TrackCollection::crateUpdated, + this, + &CrateFeature::slotCrateTableChanged); + connect(m_pTrackCollection, + &TrackCollection::crateDeleted, + this, + &CrateFeature::slotCrateTableChanged); + connect(m_pTrackCollection, + &TrackCollection::crateTracksChanged, + this, + &CrateFeature::slotCrateContentChanged); + connect(m_pTrackCollection, + &TrackCollection::crateSummaryChanged, + this, + &CrateFeature::slotUpdateCrateLabels); } QVariant CrateFeature::title() { @@ -243,8 +279,10 @@ void CrateFeature::bindWidget(WLibrary* libraryWidget, WLibraryTextBrowser* edit = new WLibraryTextBrowser(libraryWidget); edit->setHtml(formatRootViewHtml()); edit->setOpenLinks(false); - connect(edit, SIGNAL(anchorClicked(const QUrl)), - this, SLOT(htmlLinkClicked(const QUrl))); + connect(edit, + &WLibraryTextBrowser::anchorClicked, + this, + &CrateFeature::htmlLinkClicked); libraryWidget->registerView("CRATEHOME", edit); } diff --git a/src/library/dao/autodjcratesdao.cpp b/src/library/dao/autodjcratesdao.cpp index 43557dc81c7a..64e0949267fc 100644 --- a/src/library/dao/autodjcratesdao.cpp +++ b/src/library/dao/autodjcratesdao.cpp @@ -194,41 +194,62 @@ void AutoDJCratesDAO::createAndConnectAutoDjCratesDatabase() { // Be notified when a track is modified. // We only care when the number of times it's been played changes. - connect(&m_pTrackCollection->getTrackDAO(), SIGNAL(trackDirty(TrackId)), - this, SLOT(slotTrackDirty(TrackId))); + connect(&m_pTrackCollection->getTrackDAO(), + &TrackDAO::trackDirty, + this, + &AutoDJCratesDAO::slotTrackDirty); // Be notified when the status of crates changes. - connect(m_pTrackCollection, SIGNAL(crateInserted(CrateId)), - this, SLOT(slotCrateInserted(CrateId))); - connect(m_pTrackCollection, SIGNAL(crateDeleted(CrateId)), - this, SLOT(slotCrateDeleted(CrateId))); - connect(m_pTrackCollection, SIGNAL(crateUpdated(CrateId)), - this, SLOT(slotCrateUpdated(CrateId))); - connect(m_pTrackCollection, SIGNAL(crateTracksChanged(CrateId,QList,QList)), - this, SLOT(slotCrateTracksChanged(CrateId,QList,QList))); + connect(m_pTrackCollection, + &TrackCollection::crateInserted, + this, + &AutoDJCratesDAO::slotCrateInserted); + connect(m_pTrackCollection, + &TrackCollection::crateDeleted, + this, + &AutoDJCratesDAO::slotCrateDeleted); + connect(m_pTrackCollection, + &TrackCollection::crateUpdated, + this, + &AutoDJCratesDAO::slotCrateUpdated); + connect(m_pTrackCollection, + &TrackCollection::crateTracksChanged, + this, + &AutoDJCratesDAO::slotCrateTracksChanged); // Be notified when playlists are added/removed. // We only care about set-log playlists. - connect(&m_pTrackCollection->getPlaylistDAO(), SIGNAL(added(int)), - this, SLOT(slotPlaylistAdded(int))); - connect(&m_pTrackCollection->getPlaylistDAO(), SIGNAL(deleted(int)), - this, SLOT(slotPlaylistDeleted(int))); + connect(&m_pTrackCollection->getPlaylistDAO(), + &PlaylistDAO::added, + this, + &AutoDJCratesDAO::slotPlaylistAdded); + connect(&m_pTrackCollection->getPlaylistDAO(), + &PlaylistDAO::deleted, + this, + &AutoDJCratesDAO::slotPlaylistDeleted); // Be notified when tracks are added/removed from playlists. // We only care about the auto-DJ playlist and the set-log playlists. - connect(&m_pTrackCollection->getPlaylistDAO(), SIGNAL(trackAdded(int,TrackId,int)), - this, SLOT(slotPlaylistTrackAdded(int,TrackId,int))); - connect(&m_pTrackCollection->getPlaylistDAO(), SIGNAL(trackRemoved(int,TrackId,int)), - this, SLOT(slotPlaylistTrackRemoved(int,TrackId,int))); + connect(&m_pTrackCollection->getPlaylistDAO(), + &PlaylistDAO::trackAdded, + this, + &AutoDJCratesDAO::slotPlaylistTrackAdded); + connect(&m_pTrackCollection->getPlaylistDAO(), + &PlaylistDAO::trackRemoved, + this, + &AutoDJCratesDAO::slotPlaylistTrackRemoved); // Be notified when tracks are loaded to, or unloaded from, a deck. // These count as auto-DJ references, i.e. prevent the track from being // selected randomly. - connect(&PlayerInfo::instance(), SIGNAL(trackLoaded(QString,TrackPointer)), - this, SLOT(slotPlayerInfoTrackLoaded(QString,TrackPointer))); connect(&PlayerInfo::instance(), - SIGNAL(trackUnloaded(QString,TrackPointer)), - this, SLOT(slotPlayerInfoTrackUnloaded(QString,TrackPointer))); + &PlayerInfo::trackLoaded, + this, + &AutoDJCratesDAO::slotPlayerInfoTrackLoaded); + connect(&PlayerInfo::instance(), + &PlayerInfo::trackUnloaded, + this, + &AutoDJCratesDAO::slotPlayerInfoTrackUnloaded); // Remember that the auto-DJ-crates database has been created. m_bAutoDjCratesDbCreated = true; diff --git a/src/library/dao/trackdao.cpp b/src/library/dao/trackdao.cpp index 26b0b4da1470..a3e4d50d99fa 100644 --- a/src/library/dao/trackdao.cpp +++ b/src/library/dao/trackdao.cpp @@ -1407,14 +1407,20 @@ TrackPointer TrackDAO::getTrackFromDB(TrackId trackId) const { } // Listen to dirty and changed signals - connect(pTrack.get(), SIGNAL(dirty(Track*)), - this, SLOT(slotTrackDirty(Track*)), + connect(pTrack.get(), + &Track::dirty, + this, + &TrackDAO::slotTrackDirty, Qt::DirectConnection); - connect(pTrack.get(), SIGNAL(clean(Track*)), - this, SLOT(slotTrackClean(Track*)), + connect(pTrack.get(), + &Track::clean, + this, + &TrackDAO::slotTrackClean, Qt::DirectConnection); - connect(pTrack.get(), SIGNAL(changed(Track*)), - this, SLOT(slotTrackChanged(Track*)), + connect(pTrack.get(), + &Track::changed, + this, + &TrackDAO::slotTrackChanged, Qt::DirectConnection); // BaseTrackCache cares about track trackDirty/trackClean notifications diff --git a/src/library/dlganalysis.cpp b/src/library/dlganalysis.cpp index c3c123c6da45..a1484ede503d 100644 --- a/src/library/dlganalysis.cpp +++ b/src/library/dlganalysis.cpp @@ -22,13 +22,19 @@ DlgAnalysis::DlgAnalysis(QWidget* parent, m_songsButtonGroup.addButton(radioButtonAllSongs); m_pAnalysisLibraryTableView = new WAnalysisLibraryTableView(this, pConfig, m_pTrackCollection); - connect(m_pAnalysisLibraryTableView, SIGNAL(loadTrack(TrackPointer)), - this, SIGNAL(loadTrack(TrackPointer))); - connect(m_pAnalysisLibraryTableView, SIGNAL(loadTrackToPlayer(TrackPointer, QString)), - this, SIGNAL(loadTrackToPlayer(TrackPointer, QString))); + connect(m_pAnalysisLibraryTableView, + &WAnalysisLibraryTableView::loadTrack, + this, + &DlgAnalysis::loadTrack); + connect(m_pAnalysisLibraryTableView, + &WAnalysisLibraryTableView::loadTrackToPlayer, + this, + &DlgAnalysis::loadTrackToPlayer); - connect(m_pAnalysisLibraryTableView, SIGNAL(trackSelected(TrackPointer)), - this, SIGNAL(trackSelected(TrackPointer))); + connect(m_pAnalysisLibraryTableView, + &WAnalysisLibraryTableView::trackSelected, + this, + &DlgAnalysis::trackSelected); QBoxLayout* box = dynamic_cast(layout()); VERIFY_OR_DEBUG_ASSERT(box) { // Assumes the form layout is a QVBox/QHBoxLayout! @@ -41,32 +47,46 @@ DlgAnalysis::DlgAnalysis(QWidget* parent, m_pAnalysisLibraryTableModel = new AnalysisLibraryTableModel(this, m_pTrackCollection); m_pAnalysisLibraryTableView->loadTrackModel(m_pAnalysisLibraryTableModel); - connect(radioButtonRecentlyAdded, SIGNAL(clicked()), - this, SLOT(showRecentSongs())); - connect(radioButtonAllSongs, SIGNAL(clicked()), - this, SLOT(showAllSongs())); + connect(radioButtonRecentlyAdded, + &QRadioButton::clicked, + this, + &DlgAnalysis::showRecentSongs); + connect(radioButtonAllSongs, + &QRadioButton::clicked, + this, + &DlgAnalysis::showAllSongs); // TODO(rryan): This triggers a library search before the UI has even // started up. Accounts for 0.2% of skin creation time. Get rid of this! radioButtonRecentlyAdded->click(); - connect(pushButtonAnalyze, SIGNAL(clicked()), - this, SLOT(analyze())); + connect(pushButtonAnalyze, + &QPushButton::clicked, + this, + &DlgAnalysis::analyze); - connect(pushButtonSelectAll, SIGNAL(clicked()), - this, SLOT(selectAll())); + connect(pushButtonSelectAll, + &QPushButton::clicked, + this, + &DlgAnalysis::selectAll); connect(m_pAnalysisLibraryTableView->selectionModel(), - SIGNAL(selectionChanged(const QItemSelection &, const QItemSelection&)), + &QItemSelectionModel::selectionChanged, this, - SLOT(tableSelectionChanged(const QItemSelection &, const QItemSelection&))); - - connect(pLibrary, SIGNAL(setTrackTableFont(QFont)), - m_pAnalysisLibraryTableView, SLOT(setTrackTableFont(QFont))); - connect(pLibrary, SIGNAL(setTrackTableRowHeight(int)), - m_pAnalysisLibraryTableView, SLOT(setTrackTableRowHeight(int))); - connect(pLibrary, SIGNAL(setSelectedClick(bool)), - m_pAnalysisLibraryTableView, SLOT(setSelectedClick(bool))); + &DlgAnalysis::tableSelectionChanged); + + connect(pLibrary, + &Library::setTrackTableFont, + m_pAnalysisLibraryTableView, + &WAnalysisLibraryTableView::setTrackTableFont); + connect(pLibrary, + &Library::setTrackTableRowHeight, + m_pAnalysisLibraryTableView, + &WAnalysisLibraryTableView::setTrackTableRowHeight); + connect(pLibrary, + &Library::setSelectedClick, + m_pAnalysisLibraryTableView, + &WAnalysisLibraryTableView::setSelectedClick); slotAnalysisActive(m_bAnalysisActive); } diff --git a/src/library/dlgcoverartfullsize.cpp b/src/library/dlgcoverartfullsize.cpp index a17f4a44b3bd..8eda69878228 100644 --- a/src/library/dlgcoverartfullsize.cpp +++ b/src/library/dlgcoverartfullsize.cpp @@ -19,16 +19,24 @@ DlgCoverArtFullSize::DlgCoverArtFullSize(QWidget* parent, BaseTrackPlayer* pPlay } setContextMenuPolicy(Qt::CustomContextMenu); - connect(this, SIGNAL(customContextMenuRequested(QPoint)), - this, SLOT(slotCoverMenu(QPoint))); - connect(m_pCoverMenu, SIGNAL(coverInfoSelected(const CoverInfoRelative&)), - this, SLOT(slotCoverInfoSelected(const CoverInfoRelative&))); - connect(m_pCoverMenu, SIGNAL(reloadCoverArt()), - this, SLOT(slotReloadCoverArt())); + connect(this, + &DlgCoverArtFullSize::customContextMenuRequested, + this, + &DlgCoverArtFullSize::slotCoverMenu); + connect(m_pCoverMenu, + &WCoverArtMenu::coverInfoSelected, + this, + &DlgCoverArtFullSize::slotCoverInfoSelected); + connect(m_pCoverMenu, + &WCoverArtMenu::reloadCoverArt, + this, + &DlgCoverArtFullSize::slotReloadCoverArt); if (m_pPlayer != nullptr) { - connect(pPlayer, SIGNAL(newTrackLoaded(TrackPointer)), - this, SLOT(slotLoadTrack(TrackPointer))); + connect(pPlayer, + &BaseTrackPlayer::newTrackLoaded, + this, + &DlgCoverArtFullSize::slotLoadTrack); } setupUi(this); @@ -49,13 +57,17 @@ void DlgCoverArtFullSize::init(TrackPointer pTrack) { void DlgCoverArtFullSize::slotLoadTrack(TrackPointer pTrack) { if (m_pLoadedTrack != nullptr) { - disconnect(m_pLoadedTrack.get(), SIGNAL(coverArtUpdated()), - this, SLOT(slotTrackCoverArtUpdated())); + disconnect(m_pLoadedTrack.get(), + &Track::coverArtUpdated, + this, + &DlgCoverArtFullSize::slotTrackCoverArtUpdated); } m_pLoadedTrack = pTrack; if (m_pLoadedTrack != nullptr) { - connect(m_pLoadedTrack.get(), SIGNAL(coverArtUpdated()), - this, SLOT(slotTrackCoverArtUpdated())); + connect(m_pLoadedTrack.get(), + &Track::coverArtUpdated, + this, + &DlgCoverArtFullSize::slotTrackCoverArtUpdated); // Somehow setting the widow title triggered a bug in Xlib that resulted // in a deadlock before the check for isVisible() was added. diff --git a/src/library/dlghidden.cpp b/src/library/dlghidden.cpp index 19462e6e5085..162c1005ae83 100644 --- a/src/library/dlghidden.cpp +++ b/src/library/dlghidden.cpp @@ -27,29 +27,47 @@ DlgHidden::DlgHidden(QWidget* parent, UserSettingsPointer pConfig, m_pHiddenTableModel = new HiddenTableModel(this, pLibrary); m_pTrackTableView->loadTrackModel(m_pHiddenTableModel); - connect(btnUnhide, SIGNAL(clicked()), - m_pTrackTableView, SLOT(slotUnhide())); - connect(btnUnhide, SIGNAL(clicked()), - this, SLOT(clicked())); - connect(btnPurge, SIGNAL(clicked()), - m_pTrackTableView, SLOT(slotPurge())); - connect(btnPurge, SIGNAL(clicked()), - this, SLOT(clicked())); - connect(btnSelect, SIGNAL(clicked()), - this, SLOT(selectAll())); + connect(btnUnhide, + &QPushButton::clicked, + m_pTrackTableView, + &WTrackTableView::slotUnhide); + connect(btnUnhide, + &QPushButton::clicked, + this, + &DlgHidden::clicked); + connect(btnPurge, + &QPushButton::clicked, + m_pTrackTableView, + &WTrackTableView::slotPurge); + connect(btnPurge, + &QPushButton::clicked, + this, + &DlgHidden::clicked); + connect(btnSelect, + &QPushButton::clicked, + this, + &DlgHidden::selectAll); connect(m_pTrackTableView->selectionModel(), - SIGNAL(selectionChanged(const QItemSelection&, const QItemSelection&)), + &QItemSelectionModel::selectionChanged, + this, + &DlgHidden::selectionChanged); + connect(m_pTrackTableView, + &WTrackTableView::trackSelected, this, - SLOT(selectionChanged(const QItemSelection&, const QItemSelection&))); - connect(m_pTrackTableView, SIGNAL(trackSelected(TrackPointer)), - this, SIGNAL(trackSelected(TrackPointer))); + &DlgHidden::trackSelected); - 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(pLibrary, + &Library::setTrackTableFont, + m_pTrackTableView, + &WTrackTableView::setTrackTableFont); + connect(pLibrary, + &Library::setTrackTableRowHeight, + m_pTrackTableView, + &WTrackTableView::setTrackTableRowHeight); + connect(pLibrary, + &Library::setSelectedClick, + m_pTrackTableView, + &WTrackTableView::setSelectedClick); } DlgHidden::~DlgHidden() { diff --git a/src/library/dlgmissing.cpp b/src/library/dlgmissing.cpp index efa4b49f5507..71627c4d5b9e 100644 --- a/src/library/dlgmissing.cpp +++ b/src/library/dlgmissing.cpp @@ -26,25 +26,18 @@ DlgMissing::DlgMissing(QWidget* parent, UserSettingsPointer pConfig, m_pMissingTableModel = new MissingTableModel(this, pLibrary); m_pTrackTableView->loadTrackModel(m_pMissingTableModel); - connect(btnPurge, SIGNAL(clicked()), - m_pTrackTableView, SLOT(slotPurge())); - connect(btnPurge, SIGNAL(clicked()), - this, SLOT(clicked())); - connect(btnSelect, SIGNAL(clicked()), - this, SLOT(selectAll())); + connect(btnPurge, &QPushButton::clicked, m_pTrackTableView, &WTrackTableView::slotPurge); + connect(btnPurge, &QPushButton::clicked, this, &DlgMissing::clicked); + connect(btnSelect, &QPushButton::clicked, this, &DlgMissing::selectAll); connect(m_pTrackTableView->selectionModel(), - SIGNAL(selectionChanged(const QItemSelection&, const QItemSelection&)), + &QItemSelectionModel::selectionChanged, this, - SLOT(selectionChanged(const QItemSelection&, const QItemSelection&))); - connect(m_pTrackTableView, SIGNAL(trackSelected(TrackPointer)), - this, SIGNAL(trackSelected(TrackPointer))); + &DlgMissing::selectionChanged); + connect(m_pTrackTableView, &WTrackTableView::trackSelected, this, &DlgMissing::trackSelected); - 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(pLibrary, &Library::setTrackTableFont, m_pTrackTableView, &WTrackTableView::setTrackTableFont); + connect(pLibrary, &Library::setTrackTableRowHeight, m_pTrackTableView, &WTrackTableView::setTrackTableRowHeight); + connect(pLibrary, &Library::setSelectedClick, m_pTrackTableView, &WTrackTableView::setSelectedClick); } DlgMissing::~DlgMissing() { diff --git a/src/library/dlgtrackinfo.cpp b/src/library/dlgtrackinfo.cpp index c8b9de3f603d..3a090dcce942 100644 --- a/src/library/dlgtrackinfo.cpp +++ b/src/library/dlgtrackinfo.cpp @@ -3,17 +3,18 @@ #include #include -#include "util/desktophelper.h" -#include "library/dlgtrackinfo.h" -#include "sources/soundsourceproxy.h" #include "library/coverartcache.h" #include "library/coverartutils.h" +#include "library/dlgtrackinfo.h" +#include "sources/soundsourceproxy.h" #include "track/beatfactory.h" #include "track/cue.h" #include "track/keyfactory.h" #include "track/keyutils.h" -#include "util/duration.h" #include "util/color/color.h" +#include "util/compatibility.h" +#include "util/desktophelper.h" +#include "util/duration.h" const int kFilterLength = 80; const int kMinBpm = 30; @@ -39,66 +40,101 @@ void DlgTrackInfo::init() { cueTable->hideColumn(0); coverBox->insertWidget(1, m_pWCoverArtLabel); - connect(btnNext, SIGNAL(clicked()), - this, SLOT(slotNext())); - connect(btnPrev, SIGNAL(clicked()), - this, SLOT(slotPrev())); - connect(btnApply, SIGNAL(clicked()), - this, SLOT(apply())); - connect(btnOK, SIGNAL(clicked()), - this, SLOT(OK())); - connect(btnCancel, SIGNAL(clicked()), - this, SLOT(cancel())); - - connect(bpmDouble, SIGNAL(clicked()), - this, SLOT(slotBpmDouble())); - connect(bpmHalve, SIGNAL(clicked()), - this, SLOT(slotBpmHalve())); - connect(bpmTwoThirds, SIGNAL(clicked()), - this, SLOT(slotBpmTwoThirds())); - connect(bpmThreeFourth, SIGNAL(clicked()), - this, SLOT(slotBpmThreeFourth())); - connect(bpmFourThirds, SIGNAL(clicked()), - this, SLOT(slotBpmFourThirds())); - connect(bpmThreeHalves, SIGNAL(clicked()), - this, SLOT(slotBpmThreeHalves())); - connect(bpmClear, SIGNAL(clicked()), - this, SLOT(slotBpmClear())); - - connect(bpmConst, SIGNAL(stateChanged(int)), - this, SLOT(slotBpmConstChanged(int))); - - connect(spinBpm, SIGNAL(valueChanged(double)), - this, SLOT(slotSpinBpmValueChanged(double))); - - connect(txtKey, SIGNAL(editingFinished()), - this, SLOT(slotKeyTextChanged())); - - connect(btnCueActivate, SIGNAL(clicked()), - this, SLOT(cueActivate())); - connect(btnCueDelete, SIGNAL(clicked()), - this, SLOT(cueDelete())); - connect(bpmTap, SIGNAL(pressed()), - m_pTapFilter.data(), SLOT(tap())); - connect(m_pTapFilter.data(), SIGNAL(tapped(double, int)), - this, SLOT(slotBpmTap(double, int))); - - connect(btnImportMetadataFromFile, SIGNAL(clicked()), - this, SLOT(slotImportMetadataFromFile())); - connect(btnImportMetadataFromMusicBrainz, SIGNAL(clicked()), - this, SLOT(slotImportMetadataFromMusicBrainz())); - connect(btnOpenFileBrowser, SIGNAL(clicked()), - this, SLOT(slotOpenInFileBrowser())); + connect(btnNext, &QPushButton::clicked, this, &DlgTrackInfo::slotNext); + connect(btnPrev, &QPushButton::clicked, this, &DlgTrackInfo::slotPrev); + connect(btnApply, &QPushButton::clicked, this, &DlgTrackInfo::apply); + connect(btnOK, &QPushButton::clicked, this, &DlgTrackInfo::OK); + connect(btnCancel, &QPushButton::clicked, this, &DlgTrackInfo::cancel); + + connect(bpmDouble, + &QPushButton::clicked, + this, + &DlgTrackInfo::slotBpmDouble); + connect(bpmHalve, + &QPushButton::clicked, + this, + &DlgTrackInfo::slotBpmHalve); + connect(bpmTwoThirds, + &QPushButton::clicked, + this, + &DlgTrackInfo::slotBpmTwoThirds); + connect(bpmThreeFourth, + &QPushButton::clicked, + this, + &DlgTrackInfo::slotBpmThreeFourth); + connect(bpmFourThirds, + &QPushButton::clicked, + this, + &DlgTrackInfo::slotBpmFourThirds); + connect(bpmThreeHalves, + &QPushButton::clicked, + this, + &DlgTrackInfo::slotBpmThreeHalves); + connect(bpmClear, + &QPushButton::clicked, + this, + &DlgTrackInfo::slotBpmClear); + + connect(bpmConst, + &QCheckBox::stateChanged, + this, + &DlgTrackInfo::slotBpmConstChanged); + + connect(spinBpm, + QOverload::of(&QDoubleSpinBox::valueChanged), + this, + &DlgTrackInfo::slotSpinBpmValueChanged); + + connect(txtKey, + &QLineEdit::editingFinished, + this, + &DlgTrackInfo::slotKeyTextChanged); + + connect(btnCueActivate, + &QPushButton::clicked, + this, + &DlgTrackInfo::cueActivate); + connect(btnCueDelete, + &QPushButton::clicked, + this, + &DlgTrackInfo::cueDelete); + connect(bpmTap, + &QPushButton::pressed, + m_pTapFilter.data(), + &TapFilter::tap); + connect(m_pTapFilter.data(), + &TapFilter::tapped, + this, + &DlgTrackInfo::slotBpmTap); + + connect(btnImportMetadataFromFile, + &QPushButton::clicked, + this, + &DlgTrackInfo::slotImportMetadataFromFile); + connect(btnImportMetadataFromMusicBrainz, + &QPushButton::clicked, + this, + &DlgTrackInfo::slotImportMetadataFromMusicBrainz); + connect(btnOpenFileBrowser, + &QPushButton::clicked, + this, + &DlgTrackInfo::slotOpenInFileBrowser); CoverArtCache* pCache = CoverArtCache::instance(); - if (pCache != NULL) { - connect(pCache, SIGNAL(coverFound(const QObject*, const CoverInfoRelative&, QPixmap, bool)), - this, SLOT(slotCoverFound(const QObject*, const CoverInfoRelative&, QPixmap, bool))); + if (pCache != nullptr) { + connect(pCache, + &CoverArtCache::coverFound, + this, + &DlgTrackInfo::slotCoverFound); } - connect(m_pWCoverArtLabel, SIGNAL(coverInfoSelected(const CoverInfoRelative&)), - this, SLOT(slotCoverInfoSelected(const CoverInfoRelative&))); - connect(m_pWCoverArtLabel, SIGNAL(reloadCoverArt()), - this, SLOT(slotReloadCoverArt())); + connect(m_pWCoverArtLabel, + &WCoverArtLabel::coverInfoSelected, + this, + &DlgTrackInfo::slotCoverInfoSelected); + connect(m_pWCoverArtLabel, + &WCoverArtLabel::reloadCoverArt, + this, + &DlgTrackInfo::slotReloadCoverArt); } void DlgTrackInfo::OK() { @@ -224,8 +260,10 @@ void DlgTrackInfo::loadTrack(TrackPointer pTrack) { // We already listen to changed() so we don't need to listen to individual // signals such as cuesUpdates, coverArtUpdated(), etc. - connect(pTrack.get(), SIGNAL(changed(Track*)), - this, SLOT(updateTrackMetadata())); + connect(pTrack.get(), + &Track::changed, + this, + &DlgTrackInfo::updateTrackMetadata); } void DlgTrackInfo::slotCoverFound(const QObject* pRequestor, @@ -379,8 +417,10 @@ void DlgTrackInfo::saveTrack() { // First, disconnect the track changed signal. Otherwise we signal ourselves // and repopulate all these fields. - disconnect(m_pLoadedTrack.get(), SIGNAL(changed(Track*)), - this, SLOT(updateTrackMetadata())); + disconnect(m_pLoadedTrack.get(), + &Track::changed, + this, + &DlgTrackInfo::updateTrackMetadata); m_pLoadedTrack->setTitle(txtTrackName->text()); m_pLoadedTrack->setArtist(txtArtist->text()); @@ -467,8 +507,10 @@ void DlgTrackInfo::saveTrack() { m_pLoadedTrack->setCoverInfo(m_loadedCoverInfo); // Reconnect changed signals now. - connect(m_pLoadedTrack.get(), SIGNAL(changed(Track*)), - this, SLOT(updateTrackMetadata())); + connect(m_pLoadedTrack.get(), + &Track::changed, + this, + &DlgTrackInfo::updateTrackMetadata); } void DlgTrackInfo::unloadTrack(bool save) { @@ -483,7 +525,10 @@ void DlgTrackInfo::unloadTrack(bool save) { } void DlgTrackInfo::clear() { - disconnect(this, SLOT(updateTrackMetadata())); + disconnect(m_pLoadedTrack.get(), + &Track::changed, + this, + &DlgTrackInfo::updateTrackMetadata); m_pLoadedTrack.reset(); txtTrackName->setText(""); diff --git a/src/library/export/trackexportdlg.cpp b/src/library/export/trackexportdlg.cpp index f17e509203b1..14f5dbb4036f 100644 --- a/src/library/export/trackexportdlg.cpp +++ b/src/library/export/trackexportdlg.cpp @@ -14,20 +14,28 @@ TrackExportDlg::TrackExportDlg(QWidget *parent, m_pConfig(pConfig), m_worker(worker) { setupUi(this); - connect(cancelButton, SIGNAL(clicked()), this, SLOT(cancelButtonClicked())); + connect(cancelButton, + &QPushButton::clicked, + this, + &TrackExportDlg::cancelButtonClicked); exportProgress->setMinimum(0); exportProgress->setMaximum(1); exportProgress->setValue(0); statusLabel->setText(""); setModal(true); - connect(m_worker, SIGNAL(progress(QString, int, int)), this, - SLOT(slotProgress(QString, int, int))); connect(m_worker, - SIGNAL(askOverwriteMode(QString, std::promise*)), + &TrackExportWorker::progress, + this, + &TrackExportDlg::slotProgress); + connect(m_worker, + &TrackExportWorker::askOverwriteMode, + this, + &TrackExportDlg::slotAskOverwriteMode); + connect(m_worker, + &TrackExportWorker::canceled, this, - SLOT(slotAskOverwriteMode(QString, std::promise*))); - connect(m_worker, SIGNAL(canceled()), this, SLOT(cancelButtonClicked())); + &TrackExportDlg::cancelButtonClicked); } void TrackExportDlg::showEvent(QShowEvent* event) { diff --git a/src/library/itunes/itunesfeature.cpp b/src/library/itunes/itunesfeature.cpp index 372a9ee5ad86..112170b3cac3 100644 --- a/src/library/itunes/itunesfeature.cpp +++ b/src/library/itunes/itunesfeature.cpp @@ -105,7 +105,10 @@ ITunesFeature::ITunesFeature(QObject* parent, TrackCollection* pTrackCollection) if (!m_database.open()) { qDebug() << "Failed to open database for iTunes scanner." << m_database.lastError(); } - connect(&m_future_watcher, SIGNAL(finished()), this, SLOT(onTrackCollectionLoaded())); + connect(&m_future_watcher, + &QFutureWatcher::finished, + this, + &ITunesFeature::onTrackCollectionLoaded); } ITunesFeature::~ITunesFeature() { diff --git a/src/library/library.cpp b/src/library/library.cpp index 2c04fc0fb956..e8225b4d43bd 100644 --- a/src/library/library.cpp +++ b/src/library/library.cpp @@ -100,12 +100,30 @@ Library::Library( m_pKeyNotation.reset(new ControlObject(ConfigKey(kConfigGroup, "key_notation"))); - connect(&m_scanner, &LibraryScanner::scanStarted, this, &Library::scanStarted); - connect(&m_scanner, &LibraryScanner::scanFinished, this, &Library::scanFinished); - connect(&m_scanner, &LibraryScanner::scanFinished, this, &Library::slotRefreshLibraryModels); - connect(&m_scanner, &LibraryScanner::trackAdded, this, &Library::slotScanTrackAdded); - connect(&m_scanner, &LibraryScanner::tracksChanged, this, &Library::slotScanTracksUpdated); - connect(&m_scanner, &LibraryScanner::tracksReplaced, this, &Library::slotScanTracksReplaced); + connect(&m_scanner, + &LibraryScanner::scanStarted, + this, + &Library::scanStarted); + connect(&m_scanner, + &LibraryScanner::scanFinished, + this, + &Library::scanFinished); + connect(&m_scanner, + &LibraryScanner::scanFinished, + this, + &Library::slotRefreshLibraryModels); + connect(&m_scanner, + &LibraryScanner::trackAdded, + this, + &Library::slotScanTrackAdded); + connect(&m_scanner, + &LibraryScanner::tracksChanged, + this, + &Library::slotScanTracksUpdated); + connect(&m_scanner, + &LibraryScanner::tracksReplaced, + this, + &Library::slotScanTracksReplaced); // TODO(rryan) -- turn this construction / adding of features into a static // method or something -- CreateDefaultLibrary @@ -119,12 +137,18 @@ Library::Library( addFeature(m_pCrateFeature); BrowseFeature* browseFeature = new BrowseFeature( this, pConfig, m_pTrackCollection, pRecordingManager); - connect(browseFeature, SIGNAL(scanLibrary()), - &m_scanner, SLOT(scan())); - connect(&m_scanner, SIGNAL(scanStarted()), - browseFeature, SLOT(slotLibraryScanStarted())); - connect(&m_scanner, SIGNAL(scanFinished()), - browseFeature, SLOT(slotLibraryScanFinished())); + connect(browseFeature, + &BrowseFeature::scanLibrary, + &m_scanner, + &LibraryScanner::scan); + connect(&m_scanner, + &LibraryScanner::scanStarted, + browseFeature, + &BrowseFeature::slotLibraryScanStarted); + connect(&m_scanner, + &LibraryScanner::scanFinished, + browseFeature, + &BrowseFeature::slotLibraryScanFinished); addFeature(browseFeature); addFeature(new RecordingFeature(this, pConfig, m_pTrackCollection, pRecordingManager)); @@ -247,22 +271,34 @@ void Library::bindSidebarWidget(WLibrarySidebar* pSidebarWidget) { // Setup the sources view pSidebarWidget->setModel(m_pSidebarModel); - connect(m_pSidebarModel, SIGNAL(selectIndex(const QModelIndex&)), - pSidebarWidget, SLOT(selectIndex(const QModelIndex&))); - connect(pSidebarWidget, SIGNAL(pressed(const QModelIndex&)), - m_pSidebarModel, SLOT(pressed(const QModelIndex&))); - connect(pSidebarWidget, SIGNAL(clicked(const QModelIndex&)), - m_pSidebarModel, SLOT(clicked(const QModelIndex&))); + connect(m_pSidebarModel, + &SidebarModel::selectIndex, + pSidebarWidget, + &WLibrarySidebar::selectIndex); + connect(pSidebarWidget, + &WLibrarySidebar::pressed, + m_pSidebarModel, + &SidebarModel::pressed); + connect(pSidebarWidget, + &WLibrarySidebar::clicked, + m_pSidebarModel, + &SidebarModel::clicked); // Lazy model: Let triangle symbol increment the model - connect(pSidebarWidget, SIGNAL(expanded(const QModelIndex&)), - m_pSidebarModel, SLOT(doubleClicked(const QModelIndex&))); + connect(pSidebarWidget, + &WLibrarySidebar::expanded, + m_pSidebarModel, + &SidebarModel::doubleClicked); - connect(pSidebarWidget, SIGNAL(rightClicked(const QPoint&, const QModelIndex&)), - m_pSidebarModel, SLOT(rightClicked(const QPoint&, const QModelIndex&))); + connect(pSidebarWidget, + &WLibrarySidebar::rightClicked, + m_pSidebarModel, + &SidebarModel::rightClicked); pSidebarWidget->slotSetFont(m_trackTableFont); - connect(this, SIGNAL(setTrackTableFont(QFont)), - pSidebarWidget, SLOT(slotSetFont(QFont))); + connect(this, + &Library::setTrackTableFont, + pSidebarWidget, + &WLibrarySidebar::slotSetFont); } void Library::bindWidget(WLibrary* pLibraryWidget, @@ -275,26 +311,42 @@ void Library::bindWidget(WLibrary* pLibraryWidget, true, m_externalTrackCollections); pTrackTableView->installEventFilter(pKeyboard); - connect(this, SIGNAL(showTrackModel(QAbstractItemModel*)), - pTrackTableView, SLOT(loadTrackModel(QAbstractItemModel*))); - connect(pTrackTableView, SIGNAL(loadTrack(TrackPointer)), - this, SLOT(slotLoadTrack(TrackPointer))); - connect(pTrackTableView, SIGNAL(loadTrackToPlayer(TrackPointer, QString, bool)), - this, SLOT(slotLoadTrackToPlayer(TrackPointer, QString, bool))); + connect(this, + &Library::showTrackModel, + pTrackTableView, + &WTrackTableView::loadTrackModel); + connect(pTrackTableView, + &WTrackTableView::loadTrack, + this, + &Library::slotLoadTrack); + connect(pTrackTableView, + &WTrackTableView::loadTrackToPlayer, + this, + &Library::slotLoadTrackToPlayer); pLibraryWidget->registerView(m_sTrackViewName, pTrackTableView); - connect(this, SIGNAL(switchToView(const QString&)), - pLibraryWidget, SLOT(switchToView(const QString&))); - - connect(pTrackTableView, SIGNAL(trackSelected(TrackPointer)), - this, SIGNAL(trackSelected(TrackPointer))); - - connect(this, SIGNAL(setTrackTableFont(QFont)), - pTrackTableView, SLOT(setTrackTableFont(QFont))); - connect(this, SIGNAL(setTrackTableRowHeight(int)), - pTrackTableView, SLOT(setTrackTableRowHeight(int))); - connect(this, SIGNAL(setSelectedClick(bool)), - pTrackTableView, SLOT(setSelectedClick(bool))); + connect(this, + &Library::switchToView, + pLibraryWidget, + &WLibrary::switchToView); + + connect(pTrackTableView, + &WTrackTableView::trackSelected, + this, + &Library::trackSelected); + + connect(this, + &Library::setTrackTableFont, + pTrackTableView, + &WTrackTableView::setTrackTableFont); + connect(this, + &Library::setTrackTableRowHeight, + pTrackTableView, + &WTrackTableView::setTrackTableRowHeight); + connect(this, + &Library::setSelectedClick, + pTrackTableView, + &WTrackTableView::setSelectedClick); m_pLibraryControl->bindWidget(pLibraryWidget, pKeyboard); @@ -317,22 +369,38 @@ void Library::addFeature(LibraryFeature* feature) { } m_features.push_back(feature); m_pSidebarModel->addLibraryFeature(feature); - connect(feature, SIGNAL(showTrackModel(QAbstractItemModel*)), - this, SLOT(slotShowTrackModel(QAbstractItemModel*))); - connect(feature, SIGNAL(switchToView(const QString&)), - this, SLOT(slotSwitchToView(const QString&))); - connect(feature, SIGNAL(loadTrack(TrackPointer)), - this, SLOT(slotLoadTrack(TrackPointer))); - connect(feature, SIGNAL(loadTrackToPlayer(TrackPointer, QString, bool)), - this, SLOT(slotLoadTrackToPlayer(TrackPointer, QString, bool))); - connect(feature, SIGNAL(restoreSearch(const QString&)), - this, SLOT(slotRestoreSearch(const QString&))); - connect(feature, SIGNAL(disableSearch()), - this, SLOT(slotDisableSearch())); - connect(feature, SIGNAL(enableCoverArtDisplay(bool)), - this, SIGNAL(enableCoverArtDisplay(bool))); - connect(feature, SIGNAL(trackSelected(TrackPointer)), - this, SIGNAL(trackSelected(TrackPointer))); + connect(feature, + &LibraryFeature::showTrackModel, + this, + &Library::slotShowTrackModel); + connect(feature, + &LibraryFeature::switchToView, + this, + &Library::slotSwitchToView); + connect(feature, + &LibraryFeature::loadTrack, + this, + &Library::slotLoadTrack); + connect(feature, + &LibraryFeature::loadTrackToPlayer, + this, + &Library::slotLoadTrackToPlayer); + connect(feature, + &LibraryFeature::restoreSearch, + this, + &Library::slotRestoreSearch); + connect(feature, + &LibraryFeature::disableSearch, + this, + &Library::slotDisableSearch); + connect(feature, + &LibraryFeature::enableCoverArtDisplay, + this, + &Library::enableCoverArtDisplay); + connect(feature, + &LibraryFeature::trackSelected, + this, + &Library::trackSelected); } void Library::onPlayerManagerTrackAnalyzerProgress( diff --git a/src/library/librarycontrol.cpp b/src/library/librarycontrol.cpp index 128350ee9a97..64b15cf04b27 100644 --- a/src/library/librarycontrol.cpp +++ b/src/library/librarycontrol.cpp @@ -15,20 +15,25 @@ #include "library/library.h" #include "library/libraryview.h" - -LoadToGroupController::LoadToGroupController(QObject* pParent, const QString& group) +LoadToGroupController::LoadToGroupController(LibraryControl* pParent, const QString& group) : QObject(pParent), m_group(group) { m_pLoadControl = std::make_unique(ConfigKey(group, "LoadSelectedTrack")); - connect(m_pLoadControl.get(), SIGNAL(valueChanged(double)), - this, SLOT(slotLoadToGroup(double))); + connect(m_pLoadControl.get(), + &ControlObject::valueChanged, + this, + &LoadToGroupController::slotLoadToGroup); m_pLoadAndPlayControl = std::make_unique(ConfigKey(group, "LoadSelectedTrackAndPlay")); - connect(m_pLoadAndPlayControl.get(), SIGNAL(valueChanged(double)), - this, SLOT(slotLoadToGroupAndPlay(double))); + connect(m_pLoadAndPlayControl.get(), + &ControlObject::valueChanged, + this, + &LoadToGroupController::slotLoadToGroupAndPlay); - connect(this, SIGNAL(loadToGroup(QString, bool)), - pParent, SLOT(slotLoadSelectedTrackToGroup(QString, bool))); + connect(this, + &LoadToGroupController::loadToGroup, + pParent, + &LibraryControl::slotLoadSelectedTrackToGroup); } LoadToGroupController::~LoadToGroupController() = default; @@ -65,110 +70,176 @@ LibraryControl::LibraryControl(Library* pLibrary) m_pMoveUp = std::make_unique(ConfigKey("[Library]", "MoveUp")); m_pMoveDown = std::make_unique(ConfigKey("[Library]", "MoveDown")); m_pMoveVertical = std::make_unique(ConfigKey("[Library]", "MoveVertical"), false); - connect(m_pMoveUp.get(), SIGNAL(valueChanged(double)),this, SLOT(slotMoveUp(double))); - connect(m_pMoveDown.get(), SIGNAL(valueChanged(double)),this, SLOT(slotMoveDown(double))); - connect(m_pMoveVertical.get(), SIGNAL(valueChanged(double)),this, SLOT(slotMoveVertical(double))); + connect(m_pMoveUp.get(), + &ControlPushButton::valueChanged, + this, + &LibraryControl::slotMoveUp); + connect(m_pMoveDown.get(), + &ControlPushButton::valueChanged, + this, + &LibraryControl::slotMoveDown); + connect(m_pMoveVertical.get(), + &ControlEncoder::valueChanged, + this, + &LibraryControl::slotMoveVertical); // Controls to navigate vertically within currently focused widget (up/down buttons) m_pScrollUp = std::make_unique(ConfigKey("[Library]", "ScrollUp")); m_pScrollDown = std::make_unique(ConfigKey("[Library]", "ScrollDown")); m_pScrollVertical = std::make_unique(ConfigKey("[Library]", "ScrollVertical"), false); - connect(m_pScrollUp.get(), SIGNAL(valueChanged(double)),this, SLOT(slotScrollUp(double))); - connect(m_pScrollDown.get(), SIGNAL(valueChanged(double)),this, SLOT(slotScrollDown(double))); - connect(m_pScrollVertical.get(), SIGNAL(valueChanged(double)),this, SLOT(slotScrollVertical(double))); + connect(m_pScrollUp.get(), + &ControlPushButton::valueChanged, + this, + &LibraryControl::slotScrollUp); + connect(m_pScrollDown.get(), + &ControlPushButton::valueChanged, + this, + &LibraryControl::slotScrollDown); + connect(m_pScrollVertical.get(), + &ControlEncoder::valueChanged, + this, + &LibraryControl::slotScrollVertical); // Controls to navigate horizontally within currently selected item (left/right buttons) m_pMoveLeft = std::make_unique(ConfigKey("[Library]", "MoveLeft")); m_pMoveRight = std::make_unique(ConfigKey("[Library]", "MoveRight")); m_pMoveHorizontal = std::make_unique(ConfigKey("[Library]", "MoveHorizontal"), false); - connect(m_pMoveLeft.get(), SIGNAL(valueChanged(double)),this, SLOT(slotMoveLeft(double))); - connect(m_pMoveRight.get(), SIGNAL(valueChanged(double)),this, SLOT(slotMoveRight(double))); - connect(m_pMoveHorizontal.get(), SIGNAL(valueChanged(double)),this, SLOT(slotMoveHorizontal(double))); + connect(m_pMoveLeft.get(), + &ControlPushButton::valueChanged, + this, + &LibraryControl::slotMoveLeft); + connect(m_pMoveRight.get(), + &ControlPushButton::valueChanged, + this, + &LibraryControl::slotMoveRight); + connect(m_pMoveHorizontal.get(), + &ControlEncoder::valueChanged, + this, + &LibraryControl::slotMoveHorizontal); // Control to navigate between widgets (tab/shit+tab button) m_pMoveFocusForward = std::make_unique(ConfigKey("[Library]", "MoveFocusForward")); m_pMoveFocusBackward = std::make_unique(ConfigKey("[Library]", "MoveFocusBackward")); m_pMoveFocus = std::make_unique(ConfigKey("[Library]", "MoveFocus"), false); - connect(m_pMoveFocusForward.get(), SIGNAL(valueChanged(double)),this, SLOT(slotMoveFocusForward(double))); - connect(m_pMoveFocusBackward.get(), SIGNAL(valueChanged(double)),this, SLOT(slotMoveFocusBackward(double))); - connect(m_pMoveFocus.get(), SIGNAL(valueChanged(double)),this, SLOT(slotMoveFocus(double))); + connect(m_pMoveFocusForward.get(), + &ControlPushButton::valueChanged, + this, + &LibraryControl::slotMoveFocusForward); + connect(m_pMoveFocusBackward.get(), + &ControlPushButton::valueChanged, + this, + &LibraryControl::slotMoveFocusBackward); + connect(m_pMoveFocus.get(), + &ControlEncoder::valueChanged, + this, + &LibraryControl::slotMoveFocus); // Control to "goto" the currently selected item in focused widget (context dependent) m_pGoToItem = std::make_unique(ConfigKey("[Library]", "GoToItem")); - connect(m_pGoToItem.get(), SIGNAL(valueChanged(double)), this, SLOT(slotGoToItem(double))); + connect(m_pGoToItem.get(), + &ControlPushButton::valueChanged, + this, + &LibraryControl::slotGoToItem); // Auto DJ controls m_pAutoDjAddTop = std::make_unique(ConfigKey("[Library]","AutoDjAddTop")); - connect(m_pAutoDjAddTop.get(), SIGNAL(valueChanged(double)), - this, SLOT(slotAutoDjAddTop(double))); + connect(m_pAutoDjAddTop.get(), + &ControlPushButton::valueChanged, + this, + &LibraryControl::slotAutoDjAddTop); m_pAutoDjAddBottom = std::make_unique(ConfigKey("[Library]","AutoDjAddBottom")); - connect(m_pAutoDjAddBottom.get(), SIGNAL(valueChanged(double)), - this, SLOT(slotAutoDjAddBottom(double))); + connect(m_pAutoDjAddBottom.get(), + &ControlPushButton::valueChanged, + this, + &LibraryControl::slotAutoDjAddBottom); // Sort controls m_pSortColumn = std::make_unique(ConfigKey("[Library]", "sort_column")); m_pSortOrder = std::make_unique(ConfigKey("[Library]", "sort_order")); m_pSortOrder->setButtonMode(ControlPushButton::TOGGLE); m_pSortColumnToggle = std::make_unique(ConfigKey("[Library]", "sort_column_toggle"), false); - connect(m_pSortColumn.get(), SIGNAL(valueChanged(double)), - this, SLOT(slotSortColumn(double))); - connect(m_pSortColumnToggle.get(), SIGNAL(valueChanged(double)), - this, SLOT(slotSortColumnToggle(double))); + connect(m_pSortColumn.get(), + &ControlEncoder::valueChanged, + this, + &LibraryControl::slotSortColumn); + connect(m_pSortColumnToggle.get(), + &ControlEncoder::valueChanged, + this, + &LibraryControl::slotSortColumnToggle); // Font sizes m_pFontSizeKnob = std::make_unique( ConfigKey("[Library]", "font_size_knob"), false); - connect(m_pFontSizeKnob.get(), SIGNAL(valueChanged(double)), - this, SLOT(slotFontSize(double))); + connect(m_pFontSizeKnob.get(), + &ControlObject::valueChanged, + this, + &LibraryControl::slotFontSize); m_pFontSizeDecrement = std::make_unique( ConfigKey("[Library]", "font_size_decrement")); - connect(m_pFontSizeDecrement.get(), SIGNAL(valueChanged(double)), - this, SLOT(slotDecrementFontSize(double))); + connect(m_pFontSizeDecrement.get(), + &ControlPushButton::valueChanged, + this, + &LibraryControl::slotDecrementFontSize); m_pFontSizeIncrement = std::make_unique( ConfigKey("[Library]", "font_size_increment")); - connect(m_pFontSizeIncrement.get(), SIGNAL(valueChanged(double)), - this, SLOT(slotIncrementFontSize(double))); - + connect(m_pFontSizeIncrement.get(), + &ControlPushButton::valueChanged, + this, + &LibraryControl::slotIncrementFontSize); /// Deprecated controls m_pSelectNextTrack = std::make_unique(ConfigKey("[Playlist]", "SelectNextTrack")); - connect(m_pSelectNextTrack.get(), SIGNAL(valueChanged(double)), - this, SLOT(slotSelectNextTrack(double))); - + connect(m_pSelectNextTrack.get(), + &ControlPushButton::valueChanged, + this, + &LibraryControl::slotSelectNextTrack); m_pSelectPrevTrack = std::make_unique(ConfigKey("[Playlist]", "SelectPrevTrack")); - connect(m_pSelectPrevTrack.get(), SIGNAL(valueChanged(double)), - this, SLOT(slotSelectPrevTrack(double))); + connect(m_pSelectPrevTrack.get(), + &ControlPushButton::valueChanged, + this, + &LibraryControl::slotSelectPrevTrack); // Ignoring no-ops is important since this is for +/- tickers. m_pSelectTrack = std::make_unique(ConfigKey("[Playlist]","SelectTrackKnob"), false); - connect(m_pSelectTrack.get(), SIGNAL(valueChanged(double)), - this, SLOT(slotSelectTrack(double))); - + connect(m_pSelectTrack.get(), + &ControlObject::valueChanged, + this, + &LibraryControl::slotSelectTrack); m_pSelectNextSidebarItem = std::make_unique(ConfigKey("[Playlist]", "SelectNextPlaylist")); - connect(m_pSelectNextSidebarItem.get(), SIGNAL(valueChanged(double)), - this, SLOT(slotSelectNextSidebarItem(double))); + connect(m_pSelectNextSidebarItem.get(), + &ControlPushButton::valueChanged, + this, + &LibraryControl::slotSelectNextSidebarItem); m_pSelectPrevSidebarItem = std::make_unique(ConfigKey("[Playlist]", "SelectPrevPlaylist")); - connect(m_pSelectPrevSidebarItem.get(), SIGNAL(valueChanged(double)), - this, SLOT(slotSelectPrevSidebarItem(double))); + connect(m_pSelectPrevSidebarItem.get(), + &ControlPushButton::valueChanged, + this, + &LibraryControl::slotSelectPrevSidebarItem); // Ignoring no-ops is important since this is for +/- tickers. m_pSelectSidebarItem = std::make_unique(ConfigKey("[Playlist]", "SelectPlaylist"), false); - connect(m_pSelectSidebarItem.get(), SIGNAL(valueChanged(double)), - this, SLOT(slotSelectSidebarItem(double))); + connect(m_pSelectSidebarItem.get(), + &ControlObject::valueChanged, + this, + &LibraryControl::slotSelectSidebarItem); m_pToggleSidebarItem = std::make_unique(ConfigKey("[Playlist]", "ToggleSelectedSidebarItem")); - connect(m_pToggleSidebarItem.get(), SIGNAL(valueChanged(double)), - this, SLOT(slotToggleSelectedSidebarItem(double))); + connect(m_pToggleSidebarItem.get(), + &ControlPushButton::valueChanged, + this, + &LibraryControl::slotToggleSelectedSidebarItem); m_pLoadSelectedIntoFirstStopped = std::make_unique(ConfigKey("[Playlist]","LoadSelectedIntoFirstStopped")); - connect(m_pLoadSelectedIntoFirstStopped.get(), SIGNAL(valueChanged(double)), - this, SLOT(slotLoadSelectedIntoFirstStopped(double))); + connect(m_pLoadSelectedIntoFirstStopped.get(), + &ControlPushButton::valueChanged, + this, + &LibraryControl::slotLoadSelectedIntoFirstStopped); ControlDoublePrivate::insertAlias(ConfigKey("[Playlist]", "AutoDjAddTop"), ConfigKey("[Library]", "AutoDjAddTop")); ControlDoublePrivate::insertAlias(ConfigKey("[Playlist]", "AutoDjAddBottom"), ConfigKey("[Library]", "AutoDjAddBottom")); @@ -224,8 +295,10 @@ void LibraryControl::bindSidebarWidget(WLibrarySidebar* pSidebarWidget) { disconnect(m_pSidebarWidget, 0, this, 0); } m_pSidebarWidget = pSidebarWidget; - connect(m_pSidebarWidget, SIGNAL(destroyed()), - this, SLOT(sidebarWidgetDeleted())); + connect(m_pSidebarWidget, + &WLibrarySidebar::destroyed, + this, + &LibraryControl::sidebarWidgetDeleted); } void LibraryControl::bindWidget(WLibrary* pLibraryWidget, KeyboardEventFilter* pKeyboard) { @@ -234,8 +307,10 @@ void LibraryControl::bindWidget(WLibrary* pLibraryWidget, KeyboardEventFilter* p disconnect(m_pLibraryWidget, 0, this, 0); } m_pLibraryWidget = pLibraryWidget; - connect(m_pLibraryWidget, SIGNAL(destroyed()), - this, SLOT(libraryWidgetDeleted())); + connect(m_pLibraryWidget, + &WLibrary::destroyed, + this, + &LibraryControl::libraryWidgetDeleted); } void LibraryControl::libraryWidgetDeleted() { diff --git a/src/library/librarycontrol.h b/src/library/librarycontrol.h index e2efd831aaa9..f9ce762ae713 100644 --- a/src/library/librarycontrol.h +++ b/src/library/librarycontrol.h @@ -10,6 +10,7 @@ class ControlObject; class ControlPushButton; class Library; +class LibraryControl; class WLibrary; class WLibrarySidebar; class KeyboardEventFilter; @@ -17,7 +18,7 @@ class KeyboardEventFilter; class LoadToGroupController : public QObject { Q_OBJECT public: - LoadToGroupController(QObject* pParent, const QString& group); + LoadToGroupController(LibraryControl* pParent, const QString& group); virtual ~LoadToGroupController(); signals: @@ -42,6 +43,10 @@ class LibraryControl : public QObject { void bindWidget(WLibrary* pLibrary, KeyboardEventFilter* pKeyboard); void bindSidebarWidget(WLibrarySidebar* pLibrarySidebar); + public slots: + // Deprecated navigation slots + void slotLoadSelectedTrackToGroup(QString group, bool play); + private slots: void libraryWidgetDeleted(); void sidebarWidgetDeleted(); @@ -61,7 +66,6 @@ class LibraryControl : public QObject { void slotGoToItem(double v); // Deprecated navigation slots - void slotLoadSelectedTrackToGroup(QString group, bool play); void slotSelectNextTrack(double v); void slotSelectPrevTrack(double v); void slotSelectTrack(double v); diff --git a/src/library/mixxxlibraryfeature.cpp b/src/library/mixxxlibraryfeature.cpp index 199a2926df48..696b3a485bde 100644 --- a/src/library/mixxxlibraryfeature.cpp +++ b/src/library/mixxxlibraryfeature.cpp @@ -91,18 +91,30 @@ MixxxLibraryFeature::MixxxLibraryFeature(Library* pLibrary, BaseTrackCache* pBaseTrackCache = new BaseTrackCache( pTrackCollection, tableName, LIBRARYTABLE_ID, columns, true); - connect(&m_trackDao, SIGNAL(trackDirty(TrackId)), - pBaseTrackCache, SLOT(slotTrackDirty(TrackId))); - connect(&m_trackDao, SIGNAL(trackClean(TrackId)), - pBaseTrackCache, SLOT(slotTrackClean(TrackId))); - connect(&m_trackDao, SIGNAL(trackChanged(TrackId)), - pBaseTrackCache, SLOT(slotTrackChanged(TrackId))); - connect(&m_trackDao, SIGNAL(tracksAdded(QSet)), - pBaseTrackCache, SLOT(slotTracksAdded(QSet))); - connect(&m_trackDao, SIGNAL(tracksRemoved(QSet)), - pBaseTrackCache, SLOT(slotTracksRemoved(QSet))); - connect(&m_trackDao, SIGNAL(dbTrackAdded(TrackPointer)), - pBaseTrackCache, SLOT(slotDbTrackAdded(TrackPointer))); + connect(&m_trackDao, + &TrackDAO::trackDirty, + pBaseTrackCache, + &BaseTrackCache::slotTrackDirty); + connect(&m_trackDao, + &TrackDAO::trackClean, + pBaseTrackCache, + &BaseTrackCache::slotTrackClean); + connect(&m_trackDao, + &TrackDAO::trackChanged, + pBaseTrackCache, + &BaseTrackCache::slotTrackChanged); + connect(&m_trackDao, + &TrackDAO::tracksAdded, + pBaseTrackCache, + &BaseTrackCache::slotTracksAdded); + connect(&m_trackDao, + &TrackDAO::tracksRemoved, + pBaseTrackCache, + &BaseTrackCache::slotTracksRemoved); + connect(&m_trackDao, + &TrackDAO::dbTrackAdded, + pBaseTrackCache, + &BaseTrackCache::slotDbTrackAdded); m_pBaseTrackCache = QSharedPointer(pBaseTrackCache); pTrackCollection->setTrackSource(m_pBaseTrackCache); @@ -126,14 +138,18 @@ void MixxxLibraryFeature::bindWidget(WLibrary* pLibraryWidget, m_pHiddenView = new DlgHidden(pLibraryWidget, m_pConfig, m_pLibrary, m_pTrackCollection, pKeyboard); pLibraryWidget->registerView(kHiddenTitle, m_pHiddenView); - connect(m_pHiddenView, SIGNAL(trackSelected(TrackPointer)), - this, SIGNAL(trackSelected(TrackPointer))); + connect(m_pHiddenView, + &DlgHidden::trackSelected, + this, + &MixxxLibraryFeature::trackSelected); m_pMissingView = new DlgMissing(pLibraryWidget, m_pConfig, m_pLibrary, m_pTrackCollection, pKeyboard); pLibraryWidget->registerView(kMissingTitle, m_pMissingView); - connect(m_pMissingView, SIGNAL(trackSelected(TrackPointer)), - this, SIGNAL(trackSelected(TrackPointer))); + connect(m_pMissingView, + &DlgMissing::trackSelected, + this, + &MixxxLibraryFeature::trackSelected); } QVariant MixxxLibraryFeature::title() { diff --git a/src/library/playlisttablemodel.cpp b/src/library/playlisttablemodel.cpp index b77d48e5451b..bac651bd3407 100644 --- a/src/library/playlisttablemodel.cpp +++ b/src/library/playlisttablemodel.cpp @@ -104,8 +104,10 @@ void PlaylistTableModel::setTableModel(int playlistId) { setDefaultSort(fieldIndex(ColumnCache::COLUMN_PLAYLISTTRACKSTABLE_POSITION), Qt::AscendingOrder); setSort(defaultSortColumn(), defaultSortOrder()); - connect(&m_pTrackCollection->getPlaylistDAO(), SIGNAL(changed(int)), - this, SLOT(playlistChanged(int))); + connect(&m_pTrackCollection->getPlaylistDAO(), + &PlaylistDAO::changed, + this, + &PlaylistTableModel::playlistChanged); } int PlaylistTableModel::addTracks(const QModelIndex& index, diff --git a/src/library/previewbuttondelegate.cpp b/src/library/previewbuttondelegate.cpp index 753d9037e110..500759f4b02b 100644 --- a/src/library/previewbuttondelegate.cpp +++ b/src/library/previewbuttondelegate.cpp @@ -2,14 +2,15 @@ #include #include +#include "control/controlproxy.h" #include "library/previewbuttondelegate.h" #include "library/trackmodel.h" #include "mixer/playerinfo.h" #include "mixer/playermanager.h" #include "track/track.h" -#include "control/controlproxy.h" +#include "widget/wlibrarytableview.h" -PreviewButtonDelegate::PreviewButtonDelegate(QTableView* parent, int column) +PreviewButtonDelegate::PreviewButtonDelegate(WLibraryTableView* parent, int column) : TableItemDelegate(parent), m_pTableView(parent), m_isOneCellInEditMode(false), @@ -22,8 +23,10 @@ PreviewButtonDelegate::PreviewButtonDelegate(QTableView* parent, int column) PlayerManager::groupForPreviewDeck(0), "cue_gotoandplay", this); // This assumes that the parent is wtracktableview - connect(this, SIGNAL(loadTrackToPlayer(TrackPointer, QString, bool)), - parent, SIGNAL(loadTrackToPlayer(TrackPointer, QString, bool))); + connect(this, + &PreviewButtonDelegate::loadTrackToPlayer, + parent, + &WLibraryTableView::loadTrackToPlayer); // The button needs to be parented to receive the parent styles. m_pButton = make_parented(m_pTableView); @@ -33,8 +36,7 @@ PreviewButtonDelegate::PreviewButtonDelegate(QTableView* parent, int column) // We need to hide the button that it is not painted by the QObject tree m_pButton->hide(); - connect(m_pTableView, SIGNAL(entered(QModelIndex)), - this, SLOT(cellEntered(QModelIndex))); + connect(m_pTableView, &QTableView::entered, this, &PreviewButtonDelegate::cellEntered); } PreviewButtonDelegate::~PreviewButtonDelegate() { @@ -55,10 +57,14 @@ QWidget* PreviewButtonDelegate::createEditor(QWidget* parent, // Check-state is whether the track is loaded (index.data()) and whether // it's playing. btn->setChecked(index.data().toBool() && playing); - connect(btn, SIGNAL(clicked()), - this, SLOT(buttonClicked())); - connect(this, SIGNAL(buttonSetChecked(bool)), - btn, SLOT(setChecked(bool))); + connect(btn, + &QPushButton::clicked, + this, + &PreviewButtonDelegate::buttonClicked); + connect(this, + &PreviewButtonDelegate::buttonSetChecked, + btn, + &QPushButton::setChecked); return btn; } diff --git a/src/library/previewbuttondelegate.h b/src/library/previewbuttondelegate.h index cce3e32b7b2c..5e238ea7599a 100644 --- a/src/library/previewbuttondelegate.h +++ b/src/library/previewbuttondelegate.h @@ -9,6 +9,7 @@ #include "util/parented_ptr.h" class ControlProxy; +class WLibraryTableView; // A QPushButton for rendering the library preview button within the // PreviewButtonDelegate. @@ -36,7 +37,7 @@ class PreviewButtonDelegate : public TableItemDelegate { Q_OBJECT public: - explicit PreviewButtonDelegate(QTableView* parent, int column); + explicit PreviewButtonDelegate(WLibraryTableView* parent, int column); virtual ~PreviewButtonDelegate(); QWidget* createEditor(QWidget* parent, diff --git a/src/library/recording/dlgrecording.cpp b/src/library/recording/dlgrecording.cpp index 684d06fe7da7..b6299c31db45 100644 --- a/src/library/recording/dlgrecording.cpp +++ b/src/library/recording/dlgrecording.cpp @@ -23,23 +23,39 @@ DlgRecording::DlgRecording(QWidget* parent, UserSettingsPointer pConfig, m_pTrackTableView = new WTrackTableView(this, pConfig, m_pTrackCollection, true); 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(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_pRecordingManager, SIGNAL(isRecording(bool)), - this, SLOT(slotRecordingEnabled(bool))); - connect(m_pRecordingManager, SIGNAL(bytesRecorded(int)), - this, SLOT(slotBytesRecorded(int))); - connect(m_pRecordingManager, SIGNAL(durationRecorded(QString)), - this, SLOT(slotDurationRecorded(QString))); + connect(m_pTrackTableView, + &WTrackTableView::loadTrack, + this, + &DlgRecording::loadTrack); + connect(m_pTrackTableView, + &WTrackTableView::loadTrackToPlayer, + this, + &DlgRecording::loadTrackToPlayer); + connect(pLibrary, + &Library::setTrackTableFont, + m_pTrackTableView, + &WTrackTableView::setTrackTableFont); + connect(pLibrary, + &Library::setTrackTableRowHeight, + m_pTrackTableView, + &WTrackTableView::setTrackTableRowHeight); + connect(pLibrary, + &Library::setSelectedClick, + m_pTrackTableView, + &WTrackTableView::setSelectedClick); + + connect(m_pRecordingManager, + &RecordingManager::isRecording, + this, + &DlgRecording::slotRecordingEnabled); + connect(m_pRecordingManager, + &RecordingManager::bytesRecorded, + this, + &DlgRecording::slotBytesRecorded); + connect(m_pRecordingManager, + &RecordingManager::durationRecorded, + this, + &DlgRecording::slotDurationRecorded); QBoxLayout* box = dynamic_cast(layout()); VERIFY_OR_DEBUG_ASSERT(box) { //Assumes the form layout is a QVBox/QHBoxLayout! @@ -57,8 +73,10 @@ DlgRecording::DlgRecording(QWidget* parent, UserSettingsPointer pConfig, m_browseModel.setPath(m_recordingDir); m_pTrackTableView->loadTrackModel(&m_proxyModel); - connect(pushButtonRecording, SIGNAL(toggled(bool)), - this, SLOT(toggleRecording(bool))); + connect(pushButtonRecording, + &QPushButton::toggled, + this, + &DlgRecording::toggleRecording); label->setText(""); label->setEnabled(false); } diff --git a/src/library/recording/recordingfeature.cpp b/src/library/recording/recordingfeature.cpp index 22c436ee3a22..dbec0de53f1e 100644 --- a/src/library/recording/recordingfeature.cpp +++ b/src/library/recording/recordingfeature.cpp @@ -51,16 +51,26 @@ void RecordingFeature::bindWidget(WLibrary* pLibraryWidget, pRecordingView->installEventFilter(keyboard); pLibraryWidget->registerView(m_sRecordingViewName, pRecordingView); - connect(pRecordingView, SIGNAL(loadTrack(TrackPointer)), - this, SIGNAL(loadTrack(TrackPointer))); - connect(pRecordingView, SIGNAL(loadTrackToPlayer(TrackPointer, QString, bool)), - this, SIGNAL(loadTrackToPlayer(TrackPointer, QString, bool))); - connect(this, SIGNAL(refreshBrowseModel()), - pRecordingView, SLOT(refreshBrowseModel())); - connect(this, SIGNAL(requestRestoreSearch()), - pRecordingView, SLOT(slotRestoreSearch())); - connect(pRecordingView, SIGNAL(restoreSearch(QString)), - this, SIGNAL(restoreSearch(QString))); + connect(pRecordingView, + &DlgRecording::loadTrack, + this, + &RecordingFeature::loadTrack); + connect(pRecordingView, + &DlgRecording::loadTrackToPlayer, + this, + &RecordingFeature::loadTrackToPlayer); + connect(this, + &RecordingFeature::refreshBrowseModel, + pRecordingView, + &DlgRecording::refreshBrowseModel); + connect(this, + &RecordingFeature::requestRestoreSearch, + pRecordingView, + &DlgRecording::slotRestoreSearch); + connect(pRecordingView, + &DlgRecording::restoreSearch, + this, + &RecordingFeature::restoreSearch); } diff --git a/src/library/rhythmbox/rhythmboxfeature.cpp b/src/library/rhythmbox/rhythmboxfeature.cpp index b50e7593042b..8e482175f807 100644 --- a/src/library/rhythmbox/rhythmboxfeature.cpp +++ b/src/library/rhythmbox/rhythmboxfeature.cpp @@ -66,8 +66,10 @@ RhythmboxFeature::RhythmboxFeature(QObject* parent, TrackCollection* pTrackColle qDebug() << "Failed to open database for Rhythmbox scanner." << m_database.lastError(); } - connect(&m_track_watcher, SIGNAL(finished()), - this, SLOT(onTrackCollectionLoaded()), + connect(&m_track_watcher, + &QFutureWatcher::finished, + this, + &RhythmboxFeature::onTrackCollectionLoaded, Qt::QueuedConnection); } diff --git a/src/library/scanner/libraryscanner.cpp b/src/library/scanner/libraryscanner.cpp index 9aea8ff127da..5a426724ac0a 100644 --- a/src/library/scanner/libraryscanner.cpp +++ b/src/library/scanner/libraryscanner.cpp @@ -51,33 +51,55 @@ LibraryScanner::LibraryScanner( // Listen to signals from our public methods (invoked by other threads) and // connect them to our slots to run the command on the scanner thread. - connect(this, SIGNAL(startScan()), - this, SLOT(slotStartScan())); + connect(this, &LibraryScanner::startScan, this, &LibraryScanner::slotStartScan); // Force the GUI thread's Track cache to be cleared when a library // scan is finished, because we might have modified the database directly // when we detected moved files, and the TIOs corresponding to the moved // files would then have the wrong track location. TrackDAO* trackDao = &(m_pTrackCollection->getTrackDAO()); - connect(this, &LibraryScanner::trackAdded, trackDao, &TrackDAO::databaseTrackAdded); - connect(this, &LibraryScanner::tracksChanged, trackDao, &TrackDAO::databaseTracksChanged); - connect(this, &LibraryScanner::tracksReplaced, trackDao, &TrackDAO::databaseTracksReplaced); + connect(this, + &LibraryScanner::trackAdded, + trackDao, + &TrackDAO::databaseTrackAdded); + connect(this, + &LibraryScanner::tracksChanged, + trackDao, + &TrackDAO::databaseTracksChanged); + connect(this, + &LibraryScanner::tracksReplaced, + trackDao, + &TrackDAO::databaseTracksReplaced); m_pProgressDlg.reset(new LibraryScannerDlg()); - connect(this, SIGNAL(progressLoading(QString)), - m_pProgressDlg.data(), SLOT(slotUpdate(QString))); - connect(this, SIGNAL(progressHashing(QString)), - m_pProgressDlg.data(), SLOT(slotUpdate(QString))); - connect(this, SIGNAL(scanStarted()), - m_pProgressDlg.data(), SLOT(slotScanStarted())); - connect(this, SIGNAL(scanFinished()), - m_pProgressDlg.data(), SLOT(slotScanFinished())); - connect(m_pProgressDlg.data(), SIGNAL(scanCancelled()), - this, SLOT(slotCancel())); - connect(&m_trackDao, SIGNAL(progressVerifyTracksOutside(QString)), - m_pProgressDlg.data(), SLOT(slotUpdate(QString))); - connect(&m_trackDao, SIGNAL(progressCoverArt(QString)), - m_pProgressDlg.data(), SLOT(slotUpdateCover(QString))); + connect(this, + &LibraryScanner::progressLoading, + m_pProgressDlg.data(), + &LibraryScannerDlg::slotUpdate); + connect(this, + &LibraryScanner::progressHashing, + m_pProgressDlg.data(), + &LibraryScannerDlg::slotUpdate); + connect(this, + &LibraryScanner::scanStarted, + m_pProgressDlg.data(), + &LibraryScannerDlg::slotScanStarted); + connect(this, + &LibraryScanner::scanFinished, + m_pProgressDlg.data(), + &LibraryScannerDlg::slotScanFinished); + connect(m_pProgressDlg.data(), + &LibraryScannerDlg::scanCancelled, + this, + &LibraryScanner::slotCancel); + connect(&m_trackDao, + &TrackDAO::progressVerifyTracksOutside, + m_pProgressDlg.data(), + &LibraryScannerDlg::slotUpdate); + connect(&m_trackDao, + &TrackDAO::progressCoverArt, + m_pProgressDlg.data(), + &LibraryScannerDlg::slotUpdateCover); start(); } @@ -171,8 +193,10 @@ void LibraryScanner::slotStartScan() { // are done, TaskWatcher will signal slotFinishHashedScan. TaskWatcher* pWatcher = &m_scannerGlobal->getTaskWatcher(); pWatcher->watchTask(); - connect(pWatcher, SIGNAL(allTasksDone()), - this, SLOT(slotFinishHashedScan())); + connect(pWatcher, + &TaskWatcher::allTasksDone, + this, + &LibraryScanner::slotFinishHashedScan); foreach (const QString& dirPath, m_libraryRootDirs) { // Acquire a security bookmark for this directory if we are in a @@ -199,8 +223,10 @@ void LibraryScanner::slotFinishHashedScan() { } TaskWatcher* pWatcher = &m_scannerGlobal->getTaskWatcher(); - disconnect(pWatcher, SIGNAL(allTasksDone()), - this, SLOT(slotFinishHashedScan())); + disconnect(pWatcher, + &TaskWatcher::allTasksDone, + this, + &LibraryScanner::slotFinishHashedScan); if (m_scannerGlobal->unhashedDirs().empty()) { // bypass the second stage @@ -212,8 +238,10 @@ void LibraryScanner::slotFinishHashedScan() { // in the first stage. When all tasks // are done, TaskWatcher will signal slotFinishUnhashedScan. pWatcher->watchTask(); - connect(pWatcher, SIGNAL(allTasksDone()), - this, SLOT(slotFinishUnhashedScan())); + connect(pWatcher, + &TaskWatcher::allTasksDone, + this, + &LibraryScanner::slotFinishUnhashedScan); foreach (const DirInfo& dirInfo, m_scannerGlobal->unhashedDirs()) { // no testAndMarkDirectoryScanned() here, because all unhashedDirs() @@ -413,23 +441,37 @@ void LibraryScanner::queueTask(ScannerTask* pTask) { return; } m_scannerGlobal->getTaskWatcher().watchTask(); - connect(pTask, SIGNAL(queueTask(ScannerTask*)), - this, SLOT(queueTask(ScannerTask*))); - connect(pTask, SIGNAL(directoryHashedAndScanned(QString, bool, int)), - this, SLOT(slotDirectoryHashedAndScanned(QString, bool, int))); - connect(pTask, SIGNAL(directoryUnchanged(QString)), - this, SLOT(slotDirectoryUnchanged(QString))); - connect(pTask, SIGNAL(trackExists(QString)), - this, SLOT(slotTrackExists(QString))); - connect(pTask, SIGNAL(addNewTrack(QString)), - this, SLOT(slotAddNewTrack(QString))); + connect(pTask, + &ScannerTask::queueTask, + this, + &LibraryScanner::queueTask); + connect(pTask, + &ScannerTask::directoryHashedAndScanned, + this, + &LibraryScanner::slotDirectoryHashedAndScanned); + connect(pTask, + &ScannerTask::directoryUnchanged, + this, + &LibraryScanner::slotDirectoryUnchanged); + connect(pTask, + &ScannerTask::trackExists, + this, + &LibraryScanner::slotTrackExists); + connect(pTask, + &ScannerTask::addNewTrack, + this, + &LibraryScanner::slotAddNewTrack); // Progress signals. // Pass directly to the main thread - connect(pTask, SIGNAL(progressLoading(QString)), - this, SIGNAL(progressLoading(QString))); - connect(pTask, SIGNAL(progressHashing(QString)), - this, SIGNAL(progressHashing(QString))); + connect(pTask, + &ScannerTask::progressLoading, + this, + &LibraryScanner::progressLoading); + connect(pTask, + &ScannerTask::progressHashing, + this, + &LibraryScanner::progressHashing); m_pool.start(pTask); } diff --git a/src/library/scanner/libraryscannerdlg.cpp b/src/library/scanner/libraryscannerdlg.cpp index fd3fc7891101..08568b2ad22b 100644 --- a/src/library/scanner/libraryscannerdlg.cpp +++ b/src/library/scanner/libraryscannerdlg.cpp @@ -35,8 +35,10 @@ LibraryScannerDlg::LibraryScannerDlg(QWidget* parent, Qt::WindowFlags f) pLayout->addWidget(pLabel); QPushButton* pCancel = new QPushButton(tr("Cancel"), this); - connect(pCancel, SIGNAL(clicked()), - this, SLOT(slotCancel())); + connect(pCancel, + &QPushButton::clicked, + this, + &LibraryScannerDlg::slotCancel); pLayout->addWidget(pCancel); QLabel* pCurrent = new QLabel(this); @@ -44,8 +46,7 @@ LibraryScannerDlg::LibraryScannerDlg(QWidget* parent, Qt::WindowFlags f) pCurrent->setMaximumWidth(600); pCurrent->setFixedHeight(this->fontMetrics().height()); pCurrent->setWordWrap(true); - connect(this, SIGNAL(progress(QString)), - pCurrent, SLOT(setText(QString))); + connect(this, &LibraryScannerDlg::progress, pCurrent, &QLabel::setText); pLayout->addWidget(pCurrent); setLayout(pLayout); } diff --git a/src/library/setlogfeature.cpp b/src/library/setlogfeature.cpp index 4ec518bab016..e42fea2e5d6d 100644 --- a/src/library/setlogfeature.cpp +++ b/src/library/setlogfeature.cpp @@ -30,11 +30,16 @@ SetlogFeature::SetlogFeature(QObject* parent, constructChildModel(-1); m_pJoinWithPreviousAction = new QAction(tr("Join with previous"), this); - connect(m_pJoinWithPreviousAction, SIGNAL(triggered()), - this, SLOT(slotJoinWithPrevious())); + connect(m_pJoinWithPreviousAction, + &QAction::triggered, + this, + &SetlogFeature::slotJoinWithPrevious); m_pGetNewPlaylist = new QAction(tr("Create new history playlist"), this); - connect(m_pGetNewPlaylist, SIGNAL(triggered()), this, SLOT(slotGetNewPlaylist())); + connect(m_pGetNewPlaylist, + &QAction::triggered, + this, + &SetlogFeature::slotGetNewPlaylist); // initialized in a new generic slot(get new history playlist purpose) slotGetNewPlaylist(); @@ -62,8 +67,10 @@ void SetlogFeature::bindWidget(WLibrary* libraryWidget, KeyboardEventFilter* keyboard) { BasePlaylistFeature::bindWidget(libraryWidget, keyboard); - connect(&PlayerInfo::instance(), SIGNAL(currentPlayingTrackChanged(TrackPointer)), - this, SLOT(slotPlayingTrackChanged(TrackPointer))); + connect(&PlayerInfo::instance(), + &PlayerInfo::currentPlayingTrackChanged, + this, + &SetlogFeature::slotPlayingTrackChanged); m_libraryWidget = libraryWidget; } diff --git a/src/library/sidebarmodel.cpp b/src/library/sidebarmodel.cpp index 458176a63ddc..87155c09f9f9 100644 --- a/src/library/sidebarmodel.cpp +++ b/src/library/sidebarmodel.cpp @@ -24,36 +24,58 @@ SidebarModel::SidebarModel( m_iDefaultSelectedIndex(0), m_pressedUntilClickedTimer(new QTimer(this)) { m_pressedUntilClickedTimer->setSingleShot(true); - connect(m_pressedUntilClickedTimer, SIGNAL(timeout()), this, SLOT(slotPressedUntilClickedTimeout())); + connect(m_pressedUntilClickedTimer, + &QTimer::timeout, + this, + &SidebarModel::slotPressedUntilClickedTimeout); } void SidebarModel::addLibraryFeature(LibraryFeature* feature) { m_sFeatures.push_back(feature); - connect(feature, SIGNAL(featureIsLoading(LibraryFeature*, bool)), - this, SLOT(slotFeatureIsLoading(LibraryFeature*, bool))); - connect(feature, SIGNAL(featureLoadingFinished(LibraryFeature*)), - this, SLOT(slotFeatureLoadingFinished(LibraryFeature*))); - connect(feature, SIGNAL(featureSelect(LibraryFeature*, const QModelIndex&)), - this, SLOT(slotFeatureSelect(LibraryFeature*, const QModelIndex&))); + connect(feature, + &LibraryFeature::featureIsLoading, + this, + &SidebarModel::slotFeatureIsLoading); + connect(feature, + &LibraryFeature::featureLoadingFinished, + this, + &SidebarModel::slotFeatureLoadingFinished); + connect(feature, + &LibraryFeature::featureSelect, + this, + &SidebarModel::slotFeatureSelect); QAbstractItemModel* model = feature->getChildModel(); - connect(model, SIGNAL(modelAboutToBeReset()), - this, SLOT(slotModelAboutToBeReset())); - connect(model, SIGNAL(modelReset()), - this, SLOT(slotModelReset())); - connect(model, SIGNAL(dataChanged(const QModelIndex&,const QModelIndex&)), - this, SLOT(slotDataChanged(const QModelIndex&,const QModelIndex&))); - - connect(model, SIGNAL(rowsAboutToBeInserted(const QModelIndex&, int, int)), - this, SLOT(slotRowsAboutToBeInserted(const QModelIndex&, int, int))); - connect(model, SIGNAL(rowsAboutToBeRemoved(const QModelIndex&, int, int)), - this, SLOT(slotRowsAboutToBeRemoved(const QModelIndex&, int, int))); - connect(model, SIGNAL(rowsInserted(const QModelIndex&, int, int)), - this, SLOT(slotRowsInserted(const QModelIndex&, int, int))); - connect(model, SIGNAL(rowsRemoved(const QModelIndex&, int, int)), - this, SLOT(slotRowsRemoved(const QModelIndex&, int, int))); - + connect(model, + &QAbstractItemModel::modelAboutToBeReset, + this, + &SidebarModel::slotModelAboutToBeReset); + connect(model, + &QAbstractItemModel::modelReset, + this, + &SidebarModel::slotModelReset); + connect(model, + &QAbstractItemModel::dataChanged, + this, + &SidebarModel::slotDataChanged); + + connect(model, + &QAbstractItemModel::rowsAboutToBeInserted, + this, + &SidebarModel::slotRowsAboutToBeInserted); + connect(model, + &QAbstractItemModel::rowsAboutToBeRemoved, + this, + &SidebarModel::slotRowsAboutToBeRemoved); + connect(model, + &QAbstractItemModel::rowsInserted, + this, + &SidebarModel::slotRowsInserted); + connect(model, + &QAbstractItemModel::rowsRemoved, + this, + &SidebarModel::slotRowsRemoved); } QModelIndex SidebarModel::getDefaultSelection() { diff --git a/src/library/songdownloader.cpp b/src/library/songdownloader.cpp index c2813288a785..c5369988122e 100644 --- a/src/library/songdownloader.cpp +++ b/src/library/songdownloader.cpp @@ -5,6 +5,7 @@ #include #include +#include "util/compatibility.h" #include "util/version.h" #define TEMP_EXTENSION ".tmp" @@ -17,8 +18,8 @@ SongDownloader::SongDownloader(QObject* parent) qDebug() << "SongDownloader constructed"; m_pNetwork = new QNetworkAccessManager(); - //connect(m_pNetwork, SIGNAL(finished(QNetworkReply*)), - // this, SLOT(finishedSlot(QNetworkReply*))); + //connect(m_pNetwork, finished, + // this, finishedSlot); } SongDownloader::~SongDownloader() { @@ -64,15 +65,23 @@ bool SongDownloader::downloadFromQueue() { m_pRequest->setRawHeader("User-Agent", mixxxUABA); m_pReply = m_pNetwork->get(*m_pRequest); - connect(m_pReply, SIGNAL(readyRead()), this, SLOT(slotReadyRead())); - connect(m_pReply, SIGNAL(error(QNetworkReply::NetworkError)), - this, SLOT(slotError(QNetworkReply::NetworkError))); - connect(m_pReply, SIGNAL(downloadProgress(qint64, qint64)), - this, SLOT(slotProgress(qint64, qint64))); - connect(m_pReply, SIGNAL(downloadProgress(qint64, qint64)), - this, SIGNAL(downloadProgress(qint64, qint64))); - connect(m_pReply, SIGNAL(finished()), - this, SLOT(slotDownloadFinished())); + connect(m_pReply, + &QNetworkReply::readyRead, + this, + &SongDownloader::slotReadyRead); + connect(m_pReply, QOverload::of(&QNetworkReply::error), this, &SongDownloader::slotError); + connect(m_pReply, + &QNetworkReply::downloadProgress, + this, + &SongDownloader::slotProgress); + connect(m_pReply, + &QNetworkReply::downloadProgress, + this, + &SongDownloader::downloadProgress); + connect(m_pReply, + &QNetworkReply::finished, + this, + &SongDownloader::slotDownloadFinished); return true; } diff --git a/src/library/stardelegate.cpp b/src/library/stardelegate.cpp index b1a5b44a22f3..ca96ccab82c9 100644 --- a/src/library/stardelegate.cpp +++ b/src/library/stardelegate.cpp @@ -27,8 +27,7 @@ StarDelegate::StarDelegate(QTableView* pTableView) : TableItemDelegate(pTableView), m_pTableView(pTableView), m_isOneCellInEditMode(false) { - connect(pTableView, SIGNAL(entered(QModelIndex)), - this, SLOT(cellEntered(QModelIndex))); + connect(pTableView, &QTableView::entered, this, &StarDelegate::cellEntered); } void StarDelegate::paint(QPainter* painter, const QStyleOptionViewItem& option, @@ -66,8 +65,10 @@ QWidget* StarDelegate::createEditor(QWidget* parent, initStyleOption(&newOption, index); StarEditor* editor = new StarEditor(parent, m_pTableView, index, newOption); - connect(editor, SIGNAL(editingFinished()), - this, SLOT(commitAndCloseEditor())); + connect(editor, + &StarEditor::editingFinished, + this, + &StarDelegate::commitAndCloseEditor); return editor; } diff --git a/src/library/traktor/traktorfeature.cpp b/src/library/traktor/traktorfeature.cpp index 50263e49450a..872c4383a610 100644 --- a/src/library/traktor/traktorfeature.cpp +++ b/src/library/traktor/traktorfeature.cpp @@ -109,8 +109,10 @@ TraktorFeature::TraktorFeature(QObject* parent, TrackCollection* pTrackCollectio qDebug() << "Failed to open database for iTunes scanner." << m_database.lastError(); } - connect(&m_future_watcher, SIGNAL(finished()), - this, SLOT(onTrackCollectionLoaded())); + connect(&m_future_watcher, + &QFutureWatcher::finished, + this, + &TraktorFeature::onTrackCollectionLoaded); } TraktorFeature::~TraktorFeature() { diff --git a/src/widget/wlibrarytableview.cpp b/src/widget/wlibrarytableview.cpp index d8bff69a8169..297a8347d71a 100644 --- a/src/widget/wlibrarytableview.cpp +++ b/src/widget/wlibrarytableview.cpp @@ -6,6 +6,7 @@ #include #include +#include "library/trackmodel.h" #include "widget/wwidget.h" #include "widget/wskincolor.h" #include "widget/wlibrarytableview.h" diff --git a/src/widget/wlibrarytableview.h b/src/widget/wlibrarytableview.h index 41714eb55b42..ad142ef194e9 100644 --- a/src/widget/wlibrarytableview.h +++ b/src/widget/wlibrarytableview.h @@ -11,9 +11,8 @@ #include "preferences/usersettings.h" #include "library/libraryview.h" #include "track/track.h" -#include "library/coverartcache.h" -#include "library/trackmodel.h" +class TrackModel; class WLibraryTableView : public QTableView, public virtual LibraryView { Q_OBJECT @@ -23,6 +22,7 @@ class WLibraryTableView : public QTableView, public virtual LibraryView { UserSettingsPointer pConfig, ConfigKey vScrollBarPosKey); ~WLibraryTableView() override; + void moveSelection(int delta) override; /**