00001 /* 00002 * Copyright (C) 2009, Edmundo Albuquerque de Souza e Silva. 00003 * 00004 * This file may be distributed under the terms of the Q Public License 00005 * as defined by Trolltech AS of Norway and appearing in the file 00006 * LICENSE.QPL included in the packaging of this file. 00007 * 00008 * THIS FILE IS PROVIDED AS IS WITH NO WARRANTY OF ANY KIND, INCLUDING 00009 * THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR 00010 * PURPOSE. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, 00011 * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING 00012 * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, 00013 * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION 00014 * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 00015 * 00016 */ 00017 00018 #ifndef __RIOCOPY_H__ 00019 #define __RIOCOPY_H__ 00020 00021 #include <qprogressdialog.h> 00022 00023 #include <qlabel.h> 00024 #include <qdialog.h> 00025 #include <qprogressbar.h> 00026 00027 #include "RioQt.h" 00028 #include "FileWindow.h" 00029 #include "RioExplorer.h" 00030 00031 class RioQt; 00032 class FileWindow; 00033 00034 class RioCopy : public QDialog 00035 { 00036 Q_OBJECT 00037 00038 private: 00039 QLabel *lbl_copying_file; 00040 QLabel *lbl_current_file; 00041 QLabel *lbl_overall; 00042 QProgressBar *pb_current_file; 00043 QProgressBar *pb_overall; 00044 00045 RioQt *rioQt; 00046 RioExplorer *rioExplorer; 00047 CRioSession *src_session; 00048 CRioSession *dest_session; 00049 QStringList *source_list; 00050 string dest_file; 00051 00052 bool copy_running; 00053 bool copy_allowed; 00054 FileWindow *destFileWindow; 00055 00056 pthread_t thread; 00057 00058 string current_file; 00059 RioObjectSize current_file_completed; 00060 RioObjectSize current_file_size; 00061 RioObjectSize total_completed; 00062 RioObjectSize total_size; 00063 00064 /* Maximum length of the current file being copied 00065 * Note: this constant limits the progress dialog width 00066 */ 00067 static const unsigned int CURRENT_FILE_MAX_LENGTH = 25; 00068 00069 QString truncateFileName( string ); 00070 void closeEvent( QCloseEvent * ); 00071 00072 private slots: 00073 virtual bool userCancel( void ); 00074 00075 public: 00076 RioCopy( RioQt *, 00077 RioExplorer *, 00078 CRioSession *, CRioSession *, 00079 QStringList *, QString, 00080 FileWindow * ); 00081 00082 bool doCopy( void ); 00083 void updateProgress( void ); 00084 }; 00085 00086 #endif