00001 /* 00002 * wxChecksums 00003 * Copyright (C) 2003-2004 Julien Couot 00004 * 00005 * This program is free software; you can redistribute it and/or 00006 * modify it under the terms of the GNU General Public License 00007 * as published by the Free Software Foundation; either version 2 00008 * of the License, or (at your option) any later version. 00009 * 00010 * This program is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 * GNU General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU General Public License 00016 * along with this program; if not, write to the Free Software 00017 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00018 */ 00019 00020 /** 00021 * \file dlgMultiCheck.hpp 00022 * Dialog for checking multiple checksums' files. 00023 */ 00024 00025 #ifndef INC_DLGMULTICHECK_HPP 00026 #define INC_DLGMULTICHECK_HPP 00027 00028 //--------------------------------------------------------------------------- 00029 // For compilers that support precompilation, includes "wx.h". 00030 #include <wx/wxprec.h> 00031 00032 #ifdef __BORLANDC__ 00033 #pragma hdrstop 00034 #endif 00035 00036 #ifndef WX_PRECOMP 00037 // Include your minimal set of headers here, or wx.h 00038 #include <wx/wx.h> 00039 #endif 00040 #include <wx/filename.h> 00041 00042 #include "dlgResProg.hpp" 00043 #include "bytedisp.hpp" 00044 #include "checksum.hpp" 00045 //--------------------------------------------------------------------------- 00046 00047 00048 /** 00049 * Dialog which displays results of multiple files checking. 00050 */ 00051 class dlgMultiCheck : public dlgResultsProgress 00052 { 00053 public: 00054 // Creates a new dialog. 00055 dlgMultiCheck(); 00056 00057 protected: 00058 // Creates a new dialog. 00059 dlgMultiCheck(wxWindow *parent); 00060 00061 public: 00062 // The class descructor. 00063 virtual ~dlgMultiCheck() {} 00064 00065 // Creates and initializes the controls of the dialog. 00066 void createControls(); 00067 00068 protected: 00069 wxStaticText* lblTotal; ///< Current checksum file (number/total). 00070 wxGauge* gauTotal; ///< Current checksum file (gauge). 00071 wxStaticText* lblChecksumFile; ///< Current file in checksums' file (number/total). 00072 wxGauge* gauChecksumFile; ///< Current file in checksums' file (gauge). 00073 wxStaticText* lblFile; ///< Current file (bytes read/total). 00074 wxGauge* gauFile; ///< Current file (gauge). 00075 00076 // Processes button Cancel. 00077 void btnCancelClick(wxCommandEvent& event); 00078 00079 DECLARE_EVENT_TABLE() 00080 00081 private: 00082 DECLARE_DYNAMIC_CLASS(dlgMultiCheck) 00083 00084 protected: 00085 unsigned long filesToCheck; ///< Number of files to check. 00086 unsigned long fileChecked; ///< Number of the current file to be checked. 00087 unsigned long filesInChecksumsFile; ///< Number of files in the current checksums' file. 00088 unsigned long fileInChecksumsFile; ///< Number of the current file in the current checksums' file. 00089 BytesDisplayer totalBytes; ///< Number of bytes of the current checked file. 00090 BytesDisplayer bytesRead; ///< Number of read bytes in the current checked file. 00091 00092 public: 00093 // Gets the number of files to check. 00094 unsigned long getFilesToCheck() const; 00095 // Sets the number of files to check. 00096 void setFilesToCheck(unsigned long nbTotalChecksumsFiles); 00097 00098 // Gets the number of the current file to be check. 00099 unsigned long getFileToBeChecked() const; 00100 // Sets the number of files to check. 00101 void setFileToBeChecked(unsigned long nbChecksumsFiles); 00102 00103 // Gets the number of files in the current checksums' file. 00104 unsigned long getFilesInChecksumsFile() const; 00105 // Sets the number of files in the current checksums' file. 00106 void setFilesInChecksumsFile(unsigned long nbTotalInChecksumsFiles); 00107 00108 // Gets the number of the current file in the current checksums' file. 00109 unsigned long getFileInChecksumsFile() const; 00110 // Sets the number of the current file in the current checksums' file. 00111 void setFileInChecksumsFile(unsigned long nbInChecksumsFiles); 00112 00113 // Gets the number of bytes of the current checked file in the current checked checksums' file. 00114 BytesDisplayer getTotalBytes() const; 00115 // Sets the number of bytes of the current checked file in the current checked checksums' file. 00116 void setTotalBytes(const BytesDisplayer& bytes); 00117 00118 // Gets the number of bytes read of the current checked file in the current checked checksums' file. 00119 BytesDisplayer getReadBytes() const; 00120 // Sets the number of bytes read of the current checked file in the current checked checksums' file. 00121 void setReadBytes(const BytesDisplayer& bytes); 00122 00123 protected: 00124 // Update the information of the total of the checksums' files to be checked. 00125 void updateTotalChecksumsFiles(); 00126 00127 // Update the information of the files in the checksums' files to be checked. 00128 void updateFilesInChecksumsFiles(); 00129 00130 // Update the information of the current checked file. 00131 void updateCurrentCheckedFile(); 00132 00133 // Statistics on the files. 00134 class FilesStatistics; 00135 00136 // Checks a file. 00137 static void checkFile(const wxFileName& fileName, Checksum* cc, const wxString& checksum, dlgMultiCheck& dlgPrg, FilesStatistics& stats); 00138 00139 public: 00140 // Checks multiple checksums' files. 00141 static void checkChecksumsFiles(const wxArrayString& files, wxWindow* parent = NULL); 00142 00143 private: 00144 // Progress updater 00145 class ChecksumProgress; 00146 }; 00147 //--------------------------------------------------------------------------- 00148 00149 #endif // INC_DLGMULTICHECK_HPP