Fixed non-loading files

This commit is contained in:
graffy76 2013-10-06 22:10:38 -05:00
parent 217a4d75b4
commit 4c72a9ffdf
4 changed files with 11 additions and 7 deletions

View file

@ -128,6 +128,9 @@ void CS::Editor::openFiles()
files.push_back(path.toStdString()); files.push_back(path.toStdString());
} }
foreach (const boost::filesystem::path fp, files)
qDebug() << "loading files: " << fp.c_str();
/// \todo Get the save path from the file dialogue /// \todo Get the save path from the file dialogue
CSMDoc::Document *document = mDocumentManager.addDocument (files, *files.rbegin(), false); CSMDoc::Document *document = mDocumentManager.addDocument (files, *files.rbegin(), false);

View file

@ -44,7 +44,7 @@ QStringList CSVDoc::FileDialog::selectedFilePaths()
foreach (ContentSelectorModel::EsmFile *file, ContentSelectorView::ContentSelector:: foreach (ContentSelectorModel::EsmFile *file, ContentSelectorView::ContentSelector::
instance().selectedFiles() ) instance().selectedFiles() )
{ {
filePaths.append(file->fileName()); filePaths.append(file->path());
} }
return filePaths; return filePaths;
} }

View file

@ -15,10 +15,10 @@ ContentSelectorModel::ContentModel::ContentModel(QObject *parent) :
mDefaultFlags (Qt::ItemIsDropEnabled | Qt::ItemIsSelectable), mDefaultFlags (Qt::ItemIsDropEnabled | Qt::ItemIsSelectable),
mDropActions (Qt::CopyAction | Qt::MoveAction) mDropActions (Qt::CopyAction | Qt::MoveAction)
{ {
// setEncoding ("win1252"); setEncoding ("win1252");
uncheckAll(); uncheckAll();
} }
/*
void ContentSelectorModel::ContentModel::setEncoding(const QString &encoding) void ContentSelectorModel::ContentModel::setEncoding(const QString &encoding)
{ {
if (encoding == QLatin1String("win1252")) if (encoding == QLatin1String("win1252"))
@ -33,7 +33,7 @@ void ContentSelectorModel::ContentModel::setEncoding(const QString &encoding)
else else
return; // This should never happen; return; // This should never happen;
} }
*/
int ContentSelectorModel::ContentModel::columnCount(const QModelIndex &parent) const int ContentSelectorModel::ContentModel::columnCount(const QModelIndex &parent) const
{ {
if (parent.isValid()) if (parent.isValid())
@ -420,8 +420,9 @@ void ContentSelectorModel::ContentModel::addFiles(const QString &path)
try { try {
ESM::ESMReader fileReader; ESM::ESMReader fileReader;
ToUTF8::Utf8Encoder encoder(); //ToUTF8::calculateEncoding(QString(mCodec->name()).toStdString())); ToUTF8::Utf8Encoder encoder =
//fileReader.setEncoder(&encoder); ToUTF8::calculateEncoding(QString(mCodec->name()).toStdString());
fileReader.setEncoder(&encoder);
fileReader.open(dir.absoluteFilePath(path).toStdString()); fileReader.open(dir.absoluteFilePath(path).toStdString());
foreach (const ESM::Header::MasterData &item, fileReader.getGameFiles()) foreach (const ESM::Header::MasterData &item, fileReader.getGameFiles())

View file

@ -22,7 +22,7 @@ namespace ContentSelectorModel
public: public:
explicit ContentModel(QObject *parent = 0); explicit ContentModel(QObject *parent = 0);
//void setEncoding(const QString &encoding); void setEncoding(const QString &encoding);
int rowCount(const QModelIndex &parent = QModelIndex()) const; int rowCount(const QModelIndex &parent = QModelIndex()) const;
int columnCount(const QModelIndex &parent = QModelIndex()) const; int columnCount(const QModelIndex &parent = QModelIndex()) const;