mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-03-03 16:49:54 +00:00
Restructured esxselector directory
Added ./view Removed ./utils and ./model/esm Relocated code accordingly.
This commit is contained in:
parent
d0363b037c
commit
a14e0b32d8
17 changed files with 20 additions and 123 deletions
|
@ -20,7 +20,7 @@ class PluginsProxyModel;
|
||||||
|
|
||||||
namespace Files { struct ConfigurationManager; }
|
namespace Files { struct ConfigurationManager; }
|
||||||
|
|
||||||
class DataFilesPage : public FileOrderList::ContentSelector
|
class DataFilesPage : public EsxSelector::ContentSelector
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -18,7 +18,7 @@ class QMenu;
|
||||||
class DataFilesModel;
|
class DataFilesModel;
|
||||||
class PluginsProxyModel;
|
class PluginsProxyModel;
|
||||||
|
|
||||||
class FileDialog : public FileOrderList::ContentSelector
|
class FileDialog : public EsxSelector::ContentSelector
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -72,9 +72,10 @@ find_package(Qt4 COMPONENTS QtCore QtGui)
|
||||||
|
|
||||||
if(QT_QTGUI_LIBRARY AND QT_QTCORE_LIBRARY)
|
if(QT_QTGUI_LIBRARY AND QT_QTCORE_LIBRARY)
|
||||||
add_component_qt_dir (esxselector
|
add_component_qt_dir (esxselector
|
||||||
masterproxymodel contentselector
|
model/masterproxymodel model/modelitem model/datafilesmodel
|
||||||
model/modelitem model/datafilesmodel model/pluginsproxymodel model/esm/esmfile
|
model/pluginsproxymodel model/esm/esmfile model/naturalsort
|
||||||
utils/profilescombobox utils/comboboxlineedit utils/lineedit utils/naturalsort
|
view/profilescombobox view/comboboxlineedit
|
||||||
|
view/lineedit view/contentselector
|
||||||
)
|
)
|
||||||
|
|
||||||
include(${QT_USE_FILE})
|
include(${QT_USE_FILE})
|
||||||
|
|
|
@ -1,50 +0,0 @@
|
||||||
#include "esmfile.hpp"
|
|
||||||
|
|
||||||
EsmFile::EsmFile(QString fileName, ModelItem *parent)
|
|
||||||
: ModelItem(parent)
|
|
||||||
{
|
|
||||||
mFileName = fileName;
|
|
||||||
mSize = 0;
|
|
||||||
mVersion = 0.0f;
|
|
||||||
}
|
|
||||||
|
|
||||||
void EsmFile::setFileName(const QString &fileName)
|
|
||||||
{
|
|
||||||
mFileName = fileName;
|
|
||||||
}
|
|
||||||
|
|
||||||
void EsmFile::setAuthor(const QString &author)
|
|
||||||
{
|
|
||||||
mAuthor = author;
|
|
||||||
}
|
|
||||||
|
|
||||||
void EsmFile::setSize(const int size)
|
|
||||||
{
|
|
||||||
mSize = size;
|
|
||||||
}
|
|
||||||
|
|
||||||
void EsmFile::setDates(const QDateTime &modified, const QDateTime &accessed)
|
|
||||||
{
|
|
||||||
mModified = modified;
|
|
||||||
mAccessed = accessed;
|
|
||||||
}
|
|
||||||
|
|
||||||
void EsmFile::setVersion(float version)
|
|
||||||
{
|
|
||||||
mVersion = version;
|
|
||||||
}
|
|
||||||
|
|
||||||
void EsmFile::setPath(const QString &path)
|
|
||||||
{
|
|
||||||
mPath = path;
|
|
||||||
}
|
|
||||||
|
|
||||||
void EsmFile::setMasters(const QStringList &masters)
|
|
||||||
{
|
|
||||||
mMasters = masters;
|
|
||||||
}
|
|
||||||
|
|
||||||
void EsmFile::setDescription(const QString &description)
|
|
||||||
{
|
|
||||||
mDescription = description;
|
|
||||||
}
|
|
|
@ -1,54 +0,0 @@
|
||||||
#ifndef ESMFILE_HPP
|
|
||||||
#define ESMFILE_HPP
|
|
||||||
|
|
||||||
#include <QDateTime>
|
|
||||||
#include <QStringList>
|
|
||||||
|
|
||||||
#include "../modelitem.hpp"
|
|
||||||
|
|
||||||
class EsmFile : public ModelItem
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
Q_PROPERTY(QString filename READ fileName)
|
|
||||||
|
|
||||||
public:
|
|
||||||
EsmFile(QString fileName = QString(), ModelItem *parent = 0);
|
|
||||||
|
|
||||||
~EsmFile()
|
|
||||||
{}
|
|
||||||
|
|
||||||
void setFileName(const QString &fileName);
|
|
||||||
void setAuthor(const QString &author);
|
|
||||||
void setSize(const int size);
|
|
||||||
void setDates(const QDateTime &modified, const QDateTime &accessed);
|
|
||||||
void setVersion(const float version);
|
|
||||||
void setPath(const QString &path);
|
|
||||||
void setMasters(const QStringList &masters);
|
|
||||||
void setDescription(const QString &description);
|
|
||||||
|
|
||||||
inline QString fileName() const { return mFileName; }
|
|
||||||
inline QString author() const { return mAuthor; }
|
|
||||||
inline int size() const { return mSize; }
|
|
||||||
inline QDateTime modified() const { return mModified; }
|
|
||||||
inline QDateTime accessed() const { return mAccessed; }
|
|
||||||
inline float version() const { return mVersion; }
|
|
||||||
inline QString path() const { return mPath; }
|
|
||||||
inline QStringList masters() const { return mMasters; }
|
|
||||||
inline QString description() const { return mDescription; }
|
|
||||||
|
|
||||||
|
|
||||||
private:
|
|
||||||
QString mFileName;
|
|
||||||
QString mAuthor;
|
|
||||||
int mSize;
|
|
||||||
QDateTime mModified;
|
|
||||||
QDateTime mAccessed;
|
|
||||||
float mVersion;
|
|
||||||
QString mPath;
|
|
||||||
QStringList mMasters;
|
|
||||||
QString mDescription;
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
|
|
@ -1,6 +1,6 @@
|
||||||
#include "masterproxymodel.hpp"
|
#include "masterproxymodel.hpp"
|
||||||
|
|
||||||
FileOrderList::MasterProxyModel::MasterProxyModel(QObject *parent, QAbstractTableModel* model) :
|
EsxSelector::MasterProxyModel::MasterProxyModel(QObject *parent, QAbstractTableModel* model) :
|
||||||
QSortFilterProxyModel(parent)
|
QSortFilterProxyModel(parent)
|
||||||
{
|
{
|
||||||
setFilterRegExp(QString("game"));
|
setFilterRegExp(QString("game"));
|
||||||
|
@ -10,7 +10,7 @@ FileOrderList::MasterProxyModel::MasterProxyModel(QObject *parent, QAbstractTabl
|
||||||
setSourceModel (model);
|
setSourceModel (model);
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariant FileOrderList::MasterProxyModel::data(const QModelIndex &index, int role) const
|
QVariant EsxSelector::MasterProxyModel::data(const QModelIndex &index, int role) const
|
||||||
{
|
{
|
||||||
return QSortFilterProxyModel::data (index, role);
|
return QSortFilterProxyModel::data (index, role);
|
||||||
}
|
}
|
|
@ -5,7 +5,7 @@
|
||||||
|
|
||||||
class QAbstractTableModel;
|
class QAbstractTableModel;
|
||||||
|
|
||||||
namespace FileOrderList
|
namespace EsxSelector
|
||||||
{
|
{
|
||||||
class MasterProxyModel : public QSortFilterProxyModel
|
class MasterProxyModel : public QSortFilterProxyModel
|
||||||
{
|
{
|
|
@ -10,19 +10,19 @@
|
||||||
#include <QMenu>
|
#include <QMenu>
|
||||||
#include <QContextMenuEvent>
|
#include <QContextMenuEvent>
|
||||||
|
|
||||||
FileOrderList::ContentSelector::ContentSelector(QWidget *parent) :
|
EsxSelector::ContentSelector::ContentSelector(QWidget *parent) :
|
||||||
QWidget(parent)
|
QWidget(parent)
|
||||||
{
|
{
|
||||||
setupUi(this);
|
setupUi(this);
|
||||||
buildModelsAndViews();
|
buildModelsAndViews();
|
||||||
}
|
}
|
||||||
|
|
||||||
void FileOrderList::ContentSelector::buildModelsAndViews()
|
void EsxSelector::ContentSelector::buildModelsAndViews()
|
||||||
{
|
{
|
||||||
// Models
|
// Models
|
||||||
mDataFilesModel = new DataFilesModel (this);
|
mDataFilesModel = new DataFilesModel (this);
|
||||||
|
|
||||||
mMasterProxyModel = new FileOrderList::MasterProxyModel (this, mDataFilesModel);
|
mMasterProxyModel = new EsxSelector::MasterProxyModel (this, mDataFilesModel);
|
||||||
mPluginsProxyModel = new PluginsProxyModel (this, mDataFilesModel);
|
mPluginsProxyModel = new PluginsProxyModel (this, mDataFilesModel);
|
||||||
|
|
||||||
masterView->setModel(mMasterProxyModel);
|
masterView->setModel(mMasterProxyModel);
|
||||||
|
@ -35,7 +35,7 @@ void FileOrderList::ContentSelector::buildModelsAndViews()
|
||||||
connect(profilesComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(slotCurrentProfileIndexChanged(int)));
|
connect(profilesComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(slotCurrentProfileIndexChanged(int)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void FileOrderList::ContentSelector::addFiles(const QString &path)
|
void EsxSelector::ContentSelector::addFiles(const QString &path)
|
||||||
{
|
{
|
||||||
mDataFilesModel->addFiles(path);
|
mDataFilesModel->addFiles(path);
|
||||||
mDataFilesModel->sort(3); // Sort by date accessed
|
mDataFilesModel->sort(3); // Sort by date accessed
|
||||||
|
@ -43,12 +43,12 @@ void FileOrderList::ContentSelector::addFiles(const QString &path)
|
||||||
mDataFilesModel->uncheckAll();
|
mDataFilesModel->uncheckAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
void FileOrderList::ContentSelector::setEncoding(const QString &encoding)
|
void EsxSelector::ContentSelector::setEncoding(const QString &encoding)
|
||||||
{
|
{
|
||||||
mDataFilesModel->setEncoding(encoding);
|
mDataFilesModel->setEncoding(encoding);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FileOrderList::ContentSelector::setCheckState(QModelIndex index, QSortFilterProxyModel *model)
|
void EsxSelector::ContentSelector::setCheckState(QModelIndex index, QSortFilterProxyModel *model)
|
||||||
{
|
{
|
||||||
if (!index.isValid())
|
if (!index.isValid())
|
||||||
return;
|
return;
|
||||||
|
@ -66,12 +66,12 @@ void FileOrderList::ContentSelector::setCheckState(QModelIndex index, QSortFilte
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList FileOrderList::ContentSelector::checkedItemsPaths()
|
QStringList EsxSelector::ContentSelector::checkedItemsPaths()
|
||||||
{
|
{
|
||||||
return mDataFilesModel->checkedItemsPaths();
|
return mDataFilesModel->checkedItemsPaths();
|
||||||
}
|
}
|
||||||
|
|
||||||
void FileOrderList::ContentSelector::updateViews()
|
void EsxSelector::ContentSelector::updateViews()
|
||||||
{
|
{
|
||||||
// Ensure the columns are hidden because sort() re-enables them
|
// Ensure the columns are hidden because sort() re-enables them
|
||||||
pluginView->setColumnHidden(1, true);
|
pluginView->setColumnHidden(1, true);
|
||||||
|
@ -85,12 +85,12 @@ void FileOrderList::ContentSelector::updateViews()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void FileOrderList::ContentSelector::slotCurrentProfileIndexChanged(int index)
|
void EsxSelector::ContentSelector::slotCurrentProfileIndexChanged(int index)
|
||||||
{
|
{
|
||||||
emit profileChanged(index);
|
emit profileChanged(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FileOrderList::ContentSelector::slotCurrentMasterIndexChanged(int index)
|
void EsxSelector::ContentSelector::slotCurrentMasterIndexChanged(int index)
|
||||||
{
|
{
|
||||||
QObject *object = QObject::sender();
|
QObject *object = QObject::sender();
|
||||||
|
|
||||||
|
@ -101,7 +101,7 @@ void FileOrderList::ContentSelector::slotCurrentMasterIndexChanged(int index)
|
||||||
setCheckState(mMasterProxyModel->index(index, 0), mMasterProxyModel);
|
setCheckState(mMasterProxyModel->index(index, 0), mMasterProxyModel);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FileOrderList::ContentSelector::slotPluginTableItemClicked(const QModelIndex &index)
|
void EsxSelector::ContentSelector::slotPluginTableItemClicked(const QModelIndex &index)
|
||||||
{
|
{
|
||||||
setCheckState(index, mPluginsProxyModel);
|
setCheckState(index, mPluginsProxyModel);
|
||||||
}
|
}
|
Loading…
Reference in a new issue