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

Use rgb presentation for cue colors with "no color" migration #2398

Closed
wants to merge 49 commits into from

Conversation

daschuer
Copy link
Member

@daschuer daschuer commented Dec 11, 2019

This is a possible solution for #2345 without a persistent "no color" state.

Lagacy cues are stored with black color in the database, and are replaces by the selected default color on track load. By default the legacy skin default color is used in the CO interface and the skin. The default color is not stored (kept black) until the user manually decides for a different color per Hotcue or selects a default color from the palette as default. This replaces the black color entirely.

During development I have played with the different options and this turns out to be the smoothest transition from uncolored cues to colored. We get rid of the "no color" state as soon as the user decides for a default color. The user is not forced to do it immediately after upgrade, the GUI looks almost like Mixxx 2.2 until he has decided.

Instead of QColor it uses now the lightweight QRgb. The A value is omitted.

TODO:

  • Deduplicate the code

.. instead of PredefinedColorPointer.

COs and the database now hold the color hex int representation instead of a color id.
and change cue color CO name
@daschuer daschuer changed the title Use QColor for cue colors with default flag Use rgb presentation for cue colors with legacy migration Jan 5, 2020
@daschuer daschuer changed the title Use rgb presentation for cue colors with legacy migration [WIP] Use rgb presentation for cue colors with legacy migration Jan 5, 2020
@daschuer
Copy link
Member Author

daschuer commented Jan 5, 2020

Who has interests to try it out?
I really like to get a 2.3 beta released and that is on of the missing peaces.

@daschuer daschuer changed the title [WIP] Use rgb presentation for cue colors with legacy migration Use rgb presentation for cue colors with legacy migration Jan 18, 2020
@daschuer
Copy link
Member Author

OK, the TODOs are done. Has anyone interests to review?
@Be-ing?
I think we can later merge your color/palette swap solution ...

Copy link
Contributor

@uklotzde uklotzde left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the state of this PR??

res/schema.xml Outdated
</revision>
<revision version="31" min_compatible="3">
<description>
Convert the PredefinedColor id to the actual RGBA value.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RGB

res/schema.xml Outdated
</description>
<sql>
<!-- No Color becomes black 0x000000 -->
UPDATE cues SET color=0 WHERE color=0;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SQLite understands hex numbers and we should use this notation here:
https://www.sqlite.org/syntax/numeric-literal.html

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool, I was not aware of this.

@@ -388,6 +388,15 @@ QWidget* LegacySkinParser::parseSkin(const QString& skinPath, QWidget* pParent)
m_pParent = pParent;
QList<QWidget*> widgets = parseNode(skinDocument);

const QString hotcueSkinDefaultColor = m_pContext->variable("HotcueSkinDefaultColor");
if (!hotcueSkinDefaultColor.isNull()) {
QColor color;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use the named color ctor to create an immutable value:
const QColor color(hotcueSkinDefaultColor);

QRgb offPaletteDefaultColor() const;

private:
static const QString sGroup;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The static const member is only needed for the inlined function. I suggest to move it into an anonymous namespace in the .cpp file and un-inline the member function. This is a typical example of premature optimization.

@@ -28,20 +28,29 @@ Cue::Cue(TrackId trackId)
m_sampleEndPosition(Cue::kNoPosition),
m_iHotCue(-1),
m_label(kDefaultLabel),
m_color(Color::kPredefinedColorsSet.noColor) {
m_color(0),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

m_color(kDefaultDbColorValue)?

@@ -52,6 +61,8 @@ Cue::Cue(int id, TrackId trackId, Cue::Type type, double position, double length
} else {
m_sampleEndPosition = Cue::kNoPosition;
}

DEBUG_ASSERT(m_color);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DEBUG_ASSERT what?

m_bDirty = true;
m_colorIsDefault = false;
lock.unlock();
emit(updated());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please change all emit statements according to the recent clazy fixes.

#pragma once

#include <QColor>
#include "QList"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wrong #include directive. The whole class seems to be unfinished by violating many best practice rules.

@Be-ing
Copy link
Contributor

Be-ing commented Jan 20, 2020

This implements the "default color" idea but calls it a "legacy cue"? How would anyone know what a "legacy cue" is and why does this concept exist? Does anyone actually want the cue-color-per-skin option? Why was it added? Why are there options if Mixxx explicitly warns the user they are not recommended?? I don't understand this PR.

@Be-ing
Copy link
Contributor

Be-ing commented Jan 20, 2020

I think this PR creates new problems without bringing us any closer to a release. I think it would be best to close this and let @ferranpujolcamins continue from where #2399 left off.

@daschuer daschuer changed the title Use rgb presentation for cue colors with legacy migration Use rgb presentation for cue colors with "no color" migration Jan 21, 2020
@daschuer
Copy link
Member Author

This implements the "default color" idea but calls it a "legacy cue"? How would anyone know what a "legacy cue" is and why does this concept exist?

I have removed the term legacy cue because it turns out to be misleading.

We had the discussion that we want to discard the "no color" state as soon as the user has selected a palette color. But we don't want a pop up during migration from 2.2. So we need to save this state, which is done with black.

Does anyone actually want the cue-color-per-skin option? Why was it added?

I have no colors set yet for all my track cues and I will probably not make use of this feature because my cue pads have no colors as well. Original I have selected orange to indicate that the cue color is not selected. But It looks misplaced in Shade.
That's why I have implemented a selector which holds all legacy skin hotcue colors. Than I have noticed that his will be a regression compared to master where the skin cue color is selected automatically by default. And I have reintroduced that, in a hopefully better to maintain way.
I think @Swiftb0y also likes the feature if i recall that correct.

I am very confident with this, because nothing distracting will happen after migration to 2.3 if we use the old colors until the user starts to use the cue color feature.

Why are there options if Mixxx explicitly warns the user they are not recommended?? I don't understand this PR.

Because it is recommended to use a palette color default, that replaces persistently the info that the cue has no color. This will happen implicit if one does a Serato round-trip. A user might be tempted to give a default color a meaning. But it is not possible to select it in the color picker. It serves only the use case for the time the user is unsure about coloring. The user can only add the original default color to the palette. This way it is stored in the database.

This was IMHO part of our conclusion in #2345 right?

@Be-ing
Copy link
Contributor

Be-ing commented Jan 22, 2020

So we need to save this state, which is done with black.

No! There is no need to save this state, whatever you call it. This state will only exist if you invent it here. In 2.5 months no one has agreed it is a good idea to invent this state.

@Holzhaus
Copy link
Member

I think @ferranpujolcamins is working on PR #2345. I'll close this for now.

@Holzhaus Holzhaus closed this Feb 15, 2020
@daschuer
Copy link
Member Author

#2345 if far behind of this branch.
I think it is straight forward to continue here. We may just remove the undesired features or rebase them out.

@daschuer daschuer reopened this Feb 15, 2020
@Holzhaus Holzhaus mentioned this pull request Feb 26, 2020
@Holzhaus
Copy link
Member

Superseeded by #2520.

@uklotzde
Copy link
Contributor

uklotzde commented Mar 8, 2020

Can we close this obsolete PR?

@daschuer
Copy link
Member Author

daschuer commented Mar 9, 2020

Yes.

@daschuer daschuer closed this Mar 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants