Remove unnecessary boolean passing between objects.

celladd
cc9cii 10 years ago
parent c4625b94e5
commit 1ee6153940

@ -24,7 +24,7 @@ CSVDoc::FileDialog::FileDialog(QWidget *parent) :
resize(400, 400);
setObjectName ("FileDialog");
mSelector = new ContentSelectorView::ContentSelector (ui.contentSelectorWidget, true);
mSelector = new ContentSelectorView::ContentSelector (ui.contentSelectorWidget);
mAdjusterWidget = new AdjusterWidget (this);
}

@ -9,14 +9,13 @@
#include "components/esm/esmreader.hpp"
ContentSelectorModel::ContentModel::ContentModel(QObject *parent, QIcon warningIcon, bool showGameFiles) :
ContentSelectorModel::ContentModel::ContentModel(QObject *parent, QIcon warningIcon) :
QAbstractTableModel(parent),
mWarningIcon(warningIcon),
mMimeType ("application/omwcontent"),
mMimeTypes (QStringList() << mMimeType),
mColumnCount (1),
mDropActions (Qt::MoveAction),
mShowGameFiles(showGameFiles)
mDropActions (Qt::MoveAction)
{
setEncoding ("win1252");
uncheckAll();
@ -111,14 +110,9 @@ Qt::ItemFlags ContentSelectorModel::ContentModel::flags(const QModelIndex &index
if (!file)
return Qt::NoItemFlags;
//game files are not shown (unless OpenCS)
//game files can always be checked
if (file->isGameFile())
{
if(mShowGameFiles)
return Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsUserCheckable;
else
return Qt::NoItemFlags;
}
return Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsUserCheckable;
Qt::ItemFlags returnFlags;

@ -23,7 +23,7 @@ namespace ContentSelectorModel
{
Q_OBJECT
public:
explicit ContentModel(QObject *parent, QIcon warningIcon, bool showGameFiles = false);
explicit ContentModel(QObject *parent, QIcon warningIcon);
~ContentModel();
void setEncoding(const QString &encoding);
@ -66,7 +66,6 @@ namespace ContentSelectorModel
void addFile(EsmFile *file);
const EsmFile *item(int row) const;
EsmFile *item(int row);
bool mShowGameFiles;
void sortFiles();

@ -13,21 +13,21 @@
#include <QDir>
#include <assert.h>
ContentSelectorView::ContentSelector::ContentSelector(QWidget *parent, bool showGameFiles) :
ContentSelectorView::ContentSelector::ContentSelector(QWidget *parent) :
QObject(parent)
{
ui.setupUi(parent);
ui.addonView->setDragDropMode(QAbstractItemView::InternalMove);
buildContentModel(showGameFiles);
buildContentModel();
buildGameFileView();
buildAddonView();
}
void ContentSelectorView::ContentSelector::buildContentModel(bool showGameFiles)
void ContentSelectorView::ContentSelector::buildContentModel()
{
QIcon warningIcon(ui.addonView->style()->standardIcon(QStyle::SP_MessageBoxWarning).pixmap(QSize(16, 15)));
mContentModel = new ContentSelectorModel::ContentModel(this, warningIcon, showGameFiles);
mContentModel = new ContentSelectorModel::ContentModel(this, warningIcon);
}
void ContentSelectorView::ContentSelector::buildGameFileView()

@ -23,7 +23,7 @@ namespace ContentSelectorView
public:
explicit ContentSelector(QWidget *parent = 0, bool showGameFiles = false);
explicit ContentSelector(QWidget *parent = 0);
QString currentFile() const;
@ -48,7 +48,7 @@ namespace ContentSelectorView
Ui::ContentSelector ui;
void buildContentModel(bool showGameFiles);
void buildContentModel();
void buildGameFileView();
void buildAddonView();
void setGameFileSelected(int index, bool selected);

Loading…
Cancel
Save