mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-19 21:53:51 +00:00
Experimental folder handling rewrite
This commit is contained in:
parent
2fbed21f83
commit
5cd781b3eb
4 changed files with 9 additions and 30 deletions
|
@ -109,15 +109,14 @@ void Launcher::DataFilesPage::populateFileViews(const QString& contentModelName)
|
||||||
{
|
{
|
||||||
QStringList paths = mGameSettings.getDataDirs();
|
QStringList paths = mGameSettings.getDataDirs();
|
||||||
|
|
||||||
foreach(const QString &path, paths)
|
|
||||||
mSelector->addFiles(path);
|
|
||||||
|
|
||||||
mDataLocal = mGameSettings.getDataLocal();
|
mDataLocal = mGameSettings.getDataLocal();
|
||||||
|
|
||||||
if (!mDataLocal.isEmpty())
|
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);
|
PathIterator pathIterator(paths);
|
||||||
|
|
||||||
mSelector->setProfileContent(filesInProfile(contentModelName, pathIterator));
|
mSelector->setProfileContent(filesInProfile(contentModelName, pathIterator));
|
||||||
|
|
|
@ -28,8 +28,6 @@ CS::Editor::Editor (int argc, char **argv)
|
||||||
|
|
||||||
mViewManager = new CSVDoc::ViewManager(mDocumentManager);
|
mViewManager = new CSVDoc::ViewManager(mDocumentManager);
|
||||||
|
|
||||||
setupDataFiles (config.first);
|
|
||||||
|
|
||||||
NifOsg::Loader::setShowMarkers(true);
|
NifOsg::Loader::setShowMarkers(true);
|
||||||
|
|
||||||
mDocumentManager.setFileData(mFsStrict, config.first, config.second);
|
mDocumentManager.setFileData(mFsStrict, config.first, config.second);
|
||||||
|
@ -79,15 +77,6 @@ CS::Editor::~Editor ()
|
||||||
remove(mPid.string().c_str())); // ignore any error
|
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<Files::PathContainer, std::vector<std::string> > CS::Editor::readConfig(bool quiet)
|
std::pair<Files::PathContainer, std::vector<std::string> > CS::Editor::readConfig(bool quiet)
|
||||||
{
|
{
|
||||||
boost::program_options::variables_map variables;
|
boost::program_options::variables_map variables;
|
||||||
|
@ -160,7 +149,7 @@ std::pair<Files::PathContainer, std::vector<std::string> > CS::Editor::readConfi
|
||||||
dataDirs.insert (dataDirs.end(), dataLocal.begin(), dataLocal.end());
|
dataDirs.insert (dataDirs.end(), dataLocal.begin(), dataLocal.end());
|
||||||
|
|
||||||
//iterate the data directories and add them to the file dialog for loading
|
//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());
|
QString path = QString::fromUtf8 (iter->string().c_str());
|
||||||
mFileDialog.addFiles(path);
|
mFileDialog.addFiles(path);
|
||||||
|
@ -199,8 +188,7 @@ void CS::Editor::createAddon()
|
||||||
mStartup.hide();
|
mStartup.hide();
|
||||||
|
|
||||||
mFileDialog.clearFiles();
|
mFileDialog.clearFiles();
|
||||||
std::pair<Files::PathContainer, std::vector<std::string> > config = readConfig(/*quiet*/true);
|
readConfig(/*quiet*/true);
|
||||||
setupDataFiles (config.first);
|
|
||||||
|
|
||||||
mFileDialog.showDialog (CSVDoc::ContentAction_New);
|
mFileDialog.showDialog (CSVDoc::ContentAction_New);
|
||||||
}
|
}
|
||||||
|
@ -224,8 +212,7 @@ void CS::Editor::loadDocument()
|
||||||
mStartup.hide();
|
mStartup.hide();
|
||||||
|
|
||||||
mFileDialog.clearFiles();
|
mFileDialog.clearFiles();
|
||||||
std::pair<Files::PathContainer, std::vector<std::string> > config = readConfig(/*quiet*/true);
|
readConfig(/*quiet*/true);
|
||||||
setupDataFiles (config.first);
|
|
||||||
|
|
||||||
mFileDialog.showDialog (CSVDoc::ContentAction_Edit);
|
mFileDialog.showDialog (CSVDoc::ContentAction_Edit);
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,8 +55,6 @@ namespace CS
|
||||||
CSVTools::Merge mMerge;
|
CSVTools::Merge mMerge;
|
||||||
CSVDoc::ViewManager* mViewManager;
|
CSVDoc::ViewManager* mViewManager;
|
||||||
|
|
||||||
void setupDataFiles (const Files::PathContainer& dataDirs);
|
|
||||||
|
|
||||||
std::pair<Files::PathContainer, std::vector<std::string> > readConfig(bool quiet=false);
|
std::pair<Files::PathContainer, std::vector<std::string> > readConfig(bool quiet=false);
|
||||||
///< \return data paths
|
///< \return data paths
|
||||||
|
|
||||||
|
|
|
@ -411,14 +411,9 @@ void ContentSelectorModel::ContentModel::addFile(EsmFile *file)
|
||||||
for (int row = 0; row < mFiles.size(); row++)
|
for (int row = 0; row < mFiles.size(); row++)
|
||||||
{
|
{
|
||||||
if (!mFiles.at(row)->fileName().compare(file->fileName(), Qt::CaseInsensitive))
|
if (!mFiles.at(row)->fileName().compare(file->fileName(), Qt::CaseInsensitive))
|
||||||
{
|
return;
|
||||||
beginRemoveRows(QModelIndex(), row, row);
|
|
||||||
delete mFiles.takeAt(row);
|
|
||||||
endRemoveRows();
|
|
||||||
emit dataChanged(index(row, 0), index(mFiles.size(), 0));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
beginInsertRows(QModelIndex(), mFiles.count(), mFiles.count());
|
beginInsertRows(QModelIndex(), mFiles.count(), mFiles.count());
|
||||||
mFiles.append(file);
|
mFiles.append(file);
|
||||||
endInsertRows();
|
endInsertRows();
|
||||||
|
|
Loading…
Reference in a new issue