-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Track: Add missing NOTIFY
signals for Q_PROPERTY
declarations
#3924
Changes from 1 commit
54ddf25
1197c78
a06e8ca
cadecf7
978ab2c
640a59d
78783e5
838da06
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -47,27 +47,34 @@ class Track : public QObject { | |
const QString& filePath, | ||
TrackId trackId); | ||
|
||
Q_PROPERTY(QString artist READ getArtist WRITE setArtist) | ||
Q_PROPERTY(QString title READ getTitle WRITE setTitle) | ||
Q_PROPERTY(QString album READ getAlbum WRITE setAlbum) | ||
Q_PROPERTY(QString albumArtist READ getAlbumArtist WRITE setAlbumArtist) | ||
Q_PROPERTY(QString genre READ getGenre WRITE setGenre) | ||
Q_PROPERTY(QString composer READ getComposer WRITE setComposer) | ||
Q_PROPERTY(QString grouping READ getGrouping WRITE setGrouping) | ||
Q_PROPERTY(QString year READ getYear WRITE setYear) | ||
Q_PROPERTY(QString track_number READ getTrackNumber WRITE setTrackNumber) | ||
Q_PROPERTY(QString track_total READ getTrackTotal WRITE setTrackTotal) | ||
Q_PROPERTY(int times_played READ getTimesPlayed) | ||
Q_PROPERTY(QString comment READ getComment WRITE setComment) | ||
Q_PROPERTY(double bpm READ getBpm) | ||
Q_PROPERTY(QString bpmFormatted READ getBpmText STORED false) | ||
Q_PROPERTY(QString key READ getKeyText WRITE setKeyText) | ||
Q_PROPERTY(double duration READ getDuration) | ||
Q_PROPERTY(QString durationFormatted READ getDurationTextSeconds STORED false) | ||
Q_PROPERTY(QString durationFormattedCentiseconds READ getDurationTextCentiseconds STORED false) | ||
Q_PROPERTY(QString durationFormattedMilliseconds READ getDurationTextMilliseconds STORED false) | ||
Q_PROPERTY(QString info READ getInfo STORED false) | ||
Q_PROPERTY(QString titleInfo READ getTitleInfo STORED false) | ||
Q_PROPERTY(QString artist READ getArtist WRITE setArtist NOTIFY artistChanged) | ||
Q_PROPERTY(QString title READ getTitle WRITE setTitle NOTIFY titleChanged) | ||
Q_PROPERTY(QString album READ getAlbum WRITE setAlbum NOTIFY albumChanged) | ||
Q_PROPERTY(QString albumArtist READ getAlbumArtist WRITE setAlbumArtist | ||
NOTIFY albumArtistChanged) | ||
Q_PROPERTY(QString genre READ getGenre WRITE setGenre NOTIFY genreChanged) | ||
Q_PROPERTY(QString composer READ getComposer WRITE setComposer NOTIFY composerChanged) | ||
Q_PROPERTY(QString grouping READ getGrouping WRITE setGrouping NOTIFY groupingChanged) | ||
Q_PROPERTY(QString year READ getYear WRITE setYear NOTIFY yearChanged) | ||
Q_PROPERTY(QString trackNumber READ getTrackNumber WRITE setTrackNumber | ||
NOTIFY trackNumberChanged) | ||
Q_PROPERTY(QString trackTotal READ getTrackTotal WRITE setTrackTotal NOTIFY trackTotalChanged) | ||
Q_PROPERTY(int timesPlayed READ getTimesPlayed NOTIFY timesPlayedChanged) | ||
Q_PROPERTY(QString comment READ getComment WRITE setComment NOTIFY commentChanged) | ||
Q_PROPERTY(double bpm READ getBpm NOTIFY bpmUpdated) | ||
Q_PROPERTY(QString bpmFormatted READ getBpmText STORED false NOTIFY bpmUpdated) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The change signal has a different type than the property. Is this intended? I would expect that all change signals emit the actual property type. This also applies to the key text and formatted duration. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The signals without parameters are intended:
https://doc.qt.io/qt-5.12/properties.html The type mismatch is unintended though :D There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done. |
||
Q_PROPERTY(QString key READ getKeyText WRITE setKeyText NOTIFY keysUpdated) | ||
Q_PROPERTY(double duration READ getDuration NOTIFY durationChanged) | ||
Q_PROPERTY(QString durationFormatted READ getDurationTextSeconds | ||
STORED false NOTIFY durationChanged) | ||
Q_PROPERTY(QString durationFormattedCentiseconds READ | ||
getDurationTextCentiseconds | ||
STORED false NOTIFY durationChanged) | ||
Q_PROPERTY(QString durationFormattedMilliseconds READ | ||
getDurationTextMilliseconds | ||
STORED false NOTIFY durationChanged) | ||
Q_PROPERTY(QString info READ getInfo STORED false NOTIFY infoChanged) | ||
Q_PROPERTY(QString titleInfo READ getTitleInfo STORED false NOTIFY infoChanged) | ||
|
||
mixxx::FileAccess getFileAccess() const { | ||
// Copying QFileInfo is thread-safe due to implicit sharing, | ||
|
@@ -363,6 +370,21 @@ class Track : public QObject { | |
const mixxx::audio::StreamInfo& streamInfo); | ||
|
||
signals: | ||
void artistChanged(const QString&); | ||
void titleChanged(const QString&); | ||
void albumChanged(const QString&); | ||
void albumArtistChanged(const QString&); | ||
void genreChanged(const QString&); | ||
void composerChanged(const QString&); | ||
void groupingChanged(const QString&); | ||
void yearChanged(const QString&); | ||
void trackNumberChanged(const QString&); | ||
void trackTotalChanged(const QString&); | ||
void commentChanged(const QString&); | ||
void timesPlayedChanged(); | ||
void durationChanged(); | ||
void infoChanged(); | ||
|
||
void waveformUpdated(); | ||
void waveformSummaryUpdated(); | ||
void coverArtUpdated(); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would prefer to call the additional signals explicit.
For less magic to consider in case of future refactoring.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You want me to add slots that only contain
emit infoChanged()
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, I mean copy emit infoChanged() below emit artistChanged()
Than the call tree has one interruption less when debugging.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Than we can consider to get rid of infoChanged() in favor of changed()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, the signal signature is incompatible. I added the direct emit statements as you suggested.