VBoxApplianceEditorWgt.h revision ca0381ca68475658778a2ee96b65e5a3987ad33a
/** @file
*
* VBox frontends: Qt4 GUI ("VirtualBox"):
* VBoxApplianceEditorWgt class declaration
*/
/*
* Copyright (C) 2009 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.
*/
#ifndef __VBoxApplianceEditorWgt_h__
#define __VBoxApplianceEditorWgt_h__
/* VBox includes */
#include "COMDefs.h"
#include "VBoxApplianceEditorWgt.gen.h"
#include "QIWithRetranslateUI.h"
/* Qt includes */
#include <QSortFilterProxyModel>
#include <QItemDelegate>
/* VBox forward declarations */
////////////////////////////////////////////////////////////////////////////////
// Globals
////////////////////////////////////////////////////////////////////////////////
// ModelItem
/* This & the following derived classes represent the data items of a Virtual
System. All access/manipulation is done with the help of virtual functions
to keep the interface clean. ModelItem is able to handle tree structures
with a parent & several children's. */
{
~ModelItem();
int row() const;
int childCount() const;
int columnCount() const { return 3; }
virtual bool setData (int /* aColumn */, const QVariant & /* aValue */, int /* aRole */) { return false; }
virtual QWidget * createEditor (QWidget * /* aParent */, const QStyleOptionViewItem & /* aOption */, const QModelIndex & /* aIndex */) const { return NULL; }
virtual bool setEditorData (QWidget * /* aEditor */, const QModelIndex & /* aIndex */) const { return false; }
virtual bool setModelData (QWidget * /* aEditor */, QAbstractItemModel * /* aModel */, const QModelIndex & /* aIndex */) { return false; }
virtual void restoreDefaults() {}
virtual void putBack (QVector<BOOL>& aFinalStates, QVector<QString>& aFinalValues, QVector<QString>& aFinalExtraValues);
/* Protected member vars */
int mNumber;
};
////////////////////////////////////////////////////////////////////////////////
// VirtualSystemItem
/* This class represent a Virtual System with an index. */
{
virtual void putBack (QVector<BOOL>& aFinalStates, QVector<QString>& aFinalValues, QVector<QString>& aFinalExtraValues);
};
////////////////////////////////////////////////////////////////////////////////
// HardwareItem
/* This class represent an hardware item of a Virtual System. All values of
KVirtualSystemDescriptionType are supported & handled differently. */
{
HardwareItem (int aNumber,
const QString &aOrigValue,
const QString &aConfigValue,
const QString &aExtraConfigValue,
virtual void putBack (QVector<BOOL>& aFinalStates, QVector<QString>& aFinalValues, QVector<QString>& aFinalExtraValues);
virtual QWidget * createEditor (QWidget *aParent, const QStyleOptionViewItem &aOption, const QModelIndex &aIndex) const;
virtual bool setModelData (QWidget *aEditor, QAbstractItemModel *aModel, const QModelIndex &aIndex);
virtual void restoreDefaults()
{
}
/* Private member vars */
};
////////////////////////////////////////////////////////////////////////////////
// VirtualSystemModel
{
void putBack();
/* Private member vars */
};
////////////////////////////////////////////////////////////////////////////////
// VirtualSystemDelegate
various types we support. This class forward the requests to the virtual
methods of our different ModelItems. If this is not possible the default
methods of QItemDelegate are used to get some standard behavior. Note: We
have to handle the proxy model ourself. I really don't understand why Qt is
not doing this for us. */
{
QWidget * createEditor (QWidget *aParent, const QStyleOptionViewItem &aOption, const QModelIndex &aIndex) const;
void updateEditorGeometry (QWidget *aEditor, const QStyleOptionViewItem &aOption, const QModelIndex &aIndex) const;
{
#ifdef Q_WS_MAC
int h = 28;
#else /* Q_WS_MAC */
int h = 24;
#endif /* Q_WS_MAC */
return size;
}
/* Private member vars */
};
////////////////////////////////////////////////////////////////////////////////
// VirtualSystemSortProxyModel
{
static KVirtualSystemDescriptionType mSortList[];
};
////////////////////////////////////////////////////////////////////////////////
// VBoxApplianceEditorWgt
{
void restoreDefaults();
virtual void retranslateUi();
/* Protected member vars */
};
#endif /* __VBoxApplianceEditorWgt_h__ */