UIMachineLogicScale.cpp revision 4759f52dfc0c5362f3cf176490786142d85a73e9
/* $Id$ */
/** @file
* VBox Qt GUI - UIMachineLogicScale 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.
*/
#ifndef Q_WS_MAC
/* Qt includes: */
# include <QTimer>
#endif /* !Q_WS_MAC */
/* GUI includes: */
#include "VBoxGlobal.h"
#include "UIMessageCenter.h"
#include "UISession.h"
#include "UIActionPoolRuntime.h"
#include "UIMachineLogicScale.h"
#include "UIMachineWindow.h"
#ifndef Q_WS_MAC
# include "UIMachineMenuBar.h"
#else /* Q_WS_MAC */
# include "VBoxUtils.h"
#endif /* Q_WS_MAC */
#ifndef Q_WS_MAC
, m_pPopupMenu(0)
#endif /* !Q_WS_MAC */
{
}
bool UIMachineLogicScale::checkAvailability()
{
/* 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_Scale)->text()));
/* Show the info message. */
return false;
return true;
}
#ifndef Q_WS_MAC
{
/* Popup main-menu if present: */
{
}
}
#endif /* !Q_WS_MAC */
{
/* Call to base-class: */
/* Take care of view-action toggle state: */
if (!pActionScale->isChecked())
{
pActionScale->blockSignals(true);
pActionScale->setChecked(true);
pActionScale->blockSignals(false);
pActionScale->update();
}
}
{
/* Call to base-class: */
/* "View" actions connections: */
this, SLOT(sltChangeVisualStateToNormal()));
this, SLOT(sltChangeVisualStateToFullscreen()));
this, SLOT(sltChangeVisualStateToSeamless()));
}
{
/* 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 */
/* Get monitors count: */
/* Create machine window(s): */
/* Order machine window(s): */
/* Mark machine-window(s) created: */
setMachineWindowsCreated(true);
}
#ifndef Q_WS_MAC
void UIMachineLogicScale::prepareMenu()
{
/* Call to base-class: */
/* Prepare popup-menu: */
m_pPopupMenu = new QIMenu;
{
/* Prepare popup-menu: */
}
}
#endif /* !Q_WS_MAC */
#ifndef Q_WS_MAC
void UIMachineLogicScale::cleanupMenu()
{
/* Cleanup popup-menu: */
delete m_pPopupMenu;
m_pPopupMenu = 0;
/* Call to base-class: */
}
#endif /* !Q_WS_MAC */
{
/* 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 disconnections: */
this, SLOT(sltChangeVisualStateToNormal()));
this, SLOT(sltChangeVisualStateToFullscreen()));
this, SLOT(sltChangeVisualStateToSeamless()));
/* Call to base-class: */
}
{
/* Take care of view-action toggle state: */
if (pActionScale->isChecked())
{
pActionScale->blockSignals(true);
pActionScale->setChecked(false);
pActionScale->blockSignals(false);
pActionScale->update();
}
/* Call to base-class: */
}