Diffstat (limited to 'core/launcher/syncdialog.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | core/launcher/syncdialog.cpp | 59 |
1 files changed, 34 insertions, 25 deletions
diff --git a/core/launcher/syncdialog.cpp b/core/launcher/syncdialog.cpp index 4a2b8ff..d90b2ea 100644 --- a/core/launcher/syncdialog.cpp +++ b/core/launcher/syncdialog.cpp @@ -1,72 +1,81 @@ -/********************************************************************** -** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. -** -** This file is part of the Qtopia Environment. -** -** This file may be distributed and/or modified under the terms of the -** GNU General Public License version 2 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. -** -** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE -** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. -** -** See http://www.trolltech.com/gpl/ for GPL licensing information. -** -** Contact info@trolltech.com if any conditions of this licensing are -** not clear to you. -** -**********************************************************************/ - +/* + This file is part of the Opie Project + =. (C) 2000-2002 Trolltech AS + .=l. (C) 2002-2005 The Opie Team <opie-devel@handhelds.org> + .>+-= + _;:, .> :=|. This program is free software; you can +.> <`_, > . <= redistribute it and/or modify it under + :`=1 )Y*s>-.-- : the terms of the GNU Library General Public +.="- .-=="i, .._ License as published by the Free Software + - . .-<_> .<> Foundation; version 2 of the License. + ._= =} : + .%`+i> _;_. + .i_,=:_. -<s. This program is distributed in the hope that + + . -:. = it will be useful, but WITHOUT ANY WARRANTY; + : .. .:, . . . without even the implied warranty of + =_ + =;=|` MERCHANTABILITY or FITNESS FOR A + _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU +..}^=.= = ; Library General Public License for more +++= -. .` .: details. + : = ...= . :.=- + -. .:....=;==+<; You should have received a copy of the GNU + -_. . . )=. = Library General Public License along with + -- :-=` this library; see the file COPYING.LIB. + If not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ #include "syncdialog.h" -#include <qtopia/resource.h> +/* OPIE */ +#include <opie2/oresource.h> +using namespace Opie::Core; +/* QT */ #include <qpainter.h> #include <qapplication.h> #include <qpushbutton.h> #include <qfile.h> - SyncDialog::SyncDialog( QWidget *parent, const QString &w ) : QDialog( parent, "SyncDialog", FALSE, WStyle_Tool | WStyle_Customize | WStyle_StaysOnTop ), what(w), nextPt(0), rev(FALSE), hideDot(TRUE) { QFont f( font() ); f.setPointSize( 16 ); setFont(f); loadPath(); QSize ds = qApp->desktop()->size(); setGeometry( 0, 0, ds.width(), ds.height() ); - img = Resource::loadImage( "SyncScreen" ); + img = OResource::loadImage( "SyncScreen", OResource::NoScale ); if ( img.width() > ds.width() || img.height() > ds.height() ) { path = scalePath( path, ds.width(), img.width(), ds.height(), img.height() ); img = img.smoothScale( ds.width(), ds.height() ); } - dot = Resource::loadImage( "syncdot" ); + dot = OResource::loadImage( "syncdot", OResource::NoScale ); setBackgroundColor( white ); QPushButton *pb = new QPushButton( tr("Abort"), this, "CancelSync" ); QSize bs = pb->sizeHint(); bs.rwidth() += 10; bs.rheight() += 5; pb->setGeometry( (ds.width()-bs.width())/2, 4*ds.height()/5, bs.width(), bs.height() ); connect( pb, SIGNAL(clicked()), this, SIGNAL(cancel()) ); if ( path.count() >= 2 ) { path = generatePath( path, 8 ); startTimer( 200 ); } } void SyncDialog::paintEvent( QPaintEvent *pe ) { QPainter p(this ); p.setClipRect( pe->rect() ); int ox = (width() - img.width())/2; int oy = (height() - img.height())/2; QRect ir = QRect(ox, oy, img.width(), img.height()) & pe->rect(); @@ -97,49 +106,49 @@ void SyncDialog::timerEvent( QTimerEvent * ) if ( !rev ) { nextPt++; if ( nextPt == (int)path.count() ) { nextPt -= 2; rev = TRUE; } } else { nextPt--; if ( nextPt < 0 ) { nextPt = 1; rev = FALSE; } } hideDot = FALSE; repaint( ox+path[nextPt].x()-dot.width()/2, oy+path[nextPt].y()-dot.height()/2, dot.width(), dot.height() ); hideDot = TRUE; repaint( ox+path[oldPt].x()-dot.width()/2, oy+path[oldPt].y()-dot.height()/2, dot.width(), dot.height() ); } void SyncDialog::loadPath() { - QString pfile = Resource::findPixmap( "syncdot" ); + QString pfile = OResource::findPixmap( "syncdot" ); if ( pfile.isEmpty() ) return; int dp = pfile.findRev('.'); pfile.replace( dp, pfile.length()-dp, ".path" ); int count = 0; QFile file( pfile ); if ( file.open( IO_ReadOnly ) ) { QString line; while ( file.readLine( line, 256 ) > 0 ) { int x, y; if ( sscanf( line.latin1(), "%d %d", &x, &y ) == 2 ) { path.resize( count+1 ); path[count++] = QPoint(x, y); } } } } QPointArray SyncDialog::scalePath( const QPointArray &pa, int xn, int xd, int yn, int yd ) { QPointArray sa( pa.size() ); for ( unsigned i = 0; i < pa.count(); i++ ) { |