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