Engine 0.20.1

-reverted some changes done in 0.20.0 update
-added proper handling of non-standard data in volume's free space
- new type "Free space" added
- added machine type information
- solved a typo in DOS/PE signature check
This commit is contained in:
Nikolaj Schlej 2015-02-06 09:47:19 +01:00
parent 64a7c2ce2c
commit 2ec7ce1c30
14 changed files with 554 additions and 398 deletions

View file

@ -138,12 +138,12 @@ UINT8 TreeModel::type(const QModelIndex &index) const
return item->type();
}
UINT32 TreeModel::attributes(const QModelIndex &index) const
UINT8 TreeModel::subtype(const QModelIndex &index) const
{
if (!index.isValid())
return 0;
TreeItem *item = static_cast<TreeItem*>(index.internalPointer());
return item->attributes();
return item->subtype();
}
QByteArray TreeModel::header(const QModelIndex &index) const
@ -178,6 +178,22 @@ bool TreeModel::hasEmptyBody(const QModelIndex &index) const
return item->hasEmptyBody();
}
QByteArray TreeModel::parsingData(const QModelIndex &index) const
{
if (!index.isValid())
return QByteArray();
TreeItem *item = static_cast<TreeItem*>(index.internalPointer());
return item->parsingData();
}
bool TreeModel::hasEmptyParsingData(const QModelIndex &index) const
{
if (!index.isValid())
return true;
TreeItem *item = static_cast<TreeItem*>(index.internalPointer());
return item->hasEmptyParsingData();
}
QString TreeModel::name(const QModelIndex &index) const
{
if (!index.isValid())
@ -218,13 +234,13 @@ UINT8 TreeModel::compression(const QModelIndex &index) const
return item->compression();
}
void TreeModel::setAttributes(const QModelIndex & index, const UINT32 attributes)
void TreeModel::setSubtype(const QModelIndex & index, const UINT8 subtype)
{
if (!index.isValid())
return;
TreeItem *item = static_cast<TreeItem*>(index.internalPointer());
item->setAttributes(attributes);
item->setSubtype(subtype);
emit dataChanged(index, index);
}
@ -258,15 +274,6 @@ void TreeModel::setText(const QModelIndex &index, const QString &data)
emit dataChanged(index, index);
}
/*QString TreeModel::name(const QModelIndex &index) const
{
if (!index.isValid())
return QString();
TreeItem *item = static_cast<TreeItem*>(index.internalPointer());
return item->name();
}*/
void TreeModel::setAction(const QModelIndex &index, const UINT8 action)
{
if (!index.isValid())
@ -277,9 +284,19 @@ void TreeModel::setAction(const QModelIndex &index, const UINT8 action)
emit dataChanged(this->index(0, 0), index);
}
QModelIndex TreeModel::addItem(const UINT8 type, const UINT32 attributes, const UINT8 compression,
void TreeModel::setParsingData(const QModelIndex &index, const QByteArray &data)
{
if (!index.isValid())
return;
TreeItem *item = static_cast<TreeItem*>(index.internalPointer());
item->setParsingData(data);
emit dataChanged(this->index(0, 0), index);
}
QModelIndex TreeModel::addItem(const UINT8 type, const UINT8 subtype, const UINT8 compression,
const QString & name, const QString & text, const QString & info,
const QByteArray & header, const QByteArray & body,
const QByteArray & header, const QByteArray & body, const QByteArray & parsingData,
const QModelIndex & parent, const UINT8 mode)
{
TreeItem *item = 0;
@ -301,7 +318,7 @@ QModelIndex TreeModel::addItem(const UINT8 type, const UINT32 attributes, const
}
}
TreeItem *newItem = new TreeItem(type, attributes, compression, name, text, info, header, body, parentItem);
TreeItem *newItem = new TreeItem(type, subtype, compression, name, text, info, header, body, parsingData, parentItem);
if (mode == CREATE_MODE_APPEND) {
emit layoutAboutToBeChanged();
parentItem->appendChild(newItem);