Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
stenzek
GitHub Repository: stenzek/duckstation
Path: blob/master/src/duckstation-qt/asyncpixmaploader.h
14138 views
1
// SPDX-FileCopyrightText: 2019-2026 Connor McLaughlin <[email protected]>
2
// SPDX-License-Identifier: CC-BY-NC-ND-4.0
3
4
#pragma once
5
6
#include "common/heap_array.h"
7
8
#include <string>
9
#include <string_view>
10
11
#include <QtCore/QObject>
12
13
class QPixmap;
14
15
class AsyncPixmapLoader final : public QObject
16
{
17
Q_OBJECT
18
19
public:
20
explicit AsyncPixmapLoader(QObject* parent = nullptr);
21
~AsyncPixmapLoader() override;
22
23
static bool isQueueNeeded(std::string_view url_or_path);
24
25
static QPixmap load(std::string_view url_or_path);
26
27
void enqueue(std::string_view url_or_path);
28
29
Q_SIGNALS:
30
void pixmapLoaded(QPixmap& pixmap);
31
32
private:
33
void finishLoad();
34
35
std::string m_extension;
36
DynamicHeapArray<u8> m_data;
37
};
38
39