Reply
Thread Tools
d-iivil's Avatar
Posts: 2,154 | Thanked: 2,186 times | Joined on Dec 2009 @ Hellsinki, Finland
#41
Originally Posted by Diph View Post
Did you try the dialog.exec()? It should block until user closes it.
I did, but the whole point is that user must not close it, I mean I don't want to give user opportunity to close it. Just show him a message that something is being done and all he can do is wait
__________________
If you're rich and you think I deserve a cold beer, you may donate one or two :-P

80's style stadium rock is back - FIRENOTE
Hi-Octane heavy metal - FORCE MAJEURE
 
Posts: 180 | Thanked: 76 times | Joined on May 2010
#42
Code:
progress.setCancelButton(0);
Originally Posted by D-Iivil View Post
Just show him a message that something is being done and all he can do is wait
I would hate this, but maybe the script will mess up something if you don't let it finish?

Last edited by Diph; 2010-07-16 at 19:43.
 
d-iivil's Avatar
Posts: 2,154 | Thanked: 2,186 times | Joined on Dec 2009 @ Hellsinki, Finland
#43
Originally Posted by Diph View Post
Code:
progress.setCancelButton(0);

I would hate this, but maybe the script will mess up something if you don't let it finish?
Yep, it will lead to broken theme and I have no idea how Hildon will handle it if there's some partly copied broken png -file in theme's folder :P

dialog.exec() won't work because the script isn't ran in the background. It's launched only after user closes the dialog :-/
__________________
If you're rich and you think I deserve a cold beer, you may donate one or two :-P

80's style stadium rock is back - FIRENOTE
Hi-Octane heavy metal - FORCE MAJEURE
 

The Following User Says Thank You to d-iivil For This Useful Post:
d-iivil's Avatar
Posts: 2,154 | Thanked: 2,186 times | Joined on Dec 2009 @ Hellsinki, Finland
#44
Now I got it

I didn't realize I had to separately create also QProgressBar, the QProgressDialog wasn't enough all by itself :-P

Edit: no, I didn't get it. Still not seeing a progress bar in the dialog :-(
__________________
If you're rich and you think I deserve a cold beer, you may donate one or two :-P

80's style stadium rock is back - FIRENOTE
Hi-Octane heavy metal - FORCE MAJEURE

Last edited by d-iivil; 2010-07-16 at 20:20.
 
Nathraiben's Avatar
Posts: 267 | Thanked: 408 times | Joined on May 2010 @ Austria
#45
Originally Posted by Venemo View Post
The easiest way:

In Qt Creator's UI designer, right-click a widget, click "Go to slot...", select a slot (eg. clicked() for a button), and it generates what you need where it needs to be.
Shiny!
Finding out the hard way was good for getting the hang of how it works, but knowing that there's a hasslefree way to do it made my day...

Thanks a lot, Venemo!

Originally Posted by D-Iivil View Post
I did, but the whole point is that user must not close it, I mean I don't want to give user opportunity to close it. Just show him a message that something is being done and all he can do is wait
From a user's point of view, I'd advise against unclosable progress bars.

In maemo, that thing will completely take away the ability to close that application, so in case anything goes wrong with either your C++ code or your shell script, the user is stuck with an unclosable application until they either reboot or manage to issue a successful kill command (which, btw, didn't work for me - the application was completely locked).

Instead, issue a warning in your progress bar that this might take a couple of minutes and should not be canceled. Warn the user, but don't take away control over their own system.
 

The Following User Says Thank You to Nathraiben For This Useful Post:
Posts: 726 | Thanked: 345 times | Joined on Apr 2010 @ Sweden
#46
Originally Posted by Nathraiben View Post
the user is stuck with an unclosable application until they either reboot or manage to issue a successful kill command
Can't you press the power button and pick "End current task"?
 

The Following User Says Thank You to Joorin For This Useful Post:
Nathraiben's Avatar
Posts: 267 | Thanked: 408 times | Joined on May 2010 @ Austria
#47
Originally Posted by Joorin View Post
Can't you press the power button and pick "End current task"?
It didn't give me the option - I don't know the inner workings of the OS enough to do more than speculate, but so far from looking at when I get the option and when not, it seems like it only shows when there's a close button showing on top of the screen - which isn't the case when a progress bar takes over.
 
d-iivil's Avatar
Posts: 2,154 | Thanked: 2,186 times | Joined on Dec 2009 @ Hellsinki, Finland
#48
Originally Posted by Nathraiben View Post
Instead, issue a warning in your progress bar that this might take a couple of minutes and should not be canceled. Warn the user, but don't take away control over their own system.
Yeah... you're right about that. Well, I guess I first need to figure out how to bring the cancell -button and progress bar visible in the first place :-D

With code like this:
Code:
void MainWindow::on_pushButton_clicked()
{
        QString varattu;
        varattu = "Setting up the theme, please wait.";
        QProgressDialog progress;
        progress.setWindowModality(Qt::WindowModal);
        progress.setWindowTitle(varattu);
        progress.show();
        progress.setValue(0);
        QStringList arguments;
        arguments << ui->Transition->currentText() << ui->Font->currentText() << ui->Color->currentText() << ui->Activate->currentText();
        QProcess::execute("/sbin/launchblack", arguments);
        progress.setValue(1);

}
It works as it's supposed to work (the script is being ran at the background), but user cannot cancell nor the progress bar is shown...
Attached Images
 
__________________
If you're rich and you think I deserve a cold beer, you may donate one or two :-P

80's style stadium rock is back - FIRENOTE
Hi-Octane heavy metal - FORCE MAJEURE
 
Nathraiben's Avatar
Posts: 267 | Thanked: 408 times | Joined on May 2010 @ Austria
#49
Not sure whether they work the same in PyQt and Qt, but I had to set the value to something > 0 in order for the bar to show, since 0% more or less indicates that you didn't yet start.

With my rather short waiting times I simply set it to 50%, as I didn't really need a true progress bar but just an indication that the user will have to wait for for a short while.

With a script running for that long, a working progress bar would be rather helpful, though. Normally, you would just increment the value each time a part of your script is finished, but with just one large script I guess that would be hard.

Is there a way to split the script into smaller portions, so after each successful execute you can increment the value? Then, just set the value to 1% right before the first execute and the bar SHOULD show.
 
d-iivil's Avatar
Posts: 2,154 | Thanked: 2,186 times | Joined on Dec 2009 @ Hellsinki, Finland
#50
Originally Posted by Nathraiben View Post
Not sure whether they work the same in PyQt and Qt, but I had to set the value to something > 0 in order for the bar to show, since 0% more or less indicates that you didn't yet start.

With my rather short waiting times I simply set it to 50%, as I didn't really need a true progress bar but just an indication that the user will have to wait for for a short while.

With a script running for that long, a working progress bar would be rather helpful, though. Normally, you would just increment the value each time a part of your script is finished, but with just one large script I guess that would be hard.

Is there a way to split the script into smaller portions, so after each successful execute you can increment the value? Then, just set the value to 1% right before the first execute and the bar SHOULD show.
Did't work :/ No bar, no cancell-button.

But while I coulnd't figure out the bar -issue I optimized the script instead (which I should have done already...) and now it's taking only like 30 secs to complete and user is informed what's happening by notifications sent via DBUS.
__________________
If you're rich and you think I deserve a cold beer, you may donate one or two :-P

80's style stadium rock is back - FIRENOTE
Hi-Octane heavy metal - FORCE MAJEURE
 
Reply


 
Forum Jump


All times are GMT. The time now is 02:05.