source: calamares/trunk/fuentes/src/libcalamaresui/utils/CalamaresUtilsGui.h @ 7538

Last change on this file since 7538 was 7538, checked in by kbut, 13 months ago

sync with github

File size: 3.7 KB
Line 
1/* === This file is part of Calamares - <https://github.com/calamares> ===
2 *
3 *   Copyright 2014-2015, Teo Mrnjavac <teo@kde.org>
4 *   Copyright 2017, Adriaan de Groot <groot@kde.org>
5 *
6 *   Calamares is free software: you can redistribute it and/or modify
7 *   it under the terms of the GNU General Public License as published by
8 *   the Free Software Foundation, either version 3 of the License, or
9 *   (at your option) any later version.
10 *
11 *   Calamares is distributed in the hope that it will be useful,
12 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
13 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 *   GNU General Public License for more details.
15 *
16 *   You should have received a copy of the GNU General Public License
17 *   along with Calamares. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20#ifndef CALAMARESUTILSGUI_H
21#define CALAMARESUTILSGUI_H
22
23#include "utils/CalamaresUtils.h"
24#include "UiDllMacro.h"
25
26#include <QPixmap>
27#include <QSize>
28
29class QLayout;
30
31namespace CalamaresUtils
32{
33
34/**
35 * @brief The ImageType enum lists all common Calamares icons.
36 * Icons are loaded from SVGs and cached. Each icon has an enum value, through which
37 * it can be accessed.
38 * You can forward-declare this as:
39 * enum ImageType : int;
40 */
41enum ImageType : int
42{
43    Yes,
44    No,
45    Information,
46    Fail,
47    Bugs,
48    Help,
49    Release,
50    PartitionDisk,
51    PartitionPartition,
52    PartitionAlongside,
53    PartitionEraseAuto,
54    PartitionManual,
55    PartitionReplaceOs,
56    PartitionTable,
57    BootEnvironment,
58    Squid,
59    StatusOk,         // Icons for the requirements checker
60    StatusWarning,
61    StatusError
62};
63
64/**
65 * @brief The ImageMode enum contains different transformations that can be applied.
66 * Most of these are currently unused.
67 */
68enum ImageMode
69{
70    Original,
71    CoverInCase,
72    Grid,
73    DropShadow,
74    RoundedCorners
75};
76
77/**
78 * @brief defaultPixmap returns a resized and/or transformed pixmap for a given
79 * ImageType.
80 * @param type the ImageType i.e. the enum value for an SVG.
81 * @param mode the transformation to apply (default: no transformation).
82 * @param size the target pixmap size (default: original SVG size).
83 * @return the new pixmap.
84 */
85UIDLLEXPORT QPixmap defaultPixmap( ImageType type,
86                                   ImageMode mode = CalamaresUtils::Original,
87                                   const QSize& size = QSize( 0, 0 ) );
88
89/**
90 * @brief createRoundedImage returns a rounded version of a pixmap.
91 * @param avatar the input pixmap.
92 * @param size the new size.
93 * @param frameWidthPct the frame size, as percentage of width.
94 * @return the transformed pixmap.
95 * This one is currently unused.
96 */
97UIDLLEXPORT QPixmap createRoundedImage( const QPixmap& avatar,
98                                        const QSize& size,
99                                        float frameWidthPct = 0.20f );
100
101/**
102 * @brief unmarginLayout recursively walks the QLayout tree and removes all margins.
103 * @param layout the layout to unmargin.
104 */
105UIDLLEXPORT void unmarginLayout( QLayout* layout );
106
107/**
108 * @brief clearLayout recursively walks the QLayout tree and deletes all the child
109 * widgets and layouts.
110 * @param layout the layout to clear.
111 */
112UIDLLEXPORT void clearLayout( QLayout* layout );
113
114UIDLLEXPORT void setDefaultFontSize( int points );
115UIDLLEXPORT int defaultFontSize();      // in points
116UIDLLEXPORT int defaultFontHeight();    // in pixels, DPI-specific
117UIDLLEXPORT QFont defaultFont();
118UIDLLEXPORT QFont largeFont();
119UIDLLEXPORT QSize defaultIconSize();
120
121/**
122 * @brief Size constants for the main Calamares window.
123 */
124constexpr int windowMinimumWidth = 800;
125constexpr int windowMinimumHeight = 520;
126constexpr int windowPreferredWidth = 1024;
127constexpr int windowPreferredHeight = 520;
128}
129
130#endif // CALAMARESUTILSGUI_H
Note: See TracBrowser for help on using the repository browser.