summaryrefslogtreecommitdiff
path: root/core/launcher/syncdialog.cpp
Unidiff
Diffstat (limited to 'core/launcher/syncdialog.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--core/launcher/syncdialog.cpp59
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,60 +1,69 @@
1/********************************************************************** 1/*
2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. 2                 This file is part of the Opie Project
3** 3 =. (C) 2000-2002 Trolltech AS
4** This file is part of the Qtopia Environment. 4 .=l. (C) 2002-2005 The Opie Team <opie-devel@handhelds.org>
5** 5           .>+-=
6** This file may be distributed and/or modified under the terms of the 6 _;:,     .>    :=|. This program is free software; you can
7** GNU General Public License version 2 as published by the Free Software 7.> <`_,   >  .   <= redistribute it and/or modify it under
8** Foundation and appearing in the file LICENSE.GPL included in the 8 :`=1 )Y*s>-.--   : the terms of the GNU Library General Public
9** packaging of this file. 9.="- .-=="i,     .._ License as published by the Free Software
10** 10 - .   .-<_>     .<> Foundation; version 2 of the License.
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11     ._= =}       :
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12    .%`+i>       _;_.
13** 13    .i_,=:_.      -<s. This program is distributed in the hope that
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
15** 15 : ..    .:,     . . . without even the implied warranty of
16** Contact info@trolltech.com if any conditions of this licensing are 16    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
17** not clear to you. 17  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
18** 18..}^=.=       =       ; Library General Public License for more
19**********************************************************************/ 19++=   -.     .`     .: details.
20 20 :     =  ...= . :.=-
21 -.   .:....=;==+<; You should have received a copy of the GNU
22  -_. . .   )=.  = Library General Public License along with
23    --        :-=` this library; see the file COPYING.LIB.
24 If not, write to the Free Software Foundation,
25 Inc., 59 Temple Place - Suite 330,
26 Boston, MA 02111-1307, USA.
27*/
21#include "syncdialog.h" 28#include "syncdialog.h"
22 29
23#include <qtopia/resource.h> 30/* OPIE */
31#include <opie2/oresource.h>
32using namespace Opie::Core;
24 33
34/* QT */
25#include <qpainter.h> 35#include <qpainter.h>
26#include <qapplication.h> 36#include <qapplication.h>
27#include <qpushbutton.h> 37#include <qpushbutton.h>
28#include <qfile.h> 38#include <qfile.h>
29 39
30
31SyncDialog::SyncDialog( QWidget *parent, const QString &w ) 40SyncDialog::SyncDialog( QWidget *parent, const QString &w )
32 : QDialog( parent, "SyncDialog", FALSE, WStyle_Tool | WStyle_Customize | 41 : QDialog( parent, "SyncDialog", FALSE, WStyle_Tool | WStyle_Customize |
33 WStyle_StaysOnTop ), what(w), nextPt(0), rev(FALSE), hideDot(TRUE) 42 WStyle_StaysOnTop ), what(w), nextPt(0), rev(FALSE), hideDot(TRUE)
34{ 43{
35 QFont f( font() ); 44 QFont f( font() );
36 f.setPointSize( 16 ); 45 f.setPointSize( 16 );
37 setFont(f); 46 setFont(f);
38 47
39 loadPath(); 48 loadPath();
40 49
41 QSize ds = qApp->desktop()->size(); 50 QSize ds = qApp->desktop()->size();
42 setGeometry( 0, 0, ds.width(), ds.height() ); 51 setGeometry( 0, 0, ds.width(), ds.height() );
43 img = Resource::loadImage( "SyncScreen" ); 52 img = OResource::loadImage( "SyncScreen", OResource::NoScale );
44 if ( img.width() > ds.width() || img.height() > ds.height() ) { 53 if ( img.width() > ds.width() || img.height() > ds.height() ) {
45 path = scalePath( path, ds.width(), img.width(), ds.height(), img.height() ); 54 path = scalePath( path, ds.width(), img.width(), ds.height(), img.height() );
46 img = img.smoothScale( ds.width(), ds.height() ); 55 img = img.smoothScale( ds.width(), ds.height() );
47 } 56 }
48 dot = Resource::loadImage( "syncdot" ); 57 dot = OResource::loadImage( "syncdot", OResource::NoScale );
49 setBackgroundColor( white ); 58 setBackgroundColor( white );
50 59
51 QPushButton *pb = new QPushButton( tr("Abort"), this, "CancelSync" ); 60 QPushButton *pb = new QPushButton( tr("Abort"), this, "CancelSync" );
52 QSize bs = pb->sizeHint(); 61 QSize bs = pb->sizeHint();
53 bs.rwidth() += 10; 62 bs.rwidth() += 10;
54 bs.rheight() += 5; 63 bs.rheight() += 5;
55 pb->setGeometry( (ds.width()-bs.width())/2, 4*ds.height()/5, 64 pb->setGeometry( (ds.width()-bs.width())/2, 4*ds.height()/5,
56 bs.width(), bs.height() ); 65 bs.width(), bs.height() );
57 connect( pb, SIGNAL(clicked()), this, SIGNAL(cancel()) ); 66 connect( pb, SIGNAL(clicked()), this, SIGNAL(cancel()) );
58 67
59 if ( path.count() >= 2 ) { 68 if ( path.count() >= 2 ) {
60 path = generatePath( path, 8 ); 69 path = generatePath( path, 8 );
@@ -109,25 +118,25 @@ void SyncDialog::timerEvent( QTimerEvent * )
109 } 118 }
110 119
111 hideDot = FALSE; 120 hideDot = FALSE;
112 repaint( ox+path[nextPt].x()-dot.width()/2, oy+path[nextPt].y()-dot.height()/2, 121 repaint( ox+path[nextPt].x()-dot.width()/2, oy+path[nextPt].y()-dot.height()/2,
113 dot.width(), dot.height() ); 122 dot.width(), dot.height() );
114 hideDot = TRUE; 123 hideDot = TRUE;
115 repaint( ox+path[oldPt].x()-dot.width()/2, oy+path[oldPt].y()-dot.height()/2, 124 repaint( ox+path[oldPt].x()-dot.width()/2, oy+path[oldPt].y()-dot.height()/2,
116 dot.width(), dot.height() ); 125 dot.width(), dot.height() );
117} 126}
118 127
119void SyncDialog::loadPath() 128void SyncDialog::loadPath()
120{ 129{
121 QString pfile = Resource::findPixmap( "syncdot" ); 130 QString pfile = OResource::findPixmap( "syncdot" );
122 if ( pfile.isEmpty() ) 131 if ( pfile.isEmpty() )
123 return; 132 return;
124 int dp = pfile.findRev('.'); 133 int dp = pfile.findRev('.');
125 pfile.replace( dp, pfile.length()-dp, ".path" ); 134 pfile.replace( dp, pfile.length()-dp, ".path" );
126 135
127 int count = 0; 136 int count = 0;
128 QFile file( pfile ); 137 QFile file( pfile );
129 if ( file.open( IO_ReadOnly ) ) { 138 if ( file.open( IO_ReadOnly ) ) {
130 QString line; 139 QString line;
131 while ( file.readLine( line, 256 ) > 0 ) { 140 while ( file.readLine( line, 256 ) > 0 ) {
132 int x, y; 141 int x, y;
133 if ( sscanf( line.latin1(), "%d %d", &x, &y ) == 2 ) { 142 if ( sscanf( line.latin1(), "%d %d", &x, &y ) == 2 ) {