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 
22 /* GuiUtils.h */
23 
24 #ifndef GuiUtils_H
25 #define GuiUtils_H
26 
27 class QWidget;
28 class QPixmap;
29 class QFontMetrics;
30 class QImage;
31 class QString;
32 class QIcon;
33 class QPoint;
34 class QMainWindow;
35 class QScreen;
36 class QSize;
37 
38 template<typename T>
39 class QList;
40 
41 namespace Gui
42 {
43  namespace Util
44  {
45 
50  enum IconTheme
51  {
52  MintY,
53  NoTheme
54  };
55 
62  QIcon icon(const QString& iconName, IconTheme themeName);
63 
64 
74  QPixmap pixmap(const QString& iconName, IconTheme themeName);
75  QPixmap pixmap(const QString& iconName, IconTheme themeName, QSize sz, bool keepAspect=true);
76 
84  QImage image(const QString& iconName, IconTheme themeName);
85  QImage image(const QString& iconName, IconTheme themeName, QSize sz, bool keepAspect=true);
86 
87 
93  void setMainWindow(QMainWindow* window);
94 
100  QMainWindow* mainWindow();
101 
106  QScreen* getBiggestScreen();
107 
114  void placeInScreenCenter(QWidget* widget, float relativeSizeX, float relativeSizeY);
115 
116  int textWidth(const QFontMetrics& fm, const QString& text);
117  int textWidth(QWidget* widget, const QString& text);
118 
119  int viewRowHeight();
120  }
121 }
122 
123 #endif // GuiUtils_H
QList
Definition: EngineUtils.h:33
Gui::Util::pixmap
QPixmap pixmap(const QString &iconName, IconTheme themeName)
fetch a pixmap from resources
Util
Helper functions.
Definition: GenreView.h:36
Gui::Util::icon
QIcon icon(const QString &iconName, IconTheme themeName)
fetch a icon from resources
Gui::Util::setMainWindow
void setMainWindow(QMainWindow *window)
set the applications' main window
Gui::Util::mainWindow
QMainWindow * mainWindow()
get the applications' main window
Gui::Util::IconTheme
IconTheme
The IconTheme enum.
Definition: GuiUtils.h:51
Gui::Util::image
QImage image(const QString &iconName, IconTheme themeName)
see pixmap()