Commit aa7117d5 authored by Aleksi Suomalainen's avatar Aleksi Suomalainen Committed by GitHub

Merge pull request #68 from neochapay/master

Little fixes, remove some warnings, make pageStack frendly
parents 865503d5 c6fc74ed
import QtQuick 2.6
SomeBrokenPage {
}
......@@ -133,6 +133,10 @@ ApplicationWindow {
title: "Notifications"
page: "content/NotificationsPage.qml"
}
ListElement {
title: "Broken page"
page: "content/BrokenPage.qml"
}
}
......@@ -143,9 +147,9 @@ ApplicationWindow {
id: tools
title: "Nemo Touch Gallery"
tools: [ ToolButton { iconSource: "/usr/share/glacier-components/images/icon_cog.png"},
ToolButton { iconSource: "/usr/share/glacier-components/images/icon_edit.png"},
ToolButton { iconSource: "/usr/share/glacier-components/images/icon_refresh.png"} ]
tools: [ ToolButton { iconSource: "image://theme/cog"},
ToolButton { iconSource: "image://theme/edit"},
ToolButton { iconSource: "image://theme/refresh"} ]
//The parent of these items is null when this ToolsLayout is not used
//(i.e. you're on a different page) so we need to check the parent,
......@@ -193,19 +197,19 @@ ApplicationWindow {
id: tool1
anchors.right: parent.right
anchors.verticalCenter: parent.verticalCenter
iconSource: "/usr/share/glacier-components/images/icon_cog.png"
iconSource: "image://theme/cog"
}
ToolButton {
id: tool2
anchors.right: tool1.left
anchors.verticalCenter: parent.verticalCenter
iconSource: "/usr/share/glacier-components/images/icon_edit.png"
iconSource: "image://theme/edit"
}
ToolButton {
id: tool3
anchors.right: tool2.left
anchors.verticalCenter: parent.verticalCenter
iconSource: "/usr/share/glacier-components/images/icon_refresh.png"
iconSource: "image://theme/refresh"
}
},
ButtonRow {
......
......@@ -13,6 +13,7 @@ mainqml.path = /usr/share/glacier-components/qml
qml.files += \
content/AndroidDelegate.qml \
content/ButtonPage.qml \
content/BrokenPage.qml \
content/ProgressBarPage.qml \
content/SliderPage.qml \
content/TabBarPage.qml \
......
......@@ -27,8 +27,9 @@ QML_FILES += \
qml/DatePicker.qml \
qml/TimePicker.qml \
qml/ScrollDecorator.qml \
qml/dialogs/QueryDialog.qml \
qml/TextField.qml \
qml/ErrorStackPage.qml \
qml/dialogs/QueryDialog.qml \
qml/dialogs/SelectionDialog.qml \
qml/dialogs/Dialog.qml
......
......@@ -32,7 +32,6 @@ bool EditFilter::eventFilter(QObject *obj, QEvent *event)
nemoFocus->edit()->setProperty("focus",QVariant(false));
return false;
}
} else {
return QObject::eventFilter(obj, event);
}
return QObject::eventFilter(obj, event);
}
......@@ -35,7 +35,7 @@ public:
private:
QObject *m_edit = nullptr;
NemoFocusSingleton(QObject* parent = nullptr) {}
NemoFocusSingleton(QObject* parent = nullptr) {Q_UNUSED(parent)}
};
#endif // NEMOFOCUSSINGLETON_H
......@@ -66,6 +66,50 @@ NemoWindow {
}
}
//Safety version of pageStack.push - if we can't load component - show error page page with
//error message and back button
function push(url, params) {
if(!params){
params = {}
}
console.log("##", url, params, pageStack)
var component = Qt.createComponent(url)
if (component.status === Component.Ready) {
pageStack.push(component.createObject(pageStack, params))
} else {
console.warn("Error loading component", url, component.errorString())
pageStack.push(Qt.resolvedUrl("ErrorStackPage.qml"), {error: component.errorString()})
}
}
Timer {
id: _errorTimer
property string errorString
interval: 50
repeat: false
onTriggered: {
pageStack.replace(Qt.resolvedUrl("ErrorStackPage.qml"), {error: errorString})
errorString = ""
}
}
Connections {
target: pageStack
onBusyChanged: {
if (_errorTimer.errorString && !pageStack.busy) {
_errorTimer.start()
}
}
onCurrentItemChanged: {
var qmltype = pageStack.currentItem.toString()
if (qmltype.slice(0, 10) === "QQuickText") {
_errorTimer.errorString = pageStack.currentItem.text
}
}
}
function orientationConstraintsChanged()
{
//if the current orientation is not allowed anymore, fallback to an allowed one
......
/****************************************************************************************
**
** Copyright (C) 2018 Chupligin Sergey <neochapay@gmail.com>
** All rights reserved.
**
** You may use this file under the terms of BSD license as follows:
**
** Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions are met:
** * Redistributions of source code must retain the above copyright
** notice, this list of conditions and the following disclaimer.
** * Redistributions in binary form must reproduce the above copyright
** notice, this list of conditions and the following disclaimer in the
** documentation and/or other materials provided with the distribution.
** * Neither the name of the author nor the
** names of its contributors may be used to endorse or promote products
** derived from this software without specific prior written permission.
**
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
** ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
** WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
** DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR
** ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
** (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
** LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
** ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
** SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
**
****************************************************************************************/
import QtQuick 2.6
import QtQuick.Controls.Styles.Nemo 1.0
Page {
id: root
property alias error: errorLabel.text
headerTools: HeaderToolsLayout {
showBackButton: true;
title: qsTr("Error")
}
Column {
spacing: 40
width: parent.width
anchors.centerIn: parent
Label {
id: errorLabel
width: parent.width
text: qsTr("We got some error")
wrapMode: Text.WrapAtWordBoundaryOrAnywhere
}
}
}
......@@ -46,7 +46,7 @@ Item {
fillMode: Image.PreserveAspectFit
sourceSize.width: width
sourceSize.height: height
source: "/usr/lib/qt5/qml/QtQuick/Controls/Styles/Nemo/images/icon-triangle-left.png"
source: "image://theme/chevron-left"
}
MouseArea {
......@@ -122,7 +122,7 @@ Item {
height: toolMeasure
sourceSize.height: height
visible: drawerLevels && drawerLevels.length > 1
source: "/usr/lib/qt5/qml/QtQuick/Controls/Styles/Nemo/images/dots-vertical.png"
source: "image://theme/ellipsis-v"
rotation: isUiPortrait ? 0 : 90
}
}
......@@ -75,6 +75,8 @@ void QQuickFilteringMouseArea::mouseReleaseEvent(QMouseEvent *event) {
}
bool QQuickFilteringMouseArea::sendMouseEvent(QQuickItem *item, QMouseEvent *event) {
Q_UNUSED(item);
QPointF localPos = mapFromScene(event->windowPos());
QQuickWindow *c = window();
QQuickItem *grabber = c ? c->mouseGrabberItem() : 0;
......
......@@ -15,6 +15,7 @@ Sizing::Sizing(QObject *parent) : QObject(parent)
qreal refHeight = 854.; //N9
qreal refWidth = 480.; //N9
qreal refDpi = 251; //N9
Q_UNUSED(refDpi);
m_p_height = qgetenv("QT_QPA_EGLFS_PHYSICAL_HEIGHT").toInt();
m_p_width = qgetenv("QT_QPA_EGLFS_PHYSICAL_WIDTH").toInt();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment