[PATCH] Implementing UI behaviour: start up screen.

110 views
Skip to first unread message

Luciano Wolf

unread,
Jun 21, 2012, 10:00:50 AM6/21/12
to snowsh...@googlegroups.com
Tabs grid should be the default option unless we have some topsite
already added into database.

Reviewed-by: ?
---
src/mobile/qml/Main.qml | 10 ++++++++--
src/mobile/qml/PanelToggle.qml | 15 ++++++++++++---
2 files changed, 20 insertions(+), 5 deletions(-)

diff --git a/src/mobile/qml/Main.qml b/src/mobile/qml/Main.qml
index 5fff69f..3639dfd 100644
--- a/src/mobile/qml/Main.qml
+++ b/src/mobile/qml/Main.qml
@@ -36,7 +36,8 @@ Rectangle {
topMargin: 32
horizontalCenter: parent.horizontalCenter
}
- navigationEnabled: navigationPanel.hasOpennedTabs
+ topSitesEnabled: BookmarkModel.count
+ navigationEnabled: navigationPanel.hasOpennedTabs || !topSitesEnabled
onTopSitesSelected: {
rootPage.state = "favorites";
}
@@ -162,7 +163,12 @@ Rectangle {
// then to true on start up causing a cascade misbehaviour, the workaround
// is to set the state of the root element on Component.onCompleted.
// state: "favorites"
- Component.onCompleted: state = "favorites"
+ Component.onCompleted: {
+ if (BookmarkModel.count)
+ state = "favorites";
+ else
+ state = "navigation";
+ }

states: [
State {
diff --git a/src/mobile/qml/PanelToggle.qml b/src/mobile/qml/PanelToggle.qml
index 92f5606..bda9f47 100644
--- a/src/mobile/qml/PanelToggle.qml
+++ b/src/mobile/qml/PanelToggle.qml
@@ -19,18 +19,26 @@ import QtQuick 2.0
Image {
id: panelToggle

+ property bool topSitesEnabled: false
property bool navigationEnabled: true
property alias topSitesButtonSelected: topsites.visible

signal topSitesSelected()
signal tabsSelected()

+ onTopSitesEnabledChanged: {
+ if (!topSitesEnabled) {
+ tabs.visible = true;
+ topsites.visible = false;
+ }
+ }
+
onNavigationEnabledChanged: {
- if (!navigationEnabled)
+ if (!navigationEnabled && topSitesEnabled)
topsites.visible = true;
}

- source: navigationEnabled ? "qrc:///mobile/app/menu_unpressed" : "qrc:///mobile/app/menu_disabled"
+ source: topSitesEnabled && navigationEnabled ? "qrc:///mobile/app/menu_unpressed" : "qrc:///mobile/app/menu_disabled"

Image {
id: topsites
@@ -39,6 +47,7 @@ Image {
}
MouseArea {
anchors.fill: topsites
+ visible: topSitesEnabled
onClicked: topsites.visible = true
}

@@ -51,7 +60,7 @@ Image {
}
MouseArea {
anchors.fill: tabs
- visible: navigationEnabled
+ visible: navigationEnabled || !topSitesEnabled
onClicked: topsites.visible = false
}
}
--
1.7.9.5

Luciano Wolf

unread,
Jun 25, 2012, 2:55:49 PM6/25/12
to snowsh...@googlegroups.com
Tabs grid should be the default option unless we have some topsite
already added into database.

Reviewed-by: ?
---
src/mobile/qml/Main.qml | 11 +++++++++--
src/mobile/qml/PanelToggle.qml | 16 +++++++++++++---
2 files changed, 22 insertions(+), 5 deletions(-)

diff --git a/src/mobile/qml/Main.qml b/src/mobile/qml/Main.qml
index 5fff69f..7beee85 100644
--- a/src/mobile/qml/Main.qml
+++ b/src/mobile/qml/Main.qml
@@ -36,7 +36,8 @@ Rectangle {
topMargin: 32
horizontalCenter: parent.horizontalCenter
}
- navigationEnabled: navigationPanel.hasOpennedTabs
+ topSitesEnabled: BookmarkModel.count
+ navigationEnabled: navigationPanel.hasOpennedTabs || !topSitesEnabled || panelToggle.overrideNavigationEnabled
onTopSitesSelected: {
rootPage.state = "favorites";
}
@@ -78,6 +79,7 @@ Rectangle {

onWebViewMaximized: {
rootPage.state = "navigationFullScreen";
+ panelToggle.overrideNavigationEnabled = true;
}
onWebViewMinimized: {
rootPage.state = "navigation";
@@ -162,7 +164,12 @@ Rectangle {
// then to true on start up causing a cascade misbehaviour, the workaround
// is to set the state of the root element on Component.onCompleted.
// state: "favorites"
- Component.onCompleted: state = "favorites"
+ Component.onCompleted: {
+ if (BookmarkModel.count)
+ state = "favorites";
+ else
+ state = "navigation";
+ }

states: [
State {
diff --git a/src/mobile/qml/PanelToggle.qml b/src/mobile/qml/PanelToggle.qml
index 92f5606..64ee23c 100644
--- a/src/mobile/qml/PanelToggle.qml
+++ b/src/mobile/qml/PanelToggle.qml
@@ -19,18 +19,27 @@ import QtQuick 2.0
Image {
id: panelToggle

+ property bool topSitesEnabled: false
property bool navigationEnabled: true
+ property bool overrideNavigationEnabled: false
property alias topSitesButtonSelected: topsites.visible

signal topSitesSelected()
signal tabsSelected()

+ onTopSitesEnabledChanged: {
+ if (!topSitesEnabled) {
+ tabs.visible = true;
+ topsites.visible = false;
+ }
+ }
+
onNavigationEnabledChanged: {
- if (!navigationEnabled)
+ if (!navigationEnabled && topSitesEnabled)
topsites.visible = true;
}

- source: navigationEnabled ? "qrc:///mobile/app/menu_unpressed" : "qrc:///mobile/app/menu_disabled"
+ source: topSitesEnabled && navigationEnabled ? "qrc:///mobile/app/menu_unpressed" : "qrc:///mobile/app/menu_disabled"

Image {
id: topsites
@@ -39,6 +48,7 @@ Image {
}
MouseArea {
anchors.fill: topsites
+ visible: topSitesEnabled
onClicked: topsites.visible = true
}

@@ -51,7 +61,7 @@ Image {

Luciano Wolf

unread,
Jun 25, 2012, 2:55:50 PM6/25/12
to snowsh...@googlegroups.com
The following warning was fixed: <Unknown File>: QML StateGroup: Can't apply
a state change as part of a state definition.

Reviewed-by: ?
---
src/mobile/qml/Main.qml | 15 +++++++++------
src/mobile/qml/PanelToggle.qml | 17 +++++++++++------
2 files changed, 20 insertions(+), 12 deletions(-)

diff --git a/src/mobile/qml/Main.qml b/src/mobile/qml/Main.qml
index 7beee85..010be92 100644
--- a/src/mobile/qml/Main.qml
+++ b/src/mobile/qml/Main.qml
@@ -39,10 +39,13 @@ Rectangle {
topSitesEnabled: BookmarkModel.count
navigationEnabled: navigationPanel.hasOpennedTabs || !topSitesEnabled || panelToggle.overrideNavigationEnabled
onTopSitesSelected: {
- rootPage.state = "favorites";
+ if (rootPage.state !== "navigationFullScreen")
+ rootPage.state = "favorites";
}
onTabsSelected: {
- rootPage.state = "navigation";
+ if (rootPage.state !== "navigationFullScreen") {
+ rootPage.state = "navigation";
+ }
}
}

@@ -55,7 +58,10 @@ Rectangle {
right: parent.right
topMargin: 32
}
- onUrlSelected: navigationPanel.openUrlInNewTab(UrlTools.fromUserInput(url))
+ onUrlSelected: {
+ navigationPanel.openUrlInNewTab(UrlTools.fromUserInput(url));
+ panelToggle.topSitesButtonSelected = false;
+ }
}

TabsPanel {
@@ -174,7 +180,6 @@ Rectangle {
states: [
State {
name: "favorites"
- PropertyChanges { target: panelToggle; topSitesButtonSelected: true }
PropertyChanges { target: plusButton; opacity: 1 }
PropertyChanges { target: panelToggle; opacity: 1 }
PropertyChanges { target: topSitesPanel; opacity: 1 }
@@ -183,7 +188,6 @@ Rectangle {
},
State {
name: "navigation"
- PropertyChanges { target: panelToggle; topSitesButtonSelected: false }
PropertyChanges { target: plusButton; opacity: 1 }
PropertyChanges { target: panelToggle; opacity: 1 }
PropertyChanges { target: topSitesPanel; opacity: 0 }
@@ -192,7 +196,6 @@ Rectangle {
},
State {
name: "navigationFullScreen"
- PropertyChanges { target: panelToggle; topSitesButtonSelected: false }
PropertyChanges { target: plusButton; opacity: 0 }
PropertyChanges { target: panelToggle; opacity: 0 }
PropertyChanges { target: topSitesPanel; opacity: 0 }
diff --git a/src/mobile/qml/PanelToggle.qml b/src/mobile/qml/PanelToggle.qml
index 64ee23c..eb86068 100644
--- a/src/mobile/qml/PanelToggle.qml
+++ b/src/mobile/qml/PanelToggle.qml
@@ -29,14 +29,13 @@ Image {

onTopSitesEnabledChanged: {
if (!topSitesEnabled) {
- tabs.visible = true;
topsites.visible = false;
+ tabsSelected();
}
}

onNavigationEnabledChanged: {
- if (!navigationEnabled && topSitesEnabled)
- topsites.visible = true;
+ topsites.visible = !navigationEnabled && topSitesEnabled;
}

source: topSitesEnabled && navigationEnabled ? "qrc:///mobile/app/menu_unpressed" : "qrc:///mobile/app/menu_disabled"
@@ -44,12 +43,15 @@ Image {
Image {
id: topsites
source: "qrc:///mobile/app/mysites_pressed"
- onVisibleChanged: visible ? topSitesSelected() : tabsSelected()
+ visible: false
}
MouseArea {
anchors.fill: topsites
visible: topSitesEnabled
- onClicked: topsites.visible = true
+ onClicked: {
+ topsites.visible = true;
+ topSitesSelected();
+ }
}

Image {
@@ -62,7 +64,10 @@ Image {
MouseArea {
anchors.fill: tabs
visible: navigationEnabled || !topSitesEnabled
- onClicked: topsites.visible = false
+ onClicked: {
+ topsites.visible = false
+ tabsSelected();
+ }
}
}

--
1.7.9.5

Luciano Wolf

unread,
Jun 25, 2012, 2:56:25 PM6/25/12
to snowsh...@googlegroups.com
Deprecated.

Rafael Brandao

unread,
Jun 25, 2012, 3:03:35 PM6/25/12
to snowsh...@googlegroups.com
r=me

You could use "topSitesEnabled" here instead, so the logic will be centered to that property.



--
Rafael Brandao @ INdT

Lauro Moura

unread,
Jun 25, 2012, 4:12:10 PM6/25/12
to snowsh...@googlegroups.com
On Mon, Jun 25, 2012 at 3:55 PM, Luciano Wolf
<lucian...@openbossa.org> wrote:
r=me


--
Lauro Moura
INdT - Instituto Nokia de Tecnologia
Reply all
Reply to author
Forward
0 new messages