forked from KDE/kdev-upload
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathuploadjob.h
131 lines (107 loc) · 3.37 KB
/
uploadjob.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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
/***************************************************************************
* Copyright 2007 Niko Sams <niko.sams@gmail.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 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef UPLOADJOB_H
#define UPLOADJOB_H
#include <QDialog>
#include <QModelIndex>
class QProgressDialog;
class KJob;
namespace KIO {
class Job;
class CopyJob;
class JobUiDelegate;
class NetAccess;
}
namespace KDevelop {
class IProject;
class ProjectBaseItem;
}
class QStandardItemModel;
class QStandardItem;
class UploadProjectModel;
class UploadPlugin;
/**
* Class that does the Uploading.
* Used for Quick-Upload and in UploadDialog
*/
class UploadJob : public QObject
{
Q_OBJECT
public:
UploadJob(KDevelop::IProject* project, UploadProjectModel* model, QWidget *parent = nullptr);
~UploadJob() override;
/**
* Sets if the files should only be marked as uploaded
*/
void setOnlyMarkUploaded(bool v) {
m_onlyMarkUploaded = v;
}
bool onlyMarkUploaded() {
return m_onlyMarkUploaded;
}
/**
* Sets if the upload is a quick upload.
* If true, unmodified files will be logged too
*/
void setQuickUpload(bool q);
bool isQuickUpload();
/**
* Sets the output model that should be used to output the log messages
*/
void setOutputModel(QStandardItemModel* model);
QStandardItemModel* outputModel();
public Q_SLOTS:
/**
* Starts the upload
*/
void start();
private Q_SLOTS:
/**
* Upload the next (or first) item
*/
void uploadNext();
/**
* Called when current job is finished
*/
void uploadResult(KJob*);
/**
* Updates the progress bar
*/
void processedSize(KJob*, qulonglong);
/**
* Updates the progress text
*/
void uploadInfoMessage(KJob*, const QString& plain);
/**
* Cancel button in the ProgressDialog clicked
*/
void cancelClicked();
Q_SIGNALS:
/**
* Signal is emitted when the upload successfully finished
*/
void uploadFinished();
private:
/**
* Appends a message to the current outputModel.
* @return the QStandardItem* to modify it further (to eg. change color)
*/
QStandardItem* appendLog(const QString& message);
QModelIndex m_uploadIndex; ///< current index when the upload is running
KDevelop::IProject* m_project; ///< the project of this job
UploadProjectModel* m_uploadProjectModel;
QProgressDialog* m_progressDialog; ///< progress-dialog when the upload is running
int m_progressBytesDone; ///< uploaded bytes, incremented when a file is fully uploaded. used for progress.
bool m_onlyMarkUploaded; ///< if files should be only marked as uploaded
bool m_quickUpload; ///< if it is a quick upload
QStandardItemModel* m_outputModel;
};
#endif
// kate: space-indent on; indent-width 4; tab-width 4; replace-tabs on