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