From 3b438887b52d758bed0ad05de65a0aa0a8c1db6e Mon Sep 17 00:00:00 2001 From: Ferran Pujol Camins Date: Sun, 22 Sep 2019 19:49:54 +0200 Subject: Use new signals and slots syntax --- src/library/analysisfeature.cpp | 42 ++++--- src/library/autodj/autodjfeature.cpp | 85 ++++++++----- src/library/autodj/dlgautodj.cpp | 95 +++++++++----- src/library/baseexternallibraryfeature.cpp | 18 ++- src/library/baseplaylistfeature.cpp | 130 +++++++++++++------- src/library/basesqltablemodel.cpp | 35 ++++-- src/library/basetrackcache.h | 2 +- src/library/browse/browsefeature.cpp | 52 ++++---- src/library/browse/browsefeature.h | 9 +- src/library/browse/browsetablemodel.cpp | 20 +-- src/library/coverartcache.cpp | 5 +- src/library/coverartdelegate.cpp | 8 +- src/library/coverartdelegate.h | 3 +- src/library/crate/cratefeature.cpp | 114 +++++++++++------ src/library/dao/autodjcratesdao.cpp | 65 ++++++---- src/library/dao/trackdao.cpp | 18 ++- src/library/dlganalysis.cpp | 66 ++++++---- src/library/dlgcoverartfullsize.cpp | 36 ++++-- src/library/dlghidden.cpp | 58 ++++++--- src/library/dlgmissing.cpp | 25 ++-- src/library/dlgtrackinfo.cpp | 178 +++++++++++++++++---------- src/library/export/trackexportdlg.cpp | 20 ++- src/library/itunes/itunesfeature.cpp | 5 +- src/library/library.cpp | 163 +++++++++++++++--------- src/library/librarycontrol.cpp | 191 ++++++++++++++++++++--------- src/library/librarycontrol.h | 8 +- src/library/mixxxlibraryfeature.cpp | 48 +++++--- src/library/playlisttablemodel.cpp | 6 +- src/library/previewbuttondelegate.cpp | 23 ++-- src/library/previewbuttondelegate.h | 3 +- src/library/recording/dlgrecording.cpp | 56 ++++++--- src/library/recording/recordingfeature.cpp | 30 +++-- src/library/rhythmbox/rhythmboxfeature.cpp | 6 +- src/library/scanner/libraryscanner.cpp | 123 ++++++++++++------- src/library/scanner/libraryscannerdlg.cpp | 9 +- src/library/setlogfeature.cpp | 17 ++- src/library/sidebarmodel.cpp | 68 ++++++---- src/library/songdownloader.cpp | 30 +++-- src/library/stardelegate.cpp | 9 +- src/library/traktor/traktorfeature.cpp | 6 +- 40 files changed, 1227 insertions(+), 658 deletions(-) diff --git a/src/library/analysisfeature.cpp b/src/library/analysisfeature.cpp index 779eed475d..012bdb1a4a 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(this->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 3ec62d7d6b..5b1e130380 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 311bbf6d38..d03de12e68 100644 --- a/src/library/autodj/dlgautodj.cpp +++ b/src/library/autodj/dlgautodj.cpp @@ -3,9 +3,10 @@ #include "library/autodj/dlgautodj.h" #include "library/playlisttablemodel.h" -#include "widget/wtracktableview.h" #include "util/assert.h" +#include "util/compatibility.h" #include "util/duration.h" +#include "widget/wtracktableview.h" DlgAutoDJ::DlgAutoDJ(QWidget* parent, UserSettingsPointer pConfig, @@ -23,21 +24,35 @@ DlgAutoDJ::DlgAutoDJ(QWidget* parent, setupUi(this); m_pTrackTableView->installEventFilter(pKeyboard); - connect(m_pTrackTableView, SIGNAL(loadTrack(TrackPointer)), - this, SIGNAL(loadTrack(TrackPointer))); - connect(m_pTrackTableView, SIGNAL(loadTrackToPlayer(TrackPointer, QString, bool)), - this, SIGNAL(loadTrackToPlayer(TrackPointer, QString, bool))); - connect(m_pTrackTableView, SIGNAL(trackSelected(TrackPointer)), - this, SIGNAL(trackSelected(TrackPointer))); - connect(m_pTrackTableView, SIGNAL(trackSelected(TrackPointer)), - this, SLOT(updateSelectionInfo())); - - connect(pLibrary, SIGNAL(setTrackTableFont(QFont)), - m_pTrackTableView, SLOT(setTrackTableFont(QFont))); - connect(pLibrary, SIGNAL(setTrackTableRowHeight(int)), - m_pTrackTableView, SLOT(setTrackTableRowHeight(int))); - connect(pLibrary, SIGNAL(setSelectedClick(bool)), - m_pTrackTableView, SLOT(setSelectedClick(bool))); + connect(m_pTrackTableView, + &WTrackTableView::loadTrack, + this, + &DlgAutoDJ::loadTrack); + connect(m_pTrackTableView, + &WTrackTableView::loadTrackToPlayer, + this, + &DlgAutoDJ::loadTrackToPlayer); + connect(m_pTrackTableView, + &WTrackTableView::trackSelected, + this, + &DlgAutoDJ::trackSelected); + connect(m_pTrackTableView, + &WTrackTableView::trackSelected, + this, + &DlgAutoDJ::updateSelectionInfo); + + connect(pLibrary, + &Library::setTrackTableFont, + m_pTrackTableView, + &WTrackTableView::setTrackTableFont); + connect(pLibrary, + &Library::setTrackTableRowHeight, + m_pTrackTableView, + &WTrackTableView::setTrackTableRowHeight); + connect(pLibrary, + &Library::setSelectedClick, + m_pTrackTableView, + &WTrackTableView::setSelectedClick); QBoxLayout* box = dynamic_cast(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 b527c119d3..8eee4928bd 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 0c910be770..ba12a351d1 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 ff3d5dd923..a5f991652e 100644 --- a/src/library/basesqltablemodel.cpp +++ b/src/library/basesqltablemodel.cpp @@ -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); + WLibraryTableView* 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 a009618b28..1d77420d6b 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 b5757e226b..b5c20f836d 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 a414614759..76994191bc 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 abd06a574f..69e3c419b0 100644 --- a/src/library/browse/browsetablemodel.cpp +++ b/src/library/browse/browsetablemodel.cpp @@ -103,18 +103,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 +417,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 446761c282..6aeaa11074 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 871807d2e8..02e27e8fd0 100644 --- a/src/library/coverartdelegate.cpp +++ b/src/library/coverartdelegate.cpp @@ -6,7 +6,7 @@ #include "library/dao/trackschema.h" #include "util/math.h" -CoverArtDelegate::CoverArtDelegate(QTableView* parent) +CoverArtDelegate::CoverArtDelegate(WLibraryTableView* parent) : TableItemDelegate(parent), m_pTableView(parent), m_bOnlyCachedCover(false), @@ -18,8 +18,10 @@ 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) { diff --git a/src/library/coverartdelegate.h b/src/library/coverartdelegate.h index d5031c76fc..005b6f6348 100644 --- a/src/library/coverartdelegate.h +++ b/src/library/coverartdelegate.h @@ -1,6 +1,7 @@ #ifndef COVERARTDELEGATE_H #define COVERARTDELEGATE_H +#include #include #include @@ -10,7 +11,7 @@ class CoverArtDelegate : public TableItemDelegate { Q_OBJECT public: - explicit CoverArtDelegate(QTableView* pTableView); + explicit CoverArtDelegate(WLibraryTableView* parent); virtual ~CoverArtDelegate(); void paintItem(QPainter* painter, diff --git a/src/library/crate/cratefeature.cpp b/src/library/crate/cratefeature.cpp index bcc5cd83fc..d6d52dd32c 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 43557dc81c..64e0949267 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 266641749c..ba08954a3c 100644 --- a/src/library/dao/trackdao.cpp +++ b/src/library/dao/trackdao.cpp @@ -1348,14 +1348,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 c3c123c6da..a1484ede50 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 a17f4a44b3..8eda698782 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 b8c0c5f59a..3c9ed62bf3 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, pTrackCollection); 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 671c631efd..5fc623d3a1 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, pTrackCollection); 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 c8b9de3f60..58fba66e2a 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,98 @@ 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, +