Disable actionJupyter if not needed, Display Jupyter URL if QtWebEngine is disabled

This commit is contained in:
Florian Märkl 2018-03-02 15:06:08 +01:00
parent ccedd3d59f
commit 011d113a5e
2 changed files with 14 additions and 1 deletions

View File

@ -222,6 +222,9 @@ void MainWindow::initUI()
ADD_DOCK(FlagsWidget, flagsDock, ui->actionFlags);
#ifdef CUTTER_ENABLE_JUPYTER
ADD_DOCK(JupyterWidget, jupyterDock, ui->actionJupyter);
#else
ui->actionJupyter->setEnabled(false);
ui->actionJupyter->setVisible(false);
#endif
ADD_DOCK(Dashboard, dashboardDock, ui->actionDashboard);
ADD_DOCK(SdbDock, sdbDock, ui->actionSDBBrowser);

View File

@ -42,7 +42,17 @@ void JupyterWidget::urlReceived(const QString &url)
#ifdef CUTTER_ENABLE_QTWEBENGINE
createNewTab()->load(QUrl(url));
#else
// TODO: make a tab with the url, so the user can use another browser
QWidget *failPage = new QWidget(this);
QLabel *label = new QLabel(failPage);
label->setText(tr("Cutter has been built without QtWebEngine.<br />Open the following URL in your Browser to use Jupyter:<br /><a href=\"%1\">%1</a>").arg(url));
label->setTextFormat(Qt::RichText);
label->setTextInteractionFlags(Qt::TextBrowserInteraction);
label->setOpenExternalLinks(true);
QHBoxLayout *layout = new QHBoxLayout();
layout->addWidget(label);
layout->setAlignment(label, Qt::AlignCenter);
failPage->setLayout(layout);
ui->tabWidget->addTab(failPage, tr("Jupyter"));
#endif
}