|
|
|
@ -1,17 +1,37 @@
|
|
|
|
|
#include "contentmodel.hpp"
|
|
|
|
|
#include "esmfile.hpp"
|
|
|
|
|
#include <QDebug>
|
|
|
|
|
|
|
|
|
|
#include <QDir>
|
|
|
|
|
#include <QTextCodec>
|
|
|
|
|
#include <components/esm/esmreader.hpp>
|
|
|
|
|
#include <QDebug>
|
|
|
|
|
|
|
|
|
|
EsxModel::ContentModel::ContentModel(QObject *parent) :
|
|
|
|
|
QAbstractTableModel(parent), mEncoding("win1252")
|
|
|
|
|
{}
|
|
|
|
|
QAbstractTableModel(parent),
|
|
|
|
|
mMimeType ("application/omwcontent"),
|
|
|
|
|
mMimeTypes (QStringList() << mMimeType),
|
|
|
|
|
mColumnCount (1),
|
|
|
|
|
mDragDropFlags (Qt::ItemIsDragEnabled | Qt::ItemIsDropEnabled),
|
|
|
|
|
mDefaultFlags (Qt::ItemIsDropEnabled | Qt::ItemIsSelectable),
|
|
|
|
|
mDropActions (Qt::CopyAction | Qt::MoveAction)
|
|
|
|
|
{
|
|
|
|
|
setEncoding ("win1252");
|
|
|
|
|
uncheckAll();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void EsxModel::ContentModel::setEncoding(const QString &encoding)
|
|
|
|
|
{
|
|
|
|
|
mEncoding = encoding;
|
|
|
|
|
if (encoding == QLatin1String("win1252"))
|
|
|
|
|
mCodec = QTextCodec::codecForName("windows-1252");
|
|
|
|
|
|
|
|
|
|
else if (encoding == QLatin1String("win1251"))
|
|
|
|
|
mCodec = QTextCodec::codecForName("windows-1251");
|
|
|
|
|
|
|
|
|
|
else if (encoding == QLatin1String("win1250"))
|
|
|
|
|
mCodec = QTextCodec::codecForName("windows-1250");
|
|
|
|
|
|
|
|
|
|
else
|
|
|
|
|
return; // This should never happen;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int EsxModel::ContentModel::columnCount(const QModelIndex &parent) const
|
|
|
|
@ -19,7 +39,7 @@ int EsxModel::ContentModel::columnCount(const QModelIndex &parent) const
|
|
|
|
|
if (parent.isValid())
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
|
return mColumnCount;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int EsxModel::ContentModel::rowCount(const QModelIndex &parent) const
|
|
|
|
@ -30,22 +50,28 @@ int EsxModel::ContentModel::rowCount(const QModelIndex &parent) const
|
|
|
|
|
return mFiles.size();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
EsxModel::EsmFile* EsxModel::ContentModel::item(int row) const
|
|
|
|
|
const EsxModel::EsmFile* EsxModel::ContentModel::item(int row) const
|
|
|
|
|
{
|
|
|
|
|
if (row >= 0 && row < mFiles.count())
|
|
|
|
|
if (row >= 0 && row < mFiles.size())
|
|
|
|
|
return mFiles.at(row);
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
EsxModel::EsmFile* EsxModel::ContentModel::findItem(const QString &name)
|
|
|
|
|
EsxModel::EsmFile *EsxModel::ContentModel::item(int row)
|
|
|
|
|
{
|
|
|
|
|
for (int i = 0; i < mFiles.size(); ++i)
|
|
|
|
|
if (row >= 0 && row < mFiles.count())
|
|
|
|
|
return mFiles.at(row);
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
const EsxModel::EsmFile *EsxModel::ContentModel::findItem(const QString &name) const
|
|
|
|
|
{
|
|
|
|
|
if (name == item(i)->fileName())
|
|
|
|
|
return item(i);
|
|
|
|
|
foreach (const EsmFile *file, mFiles)
|
|
|
|
|
{
|
|
|
|
|
if (name == file->fileName())
|
|
|
|
|
return file;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -62,19 +88,15 @@ Qt::ItemFlags EsxModel::ContentModel::flags(const QModelIndex &index) const
|
|
|
|
|
if (!index.isValid())
|
|
|
|
|
return Qt::NoItemFlags;
|
|
|
|
|
|
|
|
|
|
EsmFile *file = item(index.row());
|
|
|
|
|
const EsmFile *file = item(index.row());
|
|
|
|
|
|
|
|
|
|
if (!file)
|
|
|
|
|
return Qt::NoItemFlags;
|
|
|
|
|
|
|
|
|
|
Qt::ItemFlags dragDropFlags = Qt::ItemIsDragEnabled | Qt::ItemIsDropEnabled;
|
|
|
|
|
Qt::ItemFlags checkFlags = Qt::ItemIsUserCheckable;
|
|
|
|
|
Qt::ItemFlags defaultFlags = Qt::ItemIsDropEnabled | Qt::ItemIsSelectable;
|
|
|
|
|
|
|
|
|
|
if (canBeChecked(file))
|
|
|
|
|
return Qt::ItemIsEnabled | dragDropFlags | checkFlags | defaultFlags;
|
|
|
|
|
else
|
|
|
|
|
return defaultFlags;
|
|
|
|
|
return Qt::ItemIsEnabled | mDragDropFlags | mDefaultFlags;
|
|
|
|
|
|
|
|
|
|
return mDefaultFlags;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QVariant EsxModel::ContentModel::data(const QModelIndex &index, int role) const
|
|
|
|
@ -85,7 +107,7 @@ QVariant EsxModel::ContentModel::data(const QModelIndex &index, int role) const
|
|
|
|
|
if (index.row() >= mFiles.size())
|
|
|
|
|
return QVariant();
|
|
|
|
|
|
|
|
|
|
EsmFile *file = item(index.row());
|
|
|
|
|
const EsmFile *file = item(index.row());
|
|
|
|
|
|
|
|
|
|
if (!file)
|
|
|
|
|
return QVariant();
|
|
|
|
@ -97,25 +119,11 @@ QVariant EsxModel::ContentModel::data(const QModelIndex &index, int role) const
|
|
|
|
|
case Qt::EditRole:
|
|
|
|
|
case Qt::DisplayRole:
|
|
|
|
|
{
|
|
|
|
|
switch (column)
|
|
|
|
|
{
|
|
|
|
|
case 0:
|
|
|
|
|
return file->fileName();
|
|
|
|
|
case 1:
|
|
|
|
|
return file->author();
|
|
|
|
|
case 2:
|
|
|
|
|
return file->modified().toString(Qt::ISODate);
|
|
|
|
|
case 3:
|
|
|
|
|
return file->version();
|
|
|
|
|
case 4:
|
|
|
|
|
return file->path();
|
|
|
|
|
case 5:
|
|
|
|
|
return file->masters().join(", ");
|
|
|
|
|
case 6:
|
|
|
|
|
return file->description();
|
|
|
|
|
}
|
|
|
|
|
if (column >=0 && column <=EsmFile::FileProperty_Master)
|
|
|
|
|
return file->fileProperty(static_cast<const EsmFile::FileProperty>(column));
|
|
|
|
|
|
|
|
|
|
return QVariant();
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
case Qt::TextAlignmentRole:
|
|
|
|
@ -132,6 +140,7 @@ QVariant EsxModel::ContentModel::data(const QModelIndex &index, int role) const
|
|
|
|
|
return Qt::AlignLeft + Qt::AlignVCenter;
|
|
|
|
|
}
|
|
|
|
|
return QVariant();
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
case Qt::ToolTipRole:
|
|
|
|
@ -139,23 +148,16 @@ QVariant EsxModel::ContentModel::data(const QModelIndex &index, int role) const
|
|
|
|
|
if (column != 0)
|
|
|
|
|
return QVariant();
|
|
|
|
|
|
|
|
|
|
if (file->version() == 0.0f)
|
|
|
|
|
return QVariant(); // Data not set
|
|
|
|
|
|
|
|
|
|
return QString("<b>Author:</b> %1<br/> \
|
|
|
|
|
<b>Version:</b> %2<br/> \
|
|
|
|
|
<br/><b>Description:</b><br/>%3<br/> \
|
|
|
|
|
<br/><b>Dependencies: </b>%4<br/>")
|
|
|
|
|
.arg(file->author())
|
|
|
|
|
.arg(QString::number(file->version()))
|
|
|
|
|
.arg(file->description())
|
|
|
|
|
.arg(file->masters().join(", "));
|
|
|
|
|
return file->toolTip();
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
case Qt::CheckStateRole:
|
|
|
|
|
{
|
|
|
|
|
if (!file->isMaster())
|
|
|
|
|
return isChecked(file->fileName());
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
case Qt::UserRole:
|
|
|
|
|
{
|
|
|
|
@ -179,6 +181,7 @@ bool EsxModel::ContentModel::setData(const QModelIndex &index, const QVariant &v
|
|
|
|
|
|
|
|
|
|
EsmFile *file = item(index.row());
|
|
|
|
|
QString fileName = file->fileName();
|
|
|
|
|
bool success = false;
|
|
|
|
|
|
|
|
|
|
switch(role)
|
|
|
|
|
{
|
|
|
|
@ -186,20 +189,15 @@ bool EsxModel::ContentModel::setData(const QModelIndex &index, const QVariant &v
|
|
|
|
|
{
|
|
|
|
|
QStringList list = value.toStringList();
|
|
|
|
|
|
|
|
|
|
//iterate the string list, assigning values to proeprties
|
|
|
|
|
//index-enum correspondence 1:1
|
|
|
|
|
for (int i = 0; i < EsxModel::Property_Master; i++)
|
|
|
|
|
file->setProperty(static_cast<EsmFileProperty>(i), list.at(i));
|
|
|
|
|
for (int i = 0; i < EsmFile::FileProperty_Master; i++)
|
|
|
|
|
file->setFileProperty(static_cast<EsmFile::FileProperty>(i), list.at(i));
|
|
|
|
|
|
|
|
|
|
//iterate the remainder of the string list, assifning everything
|
|
|
|
|
// as
|
|
|
|
|
for (int i = EsxModel::Property_Master; i < list.size(); i++)
|
|
|
|
|
file->setProperty (EsxModel::Property_Master, list.at(i));
|
|
|
|
|
for (int i = EsmFile::FileProperty_Master; i < list.size(); i++)
|
|
|
|
|
file->setFileProperty (EsmFile::FileProperty_Master, list.at(i));
|
|
|
|
|
|
|
|
|
|
//emit data changed for the item itself
|
|
|
|
|
emit dataChanged(index, index);
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
success = true;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
@ -209,34 +207,37 @@ bool EsxModel::ContentModel::setData(const QModelIndex &index, const QVariant &v
|
|
|
|
|
|
|
|
|
|
emit dataChanged(index, index);
|
|
|
|
|
|
|
|
|
|
for(int i = 0; i < mFiles.size(); i++)
|
|
|
|
|
foreach (EsmFile *file, mFiles)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
if (mFiles.at(i)->masters().contains(fileName))
|
|
|
|
|
if (file->masters().contains(fileName))
|
|
|
|
|
{
|
|
|
|
|
QModelIndex idx = QAbstractTableModel::index(i, 0);
|
|
|
|
|
QModelIndex idx = indexFromItem(file);
|
|
|
|
|
emit dataChanged(idx, idx);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
success = true;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case Qt::CheckStateRole:
|
|
|
|
|
{
|
|
|
|
|
bool checked = ((value.toInt() == Qt::Checked) && !isChecked(fileName));
|
|
|
|
|
int checkValue = value.toInt();
|
|
|
|
|
|
|
|
|
|
setCheckState(fileName, checked);
|
|
|
|
|
if ((checkValue==Qt::Checked) && !isChecked(fileName))
|
|
|
|
|
setCheckState(fileName, true);
|
|
|
|
|
else if ((checkValue == Qt::Checked) && isChecked (fileName))
|
|
|
|
|
setCheckState(fileName, false);
|
|
|
|
|
else if (checkValue == Qt::Unchecked)
|
|
|
|
|
setCheckState(fileName, false);
|
|
|
|
|
|
|
|
|
|
emit dataChanged(index, index);
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
success = true;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
return success;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool EsxModel::ContentModel::insertRows(int position, int rows, const QModelIndex &parent)
|
|
|
|
@ -271,16 +272,12 @@ bool EsxModel::ContentModel::removeRows(int position, int rows, const QModelInde
|
|
|
|
|
|
|
|
|
|
Qt::DropActions EsxModel::ContentModel::supportedDropActions() const
|
|
|
|
|
{
|
|
|
|
|
return Qt::CopyAction | Qt::MoveAction;
|
|
|
|
|
return mDropActions;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QStringList EsxModel::ContentModel::mimeTypes() const
|
|
|
|
|
{
|
|
|
|
|
QStringList types;
|
|
|
|
|
|
|
|
|
|
types << "application/omwcontent";
|
|
|
|
|
|
|
|
|
|
return types;
|
|
|
|
|
return mMimeTypes;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QMimeData *EsxModel::ContentModel::mimeData(const QModelIndexList &indexes) const
|
|
|
|
@ -292,14 +289,11 @@ QMimeData *EsxModel::ContentModel::mimeData(const QModelIndexList &indexes) cons
|
|
|
|
|
if (!index.isValid())
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
QByteArray fileData = item(index.row())->encodedData();
|
|
|
|
|
|
|
|
|
|
foreach (const char c, fileData)
|
|
|
|
|
encodedData.append(c);
|
|
|
|
|
encodedData.append(item(index.row())->encodedData());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QMimeData *mimeData = new QMimeData();
|
|
|
|
|
mimeData->setData("application/omwcontent", encodedData);
|
|
|
|
|
mimeData->setData(mMimeType, encodedData);
|
|
|
|
|
|
|
|
|
|
return mimeData;
|
|
|
|
|
}
|
|
|
|
@ -309,13 +303,13 @@ bool EsxModel::ContentModel::dropMimeData(const QMimeData *data, Qt::DropAction
|
|
|
|
|
if (action == Qt::IgnoreAction)
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
|
|
if (!data->hasFormat("application/omwcontent"))
|
|
|
|
|
if (column > 0)
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
if (column > 0)
|
|
|
|
|
if (!data->hasFormat(mMimeType))
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
int beginRow;
|
|
|
|
|
int beginRow = rowCount();
|
|
|
|
|
|
|
|
|
|
if (row != -1)
|
|
|
|
|
beginRow = row;
|
|
|
|
@ -323,23 +317,28 @@ bool EsxModel::ContentModel::dropMimeData(const QMimeData *data, Qt::DropAction
|
|
|
|
|
else if (parent.isValid())
|
|
|
|
|
beginRow = parent.row();
|
|
|
|
|
|
|
|
|
|
else
|
|
|
|
|
beginRow = rowCount();
|
|
|
|
|
|
|
|
|
|
QByteArray encodedData = data->data("application/omwcontent");
|
|
|
|
|
QByteArray encodedData = data->data(mMimeType);
|
|
|
|
|
QDataStream stream(&encodedData, QIODevice::ReadOnly);
|
|
|
|
|
|
|
|
|
|
while (!stream.atEnd())
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
QString value;
|
|
|
|
|
QStringList values;
|
|
|
|
|
QStringList masters;
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < EsmFile::sPropertyCount; ++i)
|
|
|
|
|
stream >> values;
|
|
|
|
|
for (int i = 0; i < EsmFile::FileProperty_Master; ++i)
|
|
|
|
|
{
|
|
|
|
|
stream >> value;
|
|
|
|
|
values << value;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
stream >> masters;
|
|
|
|
|
|
|
|
|
|
insertRows(beginRow, 1);
|
|
|
|
|
|
|
|
|
|
QModelIndex idx = index(beginRow++, 0, QModelIndex());
|
|
|
|
|
setData(idx, values, Qt::EditRole);
|
|
|
|
|
setData(idx, QStringList() << values << masters, Qt::EditRole);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
@ -349,37 +348,8 @@ bool EsxModel::ContentModel::canBeChecked(const EsmFile *file) const
|
|
|
|
|
{
|
|
|
|
|
//element can be checked if all its dependencies are
|
|
|
|
|
foreach (const QString &master, file->masters())
|
|
|
|
|
{
|
|
|
|
|
{// if the master is not found in checkstates
|
|
|
|
|
// or it is not specifically checked, return false
|
|
|
|
|
if (!mCheckStates.contains(master))
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
if (!isChecked(master))
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool found = false;
|
|
|
|
|
|
|
|
|
|
//iterate each file, if it is not a master and
|
|
|
|
|
//does not have a master that is currently checked,
|
|
|
|
|
//return false.
|
|
|
|
|
foreach(const EsmFile *file, mFiles)
|
|
|
|
|
{
|
|
|
|
|
QString filename = file->fileName();
|
|
|
|
|
|
|
|
|
|
found = (filename == master);
|
|
|
|
|
|
|
|
|
|
if (found)
|
|
|
|
|
{
|
|
|
|
|
if (!isChecked(filename))
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!found)
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
@ -387,9 +357,8 @@ bool EsxModel::ContentModel::canBeChecked(const EsmFile *file) const
|
|
|
|
|
void EsxModel::ContentModel::addFile(EsmFile *file)
|
|
|
|
|
{
|
|
|
|
|
beginInsertRows(QModelIndex(), mFiles.count(), mFiles.count());
|
|
|
|
|
{
|
|
|
|
|
mFiles.append(file);
|
|
|
|
|
} endInsertRows();
|
|
|
|
|
endInsertRows();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void EsxModel::ContentModel::addFiles(const QString &path)
|
|
|
|
@ -400,45 +369,26 @@ void EsxModel::ContentModel::addFiles(const QString &path)
|
|
|
|
|
dir.setNameFilters(filters);
|
|
|
|
|
|
|
|
|
|
// Create a decoder for non-latin characters in esx metadata
|
|
|
|
|
QTextCodec *codec;
|
|
|
|
|
|
|
|
|
|
if (mEncoding == QLatin1String("win1252")) {
|
|
|
|
|
codec = QTextCodec::codecForName("windows-1252");
|
|
|
|
|
} else if (mEncoding == QLatin1String("win1251")) {
|
|
|
|
|
codec = QTextCodec::codecForName("windows-1251");
|
|
|
|
|
} else if (mEncoding == QLatin1String("win1250")) {
|
|
|
|
|
codec = QTextCodec::codecForName("windows-1250");
|
|
|
|
|
} else {
|
|
|
|
|
return; // This should never happen;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QTextDecoder *decoder = codec->makeDecoder();
|
|
|
|
|
QTextDecoder *decoder = mCodec->makeDecoder();
|
|
|
|
|
|
|
|
|
|
foreach (const QString &path, dir.entryList()) {
|
|
|
|
|
foreach (const QString &path, dir.entryList())
|
|
|
|
|
{
|
|
|
|
|
QFileInfo info(dir.absoluteFilePath(path));
|
|
|
|
|
EsmFile *file = new EsmFile(path);
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
ESM::ESMReader fileReader;
|
|
|
|
|
ToUTF8::Utf8Encoder encoder(ToUTF8::calculateEncoding(mEncoding.toStdString()));
|
|
|
|
|
ToUTF8::Utf8Encoder encoder(ToUTF8::calculateEncoding(QString(mCodec->name()).toStdString()));
|
|
|
|
|
fileReader.setEncoder(&encoder);
|
|
|
|
|
fileReader.open(dir.absoluteFilePath(path).toStdString());
|
|
|
|
|
|
|
|
|
|
std::vector<ESM::Header::MasterData> mlist = fileReader.getMasters();
|
|
|
|
|
|
|
|
|
|
QStringList masters;
|
|
|
|
|
|
|
|
|
|
for (unsigned int i = 0; i < mlist.size(); ++i) {
|
|
|
|
|
QString master = QString::fromStdString(mlist[i].name);
|
|
|
|
|
masters.append(master);
|
|
|
|
|
}
|
|
|
|
|
foreach (const ESM::Header::MasterData &item, fileReader.getMasters())
|
|
|
|
|
file->addMaster(QString::fromStdString(item.name));
|
|
|
|
|
|
|
|
|
|
file->setAuthor (decoder->toUnicode(fileReader.getAuthor().c_str()));
|
|
|
|
|
//file->setSize(info.size());
|
|
|
|
|
file->setDate (info.lastModified());
|
|
|
|
|
file->setVersion(0.0f);
|
|
|
|
|
file->setVersion (fileReader.getFVer());
|
|
|
|
|
file->setPath (info.absoluteFilePath());
|
|
|
|
|
file->setMasters(masters);
|
|
|
|
|
file->setDescription(decoder->toUnicode(fileReader.getDesc().c_str()));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -459,7 +409,10 @@ void EsxModel::ContentModel::addFiles(const QString &path)
|
|
|
|
|
|
|
|
|
|
bool EsxModel::ContentModel::isChecked(const QString& name) const
|
|
|
|
|
{
|
|
|
|
|
if (mCheckStates.contains(name))
|
|
|
|
|
return (mCheckStates[name] == Qt::Checked);
|
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void EsxModel::ContentModel::setCheckState(const QString &name, bool isChecked)
|
|
|
|
@ -479,12 +432,9 @@ EsxModel::ContentFileList EsxModel::ContentModel::checkedItems() const
|
|
|
|
|
{
|
|
|
|
|
ContentFileList list;
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < mFiles.size(); ++i)
|
|
|
|
|
foreach (EsmFile *file, mFiles)
|
|
|
|
|
{
|
|
|
|
|
EsmFile *file = item(i);
|
|
|
|
|
|
|
|
|
|
// Only add the items that are in the checked list and available
|
|
|
|
|
if (mCheckStates[file->fileName()] == Qt::Checked && canBeChecked(file))
|
|
|
|
|
if (isChecked(file->fileName()))
|
|
|
|
|
list << file;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|