summaryrefslogtreecommitdiff
path: root/playlist/playlistmodel.hpp
blob: e5cedfe17623f4714af6873ac01a59cb2c2a28f7 (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
/* ============================================================
 * SPDX-License-Identifier: GPL-3.0-only
 * Copyright (C) 2023 aqua <aqua@iserlohn-fortress.net>
 * ============================================================ */

#pragma once

#include <QAbstractItemModel>

class Playlist;
class PlaylistModel : public QAbstractItemModel {
public:
  explicit PlaylistModel(Playlist *parent);
  ~PlaylistModel() = default;

  QModelIndex index(int row, int column, const QModelIndex &parent) const;
  QModelIndex parent(const QModelIndex &child) const;
  int rowCount(const QModelIndex &parent) const;
  int columnCount(const QModelIndex &parent) const;
  QVariant data(const QModelIndex &index, int role) const;

private slots:
  void beginInsertItems(int start, int end) { beginInsertRows(QModelIndex(), start, end); }
  void endInsertItems() { endInsertRows(); }

private:
  Playlist *playlist;
};