File indexing completed on 2024-05-12 13:09:20

0001 /*  This file is part of the Calligra project, made within the KDE community.
0002 
0003     SPDX-FileCopyrightText: 2012 Friedrich W. H. Kossebau <kossebau@kde.org>
0004 
0005     SPDX-License-Identifier: LGPL-2.0-or-later
0006 */
0007 
0008 #ifndef KOICON_H
0009 #define KOICON_H
0010 
0011 // Qt
0012 #include <QIcon>
0013 
0014 /**
0015  * Macros to support collecting the icons in use.
0016  *
0017  * After any change to this list of macros the file /CheckIcons.sh needs to be
0018  * updated accordingly, to ensure that the icon names of the affected macros are
0019  * still considered in the extraction.
0020  *
0021  * The naming pattern of the macros is like this:
0022  * * koIcon* returns a QIcon object
0023  * * koIconName* returns a QLatin1String (aligned with usual API where "iconName" property is of type QString)
0024  * * koIconNameCStr* returns a const char*
0025  */
0026 
0027 /// Use these macros for icons without any issues
0028 #define koIcon(name) (QIcon::fromTheme(QStringLiteral(name)))
0029 #define koIconName(name) (QStringLiteral(name))
0030 #define koIconNameCStr(name) (name)
0031 /// Use these definitions in files where needed:
0032 // #define koSmallIcon(name) (SmallIcon(QStringLiteral(name)))
0033 // #define koDesktopIcon(name) (DesktopIcon(QStringLiteral(name)))
0034 // Also #include <KIconLoader>
0035 
0036 /// Use these macros if there is a proper icon missing
0037 #define koIconNeeded(comment, neededName) (QIcon::fromTheme(QStringLiteral(neededName)))
0038 #define koIconNeededWithSubs(comment, neededName, substituteName) (QIcon::fromTheme(QStringLiteral(substituteName)))
0039 #define koIconNameNeeded(comment, neededName) (QStringLiteral(neededName))
0040 #define koIconNameNeededWithSubs(comment, neededName, substituteName) (QStringLiteral(substituteName))
0041 #define koIconNameCStrNeeded(comment, neededName) (neededName)
0042 #define koIconNameCStrNeededWithSubs(comment, neededName, substituteName) (substituteName)
0043 
0044 /// Use these macros if the UI is okay without any icon, but would be better with one.
0045 #define koIconWanted(comment, wantedName) (QIcon())
0046 #define koIconNameWanted(comment, wantedName) (QString())
0047 
0048 #endif