summaryrefslogtreecommitdiff
path: root/libopie/owait.cpp
Unidiff
Diffstat (limited to 'libopie/owait.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie/owait.cpp2
1 files changed, 0 insertions, 2 deletions
diff --git a/libopie/owait.cpp b/libopie/owait.cpp
index 0fdf08d..a0f3834 100644
--- a/libopie/owait.cpp
+++ b/libopie/owait.cpp
@@ -1,93 +1,91 @@
1/* This file is part of the OPIE libraries 1/* This file is part of the OPIE libraries
2 Copyright (C) 2003 Maximilian Reiss (harlekin@handhelds.org) 2 Copyright (C) 2003 Maximilian Reiss (harlekin@handhelds.org)
3 3
4 This library is free software; you can redistribute it and/or 4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public 5 modify it under the terms of the GNU Library General Public
6 License as published by the Free Software Foundation; either 6 License as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) any later version. 7 version 2 of the License, or (at your option) any later version.
8 8
9 This library is distributed in the hope that it will be useful, 9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of 10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details. 12 Library General Public License for more details.
13 13
14 You should have received a copy of the GNU Library General Public License 14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to 15 along with this library; see the file COPYING.LIB. If not, write to
16 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 16 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 Boston, MA 02111-1307, USA. 17 Boston, MA 02111-1307, USA.
18*/ 18*/
19 19
20#include <qlabel.h>
21#include <qlayout.h> 20#include <qlayout.h>
22#include <qtimer.h>
23#include <qpe/qpeapplication.h> 21#include <qpe/qpeapplication.h>
24#include <qpainter.h> 22#include <qpainter.h>
25 23
26#include "owait.h" 24#include "owait.h"
27 25
28#include <qpe/resource.h> 26#include <qpe/resource.h>
29 27
30static int frame = 0; 28static int frame = 0;
31 29
32/** 30/**
33 * This will construct a modal dialog. 31 * This will construct a modal dialog.
34 * 32 *
35 * The default timer length is 10. 33 * The default timer length is 10.
36 * 34 *
37 * @param parent The parent of the widget 35 * @param parent The parent of the widget
38 * @param msg The name of the object 36 * @param msg The name of the object
39 * @param dispIcon Display Icon? 37 * @param dispIcon Display Icon?
40 */ 38 */
41OWait::OWait(QWidget *parent, const char* msg, bool dispIcon ) 39OWait::OWait(QWidget *parent, const char* msg, bool dispIcon )
42 :QDialog(parent, msg, TRUE,WStyle_Customize) { 40 :QDialog(parent, msg, TRUE,WStyle_Customize) {
43 41
44 42
45 QHBoxLayout *hbox = new QHBoxLayout( this ); 43 QHBoxLayout *hbox = new QHBoxLayout( this );
46 44
47 m_lb = new QLabel( this ); 45 m_lb = new QLabel( this );
48 m_lb->setBackgroundMode ( NoBackground ); 46 m_lb->setBackgroundMode ( NoBackground );
49 47
50 hbox->addWidget( m_lb ); 48 hbox->addWidget( m_lb );
51 hbox->activate(); 49 hbox->activate();
52 50
53 m_pix = Resource::loadPixmap( "BigBusy" ); 51 m_pix = Resource::loadPixmap( "BigBusy" );
54 m_aniSize = m_pix.height(); 52 m_aniSize = m_pix.height();
55 resize( m_aniSize, m_aniSize ); 53 resize( m_aniSize, m_aniSize );
56 54
57 m_timerLength = 10; 55 m_timerLength = 10;
58 56
59 m_waitTimer = new QTimer( this ); 57 m_waitTimer = new QTimer( this );
60 connect( m_waitTimer, SIGNAL( timeout() ), this, SLOT( hide() ) ); 58 connect( m_waitTimer, SIGNAL( timeout() ), this, SLOT( hide() ) );
61} 59}
62 60
63void OWait::timerEvent( QTimerEvent * ) { 61void OWait::timerEvent( QTimerEvent * ) {
64 frame = (++frame) % 4; 62 frame = (++frame) % 4;
65 repaint(); 63 repaint();
66} 64}
67 65
68void OWait::paintEvent( QPaintEvent * ) { 66void OWait::paintEvent( QPaintEvent * ) {
69 QPainter p( m_lb ); 67 QPainter p( m_lb );
70 p.drawPixmap( 0, 0, m_pix, m_aniSize * frame, 0, m_aniSize, m_aniSize ); 68 p.drawPixmap( 0, 0, m_pix, m_aniSize * frame, 0, m_aniSize, m_aniSize );
71} 69}
72 70
73void OWait::show() { 71void OWait::show() {
74 72
75 move( ( ( qApp->desktop()->width() ) / 2 ) - ( m_aniSize / 2 ), ( ( qApp->desktop()->height() ) / 2 ) - ( m_aniSize / 2 ) ); 73 move( ( ( qApp->desktop()->width() ) / 2 ) - ( m_aniSize / 2 ), ( ( qApp->desktop()->height() ) / 2 ) - ( m_aniSize / 2 ) );
76 startTimer( 300 ); 74 startTimer( 300 );
77 m_waitTimer->start( m_timerLength * 1000, true ); 75 m_waitTimer->start( m_timerLength * 1000, true );
78 QDialog::show(); 76 QDialog::show();
79} 77}
80 78
81void OWait::hide() { 79void OWait::hide() {
82 killTimers(); 80 killTimers();
83 m_waitTimer->stop(); 81 m_waitTimer->stop();
84 frame = 0; 82 frame = 0;
85 QDialog::hide(); 83 QDialog::hide();
86} 84}
87 85
88void OWait::setTimerLength( int length ) { 86void OWait::setTimerLength( int length ) {
89 m_timerLength = length; 87 m_timerLength = length;
90} 88}
91 89
92OWait::~OWait() { 90OWait::~OWait() {
93} 91}