feat: add empty view for the browser
This commit is contained in:
parent
af33a50a03
commit
07774d8ff8
|
@ -433,6 +433,7 @@ Rectangle {
|
||||||
anchors.top: parent.top
|
anchors.top: parent.top
|
||||||
anchors.topMargin: Style.current.halfPadding
|
anchors.topMargin: Style.current.halfPadding
|
||||||
anchors.bottom: devToolsView.top
|
anchors.bottom: devToolsView.top
|
||||||
|
anchors.bottomMargin: Style.current.padding
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
|
@ -440,7 +441,6 @@ Rectangle {
|
||||||
tab.item.url = determineRealURL("https://simpledapp.eth");
|
tab.item.url = determineRealURL("https://simpledapp.eth");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add custom tab view style so we can customize the tabs to include a close button
|
|
||||||
style: TabViewStyle {
|
style: TabViewStyle {
|
||||||
property color fillColor: Style.current.background
|
property color fillColor: Style.current.background
|
||||||
property color nonSelectedColor: Qt.darker(Style.current.background, 1.2)
|
property color nonSelectedColor: Qt.darker(Style.current.background, 1.2)
|
||||||
|
@ -552,6 +552,7 @@ Rectangle {
|
||||||
hideStatusText.stop();
|
hideStatusText.stop();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
backgroundColor: Style.current.background
|
||||||
|
|
||||||
settings.autoLoadImages: browserHeader.browserSettings.autoLoadImages
|
settings.autoLoadImages: browserHeader.browserSettings.autoLoadImages
|
||||||
settings.javascriptEnabled: browserHeader.browserSettings.javaScriptEnabled
|
settings.javascriptEnabled: browserHeader.browserSettings.javaScriptEnabled
|
||||||
|
@ -568,20 +569,25 @@ Rectangle {
|
||||||
}
|
}
|
||||||
|
|
||||||
onNewViewRequested: function(request) {
|
onNewViewRequested: function(request) {
|
||||||
if (!request.userInitiated)
|
if (!request.userInitiated) {
|
||||||
|
print("PROUT")
|
||||||
print("Warning: Blocked a popup window.");
|
print("Warning: Blocked a popup window.");
|
||||||
else if (request.destination === WebEngineView.NewViewInTab) {
|
} else if (request.destination === WebEngineView.NewViewInTab) {
|
||||||
|
print("NewViewInTab")
|
||||||
var tab = tabs.createEmptyTab(currentWebView.profile);
|
var tab = tabs.createEmptyTab(currentWebView.profile);
|
||||||
tabs.currentIndex = tabs.count - 1;
|
tabs.currentIndex = tabs.count - 1;
|
||||||
request.openIn(tab.item);
|
request.openIn(tab.item);
|
||||||
} else if (request.destination === WebEngineView.NewViewInBackgroundTab) {
|
} else if (request.destination === WebEngineView.NewViewInBackgroundTab) {
|
||||||
|
print("NewViewInBackgroundTab")
|
||||||
var backgroundTab = tabs.createEmptyTab(currentWebView.profile);
|
var backgroundTab = tabs.createEmptyTab(currentWebView.profile);
|
||||||
request.openIn(backgroundTab.item);
|
request.openIn(backgroundTab.item);
|
||||||
} else if (request.destination === WebEngineView.NewViewInDialog) {
|
} else if (request.destination === WebEngineView.NewViewInDialog) {
|
||||||
|
print("NewViewInDialog")
|
||||||
var dialog = browserDialogComponent.createObject();
|
var dialog = browserDialogComponent.createObject();
|
||||||
dialog.currentWebView.profile = currentWebView.profile;
|
dialog.currentWebView.profile = currentWebView.profile;
|
||||||
request.openIn(dialog.currentWebView);
|
request.openIn(dialog.currentWebView);
|
||||||
} else {
|
} else {
|
||||||
|
print("SOMETHIGN")
|
||||||
// Instead of opening a new window, we open a new tab
|
// Instead of opening a new window, we open a new tab
|
||||||
// TODO: remove "open in new window" from context menu
|
// TODO: remove "open in new window" from context menu
|
||||||
var tab = tabs.createEmptyTab(currentWebView.profile);
|
var tab = tabs.createEmptyTab(currentWebView.profile);
|
||||||
|
@ -643,6 +649,64 @@ Rectangle {
|
||||||
findBar.reset();
|
findBar.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loader {
|
||||||
|
active: !webEngineView.url.toString()
|
||||||
|
width: parent.width
|
||||||
|
height: parent.height
|
||||||
|
z: 54
|
||||||
|
|
||||||
|
sourceComponent: Item {
|
||||||
|
width: parent.width
|
||||||
|
height: parent.height
|
||||||
|
|
||||||
|
Image {
|
||||||
|
id: emptyPageImage
|
||||||
|
source: "../../img/browser/compass.png"
|
||||||
|
width: 294
|
||||||
|
height: 294
|
||||||
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
anchors.top: parent.top
|
||||||
|
anchors.topMargin: 60
|
||||||
|
}
|
||||||
|
|
||||||
|
Row {
|
||||||
|
anchors.horizontalCenter: emptyPageImage.horizontalCenter
|
||||||
|
anchors.top: emptyPageImage.bottom
|
||||||
|
anchors.topMargin: 30
|
||||||
|
Item {
|
||||||
|
width: bookmarkItem.width
|
||||||
|
height: bookmarkItem.height
|
||||||
|
Item {
|
||||||
|
id: bookmarkItem
|
||||||
|
width: childrenRect.width
|
||||||
|
height: childrenRect.height
|
||||||
|
SVGImage {
|
||||||
|
id: bookmarkImage
|
||||||
|
source: "../../img/globe.svg"
|
||||||
|
width: 48
|
||||||
|
height: 48
|
||||||
|
}
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
text: "site.com"
|
||||||
|
anchors.horizontalCenter: bookmarkImage.horizontalCenter
|
||||||
|
anchors.top: bookmarkImage.bottom
|
||||||
|
anchors.topMargin: Style.current.halfPadding
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
MouseArea {
|
||||||
|
anchors.fill: bookmarkItem
|
||||||
|
cursorShape: Qt.PointingHandCursor
|
||||||
|
onClicked: console.log('Go to bookmark')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Timer {
|
Timer {
|
||||||
id: reloadTimer
|
id: reloadTimer
|
||||||
interval: 0
|
interval: 0
|
||||||
|
|
Binary file not shown.
After Width: | Height: | Size: 51 KiB |
Loading…
Reference in New Issue