/***************************************************************************
- * Copyright (C) 2005-08 by the Quassel IRC Team *
+ * Copyright (C) 2005-2020 by the Quassel Project *
* devel@quassel-irc.org *
* *
* This program is free software; you can redistribute it and/or modify *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
- * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
***************************************************************************/
-#ifndef ICON_H_
-#define ICON_H_
+#pragma once
+
+#include "uisupport-export.h"
+
+#include <vector>
#include <QIcon>
+#include <QString>
-/// A very thin wrapper around QIcon
-/** This wrapper class allows us to load an icon by its theme name rather than its full file name.
- * The overloaded ctor uses IconLoader to locate an icon with this basename in the current theme
- * or in Qt Resources.
- */
-class Icon : public QIcon {
+namespace icon {
- public:
- Icon();
- explicit Icon(const QString &iconName);
- explicit Icon(const QIcon& copy);
+/**
+ * Gets an icon from the current icon theme.
+ *
+ * If the theme does not provide the icon, tries to load the icon from the
+ * fallback path, if given.
+ *
+ * If no icon can be found, a warning is displayed and a null icon returned.
+ *
+ * @param iconName Icon name
+ * @param fallbackPath Full path to a fallback icon
+ * @returns The requested icon, if available
+ */
+UISUPPORT_EXPORT QIcon get(const QString& iconName, const QString& fallbackPath = {});
- Icon& operator=(const Icon &other);
-};
+/**
+ * Gets an icon from the current icon theme.
+ *
+ * If the theme does not provide any of the given icon names, tries to load the
+ * icon from the fallback path, if given.
+ *
+ * If no icon can be found, a warning is displayed and a null icon returned.
+ *
+ * @param iconNames List of icon names (first match wins)
+ * @param fallbackPath Full path to a fallback icon
+ * @returns The requested icon, if available
+ */
+UISUPPORT_EXPORT QIcon get(const std::vector<QString>& iconNames, const QString& fallbackPath = {});
-#endif
+} // namespace icon