-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathtaskrowviewhandler.h
97 lines (82 loc) · 3.03 KB
/
taskrowviewhandler.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
/*
Copyright (c) 2011 Carlos López Sánchez <musikolo{AT}hotmail[DOT]com>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef TASKROWVIEWHANDLER_H
#define TASKROWVIEWHANDLER_H
#include <QFile>
#include "core/report.h"
#include "httpconnector.h"
#include "httpconnectorlistener.h"
#include "taskschedulerjob.h"
#include "filedownloader.h"
class TaskViewHandler;
namespace Column {
enum ColumnEnum { TYPE, NAME, SIZE, STATUS, TIME };
}
class TaskRowViewHandler : public HttpConnectorListener
{
Q_OBJECT
private:
TaskViewHandler* viewHandler;
FileDownloader* downloader;
Report* report;
QFile* remoteTmpFile;
int rowIndex;
int seconds;
int transmissionSeconds;
bool finished;
uint jobId;
void setType( const QString& type);
void setName( const QString& name );
void setSize( qint64 size );
void setStatus( const QString& status, const QString& toolTip = QString() );
void setTime( int seconds );
void setReport( Report*const report );
void addRowItem(int column, const QString& text, const QString& toolTip = QString() );
void setupObject( const QString& type, const QString& name, int size = 0 );
QString getItemText( Column::ColumnEnum column ) const;
protected slots:
void onQueued();
void onScanningStarted();
void onErrorOccurred( const QString& message );
void onUploadProgressRate( qint64 bytesSent, qint64 bytesTotal );
void onRetrievingReport();
void onWaitingForReport( int seconds );
void onServiceLimitReached( int seconds );
void onAborted();
void onReportReady( Report*const report );
void onDownloadProgressRate( qint64 bytesSent, qint64 bytesTotal );
void onDownloadReady( QFile* resouce );
void onMaximunSizeExceeded( qint64 sizeAllowed, qint64 sizeTotal );
public slots:
void onNextSecond();
signals:
void reportCompleted( int rowIndex );
void unsubscribeNextSecond( TaskRowViewHandler* );
void rowRemoved( int rowIndex );
void maximunSizeExceeded( int rowIndex );
public:
TaskRowViewHandler( TaskViewHandler* viewHandler, int rowIndex );
virtual ~TaskRowViewHandler();
void submitFile( const QFile& file );
void submitRemoteFile( QNetworkAccessManager*const networkManager, const QUrl& url );
void submitUrl( const QUrl& url );
void setRowIndex( int index );
QString getName() const;
bool isFinished() { return finished; }
static int getHintColumnSize( int column, int availableWidth );
Report* getReport() const;
bool abort();
bool rescan();
};
#endif // TASKROWVIEWHANDLER_H