Skip to content

Commit

Permalink
Added DevTools menu item and window, working on #19
Browse files Browse the repository at this point in the history
  • Loading branch information
pierremtb committed Dec 21, 2016
1 parent 1af8536 commit dae0e2b
Show file tree
Hide file tree
Showing 5 changed files with 64 additions and 2 deletions.
3 changes: 3 additions & 0 deletions src/main/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ int main(int argc, char *argv[])
// Set Material Design QtQuick Controls 2 style
qputenv("QT_QUICK_CONTROLS_STYLE", "material");

// Set the port for DevTools
qputenv("QTWEBENGINE_REMOTE_DEBUGGING", "0.0.0.0:9992");

#if defined(ENABLE_HIGH_DPI_SCALING)
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
#endif
Expand Down
4 changes: 2 additions & 2 deletions src/ui/Main.qml
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,8 @@ QtObject {
function newWindow(incognito, openStartUrl) {
var properties = {root: root}
if (incognito)
properties["profile"] = incognitoProfile;
properties["openStartUrl"] = openStartUrl;
properties.profile = incognitoProfile;
properties.openStartUrl = openStartUrl;
var window = browserWindowComponent.createObject(root, properties);
return window;
}
Expand Down
1 change: 1 addition & 0 deletions src/ui/ui.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,6 @@
<file>tabview/content/WebContent.qml</file>
<file>tabview/content/SettingsContent.qml</file>
<file>utils/qmldir</file>
<file>window/DevToolsWindow.qml</file>
</qresource>
</RCC>
11 changes: 11 additions & 0 deletions src/ui/window/BrowserWindow.qml
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,13 @@ FluidWindow {
}
}

MenuItem {
text: "Dev Tools"
onClicked: {
devToolsWindow.open();
}
}

Connections {
target: tabController.tabsModel
onEmptyChanged: {
Expand Down Expand Up @@ -300,6 +307,10 @@ FluidWindow {
}
}

DevToolsWindow {
id: devToolsWindow
}

Component.onCompleted: {
if (openStartUrl)
tabController.openUrl(startUrl);
Expand Down
47 changes: 47 additions & 0 deletions src/ui/window/DevToolsWindow.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/*
* This file is part of Liri Browser
*
* Copyright (C) 2016 Pierre Jacquier <[email protected]>
*
* $BEGIN_LICENSE:GPL3+$
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* $END_LICENSE$
*/

import QtQuick 2.7
import Fluid.Controls 1.0
import SlimeEngine 0.2
import ".."

FluidWindow {
id: window
visible: false
width: 700
height: 600
title: 'Dev Tools - Liri Browser'

WebView {
id: engine
anchors.fill: parent
engine: WebEngine.QtWebEngine
}

function open(uid) {
// engine.url = 'http://0.0.0.0:9992/devtools/inspector.html?ws=0.0.0.0:9992/devtools/page/' + uid;
engine.url = 'http://0.0.0.0:9992';
window.showNormal();
}
}

0 comments on commit dae0e2b

Please sign in to comment.