summaryrefslogtreecommitdiffstats
path: root/src/library/browse/foldertreemodel.h
blob: 2bff73671a3ff821a2990aa670f9111d216598be (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#pragma once

#include <QAbstractItemModel>
#include <QModelIndex>
#include <QVariant>
#include <QList>
#include <QHash>

#include "library/treeitemmodel.h"
#include "library/treeitem.h"

class TreeItem;
// This class represents a folder item within the Browse Feature
// The class is derived from TreeItemModel to support lazy model
// initialization.

class FolderTreeModel : public TreeItemModel {
    Q_OBJECT
  public:
    FolderTreeModel(QObject *parent = 0);
    virtual ~FolderTreeModel();
    virtual bool hasChildren(const QModelIndex& parent = QModelIndex()) const;
    bool directoryHasChildren(const QString& path) const;

  private:
    // Used for memoizing the results of directoryHasChildren
    mutable QHash<QString, bool> m_directoryCache;
};