Another stab at fixing the pathing problem...

actorid
graffy76 11 years ago
parent 0cb591e4f6
commit cddece4f9e

@ -10,6 +10,9 @@
#include <QLabel>
#include <QStyle>
#include <QDebug>
CSVDoc::AdjusterWidget::AdjusterWidget (QWidget *parent)
: QWidget (parent), mValid (false), mAction (ContentAction_Undefined)
{
@ -76,7 +79,8 @@ void CSVDoc::AdjusterWidget::setName (const QString& name, bool addon)
path.extension() == ".esp");
bool isFilePathChanged = (path.parent_path().string() != mLocalData.string());
qDebug() << "current path: " << path.parent_path().c_str();
qDebug() << "data-local: " << mLocalData.c_str();
if (isLegacyPath)
path.replace_extension (addon ? ".omwaddon" : ".omwgame");

@ -17,6 +17,8 @@
#include "filewidget.hpp"
#include "adjusterwidget.hpp"
#include <QDebug>
CSVDoc::FileDialog::FileDialog(QWidget *parent) :
QDialog(parent), mSelector (0), mFileWidget (0), mAdjusterWidget (0)
{
@ -38,7 +40,7 @@ QStringList CSVDoc::FileDialog::selectedFilePaths()
QStringList filePaths;
foreach (ContentSelectorModel::EsmFile *file, mSelector->selectedFiles() )
filePaths.append(file->path());
filePaths.append(file->filePath());
return filePaths;
}
@ -139,7 +141,8 @@ void CSVDoc::FileDialog::slotUpdateAcceptButton(const QString &name, bool)
else
{
ContentSelectorModel::EsmFile *file = mSelector->selectedFiles().back();;
mAdjusterWidget->setName (file->fileName(), !file->isGameFile());
mAdjusterWidget->setName (file->filePath(), !file->isGameFile());
qDebug() << "setting filepath " << file->filePath();
}
ui.projectButtonBox->button (QDialogButtonBox::Ok)->setEnabled (success);
@ -168,7 +171,7 @@ void CSVDoc::FileDialog::slotOpenFile()
{
ContentSelectorModel::EsmFile *file = mSelector->selectedFiles().back();
mAdjusterWidget->setName (file->fileName(), !file->isGameFile());
mAdjusterWidget->setName (file->filePath(), !file->isGameFile());
emit signalOpenFiles (mAdjusterWidget->getPath());
}

@ -69,7 +69,7 @@ const ContentSelectorModel::EsmFile *ContentSelectorModel::ContentModel::item(co
{
foreach (const EsmFile *file, mFiles)
{
if (name == file->fileName())
if (name == file->filePath())
return file;
}
return 0;
@ -158,7 +158,7 @@ QVariant ContentSelectorModel::ContentModel::data(const QModelIndex &index, int
case Qt::CheckStateRole:
{
if (!file->isGameFile())
return isChecked(file->fileName());
return isChecked(file->filePath());
break;
}
@ -174,7 +174,7 @@ QVariant ContentSelectorModel::ContentModel::data(const QModelIndex &index, int
}
case Qt::UserRole + 1:
return isChecked(file->fileName());
return isChecked(file->filePath());
break;
}
return QVariant();
@ -186,7 +186,7 @@ bool ContentSelectorModel::ContentModel::setData(const QModelIndex &index, const
return false;
EsmFile *file = item(index.row());
QString fileName = file->fileName();
QString fileName = file->filePath();
bool success = false;
switch(role)
@ -396,6 +396,7 @@ bool ContentSelectorModel::ContentModel::canBeChecked(const EsmFile *file) const
void ContentSelectorModel::ContentModel::addFile(EsmFile *file)
{
qDebug() << "adding file: " << file->filePath();
beginInsertRows(QModelIndex(), mFiles.count(), mFiles.count());
mFiles.append(file);
endInsertRows();
@ -417,6 +418,8 @@ void ContentSelectorModel::ContentModel::addFiles(const QString &path)
// Create a decoder for non-latin characters in esx metadata
QTextDecoder *decoder = codec->makeDecoder();
qDebug() << "searching path: " << path << " files found: " << dir.entryList().size();
foreach (const QString &path, dir.entryList())
{
QFileInfo info(dir.absoluteFilePath(path));
@ -430,18 +433,24 @@ void ContentSelectorModel::ContentModel::addFiles(const QString &path)
fileReader.open(dir.absoluteFilePath(path).toStdString());
foreach (const ESM::Header::MasterData &item, fileReader.getGameFiles())
{
qDebug() << "adding gamefile: " << item.name.c_str();
file->addGameFile(QString::fromStdString(item.name));
}
file->setAuthor (decoder->toUnicode(fileReader.getAuthor().c_str()));
file->setDate (info.lastModified());
file->setFormat (fileReader.getFormat());
file->setPath (info.absoluteFilePath());
file->setFilePath (info.absoluteFilePath());
file->setDescription(decoder->toUnicode(fileReader.getDesc().c_str()));
// Put the file in the table
if (item(path) == 0)
if (item(file->filePath()) == 0)
{
qDebug () << "adding file " << file->filePath();
addFile(file);
}
} catch(std::runtime_error &e) {
// An error occurred while reading the .esp
@ -543,8 +552,8 @@ void ContentSelectorModel::ContentModel::setCheckState(const QString &name, bool
{
if (downstreamFile->gameFiles().contains(name))
{
if (mCheckStates.contains(downstreamFile->fileName()))
mCheckStates[downstreamFile->fileName()] = Qt::Unchecked;
if (mCheckStates.contains(downstreamFile->filePath()))
mCheckStates[downstreamFile->filePath()] = Qt::Unchecked;
emit dataChanged(indexFromItem(downstreamFile), indexFromItem(downstreamFile));
}
@ -558,7 +567,7 @@ ContentSelectorModel::ContentFileList ContentSelectorModel::ContentModel::checke
foreach (EsmFile *file, mFiles)
{
if (isChecked(file->fileName()))
if (isChecked(file->filePath()))
list << file;
}

@ -34,7 +34,7 @@ void ContentSelectorModel::EsmFile::setFormat(int format)
mFormat = format;
}
void ContentSelectorModel::EsmFile::setPath(const QString &path)
void ContentSelectorModel::EsmFile::setFilePath(const QString &path)
{
mPath = path;
}
@ -81,7 +81,7 @@ QVariant ContentSelectorModel::EsmFile::fileProperty(const FileProperty prop) co
return mModified.toString(Qt::ISODate);
break;
case FileProperty_Path:
case FileProperty_FilePath:
return mPath;
break;
@ -118,7 +118,7 @@ void ContentSelectorModel::EsmFile::setFileProperty (const FileProperty prop, co
mModified = QDateTime::fromString(value);
break;
case FileProperty_Path:
case FileProperty_FilePath:
mPath = value;
break;

@ -23,7 +23,7 @@ namespace ContentSelectorModel
FileProperty_Author = 1,
FileProperty_Format = 2,
FileProperty_DateModified = 3,
FileProperty_Path = 4,
FileProperty_FilePath = 4,
FileProperty_Description = 5,
FileProperty_GameFile = 6
};
@ -41,7 +41,7 @@ namespace ContentSelectorModel
void setSize(const int size);
void setDate(const QDateTime &modified);
void setFormat(const int format);
void setPath(const QString &path);
void setFilePath(const QString &path);
void setGameFiles(const QStringList &gameFiles);
void setDescription(const QString &description);
@ -52,7 +52,7 @@ namespace ContentSelectorModel
inline QString author() const { return mAuthor; }
inline QDateTime modified() const { return mModified; }
inline float format() const { return mFormat; }
inline QString path() const { return mPath; }
inline QString filePath() const { return mPath; }
inline const QStringList &gameFiles() const { return mGameFiles; }
inline QString description() const { return mDescription; }
inline QString toolTip() const { return sToolTip.arg(mAuthor)

@ -42,9 +42,6 @@ void ContentSelectorView::ContentSelector::buildGameFileView()
connect (ui.gameFileView, SIGNAL (currentIndexChanged(int)),
this, SLOT (slotCurrentGameFileIndexChanged(int)));
connect (ui.gameFileView, SIGNAL (currentIndexChanged (int)),
this, SIGNAL (signalCurrentGamefileIndexChanged (int)));
ui.gameFileView->setCurrentIndex(-1);
ui.gameFileView->setCurrentIndex(0);
}
@ -145,6 +142,8 @@ void ContentSelectorView::ContentSelector::slotCurrentGameFileIndexChanged(int i
if (proxy)
proxy->setDynamicSortFilter(true);
emit signalCurrentGamefileIndexChanged (index);
}
void ContentSelectorView::ContentSelector::slotAddonTableItemClicked(const QModelIndex &index)

Loading…
Cancel
Save