PDA

View Full Version : shutdown the system with progress bar



baobui
17th May 2011, 06:03
Hi, I am writing a Qt Application for embedded device. In this application I want to implement a "shutdown" button. The OS is linux. How can I make the system shutdown and show the shutdown process on a progress bar. And how can I display a message: "It's now safe to turn off" after the system shutdown?

Thank you very much

ChrisW67
17th May 2011, 08:01
You can start a shutdown with all sorts of commands as root, for example any of:


shutdown -h now
telinit 0
halt
Which suits your system depends on your system. QProcess can help here, but that's where involvement of Qt ends. Once started, the shutdown is entirely outside of your application's control; orchestrated by init running through whatever is scheduled in the inittab. You can use the shutdown scripts (once again system dependent) to do some fancy display stuff at a low level, but that has nothing to do with your application. Your Qt application will be terminated at some indeterminate point in the shutdown (probably early) so you cannot use it to display useful "I'm finished" message.