From 7b2e4fb4675f262f88a354abdb0ae399fde169f8 Mon Sep 17 00:00:00 2001 From: Neel Patel Date: Thu, 19 May 2016 09:33:00 -0400 Subject: [PATCH] Add Inspection support to the runtime when built in debug mode. --- README | 8 ++++++++ runtime/BrowserWindow.cpp | 7 +++++++ runtime/pgAdmin4.pro | 5 +++++ 3 files changed, 20 insertions(+) diff --git a/README b/README index a8126b671..d75b7bcb9 100644 --- a/README +++ b/README @@ -37,6 +37,14 @@ Project MESSAGE: Building for QT5+... $ make ... +To build the runtime in debug mode, use the option below with qmake +$ qmake CONFIG+=debug + +To build the runtime in release mode, use the option below with qmake +$ qmake CONFIG+=release + +By default, the runtime application will be built in release mode. + On Linux, an executable called 'pgAdmin4' will be built, and on Mac OS X, an app bundle called pgAdmin4.app will be created. diff --git a/runtime/BrowserWindow.cpp b/runtime/BrowserWindow.cpp index 409ece977..a2053e248 100644 --- a/runtime/BrowserWindow.cpp +++ b/runtime/BrowserWindow.cpp @@ -57,6 +57,13 @@ BrowserWindow::BrowserWindow(QString url) m_tabGridLayout->setContentsMargins(0, 0, 0, 0); m_mainWebView = new WebViewWindow(m_pgAdminMainTab); +#ifdef PGADMIN4_DEBUG + // If pgAdmin4 is run in debug mode, then we should enable the + // "Inspect" option, when the user right clicks on QWebView widget. + // This option is useful to debug the pgAdmin4 desktop application and open the developer tools. + QWebSettings::globalSettings()->setAttribute(QWebSettings::DeveloperExtrasEnabled, true); +#endif + m_tabGridLayout->addWidget(m_mainWebView, 0, 0, 1, 1); m_tabWidget->addTab(m_pgAdminMainTab, QString()); m_tabWidget->setCurrentIndex(0); diff --git a/runtime/pgAdmin4.pro b/runtime/pgAdmin4.pro index 6aa0361c6..339e15839 100644 --- a/runtime/pgAdmin4.pro +++ b/runtime/pgAdmin4.pro @@ -7,6 +7,11 @@ greaterThan(QT_MAJOR_VERSION, 4) { QT += webkit network } +CONFIG(debug, debug|release) { + DEFINES += PGADMIN4_DEBUG + message(Configure pgAdmin4 to run in debug mode...) +} + win32 { message(Building for Windows...)