dataloader.h

Go to the documentation of this file.
00001 /*
00002         Author: Marco Costalba (C) 2005-2006
00003 
00004         Copyright: See COPYING file that comes with this distribution
00005 
00006 */
00007 #ifndef DATALOADER_H
00008 #define DATALOADER_H
00009 
00010 #include <qobject.h>
00011 #include <qtimer.h>
00012 #include <qdatetime.h>
00013 #include <qfile.h>
00014 
00015 class QString;
00016 class Git;
00017 class FileHistory;
00018 class QProcess;
00019 class MyProcess;
00020 
00021 // data exchange facility with git-rev-list could be based on QProcess or on
00022 // a temporary file (default). Uncomment following line to use QProcess
00023 // #define USE_QPROCESS
00024 
00025 class DataLoader : public QObject {
00026 Q_OBJECT
00027 public:
00028         DataLoader(Git* g, FileHistory* f);
00029         ~DataLoader();
00030         bool start(const QStringList& args, const QString& wd);
00031 
00032 public slots:
00033         void on_procDataReady(const QByteArray&);
00034         void on_eof();
00035 
00036 signals:
00037         void newDataReady(const FileHistory*);
00038         void loaded(const FileHistory*,ulong,int,bool,const QString&,const QString&);
00039 
00040 private slots:
00041         void on_cancel();
00042         void on_cancel(const FileHistory*);
00043         void on_timeout();
00044 
00045 private:
00046         void parseSingleBuffer(const QByteArray& ba);
00047         void addSplittedChunks(const QByteArray* halfChunk);
00048         bool doStart(const QStringList& args, const QString& wd);
00049         ulong readNewData(bool lastBuffer);
00050 
00051         Git* git;
00052         FileHistory* fh;
00053         QByteArray* halfChunk;
00054         QTime loadTime;
00055         QTimer guiUpdateTimer;
00056         ulong loadedBytes;
00057         bool isProcExited;
00058         bool parsing;
00059         bool canceling;
00060 
00061 #ifdef USE_QPROCESS
00062         QProcess* proc;
00063 #else
00064         MyProcess* proc;
00065         QString procPID;
00066         QString scriptFileName;
00067         QString dataFileName;
00068         QFile dataFile;
00069 #endif
00070 };
00071 
00072 #endif

Generated on Fri Dec 7 21:57:37 2007 for QGit by  doxygen 1.5.3