From 8256343d77f5c500cff3e6ec982fbc72fa2f9134 Mon Sep 17 00:00:00 2001 From: Pieter van der Kloet Date: Fri, 29 Apr 2011 01:54:20 +0200 Subject: [PATCH] Masters in the data directory are loaded now, even when they don't have dependent plugins --- apps/launcher/datafilespage.cpp | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/apps/launcher/datafilespage.cpp b/apps/launcher/datafilespage.cpp index 2add275cb..99a8ce7d8 100644 --- a/apps/launcher/datafilespage.cpp +++ b/apps/launcher/datafilespage.cpp @@ -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 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