diff --git a/apps/launcher/datafilespage.cpp b/apps/launcher/datafilespage.cpp index 055426f30f..8554b620bb 100644 --- a/apps/launcher/datafilespage.cpp +++ b/apps/launcher/datafilespage.cpp @@ -109,15 +109,14 @@ void Launcher::DataFilesPage::populateFileViews(const QString& contentModelName) { QStringList paths = mGameSettings.getDataDirs(); - foreach(const QString &path, paths) - mSelector->addFiles(path); - mDataLocal = mGameSettings.getDataLocal(); if (!mDataLocal.isEmpty()) - mSelector->addFiles(mDataLocal); + paths.insert(0, mDataLocal); + + foreach(const QString &path, paths) + mSelector->addFiles(path); - paths.insert(0, mDataLocal); PathIterator pathIterator(paths); mSelector->setProfileContent(filesInProfile(contentModelName, pathIterator)); diff --git a/apps/opencs/editor.cpp b/apps/opencs/editor.cpp index 7b5c3f7ab2..b22f5464d8 100644 --- a/apps/opencs/editor.cpp +++ b/apps/opencs/editor.cpp @@ -28,8 +28,6 @@ CS::Editor::Editor (int argc, char **argv) mViewManager = new CSVDoc::ViewManager(mDocumentManager); - setupDataFiles (config.first); - NifOsg::Loader::setShowMarkers(true); mDocumentManager.setFileData(mFsStrict, config.first, config.second); @@ -79,15 +77,6 @@ CS::Editor::~Editor () remove(mPid.string().c_str())); // ignore any error } -void CS::Editor::setupDataFiles (const Files::PathContainer& dataDirs) -{ - for (Files::PathContainer::const_iterator iter = dataDirs.begin(); iter != dataDirs.end(); ++iter) - { - QString path = QString::fromUtf8 (iter->string().c_str()); - mFileDialog.addFiles(path); - } -} - std::pair > CS::Editor::readConfig(bool quiet) { boost::program_options::variables_map variables; @@ -160,7 +149,7 @@ std::pair > CS::Editor::readConfi dataDirs.insert (dataDirs.end(), dataLocal.begin(), dataLocal.end()); //iterate the data directories and add them to the file dialog for loading - for (Files::PathContainer::const_iterator iter = dataDirs.begin(); iter != dataDirs.end(); ++iter) + for (Files::PathContainer::const_reverse_iterator iter = dataDirs.rbegin(); iter != dataDirs.rend(); ++iter) { QString path = QString::fromUtf8 (iter->string().c_str()); mFileDialog.addFiles(path); @@ -199,8 +188,7 @@ void CS::Editor::createAddon() mStartup.hide(); mFileDialog.clearFiles(); - std::pair > config = readConfig(/*quiet*/true); - setupDataFiles (config.first); + readConfig(/*quiet*/true); mFileDialog.showDialog (CSVDoc::ContentAction_New); } @@ -224,8 +212,7 @@ void CS::Editor::loadDocument() mStartup.hide(); mFileDialog.clearFiles(); - std::pair > config = readConfig(/*quiet*/true); - setupDataFiles (config.first); + readConfig(/*quiet*/true); mFileDialog.showDialog (CSVDoc::ContentAction_Edit); } diff --git a/apps/opencs/editor.hpp b/apps/opencs/editor.hpp index 2c2e88aefc..0c3ece9059 100644 --- a/apps/opencs/editor.hpp +++ b/apps/opencs/editor.hpp @@ -55,8 +55,6 @@ namespace CS CSVTools::Merge mMerge; CSVDoc::ViewManager* mViewManager; - void setupDataFiles (const Files::PathContainer& dataDirs); - std::pair > readConfig(bool quiet=false); ///< \return data paths diff --git a/components/contentselector/model/contentmodel.cpp b/components/contentselector/model/contentmodel.cpp index 3e5afc76da..6ac074b4db 100644 --- a/components/contentselector/model/contentmodel.cpp +++ b/components/contentselector/model/contentmodel.cpp @@ -411,14 +411,9 @@ void ContentSelectorModel::ContentModel::addFile(EsmFile *file) for (int row = 0; row < mFiles.size(); row++) { if (!mFiles.at(row)->fileName().compare(file->fileName(), Qt::CaseInsensitive)) - { - beginRemoveRows(QModelIndex(), row, row); - delete mFiles.takeAt(row); - endRemoveRows(); - emit dataChanged(index(row, 0), index(mFiles.size(), 0)); - break; - } + return; } + beginInsertRows(QModelIndex(), mFiles.count(), mFiles.count()); mFiles.append(file); endInsertRows();