Skip to content

Commit

Permalink
GUI: Add comments to resource tree functions
Browse files Browse the repository at this point in the history
  • Loading branch information
fdde authored and DrMcCoy committed Dec 27, 2017
1 parent 66b8d69 commit 7376afd
Showing 1 changed file with 24 additions and 9 deletions.
33 changes: 24 additions & 9 deletions src/gui/resourcetree.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,25 +81,40 @@ class ResourceTree : public QAbstractItemModel {
explicit ResourceTree(MainWindow *mainWindow, const QString &path, QObject *parent = 0);
~ResourceTree();

/** Walk the given path and add the items to the tree structure. */
void populate(const QString& path, ResourceTreeItem *parent);

/** Called in fetchMore. */
void insertItemsFromArchive(Archive &archive, const QModelIndex &parentIndex);
void insertItems(int position, QList<ResourceTreeItem*> &items, const QModelIndex &parentIndex);

Aurora::Archive *getArchive(const QString &path);
Aurora::KEYDataFile *getKEYDataFile(const QString &file);
void loadKEYDataFiles(Aurora::KEYFile &key);

/** Return the item in the tree structure that corresponds to the given index. */
ResourceTreeItem *itemFromIndex(const QModelIndex &index) const;

/** Model functions. */

/** Return the index if it exists, else create it. */
QModelIndex index(int row, int col, const QModelIndex &parent) const override;
/** Return the parent of the given index if it exists, else create it. */
QModelIndex parent(const QModelIndex &index) const override;
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
int columnCount(const QModelIndex &parent = QModelIndex()) const override;
/** Return the data for the given index. */
QVariant data(const QModelIndex &index, int role) const override;
/** Return the header data. */
QVariant headerData(int section, Qt::Orientation orientation, int role) const;
/** Define what file types should have an expand arrow in the tree. */
bool canFetchMore(const QModelIndex &index) const;
void fetchMore(const QModelIndex &index);
/** Return whether the item for index actually has children. */
bool hasChildren(const QModelIndex &index) const;

void insertItemsFromArchive(Archive &archive, const QModelIndex &parentIndex);
void insertItems(int position, QList<ResourceTreeItem*> &items, const QModelIndex &parentIndex);
Aurora::Archive *getArchive(const QString &path);
Aurora::KEYDataFile *getKEYDataFile(const QString &file);
void loadKEYDataFiles(Aurora::KEYFile &key);
/** Return column count (in our case, 1 -- the filename.) */
int columnCount(const QModelIndex &parent = QModelIndex()) const override;
/** Return row count -- how many children the given index has. */
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
/** Add children to the given index. */
void fetchMore(const QModelIndex &index);
};

} // namespace GUI
Expand Down

0 comments on commit 7376afd

Please sign in to comment.