mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-03-29 22:06:45 +00:00
Masters in the data directory are loaded now, even when they don't have dependent plugins
This commit is contained in:
parent
9a218b12c8
commit
8256343d77
1 changed files with 23 additions and 4 deletions
|
@ -129,21 +129,40 @@ void DataFilesPage::setupDataFiles()
|
||||||
|
|
||||||
mPluginsTable->setContextMenuPolicy(Qt::CustomContextMenu);
|
mPluginsTable->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||||
|
|
||||||
// Some testing TODO TODO TODO
|
// TODO: Add a warning when a master is missing
|
||||||
|
|
||||||
QDir dataFilesDir("data/");
|
QDir dataFilesDir("data/");
|
||||||
|
|
||||||
if (!dataFilesDir.exists())
|
if (!dataFilesDir.exists())
|
||||||
qWarning("Cannot find the plugin directory");
|
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
|
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;
|
ESMReader fileReader;
|
||||||
QString currentFile = dataFiles.at(i);
|
QString currentFile = pluginFiles.at(i);
|
||||||
QStringList availableMasters; // Will contain all found masters
|
QStringList availableMasters; // Will contain all found masters
|
||||||
|
|
||||||
QString path = QString("data/").append(currentFile);
|
QString path = QString("data/").append(currentFile);
|
||||||
|
|
Loading…
Reference in a new issue