-rw-r--r-- | core/launcher/launcherview.cpp | 5 | ||||
-rw-r--r-- | core/launcher/transferserver.cpp | 2 |
2 files changed, 4 insertions, 3 deletions
diff --git a/core/launcher/launcherview.cpp b/core/launcher/launcherview.cpp index 2a051a6..95a1d4a 100644 --- a/core/launcher/launcherview.cpp +++ b/core/launcher/launcherview.cpp @@ -14,153 +14,154 @@ ** 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. ** **********************************************************************/ #include "launcherview.h" #include <qpe/qpeapplication.h> #include <qpe/applnk.h> #include <qpe/qpedebug.h> #include <qpe/categories.h> #include <qpe/categoryselect.h> #include <qpe/menubutton.h> #include <qpe/mimetype.h> #include <qpe/resource.h> #include <qpe/qpetoolbar.h> //#include <qtopia/private/palmtoprecord.h> #include <qtimer.h> #include <qtextstream.h> #include <qdict.h> #include <qfile.h> #include <qfileinfo.h> #include <qhbox.h> #include <qiconview.h> #include <qpainter.h> #include <qregexp.h> #include <qtoolbutton.h> #include <qimage.h> +#include <cstdlib> class BgPixmap { public: BgPixmap( const QPixmap &p ) : pm(p), ref(1) {} QPixmap pm; int ref; }; enum BusyIndicatorType { BIT_Normal = 0, BIT_Blinking }; static QMap<QString,BgPixmap*> *bgCache = 0; class LauncherIconView : public QIconView { public: LauncherIconView( QWidget* parent, const char* name=0 ) : QIconView(parent,name), tf(""), cf(0), bsy(0), bigIcns(TRUE), bgColor(white) { sortmeth = Name; hidden.setAutoDelete(TRUE); ike = FALSE; busytimer = 0; calculateGrid( Bottom ); } ~LauncherIconView() { #if 0 // debuggery QListIterator<AppLnk> it(hidden); AppLnk* l; while ((l=it.current())) { ++it; //qDebug("%p: hidden (should remove)",l); } #endif } void setBusyIndicatorType ( BusyIndicatorType t ) { busyType = t; } - QPixmap* busyPixmap() const { return (QPixmap*)&bpm[::abs(busystate)]; } + QPixmap* busyPixmap() const { return (QPixmap*)&bpm[abs(busystate)]; } QIconViewItem* busyItem() const { return bsy; } void setBigIcons( bool bi ) { bigIcns = bi; } void updateCategoriesAndMimeTypes(); void doAutoScroll() { // We don't want rubberbanding (yet) } void setBusy(bool on) { QIconViewItem *c = on ? currentItem() : 0; if ( bsy != c ) { QIconViewItem *oldbsy = bsy; bsy = c; if ( oldbsy ) oldbsy-> repaint ( ); if ( busytimer ) { killTimer ( busytimer ); busytimer = 0; } if ( bsy ) { QPixmap *src = bsy-> QIconViewItem::pixmap(); for ( int i = 0; i <= 5; i++ ) { QImage img = src->convertToImage(); QRgb* rgb; int count; if ( img.depth() == 32 ) { rgb = (QRgb*)img.bits(); count = img.bytesPerLine()/sizeof(QRgb)*img.height(); } else { rgb = img.colorTable(); count = img.numColors(); } int rc, gc, bc; - int bs = ::abs ( i * 10 ) + 25; + int bs = abs ( i * 10 ) + 25; colorGroup().highlight().rgb( &rc, &gc, &bc ); rc = rc * bs / 100; gc = gc * bs / 100; bc = bc * bs / 100; for ( int r = 0; r < count; r++, rgb++ ) { int ri = rc + qRed ( *rgb ) * ( 100 - bs ) / 100; int gi = gc + qGreen ( *rgb ) * ( 100 - bs ) / 100; int bi = bc + qBlue ( *rgb ) * ( 100 - bs ) / 100; int ai = qAlpha ( *rgb ); *rgb = qRgba ( ri, gi, bi, ai ); } bpm [i].convertFromImage( img ); } if ( busyType == BIT_Blinking ) { busystate = 0; busytimer = startTimer ( 200 ); } else { busystate = 3; } timerEvent ( 0 ); } } } virtual void timerEvent ( QTimerEvent *te ) { if ( !te || ( te-> timerId ( ) == busytimer )) { if ( bsy ) { diff --git a/core/launcher/transferserver.cpp b/core/launcher/transferserver.cpp index aaa4425..cbda247 100644 --- a/core/launcher/transferserver.cpp +++ b/core/launcher/transferserver.cpp @@ -965,65 +965,65 @@ void ServerPI::newConnection( int socket ) dtp->setSocket( socket ); } else if ( wait[RetrieveByteArray] ) { qDebug("retrieve byte array"); dtp->retrieveByteArray(); dtp->setSocket( socket ); } else waitsocket = socket; for( int i = 0; i < 4; i++ ) wait[i] = FALSE; } QString ServerPI::absFilePath( const QString& file ) { if ( file.isEmpty() ) return file; QString filepath( file ); if ( file[0] != "/" ) filepath = directory.path() + "/" + file; return filepath; } void ServerPI::timerEvent( QTimerEvent * ) { connectionClosed(); } -ServerDTP::ServerDTP( QObject *parent = 0, const char* name = 0) +ServerDTP::ServerDTP( QObject *parent, const char* name) : QSocket( parent, name ), mode( Idle ), createTargzProc( 0 ), retrieveTargzProc( 0 ), gzipProc( 0 ) { connect( this, SIGNAL( connected() ), SLOT( connected() ) ); connect( this, SIGNAL( connectionClosed() ), SLOT( connectionClosed() ) ); connect( this, SIGNAL( bytesWritten( int ) ), SLOT( bytesWritten( int ) ) ); connect( this, SIGNAL( readyRead() ), SLOT( readyRead() ) ); gzipProc = new QProcess( this, "gzipProc" ); gzipProc->setCommunication( QProcess::Stdin | QProcess::Stdout ); createTargzProc = new QProcess( QString("tar"), this, "createTargzProc"); createTargzProc->setCommunication( QProcess::Stdout ); createTargzProc->setWorkingDirectory( QDir::rootDirPath() ); connect( createTargzProc, SIGNAL( processExited() ), SLOT( targzDone() ) ); QStringList args = "tar"; args += "-xv"; retrieveTargzProc = new QProcess( args, this, "retrieveTargzProc" ); retrieveTargzProc->setCommunication( QProcess::Stdin ); retrieveTargzProc->setWorkingDirectory( QDir::rootDirPath() ); connect( retrieveTargzProc, SIGNAL( processExited() ), SIGNAL( completed() ) ); connect( retrieveTargzProc, SIGNAL( processExited() ), SLOT( extractTarDone() ) ); } ServerDTP::~ServerDTP() { buf.close(); file.close(); |