Thumbnail me
3.0
|
00001 /***************************************************************************/ 00022 /* 00023 Copyright (c) 2009, ImageShack Corp. 00024 All rights reserved. 00025 00026 Redistribution and use in source and binary forms, with or without modification, 00027 are permitted provided that the following conditions are met: 00028 * Redistributions of source code must retain the above copyright notice, this 00029 list of conditions and the following disclaimer. 00030 * Redistributions in binary form must reproduce the above copyright notice, 00031 this list of conditions and the following disclaimer in the documentation 00032 and/or other materials provided with the distribution. 00033 * Neither the name of the ImageShack nor the names of its contributors may be 00034 used to endorse or promote products derived from this software without 00035 specific prior written permission. 00036 00037 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 00038 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 00039 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 00040 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 00041 FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 00042 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 00043 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 00044 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 00045 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 00046 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00047 */ 00048 00049 00050 #ifndef HEADER_IMAGESHACKUPLOADWIDGET 00051 #define HEADER_IMAGESHACKUPLOADWIDGET 00052 00053 #include <QtGui/QWidget> 00054 #include <QDebug> 00055 #include <QList> 00056 #include <QMap> 00057 #include <QMovie> 00058 #include <QSettings> 00059 #include "libQt+.h" 00060 #include "ImageShackUploader/ImageShackObject.hpp" 00061 #include "ImageShackUploader/ImageShackUploader.hpp" 00062 #include "ImageShackUploader/ImageShackError.hpp" 00063 #include "ImageShackResultWidget.h" 00064 #include "defines.h" 00065 00066 namespace Ui {class ImageShackUploadWidget;} 00067 00068 class ImageShackLoginWidget; 00069 00070 class ImageShackUploadWidget : public QWidget { 00071 00072 Q_OBJECT 00073 Q_DISABLE_COPY(ImageShackUploadWidget) 00074 00075 public: 00076 explicit ImageShackUploadWidget(QWidget *parent = 0); 00077 explicit ImageShackUploadWidget(QPixmap *pixmapToUpload, QWidget *parent = 0); 00078 virtual ~ImageShackUploadWidget(); 00079 00080 public: 00081 QStringList getTags(); 00082 bool getPrivacy(); 00083 void addData(QStringList pathFilesToUpload); 00084 00085 private: 00086 void init(QWidget *parent=0); 00087 void enableLoginSection(bool state); 00088 void updateImageShackObject(); 00089 QNetworkProxy *readProxySettings(); 00090 QString cleanup(QString); 00091 00092 protected: 00093 void changeEvent(QEvent* event); 00094 void closeEvent(QCloseEvent* event); 00095 00096 private: 00097 Ui::ImageShackUploadWidget *m_ui; 00098 ImageShackUploader *imageShackUploader; 00099 ImageShackResultWidget *imageShackResultWidget; 00100 ImageShackLoginWidget *imageShackLoginWidget; 00101 QSettings *settings; 00102 QMap <int, QString> items; 00103 QList <ImageShackObject*> objectsList; 00104 bool loggedIn; 00105 int current; 00106 00107 private slots: 00108 void loginStatusReceiver(bool); 00109 void upload(); 00110 void manageProgressBar(ImageShackObject * fileUploaded , qint64 bytesReceived,qint64 bytesTotal); 00111 void manageUploads(ImageShackResponse * uploadResponse); 00112 void manageErrors(ImageShackError::UploadError); 00113 void showResults(); 00114 void abort(); 00115 00116 public slots: 00117 void reset(); 00118 }; 00119 00120 #endif // HEADER_IMAGESHACKUPLOADWIDGET