UIMachineLogicFullscreen.cpp revision af62929dce3cc5e14c75438cd2b893f82ae6dbc8
/* $Id$ */
/** @file
*
* VBox frontends: Qt GUI ("VirtualBox"):
* UIMachineLogicFullscreen class implementation
*/
/*
* Copyright (C) 2010 Sun Microsystems, Inc.
*
* 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.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
* Clara, CA 95054 USA or visit http://www.sun.com if you need
* additional information or have any questions.
*/
/* Global includes */
#include <QDesktopWidget>
/* Local includes */
#include "COMDefs.h"
#include "VBoxGlobal.h"
#include "VBoxProblemReporter.h"
#include "UIActionsPool.h"
#include "UIMachineLogicFullscreen.h"
#include "UIMachineWindow.h"
#include "UIMachineWindowFullscreen.h"
#include "UIMultiScreenLayout.h"
#include "UISession.h"
#ifdef Q_WS_MAC
# include "VBoxUtils.h"
#endif /* Q_WS_MAC */
UIMachineLogicFullscreen::UIMachineLogicFullscreen(QObject *pParent, UISession *pSession, UIActionsPool *pActionsPool)
{
m_pScreenLayout = new UIMultiScreenLayout(this);
}
{
/* Cleanup machine window: */
/* Cleanup action related stuff */
delete m_pScreenLayout;
}
{
/* Base class availability: */
if (!UIMachineLogic::checkAvailability())
return false;
/* Temporary get a machine object: */
/* Check that there are enough physical screens are connected: */
if (cHostScreens < cGuestScreens)
{
return false;
}
// TODO_NEW_CORE: this is how it looked in the old version
// bool VBoxConsoleView::isAutoresizeGuestActive() { return mGuestSupportsGraphics && mAutoresizeGuest; }
// if (uisession()->session().GetConsole().isAutoresizeGuestActive())
if (uisession()->isGuestAdditionsActive())
{
* _1M /* MB to bytes */
* 8; /* to bits */
for (int i = 0; i < cGuestScreens; ++ i)
{
// TODO_NEW_CORE: really take the screen geometry into account the
// different fb will be displayed. */
* guestBpp
}
{
// int result = vboxProblem().cannotEnterFullscreenMode(screen.width(), screen.height(), guestBpp,
// (((usedBits + 7) / 8 + _1M - 1) / _1M) * _1M);
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(actionsPool()->action(UIActionIndex_Toggle_Fullscreen)->text()));
/* Show the info message. */
return false;
return true;
}
void UIMachineLogicFullscreen::initialize()
{
/* Prepare required features: */
#ifdef Q_WS_MAC
/* Prepare common connections: */
#endif /* Q_WS_MAC */
/* Prepare console connections: */
/* Prepare action connections: */
/* Prepare action groups: */
/* Prepare machine window: */
#ifdef Q_WS_MAC
/* Prepare dock: */
prepareDock();
#endif /* Q_WS_MAC */
/* Power up machine: */
/* Initialization: */
/* Retranslate logic part: */
}
{
}
#ifdef Q_WS_MAC
{
/* Presentation mode connection */
}
#endif /* Q_WS_MAC */
{
/* Base class action groups: */
/* Adjust-window action isn't allowed in fullscreen: */
/* Add the view menu: */
}
{
/* Do not create window(s) if they created already: */
if (isMachineWindowsCreated())
return;
#ifdef Q_WS_MAC // TODO: Is that "darwinSetFrontMostProcess" 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: */
setPresentationModeEnabled(true);
#endif /* Q_WS_MAC */
/* Update the multi screen layout */
/* Create machine window(s): */
/* Order machine window(s): */
/* Remember what machine window(s) created: */
setMachineWindowsCreated(true);
}
{
/* Do not cleanup machine window if it is not present: */
if (!isMachineWindowsCreated())
return;
/* Cleanup normal machine window: */
#ifdef Q_WS_MAC
setPresentationModeEnabled(false);
#endif/* Q_WS_MAC */
}
{
/* Reenable adjust-window action: */
}
#ifdef Q_WS_MAC
void UIMachineLogicFullscreen::sltChangePresentationMode(const VBoxChangePresentationModeEvent & /* event */)
{
setPresentationModeEnabled(true);
}
{
if (fEnabled)
{
/* First check if we are on the primary screen, only than the
* presentation mode have to be changed. */
// TODO_NEW_CORE: we need some algorithm to decide which virtual screen
// is on which physical host display. Than we can decide on the
// presentation mode as well. */
// QDesktopWidget* pDesktop = QApplication::desktop();
// if (pDesktop->screenNumber(this) == pDesktop->primaryScreen())
{
QString testStr = vboxGlobal().virtualBox().GetExtraData(VBoxDefs::GUI_PresentationModeEnabled).toLower();
/* Default to false if it is an empty value */
else
}
}
else
}
#endif /* Q_WS_MAC */