UIPopupCenter.cpp revision 27a76824c2115a7594095315c069f289388d4355
/* $Id$ */
/** @file
*
* VBox frontends: Qt GUI ("VirtualBox"):
* UIPopupCenter class implementation
*/
/*
* Copyright (C) 2013 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
* General Public License (GPL) as published by the Free Software
* Foundation, in version 2 as it comes in the "COPYING" file of the
* VirtualBox OSE distribution. VirtualBox OSE is distributed in the
* hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
*/
/* GUI includes: */
#include "UIPopupCenter.h"
#include "UIPopupStack.h"
#include "UIMachineWindow.h"
#include "QIMessageBox.h"
#include "VBoxGlobal.h"
#include "UIHostComboEditor.h"
/* Other VBox includes: */
/* static */
/* static */
void UIPopupCenter::create()
{
/* Make sure instance is NOT created yet: */
if (m_spInstance)
return;
/* Create instance: */
new UIPopupCenter;
/* Prepare instance: */
m_spInstance->prepare();
}
/* static */
void UIPopupCenter::destroy()
{
/* Make sure instance is NOT destroyed yet: */
if (!m_spInstance)
return;
/* Cleanup instance: */
m_spInstance->cleanup();
/* Destroy instance: */
delete m_spInstance;
}
{
/* Assign instance: */
m_spInstance = this;
}
{
/* Unassign instance: */
m_spInstance = 0;
}
void UIPopupCenter::prepare()
{
}
void UIPopupCenter::cleanup()
{
/* Make sure all the popup-stack types destroyed: */
/* Make sure all the popup-stacks destroyed: */
{
delete m_stacks[strPopupStackID];
}
}
{
/* Make sure parent is set! */
/* Make sure corresponding popup-stack *exists*: */
return;
/* Assign stack with passed parent: */
pPopupStack->show();
}
{
/* Make sure parent is set! */
/* Make sure corresponding popup-stack *exists*: */
return;
/* Unassign stack with passed parent: */
pPopupStack->hide();
}
{
/* Make sure parent is set! */
/* Composing corresponding popup-stack ID: */
/* Looking for current popup-stack type, create if it doesn't exists: */
/* Make sure stack-type has changed: */
if (stackType == newStackType)
return;
/* Remember new stack type: */
LogRelFlow(("UIPopupCenter::setPopupStackType: Changing type of popup-stack with ID = '%s' from '%s' to '%s'.\n",
}
void UIPopupCenter::setPopupStackOrientation(QWidget *pParent, UIPopupStackOrientation newStackOrientation)
{
/* Make sure parent is set! */
/* Composing corresponding popup-stack ID: */
/* Looking for current popup-stack orientation, create if it doesn't exists: */
/* Make sure stack-orientation has changed: */
if (stackOrientation == newStackOrientation)
return;
/* Remember new stack orientation: */
LogRelFlow(("UIPopupCenter::setPopupStackType: Changing orientation of popup-stack with ID = '%s' from '%s' to '%s'.\n",
/* Update orientation for popup-stack if it currently exists: */
}
bool fProposeAutoConfirmation /* = false*/)
{
}
const QString &strMessage)
{
}
const QString &strMessage,
bool fProposeAutoConfirmation /* = false*/)
{
QString() /* 2nd button text */,
}
const QString &strMessage,
bool fProposeAutoConfirmation /* = false*/)
{
}
{
}
bool fProposeAutoConfirmation /* = false*/)
{
/* Make sure parent is set! */
/* Prepare buttons: */
int iButton1 = 0;
int iButton2 = 0;
/* Make sure single button is properly configured: */
/* Make sure buttons are unique if set both: */
{
/* If user made a mistake in button names, we will fix that: */
if (strButtonText1 == strButtonText2)
{
}
}
/* Check if popup-pane was auto-confirmed before: */
{
QStringList confirmedPopupList = vboxGlobal().virtualBox().GetExtraData(GUI_SuppressMessages).split(',');
{
else if (iButton2 & AlertButtonOption_Default)
return;
}
}
/* Looking for corresponding popup-stack: */
UIPopupStack *pPopupStack = 0;
/* If there is already popup-stack with such ID: */
{
/* Just get existing one: */
}
/* If there is no popup-stack with such ID: */
else
{
/* Create new one: */
pPopupStack = m_stacks[strPopupStackID] = new UIPopupStack(strPopupStackID, m_stackOrientations[strPopupStackID]);
/* Attach popup-stack connections: */
connect(pPopupStack, SIGNAL(sigPopupPaneDone(QString, int)), this, SLOT(sltPopupPaneDone(QString, int)));
}
/* If there is already popup-pane with such ID: */
{
/* Just update existing one: */
}
/* If there is no popup-pane with such ID: */
else
{
/* Compose button description map: */
if (iButton1 != 0)
if (iButton2 != 0)
/* Create new one: */
}
/* Show popup-stack: */
}
{
/* Make sure parent is set! */
/* Make sure corresponding popup-stack *exists*: */
return;
/* Make sure corresponding popup-pane *exists*: */
return;
/* Recall corresponding popup-pane: */
}
{
/* Was the result auto-confirmated? */
{
/* Remember auto-confirmation fact: */
QStringList confirmedPopupList = vboxGlobal().virtualBox().GetExtraData(GUI_SuppressMessages).split(',');
}
/* Notify listeners: */
}
{
/* Make sure corresponding popup-stack *exists*: */
{
AssertMsgFailed(("Popup-stack already destroyed!\n"));
return;
}
/* Delete popup-stack asyncronously.
* To avoid issues with events which already posted: */
}
/* static */
{
/* Make sure parent is set! */
/* Special handling for Runtime UI: */
return QString("UIMachineWindow");
/* Common handling for other cases: */
}
/* static */
void UIPopupCenter::assignPopupStackParent(UIPopupStack *pPopupStack, QWidget *pParent, UIPopupStackType stackType)
{
/* Make sure parent is set! */
/* Assign event-filter: */
/* Assign parent depending on passed *stack* type: */
switch (stackType)
{
{
break;
}
{
break;
}
default: break;
}
}
/* static */
{
/* Make sure parent is set! */
/* Unassign parent: */
pPopupStack->setParent(0);
/* Unassign event-filter: */
}
{
QApplication::translate("UIMessageCenter", "You are trying to shut down the guest with the ACPI power button. "
"This is currently not possible because the guest does not support software shutdown."));
}
{
QApplication::translate("UIMessageCenter", "<p>You have the <b>Auto capture keyboard</b> option turned on. "
"This will cause the Virtual Machine to automatically <b>capture</b> "
"the keyboard every time the VM window is activated and make it "
"unavailable to other applications running on your host machine: "
"when the keyboard is captured, all keystrokes (including system ones "
"like Alt-Tab) will be directed to the VM.</p>"
"<p>You can press the <b>host key</b> at any time to <b>uncapture</b> the "
"keyboard and mouse (if it is captured) and return them to normal "
"operation. The currently assigned host key is shown on the status bar "
"at the bottom of the Virtual Machine window, next to the "
"<img src=:/hostkey_16px.png/> icon. This icon, together "
"with the mouse icon placed nearby, indicate the current keyboard "
"and mouse capture state.</p>") +
QApplication::translate("UIMessageCenter", "<p>The host key is currently defined as <b>%1</b>.</p>",
"additional message box paragraph")
true);
}
{
if (fSupportsAbsolute)
{
QApplication::translate("UIMessageCenter", "<p>The Virtual Machine reports that the guest OS supports <b>mouse pointer integration</b>. "
"This means that you do not need to <i>capture</i> the mouse pointer to be able to use it in your guest OS -- "
"all mouse actions you perform when the mouse pointer is over the Virtual Machine's display "
"are directly sent to the guest OS. If the mouse is currently captured, it will be automatically uncaptured.</p>"
"<p>The mouse icon on the status bar will look like <img src=:/mouse_seamless_16px.png/> to inform you "
"that mouse pointer integration is supported by the guest OS and is currently turned on.</p>"
"<p><b>Note</b>: Some applications may behave incorrectly in mouse pointer integration mode. "
"You can always disable it for the current session (and enable it again) "
"by selecting the corresponding action from the menu bar.</p>"),
true);
}
else
{
QApplication::translate("UIMessageCenter", "<p>The Virtual Machine reports that the guest OS does not support <b>mouse pointer integration</b> "
"in the current video mode. You need to capture the mouse (by clicking over the VM display "
"or pressing the host key) in order to use the mouse inside the guest OS.</p>"),
true);
}
}
{
QApplication::translate("UIMessageCenter", "<p>The Virtual Machine is currently in the <b>Paused</b> state and not able to see any keyboard or mouse input. "
"If you want to continue to work inside the VM, you need to resume it by selecting the corresponding action "
"from the menu bar.</p>"),
true);
}
{
}
{
QApplication::translate("UIMessageCenter", "<p>The virtual machine window is optimized to work in <b>%1 bit</b> color mode "
"but the virtual display is currently set to <b>%2 bit</b>.</p>"
"<p>Please open the display properties dialog of the guest OS and select a <b>%3 bit</b> color mode, "
"if it is available, for best possible performance of the virtual video subsystem.</p>"
"<p><b>Note</b>. Some operating systems, like OS/2, may actually work in 32 bit mode "
"but report it as 24 bit (16 million colors). You may try to select a different color "
"mode to see if this message disappears or you can simply disable the message now "
"if you are sure the required color mode (%4 bit) is not available in the guest OS.</p>")
true);
}
{
}