mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-16 18:29:55 +00:00
Fix OpenCS crashing since commit 9d6145 by showing gamefiles if the content selector was created from OpenCS.
This commit is contained in:
parent
5e2839977b
commit
c4625b94e5
5 changed files with 21 additions and 14 deletions
|
@ -24,7 +24,7 @@ CSVDoc::FileDialog::FileDialog(QWidget *parent) :
|
||||||
resize(400, 400);
|
resize(400, 400);
|
||||||
|
|
||||||
setObjectName ("FileDialog");
|
setObjectName ("FileDialog");
|
||||||
mSelector = new ContentSelectorView::ContentSelector (ui.contentSelectorWidget);
|
mSelector = new ContentSelectorView::ContentSelector (ui.contentSelectorWidget, true);
|
||||||
mAdjusterWidget = new AdjusterWidget (this);
|
mAdjusterWidget = new AdjusterWidget (this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -147,7 +147,7 @@ void CSVDoc::FileDialog::slotUpdateAcceptButton(int)
|
||||||
|
|
||||||
void CSVDoc::FileDialog::slotUpdateAcceptButton(const QString &name, bool)
|
void CSVDoc::FileDialog::slotUpdateAcceptButton(const QString &name, bool)
|
||||||
{
|
{
|
||||||
bool success = (mSelector->selectedFiles().size() > 0);
|
bool success = !mSelector->selectedFiles().empty();
|
||||||
|
|
||||||
bool isNew = (mAction == ContentAction_New);
|
bool isNew = (mAction == ContentAction_New);
|
||||||
|
|
||||||
|
|
|
@ -9,13 +9,14 @@
|
||||||
|
|
||||||
#include "components/esm/esmreader.hpp"
|
#include "components/esm/esmreader.hpp"
|
||||||
|
|
||||||
ContentSelectorModel::ContentModel::ContentModel(QObject *parent, QIcon warningIcon) :
|
ContentSelectorModel::ContentModel::ContentModel(QObject *parent, QIcon warningIcon, bool showGameFiles) :
|
||||||
QAbstractTableModel(parent),
|
QAbstractTableModel(parent),
|
||||||
mWarningIcon(warningIcon),
|
mWarningIcon(warningIcon),
|
||||||
mMimeType ("application/omwcontent"),
|
mMimeType ("application/omwcontent"),
|
||||||
mMimeTypes (QStringList() << mMimeType),
|
mMimeTypes (QStringList() << mMimeType),
|
||||||
mColumnCount (1),
|
mColumnCount (1),
|
||||||
mDropActions (Qt::MoveAction)
|
mDropActions (Qt::MoveAction),
|
||||||
|
mShowGameFiles(showGameFiles)
|
||||||
{
|
{
|
||||||
setEncoding ("win1252");
|
setEncoding ("win1252");
|
||||||
uncheckAll();
|
uncheckAll();
|
||||||
|
@ -110,9 +111,14 @@ Qt::ItemFlags ContentSelectorModel::ContentModel::flags(const QModelIndex &index
|
||||||
if (!file)
|
if (!file)
|
||||||
return Qt::NoItemFlags;
|
return Qt::NoItemFlags;
|
||||||
|
|
||||||
//game files are not shown
|
//game files are not shown (unless OpenCS)
|
||||||
if (file->isGameFile())
|
if (file->isGameFile())
|
||||||
return Qt::NoItemFlags;
|
{
|
||||||
|
if(mShowGameFiles)
|
||||||
|
return Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsUserCheckable;
|
||||||
|
else
|
||||||
|
return Qt::NoItemFlags;
|
||||||
|
}
|
||||||
|
|
||||||
Qt::ItemFlags returnFlags;
|
Qt::ItemFlags returnFlags;
|
||||||
|
|
||||||
|
@ -463,7 +469,7 @@ void ContentSelectorModel::ContentModel::addFiles(const QString &path)
|
||||||
file->setDescription(QString::fromUtf8(fileReader.getDesc().c_str()));
|
file->setDescription(QString::fromUtf8(fileReader.getDesc().c_str()));
|
||||||
|
|
||||||
// HACK
|
// HACK
|
||||||
// Load order constraint of Bloodmoon.esm needing Tribunal.esm is missing
|
// Load order constraint of Bloodmoon.esm needing Tribunal.esm is missing
|
||||||
// from the file supplied by Bethesda, so we have to add it ourselves
|
// from the file supplied by Bethesda, so we have to add it ourselves
|
||||||
if (file->fileName().compare("Bloodmoon.esm", Qt::CaseInsensitive) == 0)
|
if (file->fileName().compare("Bloodmoon.esm", Qt::CaseInsensitive) == 0)
|
||||||
{
|
{
|
||||||
|
|
|
@ -23,7 +23,7 @@ namespace ContentSelectorModel
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit ContentModel(QObject *parent, QIcon warningIcon);
|
explicit ContentModel(QObject *parent, QIcon warningIcon, bool showGameFiles = false);
|
||||||
~ContentModel();
|
~ContentModel();
|
||||||
|
|
||||||
void setEncoding(const QString &encoding);
|
void setEncoding(const QString &encoding);
|
||||||
|
@ -66,6 +66,7 @@ namespace ContentSelectorModel
|
||||||
void addFile(EsmFile *file);
|
void addFile(EsmFile *file);
|
||||||
const EsmFile *item(int row) const;
|
const EsmFile *item(int row) const;
|
||||||
EsmFile *item(int row);
|
EsmFile *item(int row);
|
||||||
|
bool mShowGameFiles;
|
||||||
|
|
||||||
void sortFiles();
|
void sortFiles();
|
||||||
|
|
||||||
|
|
|
@ -13,21 +13,21 @@
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
ContentSelectorView::ContentSelector::ContentSelector(QWidget *parent) :
|
ContentSelectorView::ContentSelector::ContentSelector(QWidget *parent, bool showGameFiles) :
|
||||||
QObject(parent)
|
QObject(parent)
|
||||||
{
|
{
|
||||||
ui.setupUi(parent);
|
ui.setupUi(parent);
|
||||||
ui.addonView->setDragDropMode(QAbstractItemView::InternalMove);
|
ui.addonView->setDragDropMode(QAbstractItemView::InternalMove);
|
||||||
|
|
||||||
buildContentModel();
|
buildContentModel(showGameFiles);
|
||||||
buildGameFileView();
|
buildGameFileView();
|
||||||
buildAddonView();
|
buildAddonView();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ContentSelectorView::ContentSelector::buildContentModel()
|
void ContentSelectorView::ContentSelector::buildContentModel(bool showGameFiles)
|
||||||
{
|
{
|
||||||
QIcon warningIcon(ui.addonView->style()->standardIcon(QStyle::SP_MessageBoxWarning).pixmap(QSize(16, 15)));
|
QIcon warningIcon(ui.addonView->style()->standardIcon(QStyle::SP_MessageBoxWarning).pixmap(QSize(16, 15)));
|
||||||
mContentModel = new ContentSelectorModel::ContentModel(this, warningIcon);
|
mContentModel = new ContentSelectorModel::ContentModel(this, warningIcon, showGameFiles);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ContentSelectorView::ContentSelector::buildGameFileView()
|
void ContentSelectorView::ContentSelector::buildGameFileView()
|
||||||
|
|
|
@ -23,7 +23,7 @@ namespace ContentSelectorView
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
explicit ContentSelector(QWidget *parent = 0);
|
explicit ContentSelector(QWidget *parent = 0, bool showGameFiles = false);
|
||||||
|
|
||||||
QString currentFile() const;
|
QString currentFile() const;
|
||||||
|
|
||||||
|
@ -48,7 +48,7 @@ namespace ContentSelectorView
|
||||||
|
|
||||||
Ui::ContentSelector ui;
|
Ui::ContentSelector ui;
|
||||||
|
|
||||||
void buildContentModel();
|
void buildContentModel(bool showGameFiles);
|
||||||
void buildGameFileView();
|
void buildGameFileView();
|
||||||
void buildAddonView();
|
void buildAddonView();
|
||||||
void setGameFileSelected(int index, bool selected);
|
void setGameFileSelected(int index, bool selected);
|
||||||
|
|
Loading…
Reference in a new issue