Skip to content

Commit

Permalink
Merge pull request #13426 from ronso0/track-prop-in-hidden-and-missing
Browse files Browse the repository at this point in the history
(fix) Library: show Properties action in Missing and Hidden
  • Loading branch information
daschuer authored Jul 4, 2024
2 parents df6529d + 3213fd1 commit 6268dba
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 9 deletions.
3 changes: 2 additions & 1 deletion src/library/librarytablemodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,5 +98,6 @@ TrackModel::Capabilities LibraryTableModel::getCapabilities() const {
Capability::Hide |
Capability::ResetPlayed |
Capability::RemoveFromDisk |
Capability::Analyze;
Capability::Analyze |
Capability::Properties;
}
4 changes: 3 additions & 1 deletion src/library/missing_hidden/hiddentablemodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,9 @@ Qt::ItemFlags HiddenTableModel::flags(const QModelIndex& index) const {
TrackModel::Capabilities HiddenTableModel::getCapabilities() const {
return Capability::Purge |
Capability::Unhide |
Capability::RemoveFromDisk;
Capability::RemoveFromDisk |
Capability::EditMetadata |
Capability::Properties;
}

QString HiddenTableModel::modelKey(bool noSearch) const {
Expand Down
2 changes: 1 addition & 1 deletion src/library/missing_hidden/missingtablemodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ Qt::ItemFlags MissingTableModel::flags(const QModelIndex &index) const {
}

TrackModel::Capabilities MissingTableModel::getCapabilities() const {
return Capability::Purge;
return Capability::Purge | Capability::Properties;
}

QString MissingTableModel::modelKey(bool noSearch) const {
Expand Down
3 changes: 2 additions & 1 deletion src/library/playlisttablemodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,8 @@ TrackModel::Capabilities PlaylistTableModel::getCapabilities() const {
Capability::ResetPlayed |
Capability::RemoveFromDisk |
Capability::Hide |
Capability::Analyze;
Capability::Analyze |
Capability::Properties;

if (m_iPlaylistId !=
m_pTrackCollectionManager->internalCollection()
Expand Down
1 change: 1 addition & 0 deletions src/library/trackmodel.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ class TrackModel {
RemoveCrate = 1u << 15u,
RemoveFromDisk = 1u << 16u,
Analyze = 1u << 17u,
Properties = 1u << 18u,
};
Q_DECLARE_FLAGS(Capabilities, Capability)

Expand Down
3 changes: 2 additions & 1 deletion src/library/trackset/crate/cratetablemodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,8 @@ TrackModel::Capabilities CrateTableModel::getCapabilities() const {
Capability::ResetPlayed |
Capability::Hide |
Capability::RemoveFromDisk |
Capability::Analyze;
Capability::Analyze |
Capability::Properties;

if (m_selectedCrate.isValid()) {
Crate crate;
Expand Down
12 changes: 8 additions & 4 deletions src/widget/wtrackmenu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -345,14 +345,16 @@ void WTrackMenu::createActions() {
&WTrackMenu::slotRemoveFromDisk);
}

if (featureIsEnabled(Feature::Properties)) {
if (featureIsEnabled(Feature::Metadata)) {
m_pStarRatingAction = new WStarRatingAction(this);
m_pStarRatingAction->setObjectName("RatingAction");
connect(m_pStarRatingAction,
&WStarRatingAction::ratingSet,
this,
&WTrackMenu::slotSetRating);
}

if (featureIsEnabled(Feature::Properties)) {
m_pPropertiesAct = new QAction(tr("Properties"), this);
// This is just for having the shortcut displayed next to the action
// when the menu is invoked from the tracks table.
Expand Down Expand Up @@ -631,7 +633,7 @@ void WTrackMenu::setupActions() {
addMenu(m_pBPMMenu);
}

if (featureIsEnabled(Feature::Properties)) {
if (featureIsEnabled(Feature::Metadata)) {
addAction(m_pStarRatingAction);
}

Expand Down Expand Up @@ -1101,12 +1103,14 @@ void WTrackMenu::updateMenus() {
m_pSelectInLibraryAct->setEnabled(enabled);
}

if (featureIsEnabled(Feature::Properties)) {
if (featureIsEnabled(Feature::Metadata)) {
// Might be needed to resize Menu to fit the star rating
// QResizeEvent resizeEvent(QSize(), m_pStarRatingAction->sizeHint());
// qApp->sendEvent(m_pStarRatingAction, &resizeEvent);
m_pStarRatingAction->setRating(getCommonTrackRating());
}

if (featureIsEnabled(Feature::Properties)) {
m_pPropertiesAct->setEnabled(true);
}

Expand Down Expand Up @@ -2753,7 +2757,7 @@ bool WTrackMenu::featureIsEnabled(Feature flag) const {
case Feature::FindOnWeb:
return true;
case Feature::Properties:
return m_pTrackModel->hasCapabilities(TrackModel::Capability::EditMetadata);
return m_pTrackModel->hasCapabilities(TrackModel::Capability::Properties);
case Feature::SearchRelated:
return m_pLibrary != nullptr;
case Feature::SelectInLibrary:
Expand Down

0 comments on commit 6268dba

Please sign in to comment.