mirror of
https://github.com/OpenMW/openmw.git
synced 2025-03-03 13:39:40 +00:00
More testing and removing
This commit is contained in:
parent
74eef82902
commit
1e62d8451f
2 changed files with 37 additions and 14 deletions
|
@ -2,25 +2,17 @@
|
||||||
#include <components/esm/esm_reader.hpp>
|
#include <components/esm/esm_reader.hpp>
|
||||||
|
|
||||||
#include "datafilesdialog.h"
|
#include "datafilesdialog.h"
|
||||||
#include "datafilesmodel.h"
|
//#include "datafilesmodel.h"
|
||||||
#include "datafilesitem.h"
|
//#include "datafilesitem.h"
|
||||||
|
|
||||||
using namespace ESM;
|
using namespace ESM;
|
||||||
|
|
||||||
DataFilesDialog::DataFilesDialog()
|
DataFilesDialog::DataFilesDialog()
|
||||||
{
|
{
|
||||||
//dataFilesModel = new DataFilesModel(this);
|
//dataFilesModel = new DataFilesModel(this);
|
||||||
dataFilesModel = new DataFilesModel();
|
dataFilesModel = new QStandardItemModel();
|
||||||
|
|
||||||
for (int row = 0; row < 4; ++row) {
|
|
||||||
for (int column = 0; column < 4; ++column) {
|
|
||||||
QList<QVariant> test;
|
|
||||||
test << QString("%0").arg(i);
|
|
||||||
DataFilesItem *item = new DataFilesItem(test);
|
|
||||||
dataFilesModel->setItem(row, column, item);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//dataFilesModel->setReadOnly(true); // Prevent changes to files
|
//dataFilesModel->setReadOnly(true); // Prevent changes to files
|
||||||
//dataFilesModel->setRootPath("data");
|
//dataFilesModel->setRootPath("data");
|
||||||
|
|
||||||
|
@ -64,6 +56,10 @@ DataFilesDialog::DataFilesDialog()
|
||||||
//dataFilesView = new QTreeView(groupFiles);
|
//dataFilesView = new QTreeView(groupFiles);
|
||||||
dataFilesView = new QTreeView(groupFiles);
|
dataFilesView = new QTreeView(groupFiles);
|
||||||
dataFilesView->setModel(dataFilesModel);
|
dataFilesView->setModel(dataFilesModel);
|
||||||
|
dataFilesView->setDragEnabled(true);
|
||||||
|
dataFilesView->setDropIndicatorShown(true);
|
||||||
|
dataFilesView->setAlternatingRowColors(true);
|
||||||
|
|
||||||
|
|
||||||
// Put everything in the correct layouts
|
// Put everything in the correct layouts
|
||||||
//groupFilesLayout->addLayout(filterLayout);
|
//groupFilesLayout->addLayout(filterLayout);
|
||||||
|
@ -99,6 +95,7 @@ DataFilesDialog::DataFilesDialog()
|
||||||
*/
|
*/
|
||||||
//readConfig();
|
//readConfig();
|
||||||
//setupView();
|
//setupView();
|
||||||
|
setupView();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DataFilesDialog::changeData(QModelIndex index, QModelIndex bottom)
|
void DataFilesDialog::changeData(QModelIndex index, QModelIndex bottom)
|
||||||
|
@ -144,6 +141,30 @@ void DataFilesDialog::changeData(QModelIndex index, QModelIndex bottom)
|
||||||
|
|
||||||
void DataFilesDialog::setupView()
|
void DataFilesDialog::setupView()
|
||||||
{
|
{
|
||||||
|
QDir datadir(QString("data/"));
|
||||||
|
QStringList acceptedfiles = (QStringList() << "*.esp");
|
||||||
|
QStringList datafiles;
|
||||||
|
|
||||||
|
datadir.setNameFilters(acceptedfiles);
|
||||||
|
|
||||||
|
datafiles = datadir.entryList();
|
||||||
|
|
||||||
|
QStandardItem *parentItem = dataFilesModel->invisibleRootItem();
|
||||||
|
QStandardItem *masterFile = new QStandardItem(QString("Morrowind.esm"));
|
||||||
|
parentItem->appendRow(masterFile);
|
||||||
|
parentItem = masterFile;
|
||||||
|
|
||||||
|
QFileIconProvider fip;
|
||||||
|
QIcon fileIcon = fip.icon(QFileInfo("data/Morrowind.esm"));
|
||||||
|
|
||||||
|
foreach (const QString ¤tfile, datafiles) {
|
||||||
|
QStandardItem *item = new QStandardItem(currentfile);
|
||||||
|
item->setIcon(fileIcon);
|
||||||
|
parentItem->appendRow(item);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* The signal directoryLoaded is emitted after all files are in the model
|
/* The signal directoryLoaded is emitted after all files are in the model
|
||||||
dataFilesView->setModel(dataFilesModel);
|
dataFilesView->setModel(dataFilesModel);
|
||||||
// dataFilesView->setModel(sortModel);
|
// dataFilesView->setModel(sortModel);
|
||||||
|
|
|
@ -3,7 +3,8 @@
|
||||||
|
|
||||||
#include "lineedit.h"
|
#include "lineedit.h"
|
||||||
|
|
||||||
class DataFilesModel;
|
//class DataFilesModel;
|
||||||
|
|
||||||
|
|
||||||
/*class QStringList;
|
/*class QStringList;
|
||||||
class QTreeView;
|
class QTreeView;
|
||||||
|
@ -16,6 +17,7 @@ class QSortFilterProxyModel;
|
||||||
#include <QModelIndex>
|
#include <QModelIndex>
|
||||||
|
|
||||||
class QTreeView;
|
class QTreeView;
|
||||||
|
class QStandardItemModel;
|
||||||
|
|
||||||
class DataFilesDialog : public QDialog
|
class DataFilesDialog : public QDialog
|
||||||
{
|
{
|
||||||
|
@ -26,7 +28,7 @@ public:
|
||||||
// ~DataFilesDialog() { };
|
// ~DataFilesDialog() { };
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DataFilesModel *dataFilesModel;
|
QStandardItemModel *dataFilesModel;
|
||||||
|
|
||||||
QTreeView *dataFilesView;
|
QTreeView *dataFilesView;
|
||||||
//QItemSelectionModel *selectionModel;
|
//QItemSelectionModel *selectionModel;
|
||||||
|
|
Loading…
Reference in a new issue