diff --git a/src/contents/ui/Options.qml b/src/contents/ui/Options.qml index f40fe2a..7b81124 100644 --- a/src/contents/ui/Options.qml +++ b/src/contents/ui/Options.qml @@ -1,105 +1,105 @@ /*************************************************************************** * * * Copyright 2014-2015 Sebastian Kügler * * * * 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 2 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, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . * * * ***************************************************************************/ import QtQuick 2.3 //import QtWebEngine 1.0 //import QtQuick.Controls 1.0 //import QtQuick.Controls.Styles 1.0 import QtQuick.Layouts 1.0 //import QtQuick.Window 2.1 //import QtQuick.Controls.Private 1.0 import org.kde.kirigami 2.0 as Kirigami Rectangle { id: options state: "hidden" //state: "bookmarks" color: Kirigami.Theme.backgroundColor property string title: "" property int expandedWidth: Kirigami.Units.gridUnit * 14 Behavior on opacity { NumberAnimation { duration: Kirigami.Units.longDuration/2; easing.type: Easing.InOutQuad} } Behavior on x { NumberAnimation { duration: Kirigami.Units.longDuration/2; easing.type: Easing.InOutQuad} } width: expandedWidth height: childrenRect.height Rectangle { width: webBrowser.borderWidth color: webBrowser.borderColor anchors { left: parent.left top: parent.top bottom: parent.bottom } } Rectangle { height: webBrowser.borderWidth color: webBrowser.borderColor anchors { left: parent.left - bottom: parent.bottom + top: parent.top right: parent.right } } ColumnLayout { spacing: 0 anchors { //fill: parent top: parent.top //topMargin: Kirigami.Units.gridUnit left: parent.left right: parent.right //margins: Kirigami.Units.gridUnit / 2 } OptionsOverview { Layout.fillWidth: true; } Loader { id: loader Layout.fillHeight: true Layout.fillWidth: true //Rectangle { anchors.fill: parent; color: "black"; opacity: 0.1; } } } states: [ State { name: "hidden" PropertyChanges { target: options; opacity: 0.0} PropertyChanges { target: options; x: webBrowser.width} }, State { name: "overview" PropertyChanges { target: options; title: ""} //PropertyChanges { target: options; height: Kirigami.Units.gridUnit * 3} PropertyChanges { target: options; opacity: 1.0} PropertyChanges { target: options; x: webBrowser.width - options.width } } ] } diff --git a/src/contents/ui/webbrowser.qml b/src/contents/ui/webbrowser.qml index ff30eac..ee053eb 100644 --- a/src/contents/ui/webbrowser.qml +++ b/src/contents/ui/webbrowser.qml @@ -1,223 +1,224 @@ /*************************************************************************** * * * Copyright 2014-2015 Sebastian Kügler * * * * 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 2 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, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . * * * ***************************************************************************/ import QtQuick 2.1 import QtWebEngine 1.6 import QtQuick.Window 2.1 import org.kde.kirigami 2.4 as Kirigami Kirigami.ApplicationWindow { id: webBrowser title: "Angelfish Webbrowser" /** Pointer to the currently active view. * * Browser-level functionality should use this to refer to the current * view, rather than looking up views in the mode, as far as possible. */ property Item currentWebView: tabs.currentIndex < tabs.count ? tabs.currentItem : null onCurrentWebViewChanged: { print("Current WebView is now : " + tabs.currentIndex); } property int borderWidth: Math.round(Kirigami.Units.gridUnit / 18); property color borderColor: Kirigami.Theme.highlightColor; /** * Load a url in the current tab */ function load(url) { print("Loading url: " + url); currentWebView.url = url; currentWebView.forceActiveFocus() } width: Kirigami.Units.gridUnit * 20 height: Kirigami.Units.gridUnit * 30 function addHistoryEntry() { //print("Adding history"); var request = new Object;// FIXME request.url = currentWebView.url; request.title = currentWebView.title; request.icon = currentWebView.icon; browserManager.addToHistory(request); } property bool layerShown : pageStack.layers.depth > 1 pageStack.globalToolBar.style: layerShown ? Kirigami.ApplicationHeaderStyle.Auto : Kirigami.ApplicationHeaderStyle.None pageStack.initialPage: Kirigami.Page { leftPadding: 0 rightPadding: 0 topPadding: 0 bottomPadding: 0 ListWebView { id: tabs anchors { - top: navigation.bottom + top: parent.top left: parent.left right: parent.right - bottom: parent.bottom + bottom: navigation.top } } ErrorHandler { id: errorHandler errorString: currentWebView.errorString errorCode: currentWebView.errorCode anchors { - top: navigation.bottom + top: parent.top left: parent.left right: parent.right + //bottom: navigation.top } visible: !navigation.textFocus } Kirigami.InlineMessage { id: newTabQuestion type: Kirigami.MessageType.Warning text: i18n("Site wants to open a new tab: \n%1", url.toString()) showCloseButton: true anchors.top: navigation.bottom anchors.left: parent.left anchors.right: parent.right property var url actions: [ Kirigami.Action { iconName: "tab-new" text: i18n("Open") onTriggered: { tabs.newTab(newTabQuestion.url.toString()) newTabQuestion.visible = false } } ] } // Container for the progress bar Item { id: progressItem height: Math.round(Kirigami.Units.gridUnit / 6) z: navigation.z + 1 anchors { top: tabs.top topMargin: -Math.round(height / 2) left: tabs.left right: tabs.right } opacity: currentWebView.loading ? 1 : 0 Behavior on opacity { NumberAnimation { duration: Kirigami.Units.longDuration; easing.type: Easing.InOutQuad; } } Rectangle { color: Kirigami.Theme.highlightColor width: Math.round((currentWebView.loadProgress / 100) * parent.width) anchors { top: parent.top left: parent.left bottom: parent.bottom } } } // When clicked outside the menu, hide it MouseArea { id: optionsDismisser visible: options.state != "hidden" onClicked: options.state = "hidden" anchors.fill: parent } // The menu at the top right Options { id: options anchors { - top: navigation.bottom + bottom: navigation.top } } Navigation { id: navigation visible: !webappcontainer height: { if (!webappcontainer) return Kirigami.Units.gridUnit * 3 else return 0 } anchors { - top: parent.top + bottom: parent.bottom left: parent.left right: parent.right } - + onTextChanged: urlFilter.setFilterFixedString(text) } ListView { id: completion property string searchText: navigation.text - anchors.top: navigation.bottom + anchors.bottom: navigation.top anchors.horizontalCenter: navigation.horizontalCenter width: 0.9 * navigation.width height: 0.5 * parent.height z: 10 visible: navigation.textFocus model: urlFilter delegate: UrlDelegate { showRemove: false onClicked: tabs.forceActiveFocus() highlightText: completion.searchText } clip: true } // Thin line underneath navigation Rectangle { height: webBrowser.borderWidth color: webBrowser.borderColor anchors { left: parent.left - bottom: navigation.bottom + bottom: navigation.top right: options.left } } } }