-rw-r--r-- | core/launcher/shutdownimpl.cpp | 191 | ||||
-rw-r--r-- | core/launcher/shutdownimpl.h | 26 |
2 files changed, 109 insertions, 108 deletions
diff --git a/core/launcher/shutdownimpl.cpp b/core/launcher/shutdownimpl.cpp index 0c5b4f6..b1925d9 100644 --- a/core/launcher/shutdownimpl.cpp +++ b/core/launcher/shutdownimpl.cpp @@ -36,8 +36,8 @@ static void changeButtonColor ( QPushButton *btn, const QColor &col ) QPalette pal = btn-> palette ( ); - - pal. setColor ( QPalette::Active, QColorGroup::Button, col ); + + pal. setColor ( QPalette::Active, QColorGroup::Button, col ); pal. setColor ( QPalette::Disabled, QColorGroup::Button, col ); pal. setColor ( QPalette::Inactive, QColorGroup::Button, col ); - - btn-> setPalette ( pal ); + + btn-> setPalette ( pal ); } @@ -46,75 +46,76 @@ static void changeButtonColor ( QPushButton *btn, const QColor &col ) ShutdownImpl::ShutdownImpl( QWidget* parent, const char *name, WFlags fl ) - : QWidget ( parent, name, fl ) + : QWidget ( parent, name, fl ) { - setCaption ( tr( "Shut down..." )); + setCaption ( tr( "Shut down..." ) ); - QVBoxLayout *vbox = new QVBoxLayout ( this ); - vbox-> setSpacing ( 3 ); - vbox-> setMargin ( 6 ); + QVBoxLayout *vbox = new QVBoxLayout ( this ); + vbox-> setSpacing ( 3 ); + vbox-> setMargin ( 6 ); QButtonGroup *btngrp = new QButtonGroup ( this ); - - btngrp-> setTitle ( tr( "Terminate" )); - btngrp-> setColumnLayout ( 0, Qt::Vertical ); - btngrp-> layout ( )-> setSpacing ( 0 ); - btngrp-> layout ( )-> setMargin ( 0 ); - - QGridLayout *grid = new QGridLayout ( btngrp-> layout ( )); - grid-> setAlignment ( Qt::AlignTop ); - grid-> setSpacing ( 3 ); - grid-> setMargin ( 7 ); - - QPushButton *quit = new QPushButton ( tr( "Terminate Opie" ), btngrp, "quit" ); - changeButtonColor ( quit, QColor ( 236, 236, 179 )); - btngrp-> insert ( quit, 4 ); - grid-> addWidget ( quit, 1, 1 ); - - QPushButton *reboot = new QPushButton ( tr( "Reboot" ), btngrp, "reboot" ); - changeButtonColor ( reboot, QColor( 236, 183, 181 )); - btngrp-> insert ( reboot, 2 ); - grid-> addWidget( reboot, 1, 0 ); - - QPushButton *restart = new QPushButton ( tr( "Restart Opie" ), btngrp, "restart" ); - changeButtonColor ( restart, QColor( 236, 236, 179 )); + + btngrp-> setTitle ( tr( "Terminate" ) ); + btngrp-> setColumnLayout ( 0, Qt::Vertical ); + btngrp-> layout ( ) -> setSpacing ( 0 ); + btngrp-> layout ( ) -> setMargin ( 0 ); + + QGridLayout *grid = new QGridLayout ( btngrp-> layout ( ) ); + grid-> setAlignment ( Qt::AlignTop ); + grid-> setSpacing ( 3 ); + grid-> setMargin ( 7 ); + + QPushButton *quit = new QPushButton ( tr( "Terminate Opie" ), btngrp, "quit" ); + changeButtonColor ( quit, QColor ( 236, 236, 179 ) ); + btngrp-> insert ( quit, 4 ); + grid-> addWidget ( quit, 1, 1 ); + + QPushButton *reboot = new QPushButton ( tr( "Reboot" ), btngrp, "reboot" ); + changeButtonColor ( reboot, QColor( 236, 183, 181 ) ); + btngrp-> insert ( reboot, 2 ); + grid-> addWidget( reboot, 1, 0 ); + + QPushButton *restart = new QPushButton ( tr( "Restart Opie" ), btngrp, "restart" ); + changeButtonColor ( restart, QColor( 236, 236, 179 ) ); btngrp-> insert ( restart, 3 ); - grid-> addWidget ( restart, 0, 1 ); + grid-> addWidget ( restart, 0, 1 ); - QPushButton *shutdown = new QPushButton( tr( "Shutdown" ), btngrp, "shutdown" ); - changeButtonColor ( shutdown, QColor( 236, 183, 181 )); + QPushButton *shutdown = new QPushButton( tr( "Shutdown" ), btngrp, "shutdown" ); + changeButtonColor ( shutdown, QColor( 236, 183, 181 ) ); btngrp-> insert ( shutdown, 1 ); - grid-> addWidget ( shutdown, 0, 0 ); - - vbox-> addWidget ( btngrp ); - - m_info = new QLabel ( this, "info" ); - m_info-> setText( tr( "<p>\n" "These termination options are provided primarily for use while developing and testing the Opie system. In a normal environment, these concepts are unnecessary." ) ); - vbox-> addWidget ( m_info ); - - m_progress = new QProgressBar ( this, "progressBar" ); - m_progress-> setFrameShape ( QProgressBar::Panel ); - m_progress-> setFrameShadow ( QProgressBar::Sunken ); - m_progress-> setTotalSteps ( 20 ); - m_progress-> setIndicatorFollowsStyle ( false ); - vbox-> addWidget ( m_progress ); - - vbox-> addItem ( new QSpacerItem ( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding )); - - QPushButton *cancel = new QPushButton ( tr( "Cancel" ), this, "cancel" ); - changeButtonColor ( cancel, QColor( 181, 222, 178 )); - cancel-> setDefault ( true ); - cancel-> setSizePolicy ( QSizePolicy ( QSizePolicy::Minimum, QSizePolicy::Expanding, cancel-> sizePolicy ( ). hasHeightForWidth ( ))); - vbox-> addWidget ( cancel ); - - m_timer = new QTimer ( this ); - connect ( m_timer, SIGNAL( timeout ( )), this, SLOT( timeout ( ))); - - connect ( btngrp, SIGNAL( clicked ( int )), this, SLOT( buttonClicked ( int ))); - connect ( cancel, SIGNAL( clicked ( )), this, SLOT( cancelClicked ( ))); - - m_progress-> hide ( ); - Global::hideInputMethod ( ); + grid-> addWidget ( shutdown, 0, 0 ); + + vbox-> addWidget ( btngrp ); + + m_info = new QLabel ( this, "info" ); + m_info-> setText( tr( "<p>\n" "These termination options are provided primarily for use while developing and testing the Opie system. In a normal environment, these concepts are unnecessary." ) ); + vbox-> addWidget ( m_info ); + + m_progress = new QProgressBar ( this, "progressBar" ); + m_progress-> setFrameShape ( QProgressBar::Panel ); + m_progress-> setFrameShadow ( QProgressBar::Sunken ); + m_progress-> setTotalSteps ( 20 ); + m_progress-> setIndicatorFollowsStyle ( false ); + vbox-> addWidget ( m_progress ); + + vbox-> addItem ( new QSpacerItem ( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ) ); + + QPushButton *cancel = new QPushButton ( tr( "Cancel" ), this, "cancel" ); + changeButtonColor ( cancel, QColor( 181, 222, 178 ) ); + cancel-> setDefault ( true ); + cancel-> setSizePolicy ( QSizePolicy ( QSizePolicy::Minimum, QSizePolicy::Expanding, cancel-> sizePolicy ( ). hasHeightForWidth ( ) ) ); + vbox-> addWidget ( cancel ); + + m_timer = new QTimer ( this ); + connect ( m_timer, SIGNAL( timeout ( ) ), this, SLOT( timeout ( ) ) ); + + connect ( btngrp, SIGNAL( clicked ( int ) ), this, SLOT( buttonClicked ( int ) ) ); + connect ( cancel, SIGNAL( clicked ( ) ), this, SLOT( cancelClicked ( ) ) ); + + m_progress-> hide ( ); + Global::hideInputMethod ( ); #ifdef QT_QWS_CUSTOM - shutdown-> hide ( ); -#endif + + shutdown-> hide ( ); +#endif } @@ -123,22 +124,22 @@ void ShutdownImpl::buttonClicked ( int b ) { - m_counter = 0; - - switch ( b ) { - case 1: - m_operation = ShutdownSystem; - break; - case 2: - m_operation = RebootSystem; - break; - case 3: - m_operation = RestartDesktop; - break; - case 4: - m_operation = TerminateDesktop; - break; - } - m_info-> hide ( ); - m_progress-> show ( ); - m_timer-> start ( 300 ); - timeout ( ); + m_counter = 0; + + switch ( b ) { + case 1: + m_operation = ShutdownSystem; + break; + case 2: + m_operation = RebootSystem; + break; + case 3: + m_operation = RestartDesktop; + break; + case 4: + m_operation = TerminateDesktop; + break; + } + m_info-> hide ( ); + m_progress-> show ( ); + m_timer-> start ( 300 ); + timeout ( ); } @@ -147,7 +148,7 @@ void ShutdownImpl::cancelClicked ( ) { - m_progress-> hide ( ); - m_info-> show ( ); - if ( m_timer-> isActive ( )) + m_progress-> hide ( ); + m_info-> show ( ); + if ( m_timer-> isActive ( ) ) m_timer-> stop ( ); - else + else close ( ); @@ -157,3 +158,3 @@ void ShutdownImpl::timeout ( ) { - if (( m_counter += 2 ) > m_progress-> totalSteps ( )) { + if ( ( m_counter += 2 ) > m_progress-> totalSteps ( ) ) { m_progress-> hide ( ); @@ -161,4 +162,4 @@ void ShutdownImpl::timeout ( ) emit shutdown ( m_operation ); - } - else + } + else m_progress-> setProgress ( m_counter ); diff --git a/core/launcher/shutdownimpl.h b/core/launcher/shutdownimpl.h index 462f347..c2ebcc7 100644 --- a/core/launcher/shutdownimpl.h +++ b/core/launcher/shutdownimpl.h @@ -30,23 +30,23 @@ class ShutdownImpl : public QWidget { - Q_OBJECT + Q_OBJECT public: - ShutdownImpl( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); + ShutdownImpl( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); - enum Type { ShutdownSystem, RebootSystem, RestartDesktop, TerminateDesktop }; + enum Type { ShutdownSystem, RebootSystem, RestartDesktop, TerminateDesktop }; signals: - void shutdown( ShutdownImpl::Type ); + void shutdown( ShutdownImpl::Type ); private slots: - void buttonClicked( int ); - void cancelClicked(); - void timeout(); + void buttonClicked( int ); + void cancelClicked(); + void timeout(); private: - QTimer *m_timer; - int m_counter; - Type m_operation; - - QLabel * m_info; - QProgressBar *m_progress; + QTimer *m_timer; + int m_counter; + Type m_operation; + + QLabel * m_info; + QProgressBar *m_progress; }; |