Add missing nostalgia directory level in src tree
This commit is contained in:
@@ -0,0 +1,79 @@
|
||||
/*
|
||||
* Copyright 2016-2017 gtalent2@gmail.com
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QModelIndex>
|
||||
#include <QVector>
|
||||
#include <QVariant>
|
||||
|
||||
#include <ox/fs/filesystem.hpp>
|
||||
|
||||
namespace nostalgia {
|
||||
namespace studio {
|
||||
|
||||
class OxFSFile {
|
||||
private:
|
||||
ox::FileSystem *m_fs = nullptr;
|
||||
OxFSFile *m_parentItem = nullptr;
|
||||
QString m_path;
|
||||
QVector<OxFSFile*> m_childItems;
|
||||
|
||||
public:
|
||||
OxFSFile(ox::FileSystem *fs, QString path, OxFSFile *parentItem = nullptr);
|
||||
|
||||
~OxFSFile();
|
||||
|
||||
void appendChild(OxFSFile *child);
|
||||
|
||||
OxFSFile *child(int row);
|
||||
|
||||
int childCount() const;
|
||||
|
||||
int columnCount() const;
|
||||
|
||||
QVariant data(int column) const;
|
||||
|
||||
int row() const;
|
||||
|
||||
OxFSFile *parentItem();
|
||||
};
|
||||
|
||||
class OxFSModel: public QAbstractItemModel {
|
||||
Q_OBJECT
|
||||
|
||||
private:
|
||||
OxFSFile *m_rootItem = nullptr;
|
||||
|
||||
public:
|
||||
explicit OxFSModel(ox::FileSystem *fs, QObject *parent = 0);
|
||||
|
||||
~OxFSModel();
|
||||
|
||||
QVariant data(const QModelIndex &index, int role) const override;
|
||||
|
||||
Qt::ItemFlags flags(const QModelIndex &index) const override;
|
||||
|
||||
QVariant headerData(int section, Qt::Orientation orientation,
|
||||
int role = Qt::DisplayRole) const override;
|
||||
|
||||
QModelIndex index(int row, int column,
|
||||
const QModelIndex &parent = QModelIndex()) const override;
|
||||
|
||||
QModelIndex parent(const QModelIndex &index) const override;
|
||||
|
||||
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
|
||||
|
||||
int columnCount(const QModelIndex &parent = QModelIndex()) const override;
|
||||
|
||||
private:
|
||||
void setupModelData(const QStringList &lines, OxFSFile *parent);
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user