Version 2.6
[qgit4/redivivus.git] / src / dataloader.h
blob2557a636a6a48ab552a6c186df9b039ee1c5bdad
1 /*
2 Author: Marco Costalba (C) 2005-2007
4 Copyright: See COPYING file that comes with this distribution
6 */
7 #ifndef DATALOADER_H
8 #define DATALOADER_H
10 #include <QProcess>
11 #include <QTime>
12 #include <QTimer>
14 class Git;
15 class FileHistory;
16 class QString;
17 class UnbufferedTemporaryFile;
19 // data exchange facility with 'git log' could be based on QProcess or on
20 // a temporary file (default). Uncomment following line to use QProcess
21 // #define USE_QPROCESS
23 class DataLoader : public QProcess {
24 Q_OBJECT
25 public:
26 DataLoader(Git* g, FileHistory* f);
27 ~DataLoader();
28 bool start(const QStringList& args, const QString& wd, const QString& buf);
30 signals:
31 void newDataReady(const FileHistory*);
32 void loaded(FileHistory*,ulong,int,bool,const QString&,const QString&);
34 private slots:
35 void on_finished(int, QProcess::ExitStatus);
36 void on_cancel();
37 void on_cancel(const FileHistory*);
38 void on_timeout();
40 private:
41 void parseSingleBuffer(const QByteArray& ba);
42 void baAppend(QByteArray** src, const char* ascii, int len);
43 void addSplittedChunks(const QByteArray* halfChunk);
44 bool createTemporaryFile();
45 ulong readNewData(bool lastBuffer);
47 Git* git;
48 FileHistory* fh;
49 QByteArray* halfChunk;
50 UnbufferedTemporaryFile* dataFile;
51 QTime loadTime;
52 QTimer guiUpdateTimer;
53 ulong loadedBytes;
54 bool isProcExited;
55 bool parsing;
56 bool canceling;
59 #endif