UIMachineView.h revision 8d1ef2acf41d1d8a0f69bfe0ac1f41638160399c
/** @file
*
* VBox frontends: Qt GUI ("VirtualBox"):
* UIMachineView class declaration
*/
/*
* Copyright (C) 2010-2012 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 ___UIMachineView_h___
#define ___UIMachineView_h___
/* Global includes */
#include <QAbstractScrollArea>
#include <QEventLoop>
/* Local includes */
#include "COMDefs.h"
#include "UIMachineDefs.h"
#ifdef Q_WS_MAC
# include <CoreFoundation/CFBase.h>
#endif /* Q_WS_MAC */
/* Local forwards */
{
/** Policy for determining which guest resolutions we wish to
* handle. We also accept anything smaller than the current
* resolution. */
enum MaxGuestSizePolicy
{
/** Policy not set correctly. */
/** Anything up to a fixed size. */
/** Anything up to available space on the host desktop. */
/** We accept anything. */
};
/* Factory function to create machine-view: */
#ifdef VBOX_WITH_VIDEOHWACCEL
, bool bAccelerate2DVideo
#endif /* VBOX_WITH_VIDEOHWACCEL */
);
/* Factory function to destroy required machine-view: */
/* Public setters: */
/* Public members: */
/* Framebuffer aspect ratio: */
double aspectRatio() const;
/* Utility signals: */
void resizeHintDone();
/* Slot to perform guest resize: */
/* Console callback handlers: */
virtual void sltMachineStateChanged();
/* Machine-view constructor: */
#ifdef VBOX_WITH_VIDEOHWACCEL
, bool bAccelerate2DVideo
#endif /* VBOX_WITH_VIDEOHWACCEL */
);
/* Machine-view destructor: */
virtual ~UIMachineView();
/* Prepare routines: */
virtual void prepareViewport();
virtual void prepareFrameBuffer();
virtual void prepareCommon();
virtual void prepareFilters();
virtual void prepareConsoleConnections();
virtual void loadMachineViewSettings();
/* Cleanup routines: */
//virtual void saveMachineViewSettings() {}
//virtual void cleanupConsoleConnections() {}
//virtual void cleanupFilters() {}
//virtual void cleanupCommon() {}
virtual void cleanupFrameBuffer();
//virtual void cleanupViewport();
/* Protected getters: */
UIMachineLogic* machineLogic() const;
int contentsX() const;
int contentsY() const;
int contentsWidth() const;
int contentsHeight() const;
int visibleWidth() const;
int visibleHeight() const;
/** Atomically store the maximum guest resolution which we currently wish
* to handle for @a maxGuestSize() to read. */
void setMaxGuestSize();
/** Atomically read the maximum guest resolution which we currently wish to
* handle. This may safely be called from another thread (called by
* UIFramebuffer on EMT). */
/** Retrieve the last non-fullscreen guest size hint (from extra data).
*/
/* Protected setters: */
/** Store a guest size hint value to extra data, called on switching to
* fullscreen. */
/* Protected helpers: */
virtual void takePauseShotLive();
virtual void takePauseShotSnapshot();
/** The available area on the current screen for application windows. */
/** Calculate how big the guest desktop can be while still fitting on one
* host screen. */
virtual void maybeRestrictMinimumSize() = 0;
virtual void updateSliders();
#ifdef VBOX_WITH_VIDEOHWACCEL
#endif /* VBOX_WITH_VIDEOHWACCEL */
#ifdef Q_WS_MAC
void updateDockIcon();
#endif /* Q_WS_MAC */
/** What view mode (normal, fullscreen etc.) are we in? */
UIVisualStateType visualStateType() const;
/** Is this a fullscreen-type view? */
bool isFullscreenOrSeamless() const;
/** Return a string consisting of @a base with a suffix for the active
* virtual monitor. Used for storing monitor-specific extra data. */
/** Returns the current rendering mode.
* @note contains special case logic for scale mode. */
/* Cross-platforms event processors: */
#ifdef VBOX_WITH_DRAG_AND_DROP
void handleGHDnd();
#endif /* VBOX_WITH_DRAG_AND_DROP */
/* Platform specific event processors: */
#if defined(Q_WS_WIN)
#endif
/* Protected members: */
/** HACK: when switching out of fullscreen or seamless we wish to override
* the default size hint to avoid short resizes back to fullscreen size.
* Not explicitly initialised (i.e. invalid by default). */
/** The policy for calculating the maximum guest resolution which we wish
* to handle. */
/** The maximum guest size for fixed size policy. */
/** Maximum guest resolution which we wish to handle. Must be accessed
* atomically. */
/** @todo This should be private. */
volatile uint64_t m_u64MaxGuestSize;
#ifdef VBOX_WITH_VIDEOHWACCEL
bool m_fAccelerate2DVideo : 1;
#endif /* VBOX_WITH_VIDEOHWACCEL */
/* Friend classes: */
};
/* This maintenance class is a part of future roll-back mechanism.
* It allows to block main GUI thread until specific event received.
* Later it will become more abstract but now its just used to help
* fullscreen & seamless modes to restore normal guest size hint. */
/** @todo This class is now unused - can it be removed altogether? */
{
: QEventLoop(0)
, m_iTimerId(0)
{
/* Also start timer to unlock pool in case of
* required condition doesn't happens by some reason: */
}
{
/* Kill the timer: */
}
{
/* If that timer event occurs => it seems
* guest resize event doesn't comes in time,
* shame on it, but we just unlocking 'this': */
exit();
}
int m_iTimerId;
};
#endif // !___UIMachineView_h___