Skip to content

Commit

Permalink
Add UI changes
Browse files Browse the repository at this point in the history
  • Loading branch information
acolombier committed Jul 30, 2024
1 parent 3d06cf2 commit 2fc47ba
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 8 deletions.
15 changes: 8 additions & 7 deletions src/skin/legacy/legacyskinparser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@
#include "widget/wstarrating.h"
#include "widget/wstatuslight.h"
#ifdef __STEM__
#include "engine/engine.h"
#include "widget/wstemcontrol.h"
#endif
#include "widget/wtime.h"
Expand All @@ -90,12 +91,6 @@

using mixxx::skin::SkinManifest;

#ifdef __STEM__
namespace {
constexpr int kMaxSupportedStems = 4;
} // anonymous namespace
#endif

/// This QSet allows to make use of the implicit sharing
/// of QString instead of every widget keeping its own copy.
QSet<QString> LegacySkinParser::s_sharedGroupStrings;
Expand Down Expand Up @@ -1039,7 +1034,7 @@ QWidget* LegacySkinParser::parseVisual(const QDomElement& node) {
setupConnections(child, viewer->stemControlWidget());
QDomElement stem = child.firstChildElement("Stem");
DEBUG_ASSERT(group.endsWith("]"));
for (int stemIdx = 1; stemIdx <= kMaxSupportedStems; stemIdx++) {
for (int stemIdx = 1; stemIdx <= mixxx::kMaxSupportedStems; stemIdx++) {
m_pContext->setVariable("StemGroup",
QStringLiteral("%1Stem%2]")
.arg(group.left(group.size() - 1),
Expand Down Expand Up @@ -1068,6 +1063,12 @@ QWidget* LegacySkinParser::parseVisual(const QDomElement& node) {
&BaseTrackPlayer::loadingTrack,
viewer,
&WWaveformViewer::slotLoadingTrack);
#ifdef __STEM__
QObject::connect(pPlayer,
&BaseTrackPlayer::selectedStem,
viewer,
&WWaveformViewer::slotSelectStem);
#endif

QObject::connect(pPlayer,
&BaseTrackPlayer::trackUnloaded,
Expand Down
4 changes: 4 additions & 0 deletions src/widget/wstemcontrol.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,10 @@ void WStemControlBox::setDisplayed(bool displayed) {
emit displayedChanged(m_displayed);
}

void WStemControlBox::slotSelectStem(uint stemIdx) {
m_selectedStem = stemIdx;
}

void WStemControlBox::slotTrackLoaded(TrackPointer track) {
m_hasStem = false;
if (!track) {
Expand Down
4 changes: 3 additions & 1 deletion src/widget/wstemcontrol.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class WStemControlBox : public WWidgetGroup {

void addControl(QWidget* control);
bool shouldShow() const {
return m_hasStem && m_displayed;
return m_hasStem && m_displayed && m_selectedStem == mixxx::kNoStemSelectedIdx;
}

bool isDisplayed() const {
Expand All @@ -34,6 +34,7 @@ class WStemControlBox : public WWidgetGroup {
void setDisplayed(bool displayed);
public slots:
void slotTrackLoaded(TrackPointer track);
void slotSelectStem(uint stemIdx);

signals:
void displayedChanged(bool);
Expand All @@ -42,6 +43,7 @@ class WStemControlBox : public WWidgetGroup {
std::vector<std::unique_ptr<WStemControl>> m_stemControl;
QString m_group;
bool m_hasStem;
uint m_selectedStem;
bool m_displayed;
};

Expand Down

0 comments on commit 2fc47ba

Please sign in to comment.