|
|
|
@ -163,7 +163,7 @@ void DataFilesPage::setupDataFiles(const QStringList &paths, bool strict)
|
|
|
|
|
{
|
|
|
|
|
ESMReader fileReader;
|
|
|
|
|
QStringList availableMasters; // Will contain all found masters
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fileReader.setEncoding("win1252");
|
|
|
|
|
fileReader.open(iter->second.string());
|
|
|
|
|
|
|
|
|
@ -178,10 +178,13 @@ void DataFilesPage::setupDataFiles(const QStringList &paths, bool strict)
|
|
|
|
|
|
|
|
|
|
if (itemList.isEmpty()) // Master is not yet in the widget
|
|
|
|
|
{
|
|
|
|
|
// TODO: Show warning, missing master
|
|
|
|
|
mMastersWidget->insertRow(i);
|
|
|
|
|
|
|
|
|
|
QTableWidgetItem *item = new QTableWidgetItem(currentMaster);
|
|
|
|
|
mMastersWidget->setItem(i, 0, item);
|
|
|
|
|
item->setForeground(Qt::red);
|
|
|
|
|
item->setFlags(item->flags() & ~(Qt::ItemIsSelectable));
|
|
|
|
|
|
|
|
|
|
mMastersWidget->setItem(i, 0, item);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -190,9 +193,31 @@ void DataFilesPage::setupDataFiles(const QStringList &paths, bool strict)
|
|
|
|
|
// Now we put the current plugin in the mDataFilesModel under its masters
|
|
|
|
|
QStandardItem *parent = new QStandardItem(availableMasters.join(","));
|
|
|
|
|
|
|
|
|
|
std::string filename = boost::filesystem::path (iter->second.filename()).string();
|
|
|
|
|
QStandardItem *child = new QStandardItem(QString::fromStdString(std::string(filename)));
|
|
|
|
|
|
|
|
|
|
QString fileName = QString::fromStdString(boost::filesystem::path (iter->second.filename()).string());
|
|
|
|
|
QStandardItem *child = new QStandardItem(fileName);
|
|
|
|
|
|
|
|
|
|
// Tooltip information
|
|
|
|
|
QString author = QString::fromStdString(fileReader.getAuthor());
|
|
|
|
|
float version = fileReader.getFVer();
|
|
|
|
|
QString description = QString::fromStdString(fileReader.getDesc());
|
|
|
|
|
|
|
|
|
|
// For the date created/modified
|
|
|
|
|
QFileInfo fi(QString::fromStdString(iter->second.string()));
|
|
|
|
|
|
|
|
|
|
QString toolTip= QString("<b>Author:</b> %1<br/> \
|
|
|
|
|
<b>Version:</b> %2<br/><br/> \
|
|
|
|
|
<b>Description:</b><br/> \
|
|
|
|
|
%3<br/><br/> \
|
|
|
|
|
<b>Created on:</b> %4<br/> \
|
|
|
|
|
<b>Last modified:</b> %5")
|
|
|
|
|
.arg(author)
|
|
|
|
|
.arg(version)
|
|
|
|
|
.arg(description)
|
|
|
|
|
.arg(fi.created().toString(Qt::TextDate))
|
|
|
|
|
.arg(fi.lastModified().toString(Qt::TextDate));
|
|
|
|
|
|
|
|
|
|
child->setToolTip(toolTip);
|
|
|
|
|
|
|
|
|
|
const QList<QStandardItem*> masterList = mDataFilesModel->findItems(availableMasters.join(","));
|
|
|
|
|
|
|
|
|
|
if (masterList.isEmpty()) { // Masters node not yet in the mDataFilesModel
|
|
|
|
@ -766,6 +791,7 @@ void DataFilesPage::addPlugins(const QModelIndex &index)
|
|
|
|
|
if (childIndex.isValid()) {
|
|
|
|
|
// Now we see if the pluginsmodel already contains this plugin
|
|
|
|
|
const QString childIndexData = QVariant(mDataFilesModel->data(childIndex)).toString();
|
|
|
|
|
const QString childIndexToolTip = QVariant(mDataFilesModel->data(childIndex, Qt::ToolTipRole)).toString();
|
|
|
|
|
|
|
|
|
|
const QList<QStandardItem *> itemList = mPluginsModel->findItems(childIndexData);
|
|
|
|
|
|
|
|
|
@ -775,6 +801,7 @@ void DataFilesPage::addPlugins(const QModelIndex &index)
|
|
|
|
|
QStandardItem *item = new QStandardItem(childIndexData);
|
|
|
|
|
item->setFlags(item->flags() & ~(Qt::ItemIsDropEnabled));
|
|
|
|
|
item->setCheckable(true);
|
|
|
|
|
item->setToolTip(childIndexToolTip);
|
|
|
|
|
|
|
|
|
|
mPluginsModel->appendRow(item);
|
|
|
|
|
}
|
|
|
|
@ -940,6 +967,11 @@ void DataFilesPage::readConfig()
|
|
|
|
|
|
|
|
|
|
void DataFilesPage::writeConfig(QString profile)
|
|
|
|
|
{
|
|
|
|
|
// Don't overwrite the config if no plugins are found
|
|
|
|
|
if (mPluginsModel->rowCount() < 1) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (profile.isEmpty()) {
|
|
|
|
|
profile = mProfilesComboBox->currentText();
|
|
|
|
|
}
|
|
|
|
|