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

[WIP] Enable Setting hotcue color via controlobject #1830

Closed
wants to merge 28 commits into from
Closed
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
93c0451
added color column to properties dlg but UI and DB dont update
Oct 2, 2018
e0d73a0
fixed functionality broken by previous commit.
Oct 4, 2018
29df355
woverview waveformsmarks will now reflect their hotcue color
Oct 6, 2018
68efc42
markproperties.m_textColor is now the same color as the mark itself; …
Oct 6, 2018
92d381d
followed daschauers request to VERIFY_OR_DEBUG_ASSERT in a case
Oct 13, 2018
d8057bd
followed uklotzde change requests in widget/woverview
Oct 13, 2018
d4e0735
fixed redundant blank line (codefactor complained)
Oct 14, 2018
2c253ff
fixed inverted VERIFY_OR_DEBUG Statement
Oct 14, 2018
f57e682
Added R/W ControlObject for the HotcueColor
Oct 14, 2018
b0270ba
contrastLineColor of Markers now adapt to MarkerColor Brightness
Oct 18, 2018
9833f67
Removed Comment in cuecontrol.cpp
Oct 19, 2018
d52f107
the marker number color is now set by the skin again, not the m_color
Oct 19, 2018
c8c4150
moved brightness function to color.h; rendermark textColor adapts now
Oct 19, 2018
e58b361
Color is now settable via ComboBox in trackpropertie cuepoints table.
Oct 20, 2018
2372bdf
added more utility functions to util/color.h
Oct 20, 2018
3088c1e
minor changes for performance and codefactor
Oct 21, 2018
20ff8dc
Let skins override cue colors
ferranpujolcamins Dec 2, 2018
1b460cf
Add example, revert before merge.
ferranpujolcamins Dec 3, 2018
ca30b3b
Improve color methods efficiency
ferranpujolcamins Dec 28, 2018
b194d21
Rename Color::defaultRepresentation() to makeDefaultRepresentation()
ferranpujolcamins Dec 28, 2018
54798f3
Let skins override cue colors on overview
ferranpujolcamins Dec 28, 2018
3b324f8
Append "Cue" to the skin node name for waveform cue color overrides
ferranpujolcamins Dec 28, 2018
b6a7dd2
Revert "Add example, revert before merge."
ferranpujolcamins Dec 28, 2018
9afc8d4
Fix WOverview cue colors not being mapped after skin reload
ferranpujolcamins Dec 29, 2018
19480bd
Convert color lists to static const vars
ferranpujolcamins Dec 30, 2018
f950c25
Reduce the number of runtime copies of ColorsRepresentation
ferranpujolcamins Dec 30, 2018
f951a94
Move setupCueColorsRepresentation() to SkinContext
ferranpujolcamins Dec 30, 2018
c49961f
Added JS utility object for dealing with hotcue colors from MixxxControl
Jan 1, 2019
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
20 changes: 17 additions & 3 deletions src/library/dlgtrackinfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -332,12 +332,15 @@ void DlgTrackInfo::populateCues(TrackPointer pTrack) {
// Make the duration read only
durationItem->setFlags(Qt::NoItemFlags);

QColor cueColor = pCue->getColor();

m_cueMap[row] = pCue;
cueTable->insertRow(row);
cueTable->setItem(row, 0, new QTableWidgetItem(rowStr));
cueTable->setItem(row, 1, durationItem);
cueTable->setItem(row, 2, new QTableWidgetItem(hotcue));
cueTable->setItem(row, 3, new QTableWidgetItem(pCue->getLabel()));
cueTable->setItem(row, 3, new QTableWidgetItem(cueColor.name().toUpper()));
cueTable->setItem(row, 4, new QTableWidgetItem(pCue->getLabel()));
row += 1;
}
cueTable->setSortingEnabled(true);
Expand Down Expand Up @@ -381,9 +384,10 @@ void DlgTrackInfo::saveTrack() {
for (int row = 0; row < cueTable->rowCount(); ++row) {
QTableWidgetItem* rowItem = cueTable->item(row, 0);
QTableWidgetItem* hotcueItem = cueTable->item(row, 2);
QTableWidgetItem* labelItem = cueTable->item(row, 3);
QTableWidgetItem* colorItem = cueTable->item(row, 3);
QTableWidgetItem* labelItem = cueTable->item(row, 4);

if (!rowItem || !hotcueItem || !labelItem)
if (!rowItem || !hotcueItem || !colorItem|| !labelItem)
Swiftb0y marked this conversation as resolved.
Show resolved Hide resolved
continue;

int oldRow = rowItem->data(Qt::DisplayRole).toInt();
Expand All @@ -404,6 +408,16 @@ void DlgTrackInfo::saveTrack() {
pCue->setHotCue(-1);
}

QVariant vHotCueColor = colorItem->data(Qt::DisplayRole);
if (vHotcue.canConvert<QString>()) {
QString colorString = vHotCueColor.toString();
auto color = QColor(colorString);
if (color.isValid()) {
pCue->setColor(color);
}
// do nothing for now.
}

QString label = labelItem->data(Qt::DisplayRole).toString();
pCue->setLabel(label);
}
Expand Down
5 changes: 5 additions & 0 deletions src/library/dlgtrackinfo.ui
Original file line number Diff line number Diff line change
Expand Up @@ -820,6 +820,11 @@ Often results in higher quality beatgrids, but will not do well on tracks that h
<string>Hotcue</string>
</property>
</column>
<column>
<property name="text">
<string>Color</string>
</property>
</column>
<column>
<property name="text">
<string>Label</string>
Expand Down
1 change: 1 addition & 0 deletions src/waveform/renderers/waveformmarkproperties.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ WaveformMarkProperties::WaveformMarkProperties(const QDomNode& node,
const WaveformSignalColors& signalColors,
int hotCue) {
m_color = context.selectString(node, "Color");
// TODO (Swiftb0y): get CuePointer and color for m_color instead of skin color.
if (!m_color.isValid()) {
// As a fallback, grab the color from the parent's AxesColor
m_color = signalColors.getAxesColor();
Expand Down
26 changes: 25 additions & 1 deletion src/widget/woverview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,8 @@ void WOverview::slotLoadingTrack(TrackPointer pNewTrack, TrackPointer pOldTrack)
this, SLOT(slotWaveformSummaryUpdated()));
connect(pNewTrack.get(), SIGNAL(analyzerProgress(int)),
this, SLOT(slotAnalyzerProgress(int)));
connect(pNewTrack.get(), SIGNAL(cuesUpdated(void)),
this, SLOT(onTrackCueChange(void)));

slotAnalyzerProgress(pNewTrack->getAnalyzerProgress());
} else {
Expand All @@ -247,14 +249,36 @@ void WOverview::onEndOfTrackChange(double v) {

void WOverview::onMarkChanged(double /*v*/) {
//qDebug() << "WOverview::onMarkChanged()" << v;
update();
onTrackCueChange();
Swiftb0y marked this conversation as resolved.
Show resolved Hide resolved
//update();
}

void WOverview::onMarkRangeChange(double /*v*/) {
//qDebug() << "WOverview::onMarkRangeChange()" << v;
update();
}

// currently only updates the mark color but it could be easily extended.
void WOverview::onTrackCueChange(void) {
Swiftb0y marked this conversation as resolved.
Show resolved Hide resolved
const QList<CuePointer> loadedCues = m_pCurrentTrack->getCuePoints();

for (CuePointer currentCue: loadedCues) {
const WaveformMarkPointer currentMark = m_marks.getHotCueMark(currentCue->getHotCue());

if (currentMark && currentMark->isValid()) {
WaveformMarkProperties markProperties = currentMark->getProperties();
const QColor newColor = currentCue->getColor();

if (newColor != markProperties.m_color || newColor != markProperties.m_textColor) {
markProperties.m_color = newColor;
markProperties.m_textColor = newColor;
currentMark->setProperties(markProperties);
}
}
}
update();
}

void WOverview::mouseMoveEvent(QMouseEvent* e) {
if (m_orientation == Qt::Horizontal) {
m_iPos = math_clamp(e->x(), 0, width() - 1);
Expand Down
1 change: 1 addition & 0 deletions src/widget/woverview.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ class WOverview : public WWidget {

void onMarkChanged(double v);
void onMarkRangeChange(double v);
void onTrackCueChange(void);

void slotWaveformSummaryUpdated();
void slotAnalyzerProgress(int progress);
Expand Down