1 /*
2  * LXImage-Qt - a simple and fast image viewer
3  * Copyright (C) 2013  PCMan <pcman.tw@gmail.com>
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License along
16  * with this program; if not, write to the Free Software Foundation, Inc.,
17  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18  *
19  */
20 
21 #ifndef LXIMAGE_UPLOADDIALOG_H
22 #define LXIMAGE_UPLOADDIALOG_H
23 
24 #include <QDialog>
25 #include <QFile>
26 
27 #include "ui_uploaddialog.h"
28 
29 namespace LxImage {
30 
31 class Upload;
32 
33 /**
34  * @brief Dialog for uploading an image
35  */
36 class UploadDialog : public QDialog
37 {
38     Q_OBJECT
39 
40 public:
41 
42     /**
43      * @brief Create a dialog for uploading the specified file
44      * @param parent widget parent
45      * @param filename absolute path to file
46      */
47     UploadDialog(QWidget *parent, const QString &filename);
48 
49 private Q_SLOTS:
50 
51     void on_actionButton_clicked();
52     void on_copyButton_clicked();
53 
54 private:
55 
56     void start();
57     void updateUi();
58     void showError(const QString &message);
59 
60     Ui::UploadDialog ui;
61 
62     enum {
63         SelectProvider,
64         UploadInProgress,
65         Completed,
66     } mState;
67 
68     QFile mFile;
69 
70     Upload *mUpload;
71 };
72 
73 }
74 
75 #endif // LXIMAGE_UPLOADDIALOG_H
76