mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-02-10 21:40:15 +00:00
Restructured esxselector directory
Added ./view Removed ./utils and ./model/esm Relocated code accordingly.
This commit is contained in:
parent
d0363b037c
commit
a14e0b32d8
@ -20,7 +20,7 @@ class PluginsProxyModel;
|
||||
|
||||
namespace Files { struct ConfigurationManager; }
|
||||
|
||||
class DataFilesPage : public FileOrderList::ContentSelector
|
||||
class DataFilesPage : public EsxSelector::ContentSelector
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
@ -18,7 +18,7 @@ class QMenu;
|
||||
class DataFilesModel;
|
||||
class PluginsProxyModel;
|
||||
|
||||
class FileDialog : public FileOrderList::ContentSelector
|
||||
class FileDialog : public EsxSelector::ContentSelector
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
@ -72,9 +72,10 @@ find_package(Qt4 COMPONENTS QtCore QtGui)
|
||||
|
||||
if(QT_QTGUI_LIBRARY AND QT_QTCORE_LIBRARY)
|
||||
add_component_qt_dir (esxselector
|
||||
masterproxymodel contentselector
|
||||
model/modelitem model/datafilesmodel model/pluginsproxymodel model/esm/esmfile
|
||||
utils/profilescombobox utils/comboboxlineedit utils/lineedit utils/naturalsort
|
||||
model/masterproxymodel model/modelitem model/datafilesmodel
|
||||
model/pluginsproxymodel model/esm/esmfile model/naturalsort
|
||||
view/profilescombobox view/comboboxlineedit
|
||||
view/lineedit view/contentselector
|
||||
)
|
||||
|
||||
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"
|
||||
|
||||
FileOrderList::MasterProxyModel::MasterProxyModel(QObject *parent, QAbstractTableModel* model) :
|
||||
EsxSelector::MasterProxyModel::MasterProxyModel(QObject *parent, QAbstractTableModel* model) :
|
||||
QSortFilterProxyModel(parent)
|
||||
{
|
||||
setFilterRegExp(QString("game"));
|
||||
@ -10,7 +10,7 @@ FileOrderList::MasterProxyModel::MasterProxyModel(QObject *parent, QAbstractTabl
|
||||
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);
|
||||
}
|
@ -5,7 +5,7 @@
|
||||
|
||||
class QAbstractTableModel;
|
||||
|
||||
namespace FileOrderList
|
||||
namespace EsxSelector
|
||||
{
|
||||
class MasterProxyModel : public QSortFilterProxyModel
|
||||
{
|
@ -10,19 +10,19 @@
|
||||
#include <QMenu>
|
||||
#include <QContextMenuEvent>
|
||||
|
||||
FileOrderList::ContentSelector::ContentSelector(QWidget *parent) :
|
||||
EsxSelector::ContentSelector::ContentSelector(QWidget *parent) :
|
||||
QWidget(parent)
|
||||
{
|
||||
setupUi(this);
|
||||
buildModelsAndViews();
|
||||
}
|
||||
|
||||
void FileOrderList::ContentSelector::buildModelsAndViews()
|
||||
void EsxSelector::ContentSelector::buildModelsAndViews()
|
||||
{
|
||||
// Models
|
||||
mDataFilesModel = new DataFilesModel (this);
|
||||
|
||||
mMasterProxyModel = new FileOrderList::MasterProxyModel (this, mDataFilesModel);
|
||||
mMasterProxyModel = new EsxSelector::MasterProxyModel (this, mDataFilesModel);
|
||||
mPluginsProxyModel = new PluginsProxyModel (this, mDataFilesModel);
|
||||
|
||||
masterView->setModel(mMasterProxyModel);
|
||||
@ -35,7 +35,7 @@ void FileOrderList::ContentSelector::buildModelsAndViews()
|
||||
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->sort(3); // Sort by date accessed
|
||||
@ -43,12 +43,12 @@ void FileOrderList::ContentSelector::addFiles(const QString &path)
|
||||
mDataFilesModel->uncheckAll();
|
||||
}
|
||||
|
||||
void FileOrderList::ContentSelector::setEncoding(const QString &encoding)
|
||||
void EsxSelector::ContentSelector::setEncoding(const QString &encoding)
|
||||
{
|
||||
mDataFilesModel->setEncoding(encoding);
|
||||
}
|
||||
|
||||
void FileOrderList::ContentSelector::setCheckState(QModelIndex index, QSortFilterProxyModel *model)
|
||||
void EsxSelector::ContentSelector::setCheckState(QModelIndex index, QSortFilterProxyModel *model)
|
||||
{
|
||||
if (!index.isValid())
|
||||
return;
|
||||
@ -66,12 +66,12 @@ void FileOrderList::ContentSelector::setCheckState(QModelIndex index, QSortFilte
|
||||
}
|
||||
}
|
||||
|
||||
QStringList FileOrderList::ContentSelector::checkedItemsPaths()
|
||||
QStringList EsxSelector::ContentSelector::checkedItemsPaths()
|
||||
{
|
||||
return mDataFilesModel->checkedItemsPaths();
|
||||
}
|
||||
|
||||
void FileOrderList::ContentSelector::updateViews()
|
||||
void EsxSelector::ContentSelector::updateViews()
|
||||
{
|
||||
// Ensure the columns are hidden because sort() re-enables them
|
||||
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);
|
||||
}
|
||||
|
||||
void FileOrderList::ContentSelector::slotCurrentMasterIndexChanged(int index)
|
||||
void EsxSelector::ContentSelector::slotCurrentMasterIndexChanged(int index)
|
||||
{
|
||||
QObject *object = QObject::sender();
|
||||
|
||||
@ -101,7 +101,7 @@ void FileOrderList::ContentSelector::slotCurrentMasterIndexChanged(int index)
|
||||
setCheckState(mMasterProxyModel->index(index, 0), mMasterProxyModel);
|
||||
}
|
||||
|
||||
void FileOrderList::ContentSelector::slotPluginTableItemClicked(const QModelIndex &index)
|
||||
void EsxSelector::ContentSelector::slotPluginTableItemClicked(const QModelIndex &index)
|
||||
{
|
||||
setCheckState(index, mPluginsProxyModel);
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user