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

Refactored PR: Theming of disabled knobs #5549

Merged

Conversation

thmueller64
Copy link
Contributor

This PR partly addresses #4749 and introduces the possibility to theme disabled knobs. I refactored my old draft PR #5481, based on suggestions by @Veratil, using a similar approach as #5253.

@LmmsBot
Copy link

LmmsBot commented Jun 29, 2020

🤖 Hey, I'm @LmmsBot from github.com/lmms/bot and I made downloads for this pull request, click me to make them magically appear! 🎩

Linux

Windows

macOS

🤖
{"platform_name_to_artifacts": {"Linux": [{"artifact": {"title": {"title": "(AppImage)", "platform_name": "Linux"}, "link": {"link": "https://8470-15778896-gh.circle-artifacts.com/0/lmms-1.2.2.698-linux-x86_64.AppImage"}}, "build_link": "https://circleci.com/gh/LMMS/lmms/8470?utm_campaign=vcs-integration-link&utm_medium=referral&utm_source=github-build-link"}], "Windows": [{"artifact": {"title": {"title": "32-bit", "platform_name": "Windows"}, "link": {"link": "https://8469-15778896-gh.circle-artifacts.com/0/lmms-1.2.2.698-mingw-win32.exe"}}, "build_link": "https://circleci.com/gh/LMMS/lmms/8469?utm_campaign=vcs-integration-link&utm_medium=referral&utm_source=github-build-link"}, {"artifact": {"title": {"title": "64-bit", "platform_name": "Windows"}, "link": {"link": "https://8468-15778896-gh.circle-artifacts.com/0/lmms-1.2.2.698-mingw-win64.exe"}}, "build_link": "https://circleci.com/gh/LMMS/lmms/8468?utm_campaign=vcs-integration-link&utm_medium=referral&utm_source=github-build-link"}, {"artifact": {"title": {"title": "32-bit", "platform_name": "Windows"}, "link": {"link": "https://ci.appveyor.com/api/buildjobs/jo82pryiq89cwpw7/artifacts/build/lmms-1.2.2-msvc2017-win32.exe"}}, "build_link": "https://ci.appveyor.com/project/Lukas-W/lmms/builds/34847156"}, {"artifact": {"title": {"title": "64-bit", "platform_name": "Windows"}, "link": {"link": "https://ci.appveyor.com/api/buildjobs/8o7tnmjpx2yaii69/artifacts/build/lmms-1.2.2-msvc2017-win64.exe"}}, "build_link": "https://ci.appveyor.com/project/Lukas-W/lmms/builds/34847156"}], "macOS": [{"artifact": {"title": {"title": "", "platform_name": "macOS"}, "link": {"link": "https://8466-15778896-gh.circle-artifacts.com/0/lmms-1.2.2.698-mac10.13.dmg"}}, "build_link": "https://circleci.com/gh/LMMS/lmms/8466?utm_campaign=vcs-integration-link&utm_medium=referral&utm_source=github-build-link"}]}, "commit_sha": "ba39988d3a7d424fb414c3dd4d672f4444a786dc"}

Comment on lines +66 to +69
Q_PROPERTY(QColor lineActiveColor MEMBER m_lineActiveColor)
Q_PROPERTY(QColor lineInactiveColor MEMBER m_lineInactiveColor)
Q_PROPERTY(QColor arcActiveColor MEMBER m_arcActiveColor)
Q_PROPERTY(QColor arcInactiveColor MEMBER m_arcInactiveColor)
Copy link
Contributor

Choose a reason for hiding this comment

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

One thing that might be cool to do and allow even cooler themes is to allow gradients instead of single colors. Changing these to QBrush would allow you to define gradients or colors.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks @Veratil for the suggestion. I replaced QColor by QBrush, below is an example. You get the idea from the picture, but a QLinearGradient does not result in the intended behavior here, see e.g. the red color at low volumes (I think this is due to the gradient being applied independent of the length of the active line). Furthermore, you can observe that m_lineColor is used both for the "middle line" and the active part of the "arc line".
Maybe we could address this feature separately?

qbrush_knob

Copy link
Contributor

Choose a reason for hiding this comment

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

You wouldn't use a linear gradient in that instance, you'd use a conical gradient in the CSS. Example from Qt documentation:

/* conical gradient from white to green */
QTextEdit {
    background: qconicalgradient(cx:0.5, cy:0.5, angle:30,
                stop:0 white, stop:1 #00FF00)
}

At the same time though, if you wanted single color you can define the brush to be the normal rgba(...).

include/Knob.h Outdated Show resolved Hide resolved
@PhysSong
Copy link
Member

Can we merge this once the open discussions are resolved?

Co-authored-by: Hyunjin Song <tteu.ingog@gmail.com>
@zonkmachine
Copy link
Member

I think this works really well now.

@Veratil
Copy link
Contributor

Veratil commented Aug 16, 2020

@thmueller64 Does this need an update the classic theme as well?

Other than my suggestion for using QBrush instead of QColor, LGTM. 👍

@zonkmachine
Copy link
Member

classictheme

This is what the classic theme looks like right now. Just black lines, could be improved.

@thmueller64
Copy link
Contributor Author

@thmueller64 Does this need an update the classic theme as well?

Other than my suggestion for using QBrush instead of QColor, LGTM. +1

I updated the classic theme. Thanks again for the suggestion. I've looked into the conical gradient, but didn't find a straightforward way to replace QColor this way. For example, the middle line is drawn in the same color as the active part of the arc, so I would possibly have to introduce a separate color for it. I suggest to address this in another PR.

src/gui/widgets/Knob.cpp Outdated Show resolved Hide resolved
src/gui/widgets/Knob.cpp Outdated Show resolved Hide resolved
include/Knob.h Outdated Show resolved Hide resolved
@@ -169,7 +178,7 @@ private slots:

QString m_label;

QPixmap * m_knobPixmap;
std::unique_ptr<QPixmap> m_knobPixmap;
Copy link
Member

Choose a reason for hiding this comment

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

It might be a good idea to explicitly #include <QPixmap> - it's currently available via <QWidget>, but if this is changed to use a forward declaration, the unique_ptr here will fail to compile since QPixmap's destructor won't be declared.

src/gui/widgets/Knob.cpp Outdated Show resolved Hide resolved
src/gui/widgets/Knob.cpp Outdated Show resolved Hide resolved
src/gui/widgets/Knob.cpp Outdated Show resolved Hide resolved
Copy link
Member

@DomClark DomClark left a comment

Choose a reason for hiding this comment

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

LGTM

@zonkmachine
Copy link
Member

@thmueller64 Looks good! Ready to merge?

@zonkmachine
Copy link
Member

This PR partly addresses #4749

It looks like this fixes #4749 completely. What's left to do?

I think this should be merged.

@zonkmachine zonkmachine merged commit 2d51eae into LMMS:master Oct 30, 2020
IanCaio pushed a commit to IanCaio/lmms that referenced this pull request Mar 28, 2021
Co-authored-by: Hyunjin Song <tteu.ingog@gmail.com>
Co-authored-by: Dominic Clark <mrdomclark@gmail.com>
sdasda7777 pushed a commit to sdasda7777/lmms that referenced this pull request Jun 28, 2022
Co-authored-by: Hyunjin Song <tteu.ingog@gmail.com>
Co-authored-by: Dominic Clark <mrdomclark@gmail.com>
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.

6 participants