Re: [SailfishDevel] A welcome dialog and pageStack's operation in progress.

2014-07-17 Thread Marcin M.
I did a maybe less dirty workaround yesterday:

function openWelcomeDialog()
{
console.log("working!")
if (status == PageStatus.Active)
{
mainPage.statusChanged.disconnect(openWelcomeDialog)
var component = Qt.createComponent("WelcomeDialog.qml")
var popup = component.createObject(mainPage)
popup.open()
}
}

Component.onCompleted: mainPage.statusChanged.connect(openWelcomeDialog)

This way The check will be done only 4 times in my case and not each time
something happens with the Page.
Note, that queuing would be a great idea. In my case the busy check was
false (pageStack wasn't busy) but a while after it was and Dialog couldn't
be pushed.

--
Marcin


2014-07-17 0:50 GMT+02:00 Matthew Vogt :

> Yes, fair point.
>
> IIRC, we decided there weren't enough motivating examples to make it worth
> adding action-queueing behaviour to the PageStack.  If people keep hitting
> this problem, though, it could be worth revisiting.
>
> That said, working around the problem is usually simple, and making the
> PageStack support more complicated API patterns could lead users to get
> themselves into deeper trouble, that's harder to diagnose and fix :-)
>
> Matt
> 
> From: devel-boun...@lists.sailfishos.org [
> devel-boun...@lists.sailfishos.org] on behalf of J-P Nurmi [
> jpnu...@gmail.com]
> Sent: Thursday, July 17, 2014 7:45 AM
> To: Sailfish OS Developers
> Subject: Re: [SailfishDevel] A welcome dialog and pageStack's operation in
>  progress.
>
> On Wed, Jul 16, 2014 at 11:25 PM, Matthew Vogt 
> wrote:
> >
> > Hi, 'Page.status' is the correct property to watch for avoiding this
> problem.
> >
> > Here is an example of what you could do:
> >
> > import QtQuick 2.0
> > import Sailfish.Silica 1.0
> >
> > ApplicationWindow {
> >
> > initialPage: Component {
> > Page {
> > anchors.fill: parent
> >
> > Label {
> > anchors.centerIn: parent
> > text: 'Main page'
> > }
> >
> > property bool showSplash: true
> > onStatusChanged: {
> > if (status == PageStatus.Active &&
> showSplash) {
> > showSplash = false
> > pageStack.push(splashPage)
> > }
> > }
> > }
> > }
> >
> > Component {
> > id: splashPage
> >
> > Page {
> > Label {
> > anchors.centerIn: parent
> > text: 'Splash page'
> > }
> > }
> > }
> > }
> >
> > Thanks,
> > Matt
>
>
> Hi Matt,
>
> Notice that essentially the same problem occurs when a dialog/page is
> triggered by an external event. User navigates the UI meanwhile eg. a
> network event triggers a dialog => PageStack is busy so it just bails
> out and user misses the dialog. As a workaround, waiting until
> PageStack is no longer busy gets pretty ugly.
>
> --
> J-P Nurmi
> ___
> SailfishOS.org Devel mailing list
> To unsubscribe, please send a mail to
> devel-unsubscr...@lists.sailfishos.org
> ___
> SailfishOS.org Devel mailing list
> To unsubscribe, please send a mail to
> devel-unsubscr...@lists.sailfishos.org
>
___
SailfishOS.org Devel mailing list
To unsubscribe, please send a mail to devel-unsubscr...@lists.sailfishos.org

Re: [SailfishDevel] A welcome dialog and pageStack's operation in progress.

2014-07-16 Thread Matthew Vogt
Yes, fair point.

IIRC, we decided there weren't enough motivating examples to make it worth 
adding action-queueing behaviour to the PageStack.  If people keep hitting this 
problem, though, it could be worth revisiting.

That said, working around the problem is usually simple, and making the 
PageStack support more complicated API patterns could lead users to get 
themselves into deeper trouble, that's harder to diagnose and fix :-)

Matt

From: devel-boun...@lists.sailfishos.org [devel-boun...@lists.sailfishos.org] 
on behalf of J-P Nurmi [jpnu...@gmail.com]
Sent: Thursday, July 17, 2014 7:45 AM
To: Sailfish OS Developers
Subject: Re: [SailfishDevel] A welcome dialog and pageStack's operation in  
progress.

On Wed, Jul 16, 2014 at 11:25 PM, Matthew Vogt  wrote:
>
> Hi, 'Page.status' is the correct property to watch for avoiding this problem.
>
> Here is an example of what you could do:
>
> import QtQuick 2.0
> import Sailfish.Silica 1.0
>
> ApplicationWindow {
>
> initialPage: Component {
> Page {
> anchors.fill: parent
>
> Label {
> anchors.centerIn: parent
> text: 'Main page'
> }
>
> property bool showSplash: true
> onStatusChanged: {
> if (status == PageStatus.Active && 
> showSplash) {
> showSplash = false
> pageStack.push(splashPage)
> }
> }
> }
> }
>
> Component {
> id: splashPage
>
> Page {
> Label {
> anchors.centerIn: parent
> text: 'Splash page'
> }
> }
> }
> }
>
> Thanks,
> Matt


Hi Matt,

Notice that essentially the same problem occurs when a dialog/page is
triggered by an external event. User navigates the UI meanwhile eg. a
network event triggers a dialog => PageStack is busy so it just bails
out and user misses the dialog. As a workaround, waiting until
PageStack is no longer busy gets pretty ugly.

--
J-P Nurmi
___
SailfishOS.org Devel mailing list
To unsubscribe, please send a mail to devel-unsubscr...@lists.sailfishos.org
___
SailfishOS.org Devel mailing list
To unsubscribe, please send a mail to devel-unsubscr...@lists.sailfishos.org


Re: [SailfishDevel] A welcome dialog and pageStack's operation in progress.

2014-07-16 Thread J-P Nurmi
On Wed, Jul 16, 2014 at 11:25 PM, Matthew Vogt  wrote:
>
> Hi, 'Page.status' is the correct property to watch for avoiding this problem.
>
> Here is an example of what you could do:
>
> import QtQuick 2.0
> import Sailfish.Silica 1.0
>
> ApplicationWindow {
>
> initialPage: Component {
> Page {
> anchors.fill: parent
>
> Label {
> anchors.centerIn: parent
> text: 'Main page'
> }
>
> property bool showSplash: true
> onStatusChanged: {
> if (status == PageStatus.Active && 
> showSplash) {
> showSplash = false
> pageStack.push(splashPage)
> }
> }
> }
> }
>
> Component {
> id: splashPage
>
> Page {
> Label {
> anchors.centerIn: parent
> text: 'Splash page'
> }
> }
> }
> }
>
> Thanks,
> Matt


Hi Matt,

Notice that essentially the same problem occurs when a dialog/page is
triggered by an external event. User navigates the UI meanwhile eg. a
network event triggers a dialog => PageStack is busy so it just bails
out and user misses the dialog. As a workaround, waiting until
PageStack is no longer busy gets pretty ugly.

--
J-P Nurmi
___
SailfishOS.org Devel mailing list
To unsubscribe, please send a mail to devel-unsubscr...@lists.sailfishos.org


Re: [SailfishDevel] A welcome dialog and pageStack's operation in progress.

2014-07-16 Thread Matthew Vogt
Hi, 'Page.status' is the correct property to watch for avoiding this problem.

Here is an example of what you could do:

import QtQuick 2.0
import Sailfish.Silica 1.0

ApplicationWindow {

initialPage: Component {
Page {
anchors.fill: parent

Label {
anchors.centerIn: parent
text: 'Main page'
}

property bool showSplash: true
onStatusChanged: {
if (status == PageStatus.Active && showSplash) {
showSplash = false
pageStack.push(splashPage)
}
}
}
}

Component {
id: splashPage

Page {
Label {
anchors.centerIn: parent
text: 'Splash page'
}
}
}
}

Thanks,
Matt


From: devel-boun...@lists.sailfishos.org [devel-boun...@lists.sailfishos.org] 
on behalf of Andrey Kozhevnikov [coderusin...@gmail.com]
Sent: Wednesday, July 16, 2014 7:01 PM
To: devel@lists.sailfishos.org
Subject: Re: [SailfishDevel] A welcome dialog and pageStack's operation in 
progress.

do not use onCompleted in this case. use status == PageStatus.Active instead

16.07.2014 14:58, Marcin M. пишет:
I'd like to open a welcome dialog at startup which can be disabled by a user.

Page
{
id: mainPage
function openWelcomeDialog()
{
var component = Qt.createComponent("WelcomeDialog.qml")
var popup = component.createObject(mainPage)
popup.open()
}

Component.onCompleted: openWelcomeDialog()
// ...
}

In fact

[W] unknown:90 - file:///usr/lib/qt5/qml/Sailfish/Silica/PageStack.js:90: 
Error: Cannot push while operation is in progress: push

happens.


What's done wrong?

--
Marcin



___
SailfishOS.org Devel mailing list
To unsubscribe, please send a mail to 
devel-unsubscr...@lists.sailfishos.org<mailto:devel-unsubscr...@lists.sailfishos.org>

___
SailfishOS.org Devel mailing list
To unsubscribe, please send a mail to devel-unsubscr...@lists.sailfishos.org

Re: [SailfishDevel] A welcome dialog and pageStack's operation in progress.

2014-07-16 Thread Dmitriy Purgin
Sorry Marcin, misread the name :)

2014-07-16 18:55 GMT+06:00 Dmitriy Purgin :
> Hi Martin,
>
> I had the same issue while dealing with a similar problem where start
> page was showing BusyIndicator while the application is loading. What
> I did is connected to Component.onCompleted in ApplicationWindow,
> start the initialization procedure and replace the page after
> initialization is done:
>
> // main.qml
>
> ApplicationWindow
> {
> Component.onCompleted: {
> pageStack.push(Qt.resolvedUrl("pages/Loader.qml"))
> myApp.initialize(); // call of an exposed C++ method
> }
> }
>
> // Loader.qml:
>
> Page {
> BusyIndicator {
> running: myApp.initializing // Q_PROPERTY exposed in C++ class
> }
> onRunningChanged: {
> if (!running)
> pageStack.replace(Qt.resolvedUrl("FirstPage.qml"))
> }
> }
>
> I think you can add both of your pages in Component.onCompleted() of
> the ApplicationWindow and switch between them in runtime.
>
> Cheers
>
> 2014-07-16 18:45 GMT+06:00 Marcin M. :
>> Take back what I said. The workaround doesn't work. :P
>>
>> --
>> Marcin
>>
>>
>> 2014-07-16 14:42 GMT+02:00 Marcin M. :
>>
>>> This way the dialog opens after closing the dialog. Worked it around by
>>>
>>>
>>> Component.onCompleted:
>>> {
>>> while (status != PageStatus.Active) {}
>>> openWelcomeDialog()
>>> }
>>>
>>> --
>>> Marcin
>>>
>>>
>>> 2014-07-16 11:01 GMT+02:00 Andrey Kozhevnikov :
>>>
 do not use onCompleted in this case. use status == PageStatus.Active
 instead

 16.07.2014 14:58, Marcin M. пишет:

 I'd like to open a welcome dialog at startup which can be disabled by a
 user.

 Page
 {
 id: mainPage
 function openWelcomeDialog()
 {
 var component = Qt.createComponent("WelcomeDialog.qml")
 var popup = component.createObject(mainPage)
 popup.open()
 }

 Component.onCompleted: openWelcomeDialog()
 // ...
 }

 In fact

 [W] unknown:90 - file:///usr/lib/qt5/qml/Sailfish/Silica/PageStack.js:90:
 Error: Cannot push while operation is in progress: push

 happens.


 What's done wrong?

 --
 Marcin


 ___
 SailfishOS.org Devel mailing list
 To unsubscribe, please send a mail to
 devel-unsubscr...@lists.sailfishos.org



 ___
 SailfishOS.org Devel mailing list
 To unsubscribe, please send a mail to
 devel-unsubscr...@lists.sailfishos.org
>>>
>>>
>>
>>
>> ___
>> SailfishOS.org Devel mailing list
>> To unsubscribe, please send a mail to devel-unsubscr...@lists.sailfishos.org
___
SailfishOS.org Devel mailing list
To unsubscribe, please send a mail to devel-unsubscr...@lists.sailfishos.org

Re: [SailfishDevel] A welcome dialog and pageStack's operation in progress.

2014-07-16 Thread Dmitriy Purgin
Hi Martin,

I had the same issue while dealing with a similar problem where start
page was showing BusyIndicator while the application is loading. What
I did is connected to Component.onCompleted in ApplicationWindow,
start the initialization procedure and replace the page after
initialization is done:

// main.qml

ApplicationWindow
{
Component.onCompleted: {
pageStack.push(Qt.resolvedUrl("pages/Loader.qml"))
myApp.initialize(); // call of an exposed C++ method
}
}

// Loader.qml:

Page {
BusyIndicator {
running: myApp.initializing // Q_PROPERTY exposed in C++ class
}
onRunningChanged: {
if (!running)
pageStack.replace(Qt.resolvedUrl("FirstPage.qml"))
}
}

I think you can add both of your pages in Component.onCompleted() of
the ApplicationWindow and switch between them in runtime.

Cheers

2014-07-16 18:45 GMT+06:00 Marcin M. :
> Take back what I said. The workaround doesn't work. :P
>
> --
> Marcin
>
>
> 2014-07-16 14:42 GMT+02:00 Marcin M. :
>
>> This way the dialog opens after closing the dialog. Worked it around by
>>
>>
>> Component.onCompleted:
>> {
>> while (status != PageStatus.Active) {}
>> openWelcomeDialog()
>> }
>>
>> --
>> Marcin
>>
>>
>> 2014-07-16 11:01 GMT+02:00 Andrey Kozhevnikov :
>>
>>> do not use onCompleted in this case. use status == PageStatus.Active
>>> instead
>>>
>>> 16.07.2014 14:58, Marcin M. пишет:
>>>
>>> I'd like to open a welcome dialog at startup which can be disabled by a
>>> user.
>>>
>>> Page
>>> {
>>> id: mainPage
>>> function openWelcomeDialog()
>>> {
>>> var component = Qt.createComponent("WelcomeDialog.qml")
>>> var popup = component.createObject(mainPage)
>>> popup.open()
>>> }
>>>
>>> Component.onCompleted: openWelcomeDialog()
>>> // ...
>>> }
>>>
>>> In fact
>>>
>>> [W] unknown:90 - file:///usr/lib/qt5/qml/Sailfish/Silica/PageStack.js:90:
>>> Error: Cannot push while operation is in progress: push
>>>
>>> happens.
>>>
>>>
>>> What's done wrong?
>>>
>>> --
>>> Marcin
>>>
>>>
>>> ___
>>> SailfishOS.org Devel mailing list
>>> To unsubscribe, please send a mail to
>>> devel-unsubscr...@lists.sailfishos.org
>>>
>>>
>>>
>>> ___
>>> SailfishOS.org Devel mailing list
>>> To unsubscribe, please send a mail to
>>> devel-unsubscr...@lists.sailfishos.org
>>
>>
>
>
> ___
> SailfishOS.org Devel mailing list
> To unsubscribe, please send a mail to devel-unsubscr...@lists.sailfishos.org
___
SailfishOS.org Devel mailing list
To unsubscribe, please send a mail to devel-unsubscr...@lists.sailfishos.org

Re: [SailfishDevel] A welcome dialog and pageStack's operation in progress.

2014-07-16 Thread Andrey Kozhevnikov
In this case you'd better connect to pageStack.busyChanged :) and wait 
while pageStack.busy


16.07.2014 18:42, Marcin M. ?:

This way the dialog opens after closing the dialog. Worked it around by


Component.onCompleted:
{
while (status != PageStatus.Active) {}
openWelcomeDialog()
}

--
Marcin


2014-07-16 11:01 GMT+02:00 Andrey Kozhevnikov >:


do not use onCompleted in this case. use status ==
PageStatus.Active instead

16.07.2014 14:58, Marcin M. ?:

I'd like to open a welcome dialog at startup which can be
disabled by a user.

Page
{
id: mainPage
function openWelcomeDialog()
{
var component = Qt.createComponent("WelcomeDialog.qml")
var popup = component.createObject(mainPage)
popup.open()
}

Component.onCompleted: openWelcomeDialog()
// ...
}

In fact

[W] unknown:90 -
file:///usr/lib/qt5/qml/Sailfish/Silica/PageStack.js:90: Error:
Cannot push while operation is in progress: push

happens.


What's done wrong?

--
Marcin


___
SailfishOS.org Devel mailing list
To unsubscribe, please send a mail todevel-unsubscr...@lists.sailfishos.org  




___
SailfishOS.org Devel mailing list
To unsubscribe, please send a mail to
devel-unsubscr...@lists.sailfishos.org





___
SailfishOS.org Devel mailing list
To unsubscribe, please send a mail to devel-unsubscr...@lists.sailfishos.org


___
SailfishOS.org Devel mailing list
To unsubscribe, please send a mail to devel-unsubscr...@lists.sailfishos.org

Re: [SailfishDevel] A welcome dialog and pageStack's operation in progress.

2014-07-16 Thread Marcin M.
Take back what I said. The workaround doesn't work. :P

--
Marcin


2014-07-16 14:42 GMT+02:00 Marcin M. :

> This way the dialog opens after closing the dialog. Worked it around by
>
>
> Component.onCompleted:
> {
> while (status != PageStatus.Active) {}
> openWelcomeDialog()
> }
>
> --
> Marcin
>
>
> 2014-07-16 11:01 GMT+02:00 Andrey Kozhevnikov :
>
>  do not use onCompleted in this case. use status == PageStatus.Active
>> instead
>>
>> 16.07.2014 14:58, Marcin M. пишет:
>>
>>  I'd like to open a welcome dialog at startup which can be disabled by a
>> user.
>>
>> Page
>> {
>>  id: mainPage
>> function openWelcomeDialog()
>> {
>> var component = Qt.createComponent("WelcomeDialog.qml")
>> var popup = component.createObject(mainPage)
>> popup.open()
>> }
>>
>> Component.onCompleted: openWelcomeDialog()
>> // ...
>> }
>>
>>  In fact
>>
>> [W] unknown:90 - file:///usr/lib/qt5/qml/Sailfish/Silica/PageStack.js:90:
>> Error: Cannot push while operation is in progress: push
>>
>> happens.
>>
>>
>>  What's done wrong?
>>--
>> Marcin
>>
>>
>> ___
>> SailfishOS.org Devel mailing list
>> To unsubscribe, please send a mail to devel-unsubscr...@lists.sailfishos.org
>>
>>
>>
>> ___
>> SailfishOS.org Devel mailing list
>> To unsubscribe, please send a mail to
>> devel-unsubscr...@lists.sailfishos.org
>>
>
>
___
SailfishOS.org Devel mailing list
To unsubscribe, please send a mail to devel-unsubscr...@lists.sailfishos.org

Re: [SailfishDevel] A welcome dialog and pageStack's operation in progress.

2014-07-16 Thread Marcin M.
This way the dialog opens after closing the dialog. Worked it around by


Component.onCompleted:
{
while (status != PageStatus.Active) {}
openWelcomeDialog()
}

--
Marcin


2014-07-16 11:01 GMT+02:00 Andrey Kozhevnikov :

>  do not use onCompleted in this case. use status == PageStatus.Active
> instead
>
> 16.07.2014 14:58, Marcin M. пишет:
>
>  I'd like to open a welcome dialog at startup which can be disabled by a
> user.
>
> Page
> {
>  id: mainPage
> function openWelcomeDialog()
> {
> var component = Qt.createComponent("WelcomeDialog.qml")
> var popup = component.createObject(mainPage)
> popup.open()
> }
>
> Component.onCompleted: openWelcomeDialog()
> // ...
> }
>
>  In fact
>
> [W] unknown:90 - file:///usr/lib/qt5/qml/Sailfish/Silica/PageStack.js:90:
> Error: Cannot push while operation is in progress: push
>
> happens.
>
>
>  What's done wrong?
>--
> Marcin
>
>
> ___
> SailfishOS.org Devel mailing list
> To unsubscribe, please send a mail to devel-unsubscr...@lists.sailfishos.org
>
>
>
> ___
> SailfishOS.org Devel mailing list
> To unsubscribe, please send a mail to
> devel-unsubscr...@lists.sailfishos.org
>
___
SailfishOS.org Devel mailing list
To unsubscribe, please send a mail to devel-unsubscr...@lists.sailfishos.org

Re: [SailfishDevel] A welcome dialog and pageStack's operation in progress.

2014-07-16 Thread Andrey Kozhevnikov

do not use onCompleted in this case. use status == PageStatus.Active instead

16.07.2014 14:58, Marcin M. ?:
I'd like to open a welcome dialog at startup which can be disabled by 
a user.


Page
{
id: mainPage
function openWelcomeDialog()
{
var component = Qt.createComponent("WelcomeDialog.qml")
var popup = component.createObject(mainPage)
popup.open()
}

Component.onCompleted: openWelcomeDialog()
// ...
}

In fact

[W] unknown:90 - 
file:///usr/lib/qt5/qml/Sailfish/Silica/PageStack.js:90: Error: Cannot 
push while operation is in progress: push


happens.


What's done wrong?

--
Marcin


___
SailfishOS.org Devel mailing list
To unsubscribe, please send a mail to devel-unsubscr...@lists.sailfishos.org


___
SailfishOS.org Devel mailing list
To unsubscribe, please send a mail to devel-unsubscr...@lists.sailfishos.org

[SailfishDevel] A welcome dialog and pageStack's operation in progress.

2014-07-16 Thread Marcin M.
I'd like to open a welcome dialog at startup which can be disabled by a
user.

Page
{
id: mainPage
function openWelcomeDialog()
{
var component = Qt.createComponent("WelcomeDialog.qml")
var popup = component.createObject(mainPage)
popup.open()
}

Component.onCompleted: openWelcomeDialog()
// ...
}

In fact

[W] unknown:90 - file:///usr/lib/qt5/qml/Sailfish/Silica/PageStack.js:90:
Error: Cannot push while operation is in progress: push

happens.


What's done wrong?
--
Marcin
___
SailfishOS.org Devel mailing list
To unsubscribe, please send a mail to devel-unsubscr...@lists.sailfishos.org