diff options
Diffstat (limited to 'src/library/dlgtrackinfo.cpp')
-rw-r--r-- | src/library/dlgtrackinfo.cpp | 181 |
1 files changed, 113 insertions, 68 deletions
diff --git a/src/library/dlgtrackinfo.cpp b/src/library/dlgtrackinfo.cpp index e1f49d5d92..62cd8d5d9c 100644 --- a/src/library/dlgtrackinfo.cpp +++ b/src/library/dlgtrackinfo.cpp @@ -3,17 +3,18 @@ #include <QStringBuilder> #include <QComboBox> -#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<double>::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, @@ -399,8 +437,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()); @@ -489,8 +529,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) { @@ -505,7 +547,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(""); |