forked from teamnwah/openmw-tes3coop
Moved init code to master / plugin proxy classes
This commit is contained in:
parent
7389507eb5
commit
4c8c6d6971
6 changed files with 28 additions and 28 deletions
|
@ -15,6 +15,7 @@
|
|||
#include <components/fileorderlist/utils/naturalsort.hpp>
|
||||
#include <components/fileorderlist/utils/profilescombobox.hpp>
|
||||
|
||||
#include <components/fileorderlist/masterproxymodel.hpp>"a.out.h"
|
||||
#include "settings/gamesettings.hpp"
|
||||
#include "settings/launchersettings.hpp"
|
||||
|
||||
|
@ -31,17 +32,9 @@ DataFilesPage::DataFilesPage(Files::ConfigurationManager &cfg, GameSettings &gam
|
|||
// Models
|
||||
mDataFilesModel = new DataFilesModel (this);
|
||||
|
||||
mMastersProxyModel = new QSortFilterProxyModel();
|
||||
mMastersProxyModel->setFilterRegExp(QString("game")); //QString("^.*\\.esm"));
|
||||
mMastersProxyModel->setFilterRole (Qt::UserRole);
|
||||
mMastersProxyModel->setFilterCaseSensitivity(Qt::CaseInsensitive);
|
||||
mMastersProxyModel->setSourceModel(mDataFilesModel);
|
||||
mMastersProxyModel = new MasterProxyModel (this, mDataFilesModel);
|
||||
|
||||
mPluginsProxyModel = new PluginsProxyModel();
|
||||
mPluginsProxyModel->setFilterRegExp(QString("addon")); //^.*\\.esp"));
|
||||
mPluginsProxyModel->setFilterRole (Qt::UserRole);
|
||||
mPluginsProxyModel->setFilterCaseSensitivity(Qt::CaseInsensitive);
|
||||
mPluginsProxyModel->setSourceModel(mDataFilesModel);
|
||||
mPluginsProxyModel = new PluginsProxyModel (this, mDataFilesModel);
|
||||
|
||||
mFilterProxyModel = new QSortFilterProxyModel();
|
||||
mFilterProxyModel->setDynamicSortFilter(true);
|
||||
|
|
|
@ -26,23 +26,17 @@ FileDialog::FileDialog(QWidget *parent) :
|
|||
// Models
|
||||
mDataFilesModel = new DataFilesModel (this);
|
||||
|
||||
mMastersProxyModel = new MasterProxyModel();
|
||||
mMastersProxyModel->setFilterRegExp("game"); //QString("^.*\\.esm"));
|
||||
mMastersProxyModel->setFilterRole (Qt::UserRole);
|
||||
mMastersProxyModel->setSourceModel(mDataFilesModel);
|
||||
mMastersProxyModel = new MasterProxyModel (this, mDataFilesModel);
|
||||
mPluginsProxyModel = new PluginsProxyModel (this, mDataFilesModel);
|
||||
|
||||
mPluginsProxyModel = new PluginsProxyModel();
|
||||
mPluginsProxyModel->setFilterRegExp("addon"); //QString("^.*\\.esp"));
|
||||
mPluginsProxyModel->setFilterRole (Qt::UserRole);
|
||||
mPluginsProxyModel->setSourceModel(mDataFilesModel);
|
||||
|
||||
mFilterProxyModel = new QSortFilterProxyModel();
|
||||
mFilterProxyModel->setDynamicSortFilter(true);
|
||||
mFilterProxyModel->setSourceModel(mPluginsProxyModel);
|
||||
|
||||
/*
|
||||
QCheckBox checkBox;
|
||||
unsigned int height = checkBox.sizeHint().height() + 4;
|
||||
|
||||
*/
|
||||
masterView->setModel(mMastersProxyModel);
|
||||
/*
|
||||
mastersTable->setModel(mMastersProxyModel);
|
||||
|
@ -70,10 +64,10 @@ FileDialog::FileDialog(QWidget *parent) :
|
|||
pluginsTable->setAlternatingRowColors(true);
|
||||
pluginsTable->setVerticalScrollMode(QAbstractItemView::ScrollPerItem);
|
||||
pluginsTable->horizontalHeader()->setStretchLastSection(true);
|
||||
|
||||
/*
|
||||
pluginsTable->verticalHeader()->setDefaultSectionSize(height);
|
||||
pluginsTable->verticalHeader()->setResizeMode(QHeaderView::Fixed);
|
||||
|
||||
*/
|
||||
// Hide the profile elements
|
||||
profileLabel->hide();
|
||||
profilesComboBox->hide();
|
||||
|
|
|
@ -1,8 +1,13 @@
|
|||
#include "masterproxymodel.hpp"
|
||||
|
||||
MasterProxyModel::MasterProxyModel(QObject *parent) :
|
||||
MasterProxyModel::MasterProxyModel(QObject *parent, QAbstractTableModel* model) :
|
||||
QSortFilterProxyModel(parent)
|
||||
{
|
||||
setFilterRegExp(QString("game"));
|
||||
setFilterRole (Qt::UserRole);
|
||||
|
||||
if (model)
|
||||
setSourceModel (model);
|
||||
}
|
||||
|
||||
QVariant MasterProxyModel::data(const QModelIndex &index, int role) const
|
||||
|
|
|
@ -3,11 +3,13 @@
|
|||
|
||||
#include <QSortFilterProxyModel>
|
||||
|
||||
class QAbstractTableModel;
|
||||
|
||||
class MasterProxyModel : public QSortFilterProxyModel
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit MasterProxyModel(QObject *parent = 0);
|
||||
explicit MasterProxyModel(QObject *parent = 0, QAbstractTableModel *model = 0);
|
||||
virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
|
||||
|
||||
signals:
|
||||
|
|
|
@ -1,8 +1,13 @@
|
|||
#include "pluginsproxymodel.hpp"
|
||||
|
||||
PluginsProxyModel::PluginsProxyModel(QObject *parent) :
|
||||
PluginsProxyModel::PluginsProxyModel(QObject *parent, QAbstractTableModel *model) :
|
||||
QSortFilterProxyModel(parent)
|
||||
{
|
||||
setFilterRegExp(QString("addon"));
|
||||
setFilterRole (Qt::UserRole);
|
||||
|
||||
if (model)
|
||||
setSourceModel (model);
|
||||
}
|
||||
|
||||
PluginsProxyModel::~PluginsProxyModel()
|
||||
|
|
|
@ -4,12 +4,13 @@
|
|||
#include <QSortFilterProxyModel>
|
||||
|
||||
class QVariant;
|
||||
class QAbstractTableModel;
|
||||
|
||||
class PluginsProxyModel : public QSortFilterProxyModel
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit PluginsProxyModel(QObject *parent = 0);
|
||||
explicit PluginsProxyModel(QObject *parent = 0, QAbstractTableModel *model = 0);
|
||||
~PluginsProxyModel();
|
||||
|
||||
virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
|
||||
|
|
Loading…
Reference in a new issue