-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Customizable ColorPicker #2202
Customizable ColorPicker #2202
Conversation
Thanks, this looks really good for a first pass. Since it touches so many place in the code and we are very close to the version 11 release I will wait to merge this until after the release. Some comments based on testing (haven't done code review yet).
|
Thanks @borgmanJeremy! Third one would be a really nice addition. |
@borgmanJeremy it sounds great, thx. |
Okay the version 11 issues are slowing down so I am ready to look at this / merge. Can you remind me where it left off? We just need to do a code review and some testing? |
@borgmanJeremy Yep, testing and code review are left. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you this is a great feature!
I had some very minor comments. I had to fix some merge conflicts to do my testing but it was pretty easy.
I'll get this merged quickly once the comments are addressed.
src/widgets/colorpickerwidget.cpp
Outdated
@@ -0,0 +1,139 @@ | |||
// SPDX-License-Identifier: GPL-3.0-or-later | |||
// SPDX-FileCopyrightText: 2017-2019 Alejandro Sirgo Rica & Contributors |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI for any new files that you create, you can list your self as the copyright owner since you authored it.
src/widgets/colorpickerwidget.cpp
Outdated
c.setAlpha(100); | ||
painter.setPen(c); | ||
QRect highlight = m_colorAreaList.at(i); | ||
highlight.moveTo(highlight.x() - 3, highlight.y() - 3); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this "-3"? Maybe 3 as a const variable with a descriptive name so its easier to read in the future?
src/widgets/colorpickerwidget.cpp
Outdated
QRect highlight = m_colorAreaList.at(i); | ||
highlight.moveTo(highlight.x() - 3, highlight.y() - 3); | ||
highlight.setHeight(highlight.height() + 6); | ||
highlight.setWidth(highlight.width() + 6); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same question on 6
src/widgets/spinbox.cpp
Outdated
#include "src/widgets/spinbox.h" | ||
#include "src/utils/confighandler.h" | ||
|
||
SpinBox::SpinBox(QWidget* parent) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Im not sure SpinBox is the best name for this. Maybe put something in the name about what makes it different from a normal spin box? Like ColorSpinBox or something
src/config/colorpickereditor.cpp
Outdated
|
||
colors << m_color; | ||
|
||
const int maxPresetsAllowed = 10; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make this maximum match #2171 so we can remove this compile time option.
src/config/colorpickereditor.cpp
Outdated
const int maxPresetsAllowed = 10; | ||
|
||
if (colors.size() > maxPresetsAllowed) { | ||
QMessageBox::critical(this, tr("Error"), tr("Unable to add preset.")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adjust this error to state why the preset cannot be added "IE exceeded maximum" or something.
src/config/colorpickereditor.cpp
Outdated
|
||
if (colors.size() < minPresetsAllowed) { | ||
QMessageBox::critical( | ||
this, tr("Error"), tr("Unable to remove preset.")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adjust this to say why it cannot be removed.
Thanks for feedback! I have pushed a fix addressing all the requested changes. @borgmanJeremy |
Thanks! |
* Added spinbox, refactored colorpicker * Added add preset functionality * Added delete preset * Refactored code * Fix (cherry picked from commit 259e438)
Closes #1942
Functionality added: