SILICON
Loading...
Searching...
No Matches
icons.hpp
Go to the documentation of this file.
1/*
2 Copyright (c) 2025. Giulio Cocconi
3
4 This program is free software: you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation, either version 3 of the License, or
7 (at your option) any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18#pragma once
19
20#include <memory>
21
22#include <QByteArray>
23#include <QColor>
24#include <QIcon>
25
26class QSvgRenderer;
27
28namespace SILICON::ui {
29
30namespace svg {
31 // GUI thread only. Shared ownership keeps renderers alive across cache eviction.
32 // Resolve data-silicon-fill/stroke annotations; invalid XML/tokens return empty.
33 QByteArray preprocess(const QByteArray& source);
34 std::shared_ptr<QSvgRenderer> renderer(const QString& path);
35} // namespace svg
36
37// Rasterize lazily for the current theme and device scale. The application logo
38// retains its source colors; other icons default to Ink unless explicitly colored.
39class Icon : public QIcon {
40public:
41 explicit Icon(const QString& commonName);
42 explicit Icon(const QString& commonName, const QColor& color);
43};
44
45} // namespace SILICON::ui
Icon(const QString &commonName)
Definition icons.cpp:289
std::shared_ptr< QSvgRenderer > renderer(const QString &path)
Definition icons.cpp:261
QByteArray preprocess(const QByteArray &source)
Definition icons.cpp:230