Make the new instance dialog support instance types.
This commit is contained in:
@ -41,6 +41,11 @@ class LIBMULTIMC_EXPORT InstVersionList : public QAbstractListModel
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
enum ModelRoles
|
||||
{
|
||||
VersionPointerRole = 0x34B1CB48
|
||||
};
|
||||
|
||||
explicit InstVersionList(QObject *parent = 0);
|
||||
|
||||
/*!
|
||||
@ -75,6 +80,13 @@ public:
|
||||
* one doesn't exist.
|
||||
*/
|
||||
virtual const InstVersion *findVersion(const QString &descriptor);
|
||||
|
||||
/*!
|
||||
* \brief Gets the latest stable version of this instance type.
|
||||
* This is the version that will be selected by default.
|
||||
* By default, this is simply the first version in the list.
|
||||
*/
|
||||
virtual const InstVersion *getLatestStable();
|
||||
};
|
||||
|
||||
#endif // INSTVERSIONLIST_H
|
||||
|
@ -31,6 +31,14 @@ const InstVersion *InstVersionList::findVersion(const QString &descriptor)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
const InstVersion *InstVersionList::getLatestStable()
|
||||
{
|
||||
if (count() <= 0)
|
||||
return NULL;
|
||||
else
|
||||
return at(0);
|
||||
}
|
||||
|
||||
// Column Enum
|
||||
enum VListColumns
|
||||
{
|
||||
@ -73,6 +81,9 @@ QVariant InstVersionList::data(const QModelIndex &index, int role) const
|
||||
case Qt::ToolTipRole:
|
||||
return version->descriptor();
|
||||
|
||||
case VersionPointerRole:
|
||||
return qVariantFromValue((void *) version);
|
||||
|
||||
default:
|
||||
return QVariant();
|
||||
}
|
||||
|
Reference in New Issue
Block a user