blob: 6a5d0cf2d11a2e88a58ec6e1de09a4154374f52f [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"
swissChilie386bc72022-02-24 21:31:31 -08007#include "CellModel.h"
swissChili25620b02022-02-23 17:15:16 -08008
9class Notebook : public QObject
10{
11 Q_OBJECT
12 QML_ELEMENT
13
14 Q_PROPERTY(CellModel *cellModel READ cellModel NOTIFY cellModelChanged)
15
16public:
17 explicit Notebook(QObject *parent = nullptr);
18 Notebook(const Notebook &other, QObject *parent = nullptr);
19
20 CellModel *cellModel();
21
swissChilid85daa92022-02-24 15:29:02 -080022 Q_INVOKABLE void runCell(QUuid uuid);
23 Q_INVOKABLE void quitCell(QUuid uuid);
24
swissChili25620b02022-02-23 17:15:16 -080025signals:
26 void cellModelChanged();
27
swissChilid85daa92022-02-24 15:29:02 -080028protected slots:
29 void cellFinishedRunning(Cell *cell, RuntimeResult result);
30 void cellFailedToParse(Cell *cell, ParseResult result);
31 void cellWaiting(Cell *cell);
32 void cellRunning(Cell *cell);
33 void cellQuit(Cell *cell);
34
swissChili25620b02022-02-23 17:15:16 -080035protected:
36 friend class CellModel;
37
swissChilid85daa92022-02-24 15:29:02 -080038 QList<Cell *> _cells;
swissChili25620b02022-02-23 17:15:16 -080039 CellModel *_cellModel;
swissChilid85daa92022-02-24 15:29:02 -080040 NbRuntime _rt;
swissChili25620b02022-02-23 17:15:16 -080041};
42
43Q_DECLARE_METATYPE(Notebook)