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 31, 2024
1 parent 3d06cf2 commit 868a67e
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 10 deletions.
1 change: 0 additions & 1 deletion src/analyzer/constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ namespace mixxx {
// fixed number of channels like the engine does, usually 2 = stereo.
constexpr audio::ChannelCount kAnalysisChannels = mixxx::kEngineChannelOutputCount;
constexpr audio::ChannelCount kAnalysisMaxChannels = mixxx::kMaxEngineChannelInputCount;
constexpr int kMaxSupportedStems = 4;
constexpr SINT kAnalysisFramesPerChunk = 4096;
constexpr SINT kAnalysisSamplesPerChunk =
kAnalysisFramesPerChunk * kAnalysisMaxChannels;
Expand Down
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
2 changes: 1 addition & 1 deletion src/waveform/renderers/allshader/waveformrendererstem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ void WaveformRendererStem::paintGL() {
if (layerIdx) {
max *= m_pStemMute[stemIdx]->toBool() ||
(selectedStem &&
selectedStem != stemIdx + 1)
selectedStem != static_cast<uint>(stemIdx) + 1)
? 0.f
: static_cast<float>(m_pStemGain[stemIdx]->get());
}
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 868a67e

Please sign in to comment.