1/* This file is part of the Calligra project, made within the KDE community.
2
3 Copyright 2012 Friedrich W. H. Kossebau <kossebau@kde.org>
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public
7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version.
9
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details.
14
15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to
17 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 Boston, MA 02110-1301, USA.
19*/
20
21#ifndef KOICON_H
22#define KOICON_H
23
24// KDE
25#include <kicon.h>
26#include <kiconloader.h>
27
28/**
29 * Macros to support collecting the icons in use.
30 *
31 * After any change to this list of macros the file /CheckIcons.sh needs to be
32 * updated accordingly, to ensure that the icon names of the affected macros are
33 * still considered in the extraction.
34 *
35 * The naming pattern of the macros is like this:
36 * * koIcon* returns a KIcon object
37 * * koIconName* returns a QLatin1String (aligned with usual API where "iconName" property is of type QString)
38 * * koIconNameCStr* returns a const char*
39 */
40
41/// Use these macros for icons without any issues
42#define koIcon(name) (KIcon(QLatin1String(name)))
43#define koIconName(name) (QLatin1String(name))
44#define koIconNameCStr(name) (name)
45#define koSmallIcon(name) (SmallIcon(QLatin1String(name)))
46#define koDesktopIcon(name) (DesktopIcon(QLatin1String(name)))
47
48/// Use these macros if there is a proper icon missing
49#define koIconNeeded(comment, neededName) (KIcon(QLatin1String(neededName)))
50#define koIconNeededWithSubs(comment, neededName, substituteName) (KIcon(QLatin1String(substituteName)))
51#define koIconNameNeeded(comment, neededName) (QLatin1String(neededName))
52#define koIconNameNeededWithSubs(comment, neededName, substituteName) (QLatin1String(substituteName))
53#define koIconNameCStrNeeded(comment, neededName) (neededName)
54#define koIconNameCStrNeededWithSubs(comment, neededName, substituteName) (substituteName)
55
56/// Use these macros if the UI is okay without any icon, but would be better with one.
57#define koIconWanted(comment, wantedName) (KIcon())
58#define koIconNameWanted(comment, wantedName) (QString())
59
60#endif
61