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