summaryrefslogtreecommitdiffstats
path: root/logic/resources/IconResourceHandler.h
blob: 6f933ad4b0baecc683910d95bac1a836f47388e1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#pragma once

#include <memory>

#include "ResourceHandler.h"

class IconResourceHandler : public ResourceHandler
{
public:
	explicit IconResourceHandler(const QString &key);

	/// Sets the current theme and notifies all IconResourceHandlers of the change
	static void setTheme(const QString &theme);

private:
	// we need to keep track of all IconResourceHandlers so that we can update them if the theme changes
	void init(std::shared_ptr<ResourceHandler> &ptr) override;
	static QList<std::weak_ptr<IconResourceHandler>> m_iconHandlers;

	QString m_key;
	static QString m_theme;

	// the workhorse, returns QVariantMap (filename => size) for m_key/m_theme
	QVariant get() const;
};