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/naturalsort.hpp>
|
||||||
#include <components/fileorderlist/utils/profilescombobox.hpp>
|
#include <components/fileorderlist/utils/profilescombobox.hpp>
|
||||||
|
|
||||||
|
#include <components/fileorderlist/masterproxymodel.hpp>"a.out.h"
|
||||||
#include "settings/gamesettings.hpp"
|
#include "settings/gamesettings.hpp"
|
||||||
#include "settings/launchersettings.hpp"
|
#include "settings/launchersettings.hpp"
|
||||||
|
|
||||||
|
@ -29,19 +30,11 @@ DataFilesPage::DataFilesPage(Files::ConfigurationManager &cfg, GameSettings &gam
|
||||||
setupUi(this);
|
setupUi(this);
|
||||||
|
|
||||||
// Models
|
// Models
|
||||||
mDataFilesModel = new DataFilesModel(this);
|
mDataFilesModel = new DataFilesModel (this);
|
||||||
|
|
||||||
mMastersProxyModel = new QSortFilterProxyModel();
|
mMastersProxyModel = new MasterProxyModel (this, mDataFilesModel);
|
||||||
mMastersProxyModel->setFilterRegExp(QString("game")); //QString("^.*\\.esm"));
|
|
||||||
mMastersProxyModel->setFilterRole (Qt::UserRole);
|
|
||||||
mMastersProxyModel->setFilterCaseSensitivity(Qt::CaseInsensitive);
|
|
||||||
mMastersProxyModel->setSourceModel(mDataFilesModel);
|
|
||||||
|
|
||||||
mPluginsProxyModel = new PluginsProxyModel();
|
mPluginsProxyModel = new PluginsProxyModel (this, mDataFilesModel);
|
||||||
mPluginsProxyModel->setFilterRegExp(QString("addon")); //^.*\\.esp"));
|
|
||||||
mPluginsProxyModel->setFilterRole (Qt::UserRole);
|
|
||||||
mPluginsProxyModel->setFilterCaseSensitivity(Qt::CaseInsensitive);
|
|
||||||
mPluginsProxyModel->setSourceModel(mDataFilesModel);
|
|
||||||
|
|
||||||
mFilterProxyModel = new QSortFilterProxyModel();
|
mFilterProxyModel = new QSortFilterProxyModel();
|
||||||
mFilterProxyModel->setDynamicSortFilter(true);
|
mFilterProxyModel->setDynamicSortFilter(true);
|
||||||
|
|
|
@ -24,25 +24,19 @@ FileDialog::FileDialog(QWidget *parent) :
|
||||||
setupUi(this);
|
setupUi(this);
|
||||||
|
|
||||||
// Models
|
// Models
|
||||||
mDataFilesModel = new DataFilesModel(this);
|
mDataFilesModel = new DataFilesModel (this);
|
||||||
|
|
||||||
mMastersProxyModel = new MasterProxyModel();
|
mMastersProxyModel = new MasterProxyModel (this, mDataFilesModel);
|
||||||
mMastersProxyModel->setFilterRegExp("game"); //QString("^.*\\.esm"));
|
mPluginsProxyModel = new PluginsProxyModel (this, mDataFilesModel);
|
||||||
mMastersProxyModel->setFilterRole (Qt::UserRole);
|
|
||||||
mMastersProxyModel->setSourceModel(mDataFilesModel);
|
|
||||||
|
|
||||||
mPluginsProxyModel = new PluginsProxyModel();
|
|
||||||
mPluginsProxyModel->setFilterRegExp("addon"); //QString("^.*\\.esp"));
|
|
||||||
mPluginsProxyModel->setFilterRole (Qt::UserRole);
|
|
||||||
mPluginsProxyModel->setSourceModel(mDataFilesModel);
|
|
||||||
|
|
||||||
mFilterProxyModel = new QSortFilterProxyModel();
|
mFilterProxyModel = new QSortFilterProxyModel();
|
||||||
mFilterProxyModel->setDynamicSortFilter(true);
|
mFilterProxyModel->setDynamicSortFilter(true);
|
||||||
mFilterProxyModel->setSourceModel(mPluginsProxyModel);
|
mFilterProxyModel->setSourceModel(mPluginsProxyModel);
|
||||||
|
/*
|
||||||
QCheckBox checkBox;
|
QCheckBox checkBox;
|
||||||
unsigned int height = checkBox.sizeHint().height() + 4;
|
unsigned int height = checkBox.sizeHint().height() + 4;
|
||||||
|
*/
|
||||||
masterView->setModel(mMastersProxyModel);
|
masterView->setModel(mMastersProxyModel);
|
||||||
/*
|
/*
|
||||||
mastersTable->setModel(mMastersProxyModel);
|
mastersTable->setModel(mMastersProxyModel);
|
||||||
|
@ -70,10 +64,10 @@ FileDialog::FileDialog(QWidget *parent) :
|
||||||
pluginsTable->setAlternatingRowColors(true);
|
pluginsTable->setAlternatingRowColors(true);
|
||||||
pluginsTable->setVerticalScrollMode(QAbstractItemView::ScrollPerItem);
|
pluginsTable->setVerticalScrollMode(QAbstractItemView::ScrollPerItem);
|
||||||
pluginsTable->horizontalHeader()->setStretchLastSection(true);
|
pluginsTable->horizontalHeader()->setStretchLastSection(true);
|
||||||
|
/*
|
||||||
pluginsTable->verticalHeader()->setDefaultSectionSize(height);
|
pluginsTable->verticalHeader()->setDefaultSectionSize(height);
|
||||||
pluginsTable->verticalHeader()->setResizeMode(QHeaderView::Fixed);
|
pluginsTable->verticalHeader()->setResizeMode(QHeaderView::Fixed);
|
||||||
|
*/
|
||||||
// Hide the profile elements
|
// Hide the profile elements
|
||||||
profileLabel->hide();
|
profileLabel->hide();
|
||||||
profilesComboBox->hide();
|
profilesComboBox->hide();
|
||||||
|
|
|
@ -1,8 +1,13 @@
|
||||||
#include "masterproxymodel.hpp"
|
#include "masterproxymodel.hpp"
|
||||||
|
|
||||||
MasterProxyModel::MasterProxyModel(QObject *parent) :
|
MasterProxyModel::MasterProxyModel(QObject *parent, QAbstractTableModel* model) :
|
||||||
QSortFilterProxyModel(parent)
|
QSortFilterProxyModel(parent)
|
||||||
{
|
{
|
||||||
|
setFilterRegExp(QString("game"));
|
||||||
|
setFilterRole (Qt::UserRole);
|
||||||
|
|
||||||
|
if (model)
|
||||||
|
setSourceModel (model);
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariant MasterProxyModel::data(const QModelIndex &index, int role) const
|
QVariant MasterProxyModel::data(const QModelIndex &index, int role) const
|
||||||
|
|
|
@ -3,11 +3,13 @@
|
||||||
|
|
||||||
#include <QSortFilterProxyModel>
|
#include <QSortFilterProxyModel>
|
||||||
|
|
||||||
|
class QAbstractTableModel;
|
||||||
|
|
||||||
class MasterProxyModel : public QSortFilterProxyModel
|
class MasterProxyModel : public QSortFilterProxyModel
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
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;
|
virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
|
|
@ -1,8 +1,13 @@
|
||||||
#include "pluginsproxymodel.hpp"
|
#include "pluginsproxymodel.hpp"
|
||||||
|
|
||||||
PluginsProxyModel::PluginsProxyModel(QObject *parent) :
|
PluginsProxyModel::PluginsProxyModel(QObject *parent, QAbstractTableModel *model) :
|
||||||
QSortFilterProxyModel(parent)
|
QSortFilterProxyModel(parent)
|
||||||
{
|
{
|
||||||
|
setFilterRegExp(QString("addon"));
|
||||||
|
setFilterRole (Qt::UserRole);
|
||||||
|
|
||||||
|
if (model)
|
||||||
|
setSourceModel (model);
|
||||||
}
|
}
|
||||||
|
|
||||||
PluginsProxyModel::~PluginsProxyModel()
|
PluginsProxyModel::~PluginsProxyModel()
|
||||||
|
|
|
@ -4,12 +4,13 @@
|
||||||
#include <QSortFilterProxyModel>
|
#include <QSortFilterProxyModel>
|
||||||
|
|
||||||
class QVariant;
|
class QVariant;
|
||||||
|
class QAbstractTableModel;
|
||||||
|
|
||||||
class PluginsProxyModel : public QSortFilterProxyModel
|
class PluginsProxyModel : public QSortFilterProxyModel
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit PluginsProxyModel(QObject *parent = 0);
|
explicit PluginsProxyModel(QObject *parent = 0, QAbstractTableModel *model = 0);
|
||||||
~PluginsProxyModel();
|
~PluginsProxyModel();
|
||||||
|
|
||||||
virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
|
virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
|
||||||
|
|
Loading…
Reference in a new issue