UIMachineLogicSeamless.cpp revision c7769c4b7e84511fcc4a12a85a04dd7fbfd82b46
/* $Id$ */
/** @file
* VBox Qt GUI - UIMachineLogicSeamless class implementation.
*/
/*
* Copyright (C) 2010-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.
*/
/* Qt includes: */
#include <QDesktopWidget>
/* GUI includes: */
#include "VBoxGlobal.h"
#include "UIMessageCenter.h"
#include "UIPopupCenter.h"
#include "UISession.h"
#include "UIActionPoolRuntime.h"
#include "UIMachineLogicSeamless.h"
#include "UIMachineWindowSeamless.h"
#include "UIMultiScreenLayout.h"
#ifdef Q_WS_MAC
# include "VBoxUtils.h"
#endif /* Q_WS_MAC */
{
/* Create multiscreen layout: */
m_pScreenLayout = new UIMultiScreenLayout(this);
}
{
/* Delete multiscreen layout: */
delete m_pScreenLayout;
}
{
/* Temporary get a machine object: */
/* Check if there is enough physical memory to enter seamless: */
if (uisession()->isGuestAdditionsActive())
{
{
msgCenter().cannotEnterSeamlessMode(0, 0, 0,
return false;
}
}
/* Take the toggle hot key from the menu item.
* Since VBoxGlobal::extractKeyFromActionText gets exactly
* the linked key without the 'Host+' part we are adding it here. */
.arg(VBoxGlobal::extractKeyFromActionText(gActionPool->action(UIActionIndexRuntime_Toggle_Seamless)->text()));
/* Show the info message. */
return false;
return true;
}
{
/* We should rebuild screen-layout: */
/* We should update machine-windows sizes: */
}
{
}
{
}
{
/* If active machine-window is defined now: */
if (activeMachineWindow())
{
/* Reinstall corresponding popup-stack and make sure it has proper type: */
}
}
{
/* Call to base-class: */
/* If machine-state changed from 'paused' to 'running': */
{
LogRelFlow(("UIMachineLogicSeamless: "
"Machine-state changed from 'paused' to 'running': "
"Updating screen-layout...\n"));
/* Make sure further code will be called just once: */
/* We should rebuild screen-layout: */
/* We should update machine-windows sizes: */
}
}
void UIMachineLogicSeamless::sltGuestMonitorChange(KGuestMonitorChangedEventType changeType, ulong uScreenId, QRect screenGeo)
{
LogRelFlow(("UIMachineLogicSeamless: Guest-screen count changed.\n"));
/* Update multi-screen layout before any window update: */
/* Call to base-class: */
}
{
LogRelFlow(("UIMachineLogicSeamless: Host-screen count changed.\n"));
/* Update multi-screen layout before any window update: */
/* Call to base-class: */
}
{
/* Call to base-class: */
/* Guest auto-resize isn't allowed in seamless: */
/* Adjust-window isn't allowed in seamless: */
/* Disable mouse-integration isn't allowed in seamless: */
/* Take care of view-action toggle state: */
if (!pActionSeamless->isChecked())
{
pActionSeamless->blockSignals(true);
pActionSeamless->setChecked(true);
pActionSeamless->blockSignals(false);
}
}
{
/* Call to base-class: */
/* "View" actions connections: */
}
{
/* Do not create machine-window(s) if they created already: */
if (isMachineWindowsCreated())
return;
#ifdef Q_WS_MAC // TODO: Is that really need here?
/* We have to make sure that we are getting the front most process.
* This is necessary for Qt versions > 4.3.3: */
#endif /* Q_WS_MAC */
/* Update the multi-screen layout: */
/* Create machine window(s): */
/* Connect multi-screen layout change handler: */
for (int i = 0; i < machineWindows().size(); ++i)
/* Mark machine-window(s) created: */
setMachineWindowsCreated(true);
}
void UIMachineLogicSeamless::prepareMenu()
{
/* Call to base-class: */
/* Finally update view-menu: */
}
{
/* Do not destroy machine-window(s) if they destroyed already: */
if (!isMachineWindowsCreated())
return;
/* Mark machine-window(s) destroyed: */
setMachineWindowsCreated(false);
/* Cleanup machine-window(s): */
}
{
/* "View" actions connections: */
/* Call to base-class: */
}
{
/* Take care of view-action toggle state: */
if (pActionSeamless->isChecked())
{
pActionSeamless->blockSignals(true);
pActionSeamless->setChecked(false);
pActionSeamless->blockSignals(false);
}
/* Reenable guest-autoresize action: */
/* Reenable adjust-window action: */
/* Reenable mouse-integration action: */
/* Call to base-class: */
}