Changeset View
Changeset View
Standalone View
Standalone View
src/KPropertyUtils_p.h
1 | /* This file is part of the KDE project | 1 | /* This file is part of the KDE project | ||
---|---|---|---|---|---|
2 | Copyright (C) 2010-2016 Jarosław Staniek <staniek@kde.org> | 2 | Copyright (C) 2010-2017 Jarosław Staniek <staniek@kde.org> | ||
3 | 3 | | |||
4 | This library is free software; you can redistribute it and/or | 4 | This library is free software; you can redistribute it and/or | ||
5 | modify it under the terms of the GNU Library General Public | 5 | modify it under the terms of the GNU Library General Public | ||
6 | License as published by the Free Software Foundation; either | 6 | License as published by the Free Software Foundation; either | ||
7 | version 2 of the License, or (at your option) any later version. | 7 | version 2 of the License, or (at your option) any later version. | ||
8 | 8 | | |||
9 | This library is distributed in the hope that it will be useful, | 9 | This library is distributed in the hope that it will be useful, | ||
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
12 | Library General Public License for more details. | 12 | Library General Public License for more details. | ||
13 | 13 | | |||
14 | You should have received a copy of the GNU Library General Public License | 14 | You should have received a copy of the GNU Library General Public License | ||
15 | along with this library; see the file COPYING.LIB. If not, write to | 15 | along with this library; see the file COPYING.LIB. If not, write to | ||
16 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 16 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
17 | * Boston, MA 02110-1301, USA. | 17 | * Boston, MA 02110-1301, USA. | ||
18 | */ | 18 | */ | ||
19 | 19 | | |||
20 | #ifndef KPROPERTY_UTILS_P_H | 20 | #ifndef KPROPERTY_UTILS_P_H | ||
21 | #define KPROPERTY_UTILS_P_H | 21 | #define KPROPERTY_UTILS_P_H | ||
22 | 22 | | |||
23 | #include <QPainter> | 23 | #include <QPainter> | ||
24 | #include <QString> | 24 | #include <QString> | ||
25 | 25 | | |||
26 | class KProperty; | ||||
27 | | ||||
26 | namespace KPropertyUtilsPrivate | 28 | namespace KPropertyUtilsPrivate | ||
27 | { | 29 | { | ||
28 | 30 | | |||
29 | //! @return contrast color for @a c color. | 31 | //! @return contrast color for @a c color. | ||
30 | QColor contrastColor(const QColor& c); | 32 | QColor contrastColor(const QColor& c); | ||
31 | 33 | | |||
32 | //! @return grid line color defined by a KPropertyEditorView widget contains @a widget | 34 | //! @return grid line color defined by a KPropertyEditorView widget contains @a widget | ||
33 | //! Invalid color is returned if no grid is defined or KPropertyEditorView was not found. | 35 | //! Invalid color is returned if no grid is defined or KPropertyEditorView was not found. | ||
Show All 15 Lines | |||||
49 | bool setupPrivateIconsResourceWithMessage(const QString &privateName, const QString& path, | 51 | bool setupPrivateIconsResourceWithMessage(const QString &privateName, const QString& path, | ||
50 | QtMsgType messageType, | 52 | QtMsgType messageType, | ||
51 | const QString &prefix = QLatin1String(":/icons")); | 53 | const QString &prefix = QLatin1String(":/icons")); | ||
52 | 54 | | |||
53 | //! Sets up a global icon theme if it is different from supported. | 55 | //! Sets up a global icon theme if it is different from supported. | ||
54 | //! Warns on failure and returns @c false. | 56 | //! Warns on failure and returns @c false. | ||
55 | bool setupGlobalIconTheme(); | 57 | bool setupGlobalIconTheme(); | ||
56 | 58 | | |||
59 | //! Helper for handling minValueText, prefix and suffix property options | ||||
60 | class ValueOptionsHandler | ||||
61 | { | ||||
62 | public: | ||||
63 | explicit ValueOptionsHandler(const KProperty &property); | ||||
64 | | ||||
65 | //! @return @a valueString value with prefix and suffix, if present | ||||
66 | QString valueWithPrefixAndSuffix(const QString &valueString, const QLocale &locale) const; | ||||
67 | | ||||
68 | QString minValueText; | ||||
69 | QString prefix; | ||||
70 | QString suffix; | ||||
71 | }; | ||||
72 | | ||||
57 | //! @short Manages the QPainter::save()/QPainter::restore() block using RAII | 73 | //! @short Manages the QPainter::save()/QPainter::restore() block using RAII | ||
58 | /*! The PainterSaver class makes sure that restore() is called when exiting from the block of code. | 74 | /*! The PainterSaver class makes sure that restore() is called when exiting from the block of code. | ||
59 | 75 | | |||
60 | Instead of: | 76 | Instead of: | ||
61 | @code | 77 | @code | ||
62 | painter.save(); | 78 | painter.save(); | ||
63 | // (code) | 79 | // (code) | ||
64 | painter.restore(); | 80 | painter.restore(); | ||
Show All 22 Lines |