UIMachineWindowFullscreen.cpp revision 636c1d4a4a3c99faa799d834c46ef21923302da6
/* $Id$ */
/** @file
*
* VBox frontends: Qt GUI ("VirtualBox"):
* UIMachineWindowFullscreen 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>
#include <QMenuBar>
#include <QTimer>
#include <QContextMenuEvent>
/* Local includes */
#include "VBoxGlobal.h"
#include "UISession.h"
#include "UIActionsPool.h"
#include "UIMachineLogic.h"
#include "UIMachineView.h"
#include "UIMachineWindowFullscreen.h"
UIMachineWindowFullscreen::UIMachineWindowFullscreen(UIMachineLogic *pMachineLogic, ulong uScreenId)
{
/* "This" is machine window: */
m_pMachineWindow = this;
/* Prepare window icon: */
/* Prepare console connections: */
/* Prepare menu: */
prepareMenu();
/* Prepare connections: */
/* Retranslate normal window finally: */
/* Prepare machine view container: */
/* Prepare normal machine view: */
/* Load normal window settings: */
/* Update all the elements: */
/* Show window: */
// show();
}
{
/* Save normal window settings: */
/* Cleanup normal machine view: */
}
{
}
{
if (type == KDeviceType_HardDisk)
if (type == KDeviceType_DVD)
if (type == KDeviceType_Floppy)
}
{
}
{
}
{
}
{
}
void UIMachineWindowFullscreen::sltTryClose()
{
}
void UIMachineWindowFullscreen::sltProcessGlobalSettingChange(const char * /* aPublicName */, const char * /* aName */)
{
}
{
/* Translate parent class: */
#ifdef Q_WS_MAC
// TODO_NEW_CORE
// m_pDockSettingsMenu->setTitle(tr("Dock Icon"));
// m_pDockDisablePreview->setText(tr("Show Application Icon"));
// m_pDockEnablePreviewMonitor->setText(tr("Show Monitor Preview"));
#endif /* Q_WS_MAC */
}
{
/* Update parent-class window: */
}
{
// TODO_NEW_CORE
{
{
if (!isMaximized())
{
#ifdef VBOX_WITH_DEBUGGER_GUI
// TODO: Update debugger window size!
//dbgAdjustRelativePos();
#endif
}
break;
}
{
if (!isMaximized())
{
#ifdef VBOX_WITH_DEBUGGER_GUI
// TODO: Update debugger window position!
//dbgAdjustRelativePos();
#endif
}
break;
}
default:
break;
}
}
#ifdef Q_WS_X11
{
/* Qt bug: when the console view grabs the keyboard, FocusIn, FocusOut,
* WindowActivate and WindowDeactivate Qt events are not properly sent
* on top level window (i.e. this) deactivation. The fix is to substiute
* the mode in FocusOut X11 event structure to NotifyNormal to cause
* Qt to process it as desired. */
{
{
}
}
return false;
}
#endif
{
}
{
/* Base-class connections: */
/* Medium change updater: */
/* USB controller change updater: */
this, SLOT(sltUSBControllerChange()));
/* USB device state-change updater: */
connect(machineLogic()->uisession(), SIGNAL(sigUSBDeviceStateChange(const CUSBDevice &, bool, const CVirtualBoxErrorInfo &)),
this, SLOT(sltUSBDeviceStateChange()));
/* Network adapter change updater: */
this, SLOT(sltNetworkAdapterChange()));
/* Shared folder change updater: */
this, SLOT(sltSharedFolderChange()));
}
void UIMachineWindowFullscreen::prepareMenu()
{
/* Menubar is always hidden in fullscreen */
}
{
/* Setup global settings change updater: */
this, SLOT(sltProcessGlobalSettingChange(const char *, const char *)));
}
{
#ifdef VBOX_WITH_VIDEOHWACCEL
/* Need to force the QGL framebuffer in case 2D Video Acceleration is supported & enabled: */
bool bAccelerate2DVideo = session().GetMachine().GetAccelerate2DVideoEnabled() && VBoxGlobal::isAcceleration2DVideoAvailable();
#endif
/* Set central widget: */
setCentralWidget(new QWidget(this));
/* Set central widget layout: */
, vboxGlobal().vmRenderMode()
#ifdef VBOX_WITH_VIDEOHWACCEL
#endif
, machineLogic()->visualStateType()
, m_uScreenId);
/* Add machine view into layout: */
}
{
/* Toggle console to manual resize mode. */
/* The background has to go black */
centralWidget()->setAutoFillBackground(true);
setAutoFillBackground(true);
/* Here we are going really fullscreen */
/* Show the window */
show();
/* Make sure it is really on the right place (especially on the Mac) */
move(0, 0);
}
{
}
{
/* Do not cleanup machine view if it is not present: */
if (!machineView())
return;
m_pMachineView = 0;
}