Skip to content

Commit

Permalink
Merge pull request #12214 from ronso0/trackmenu-unify-features-for-decks
Browse files Browse the repository at this point in the history
WTrackMenu: provide the same features in all deck track widgets
  • Loading branch information
daschuer authored Feb 11, 2024
2 parents b6c409e + 65928df commit cb25968
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 35 deletions.
2 changes: 2 additions & 0 deletions src/widget/wtrackmenu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@
#include "widget/wsearchrelatedtracksmenu.h"
#include "widget/wstarrating.h"

constexpr WTrackMenu::Features WTrackMenu::kDeckTrackMenuFeatures;

namespace {
const QString kAppGroup = QStringLiteral("[App]");

Expand Down
18 changes: 18 additions & 0 deletions src/widget/wtrackmenu.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,24 @@ class WTrackMenu : public QMenu {
};
Q_DECLARE_FLAGS(Features, Feature)

// Make all deck track widgets provide the same features.
// Used by WTrackProperty, WTrackText & WTrackWidgetGroup.
static constexpr WTrackMenu::Features kDeckTrackMenuFeatures{
WTrackMenu::Feature::SearchRelated |
WTrackMenu::Feature::Playlist |
WTrackMenu::Feature::Crate |
WTrackMenu::Feature::Metadata |
WTrackMenu::Feature::Reset |
WTrackMenu::Feature::Analyze |
WTrackMenu::Feature::BPM |
WTrackMenu::Feature::Color |
WTrackMenu::Feature::RemoveFromDisk |
WTrackMenu::Feature::FileBrowser |
WTrackMenu::Feature::Properties |
WTrackMenu::Feature::UpdateReplayGainFromPregain |
WTrackMenu::Feature::FindOnWeb |
WTrackMenu::Feature::SelectInLibrary};

WTrackMenu(QWidget* parent,
UserSettingsPointer pConfig,
Library* pLibrary,
Expand Down
20 changes: 1 addition & 19 deletions src/widget/wtrackproperty.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,6 @@
#include "util/dnd.h"
#include "widget/wtrackmenu.h"

namespace {
constexpr WTrackMenu::Features kTrackMenuFeatures =
WTrackMenu::Feature::SearchRelated |
WTrackMenu::Feature::Playlist |
WTrackMenu::Feature::Crate |
WTrackMenu::Feature::Metadata |
WTrackMenu::Feature::Reset |
WTrackMenu::Feature::Analyze |
WTrackMenu::Feature::BPM |
WTrackMenu::Feature::Color |
WTrackMenu::Feature::RemoveFromDisk |
WTrackMenu::Feature::FileBrowser |
WTrackMenu::Feature::Properties |
WTrackMenu::Feature::UpdateReplayGainFromPregain |
WTrackMenu::Feature::FindOnWeb |
WTrackMenu::Feature::SelectInLibrary;
} // namespace

WTrackProperty::WTrackProperty(
QWidget* pParent,
UserSettingsPointer pConfig,
Expand Down Expand Up @@ -137,6 +119,6 @@ void WTrackProperty::contextMenuEvent(QContextMenuEvent* event) {
void WTrackProperty::ensureTrackMenuIsCreated() {
if (m_pTrackMenu.get() == nullptr) {
m_pTrackMenu = make_parented<WTrackMenu>(
this, m_pConfig, m_pLibrary, kTrackMenuFeatures);
this, m_pConfig, m_pLibrary, WTrackMenu::kDeckTrackMenuFeatures);
}
}
17 changes: 1 addition & 16 deletions src/widget/wtrackwidgetgroup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,6 @@ namespace {

constexpr int kDefaultTrackColorAlpha = 255;

constexpr WTrackMenu::Features kTrackMenuFeatures =
WTrackMenu::Feature::SearchRelated |
WTrackMenu::Feature::Playlist |
WTrackMenu::Feature::Crate |
WTrackMenu::Feature::Metadata |
WTrackMenu::Feature::Reset |
WTrackMenu::Feature::Analyze |
WTrackMenu::Feature::BPM |
WTrackMenu::Feature::Color |
WTrackMenu::Feature::FileBrowser |
WTrackMenu::Feature::Properties |
WTrackMenu::Feature::UpdateReplayGainFromPregain |
WTrackMenu::Feature::FindOnWeb |
WTrackMenu::Feature::SelectInLibrary;

} // anonymous namespace

WTrackWidgetGroup::WTrackWidgetGroup(QWidget* pParent,
Expand Down Expand Up @@ -132,6 +117,6 @@ void WTrackWidgetGroup::contextMenuEvent(QContextMenuEvent* event) {
void WTrackWidgetGroup::ensureTrackMenuIsCreated() {
if (m_pTrackMenu.get() == nullptr) {
m_pTrackMenu = make_parented<WTrackMenu>(
this, m_pConfig, m_pLibrary, kTrackMenuFeatures);
this, m_pConfig, m_pLibrary, WTrackMenu::kDeckTrackMenuFeatures);
}
}

0 comments on commit cb25968

Please sign in to comment.