#include "tycho.h" QIcon getIcon(QString const &name) { constexpr auto sizes = std::array{std::make_pair(16, "_16.svgz"), std::make_pair(24, "_24.svgz"), std::make_pair(32, "_32.svgz"), std::make_pair(64, "_64.svgz"), std::make_pair(128, "_128.svgz"), std::make_pair(256, "_256.svgz"), std::make_pair(512, "_512.svgz"), std::make_pair(1024, "_1024.svgz")}; QIcon icon; for(auto const &sz : sizes) { auto res = ":/tycho/icons/" + name + sz.second; if(QFile(res).exists()) { icon.addFile(res, QSize(sz.first, sz.first)); } } if(icon.isNull()) { return QIcon::fromTheme(name); } else { return icon; } } extern "C" { void critical_msg(char const *title, char const *msg) { QMessageBox::critical(nullptr, QObject::tr(title), QObject::tr(msg)); } } // EOF