summaryrefslogtreecommitdiff
path: root/core/launcher/shutdownimpl.cpp
Unidiff
Diffstat (limited to 'core/launcher/shutdownimpl.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--core/launcher/shutdownimpl.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/core/launcher/shutdownimpl.cpp b/core/launcher/shutdownimpl.cpp
index f43a2a3..2731568 100644
--- a/core/launcher/shutdownimpl.cpp
+++ b/core/launcher/shutdownimpl.cpp
@@ -61,100 +61,100 @@ ShutdownImpl::ShutdownImpl( QWidget* parent, const char *name, WFlags fl )
61 61
62 QGridLayout *grid = new QGridLayout ( btngrp-> layout ( ) ); 62 QGridLayout *grid = new QGridLayout ( btngrp-> layout ( ) );
63 grid-> setAlignment ( Qt::AlignTop ); 63 grid-> setAlignment ( Qt::AlignTop );
64 grid-> setSpacing ( 3 ); 64 grid-> setSpacing ( 3 );
65 grid-> setMargin ( 7 ); 65 grid-> setMargin ( 7 );
66 66
67 QPushButton *quit = new QPushButton ( tr( "Terminate Opie" ), btngrp, "quit" ); 67 QPushButton *quit = new QPushButton ( tr( "Terminate Opie" ), btngrp, "quit" );
68 changeButtonColor ( quit, QColor ( 236, 236, 179 ) ); 68 changeButtonColor ( quit, QColor ( 236, 236, 179 ) );
69 btngrp-> insert ( quit, 4 ); 69 btngrp-> insert ( quit, 4 );
70 grid-> addWidget ( quit, 1, 1 ); 70 grid-> addWidget ( quit, 1, 1 );
71 71
72 QPushButton *reboot = new QPushButton ( tr( "Reboot" ), btngrp, "reboot" ); 72 QPushButton *reboot = new QPushButton ( tr( "Reboot" ), btngrp, "reboot" );
73 changeButtonColor ( reboot, QColor( 236, 183, 181 ) ); 73 changeButtonColor ( reboot, QColor( 236, 183, 181 ) );
74 btngrp-> insert ( reboot, 2 ); 74 btngrp-> insert ( reboot, 2 );
75 grid-> addWidget( reboot, 1, 0 ); 75 grid-> addWidget( reboot, 1, 0 );
76 76
77 QPushButton *restart = new QPushButton ( tr( "Restart Opie" ), btngrp, "restart" ); 77 QPushButton *restart = new QPushButton ( tr( "Restart Opie" ), btngrp, "restart" );
78 changeButtonColor ( restart, QColor( 236, 236, 179 ) ); 78 changeButtonColor ( restart, QColor( 236, 236, 179 ) );
79 btngrp-> insert ( restart, 3 ); 79 btngrp-> insert ( restart, 3 );
80 grid-> addWidget ( restart, 0, 1 ); 80 grid-> addWidget ( restart, 0, 1 );
81 81
82 QPushButton *shutdown = new QPushButton( tr( "Shutdown" ), btngrp, "shutdown" ); 82 QPushButton *shutdown = new QPushButton( tr( "Shutdown" ), btngrp, "shutdown" );
83 changeButtonColor ( shutdown, QColor( 236, 183, 181 ) ); 83 changeButtonColor ( shutdown, QColor( 236, 183, 181 ) );
84 btngrp-> insert ( shutdown, 1 ); 84 btngrp-> insert ( shutdown, 1 );
85 grid-> addWidget ( shutdown, 0, 0 ); 85 grid-> addWidget ( shutdown, 0, 0 );
86 86
87 vbox-> addWidget ( btngrp ); 87 vbox-> addWidget ( btngrp );
88 88
89 m_info = new QLabel ( this, "info" ); 89 m_info = new QLabel ( this, "info" );
90 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." ) ); 90 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." ) );
91 vbox-> addWidget ( m_info ); 91 vbox-> addWidget ( m_info );
92 92
93 m_progress = new QProgressBar ( this, "progressBar" ); 93 m_progress = new QProgressBar ( this, "progressBar" );
94 m_progress-> setFrameShape ( QProgressBar::Panel ); 94 m_progress-> setFrameShape ( QProgressBar::Panel );
95 m_progress-> setFrameShadow ( QProgressBar::Sunken ); 95 m_progress-> setFrameShadow ( QProgressBar::Sunken );
96 m_progress-> setTotalSteps ( 20 ); 96 m_progress-> setTotalSteps ( 20 );
97 m_progress-> setIndicatorFollowsStyle ( false ); 97 m_progress-> setIndicatorFollowsStyle ( false );
98 vbox-> addWidget ( m_progress ); 98 vbox-> addWidget ( m_progress );
99 99
100 vbox-> addItem ( new QSpacerItem ( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ) ); 100 vbox-> addItem ( new QSpacerItem ( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ) );
101 101
102 QPushButton *cancel = new QPushButton ( tr( "Cancel" ), this, "cancel" ); 102 QPushButton *cancel = new QPushButton ( tr( "Cancel" ), this, "cancel" );
103 changeButtonColor ( cancel, QColor( 181, 222, 178 ) ); 103 changeButtonColor ( cancel, QColor( 181, 222, 178 ) );
104 cancel-> setDefault ( true ); 104 cancel-> setDefault ( true );
105 cancel-> setSizePolicy ( QSizePolicy ( QSizePolicy::Minimum, QSizePolicy::Expanding, cancel-> sizePolicy ( ). hasHeightForWidth ( ) ) ); 105 cancel-> setSizePolicy ( QSizePolicy ( QSizePolicy::Minimum, QSizePolicy::Expanding, cancel-> sizePolicy ( ). hasHeightForWidth ( ) ) );
106 vbox-> addWidget ( cancel ); 106 vbox-> addWidget ( cancel );
107 107
108 m_timer = new QTimer ( this ); 108 m_timer = new QTimer ( this );
109 connect ( m_timer, SIGNAL( timeout ( ) ), this, SLOT( timeout ( ) ) ); 109 connect ( m_timer, SIGNAL( timeout() ), this, SLOT( timeout() ) );
110 110
111 connect ( btngrp, SIGNAL( clicked ( int ) ), this, SLOT( buttonClicked ( int ) ) ); 111 connect ( btngrp, SIGNAL( clicked(int) ), this, SLOT( buttonClicked(int) ) );
112 connect ( cancel, SIGNAL( clicked ( ) ), this, SLOT( cancelClicked ( ) ) ); 112 connect ( cancel, SIGNAL( clicked() ), this, SLOT( cancelClicked() ) );
113 113
114 m_progress-> hide ( ); 114 m_progress-> hide ( );
115 Global::hideInputMethod ( ); 115 Global::hideInputMethod ( );
116} 116}
117 117
118void ShutdownImpl::buttonClicked ( int b ) 118void ShutdownImpl::buttonClicked ( int b )
119{ 119{
120 m_counter = 0; 120 m_counter = 0;
121 121
122 switch ( b ) { 122 switch ( b ) {
123 case 1: 123 case 1:
124 m_operation = ShutdownSystem; 124 m_operation = ShutdownSystem;
125 break; 125 break;
126 case 2: 126 case 2:
127 m_operation = RebootSystem; 127 m_operation = RebootSystem;
128 break; 128 break;
129 case 3: 129 case 3:
130 m_operation = RestartDesktop; 130 m_operation = RestartDesktop;
131 break; 131 break;
132 case 4: 132 case 4:
133 m_operation = TerminateDesktop; 133 m_operation = TerminateDesktop;
134 break; 134 break;
135 } 135 }
136 m_info-> hide ( ); 136 m_info-> hide ( );
137 m_progress-> show ( ); 137 m_progress-> show ( );
138 m_timer-> start ( 300 ); 138 m_timer-> start ( 300 );
139 timeout ( ); 139 timeout ( );
140} 140}
141 141
142void ShutdownImpl::cancelClicked ( ) 142void ShutdownImpl::cancelClicked ( )
143{ 143{
144 m_progress-> hide ( ); 144 m_progress-> hide ( );
145 m_info-> show ( ); 145 m_info-> show ( );
146 if ( m_timer-> isActive ( ) ) 146 if ( m_timer-> isActive ( ) )
147 m_timer-> stop ( ); 147 m_timer-> stop ( );
148 else 148 else
149 close ( ); 149 close ( );
150} 150}
151 151
152void ShutdownImpl::timeout ( ) 152void ShutdownImpl::timeout ( )
153{ 153{
154 if ( ( m_counter += 2 ) > m_progress-> totalSteps ( ) ) { 154 if ( ( m_counter += 2 ) > m_progress-> totalSteps ( ) ) {
155 m_progress-> hide ( ); 155 m_progress-> hide ( );
156 m_timer-> stop ( ); 156 m_timer-> stop ( );
157 emit shutdown ( m_operation ); 157 emit shutdown ( m_operation );
158 } 158 }
159 else 159 else
160 m_progress-> setProgress ( m_counter ); 160 m_progress-> setProgress ( m_counter );