VBoxGlobal.h revision 37b496c57b08e8ae755f0a31e964ae16accc56d9
/** @file
*
* VBox frontends: Qt GUI ("VirtualBox"):
* VBoxGlobal class declaration
*/
/*
* Copyright (C) 2006-2007 innotek GmbH
*
* 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 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 __VBoxGlobal_h__
#define __VBoxGlobal_h__
#include "COMDefs.h"
#include "VBoxGlobalSettings.h"
#include <qapplication.h>
#include <qpixmap.h>
#include <qiconset.h>
#include <qcolor.h>
#include <quuid.h>
#include <qthread.h>
#include <qpopupmenu.h>
#include <qtooltip.h>
#include <qptrvector.h>
#include <qvaluevector.h>
#include <qvaluelist.h>
#include <qdict.h>
#include <qintdict.h>
// Auxiliary types
////////////////////////////////////////////////////////////////////////////////
/** Simple media descriptor type. */
struct VBoxMedia
{
};
// VirtualBox callback events
////////////////////////////////////////////////////////////////////////////////
{
{}
};
{
{}
};
{
{}
const bool registered;
};
{
{}
};
{
{}
};
{
{}
const QUuid snapshotId;
};
// VBoxGlobal
////////////////////////////////////////////////////////////////////////////////
{
static VBoxGlobal &instance();
const char *vmRenderModeStr() const { return vm_render_mode_str; }
#ifdef VBOX_WITH_DEBUGGER_GUI
bool isDebuggerEnabled() const { return dbg_enabled; }
bool isDebuggerVisibleAtStartup() const { return dbg_visible_at_startup; }
#endif
QStringList vmGuestOSTypeDescriptions() const;
{
}
{
}
{
return machineStates [s];
}
{
return sessionStates [s];
}
{
return diskControllerTypes [t];
}
{
return diskTypes [t];
}
{
return diskStorageTypes [t];
}
{
return vrdpAuthTypes [t];
}
{
return portModeTypes [t];
}
{
return usbFilterActionTypes [t];
}
{
return clipboardTypes [t];
}
{
}
{
}
{
}
{
}
/**
* Similar to toString (CEnums::HardDiskType), but returns 'Differencing'
* for normal hard disks that have a parent hard disk.
*/
{
{
}
}
{
return deviceTypes [t];
}
{
}
QStringList deviceTypeStrings() const;
{
return audioDriverTypes [t];
}
{
}
{
return networkAttachmentTypes [t];
}
{
}
{
return USBDeviceStates [aState];
}
QStringList COMPortNames() const;
{
}
/* details generators */
/* VirtualBox helpers */
#ifdef Q_WS_X11
bool showVirtualBoxLicense();
#endif
void showRegistrationDialog();
void startEnumeratingMedia();
/**
* Returns a list of all currently registered media. This list is used
* to globally track the accessiblity state of all media on a dedicated
* thread. This the list is initially empty (before the first enumeration
* process is started using #startEnumeratingMedia()).
*/
/** Returns true if the media enumeration is in progress. */
void updateMedia (const VBoxMedia &);
/* various helpers */
QString languageName() const;
QString languageCountry() const;
QString languageNameEnglish() const;
QString languageCountryEnglish() const;
QString languageTranslators() const;
void languageChange();
/** @internal made public for internal purposes */
void cleanup();
/* public static stuff */
static void adoptLabelPixmap (QLabel *);
static QString languageId();
const char *aDisabled = 0,
const char *aActive = 0);
const char *aDisabled = 0, const char *aSmallDisabled = 0,
const char *aActive = 0, const char *aSmallActive = 0);
bool aCanResize = true);
bool aCanResize = true);
static QChar decimalSep();
static QString sizeRegexp();
static QString systemLanguageId();
const char *aName = 0,
bool resolveSymlinks = TRUE);
const char*, const QString &,
QString *defaultFilter = 0,
bool resolveSymLinks = true);
const char *aClassName = NULL,
bool aRecursive = false);
/**
* Emitted at the beginning of the enumeration process started
* by #startEnumeratingMedia().
*/
void mediaEnumStarted();
/**
* Emitted when a new media item from the list has updated
* its accessibility state.
*/
/**
* Emitted at the end of the enumeration process started
* by #startEnumeratingMedia(). The @a aList argument is passed for
* convenience, it is exactly the same as returned by #currentMediaList().
*/
/** Emitted when a new media is added using #addMedia(). */
void mediaAdded (const VBoxMedia &);
/** Emitted when the media is updated using #updateMedia(). */
void mediaUpdated (const VBoxMedia &);
/** Emitted when the media is removed using #removeMedia(). */
/* signals emitted when the VirtualBox callback is called by the server
* (not that currently these signals are emitted only when the application
* is the in the VM selector mode) */
void machineStateChanged (const VBoxMachineStateChangeEvent &e);
void machineDataChanged (const VBoxMachineDataChangeEvent &e);
void machineRegistered (const VBoxMachineRegisteredEvent &e);
void sessionStateChanged (const VBoxSessionStateChangeEvent &e);
void snapshotChanged (const VBoxSnapshotEvent &e);
VBoxGlobal();
~VBoxGlobal() {}
void init();
bool valid;
const char * vm_render_mode_str;
#ifdef VBOX_WITH_DEBUGGER_GUI
bool dbg_enabled;
bool dbg_visible_at_startup;
#endif
#if defined (Q_WS_WIN32)
#endif
};
// Helper classes
////////////////////////////////////////////////////////////////////////////////
/**
* Generic asyncronous event.
*
* This abstract class is intended to provide a conveinent way to execute
* code on the main GUI thread asynchronously to the calling party. This is
* done by putting necessary actions to the #handle() function in a subclass
* and then posting an instance of the subclass using #post(). The instance
* must be allocated on the heap using the <tt>new</tt> operation and will be
* automatically deleted after processing. Note that if you don't call #post()
* on the created instance, you have to delete it yourself.
*/
{
/**
* Worker function. Gets executed on the GUI thread when the posted event
* is processed by the main event loop.
*/
/**
* Posts this event to the main event loop.
* The caller loses ownership of this object after this method returns
* and must not delete the object.
*/
void post()
{
}
};
/**
* USB Popup Menu class.
* This class provides the list of USB devices attached to the host.
*/
{
enum { USBDevicesMenuNoDevicesId = 1 };
VBoxUSBMenu (QWidget *);
const CUSBDevice& getUSB (int);
void setConsole (const CConsole &);
void processAboutToShow();
void processHighlighted (int);
};
/**
*/
{
void setToolTip (const QString &);
void processAboutToShow();
void processActivated (int);
bool mInverted;
};
#endif /* __VBoxGlobal_h__ */