1 #ifndef SEAFILE_CLIENT_FILE_BROWSER_PROGRESS_DIALOG_H
2 #define SEAFILE_CLIENT_FILE_BROWSER_PROGRESS_DIALOG_H
3 
4 #include <QProgressDialog>
5 #include <QObject>
6 #include <QTimer>
7 
8 #include "tasks.h"
9 
10 class QProgressBar;
11 class QLabel;
12 
13 
14 class FileBrowserProgressDialog : public QProgressDialog {
15     Q_OBJECT
16 public:
17     FileBrowserProgressDialog(FileNetworkTask *task, QWidget *parent=0);
18     ~FileBrowserProgressDialog();
19 
20     typedef enum {
21         ActionRetry = 0,
22         ActionSkip,
23         ActionAbort,
24     } ActionOnFailure;
25 
26 public slots:
27     void cancel();
28 
29 private slots:
30     void onProgressUpdate(qint64 processed_bytes, qint64 total_bytes);
31     void onCurrentNameUpdate(QString current_name);
32     void onTaskFinished(bool success);
33     void initTaskInfo();
34     void onOneFileUploadFailed(const QString& filename, bool single_file);
35     void onQueryUpdate();
36     void onQuerySuccess(const ServerIndexProgress& result);
37     void onQueryFailed(const ApiError& error);
38     ActionOnFailure retryOrSkipOrAbort(const QString& msg, bool single_file);
39 
40 private:
41     void initUI();
42 
43     FileNetworkTask* task_;
44     QPushButton *cancel_button_;
45     QLabel *description_label_;
46     QLabel *more_details_label_;
47     QProgressBar *progress_bar_;
48     QUrl progress_url_;
49     QString progerss_id_;
50     GetIndexProgressRequest *progress_request_;
51     QTimer *index_progress_timer_;
52     bool task_finished_;
53 };
54 
55 #endif // SEAFILE_CLIENT_FILE_BROWSER_PROGRESS_DIALOG_H
56