1 | /* $Id: UIIconPool.cpp 103803 2024-03-12 11:15:18Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VBox Qt GUI - UIIconPool class implementation.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2010-2023 Oracle and/or its affiliates.
|
---|
8 | *
|
---|
9 | * This file is part of VirtualBox base platform packages, as
|
---|
10 | * available from https://www.virtualbox.org.
|
---|
11 | *
|
---|
12 | * This program is free software; you can redistribute it and/or
|
---|
13 | * modify it under the terms of the GNU General Public License
|
---|
14 | * as published by the Free Software Foundation, in version 3 of the
|
---|
15 | * License.
|
---|
16 | *
|
---|
17 | * This program is distributed in the hope that it will be useful, but
|
---|
18 | * WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
20 | * General Public License for more details.
|
---|
21 | *
|
---|
22 | * You should have received a copy of the GNU General Public License
|
---|
23 | * along with this program; if not, see <https://www.gnu.org/licenses>.
|
---|
24 | *
|
---|
25 | * SPDX-License-Identifier: GPL-3.0-only
|
---|
26 | */
|
---|
27 |
|
---|
28 | /* Qt includes: */
|
---|
29 | #include <QApplication>
|
---|
30 | #include <QFile>
|
---|
31 | #include <QPainter>
|
---|
32 | #include <QStyle>
|
---|
33 | #include <QWidget>
|
---|
34 | #include <QWindow>
|
---|
35 |
|
---|
36 | /* GUI includes: */
|
---|
37 | #include "UIIconPool.h"
|
---|
38 | #include "UIExtraDataManager.h"
|
---|
39 | #include "UIGlobalSession.h"
|
---|
40 | #include "UIGuestOSType.h"
|
---|
41 | #include "UIModalWindowManager.h"
|
---|
42 |
|
---|
43 | /* COM includes: */
|
---|
44 | #include "CMachine.h"
|
---|
45 | #include <VBox/com/VirtualBox.h> /* Need GUEST_OS_ID_STR_X86 and friends. */
|
---|
46 |
|
---|
47 | /* Other VBox includes: */
|
---|
48 | #include <iprt/assert.h>
|
---|
49 |
|
---|
50 |
|
---|
51 | /*********************************************************************************************************************************
|
---|
52 | * Class UIIconPool implementation. *
|
---|
53 | *********************************************************************************************************************************/
|
---|
54 |
|
---|
55 | /* static */
|
---|
56 | QPixmap UIIconPool::pixmap(const QString &strName)
|
---|
57 | {
|
---|
58 | /* Reuse iconSet API: */
|
---|
59 | QIcon icon = iconSet(strName);
|
---|
60 |
|
---|
61 | /* Return pixmap of first available size: */
|
---|
62 | const int iHint = QApplication::style()->pixelMetric(QStyle::PM_SmallIconSize);
|
---|
63 | return icon.pixmap(icon.availableSizes().value(0, QSize(iHint, iHint)));
|
---|
64 | }
|
---|
65 |
|
---|
66 | /* static */
|
---|
67 | QIcon UIIconPool::iconSet(const QString &strNormal,
|
---|
68 | const QString &strDisabled /* = QString() */,
|
---|
69 | const QString &strActive /* = QString() */)
|
---|
70 | {
|
---|
71 | /* Prepare fallback icon: */
|
---|
72 | static QIcon nullIcon;
|
---|
73 |
|
---|
74 | /* Prepare icon: */
|
---|
75 | QIcon icon;
|
---|
76 |
|
---|
77 | /* Add 'normal' pixmap: */
|
---|
78 | AssertReturn(!strNormal.isEmpty(), nullIcon);
|
---|
79 | addName(icon, strNormal, QIcon::Normal);
|
---|
80 |
|
---|
81 | /* Add 'disabled' pixmap (if any): */
|
---|
82 | if (!strDisabled.isEmpty())
|
---|
83 | addName(icon, strDisabled, QIcon::Disabled);
|
---|
84 |
|
---|
85 | /* Add 'active' pixmap (if any): */
|
---|
86 | if (!strActive.isEmpty())
|
---|
87 | addName(icon, strActive, QIcon::Active);
|
---|
88 |
|
---|
89 | /* Return icon: */
|
---|
90 | return icon;
|
---|
91 | }
|
---|
92 |
|
---|
93 | /* static */
|
---|
94 | QIcon UIIconPool::iconSetOnOff(const QString &strNormal, const QString strNormalOff,
|
---|
95 | const QString &strDisabled /* = QString() */, const QString &strDisabledOff /* = QString() */,
|
---|
96 | const QString &strActive /* = QString() */, const QString &strActiveOff /* = QString() */)
|
---|
97 | {
|
---|
98 | /* Prepare fallback icon: */
|
---|
99 | static QIcon nullIcon;
|
---|
100 |
|
---|
101 | /* Prepare icon: */
|
---|
102 | QIcon icon;
|
---|
103 |
|
---|
104 | /* Add 'normal' on/off pixmaps: */
|
---|
105 | AssertReturn(!strNormal.isEmpty(), nullIcon);
|
---|
106 | addName(icon, strNormal, QIcon::Normal, QIcon::On);
|
---|
107 | AssertReturn(!strNormalOff.isEmpty(), nullIcon);
|
---|
108 | addName(icon, strNormalOff, QIcon::Normal, QIcon::Off);
|
---|
109 |
|
---|
110 | /* Add 'disabled' on/off pixmaps (if any): */
|
---|
111 | if (!strDisabled.isEmpty())
|
---|
112 | addName(icon, strDisabled, QIcon::Disabled, QIcon::On);
|
---|
113 | if (!strDisabledOff.isEmpty())
|
---|
114 | addName(icon, strDisabledOff, QIcon::Disabled, QIcon::Off);
|
---|
115 |
|
---|
116 | /* Add 'active' on/off pixmaps (if any): */
|
---|
117 | if (!strActive.isEmpty())
|
---|
118 | addName(icon, strActive, QIcon::Active, QIcon::On);
|
---|
119 | if (!strActiveOff.isEmpty())
|
---|
120 | addName(icon, strActiveOff, QIcon::Active, QIcon::Off);
|
---|
121 |
|
---|
122 | /* Return icon: */
|
---|
123 | return icon;
|
---|
124 | }
|
---|
125 |
|
---|
126 | /* static */
|
---|
127 | QIcon UIIconPool::iconSetFull(const QString &strNormal, const QString &strSmall,
|
---|
128 | const QString &strNormalDisabled /* = QString() */, const QString &strSmallDisabled /* = QString() */,
|
---|
129 | const QString &strNormalActive /* = QString() */, const QString &strSmallActive /* = QString() */)
|
---|
130 | {
|
---|
131 | /* Prepare fallback icon: */
|
---|
132 | static QIcon nullIcon;
|
---|
133 |
|
---|
134 | /* Prepare icon: */
|
---|
135 | QIcon icon;
|
---|
136 |
|
---|
137 | /* Add 'normal' & 'small normal' pixmaps: */
|
---|
138 | AssertReturn(!strNormal.isEmpty(), nullIcon);
|
---|
139 | addName(icon, strNormal, QIcon::Normal);
|
---|
140 | AssertReturn(!strSmall.isEmpty(), nullIcon);
|
---|
141 | addName(icon, strSmall, QIcon::Normal);
|
---|
142 |
|
---|
143 | /* Add 'disabled' & 'small disabled' pixmaps (if any): */
|
---|
144 | if (!strNormalDisabled.isEmpty())
|
---|
145 | addName(icon, strNormalDisabled, QIcon::Disabled);
|
---|
146 | if (!strSmallDisabled.isEmpty())
|
---|
147 | addName(icon, strSmallDisabled, QIcon::Disabled);
|
---|
148 |
|
---|
149 | /* Add 'active' & 'small active' pixmaps (if any): */
|
---|
150 | if (!strNormalActive.isEmpty())
|
---|
151 | addName(icon, strNormalActive, QIcon::Active);
|
---|
152 | if (!strSmallActive.isEmpty())
|
---|
153 | addName(icon, strSmallActive, QIcon::Active);
|
---|
154 |
|
---|
155 | /* Return icon: */
|
---|
156 | return icon;
|
---|
157 | }
|
---|
158 |
|
---|
159 | /* static */
|
---|
160 | QIcon UIIconPool::iconSet(const QPixmap &normal,
|
---|
161 | const QPixmap &disabled /* = QPixmap() */,
|
---|
162 | const QPixmap &active /* = QPixmap() */)
|
---|
163 | {
|
---|
164 | QIcon iconSet;
|
---|
165 |
|
---|
166 | Assert(!normal.isNull());
|
---|
167 | iconSet.addPixmap(normal, QIcon::Normal);
|
---|
168 |
|
---|
169 | if (!disabled.isNull())
|
---|
170 | iconSet.addPixmap(disabled, QIcon::Disabled);
|
---|
171 |
|
---|
172 | if (!active.isNull())
|
---|
173 | iconSet.addPixmap(active, QIcon::Active);
|
---|
174 |
|
---|
175 | return iconSet;
|
---|
176 | }
|
---|
177 |
|
---|
178 | /* static */
|
---|
179 | QIcon UIIconPool::defaultIcon(UIDefaultIconType defaultIconType, const QWidget *pWidget /* = 0 */)
|
---|
180 | {
|
---|
181 | QIcon icon;
|
---|
182 | QStyle *pStyle = pWidget ? pWidget->style() : QApplication::style();
|
---|
183 | switch (defaultIconType)
|
---|
184 | {
|
---|
185 | case UIDefaultIconType_MessageBoxInformation:
|
---|
186 | {
|
---|
187 | icon = pStyle->standardIcon(QStyle::SP_MessageBoxInformation, 0, pWidget);
|
---|
188 | break;
|
---|
189 | }
|
---|
190 | case UIDefaultIconType_MessageBoxQuestion:
|
---|
191 | {
|
---|
192 | icon = pStyle->standardIcon(QStyle::SP_MessageBoxQuestion, 0, pWidget);
|
---|
193 | break;
|
---|
194 | }
|
---|
195 | case UIDefaultIconType_MessageBoxWarning:
|
---|
196 | {
|
---|
197 | #ifdef VBOX_WS_MAC
|
---|
198 | /* At least in Qt 4.3.4/4.4 RC1 SP_MessageBoxWarning is the application
|
---|
199 | * icon. So change this to the critical icon. (Maybe this would be
|
---|
200 | * fixed in a later Qt version) */
|
---|
201 | icon = pStyle->standardIcon(QStyle::SP_MessageBoxCritical, 0, pWidget);
|
---|
202 | #else /* VBOX_WS_MAC */
|
---|
203 | icon = pStyle->standardIcon(QStyle::SP_MessageBoxWarning, 0, pWidget);
|
---|
204 | #endif /* !VBOX_WS_MAC */
|
---|
205 | break;
|
---|
206 | }
|
---|
207 | case UIDefaultIconType_MessageBoxCritical:
|
---|
208 | {
|
---|
209 | icon = pStyle->standardIcon(QStyle::SP_MessageBoxCritical, 0, pWidget);
|
---|
210 | break;
|
---|
211 | }
|
---|
212 | case UIDefaultIconType_DialogCancel:
|
---|
213 | {
|
---|
214 | icon = pStyle->standardIcon(QStyle::SP_DialogCancelButton, 0, pWidget);
|
---|
215 | if (icon.isNull())
|
---|
216 | icon = iconSet(":/cancel_16px.png");
|
---|
217 | break;
|
---|
218 | }
|
---|
219 | case UIDefaultIconType_DialogHelp:
|
---|
220 | {
|
---|
221 | icon = pStyle->standardIcon(QStyle::SP_DialogHelpButton, 0, pWidget);
|
---|
222 | if (icon.isNull())
|
---|
223 | icon = iconSet(":/help_16px.png");
|
---|
224 | break;
|
---|
225 | }
|
---|
226 | case UIDefaultIconType_ArrowBack:
|
---|
227 | {
|
---|
228 | icon = pStyle->standardIcon(QStyle::SP_ArrowBack, 0, pWidget);
|
---|
229 | if (icon.isNull())
|
---|
230 | icon = iconSet(":/list_moveup_16px.png",
|
---|
231 | ":/list_moveup_disabled_16px.png");
|
---|
232 | break;
|
---|
233 | }
|
---|
234 | case UIDefaultIconType_ArrowForward:
|
---|
235 | {
|
---|
236 | icon = pStyle->standardIcon(QStyle::SP_ArrowForward, 0, pWidget);
|
---|
237 | if (icon.isNull())
|
---|
238 | icon = iconSet(":/list_movedown_16px.png",
|
---|
239 | ":/list_movedown_disabled_16px.png");
|
---|
240 | break;
|
---|
241 | }
|
---|
242 | default:
|
---|
243 | {
|
---|
244 | AssertMsgFailed(("Unknown default icon type!"));
|
---|
245 | break;
|
---|
246 | }
|
---|
247 | }
|
---|
248 | return icon;
|
---|
249 | }
|
---|
250 |
|
---|
251 | /* static */
|
---|
252 | QPixmap UIIconPool::joinPixmaps(const QPixmap &pixmap1, const QPixmap &pixmap2)
|
---|
253 | {
|
---|
254 | if (pixmap1.isNull())
|
---|
255 | return pixmap2;
|
---|
256 | if (pixmap2.isNull())
|
---|
257 | return pixmap1;
|
---|
258 |
|
---|
259 | QPixmap result(pixmap1.width() + pixmap2.width() + 2,
|
---|
260 | qMax(pixmap1.height(), pixmap2.height()));
|
---|
261 | result.fill(Qt::transparent);
|
---|
262 |
|
---|
263 | QPainter painter(&result);
|
---|
264 | painter.drawPixmap(0, 0, pixmap1);
|
---|
265 | painter.drawPixmap(pixmap1.width() + 2, result.height() - pixmap2.height(), pixmap2);
|
---|
266 | painter.end();
|
---|
267 |
|
---|
268 | return result;
|
---|
269 | }
|
---|
270 |
|
---|
271 | /* static */
|
---|
272 | void UIIconPool::addName(QIcon &icon, const QString &strName,
|
---|
273 | QIcon::Mode mode /* = QIcon::Normal */, QIcon::State state /* = QIcon::Off */)
|
---|
274 | {
|
---|
275 | /* Prepare pixmap on the basis of passed value: */
|
---|
276 | QPixmap pixmap(strName);
|
---|
277 | /* Add pixmap: */
|
---|
278 | icon.addPixmap(pixmap, mode, state);
|
---|
279 |
|
---|
280 | /* Parse name to prefix and suffix: */
|
---|
281 | QString strPrefix = strName.section('.', 0, -2);
|
---|
282 | QString strSuffix = strName.section('.', -1, -1);
|
---|
283 | /* Prepare HiDPI pixmaps: */
|
---|
284 | const QStringList aPixmapNames = QStringList() << (strPrefix + "_x2." + strSuffix)
|
---|
285 | << (strPrefix + "_x3." + strSuffix)
|
---|
286 | << (strPrefix + "_x4." + strSuffix);
|
---|
287 | foreach (const QString &strPixmapName, aPixmapNames)
|
---|
288 | {
|
---|
289 | QPixmap pixmapHiDPI(strPixmapName);
|
---|
290 | if (!pixmapHiDPI.isNull())
|
---|
291 | icon.addPixmap(pixmapHiDPI, mode, state);
|
---|
292 | }
|
---|
293 | }
|
---|
294 |
|
---|
295 |
|
---|
296 | /*********************************************************************************************************************************
|
---|
297 | * Class UIIconPoolGeneral implementation. *
|
---|
298 | *********************************************************************************************************************************/
|
---|
299 |
|
---|
300 | /* static */
|
---|
301 | UIIconPoolGeneral *UIIconPoolGeneral::s_pInstance = 0;
|
---|
302 |
|
---|
303 | /* static */
|
---|
304 | void UIIconPoolGeneral::create()
|
---|
305 | {
|
---|
306 | AssertReturnVoid(!s_pInstance);
|
---|
307 | new UIIconPoolGeneral;
|
---|
308 | }
|
---|
309 |
|
---|
310 | /* static */
|
---|
311 | void UIIconPoolGeneral::destroy()
|
---|
312 | {
|
---|
313 | AssertPtrReturnVoid(s_pInstance);
|
---|
314 | delete s_pInstance;
|
---|
315 | }
|
---|
316 |
|
---|
317 | /* static */
|
---|
318 | UIIconPoolGeneral *UIIconPoolGeneral::instance()
|
---|
319 | {
|
---|
320 | return s_pInstance;
|
---|
321 | }
|
---|
322 |
|
---|
323 | UIIconPoolGeneral::UIIconPoolGeneral()
|
---|
324 | {
|
---|
325 | /* Init instance: */
|
---|
326 | s_pInstance = this;
|
---|
327 |
|
---|
328 | /* Prepare OS type icon-name hash: */
|
---|
329 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X86("Other"), ":/os_other.png");
|
---|
330 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X64("Other"), ":/os_other.png");
|
---|
331 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_A64("Other"), ":/os_other.png");
|
---|
332 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X86("DOS"), ":/os_dos.png");
|
---|
333 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X86("Netware"), ":/os_netware.png");
|
---|
334 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X86("L4"), ":/os_l4.png");
|
---|
335 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X86("Windows31"), ":/os_win31.png");
|
---|
336 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X86("Windows95"), ":/os_win95.png");
|
---|
337 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X86("Windows98"), ":/os_win98.png");
|
---|
338 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X86("WindowsMe"), ":/os_winme.png");
|
---|
339 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X86("WindowsNT3x"), ":/os_winnt4.png");
|
---|
340 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X86("WindowsNT4"), ":/os_winnt4.png");
|
---|
341 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X86("Windows2000"), ":/os_win2k.png");
|
---|
342 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X86("WindowsXP"), ":/os_winxp.png");
|
---|
343 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X64("WindowsXP"), ":/os_winxp.png");
|
---|
344 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X86("Windows2003"), ":/os_win2k3.png");
|
---|
345 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X64("Windows2003"), ":/os_win2k3.png");
|
---|
346 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X86("WindowsVista"), ":/os_winvista.png");
|
---|
347 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X64("WindowsVista"), ":/os_winvista.png");
|
---|
348 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X86("Windows2008"), ":/os_win2k8.png");
|
---|
349 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X64("Windows2008"), ":/os_win2k8.png");
|
---|
350 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X86("Windows7"), ":/os_win7.png");
|
---|
351 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X64("Windows7"), ":/os_win7.png");
|
---|
352 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X86("Windows8"), ":/os_win8.png");
|
---|
353 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X64("Windows8"), ":/os_win8.png");
|
---|
354 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X86("Windows81"), ":/os_win81.png");
|
---|
355 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X64("Windows81"), ":/os_win81.png");
|
---|
356 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X64("Windows2012"), ":/os_win2k12.png");
|
---|
357 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X86("Windows10"), ":/os_win10.png");
|
---|
358 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X64("Windows10"), ":/os_win10.png");
|
---|
359 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X64("Windows11"), ":/os_win11.png");
|
---|
360 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X64("Windows2016"), ":/os_win2k16.png");
|
---|
361 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X64("Windows2019"), ":/os_win2k19.png");
|
---|
362 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X64("Windows2022"), ":/os_win2k22.png");
|
---|
363 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X86("WindowsNT"), ":/os_win_other.png");
|
---|
364 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X64("WindowsNT"), ":/os_win_other.png");
|
---|
365 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X86("OS2Warp3"), ":/os_os2warp3.png");
|
---|
366 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X86("OS2Warp4"), ":/os_os2warp4.png");
|
---|
367 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X86("OS2Warp45"), ":/os_os2warp45.png");
|
---|
368 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X86("OS2eCS"), ":/os_os2ecs.png");
|
---|
369 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X86("OS2ArcaOS"), ":/os_os2_other.png"); /** @todo icon? */
|
---|
370 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X86("OS21x"), ":/os_os2_other.png");
|
---|
371 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X86("OS2"), ":/os_os2_other.png");
|
---|
372 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X86("Linux22"), ":/os_linux22.png");
|
---|
373 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X86("Linux24"), ":/os_linux24.png");
|
---|
374 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X64("Linux24"), ":/os_linux24.png");
|
---|
375 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X86("Linux26"), ":/os_linux26.png");
|
---|
376 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X64("Linux26"), ":/os_linux26.png");
|
---|
377 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X86("ArchLinux"), ":/os_archlinux.png");
|
---|
378 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X64("ArchLinux"), ":/os_archlinux.png");
|
---|
379 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_A64("ArchLinux"), ":/os_archlinux.png");
|
---|
380 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X86("Debian"), ":/os_debian.png");
|
---|
381 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X64("Debian"), ":/os_debian.png");
|
---|
382 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_A64("Debian"), ":/os_debian.png");
|
---|
383 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X86("Debian31"), ":/os_debian.png");
|
---|
384 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X86("Debian4"), ":/os_debian.png");
|
---|
385 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X64("Debian4"), ":/os_debian.png");
|
---|
386 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X86("Debian5"), ":/os_debian.png");
|
---|
387 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X64("Debian5"), ":/os_debian.png");
|
---|
388 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X86("Debian5"), ":/os_debian.png");
|
---|
389 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X64("Debian5"), ":/os_debian.png");
|
---|
390 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X86("Debian6"), ":/os_debian.png");
|
---|
391 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X64("Debian6"), ":/os_debian.png");
|
---|
392 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X86("Debian7"), ":/os_debian.png");
|
---|
393 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X64("Debian7"), ":/os_debian.png");
|
---|
394 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X86("Debian8"), ":/os_debian.png");
|
---|
395 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X64("Debian8"), ":/os_debian.png");
|
---|
396 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X86("Debian9"), ":/os_debian.png");
|
---|
397 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X64("Debian9"), ":/os_debian.png");
|
---|
398 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_A64("Debian9"), ":/os_debian.png");
|
---|
399 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X86("Debian10"), ":/os_debian.png");
|
---|
400 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X64("Debian10"), ":/os_debian.png");
|
---|
401 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_A64("Debian10"), ":/os_debian.png");
|
---|
402 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X86("Debian11"), ":/os_debian.png");
|
---|
403 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X64("Debian11"), ":/os_debian.png");
|
---|
404 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_A64("Debian11"), ":/os_debian.png");
|
---|
405 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X86("Debian12"), ":/os_debian.png");
|
---|
406 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X64("Debian12"), ":/os_debian.png");
|
---|
407 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_A64("Debian12"), ":/os_debian.png");
|
---|
408 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X86("OpenSUSE"), ":/os_opensuse.png");
|
---|
409 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X64("OpenSUSE"), ":/os_opensuse.png");
|
---|
410 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X64("OpenSUSE_Leap"), ":/os_opensuse.png");
|
---|
411 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_A64("OpenSUSE_Leap"), ":/os_opensuse.png");
|
---|
412 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X86("OpenSUSE_Tumbleweed"), ":/os_opensuse.png");
|
---|
413 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X64("OpenSUSE_Tumbleweed"), ":/os_opensuse.png");
|
---|
414 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_A64("OpenSUSE_Tumbleweed"), ":/os_opensuse.png");
|
---|
415 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X86("SUSE_LE"), ":/os_opensuse.png");
|
---|
416 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X64("SUSE_LE"), ":/os_opensuse.png");
|
---|
417 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X86("Fedora"), ":/os_fedora.png");
|
---|
418 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X64("Fedora"), ":/os_fedora.png");
|
---|
419 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_A64("Fedora"), ":/os_fedora.png");
|
---|
420 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X86("Gentoo"), ":/os_gentoo.png");
|
---|
421 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X64("Gentoo"), ":/os_gentoo.png");
|
---|
422 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X86("Mandriva"), ":/os_mandriva.png");
|
---|
423 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X64("Mandriva"), ":/os_mandriva.png");
|
---|
424 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X86("OpenMandriva_Lx"), ":/os_mandriva.png");
|
---|
425 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X64("OpenMandriva_Lx"), ":/os_mandriva.png");
|
---|
426 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X86("PCLinuxOS"), ":/os_mandriva.png");
|
---|
427 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X64("PCLinuxOS"), ":/os_mandriva.png");
|
---|
428 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X86("Mageia"), ":/os_mandriva.png");
|
---|
429 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X64("Mageia"), ":/os_mandriva.png");
|
---|
430 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X86("RedHat"), ":/os_redhat.png");
|
---|
431 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X64("RedHat"), ":/os_redhat.png");
|
---|
432 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X86("RedHat3"), ":/os_redhat.png");
|
---|
433 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X64("RedHat3"), ":/os_redhat.png");
|
---|
434 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X86("RedHat4"), ":/os_redhat.png");
|
---|
435 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X64("RedHat4"), ":/os_redhat.png");
|
---|
436 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X86("RedHat5"), ":/os_redhat.png");
|
---|
437 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X64("RedHat5"), ":/os_redhat.png");
|
---|
438 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X86("RedHat6"), ":/os_redhat.png");
|
---|
439 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X64("RedHat6"), ":/os_redhat.png");
|
---|
440 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X64("RedHat7"), ":/os_redhat.png");
|
---|
441 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X64("RedHat8"), ":/os_redhat.png");
|
---|
442 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X64("RedHat9"), ":/os_redhat.png");
|
---|
443 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X86("Turbolinux"), ":/os_turbolinux.png");
|
---|
444 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X64("Turbolinux"), ":/os_turbolinux.png");
|
---|
445 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X86("Ubuntu"), ":/os_ubuntu.png");
|
---|
446 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X64("Ubuntu"), ":/os_ubuntu.png");
|
---|
447 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_A64("Ubuntu"), ":/os_ubuntu.png");
|
---|
448 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X86("Ubuntu10_LTS"), ":/os_ubuntu.png");
|
---|
449 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X64("Ubuntu10_LTS"), ":/os_ubuntu.png");
|
---|
450 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X86("Ubuntu10"), ":/os_ubuntu.png");
|
---|
451 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X64("Ubuntu10"), ":/os_ubuntu.png");
|
---|
452 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X86("Ubuntu11"), ":/os_ubuntu.png");
|
---|
453 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X64("Ubuntu11"), ":/os_ubuntu.png");
|
---|
454 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X86("Ubuntu12_LTS"), ":/os_ubuntu.png");
|
---|
455 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X64("Ubuntu12_LTS"), ":/os_ubuntu.png");
|
---|
456 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X86("Ubuntu12"), ":/os_ubuntu.png");
|
---|
457 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X64("Ubuntu12"), ":/os_ubuntu.png");
|
---|
458 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X86("Ubuntu13"), ":/os_ubuntu.png");
|
---|
459 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X64("Ubuntu13"), ":/os_ubuntu.png");
|
---|
460 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X86("Ubuntu14_LTS"), ":/os_ubuntu.png");
|
---|
461 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X64("Ubuntu14_LTS"), ":/os_ubuntu.png");
|
---|
462 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X86("Ubuntu14"), ":/os_ubuntu.png");
|
---|
463 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X64("Ubuntu14"), ":/os_ubuntu.png");
|
---|
464 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X86("Ubuntu15"), ":/os_ubuntu.png");
|
---|
465 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X64("Ubuntu15"), ":/os_ubuntu.png");
|
---|
466 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X86("Ubuntu16_LTS"), ":/os_ubuntu.png");
|
---|
467 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X64("Ubuntu16_LTS"), ":/os_ubuntu.png");
|
---|
468 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X86("Ubuntu16"), ":/os_ubuntu.png");
|
---|
469 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X64("Ubuntu16"), ":/os_ubuntu.png");
|
---|
470 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X86("Ubuntu17"), ":/os_ubuntu.png");
|
---|
471 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X64("Ubuntu17"), ":/os_ubuntu.png");
|
---|
472 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X86("Ubuntu18_LTS"), ":/os_ubuntu.png");
|
---|
473 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X64("Ubuntu18_LTS"), ":/os_ubuntu.png");
|
---|
474 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X86("Ubuntu18"), ":/os_ubuntu.png");
|
---|
475 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X64("Ubuntu18"), ":/os_ubuntu.png");
|
---|
476 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X86("Ubuntu19"), ":/os_ubuntu.png");
|
---|
477 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X64("Ubuntu19"), ":/os_ubuntu.png");
|
---|
478 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X64("Ubuntu20_LTS"), ":/os_ubuntu.png");
|
---|
479 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X64("Ubuntu20"), ":/os_ubuntu.png");
|
---|
480 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X64("Ubuntu21_LTS"), ":/os_ubuntu.png");
|
---|
481 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X64("Ubuntu21"), ":/os_ubuntu.png");
|
---|
482 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X64("Ubuntu22_LTS"), ":/os_ubuntu.png");
|
---|
483 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X64("Ubuntu22"), ":/os_ubuntu.png");
|
---|
484 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_A64("Ubuntu22"), ":/os_ubuntu.png");
|
---|
485 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X64("Ubuntu23"), ":/os_ubuntu.png");
|
---|
486 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_A64("Ubuntu23"), ":/os_ubuntu.png");
|
---|
487 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X86("Lubuntu"), ":/os_ubuntu.png");
|
---|
488 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X64("Lubuntu"), ":/os_ubuntu.png");
|
---|
489 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X86("Xubuntu"), ":/os_ubuntu.png");
|
---|
490 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X64("Xubuntu"), ":/os_ubuntu.png");
|
---|
491 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X86("Xandros"), ":/os_xandros.png");
|
---|
492 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X64("Xandros"), ":/os_xandros.png");
|
---|
493 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X86("Oracle"), ":/os_oracle.png");
|
---|
494 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X64("Oracle"), ":/os_oracle.png");
|
---|
495 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X86("Oracle3"), ":/os_oracle.png");
|
---|
496 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X64("Oracle3"), ":/os_oracle.png");
|
---|
497 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X86("Oracle4"), ":/os_oracle.png");
|
---|
498 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X64("Oracle4"), ":/os_oracle.png");
|
---|
499 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X86("Oracle5"), ":/os_oracle.png");
|
---|
500 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X64("Oracle5"), ":/os_oracle.png");
|
---|
501 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X86("Oracle6"), ":/os_oracle.png");
|
---|
502 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X64("Oracle6"), ":/os_oracle.png");
|
---|
503 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X64("Oracle7"), ":/os_oracle.png");
|
---|
504 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X64("Oracle8"), ":/os_oracle.png");
|
---|
505 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X64("Oracle9"), ":/os_oracle.png");
|
---|
506 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_A64("Oracle9"), ":/os_oracle.png");
|
---|
507 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X86("Oracle"), ":/os_oracle.png");
|
---|
508 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X64("Oracle"), ":/os_oracle.png");
|
---|
509 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_A64("Oracle"), ":/os_oracle.png");
|
---|
510 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X86("Linux"), ":/os_linux.png");
|
---|
511 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X64("Linux"), ":/os_linux.png");
|
---|
512 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X86("FreeBSD"), ":/os_freebsd.png");
|
---|
513 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X64("FreeBSD"), ":/os_freebsd.png");
|
---|
514 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_A64("FreeBSD"), ":/os_freebsd.png");
|
---|
515 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X86("OpenBSD"), ":/os_openbsd.png");
|
---|
516 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X64("OpenBSD"), ":/os_openbsd.png");
|
---|
517 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_A64("OpenBSD"), ":/os_openbsd.png");
|
---|
518 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X86("NetBSD"), ":/os_netbsd.png");
|
---|
519 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X64("NetBSD"), ":/os_netbsd.png");
|
---|
520 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_A64("NetBSD"), ":/os_netbsd.png");
|
---|
521 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X86("Solaris"), ":/os_solaris.png");
|
---|
522 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X64("Solaris"), ":/os_solaris.png");
|
---|
523 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X86("Solaris10U8_or_later"), ":/os_solaris.png");
|
---|
524 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X64("Solaris10U8_or_later"), ":/os_solaris.png");
|
---|
525 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X86("OpenSolaris"), ":/os_oraclesolaris.png");
|
---|
526 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X64("OpenSolaris"), ":/os_oraclesolaris.png");
|
---|
527 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X64("Solaris11"), ":/os_oraclesolaris.png");
|
---|
528 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X86("QNX"), ":/os_qnx.png");
|
---|
529 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X86("MacOS"), ":/os_macosx.png");
|
---|
530 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X64("MacOS"), ":/os_macosx.png");
|
---|
531 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X86("MacOS106"), ":/os_macosx.png");
|
---|
532 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X64("MacOS106"), ":/os_macosx.png");
|
---|
533 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X64("MacOS107"), ":/os_macosx.png");
|
---|
534 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X64("MacOS108"), ":/os_macosx.png");
|
---|
535 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X64("MacOS109"), ":/os_macosx.png");
|
---|
536 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X64("MacOS1010"), ":/os_macosx.png");
|
---|
537 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X64("MacOS1011"), ":/os_macosx.png");
|
---|
538 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X64("MacOS1012"), ":/os_macosx.png");
|
---|
539 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X64("MacOS1013"), ":/os_macosx.png");
|
---|
540 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X86("JRockitVE"), ":/os_jrockitve.png");
|
---|
541 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X64("VBoxBS"), ":/os_other.png");
|
---|
542 | m_guestOSTypeIconNames.insert(GUEST_OS_ID_STR_X86("Cloud"), ":/os_cloud.png");
|
---|
543 |
|
---|
544 | /* Prepare warning/error icons: */
|
---|
545 | m_pixWarning = defaultIcon(UIDefaultIconType_MessageBoxWarning).pixmap(16, 16);
|
---|
546 | Assert(!m_pixWarning.isNull());
|
---|
547 | m_pixError = defaultIcon(UIDefaultIconType_MessageBoxCritical).pixmap(16, 16);
|
---|
548 | Assert(!m_pixError.isNull());
|
---|
549 | }
|
---|
550 |
|
---|
551 | UIIconPoolGeneral::~UIIconPoolGeneral()
|
---|
552 | {
|
---|
553 | /* Deinit instance: */
|
---|
554 | s_pInstance = 0;
|
---|
555 | }
|
---|
556 |
|
---|
557 | /* static */
|
---|
558 | QIcon UIIconPoolGeneral::overlayedIconSet(const QString &strGuestOSTypeId,
|
---|
559 | const QString &strNormal,
|
---|
560 | const QString &strDisabled /* = QString() */,
|
---|
561 | const QString &strActive /* = QString() */)
|
---|
562 | {
|
---|
563 | /* Prepare fallback icon: */
|
---|
564 | static QIcon nullIcon;
|
---|
565 |
|
---|
566 | /* Prepare icon: */
|
---|
567 | QIcon icon;
|
---|
568 |
|
---|
569 | /* Add 'normal' pixmap: */
|
---|
570 | AssertReturn(!strNormal.isEmpty(), nullIcon);
|
---|
571 | addNameAndOverlay(icon, strNormal, strGuestOSTypeId, QIcon::Normal);
|
---|
572 |
|
---|
573 | /* Add 'disabled' pixmap (if any): */
|
---|
574 | if (!strDisabled.isEmpty())
|
---|
575 | addNameAndOverlay(icon, strDisabled, strGuestOSTypeId, QIcon::Disabled);
|
---|
576 |
|
---|
577 | /* Add 'active' pixmap (if any): */
|
---|
578 | if (!strActive.isEmpty())
|
---|
579 | addNameAndOverlay(icon, strActive, strGuestOSTypeId, QIcon::Active);
|
---|
580 |
|
---|
581 | /* Return icon: */
|
---|
582 | return icon;
|
---|
583 | }
|
---|
584 |
|
---|
585 | /* static */
|
---|
586 | void UIIconPoolGeneral::addNameAndOverlay(QIcon &icon, const QString &strName, const QString &strGuestOSTypeId,
|
---|
587 | QIcon::Mode mode /* = QIcon::Normal */, QIcon::State state /* = QIcon::Off */ )
|
---|
588 | {
|
---|
589 | /* Prepare pixmap on the basis of passed value: */
|
---|
590 | QPixmap pixmap(strName);
|
---|
591 | overlayArchitectureTextOnPixmap(determineOSArchString(strGuestOSTypeId), pixmap);
|
---|
592 | /* Add pixmap: */
|
---|
593 | icon.addPixmap(pixmap, mode, state);
|
---|
594 |
|
---|
595 | /* Parse name to prefix and suffix: */
|
---|
596 | QString strPrefix = strName.section('.', 0, -2);
|
---|
597 | QString strSuffix = strName.section('.', -1, -1);
|
---|
598 | /* Prepare HiDPI pixmaps: */
|
---|
599 | const QStringList aPixmapNames = QStringList() << (strPrefix + "_x2." + strSuffix)
|
---|
600 | << (strPrefix + "_x3." + strSuffix)
|
---|
601 | << (strPrefix + "_x4." + strSuffix);
|
---|
602 | foreach (const QString &strPixmapName, aPixmapNames)
|
---|
603 | {
|
---|
604 | QPixmap pixmapHiDPI(strPixmapName);
|
---|
605 | if (!pixmapHiDPI.isNull())
|
---|
606 | {
|
---|
607 | overlayArchitectureTextOnPixmap(determineOSArchString(strGuestOSTypeId), pixmapHiDPI);
|
---|
608 | icon.addPixmap(pixmapHiDPI, mode, state);
|
---|
609 | }
|
---|
610 | }
|
---|
611 | }
|
---|
612 |
|
---|
613 | QIcon UIIconPoolGeneral::userMachineIcon(const CMachine &comMachine) const
|
---|
614 | {
|
---|
615 | /* Make sure machine is not NULL: */
|
---|
616 | AssertReturn(comMachine.isNotNull(), QIcon());
|
---|
617 |
|
---|
618 | /* Get machine ID: */
|
---|
619 | const QUuid uMachineId = comMachine.GetId();
|
---|
620 | AssertReturn(comMachine.isOk(), QIcon());
|
---|
621 |
|
---|
622 | /* Prepare icon: */
|
---|
623 | QIcon icon;
|
---|
624 |
|
---|
625 | /* 1. First, load icon from IMachine extra-data: */
|
---|
626 | if (icon.isNull())
|
---|
627 | {
|
---|
628 | foreach (const QString &strIconName, gEDataManager->machineWindowIconNames(uMachineId))
|
---|
629 | if (!strIconName.isEmpty() && QFile::exists(strIconName))
|
---|
630 | icon.addFile(strIconName);
|
---|
631 | }
|
---|
632 |
|
---|
633 | /* 2. Otherwise, load icon from IMachine interface itself: */
|
---|
634 | if (icon.isNull())
|
---|
635 | {
|
---|
636 | const QVector<BYTE> byteVector = comMachine.GetIcon();
|
---|
637 | AssertReturn(comMachine.isOk(), QPixmap());
|
---|
638 | const QByteArray byteArray = QByteArray::fromRawData(reinterpret_cast<const char*>(byteVector.constData()), byteVector.size());
|
---|
639 | const QImage image = QImage::fromData(byteArray);
|
---|
640 | if (!image.isNull())
|
---|
641 | {
|
---|
642 | QPixmap pixmap = QPixmap::fromImage(image);
|
---|
643 | const int iMinimumLength = qMin(pixmap.width(), pixmap.height());
|
---|
644 | if (pixmap.width() != iMinimumLength || pixmap.height() != iMinimumLength)
|
---|
645 | pixmap = pixmap.scaled(QSize(iMinimumLength, iMinimumLength), Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
|
---|
646 | icon.addPixmap(pixmap);
|
---|
647 | }
|
---|
648 | }
|
---|
649 |
|
---|
650 | /* Return icon: */
|
---|
651 | return icon;
|
---|
652 | }
|
---|
653 |
|
---|
654 | QPixmap UIIconPoolGeneral::userMachinePixmap(const CMachine &comMachine, const QSize &size) const
|
---|
655 | {
|
---|
656 | /* Acquire icon: */
|
---|
657 | const QIcon icon = userMachineIcon(comMachine);
|
---|
658 |
|
---|
659 | /* Prepare pixmap: */
|
---|
660 | QPixmap pixmap;
|
---|
661 |
|
---|
662 | /* Check whether we have valid icon: */
|
---|
663 | if (!icon.isNull())
|
---|
664 | {
|
---|
665 | /* Get pixmap of requested size: */
|
---|
666 | pixmap = icon.pixmap(size);
|
---|
667 | /* And even scale it if size is not valid: */
|
---|
668 | if (pixmap.size() != size)
|
---|
669 | pixmap = pixmap.scaled(size, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
|
---|
670 | }
|
---|
671 |
|
---|
672 | /* Return pixmap: */
|
---|
673 | return pixmap;
|
---|
674 | }
|
---|
675 |
|
---|
676 | QPixmap UIIconPoolGeneral::userMachinePixmapDefault(const CMachine &comMachine, QSize *pLogicalSize /* = 0 */) const
|
---|
677 | {
|
---|
678 | /* Acquire icon: */
|
---|
679 | const QIcon icon = userMachineIcon(comMachine);
|
---|
680 |
|
---|
681 | /* Prepare pixmap: */
|
---|
682 | QPixmap pixmap;
|
---|
683 |
|
---|
684 | /* Check whether we have valid icon: */
|
---|
685 | if (!icon.isNull())
|
---|
686 | {
|
---|
687 | /* Determine desired icon size: */
|
---|
688 | const int iIconMetric = QApplication::style()->pixelMetric(QStyle::PM_LargeIconSize);
|
---|
689 | const QSize iconSize = QSize(iIconMetric, iIconMetric);
|
---|
690 |
|
---|
691 | /* Pass up logical size if necessary: */
|
---|
692 | if (pLogicalSize)
|
---|
693 | *pLogicalSize = iconSize;
|
---|
694 |
|
---|
695 | /* Get pixmap of requested size: */
|
---|
696 | pixmap = icon.pixmap(iconSize);
|
---|
697 | }
|
---|
698 |
|
---|
699 | /* Return pixmap: */
|
---|
700 | return pixmap;
|
---|
701 | }
|
---|
702 |
|
---|
703 | QIcon UIIconPoolGeneral::guestOSTypeIcon(const QString &strOSTypeID) const
|
---|
704 | {
|
---|
705 | /* Prepare fallback icon: */
|
---|
706 | static QPixmap nullIcon(":/os_other.png");
|
---|
707 |
|
---|
708 | /* If we do NOT have that 'guest OS type' icon cached already: */
|
---|
709 | if (!m_guestOSTypeIcons.contains(strOSTypeID))
|
---|
710 | {
|
---|
711 | /* Compose proper icon if we have that 'guest OS type' known: */
|
---|
712 | if (m_guestOSTypeIconNames.contains(strOSTypeID))
|
---|
713 | m_guestOSTypeIcons[strOSTypeID] = overlayedIconSet(strOSTypeID, m_guestOSTypeIconNames[strOSTypeID]);
|
---|
714 | /* Assign fallback icon if we do NOT have that 'guest OS type' registered: */
|
---|
715 | else if (!strOSTypeID.isNull())
|
---|
716 | m_guestOSTypeIcons[strOSTypeID] = overlayedIconSet(strOSTypeID, m_guestOSTypeIconNames[GUEST_OS_ID_STR_X86("Other")]);
|
---|
717 | /* Assign fallback icon if we do NOT have that 'guest OS type' known: */
|
---|
718 | else
|
---|
719 | m_guestOSTypeIcons[strOSTypeID] = iconSet(nullIcon);
|
---|
720 | }
|
---|
721 |
|
---|
722 | /* Retrieve corresponding icon: */
|
---|
723 | const QIcon &icon = m_guestOSTypeIcons[strOSTypeID];
|
---|
724 | AssertMsgReturn(!icon.isNull(),
|
---|
725 | ("Undefined icon for type '%s'.", strOSTypeID.toLatin1().constData()),
|
---|
726 | nullIcon);
|
---|
727 |
|
---|
728 | /* Return icon: */
|
---|
729 | return icon;
|
---|
730 | }
|
---|
731 |
|
---|
732 | QPixmap UIIconPoolGeneral::guestOSTypePixmap(const QString &strOSTypeID, const QSize &size) const
|
---|
733 | {
|
---|
734 | /* Acquire icon: */
|
---|
735 | const QIcon icon = guestOSTypeIcon(strOSTypeID);
|
---|
736 |
|
---|
737 | /* Prepare pixmap: */
|
---|
738 | QPixmap pixmap;
|
---|
739 |
|
---|
740 | /* Check whether we have valid icon: */
|
---|
741 | if (!icon.isNull())
|
---|
742 | {
|
---|
743 | /* Get pixmap of requested size: */
|
---|
744 | pixmap = icon.pixmap(size);
|
---|
745 | /* And even scale it if size is not valid: */
|
---|
746 | if (pixmap.size() != size)
|
---|
747 | pixmap = pixmap.scaled(size, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
|
---|
748 | }
|
---|
749 |
|
---|
750 | /* Return pixmap: */
|
---|
751 | return pixmap;
|
---|
752 | }
|
---|
753 |
|
---|
754 | QPixmap UIIconPoolGeneral::guestOSTypePixmapDefault(const QString &strOSTypeID, QSize *pLogicalSize /* = 0 */) const
|
---|
755 | {
|
---|
756 | /* Acquire icon: */
|
---|
757 | const QIcon icon = guestOSTypeIcon(strOSTypeID);
|
---|
758 |
|
---|
759 | /* Prepare pixmap: */
|
---|
760 | QPixmap pixmap;
|
---|
761 |
|
---|
762 | /* Check whether we have valid icon: */
|
---|
763 | if (!icon.isNull())
|
---|
764 | {
|
---|
765 | /* Determine desired icon size: */
|
---|
766 | const int iIconMetric = QApplication::style()->pixelMetric(QStyle::PM_LargeIconSize);
|
---|
767 | const QSize iconSize = QSize(iIconMetric, iIconMetric);
|
---|
768 |
|
---|
769 | /* Pass up logical size if necessary: */
|
---|
770 | if (pLogicalSize)
|
---|
771 | *pLogicalSize = iconSize;
|
---|
772 |
|
---|
773 | /* Get pixmap of requested size (take into account the DPI of the main shown window, if possible): */
|
---|
774 | const qreal fDevicePixelRatio = windowManager().mainWindowShown() && windowManager().mainWindowShown()->windowHandle()
|
---|
775 | ? windowManager().mainWindowShown()->windowHandle()->devicePixelRatio() : 1;
|
---|
776 | pixmap = icon.pixmap(iconSize, fDevicePixelRatio);
|
---|
777 | }
|
---|
778 |
|
---|
779 | /* Return pixmap: */
|
---|
780 | return pixmap;
|
---|
781 | }
|
---|
782 |
|
---|
783 | /* static */
|
---|
784 | QString UIIconPoolGeneral::determineOSArchString(const QString &strOSTypeId)
|
---|
785 | {
|
---|
786 | bool fIs64Bit = gpGlobalSession->guestOSTypeManager().is64Bit(strOSTypeId);
|
---|
787 | KPlatformArchitecture enmPlatformArchitecture = gpGlobalSession->guestOSTypeManager().getPlatformArchitecture(strOSTypeId);
|
---|
788 |
|
---|
789 | if (enmPlatformArchitecture == KPlatformArchitecture_ARM)
|
---|
790 | {
|
---|
791 | if (fIs64Bit)
|
---|
792 | return QString("A64");
|
---|
793 | else
|
---|
794 | return QString("A32");
|
---|
795 | }
|
---|
796 | else if (enmPlatformArchitecture == KPlatformArchitecture_x86)
|
---|
797 | {
|
---|
798 | if (fIs64Bit)
|
---|
799 | return QString("x64");
|
---|
800 | else
|
---|
801 | return QString("32");
|
---|
802 | }
|
---|
803 | return QString();
|
---|
804 | }
|
---|
805 |
|
---|
806 | /* static */
|
---|
807 | void UIIconPoolGeneral::overlayArchitectureTextOnPixmap(const QString &strArch, QPixmap &pixmap)
|
---|
808 | {
|
---|
809 | #if 0
|
---|
810 | /* First create a pixmap and draw a background and text on it: */
|
---|
811 | QFontMetrics fontMetrics = qApp->fontMetrics();
|
---|
812 | QRect rect(0, 0, fontMetrics.boundingRect(strArch).width(), fontMetrics.boundingRect(strArch).height());
|
---|
813 | QPixmap textPixmap(rect.size());
|
---|
814 |
|
---|
815 | QPainter painter(&textPixmap);
|
---|
816 | QFont font = qApp->font();
|
---|
817 | font.setBold(true);
|
---|
818 | painter.setFont(font);
|
---|
819 | painter.setRenderHint(QPainter::Antialiasing);
|
---|
820 | painter.setRenderHint(QPainter::SmoothPixmapTransform);
|
---|
821 | painter.setRenderHint(QPainter::TextAntialiasing);
|
---|
822 | painter.setPen(QPen(Qt::black, 1));
|
---|
823 | painter.setBrush(QColor(255, 255, 255, 80));
|
---|
824 | painter.drawRect(rect);
|
---|
825 | painter.drawText(rect, Qt::AlignHCenter | Qt::AlignVCenter, strArch);
|
---|
826 |
|
---|
827 | /* Now draw that^^ pixmap onto our original pixmap:*/
|
---|
828 | QPainter originalPixmapPainter(&pixmap);
|
---|
829 | originalPixmapPainter.setRenderHint(QPainter::Antialiasing);
|
---|
830 | originalPixmapPainter.setRenderHint(QPainter::SmoothPixmapTransform);
|
---|
831 | QRect targetRect(QPoint(0, 0), QSize(0.34 * pixmap.rect().width(), 0.3 * pixmap.rect().height()));
|
---|
832 | originalPixmapPainter.drawPixmap(targetRect, textPixmap, textPixmap.rect());
|
---|
833 | #endif
|
---|
834 | #if 1
|
---|
835 | QFont font = qApp->font();
|
---|
836 | /* Set font' size wrt. @p pixmap height/dpr: */
|
---|
837 | font.setPixelSize(0.31 * pixmap.height() / pixmap.devicePixelRatio());
|
---|
838 | font.setBold(true);
|
---|
839 | QPainter painter(&pixmap);
|
---|
840 | painter.setFont(font);
|
---|
841 | /* Make a rectangle just a bit larger than text's bounding rect. to have some spacing around the text: */
|
---|
842 | int w = 1.2 * painter.fontMetrics().boundingRect(strArch).size().width();
|
---|
843 | int h = 1.0 * painter.fontMetrics().boundingRect(strArch).size().height();
|
---|
844 | QRect textRect(QPoint(0, 0), QSize(w, h));
|
---|
845 | painter.setRenderHint(QPainter::Antialiasing);
|
---|
846 | painter.setRenderHint(QPainter::SmoothPixmapTransform);
|
---|
847 | painter.setRenderHint(QPainter::TextAntialiasing);
|
---|
848 | painter.setPen(QPen(Qt::black, 1));
|
---|
849 | painter.setBrush(QColor(255, 255, 255, 200));
|
---|
850 | /* x and y radii are relative to rectangle's width and height and should be in [0, 100]: */
|
---|
851 | painter.drawRoundedRect(textRect, 50 /* xRadius */, 50 /* yRadius*/, Qt::RelativeSize);
|
---|
852 | painter.drawText(textRect, Qt::AlignHCenter | Qt::AlignVCenter, strArch);
|
---|
853 | #endif
|
---|
854 | }
|
---|