2017-12-13 17:36:00 +00:00
|
|
|
|
|
|
|
#ifndef JUPYTERWIDGET_H
|
|
|
|
#define JUPYTERWIDGET_H
|
|
|
|
|
2018-03-02 13:15:53 +00:00
|
|
|
#ifdef CUTTER_ENABLE_JUPYTER
|
|
|
|
|
2017-12-13 17:36:00 +00:00
|
|
|
#include <memory>
|
|
|
|
|
|
|
|
#include <QDockWidget>
|
|
|
|
|
|
|
|
#include "utils/JupyterConnection.h"
|
|
|
|
|
|
|
|
namespace Ui
|
|
|
|
{
|
|
|
|
class JupyterWidget;
|
|
|
|
}
|
|
|
|
|
|
|
|
class JupyterWebView;
|
|
|
|
|
2018-03-02 18:03:12 +00:00
|
|
|
class QTabWidget;
|
|
|
|
|
2017-12-13 17:36:00 +00:00
|
|
|
class JupyterWidget : public QDockWidget
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
JupyterWidget(QWidget *parent = nullptr, Qt::WindowFlags flags = Qt::WindowFlags());
|
|
|
|
~JupyterWidget();
|
|
|
|
|
2018-03-02 13:15:53 +00:00
|
|
|
#ifdef CUTTER_ENABLE_QTWEBENGINE
|
2017-12-13 17:36:00 +00:00
|
|
|
JupyterWebView *createNewTab();
|
2018-03-02 13:15:53 +00:00
|
|
|
#endif
|
2017-12-13 17:36:00 +00:00
|
|
|
|
|
|
|
private slots:
|
|
|
|
void urlReceived(const QString &url);
|
2018-02-22 18:39:20 +00:00
|
|
|
void creationFailed();
|
2017-12-13 17:36:00 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
std::unique_ptr<Ui::JupyterWidget> ui;
|
|
|
|
};
|
|
|
|
|
2018-03-02 13:15:53 +00:00
|
|
|
#ifdef CUTTER_ENABLE_QTWEBENGINE
|
|
|
|
|
|
|
|
#include <QWebEngineView>
|
2017-12-13 17:36:00 +00:00
|
|
|
|
|
|
|
class JupyterWebView : public QWebEngineView
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
JupyterWebView(JupyterWidget *mainWidget, QWidget *parent = nullptr);
|
|
|
|
|
2018-03-02 16:56:59 +00:00
|
|
|
void setTabWidget(QTabWidget *tabWidget);
|
|
|
|
|
2017-12-13 17:36:00 +00:00
|
|
|
protected:
|
|
|
|
QWebEngineView *createWindow(QWebEnginePage::WebWindowType type) override;
|
|
|
|
|
2018-03-02 16:56:59 +00:00
|
|
|
private slots:
|
|
|
|
void onTitleChanged(const QString &title);
|
|
|
|
|
2017-12-13 17:36:00 +00:00
|
|
|
private:
|
|
|
|
JupyterWidget *mainWidget;
|
2018-03-02 16:56:59 +00:00
|
|
|
QTabWidget *tabWidget;
|
|
|
|
|
|
|
|
void updateTitle();
|
2017-12-13 17:36:00 +00:00
|
|
|
};
|
|
|
|
|
2018-03-02 13:15:53 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
2017-12-13 17:36:00 +00:00
|
|
|
#endif //JUPYTERWIDGET_H
|