VBoxVMListView.h revision 8e0c2ca3abd721979958f95b9af73b60665478c8
/** @file
*
* VBox frontends: Qt GUI ("VirtualBox"):
* VBoxVMItem, VBoxVMModel, VBoxVMListView, VBoxVMItemPainter class declarations
*/
/*
* Copyright (C) 2006-2008 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 __VBoxVMListView_h__
#define __VBoxVMListView_h__
#include "VBoxGlobal.h"
#include "QIListView.h"
/* Qt includes */
#include <QAbstractListModel>
#include <QDateTime>
{
virtual ~VBoxVMItem();
QIcon osIcon() const { return mAccessible ? vboxGlobal().vmGuestOSTypeIcon (mOSTypeId) :QPixmap (":/os_unknown.png"); }
QString sessionStateName() const;
QIcon sessionStateIcon() const { return mAccessible ? vboxGlobal().toIcon (mState) : QPixmap (":/state_aborted_16px.png"); }
QString toolTipText() const;
bool accessible() const { return mAccessible; }
bool recache();
bool canSwitchTo() const;
bool switchTo();
/* Private member vars */
/* Cached machine data (to minimize server requests) */
bool mAccessible;
};
/* Make the pointer of this class public to the QVariant framework */
{
:QAbstractListModel (aParent) {}
void clear();
/* The following are necessary model implementations */
/* Private member vars */
};
{
void selectItemByRow (int row);
void ensureSomeRowSelected (int aRowHint);
VBoxVMItem * selectedItem() const;
void ensureCurrentVisible();
void currentChanged();
void activated();
bool selectCurrent();
};
{
const QModelIndex &aIndex) const;
const QModelIndex &aIndex) const;
inline QFontMetrics fontMetric (const QModelIndex &aIndex, int aRole) const { return QFontMetrics (aIndex.data (aRole).value<QFont>()); }
{
}
inline QIcon::State iconState (QStyle::State aState) const { return aState & QStyle::State_Open ? QIcon::On : QIcon::Off; }
/* Private member vars */
int mMargin;
int mSpacing;
};
#endif /* __VBoxVMListView_h__ */