Skip to content
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

WTrackMenu: provide the same features in all deck track widgets #12214

Merged
merged 1 commit into from
Feb 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/widget/wtrackmenu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@
#include "widget/wsearchrelatedtracksmenu.h"
#include "widget/wstarrating.h"

constexpr WTrackMenu::Features WTrackMenu::kDeckTrackMenuFeatures;

namespace {
const QString kAppGroup = QStringLiteral("[App]");
} // namespace
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);
}
}
Loading