VirtualBox

source: vbox/trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineMenuBar.cpp@ 49698

Last change on this file since 49698 was 49698, checked in by vboxsync, 11 years ago

FE/Qt: Runtime UI: Extra-data flags and handling for menus content configuration.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 20.9 KB
Line 
1/* $Id: UIMachineMenuBar.cpp 49698 2013-11-28 11:44:37Z vboxsync $ */
2/** @file
3 * VBox Qt GUI - UIMachineMenuBar class implementation.
4 */
5
6/*
7 * Copyright (C) 2010-2013 Oracle Corporation
8 *
9 * This file is part of VirtualBox Open Source Edition (OSE), as
10 * available from http://www.virtualbox.org. This file is free software;
11 * you can redistribute it and/or modify it under the terms of the GNU
12 * General Public License (GPL) as published by the Free Software
13 * Foundation, in version 2 as it comes in the "COPYING" file of the
14 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16 */
17
18/* Qt includes: */
19#include <QMenuBar>
20#include <QPainter>
21#include <QPaintEvent>
22#include <QPixmapCache>
23
24/* GUI includes: */
25#include "UIMachineMenuBar.h"
26#include "UISession.h"
27#include "UIActionPoolRuntime.h"
28#include "VBoxGlobal.h"
29#include "UIMessageCenter.h"
30#include "UIImageTools.h"
31#ifdef VBOX_GUI_WITH_NETWORK_MANAGER
32# include "UINetworkManager.h"
33#endif /* VBOX_GUI_WITH_NETWORK_MANAGER */
34
35/* COM includes: */
36#include "CMachine.h"
37
38
39/**
40 * QMenu sub-class with extended functionality.
41 * Allows to highlight first menu item for popped up menu.
42 */
43class QIMenu : public QMenu
44{
45 Q_OBJECT;
46
47public:
48
49 /** Constructor. */
50 QIMenu() : QMenu(0) {}
51
52private slots:
53
54 /** Highlights first menu action for popped up menu. */
55 void sltHighlightFirstAction()
56 {
57#ifdef Q_WS_WIN
58 activateWindow();
59#endif /* Q_WS_WIN */
60 QMenu::focusNextChild();
61 }
62};
63
64
65/**
66 * QMenuBar sub-class with extended functionality.
67 * Reflects BETA label when necessary.
68 */
69class UIMenuBar: public QMenuBar
70{
71 Q_OBJECT;
72
73public:
74
75 /** Constructor. */
76 UIMenuBar(QWidget *pParent = 0)
77 : QMenuBar(pParent)
78 , m_fShowBetaLabel(false)
79 {
80 /* Check for beta versions: */
81 if (vboxGlobal().isBeta())
82 m_fShowBetaLabel = true;
83 }
84
85protected:
86
87 /** Paint-event reimplementation. */
88 void paintEvent(QPaintEvent *pEvent)
89 {
90 QMenuBar::paintEvent(pEvent);
91 if (m_fShowBetaLabel)
92 {
93 QPixmap betaLabel;
94 const QString key("vbox:betaLabel");
95 if (!QPixmapCache::find(key, betaLabel))
96 {
97 betaLabel = ::betaLabel();
98 QPixmapCache::insert(key, betaLabel);
99 }
100 QSize s = size();
101 QPainter painter(this);
102 painter.setClipRect(pEvent->rect());
103 painter.drawPixmap(s.width() - betaLabel.width() - 10, (height() - betaLabel.height()) / 2, betaLabel);
104 }
105 }
106
107private:
108
109 /** Reflects whether we should show BETA label or not. */
110 bool m_fShowBetaLabel;
111};
112
113
114UIMachineMenuBar::UIMachineMenuBar(UISession *pSession)
115 : m_pSession(pSession)
116{
117}
118
119QMenu* UIMachineMenuBar::createMenu(RuntimeMenuType fOptions /* = RuntimeMenuType_All */)
120{
121 /* Create empty menu: */
122 QMenu *pMenu = new QIMenu;
123
124 /* Fill menu with prepared items: */
125 foreach (QMenu *pSubMenu, prepareSubMenus(fOptions))
126 pMenu->addMenu(pSubMenu);
127
128 /* Return filled menu: */
129 return pMenu;
130}
131
132QMenuBar* UIMachineMenuBar::createMenuBar(RuntimeMenuType fOptions /* = RuntimeMenuType_All */)
133{
134 /* Create empty menubar: */
135 QMenuBar *pMenuBar = new UIMenuBar;
136
137 /* Fill menubar with prepared items: */
138 foreach (QMenu *pSubMenu, prepareSubMenus(fOptions))
139 pMenuBar->addMenu(pSubMenu);
140
141 /* Return filled menubar: */
142 return pMenuBar;
143}
144
145QList<QMenu*> UIMachineMenuBar::prepareSubMenus(RuntimeMenuType fOptions /* = RuntimeMenuType_All */)
146{
147 /* Create empty submenu list: */
148 QList<QMenu*> preparedSubMenus;
149
150 /* Machine submenu: */
151 if (fOptions & RuntimeMenuType_Machine)
152 {
153 QMenu *pMenuMachine = gActionPool->action(UIActionIndexRuntime_Menu_Machine)->menu();
154 prepareMenuMachine(pMenuMachine);
155 preparedSubMenus << pMenuMachine;
156 }
157
158 /* View submenu: */
159 if (fOptions & RuntimeMenuType_View)
160 {
161 QMenu *pMenuView = gActionPool->action(UIActionIndexRuntime_Menu_View)->menu();
162 prepareMenuView(pMenuView);
163 preparedSubMenus << pMenuView;
164 }
165
166 /* Devices submenu: */
167 if (fOptions & RuntimeMenuType_Devices)
168 {
169 QMenu *pMenuDevices = gActionPool->action(UIActionIndexRuntime_Menu_Devices)->menu();
170 prepareMenuDevices(pMenuDevices);
171 preparedSubMenus << pMenuDevices;
172 }
173
174#ifdef VBOX_WITH_DEBUGGER_GUI
175 /* Debug submenu: */
176 if (fOptions & RuntimeMenuType_Debug)
177 {
178 CMachine machine = m_pSession->session().GetMachine();
179 if (vboxGlobal().isDebuggerEnabled(machine))
180 {
181 QMenu *pMenuDebug = gActionPool->action(UIActionIndexRuntime_Menu_Debug)->menu();
182 prepareMenuDebug(pMenuDebug);
183 preparedSubMenus << pMenuDebug;
184 }
185 }
186#endif /* VBOX_WITH_DEBUGGER_GUI */
187
188 /* Help submenu: */
189 if (fOptions & RuntimeMenuType_Help)
190 {
191 QMenu *pMenuHelp = gActionPool->action(UIActionIndex_Menu_Help)->menu();
192 prepareMenuHelp(pMenuHelp);
193 preparedSubMenus << pMenuHelp;
194 }
195
196 /* Return a list of prepared submenus: */
197 return preparedSubMenus;
198}
199
200void UIMachineMenuBar::prepareMenuMachine(QMenu *pMenu)
201{
202 /* Do not prepare if ready: */
203 if (!pMenu->isEmpty())
204 return;
205
206
207 /* Separator #1? */
208 bool fSeparator1 = false;
209
210 /* Settings Dialog action: */
211 if (m_pSession->allowedActionsMenuMachine() & RuntimeMenuMachineActionType_SettingsDialog)
212 {
213 pMenu->addAction(gActionPool->action(UIActionIndexRuntime_Simple_SettingsDialog));
214 fSeparator1 = true;
215 }
216 else
217 gActionPool->action(UIActionIndexRuntime_Simple_SettingsDialog)->setEnabled(false);
218 /* Take Snapshot action: */
219 if (m_pSession->allowedActionsMenuMachine() & RuntimeMenuMachineActionType_TakeSnapshot &&
220 m_pSession->isSnapshotOperationsAllowed())
221 {
222 pMenu->addAction(gActionPool->action(UIActionIndexRuntime_Simple_TakeSnapshot));
223 fSeparator1 = true;
224 }
225 else
226 gActionPool->action(UIActionIndexRuntime_Simple_TakeSnapshot)->setEnabled(false);
227 /* Take Screenshot action: */
228 if (m_pSession->allowedActionsMenuMachine() & RuntimeMenuMachineActionType_TakeScreenshot)
229 {
230 pMenu->addAction(gActionPool->action(UIActionIndexRuntime_Simple_TakeScreenshot));
231 fSeparator1 = true;
232 }
233 else
234 gActionPool->action(UIActionIndexRuntime_Simple_TakeScreenshot)->setEnabled(false);
235 /* Information Dialog action: */
236 if (m_pSession->allowedActionsMenuMachine() & RuntimeMenuMachineActionType_InformationDialog)
237 {
238 pMenu->addAction(gActionPool->action(UIActionIndexRuntime_Simple_InformationDialog));
239 fSeparator1 = true;
240 }
241 else
242 gActionPool->action(UIActionIndexRuntime_Simple_InformationDialog)->setEnabled(false);
243
244 /* Separator #1: */
245 if (fSeparator1)
246 pMenu->addSeparator();
247
248
249 /* Separator #2? */
250 bool fSeparator2 = false;
251
252 /* Mouse Integration action: */
253 if (m_pSession->allowedActionsMenuMachine() & RuntimeMenuMachineActionType_MouseIntegration)
254 {
255 pMenu->addAction(gActionPool->action(UIActionIndexRuntime_Toggle_MouseIntegration));
256 fSeparator2 = true;
257 }
258 else
259 gActionPool->action(UIActionIndexRuntime_Toggle_MouseIntegration)->setEnabled(false);
260
261 /* Separator #2: */
262 if (fSeparator2)
263 pMenu->addSeparator();
264
265
266 /* Separator #3? */
267 bool fSeparator3 = false;
268
269 /* Type CAD action: */
270 if (m_pSession->allowedActionsMenuMachine() & RuntimeMenuMachineActionType_TypeCAD)
271 {
272 pMenu->addAction(gActionPool->action(UIActionIndexRuntime_Simple_TypeCAD));
273 fSeparator3 = true;
274 }
275 else
276 gActionPool->action(UIActionIndexRuntime_Simple_TypeCAD)->setEnabled(false);
277#ifdef Q_WS_X11
278 /* Type CABS action: */
279 if (m_pSession->allowedActionsMenuMachine() & RuntimeMenuMachineActionType_TypeCABS)
280 {
281 pMenu->addAction(gActionPool->action(UIActionIndexRuntime_Simple_TypeCABS));
282 fSeparator3 = true;
283 }
284 else
285 gActionPool->action(UIActionIndexRuntime_Simple_TypeCABS)->setEnabled(false);
286#endif /* Q_WS_X11 */
287
288 /* Separator #3: */
289 if (fSeparator3)
290 pMenu->addSeparator();
291
292
293 /* Separator #4? */
294 bool fSeparator4 = false;
295
296 /* Pause action: */
297 if (m_pSession->allowedActionsMenuMachine() & RuntimeMenuMachineActionType_Pause)
298 {
299 pMenu->addAction(gActionPool->action(UIActionIndexRuntime_Toggle_Pause));
300 fSeparator4 = true;
301 }
302 else
303 gActionPool->action(UIActionIndexRuntime_Toggle_Pause)->setEnabled(false);
304 /* Reset action: */
305 if (m_pSession->allowedActionsMenuMachine() & RuntimeMenuMachineActionType_Reset)
306 {
307 pMenu->addAction(gActionPool->action(UIActionIndexRuntime_Simple_Reset));
308 fSeparator4 = true;
309 }
310 else
311 gActionPool->action(UIActionIndexRuntime_Simple_Reset)->setEnabled(false);
312 /* SaveState action: */
313 if (!(m_pSession->allowedActionsMenuMachine() & RuntimeMenuMachineActionType_SaveState))
314 gActionPool->action(UIActionIndexRuntime_Simple_Save)->setEnabled(false);
315 /* Shutdown action: */
316 if (m_pSession->allowedActionsMenuMachine() & RuntimeMenuMachineActionType_Shutdown)
317 {
318 pMenu->addAction(gActionPool->action(UIActionIndexRuntime_Simple_Shutdown));
319 fSeparator4 = true;
320 }
321 else
322 gActionPool->action(UIActionIndexRuntime_Simple_Shutdown)->setEnabled(false);
323 /* PowerOff action: */
324 if (!(m_pSession->allowedActionsMenuMachine() & RuntimeMenuMachineActionType_PowerOff))
325 gActionPool->action(UIActionIndexRuntime_Simple_PowerOff)->setEnabled(false);
326
327#ifndef Q_WS_MAC
328 /* Separator #3: */
329 if (fSeparator4)
330 pMenu->addSeparator();
331#endif /* !Q_WS_MAC */
332
333
334 /* Close action: */
335 pMenu->addAction(gActionPool->action(UIActionIndexRuntime_Simple_Close));
336 if (m_pSession->isAllCloseActionsRestricted())
337 gActionPool->action(UIActionIndexRuntime_Simple_Close)->setEnabled(false);
338}
339
340void UIMachineMenuBar::prepareMenuView(QMenu *pMenu)
341{
342 /* Do not prepare if ready: */
343 if (!pMenu->isEmpty())
344 return;
345
346
347 /* Mode flags: */
348 bool fIsAllowedFullscreen = m_pSession->isVisualStateAllowedFullscreen() &&
349 (m_pSession->allowedActionsMenuView() & RuntimeMenuViewActionType_Fullscreen);
350 bool fIsAllowedSeamless = m_pSession->isVisualStateAllowedSeamless() &&
351 (m_pSession->allowedActionsMenuView() & RuntimeMenuViewActionType_Seamless);
352 bool fIsAllowedScale = m_pSession->isVisualStateAllowedScale() &&
353 (m_pSession->allowedActionsMenuView() & RuntimeMenuViewActionType_Scale);
354
355 /* Fullscreen action: */
356 gActionPool->action(UIActionIndexRuntime_Toggle_Fullscreen)->setEnabled(fIsAllowedFullscreen);
357 if (fIsAllowedFullscreen)
358 pMenu->addAction(gActionPool->action(UIActionIndexRuntime_Toggle_Fullscreen));
359
360 /* Seamless action: */
361 gActionPool->action(UIActionIndexRuntime_Toggle_Seamless)->setEnabled(fIsAllowedSeamless);
362 if (fIsAllowedSeamless)
363 pMenu->addAction(gActionPool->action(UIActionIndexRuntime_Toggle_Seamless));
364
365 /* Scale action: */
366 gActionPool->action(UIActionIndexRuntime_Toggle_Scale)->setEnabled(fIsAllowedScale);
367 if (fIsAllowedScale)
368 pMenu->addAction(gActionPool->action(UIActionIndexRuntime_Toggle_Scale));
369
370 /* Mode separator: */
371 if (fIsAllowedFullscreen || fIsAllowedSeamless || fIsAllowedScale)
372 pMenu->addSeparator();
373
374
375 /* Guest Autoresize action: */
376 if (m_pSession->allowedActionsMenuView() & RuntimeMenuViewActionType_GuestAutoresize)
377 pMenu->addAction(gActionPool->action(UIActionIndexRuntime_Toggle_GuestAutoresize));
378 else
379 gActionPool->action(UIActionIndexRuntime_Toggle_GuestAutoresize)->setEnabled(false);
380
381 /* Adjust Window action: */
382 if (m_pSession->allowedActionsMenuView() & RuntimeMenuViewActionType_AdjustWindow)
383 pMenu->addAction(gActionPool->action(UIActionIndexRuntime_Simple_AdjustWindow));
384 else
385 gActionPool->action(UIActionIndexRuntime_Simple_AdjustWindow)->setEnabled(false);
386}
387
388void UIMachineMenuBar::prepareMenuDevices(QMenu *pMenu)
389{
390 /* Do not prepare if ready: */
391 if (!pMenu->isEmpty())
392 return;
393
394
395 /* Separator #1? */
396 bool fSeparator1 = false;
397
398 /* Optical Devices submenu: */
399 if (m_pSession->allowedActionsMenuDevices() & RuntimeMenuDevicesActionType_OpticalDevices)
400 {
401 pMenu->addAction(gActionPool->action(UIActionIndexRuntime_Menu_OpticalDevices));
402 fSeparator1 = true;
403 }
404 else
405 gActionPool->action(UIActionIndexRuntime_Menu_OpticalDevices)->setEnabled(false);
406 /* Floppy Devices submenu: */
407 if (m_pSession->allowedActionsMenuDevices() & RuntimeMenuDevicesActionType_FloppyDevices)
408 {
409 pMenu->addAction(gActionPool->action(UIActionIndexRuntime_Menu_FloppyDevices));
410 fSeparator1 = true;
411 }
412 else
413 gActionPool->action(UIActionIndexRuntime_Menu_FloppyDevices)->setEnabled(false);
414 /* USB Devices submenu: */
415 if (m_pSession->allowedActionsMenuDevices() & RuntimeMenuDevicesActionType_USBDevices)
416 {
417 pMenu->addAction(gActionPool->action(UIActionIndexRuntime_Menu_USBDevices));
418 fSeparator1 = true;
419 }
420 else
421 gActionPool->action(UIActionIndexRuntime_Menu_USBDevices)->setEnabled(false);
422 /* Web Cams submenu: */
423 if (m_pSession->allowedActionsMenuDevices() & RuntimeMenuDevicesActionType_WebCams)
424 {
425 pMenu->addAction(gActionPool->action(UIActionIndexRuntime_Menu_WebCams));
426 fSeparator1 = true;
427 }
428 else
429 gActionPool->action(UIActionIndexRuntime_Menu_WebCams)->setEnabled(false);
430 /* Shared Clipboard submenu: */
431 if (m_pSession->allowedActionsMenuDevices() & RuntimeMenuDevicesActionType_SharedClipboard)
432 {
433 pMenu->addAction(gActionPool->action(UIActionIndexRuntime_Menu_SharedClipboard));
434 fSeparator1 = true;
435 }
436 else
437 gActionPool->action(UIActionIndexRuntime_Menu_SharedClipboard)->setEnabled(false);
438 /* Drag&Drop submenu: */
439 if (m_pSession->allowedActionsMenuDevices() & RuntimeMenuDevicesActionType_DragAndDrop)
440 {
441 pMenu->addAction(gActionPool->action(UIActionIndexRuntime_Menu_DragAndDrop));
442 fSeparator1 = true;
443 }
444 else
445 gActionPool->action(UIActionIndexRuntime_Menu_DragAndDrop)->setEnabled(false);
446 /* Network Settings action: */
447 if (m_pSession->allowedActionsMenuDevices() & RuntimeMenuDevicesActionType_NetworkSettings)
448 {
449 pMenu->addAction(gActionPool->action(UIActionIndexRuntime_Simple_NetworkSettings));
450 fSeparator1 = true;
451 }
452 else
453 gActionPool->action(UIActionIndexRuntime_Simple_NetworkSettings)->setEnabled(false);
454 /* Shared Folders Settings action: */
455 if (m_pSession->allowedActionsMenuDevices() & RuntimeMenuDevicesActionType_SharedFoldersSettings)
456 {
457 pMenu->addAction(gActionPool->action(UIActionIndexRuntime_Simple_SharedFoldersSettings));
458 fSeparator1 = true;
459 }
460 else
461 gActionPool->action(UIActionIndexRuntime_Simple_SharedFoldersSettings)->setEnabled(false);
462
463 /* Separator #1: */
464 if (fSeparator1)
465 pMenu->addSeparator();
466
467
468 /* Separator #2? */
469 bool fSeparator2 = false;
470
471 /* VRDE Server action: */
472 if (m_pSession->allowedActionsMenuDevices() & RuntimeMenuDevicesActionType_VRDEServer)
473 {
474 pMenu->addAction(gActionPool->action(UIActionIndexRuntime_Toggle_VRDEServer));
475 fSeparator2 = true;
476 }
477 else
478 gActionPool->action(UIActionIndexRuntime_Toggle_VRDEServer)->setEnabled(false);
479 /* Video Capture action: */
480 if (m_pSession->allowedActionsMenuDevices() & RuntimeMenuDevicesActionType_VideoCapture)
481 {
482 pMenu->addAction(gActionPool->action(UIActionIndexRuntime_Toggle_VideoCapture));
483 fSeparator2 = true;
484 }
485 else
486 gActionPool->action(UIActionIndexRuntime_Toggle_VideoCapture)->setEnabled(false);
487
488 /* Separator #2: */
489 if (fSeparator2)
490 pMenu->addSeparator();
491
492
493 /* Install Guest Tools action: */
494 if (m_pSession->allowedActionsMenuDevices() & RuntimeMenuDevicesActionType_InstallGuestTools)
495 pMenu->addAction(gActionPool->action(UIActionIndexRuntime_Simple_InstallGuestTools));
496 else
497 gActionPool->action(UIActionIndexRuntime_Simple_InstallGuestTools)->setEnabled(false);
498}
499
500#ifdef VBOX_WITH_DEBUGGER_GUI
501void UIMachineMenuBar::prepareMenuDebug(QMenu *pMenu)
502{
503 /* Do not prepare if ready: */
504 if (!pMenu->isEmpty())
505 return;
506
507 /* Statistics action: */
508 if (m_pSession->allowedActionsMenuDebugger() & RuntimeMenuDebuggerActionType_Statistics)
509 pMenu->addAction(gActionPool->action(UIActionIndexRuntime_Simple_Statistics));
510 else
511 gActionPool->action(UIActionIndexRuntime_Simple_Statistics)->setEnabled(false);
512 /* Command Line action: */
513 if (m_pSession->allowedActionsMenuDebugger() & RuntimeMenuDebuggerActionType_CommandLine)
514 pMenu->addAction(gActionPool->action(UIActionIndexRuntime_Simple_CommandLine));
515 else
516 gActionPool->action(UIActionIndexRuntime_Simple_CommandLine)->setEnabled(false);
517 /* Logging action: */
518 if (m_pSession->allowedActionsMenuDebugger() & RuntimeMenuDebuggerActionType_Logging)
519 pMenu->addAction(gActionPool->action(UIActionIndexRuntime_Toggle_Logging));
520 else
521 gActionPool->action(UIActionIndexRuntime_Toggle_Logging)->setEnabled(false);
522 /* Log Dialog action: */
523 if (m_pSession->allowedActionsMenuDebugger() & RuntimeMenuDebuggerActionType_LogDialog)
524 pMenu->addAction(gActionPool->action(UIActionIndex_Simple_LogDialog));
525 else
526 gActionPool->action(UIActionIndex_Simple_LogDialog)->setEnabled(false);
527}
528#endif /* VBOX_WITH_DEBUGGER_GUI */
529
530void UIMachineMenuBar::prepareMenuHelp(QMenu *pMenu)
531{
532 /* Do not prepare if ready: */
533 if (!pMenu->isEmpty())
534 return;
535
536
537 /* Separator #1? */
538 bool fSeparator1 = false;
539
540 /* Contents action: */
541 if (m_pSession->allowedActionsMenuHelp() & RuntimeMenuHelpActionType_Contents)
542 {
543 pMenu->addAction(gActionPool->action(UIActionIndex_Simple_Contents));
544 VBoxGlobal::connect(gActionPool->action(UIActionIndex_Simple_Contents), SIGNAL(triggered()),
545 &msgCenter(), SLOT(sltShowHelpHelpDialog()));
546 fSeparator1 = true;
547 }
548 else
549 gActionPool->action(UIActionIndex_Simple_Contents)->setEnabled(false);
550 /* Web Site action: */
551 if (m_pSession->allowedActionsMenuHelp() & RuntimeMenuHelpActionType_WebSite)
552 {
553 pMenu->addAction(gActionPool->action(UIActionIndex_Simple_WebSite));
554 VBoxGlobal::connect(gActionPool->action(UIActionIndex_Simple_WebSite), SIGNAL(triggered()),
555 &msgCenter(), SLOT(sltShowHelpWebDialog()));
556 fSeparator1 = true;
557 }
558 else
559 gActionPool->action(RuntimeMenuHelpActionType_WebSite)->setEnabled(false);
560
561 /* Separator #1: */
562 if (fSeparator1)
563 pMenu->addSeparator();
564
565
566 /* Separator #2? */
567 bool fSeparator2 = false;
568
569 /* Reset Warnings action: */
570 if (m_pSession->allowedActionsMenuHelp() & RuntimeMenuHelpActionType_ResetWarnings)
571 {
572 pMenu->addAction(gActionPool->action(UIActionIndex_Simple_ResetWarnings));
573 VBoxGlobal::connect(gActionPool->action(UIActionIndex_Simple_ResetWarnings), SIGNAL(triggered()),
574 &msgCenter(), SLOT(sltResetSuppressedMessages()));
575 fSeparator2 = true;
576 }
577 else
578 gActionPool->action(UIActionIndex_Simple_ResetWarnings)->setEnabled(false);
579
580 /* Separator #2: */
581 if (fSeparator2)
582 pMenu->addSeparator();
583
584
585#ifdef VBOX_GUI_WITH_NETWORK_MANAGER
586# ifndef Q_WS_MAC
587 /* Separator #3? */
588 bool fSeparator3 = false;
589# endif /* !Q_WS_MAC */
590
591 /* Reset Warnings action: */
592 if (m_pSession->allowedActionsMenuHelp() & RuntimeMenuHelpActionType_NetworkAccessManager)
593 {
594 pMenu->addAction(gActionPool->action(UIActionIndex_Simple_NetworkAccessManager));
595 VBoxGlobal::connect(gActionPool->action(UIActionIndex_Simple_NetworkAccessManager), SIGNAL(triggered()),
596 gNetworkManager, SLOT(show()));
597# ifndef Q_WS_MAC
598 fSeparator3 = true;
599# endif /* !Q_WS_MAC */
600 }
601 else
602 gActionPool->action(UIActionIndex_Simple_NetworkAccessManager)->setEnabled(false);
603
604# ifndef Q_WS_MAC
605 /* Separator #3: */
606 if (fSeparator3)
607 pMenu->addSeparator();
608# endif /* !Q_WS_MAC */
609#endif /* VBOX_GUI_WITH_NETWORK_MANAGER */
610
611
612 /* About action: */
613#ifdef Q_WS_MAC
614 if (m_pSession->allowedActionsMenuApplication() & RuntimeMenuApplicationActionType_About)
615#else /* !Q_WS_MAC */
616 if (m_pSession->allowedActionsMenuHelp() & RuntimeMenuHelpActionType_About)
617#endif /* Q_WS_MAC */
618 {
619 pMenu->addAction(gActionPool->action(UIActionIndex_Simple_About));
620 VBoxGlobal::connect(gActionPool->action(UIActionIndex_Simple_About), SIGNAL(triggered()),
621 &msgCenter(), SLOT(sltShowHelpAboutDialog()));
622 }
623 else
624 gActionPool->action(UIActionIndex_Simple_About)->setEnabled(false);
625}
626
627#include "UIMachineMenuBar.moc"
628
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette