blob: 867c2e99459809d020ae4cfdf8bbf82d0ddd1fde [file] [log] [blame]
swissChili25620b02022-02-23 17:15:16 -08001#pragma once
2
3#include <QObject>
4
5#include "Cell.h"
swissChilid85daa92022-02-24 15:29:02 -08006#include "NbRuntime.h"
swissChili25620b02022-02-23 17:15:16 -08007
8class CellModel;
9
10class Notebook : public QObject
11{
12 Q_OBJECT
13 QML_ELEMENT
14
15 Q_PROPERTY(CellModel *cellModel READ cellModel NOTIFY cellModelChanged)
16
17public:
18 explicit Notebook(QObject *parent = nullptr);
19 Notebook(const Notebook &other, QObject *parent = nullptr);
20
21 CellModel *cellModel();
22
swissChilid85daa92022-02-24 15:29:02 -080023 Q_INVOKABLE void runCell(QUuid uuid);
24 Q_INVOKABLE void quitCell(QUuid uuid);
25
swissChili25620b02022-02-23 17:15:16 -080026signals:
27 void cellModelChanged();
28
swissChilid85daa92022-02-24 15:29:02 -080029protected slots:
30 void cellFinishedRunning(Cell *cell, RuntimeResult result);
31 void cellFailedToParse(Cell *cell, ParseResult result);
32 void cellWaiting(Cell *cell);
33 void cellRunning(Cell *cell);
34 void cellQuit(Cell *cell);
35
swissChili25620b02022-02-23 17:15:16 -080036protected:
37 friend class CellModel;
38
swissChilid85daa92022-02-24 15:29:02 -080039 QList<Cell *> _cells;
swissChili25620b02022-02-23 17:15:16 -080040 CellModel *_cellModel;
swissChilid85daa92022-02-24 15:29:02 -080041 NbRuntime _rt;
swissChili25620b02022-02-23 17:15:16 -080042};
43
44Q_DECLARE_METATYPE(Notebook)