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

Add custom image functionality for inline mod buttons. #5369

Merged
merged 42 commits into from
May 11, 2024

Conversation

Mm2PL
Copy link
Collaborator

@Mm2PL Mm2PL commented Apr 28, 2024

This also cleans up ModerationAction code

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

clang-tidy made some suggestions

@Mm2PL Mm2PL requested a review from pajlada April 28, 2024 23:34
Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

clang-tidy made some suggestions

src/util/LoadPixmapLazy.cpp Outdated Show resolved Hide resolved
src/util/LoadPixmapLazy.cpp Outdated Show resolved Hide resolved
src/util/LoadPixmapLazy.cpp Outdated Show resolved Hide resolved
src/util/LoadPixmapLazy.cpp Outdated Show resolved Hide resolved
src/util/LoadPixmapLazy.hpp Outdated Show resolved Hide resolved
src/util/LoadPixmapLazy.hpp Outdated Show resolved Hide resolved
Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

clang-tidy made some suggestions

src/util/LoadPixmapLazy.cpp Outdated Show resolved Hide resolved
Copy link
Contributor

@Nerixyz Nerixyz left a comment

Choose a reason for hiding this comment

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

I can't comment there, but there's no title for the custom image:

CHANGELOG.md Show resolved Hide resolved
Comment on lines 36 to 39
loadPixmapFromUrlLazy(
(*item.getImage())->url(), [row](const QPixmap &pixmap) {
row[Column::Icon]->setData(pixmap, Qt::DecorationRole);
});
Copy link
Contributor

Choose a reason for hiding this comment

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

This should ensure the reference to row remains valid. Furthermore, setData should be called on the GUI thread.

if iconPath is present, getImage will always be valid.

This should be noted in a comment.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I don't think we can even check if row is valid. I can't make it a smart pointer without a large refactor. I could look up the row by some kind of unique temporary ID, but it seems like a hack.

src/controllers/moderationactions/ModerationAction.cpp Outdated Show resolved Hide resolved
if (!reader.canRead() || reader.size().isEmpty())
{
qCWarning(chatterinoSettings)
<< "Can't read mod action image at" << url.string << ":"
Copy link
Contributor

Choose a reason for hiding this comment

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

  • This mentions a mod action image, but the function is more general (it can read any image).
  • This will add a space between the URL and the colon (same as below).

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It does add a space, to be honest I don't care that much about that space.

src/util/LoadPixmapLazy.hpp Outdated Show resolved Hide resolved
src/util/LoadPixmapLazy.cpp Outdated Show resolved Hide resolved
src/util/LoadPixmapLazy.cpp Outdated Show resolved Hide resolved
src/widgets/settingspages/ModerationPage.cpp Outdated Show resolved Hide resolved
src/widgets/settingspages/ModerationPage.cpp Outdated Show resolved Hide resolved
@Mm2PL Mm2PL force-pushed the feature/inline-mod-button-custom-images branch from d59967c to d9ff6ca Compare May 1, 2024 18:32
Mm2PL added 2 commits May 1, 2024 21:11
 - now uses QPointer to ensure the view is valid
 - now calls the code on the main thread to never hit an assertion
Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

clang-tidy made some suggestions

src/util/LoadPixmap.cpp Outdated Show resolved Hide resolved
@pajlada pajlada linked an issue May 5, 2024 that may be closed by this pull request
@pajlada pajlada enabled auto-merge (squash) May 11, 2024 10:27
@pajlada pajlada merged commit c3b84cb into master May 11, 2024
17 checks passed
@pajlada pajlada deleted the feature/inline-mod-button-custom-images branch May 11, 2024 10:54
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.

Customize mod icons
3 participants