swissChili | 25620b0 | 2022-02-23 17:15:16 -0800 | [diff] [blame] | 1 | #pragma once |
| 2 | |
| 3 | #include <QObject> |
| 4 | |
| 5 | #include "Cell.h" |
swissChili | d85daa9 | 2022-02-24 15:29:02 -0800 | [diff] [blame^] | 6 | #include "NbRuntime.h" |
swissChili | 25620b0 | 2022-02-23 17:15:16 -0800 | [diff] [blame] | 7 | |
| 8 | class CellModel; |
| 9 | |
| 10 | class Notebook : public QObject |
| 11 | { |
| 12 | Q_OBJECT |
| 13 | QML_ELEMENT |
| 14 | |
| 15 | Q_PROPERTY(CellModel *cellModel READ cellModel NOTIFY cellModelChanged) |
| 16 | |
| 17 | public: |
| 18 | explicit Notebook(QObject *parent = nullptr); |
| 19 | Notebook(const Notebook &other, QObject *parent = nullptr); |
| 20 | |
| 21 | CellModel *cellModel(); |
| 22 | |
swissChili | d85daa9 | 2022-02-24 15:29:02 -0800 | [diff] [blame^] | 23 | Q_INVOKABLE void runCell(QUuid uuid); |
| 24 | Q_INVOKABLE void quitCell(QUuid uuid); |
| 25 | |
swissChili | 25620b0 | 2022-02-23 17:15:16 -0800 | [diff] [blame] | 26 | signals: |
| 27 | void cellModelChanged(); |
| 28 | |
swissChili | d85daa9 | 2022-02-24 15:29:02 -0800 | [diff] [blame^] | 29 | protected 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 | |
swissChili | 25620b0 | 2022-02-23 17:15:16 -0800 | [diff] [blame] | 36 | protected: |
| 37 | friend class CellModel; |
| 38 | |
swissChili | d85daa9 | 2022-02-24 15:29:02 -0800 | [diff] [blame^] | 39 | QList<Cell *> _cells; |
swissChili | 25620b0 | 2022-02-23 17:15:16 -0800 | [diff] [blame] | 40 | CellModel *_cellModel; |
swissChili | d85daa9 | 2022-02-24 15:29:02 -0800 | [diff] [blame^] | 41 | NbRuntime _rt; |
swissChili | 25620b0 | 2022-02-23 17:15:16 -0800 | [diff] [blame] | 42 | }; |
| 43 | |
| 44 | Q_DECLARE_METATYPE(Notebook) |