Note that this is not the same as the help browser built into the IDE.
-Since the Qt WebEngine dependency is hefty and difficult to install on some systems, it is possible for sclang to have been built without WebView support (using the CMake flag code:: -DSC_USE_WEBENGINE=OFF :: at compile). If so, attempting to invoke this class will throw an error.
+Since the Qt WebEngine dependency is hefty and difficult to install on some systems, it is possible for sclang to have been built without WebView support (using the CMake flag code:: -DSC_USE_QTWEBENGINE=OFF :: at compile). If so, attempting to invoke this class will throw an error.
classmethods::
private:: getOldWrapUrl, initClass
WebView displays web pages and provides all the standard browsing functionality.
-Since the Qt WebEngine dependency is hefty and difficult to install on some systems, it is possible for sclang to have been built without WebView support (using the CMake flag code:: -DSC_USE_WEBENGINE=OFF :: at compile). If so, attempting to invoke this class will throw an error.
+Since the Qt WebEngine dependency is hefty and difficult to install on some systems, it is possible for sclang to have been built without WebView support (using the CMake flag code:: -DSC_USE_QTWEBENGINE=OFF :: at compile). If so, attempting to invoke this class will throw an error.
CLASSMETHODS::
set(REQUIRED_QT_VERSION 5.7)
-option(SC_USE_WEBENGINE "Build with Qt WebEngine." ON)
+option(SC_USE_QTWEBENGINE "Build with Qt WebEngine." ON)
###############################################################################
# Components and libraries
Qt5::Quick Qt5::Qml Qt5::Sql Qt5::OpenGL Qt5::Svg
${MATH_LIBRARY})
-if(SC_USE_WEBENGINE)
+if(SC_USE_QTWEBENGINE)
list(APPEND QT_COMPONENTS WebEngine WebEngineCore WebEngineWidgets)
list(APPEND QT_COLLIDER_LIBS Qt5::WebEngineCore Qt5::WebEngineWidgets)
endif()
${QT_COLLIDER_DIR}/widgets/web_page.hpp
)
-if(SC_USE_WEBENGINE)
+if(SC_USE_QTWEBENGINE)
list(APPEND QT_COLLIDER_HDRS ${QT_COLLIDER_WEBENGINE_HDRS})
endif()
QC_ADD_FACTORY(QcGridLayout);
QC_ADD_FACTORY(QcStackLayout);
QC_ADD_FACTORY(QtDownload);
-#ifdef SC_USE_WEBENGINE
+#ifdef SC_USE_QTWEBENGINE
QC_ADD_FACTORY(WebView);
#endif
#ifdef __APPLE__
#include <QEventLoop>
#include <QDir>
-#ifdef SC_USE_WEBENGINE
+#ifdef SC_USE_QTWEBENGINE
# include <QWebEngineSettings>
#endif
gSystemPalette = qcApp->palette();
-#ifdef SC_USE_WEBENGINE
+#ifdef SC_USE_QTWEBENGINE
// Enable javascript localStorage for WebViews
QWebEngineSettings::globalSettings()->setAttribute(QWebEngineSettings::LocalStorageEnabled, true);
#endif
#include <QStyleOptionSlider>
#include <QPainter>
-#ifdef SC_USE_WEBENGINE
+#ifdef SC_USE_QTWEBENGINE
# include <QWebEngineView>
#endif
void ProxyStyle::drawComplexControl(ComplexControl ctrl, const QStyleOptionComplex* opt, QPainter* p,
const QWidget* w) const {
-#ifdef SC_USE_WEBENGINE
+#ifdef SC_USE_QTWEBENGINE
// FIXME: this is a workaround for the WebKit bug #104116 (or a variation on it).
if (ctrl == QStyle::CC_ScrollBar && qobject_cast<const QWebEngineView*>(w) != 0
&& opt->type == QStyleOption::SO_Slider) {
QProxyStyle::drawComplexControl(ctrl, &opt2, p, w);
return;
}
-#endif // SC_USE_WEBENGINE
+#endif // SC_USE_QTWEBENGINE
if (ctrl == QStyle::CC_ScrollBar && AlwaysShowScrollbars()) {
const QStyleOptionSlider* optSlider = static_cast<const QStyleOptionSlider*>(opt);
*
************************************************************************/
-#ifdef SC_USE_WEBENGINE
+#ifdef SC_USE_QTWEBENGINE
# include "QcWebView.h"
# include "../widgets/web_page.hpp"
} // namespace QtCollider
-#endif // SC_USE_WEBENGINE
+#endif // SC_USE_QTWEBENGINE
*
************************************************************************/
-#ifdef SC_USE_WEBENGINE
+#ifdef SC_USE_QTWEBENGINE
# include "web_page.hpp"
} // namespace QtCollider
-#endif // SC_USE_WEBENGINE
+#endif // SC_USE_QTWEBENGINE
Qt5::Sql
)
-if(SC_USE_WEBENGINE)
+if(SC_USE_QTWEBENGINE)
list(APPEND QT_IDE_COMPONENTS
WebChannel
WebEngine
${CMAKE_SOURCE_DIR}/QtCollider/widgets/web_page.cpp
)
-if(SC_USE_WEBENGINE)
+if(SC_USE_QTWEBENGINE)
list(APPEND ide_moc_hdr ${ide_webengine_moc_hdrs})
list(APPEND ide_src ${ide_webengine_src})
endif()
APPEND PROPERTY LINK_FLAGS "-flto -flto-report -fwhole-program")
endif()
-if(SC_USE_WEBENGINE)
+if(SC_USE_QTWEBENGINE)
message(STATUS "IDE: Building with QtWebEngine")
- target_compile_definitions(SuperCollider PUBLIC SC_USE_WEBENGINE)
+ target_compile_definitions(SuperCollider PUBLIC SC_USE_QTWEBENGINE)
endif()
# Installation
#include <QDebug>
#include <QStyleFactory>
-#ifdef SC_USE_WEBENGINE
+#ifdef SC_USE_QTWEBENGINE
# include <QWebChannel>
# include "../widgets/util/WebSocketClientWrapper.hpp"
# include "../widgets/util/WebSocketTransport.hpp"
# include "../widgets/util/IDEWebChannelWrapper.hpp"
-#endif // SC_USE_WEBENGINE
+#endif // SC_USE_QTWEBENGINE
using namespace ScIDE;
if (startInterpreter)
main->scProcess()->startLanguage();
-#ifdef SC_USE_WEBENGINE
+#ifdef SC_USE_QTWEBENGINE
// setup HelpBrowser server
QWebSocketServer server("SCIDE HelpBrowser Server", QWebSocketServer::NonSecureMode);
if (!server.listen(QHostAddress::LocalHost, 12344)) {
// publish IDE interface
IDEWebChannelWrapper ideWrapper { win->helpBrowserDocklet()->browser() };
channel.registerObject("IDE", &ideWrapper);
-#endif // SC_USE_WEBENGINE
+#endif // SC_USE_QTWEBENGINE
return app.exec();
}
}
bool Main::openDocumentation(const QString& string) {
-#ifdef SC_USE_WEBENGINE
+#ifdef SC_USE_QTWEBENGINE
QString symbol = string.trimmed();
if (symbol.isEmpty())
return false;
helpDock->browser()->gotoHelpFor(symbol);
helpDock->focus();
return true;
-#else // SC_USE_WEBENGINE
+#else // SC_USE_QTWEBENGINE
return false;
-#endif // SC_USE_WEBENGINE
+#endif // SC_USE_QTWEBENGINE
}
bool Main::openDocumentationForMethod(const QString& className, const QString& methodName) {
-#ifdef SC_USE_WEBENGINE
+#ifdef SC_USE_QTWEBENGINE
HelpBrowserDocklet* helpDock = MainWindow::instance()->helpBrowserDocklet();
helpDock->browser()->gotoHelpForMethod(className, methodName);
helpDock->focus();
return true;
-#else // SC_USE_WEBENGINE
+#else // SC_USE_QTWEBENGINE
return false;
-#endif // SC_USE_WEBENGINE
+#endif // SC_USE_QTWEBENGINE
}
void Main::openDefinition(const QString& string, QWidget* parent) {
#include "../../core/util/standard_dirs.hpp"
#include "../main_window.hpp"
-#ifdef SC_USE_WEBENGINE
+#ifdef SC_USE_QTWEBENGINE
# include "../help_browser.hpp"
-#endif // SC_USE_WEBENGINE
+#endif // SC_USE_QTWEBENGINE
#include <yaml-cpp/node/node.h>
#include <yaml-cpp/parser.h>
}
void AutoCompleter::gotoHelp(QString symbol) {
-#ifdef SC_USE_WEBENGINE
+#ifdef SC_USE_QTWEBENGINE
HelpBrowserDocklet* helpDock = MainWindow::instance()->helpBrowserDocklet();
helpDock->browser()->gotoHelpFor(symbol);
helpDock->focus();
-#endif // SC_USE_WEBENGINE
+#endif // SC_USE_QTWEBENGINE
}
} // namespace ScIDE
#include "../../core/settings/manager.hpp"
#include "../../core/settings/theme.hpp"
-#ifdef SC_USE_WEBENGINE
+#ifdef SC_USE_QTWEBENGINE
# include "help_browser.hpp"
-#endif // SC_USE_WEBENGINE
+#endif // SC_USE_QTWEBENGINE
#include "QtCollider/hacks/hacks_qt.hpp"
{
QString text;
-#ifdef SC_USE_WEBENGINE
+#ifdef SC_USE_QTWEBENGINE
HelpBrowserDocklet* help = MainWindow::instance()->helpBrowserDocklet();
if (help && help->browser()->helpBrowserHasFocus()) {
help->browser()->evaluateSelection(false);
return; // early return
}
-#endif // SC_USE_WEBENGINE
+#endif // SC_USE_QTWEBENGINE
// Try current selection
QTextCursor cursor = textCursor();
{
QString text;
-#ifdef SC_USE_WEBENGINE
+#ifdef SC_USE_QTWEBENGINE
HelpBrowserDocklet* help = MainWindow::instance()->helpBrowserDocklet();
if (help && help->browser()->helpBrowserHasFocus()) {
help->browser()->evaluateSelection(true);
return; // early return
}
-#endif // SC_USE_WEBENGINE
+#endif // SC_USE_QTWEBENGINE
// Try current selection
QTextCursor cursor = textCursor();
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#ifdef SC_USE_WEBENGINE
+#ifdef SC_USE_QTWEBENGINE
# define QT_NO_DEBUG_OUTPUT
} // namespace ScIDE
-#endif // SC_USE_WEBENGINE
+#endif // SC_USE_QTWEBENGINE
#include "code_editor/sc_editor.hpp"
#include "settings/dialog.hpp"
-#ifdef SC_USE_WEBENGINE
+#ifdef SC_USE_QTWEBENGINE
# include "help_browser.hpp"
-#endif // SC_USE_WEBENGINE
+#endif // SC_USE_QTWEBENGINE
#include "QtCollider/hacks/hacks_qt.hpp"
addDockWidget(Qt::LeftDockWidgetArea, mDocumentsDocklet->dockWidget());
mDocumentsDocklet->hide();
-#ifdef SC_USE_WEBENGINE
+#ifdef SC_USE_QTWEBENGINE
mHelpBrowserDocklet = new HelpBrowserDocklet(this);
mHelpBrowserDocklet->setObjectName("help-dock");
addDockWidget(Qt::RightDockWidgetArea, mHelpBrowserDocklet->dockWidget());
// mHelpBrowserDockable->hide();
-#endif // SC_USE_WEBENGINE
+#endif // SC_USE_QTWEBENGINE
mPostDocklet = new PostDocklet(this);
mPostDocklet->setObjectName("post-dock");
action->setStatusTip(tr("Show/hide Documents docklet"));
settings->addAction(mDocumentsDocklet->toggleViewAction(), "ide-docklet-documents", ideCategory);
-#ifdef SC_USE_WEBENGINE
+#ifdef SC_USE_QTWEBENGINE
action = mHelpBrowserDocklet->toggleViewAction();
action->setIcon(QIcon::fromTheme("system-help"));
action->setStatusTip(tr("Show/hide Help browser docklet"));
settings->addAction(mHelpBrowserDocklet->toggleViewAction(), "ide-docklet-help", ideCategory);
-#endif // SC_USE_WEBENGINE
+#endif // SC_USE_QTWEBENGINE
// In Mac OS, all menu item shortcuts need a modifier, so add the action with
// the "Escape" default shortcut to the main window widget.
mPostDocklet->widget()->addAction(mActions[LookupReferences]);
mPostDocklet->widget()->addAction(mActions[LookupReferencesForCursor]);
-#ifdef SC_USE_WEBENGINE
+#ifdef SC_USE_QTWEBENGINE
mHelpBrowserDocklet->widget()->addAction(mActions[LookupDocumentation]);
mHelpBrowserDocklet->widget()->addAction(mActions[LookupDocumentationForCursor]);
mHelpBrowserDocklet->widget()->addAction(mActions[LookupImplementation]);
mHelpBrowserDocklet->widget()->addAction(mActions[LookupImplementationForCursor]);
mHelpBrowserDocklet->widget()->addAction(mActions[LookupReferences]);
mHelpBrowserDocklet->widget()->addAction(mActions[LookupReferencesForCursor]);
-#endif // SC_USE_WEBENGINE
+#endif // SC_USE_QTWEBENGINE
}
void MainWindow::createMenus() {
submenu = new QMenu(tr("&Docklets"), this);
submenu->addAction(mPostDocklet->toggleViewAction());
submenu->addAction(mDocumentsDocklet->toggleViewAction());
-#ifdef SC_USE_WEBENGINE
+#ifdef SC_USE_QTWEBENGINE
submenu->addAction(mHelpBrowserDocklet->toggleViewAction());
-#endif // SC_USE_WEBENGINE
+#endif // SC_USE_QTWEBENGINE
menu->addMenu(submenu);
menu->addSeparator();
submenu = menu->addMenu(tr("&Tool Panels"));
menu = new QMenu(tr("&Help"), this);
menu->addAction(mActions[HelpAboutIDE]);
menu->addAction(mActions[ReportABug]);
-#ifdef SC_USE_WEBENGINE
+#ifdef SC_USE_QTWEBENGINE
menu->addSeparator();
menu->addAction(mActions[Help]);
menu->addAction(mActions[LookupDocumentationForCursor]);
menu->addAction(mActions[LookupDocumentation]);
-#endif // SC_USE_WEBENGINE
+#endif // SC_USE_QTWEBENGINE
menu->addSeparator();
menu->addAction(mActions[ShowAbout]);
menu->addAction(mActions[ShowAboutQT]);
QVariantMap detachedData;
saveDetachedState(mPostDocklet, detachedData);
saveDetachedState(mDocumentsDocklet, detachedData);
-#ifdef SC_USE_WEBENGINE
+#ifdef SC_USE_QTWEBENGINE
saveDetachedState(mHelpBrowserDocklet, detachedData);
-#endif // SC_USE_WEBENGINE
+#endif // SC_USE_QTWEBENGINE
settings->beginGroup("mainWindow");
settings->setValue("geometry", this->saveGeometry().toBase64());
restoreDetachedState(mPostDocklet, detachedData);
restoreDetachedState(mDocumentsDocklet, detachedData);
-#ifdef SC_USE_WEBENGINE
+#ifdef SC_USE_QTWEBENGINE
restoreDetachedState(mHelpBrowserDocklet, detachedData);
-#endif // SC_USE_WEBENGINE
+#endif // SC_USE_QTWEBENGINE
qDebug("restoring state");
applyCursorBlinkingSettings(settings);
mPostDocklet->mPostWindow->applySettings(settings);
-#ifdef SC_USE_WEBENGINE
+#ifdef SC_USE_QTWEBENGINE
mHelpBrowserDocklet->browser()->applySettings(settings);
-#endif // SC_USE_WEBENGINE
+#endif // SC_USE_QTWEBENGINE
mCmdLine->applySettings(settings);
}
}
void MainWindow::openHelp() {
-#ifdef SC_USE_WEBENGINE
+#ifdef SC_USE_QTWEBENGINE
if (mHelpBrowserDocklet->browser()->url().isEmpty())
mHelpBrowserDocklet->browser()->goHome();
mHelpBrowserDocklet->focus();
-#endif // SC_USE_WEBENGINE
+#endif // SC_USE_QTWEBENGINE
}
void MainWindow::openHelpAboutIDE() {
-#ifdef SC_USE_WEBENGINE
+#ifdef SC_USE_QTWEBENGINE
mHelpBrowserDocklet->browser()->gotoHelpFor("Guides/SCIde");
mHelpBrowserDocklet->focus();
-#endif // SC_USE_WEBENGINE
+#endif // SC_USE_QTWEBENGINE
}
void MainWindow::doBugReport() {
void focusCodeEditor();
bool promptSaveDocs();
-#ifdef SC_USE_WEBENGINE
+#ifdef SC_USE_QTWEBENGINE
HelpBrowserDocklet* helpBrowserDocklet() { return mHelpBrowserDocklet; }
#endif
PostDocklet* postDocklet() { return mPostDocklet; }
// Docks
PostDocklet* mPostDocklet;
DocumentsDocklet* mDocumentsDocklet;
-#ifdef SC_USE_WEBENGINE
+#ifdef SC_USE_QTWEBENGINE
HelpBrowserDocklet* mHelpBrowserDocklet;
#endif
#include <QLayout>
#include <QDebug>
-#ifdef SC_USE_WEBENGINE
+#ifdef SC_USE_QTWEBENGINE
# include <QWebEngineView>
-#endif // SC_USE_WEBENGINE
+#endif // SC_USE_QTWEBENGINE
namespace ScIDE {
}
switch (control) {
-#ifdef SC_USE_WEBENGINE
+#ifdef SC_USE_QTWEBENGINE
// FIXME: this is a workaround for the WebKit bug #104116 (or a variation on it).
case QStyle::CC_ScrollBar: {
if (qobject_cast<const QWebEngineView*>(widget) != 0 && option->type == QStyleOption::SO_Slider) {
return;
}
}
-#endif // SC_USE_WEBENGINE
+#endif // SC_USE_QTWEBENGINE
case QStyle::CC_ToolButton: {
// TODO: We only draw either text, or icon, or arrow
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifdef SC_USE_WEBENGINE
+#ifdef SC_USE_QTWEBENGINE
# include "WebSocketTransport.hpp"
} // namespace ScIDE
-#endif // SC_USE_WEBENGINE
+#endif // SC_USE_QTWEBENGINE
message(STATUS "Found Qt: " ${QtCore_location} )
get_filename_component(QT_BIN_PATH ${QtCore_location} DIRECTORY CACHE)
- if(SC_USE_WEBENGINE)
+ if(SC_USE_QTWEBENGINE)
message(STATUS "sclang: Building with QtWebEngine")
- target_compile_definitions(libsclang PUBLIC SC_USE_WEBENGINE)
+ target_compile_definitions(libsclang PUBLIC SC_USE_QTWEBENGINE)
endif()
target_link_libraries(libsclang ${QT_COLLIDER_LIBS})
endif()