Sayonara Player
GuiUtils.h
1/* GuiUtils.h */
2
3/* Copyright (C) 2011-2020 Michael Lugmair (Lucio Carreras)
4 *
5 * This file is part of sayonara player
6 *
7 * This program is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 */
20
21#ifndef GUI_UTILS_H
22#define GUI_UTILS_H
23
24class QWidget;
25class QPixmap;
26class QColor;
27class QFontMetrics;
28class QImage;
29class QString;
30class QIcon;
31class QPoint;
32class QMainWindow;
33class QScreen;
34class QSize;
35
36template<typename T>
37class QList;
38
39#include <QPalette>
40
41namespace Gui
42{
43 namespace Util
44 {
45 enum IconTheme
46 {
47 MintY,
48 NoTheme
49 };
50
51 QIcon icon(const QString& iconName, IconTheme iconTheme);
52 QIcon systemThemeIcon(const QString& iconName);
53
54 QImage image(const QString& iconName, IconTheme themeName);
55 QImage image(const QString& iconName, IconTheme themeName, const QSize& size, bool keepAspectRatio = true);
56
57 QPixmap pixmap(const QString& iconName, IconTheme themeName);
58 QPixmap pixmap(const QString& iconName, IconTheme themeName, const QSize& size, bool keepAspectRatio = true);
59
60 QScreen* getBiggestScreen();
61
62 QColor color(QPalette::ColorGroup colorGroup, QPalette::ColorRole colorRole);
63
64 void placeInScreenCenter(QWidget* widget, float relativeSizeX, float relativeSizeY);
65
66 int textWidth(const QFontMetrics& fm, const QString& text);
67 int textWidth(QWidget* widget, const QString& text);
68
69 int viewRowHeight(const QFontMetrics& fontMetrics);
70 }
71}
72
73#endif // GUI_UTILS_H
Definition: EngineUtils.h:33
Helper functions.
Definition: Utils.h:38