Verified Commit 5ca48c22 authored by Jonah Brüchert's avatar Jonah Brüchert Committed by Jonah Brüchert
Browse files

Port to newer technologies

* Begin replacing PlasmaComponents with Kirigami
* QtWebEngine.experimental is deprecated and its features have been added to the main module
parent 1e816d55
project(plasma-angelfish)
cmake_minimum_required(VERSION 2.8.10.1)
cmake_minimum_required(VERSION 2.8.12)
################# Disallow in-source build #################
......
......@@ -29,6 +29,7 @@ import QtQuick.Layouts 1.0
import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.plasma.components 2.0 as PlasmaComponents
import org.kde.plasma.extras 2.0 as PlasmaExtras
import org.kde.kirigami 2.0 as Kirigami
Rectangle {
......@@ -71,7 +72,7 @@ Rectangle {
left: parent.left
right: parent.right
bottom: parent.bottom
margins: units.gridUnit / 2
margins: Kirigami.Units.gridUnit / 2
}
}
......@@ -85,7 +86,7 @@ Rectangle {
right: closeButton.left
top: parent.top
left: parent.left
margins: units.gridUnit / 2
margins: Kirigami.Units.gridUnit / 2
}
MouseArea {
anchors.fill: parent
......@@ -96,14 +97,14 @@ Rectangle {
PlasmaCore.IconItem {
id: closeButton
width: units.gridUnit
width: Kirigami.Units.gridUnit
height: width
source: "dialog-close"
anchors {
right: parent.right
top: parent.top
margins: units.gridUnit
margins: Kirigami.Units.gridUnit
}
MouseArea {
anchors.fill: parent
......
......@@ -28,6 +28,7 @@ import QtQuick.Layouts 1.0
//import QtQuick.Controls.Private 1.0
import org.kde.plasma.components 2.0 as PlasmaComponents
import org.kde.plasma.extras 2.0 as PlasmaExtras
import org.kde.kirigami 2.0 as Kirigami
Item {
......@@ -36,7 +37,7 @@ Item {
property string errorCode: ""
property alias errorString: errorDescription.text
property int expandedHeight: units.gridUnit * 8
property int expandedHeight: Kirigami.Units.gridUnit * 8
Behavior on height { NumberAnimation { duration: units.longDuration; easing.type: Easing.InOutQuad} }
......@@ -45,10 +46,10 @@ Item {
ColumnLayout {
visible: parent.height > 0
spacing: units.gridUnit
spacing: Kirigami.Units.gridUnit
anchors {
fill: parent
margins: units.gridUnit
margins: Kirigami.Units.gridUnit
}
PlasmaExtras.Heading {
level: 3
......@@ -70,7 +71,7 @@ Item {
anchors {
right: parent.right
bottom: parent.bottom
margins: units.gridUnit
margins: Kirigami.Units.gridUnit
}
text: errorCode
}
......
......@@ -29,7 +29,6 @@ import QtQuick.Layouts 1.0
import org.kde.plasma.components 2.0 as PlasmaComponents
import org.kde.plasma.extras 2.0 as PlasmaExtras
Item {
// id: options
......
......@@ -20,12 +20,11 @@
***************************************************************************/
import QtQuick 2.3
import QtQuick.Controls 1.0
import QtQuick.Controls 2.0
import QtQuick.Controls.Styles 1.0
import QtQml.Models 2.1
import QtWebEngine 1.0
import QtWebEngine.experimental 1.0
import QtWebEngine 1.6
ListView {
......@@ -47,7 +46,7 @@ ListView {
model: ListModel {
id: tabsModel
ListElement { pageurl: "http://duckduckgo.com" }
ListElement { pageurl: "https://duckduckgo.com" }
// ListElement { pageurl: "http://tagesschau.de" }
// ListElement { pageurl: "http://bbc.co.uk" }
}
......
......@@ -21,10 +21,12 @@
import QtQuick 2.3
import QtQuick.Layouts 1.0
//import QtWebEngine 1.0
import QtWebEngine 1.4
import QtQuick.Controls 2.0 as Controls
import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.plasma.components 2.0 as PlasmaComponents
import org.kde.kirigami 2.0 as Kirigami
//import org.kde.plasma.components 2.0 as PlasmaComponents
//import org.kde.plasma.extras 2.0 as PlasmaExtras
......@@ -35,8 +37,8 @@ Item {
property bool navigationShown: errorCode != "" || webBrowser.url == "" || true
property int expandedHeight: units.gridUnit * 2.5
property int buttonSize: units.gridUnit * 2
property int expandedHeight: Kirigami.Units.gridUnit * 2.5
property int buttonSize: Kirigami.Units.gridUnit * 2
Behavior on height { NumberAnimation { duration: units.longDuration; easing.type: Easing.InOutQuad} }
......@@ -45,11 +47,12 @@ Item {
RowLayout {
id: layout
anchors.fill: parent
anchors.leftMargin: units.gridUnit / 2
anchors.rightMargin: units.gridUnit / 2
anchors.leftMargin: Kirigami.Units.gridUnit / 2
anchors.rightMargin: Kirigami.Units.gridUnit / 2
visible: navigationShown
spacing: units.smallSpacing
/*
PlasmaComponents.ToolButton {
id: backButton
......@@ -87,13 +90,16 @@ Item {
}
*/
PlasmaComponents.TextField {
Controls.TextField {
id: urlInput
Layout.fillWidth: true
text: currentWebView.url
selectByMouse: true
Keys.onReturnPressed: load(browserManager.urlFromUserInput(text))
}
......@@ -103,8 +109,8 @@ Item {
visible: currentWebView.loading
PlasmaComponents.BusyIndicator {
width: buttonSize / 2
Controls.BusyIndicator {
width: buttonSize
height: width
anchors.centerIn: parent
running: currentWebView.loading
......@@ -129,7 +135,7 @@ Item {
}
elementId: iconSvg.hasElement("menu") ? "menu" : "configure"
anchors.fill: parent
anchors.margins: (units.gridUnit / 2)
anchors.margins: (Kirigami.Units.gridUnit / 2)
}
checked: options.state != "hidden"
//onClicked: options.state = (options.state != "hidden" ? "hidden" : targetState)
......
......@@ -21,19 +21,18 @@
import QtQuick 2.3
//import QtWebEngine 1.0
import QtQuick.Controls 1.0
import QtQuick.Controls.Styles 1.0
import QtQuick.Controls 2.0 as Controls
import QtQuick.Layouts 1.0
//import QtQuick.Window 2.1
//import QtQuick.Controls.Private 1.0
import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.plasma.components 2.0 as PlasmaComponents
import org.kde.kirigami 2.4 as Kirigami
Button {
Controls.ToolButton {
id: button
property alias icon: iconItem.source
property alias iconSource: iconItem.source
signal released
signal pressed
......@@ -76,7 +75,7 @@ Button {
}
}
PlasmaCore.IconItem {
Kirigami.Icon {
id: iconItem
anchors.fill: parent
visible: text == ""
......@@ -85,42 +84,12 @@ Button {
RowLayout {
id: layoutRow
anchors.fill: parent
PlasmaCore.IconItem {
Kirigami.Icon {
id: rowIcon
Layout.preferredWidth: parent.width / 4
Layout.fillWidth: false
source: iconItem.source
}
PlasmaComponents.Label {
id: rowLabel
//Layout.preferredWidth: parent.height
Layout.fillWidth: true
//visible: text == ""
text: button.text
}
visible: text != ""
}
style: ButtonStyle {
label: Item {}
background: Rectangle {
color: theme.highlightColor
opacity: {
if (button.isPressed) {
return 1
} else if (isActive) {
return 0.3
} else {
0
}
}
//border.color: "black"
//border.width: 1
// //opacity: isActive ? 0.8 : 0
Behavior on opacity { NumberAnimation { duration: units.longDuration/2; easing.type: Easing.InOutQuad} }
}
}
}
\ No newline at end of file
}
......@@ -29,6 +29,7 @@ import QtQuick.Layouts 1.0
import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.plasma.components 2.0 as PlasmaComponents
import org.kde.plasma.extras 2.0 as PlasmaExtras
import org.kde.kirigami 2.0 as Kirigami
Rectangle {
......@@ -40,16 +41,16 @@ Rectangle {
property string title: ""
property int expandedHeight: units.gridUnit * 12
property int expandedWidth: units.gridUnit * 14
property int expandedHeight: Kirigami.Units.gridUnit * 12
property int expandedWidth: Kirigami.Units.gridUnit * 14
Behavior on opacity { NumberAnimation { duration: units.longDuration/2; easing.type: Easing.InOutQuad} }
Behavior on x { NumberAnimation { duration: units.longDuration/2; easing.type: Easing.InOutQuad} }
height: expandedHeight
width: expandedWidth
//height: childrenRect.height + units.gridUnit
//width: childrenRect.width + units.gridUnit/2
//height: childrenRect.height + Kirigami.Units.gridUnit
//width: childrenRect.width + Kirigami.Units.gridUnit/2
//width: expandedWidth
//anchors.rightMargin: -options.margins.right
......@@ -78,18 +79,18 @@ Rectangle {
ColumnLayout {
//visible: parent.height > 0
//spacing: units.gridUnit
//spacing: Kirigami.Units.gridUnit
spacing: 0
//x: units.gridUnit / 2
//y: - (units.gridUnit + webBrowser.borderWidth)
//width: units.gridUnit * 14
//x: Kirigami.Units.gridUnit / 2
//y: - (Kirigami.Units.gridUnit + webBrowser.borderWidth)
//width: Kirigami.Units.gridUnit * 14
anchors {
//fill: parent
top: parent.top
//topMargin: units.gridUnit
//topMargin: Kirigami.Units.gridUnit
left: parent.left
right: parent.right
//margins: units.gridUnit / 2
//margins: Kirigami.Units.gridUnit / 2
}
MouseArea {
anchors.fill: parent
......@@ -119,7 +120,7 @@ Rectangle {
State {
name: "overview"
PropertyChanges { target: options; title: ""}
//PropertyChanges { target: options; height: units.gridUnit * 3}
//PropertyChanges { target: options; height: Kirigami.Units.gridUnit * 3}
PropertyChanges { target: options; opacity: 1.0}
PropertyChanges { target: options; x: webBrowser.width - options.width }
......
......@@ -28,20 +28,21 @@ import QtQuick.Layouts 1.0
//import QtQuick.Controls.Private 1.0
import org.kde.plasma.components 2.0 as PlasmaComponents
import org.kde.plasma.extras 2.0 as PlasmaExtras
import org.kde.kirigami 2.0 as Kirigami
ColumnLayout {
id: optionsOverview
property int buttonSize: units.gridUnit * 2
property int buttonSize: Kirigami.Units.gridUnit * 2
RowLayout {
id: layout
anchors.fill: parent
height: buttonSize
spacing: 0
// anchors.leftMargin: units.gridUnit / 2
// anchors.rightMargin: units.gridUnit / 2
// anchors.leftMargin: Kirigami.Units.gridUnit / 2
// anchors.rightMargin: Kirigami.Units.gridUnit / 2
//visible: navigationShown
//spacing: units.smallSpacing
......@@ -51,7 +52,7 @@ ColumnLayout {
enabled: currentWebView.canGoBack
icon: "go-previous"
iconSource: "go-previous"
onClicked: currentWebView.goBack()
onTriggered: {
......@@ -68,7 +69,7 @@ ColumnLayout {
// Layout.preferredHeight: buttonSize
enabled: currentWebView.canGoForward
icon: "go-next"
iconSource: "go-next"
onTriggered: {
options.state = "hidden";
......@@ -83,7 +84,7 @@ ColumnLayout {
// Layout.fillWidth: true
// Layout.preferredHeight: buttonSize
icon: currentWebView.loading ? "process-stop" : "view-refresh"
iconSource: currentWebView.loading ? "process-stop" : "view-refresh"
onTriggered: {
options.state = "hidden";
......@@ -98,14 +99,14 @@ ColumnLayout {
// Layout.fillWidth: true
// Layout.preferredHeight: buttonSize
icon: "bookmarks"
iconSource: "bookmarks"
onTriggered: {
print("Adding bookmark");
var request = new Object;// FIXME
request.url = currentWebView.url;
request.title = currentWebView.title;
request.icon = currentWebView.icon;
request.iconSource = currentWebView.iconSource;
request.bookmarked = true;
browserManager.addBookmark(request);
options.state = "hidden"
......@@ -127,7 +128,7 @@ ColumnLayout {
}
OptionButton {
icon: "tab-duplicate"
iconSource: "tab-duplicate"
Layout.fillWidth: true
Layout.preferredHeight: buttonSize
onTriggered: {
......@@ -139,7 +140,7 @@ ColumnLayout {
}
OptionButton {
icon: "bookmarks"
iconSource: "bookmarks"
Layout.fillWidth: true
Layout.preferredHeight: buttonSize
onTriggered: {
......@@ -151,7 +152,7 @@ ColumnLayout {
}
OptionButton {
icon: "view-history"
iconSource: "view-history"
Layout.fillWidth: true
Layout.preferredHeight: buttonSize
onTriggered: {
......@@ -163,7 +164,7 @@ ColumnLayout {
}
OptionButton {
icon: "configure"
iconSource: "configure"
Layout.fillWidth: true
Layout.preferredHeight: buttonSize
text: i18n("Settings")
......
......@@ -20,57 +20,52 @@
***************************************************************************/
import QtQuick 2.3
import QtQuick.Controls 1.0
import QtQuick.Controls 2.0 as Controls
import QtQuick.Layouts 1.0
import org.kde.plasma.components 2.0 as PlasmaComponents
import org.kde.plasma.extras 2.0 as PlasmaExtras
import QtWebEngine 1.0
import QtWebEngine.experimental 1.0
GridLayout {
id: settingsPage
columns: 2
PlasmaComponents.Label {
Controls.Label {
text: "Enable javascript"
Layout.fillWidth: true
Layout.preferredHeight: units.gridUnit * 2
Layout.preferredHeight: Kirigami.Units.gridUnit * 2
}
CheckBox {
Layout.preferredHeight: units.gridUnit * 2
Layout.preferredWidth: units.gridUnit * 2
Controls.CheckBox {
Layout.preferredHeight: Kirigami.Units.gridUnit * 2
Layout.preferredWidth: Kirigami.Units.gridUnit * 2
onCheckedChanged: {
var settings = currentWebView.experimental.settings;
var settings = currentWebView.settings;
settings.javascriptEnabled = checked;
// FIXME: save to config
}
Component.onCompleted: {
checked = currentWebView.experimental.settings.javascriptEnabled;
checked = currentWebView.settings.javascriptEnabled;
}
}
PlasmaComponents.Label {
Controls.Label {
text: "Load images"
Layout.fillWidth: true
Layout.preferredHeight: units.gridUnit * 2
Layout.preferredHeight: Kirigami.Units.gridUnit * 2
}
CheckBox {
Layout.preferredHeight: units.gridUnit * 2
Layout.preferredWidth: units.gridUnit * 2
Controls.CheckBox {
Layout.preferredHeight: Kirigami.Units.gridUnit * 2
Layout.preferredWidth: Kirigami.Units.gridUnit * 2
onCheckedChanged: {
var settings = currentWebView.experimental.settings;
var settings = currentWebView.settings;
settings.autoLoadImages = checked;
// FIXME: save to config
}
Component.onCompleted: {
checked = currentWebView.experimental.settings.autoLoadImages;
checked = currentWebView.settings.autoLoadImages;
}
}
......
......@@ -20,10 +20,10 @@
***************************************************************************/
import QtQuick 2.3
import QtQuick.Controls 1.0
import QtQuick.Controls 2.0
import QtQuick.Controls.Styles 1.0
import QtWebEngine 1.0
import QtWebEngine 1.6
TabView {
......
......@@ -20,13 +20,14 @@
***************************************************************************/
import QtQuick 2.3
//import QtQuick.Controls 1.0
import QtQuick.Controls 2.0 as Controls
//import QtWebEngine 1.0
import QtQuick.Layouts 1.0
import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.kirigami 2.0 as Kirigami
// import org.kde.plasma.components 2.0 as PlasmaComponents
// import org.kde.plasma.extras 2.0 as PlasmaExtras
......@@ -36,7 +37,7 @@ Item {
id: tabsRoot
property int itemHeight: Math.round(itemWidth/ 3 * 2)
property int itemWidth: (width / 2) - units.gridUnit
property int itemWidth: (width / 2) - Kirigami.Units.gridUnit
//Rectangle { anchors.fill: parent; color: "brown"; opacity: 0.5; }
......@@ -58,7 +59,7 @@ Item {
//live: true
anchors.fill: parent
anchors.margins: units.gridUnit / 2
anchors.margins: Kirigami.Units.gridUnit / 2
sourceRect: Qt.rect(0, 0, width * 2, height * 2)
......@@ -95,12 +96,11 @@ Item {
}
Rectangle {
anchors.fill: parent;
anchors.margins: units.gridUnit / 4;
anchors.margins: Kirigami.Units.gridUnit / 4;
border.color: theme.textColor;
border.width: webBrowser.borderWidth
color: "transparent"
opacity: 0.3;
}
MouseArea {
anchors.fill: parent
......@@ -129,7 +129,7 @@ Item {
color: "white"
width: itemWidth
height: itemHeight
PlasmaCore.IconItem {
Kirigami.Icon {
anchors.fill: parent
anchors.margins: Math.round(itemHeight / 4)
source: "list-add"
......@@ -137,11 +137,10 @@ Item {
MouseArea {
anchors.fill: parent
onClicked: {
tabs.newTab("")
tabs.newTab("https://duckduckgo.com")
//addressBar.forceActiveFocus();
//addressBar.selectAll();
tabs.currentIndex = tabs.count - 1;
contentView.state = "bookmarks"
}
}
......
......@@ -20,7 +20,7 @@
***************************************************************************/
import QtQuick 2.3
//import QtQuick.Controls 1.0
import QtQuick.Controls 2.0 as Controls
//import QtWebEngine 1.0
......@@ -30,11 +30,12 @@ import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.plasma.components 2.0 as PlasmaComponents
import org.kde.plasma.extras 2.0 as PlasmaExtras
import org.kde.kirigami 2.0 as Kirigami
MouseArea {
Controls.ItemDelegate {
id: urlDelegate
height: units.gridUnit * 3
height: Kirigami.Units.gridUnit * 3