From 6d0df38a805c5560b0815df62b212d4be0913154 Mon Sep 17 00:00:00 2001 From: sandman Date: Thu, 27 Jun 2002 01:44:44 +0000 Subject: Made the launcher dialog "liquid compatible": remvoed the ui file and hand-coded the gui with smarter palette handling. --- (limited to 'core/launcher') diff --git a/core/launcher/launcher.pro b/core/launcher/launcher.pro index c053662..ccf8231 100644 --- a/core/launcher/launcher.pro +++ b/core/launcher/launcher.pro @@ -91,7 +91,7 @@ SOURCES = background.cpp \ $(OPIEDIR)/rsync/version.c \ $(OPIEDIR)/rsync/whole.c \ $(OPIEDIR)/rsync/qrsync.cpp -INTERFACES = shutdown.ui syncdialog.ui +INTERFACES = syncdialog.ui INCLUDEPATH += $(OPIEDIR)/include DEPENDPATH += $(OPIEDIR)/include . INCLUDEPATH += $(OPIEDIR)/core/apps/calibrate diff --git a/core/launcher/shutdown.ui b/core/launcher/shutdown.ui deleted file mode 100644 index c5863df..0000000 --- a/core/launcher/shutdown.ui +++ b/dev/null @@ -1,1323 +0,0 @@ - -Shutdown - - QWidget - - name - Form1 - - - geometry - - 0 - 0 - 433 - 465 - - - - caption - Shut down... - - - layoutMargin - - - layoutSpacing - - - - margin - 6 - - - spacing - 3 - - - QButtonGroup - - name - ButtonGroup1 - - - title - Terminate - - - layoutMargin - - - layoutSpacing - - - - margin - 7 - - - spacing - 3 - - - QPushButton - - name - quit - - - sizePolicy - - 3 - 0 - - - - palette - - - - 0 - 0 - 0 - - - 236 - 236 - 179 - - - 255 - 255 - 255 - - - 245 - 245 - 217 - - - 118 - 118 - 89 - - - 157 - 157 - 119 - - - 0 - 0 - 0 - - - 255 - 255 - 255 - - - 0 - 0 - 0 - - - 255 - 255 - 255 - - - 222 - 222 - 222 - - - 0 - 0 - 0 - - - 0 - 0 - 128 - - - 255 - 255 - 255 - - - - - 128 - 128 - 128 - - - 236 - 236 - 179 - - - 255 - 255 - 255 - - - 255 - 255 - 209 - - - 118 - 118 - 89 - - - 157 - 157 - 119 - - - 128 - 128 - 128 - - - 255 - 255 - 255 - - - 128 - 128 - 128 - - - 255 - 255 - 255 - - - 222 - 222 - 222 - - - 0 - 0 - 0 - - - 0 - 0 - 128 - - - 255 - 255 - 255 - - - - - 0 - 0 - 0 - - - 236 - 236 - 179 - - - 255 - 255 - 255 - - - 255 - 255 - 209 - - - 118 - 118 - 89 - - - 157 - 157 - 119 - - - 0 - 0 - 0 - - - 255 - 255 - 255 - - - 0 - 0 - 0 - - - 255 - 255 - 255 - - - 222 - 222 - 222 - - - 0 - 0 - 0 - - - 0 - 0 - 128 - - - 255 - 255 - 255 - - - - - - text - Terminate Opie - - - buttonGroupId - 4 - - - - QPushButton - - name - reboot - - - sizePolicy - - 3 - 0 - - - - palette - - - - 0 - 0 - 0 - - - 236 - 183 - 181 - - - 255 - 255 - 255 - - - 245 - 219 - 218 - - - 118 - 92 - 91 - - - 157 - 122 - 121 - - - 0 - 0 - 0 - - - 255 - 255 - 255 - - - 0 - 0 - 0 - - - 255 - 255 - 255 - - - 222 - 222 - 222 - - - 0 - 0 - 0 - - - 0 - 0 - 128 - - - 255 - 255 - 255 - - - - - 128 - 128 - 128 - - - 236 - 183 - 181 - - - 255 - 255 - 255 - - - 255 - 213 - 212 - - - 118 - 92 - 91 - - - 157 - 122 - 121 - - - 128 - 128 - 128 - - - 255 - 255 - 255 - - - 128 - 128 - 128 - - - 255 - 255 - 255 - - - 222 - 222 - 222 - - - 0 - 0 - 0 - - - 0 - 0 - 128 - - - 255 - 255 - 255 - - - - - 0 - 0 - 0 - - - 236 - 183 - 181 - - - 255 - 255 - 255 - - - 255 - 213 - 212 - - - 118 - 92 - 91 - - - 157 - 122 - 121 - - - 0 - 0 - 0 - - - 255 - 255 - 255 - - - 0 - 0 - 0 - - - 255 - 255 - 255 - - - 222 - 222 - 222 - - - 0 - 0 - 0 - - - 0 - 0 - 128 - - - 255 - 255 - 255 - - - - - - text - Reboot - - - buttonGroupId - 2 - - - - QPushButton - - name - restart - - - palette - - - - 0 - 0 - 0 - - - 236 - 236 - 179 - - - 255 - 255 - 255 - - - 245 - 245 - 217 - - - 118 - 118 - 89 - - - 157 - 157 - 119 - - - 0 - 0 - 0 - - - 255 - 255 - 255 - - - 0 - 0 - 0 - - - 255 - 255 - 255 - - - 222 - 222 - 222 - - - 0 - 0 - 0 - - - 0 - 0 - 128 - - - 255 - 255 - 255 - - - - - 128 - 128 - 128 - - - 236 - 236 - 179 - - - 255 - 255 - 255 - - - 255 - 255 - 209 - - - 118 - 118 - 89 - - - 157 - 157 - 119 - - - 128 - 128 - 128 - - - 255 - 255 - 255 - - - 128 - 128 - 128 - - - 255 - 255 - 255 - - - 222 - 222 - 222 - - - 0 - 0 - 0 - - - 0 - 0 - 128 - - - 255 - 255 - 255 - - - - - 0 - 0 - 0 - - - 236 - 236 - 179 - - - 255 - 255 - 255 - - - 255 - 255 - 209 - - - 118 - 118 - 89 - - - 157 - 157 - 119 - - - 0 - 0 - 0 - - - 255 - 255 - 255 - - - 0 - 0 - 0 - - - 255 - 255 - 255 - - - 222 - 222 - 222 - - - 0 - 0 - 0 - - - 0 - 0 - 128 - - - 255 - 255 - 255 - - - - - - text - Restart Opie - - - buttonGroupId - 3 - - - - QPushButton - - name - shutdown - - - palette - - - - 0 - 0 - 0 - - - 236 - 183 - 181 - - - 255 - 255 - 255 - - - 245 - 219 - 218 - - - 118 - 92 - 91 - - - 157 - 122 - 121 - - - 0 - 0 - 0 - - - 255 - 255 - 255 - - - 0 - 0 - 0 - - - 255 - 255 - 255 - - - 222 - 222 - 222 - - - 0 - 0 - 0 - - - 0 - 0 - 128 - - - 255 - 255 - 255 - - - - - 128 - 128 - 128 - - - 236 - 183 - 181 - - - 255 - 255 - 255 - - - 255 - 213 - 212 - - - 118 - 92 - 91 - - - 157 - 122 - 121 - - - 128 - 128 - 128 - - - 255 - 255 - 255 - - - 128 - 128 - 128 - - - 255 - 255 - 255 - - - 222 - 222 - 222 - - - 0 - 0 - 0 - - - 0 - 0 - 128 - - - 255 - 255 - 255 - - - - - 0 - 0 - 0 - - - 236 - 183 - 181 - - - 255 - 255 - 255 - - - 255 - 213 - 212 - - - 118 - 92 - 91 - - - 157 - 122 - 121 - - - 0 - 0 - 0 - - - 255 - 255 - 255 - - - 0 - 0 - 0 - - - 255 - 255 - 255 - - - 222 - 222 - 222 - - - 0 - 0 - 0 - - - 0 - 0 - 128 - - - 255 - 255 - 255 - - - - - - text - Shutdown - - - buttonGroupId - 1 - - - - - - QLabel - - name - info - - - text - <p> -These termination options are provided primarily for use while developing and testing the Opie system. In a normal environment, these concepts are unnecessary. - - - - QProgressBar - - name - progressBar - - - frameShape - Panel - - - frameShadow - Sunken - - - totalSteps - 20 - - - indicatorFollowsStyle - false - - - - - name - Spacer2 - - - orientation - Vertical - - - sizeType - Expanding - - - sizeHint - - 20 - 20 - - - - - QPushButton - - name - cancel - - - sizePolicy - - 1 - 7 - - - - palette - - - - 0 - 0 - 0 - - - 181 - 222 - 178 - - - 255 - 255 - 255 - - - 218 - 238 - 216 - - - 90 - 111 - 89 - - - 120 - 148 - 118 - - - 0 - 0 - 0 - - - 255 - 255 - 255 - - - 0 - 0 - 0 - - - 255 - 255 - 255 - - - 174 - 222 - 158 - - - 0 - 0 - 0 - - - 0 - 0 - 128 - - - 255 - 255 - 255 - - - - - 128 - 128 - 128 - - - 181 - 222 - 178 - - - 255 - 255 - 255 - - - 207 - 255 - 204 - - - 90 - 111 - 89 - - - 120 - 148 - 118 - - - 128 - 128 - 128 - - - 255 - 255 - 255 - - - 128 - 128 - 128 - - - 255 - 255 - 255 - - - 174 - 222 - 158 - - - 0 - 0 - 0 - - - 0 - 0 - 128 - - - 255 - 255 - 255 - - - - - 0 - 0 - 0 - - - 181 - 222 - 178 - - - 255 - 255 - 255 - - - 207 - 255 - 204 - - - 90 - 111 - 89 - - - 120 - 148 - 118 - - - 0 - 0 - 0 - - - 255 - 255 - 255 - - - 0 - 0 - 0 - - - 255 - 255 - 255 - - - 174 - 222 - 158 - - - 0 - 0 - 0 - - - 0 - 0 - 128 - - - 255 - 255 - 255 - - - - - - text - Cancel - - - default - true - - - - - diff --git a/core/launcher/shutdownimpl.cpp b/core/launcher/shutdownimpl.cpp index 06ed756..0c5b4f6 100644 --- a/core/launcher/shutdownimpl.cpp +++ b/core/launcher/shutdownimpl.cpp @@ -27,69 +27,141 @@ #include #include #include +#include +#include +static void changeButtonColor ( QPushButton *btn, const QColor &col ) +{ + QPalette pal = btn-> palette ( ); + + pal. setColor ( QPalette::Active, QColorGroup::Button, col ); + pal. setColor ( QPalette::Disabled, QColorGroup::Button, col ); + pal. setColor ( QPalette::Inactive, QColorGroup::Button, col ); + + btn-> setPalette ( pal ); +} + -#include ShutdownImpl::ShutdownImpl( QWidget* parent, const char *name, WFlags fl ) - : Shutdown( parent, name, fl ) + : QWidget ( parent, name, fl ) { - timer = new QTimer( this ); - connect( timer, SIGNAL(timeout()), this, SLOT(timeout()) ); + setCaption ( tr( "Shut down..." )); + + 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-> insert ( restart, 3 ); + grid-> addWidget ( restart, 0, 1 ); - connect( ButtonGroup1, SIGNAL(clicked(int)), this, SLOT(buttonClicked(int)) ); - connect( cancel, SIGNAL(clicked()), this, SLOT(cancelClicked()) ); + 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( "

\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 ( ); - progressBar->hide(); - Global::hideInputMethod(); #ifdef QT_QWS_CUSTOM - QPushButton *sb = Shutdown::shutdown; - sb->hide(); + shutdown-> hide ( ); #endif } -void ShutdownImpl::buttonClicked( int b ) +void ShutdownImpl::buttonClicked ( int b ) { - progress = 0; + m_counter = 0; + switch ( b ) { case 1: - operation = ShutdownSystem; + m_operation = ShutdownSystem; break; case 2: - operation = RebootSystem; + m_operation = RebootSystem; break; case 3: - operation = RestartDesktop; + m_operation = RestartDesktop; break; case 4: - operation = TerminateDesktop; + m_operation = TerminateDesktop; break; } - info->hide(); - progressBar->show(); - timer->start( 300 ); - timeout(); + m_info-> hide ( ); + m_progress-> show ( ); + m_timer-> start ( 300 ); + timeout ( ); } -void ShutdownImpl::cancelClicked() +void ShutdownImpl::cancelClicked ( ) { - progressBar->hide(); - info->show(); - if ( timer->isActive() ) - timer->stop(); + m_progress-> hide ( ); + m_info-> show ( ); + if ( m_timer-> isActive ( )) + m_timer-> stop ( ); else - close(); + close ( ); } -void ShutdownImpl::timeout() +void ShutdownImpl::timeout ( ) { - if ( (progress+=2) > progressBar->totalSteps() ) { - progressBar->hide(); - timer->stop(); - emit shutdown( operation ); - } else { - progressBar->setProgress( progress ); - } + if (( m_counter += 2 ) > m_progress-> totalSteps ( )) { + m_progress-> hide ( ); + m_timer-> stop ( ); + emit shutdown ( m_operation ); + } + else + m_progress-> setProgress ( m_counter ); } diff --git a/core/launcher/shutdownimpl.h b/core/launcher/shutdownimpl.h index 54668f3..462f347 100644 --- a/core/launcher/shutdownimpl.h +++ b/core/launcher/shutdownimpl.h @@ -20,11 +20,13 @@ #ifndef SHUTDOWNIMPL_H #define SHUTDOWNIMPL_H -#include "shutdown.h" +#include class QTimer; +class QLabel; +class QProgressBar; -class ShutdownImpl : public Shutdown +class ShutdownImpl : public QWidget { Q_OBJECT public: @@ -41,9 +43,12 @@ private slots: void timeout(); private: - QTimer *timer; - int progress; - Type operation; + QTimer *m_timer; + int m_counter; + Type m_operation; + + QLabel * m_info; + QProgressBar *m_progress; }; #endif -- cgit v0.9.0.2