Skip to content

Commit

Permalink
Rename loadPixmapFromUrl{Lazy,}
Browse files Browse the repository at this point in the history
  • Loading branch information
Mm2PL committed May 1, 2024
1 parent f511abb commit d59967c
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 11 deletions.
4 changes: 2 additions & 2 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -500,8 +500,8 @@ set(SOURCE_FILES
util/IpcQueue.hpp
util/LayoutHelper.cpp
util/LayoutHelper.hpp
util/LoadPixmapLazy.cpp
util/LoadPixmapLazy.hpp
util/LoadPixmap.cpp
util/LoadPixmap.hpp
util/RapidjsonHelpers.cpp
util/RapidjsonHelpers.hpp
util/RatelimitBucket.cpp
Expand Down
4 changes: 2 additions & 2 deletions src/controllers/moderationactions/ModerationActionModel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#include "controllers/moderationactions/ModerationAction.hpp"
#include "messages/Image.hpp"
#include "util/LoadPixmapLazy.hpp"
#include "util/LoadPixmap.hpp"
#include "util/PostToThread.hpp"
#include "util/StandardItemHelper.hpp"

Expand Down Expand Up @@ -34,7 +34,7 @@ void ModerationActionModel::getRowFromItem(const ModerationAction &item,
setFilePathItem(row[Column::Icon], item.iconPath());
if (!item.iconPath().isEmpty())
{
loadPixmapFromUrlLazy(
loadPixmapFromUrl(
(*item.getImage())->url(), [row](const QPixmap &pixmap) {
postToThread([row, pixmap]() {
row[Column::Icon]->setData(pixmap, Qt::DecorationRole);
Expand Down
4 changes: 2 additions & 2 deletions src/providers/twitch/TwitchBadges.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#include "messages/Image.hpp"
#include "providers/twitch/api/Helix.hpp"
#include "util/DisplayBadge.hpp"
#include "util/LoadPixmapLazy.hpp"
#include "util/LoadPixmap.hpp"

#include <QBuffer>
#include <QFile>
Expand Down Expand Up @@ -244,7 +244,7 @@ void TwitchBadges::loadEmoteImage(const QString &name, ImagePtr image,
BadgeIconCallback &&callback)
{
auto url = image->url().string;
loadPixmapFromUrlLazy({url}, [this, name, callback, url](auto pixmap) {
loadPixmapFromUrl({url}, [this, name, callback, url](auto pixmap) {
auto icon = std::make_shared<QIcon>(pixmap);

{
Expand Down
3 changes: 1 addition & 2 deletions src/util/LoadPixmapLazy.cpp → src/util/LoadPixmap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@

namespace chatterino {

void loadPixmapFromUrlLazy(const Url &url,
std::function<void(QPixmap)> &&callback)
void loadPixmapFromUrl(const Url &url, std::function<void(QPixmap)> &&callback)
{
NetworkRequest(url.string)
.concurrent()
Expand Down
3 changes: 1 addition & 2 deletions src/util/LoadPixmapLazy.hpp → src/util/LoadPixmap.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,5 @@ namespace chatterino {
/**
* Loads an image from url into a QPixmap. Allows for file:// protocol links. Uses cacheing.
*/
void loadPixmapFromUrlLazy(const Url &url,
std::function<void(QPixmap)> &&callback);
void loadPixmapFromUrl(const Url &url, std::function<void(QPixmap)> &&callback);
} // namespace chatterino
2 changes: 1 addition & 1 deletion src/widgets/settingspages/ModerationPage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ ModerationPage::ModerationPage()
}
else
{
loadPixmapFromUrlLazy(
loadPixmapFromUrl(
{fileUrl.toString()},
[clicked, view](const QPixmap &pixmap) {
view->getModel()->setData(clicked, pixmap,
Expand Down

0 comments on commit d59967c

Please sign in to comment.