1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-04 02:41:19 +00:00

Masters in the data directory are loaded now, even when they don't have dependent plugins

This commit is contained in:
Pieter van der Kloet 2011-04-29 01:54:20 +02:00
parent 9a218b12c8
commit 8256343d77

View File

@ -129,21 +129,40 @@ void DataFilesPage::setupDataFiles()
mPluginsTable->setContextMenuPolicy(Qt::CustomContextMenu);
// Some testing TODO TODO TODO
// TODO: Add a warning when a master is missing
QDir dataFilesDir("data/");
if (!dataFilesDir.exists())
qWarning("Cannot find the plugin directory");
// First we add all the master files from the plugin dir
dataFilesDir.setNameFilters((QStringList() << "*.esm")); // Only load masters
QStringList masterFiles = dataFilesDir.entryList();
for (int i=0; i<masterFiles.count(); ++i)
{
QString currentMaster = masterFiles.at(i);
QList<QTableWidgetItem*> itemList = mMastersWidget->findItems(currentMaster, Qt::MatchExactly);
if (itemList.isEmpty()) // Master is not yet in the widget
{
mMastersWidget->insertRow(i);
QTableWidgetItem *item = new QTableWidgetItem(currentMaster);
mMastersWidget->setItem(i, 0, item);
}
}
// Now on to the plugins
dataFilesDir.setNameFilters((QStringList() << "*.esp")); // Only load plugins
QStringList dataFiles = dataFilesDir.entryList();
QStringList pluginFiles = dataFilesDir.entryList();
for (int i=0; i<dataFiles.count(); ++i)
for (int i=0; i<pluginFiles.count(); ++i)
{
ESMReader fileReader;
QString currentFile = dataFiles.at(i);
QString currentFile = pluginFiles.at(i);
QStringList availableMasters; // Will contain all found masters
QString path = QString("data/").append(currentFile);