Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members

ChecksumsListView Class Reference

The list that will display information about checksums. More...

#include <lvwSums.hpp>

Collaboration diagram for ChecksumsListView:

Collaboration graph
[legend]
List of all members.

Public Types

enum  Columns { FILE_NAME = 0, DIRECTORY, CHECKSUM_VALUE, STATE }
 Columns enumeration. More...

enum  SortOrder { NONE, ASCENDING, DESCENDING }
 Sort order of the column. More...


Public Member Functions

void addFiles (const wxArrayString &files)
 Adds files to the list of checksums.

void check ()
 Checks the files.

 ChecksumsListView (wxWindow *parent, wxWindowID id, SumFile *checksumFile, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxLC_REPORT, const wxValidator &validator=wxDefaultValidator, const wxString &name=wxT("checksumslistview"))
 Constructor, creating and showing a list control.

 ChecksumsListView ()
 Default constructor.

void DnDFiles (wxCommandEvent &event)
 Processes a drop of files on the list.

void getColumns (Columns cols[LVW_SUMS_NBCOLS])
 Gets the columns.

int getColumnToSort () const
 Gets the column to be sorted.

SortOrder getSortOrder () const
 Gets to sort order.

wxArrayInt getStates (const bool onlySelected=false) const
 Gets the total of each state in the list of checksums.

SumFilegetSumFile () const
 Gets a pointer on the checksum file.

void init ()
 Initializes the list parameters.

void invertSelection ()
 Inverts the selection.

bool openChecksumFile (const wxFileName &fileName)
 Open a checksum file.

void recompute ()
 Recomputes the checksums.

void reformat ()
 Reformats the list.

void removeSelectedChecksums ()
 Removes the selected checksums from the list.

void selectAll ()
 Selects all the items.

void selectDirectoriesToAdd ()
 Open a dialog to select the directories to add to the list.

void selectFilesToAdd ()
 Open a dialog to select the files to add to the list.

void selectMatchingFilesToAdd ()
 Open a dialog to select files to add from matching patterns.

bool setColumns (Columns newColumns[LVW_SUMS_NBCOLS])
 Sets the columns.

void setColumnToSort (const int col, const SortOrder newSortOrder)
 Sets the column to be sorted.

void setColumnToSort (const int col)
 Sets the column to be sorted.

void setSortOrder (const SortOrder newSortOrder)
 Sets the sort order.

void setSumFile (SumFile *pSumFile)
 Sets the checksum file.

void sort ()
 Sort the list.

wxString sumUpStates (const bool onlySelected=false) const
 Sums up the total of each state in the list of checksums.

virtual ~ChecksumsListView ()
 Destructor.


Static Public Member Functions

wxString getColumnName (const Columns col)
 Gets the name of a column.


Protected Types

enum  { ITP_FILESADD = wxID_HIGHEST + 1000, ITP_DIRECTORIESADD, ITP_ADDMATCHINGFILES, ITP_REMOVE }

Protected Member Functions

long addChecksum (const long key, const wxString &stateMsg)
 Adds a checksum in the list.

bool isInList (const wxString &fileName)
 Indicates if the specified file is present in the list.

void itpAddDirectoriesClick (wxCommandEvent &event)
 Event handler a pop-up menu click on 'Add directories...'.

void itpAddFilesClick (wxCommandEvent &event)
 Event handler a pop-up menu click on 'Add files...'.

void itpAddMatchingFilesClick (wxCommandEvent &event)
 Event handler a pop-up menu click on 'Add matching files...'.

void itpRemoveClick (wxCommandEvent &event)
 Event handler a pop-up menu click on 'Remove'.

void OnRightUp (wxMouseEvent &event)
 Event handler for the context menu demand.

void reformat (Columns oldColumns[LVW_SUMS_NBCOLS])
 Reformats the list.

bool removeFilesInList (wxArrayString &files, wxArrayString *in=NULL)
 Removes the files that are already in the listview.

void setChecksum (long item, const wxString &stateMsg)
 Sets an item.

void setChecksumState (long item, const ChecksumData::State state, const wxString &msg)
 Sets the state of a checksum.

void ShowContextMenu (const wxPoint &p)
 Shows the context menu.


Protected Attributes

int colToSort
 Column to sort.

Columns columns [LVW_SUMS_NBCOLS]
 List of the columns (size = nb elements of enum Columns).

SortOrder sortOrder
 Sort order.

SumFilesumFile
 Checksums file linked with the list.


Detailed Description

The list that will display information about checksums.

Definition at line 50 of file lvwSums.hpp.


Member Enumeration Documentation

enum ChecksumsListView::Columns
 

Columns enumeration.

Definition at line 84 of file lvwSums.hpp.

Referenced by reformat(), and setColumns().

enum ChecksumsListView::SortOrder
 

Sort order of the column.

Definition at line 76 of file lvwSums.hpp.

Referenced by getSortOrder().


Constructor & Destructor Documentation

ChecksumsListView::ChecksumsListView  ) 
 

Default constructor.

Definition at line 355 of file lvwSums.cpp.

References init(), and sumFile.

ChecksumsListView::ChecksumsListView wxWindow *  parent,
wxWindowID  id,
SumFile checksumFile,
const wxPoint &  pos = wxDefaultPosition,
const wxSize &  size = wxDefaultSize,
long  style = wxLC_REPORT,
const wxValidator &  validator = wxDefaultValidator,
const wxString &  name = wxT("checksumslistview")
 

Constructor, creating and showing a list control.

Parameters:
parent Parent window. Must not be NULL.
id Window identifier. A value of -1 indicates a default value.
checksumFile The checksum file linked with this listview.
pos Window position.
size Window size. If the default size (-1, -1) is specified then the window is sized appropriately.
style Window style. See wxListCtrl.
validator Window validator.
name Window name.

Definition at line 377 of file lvwSums.cpp.

References init(), and sumFile.

ChecksumsListView::~ChecksumsListView  )  [virtual]
 

Destructor.

Definition at line 393 of file lvwSums.cpp.

References sumFile.


Member Function Documentation

long ChecksumsListView::addChecksum const long  key,
const wxString &  stateMsg
[protected]
 

Adds a checksum in the list.

Parameters:
key Key of the item in the file of checksums.
stateMsg Information about the state.
Returns:
The index of the new item.

Definition at line 1082 of file lvwSums.cpp.

References addChecksum(), SumFile::getChecksumData(), ChecksumData::getState(), setChecksum(), setChecksumState(), and sumFile.

Referenced by addChecksum(), addFiles(), and setSumFile().

void ChecksumsListView::addFiles const wxArrayString &  files  ) 
 

Adds files to the list of checksums.

This function will search recursively files in subdirectories. All the files and all the directories that are provided in the array must be in absolute path.

Parameters:
files A list of files and directories to add.

Definition at line 809 of file lvwSums.cpp.

References addChecksum(), SumFile::addChecksumData(), addFiles(), ChecksumFileCalculator::calculate(), ChecksumsListView::ChecksumProgress::finished(), SumFile::getChecksumCalculator(), getSumFile(), removeFilesInList(), ChecksumsListView::ChecksumProgress::setFileName(), sort(), and sumFile.

Referenced by addFiles(), DnDFiles(), frmSums::initializeFromCmdLine(), selectDirectoriesToAdd(), selectFilesToAdd(), and selectMatchingFilesToAdd().

void ChecksumsListView::check  ) 
 

Checks the files.

Definition at line 1331 of file lvwSums.cpp.

References ChecksumFileCalculator::check(), ChecksumsListView::ChecksumProgress::finished(), AppPrefs::get(), ChecksumData::getChecksum(), SumFile::getChecksumCalculator(), SumFile::getChecksumData(), ChecksumData::getFileName(), getSumFile(), AppPrefs::readBool(), setChecksumState(), ChecksumsListView::ChecksumProgress::setFileName(), sort(), sumFile, sumUpStates(), wxCGetFileLength, and wxCOff_t.

Referenced by frmSums::initializeFromCmdLine(), frmSums::itmSumsCheckClick(), and openChecksumFile().

void ChecksumsListView::DnDFiles wxCommandEvent &  event  ) 
 

Processes a drop of files on the list.

Parameters:
event event parameters.

Definition at line 1640 of file lvwSums.cpp.

References addFiles(), DnDFiles(), getSumFile(), and openChecksumFile().

Referenced by DnDFiles().

wxString ChecksumsListView::getColumnName const Columns  col  )  [static]
 

Gets the name of a column.

Parameters:
col The column which the name will be returned.
Returns:
The name of a column.

Definition at line 1811 of file lvwSums.cpp.

References getColumnName().

Referenced by getColumnName(), init(), and reformat().

void ChecksumsListView::getColumns Columns  cols[LVW_SUMS_NBCOLS]  ) 
 

Gets the columns.

Parameters:
cols Array that will contain the columns.

Definition at line 1676 of file lvwSums.cpp.

References columns, getColumns(), and LVW_SUMS_NBCOLS.

Referenced by frmSums::FrameClose(), getColumns(), frmSums::itmSumsSortByClick(), frmSums::itmSumsSortByUpdate(), frmSums::itmToolsConfigureClick(), and SumListCompareFnct().

int ChecksumsListView::getColumnToSort  )  const
 

Gets the column to be sorted.

Returns:
The column to be sorted.

Definition at line 476 of file lvwSums.cpp.

References colToSort.

Referenced by frmSums::FrameClose(), frmSums::itmSumsSortByUpdate(), frmSums::lvwSumsColumnClick(), and SumListCompareFnct().

ChecksumsListView::SortOrder ChecksumsListView::getSortOrder  )  const
 

Gets to sort order.

Returns:
The sort order.

Definition at line 441 of file lvwSums.cpp.

References sortOrder, and SortOrder.

Referenced by frmSums::FrameClose(), frmSums::itmSumsSortByUpdate(), frmSums::lvwSumsColumnClick(), and SumListCompareFnct().

wxArrayInt ChecksumsListView::getStates const bool  onlySelected = false  )  const
 

Gets the total of each state in the list of checksums.

Parameters:
onlySelected If true gets the state of the selected checksums/files. If false gets the state of all the files.
Returns:
An array that contains the total of each state in the list of checksums or an empty array if there is no checksum file opened.

Definition at line 1204 of file lvwSums.cpp.

References CD_STATE_COUNT, SumFile::getChecksumData(), ChecksumData::getState(), getStates(), and getSumFile().

Referenced by frmSums::closeAfterInitFromCmdLine(), getStates(), frmSums::saveChecksumFile(), and sumUpStates().

SumFile * ChecksumsListView::getSumFile  )  const
 

Gets a pointer on the checksum file.

Returns:
A pointer on the checksum file.

Definition at line 607 of file lvwSums.cpp.

References sumFile.

Referenced by addFiles(), check(), frmSums::checkFileBeforeClose(), DnDFiles(), frmSums::FrameClose(), getStates(), frmSums::initializeFromCmdLine(), frmSums::itmFileCloseClick(), frmSums::itmFileOpenRecentClick(), frmSums::itmFileSaveAsClick(), frmSums::itmFileSaveClick(), recompute(), removeSelectedChecksums(), frmSums::saveChecksumFile(), selectDirectoriesToAdd(), selectFilesToAdd(), selectMatchingFilesToAdd(), sort(), SumListCompareFnct(), sumUpStates(), and frmSums::updateTitle().

void ChecksumsListView::init  ) 
 

Initializes the list parameters.

Definition at line 407 of file lvwSums.cpp.

References columns, getColumnName(), and setColumnToSort().

Referenced by ChecksumsListView().

void ChecksumsListView::invertSelection  ) 
 

Inverts the selection.

Definition at line 672 of file lvwSums.cpp.

Referenced by frmSums::itmSumsInvertSelectionClick().

bool ChecksumsListView::isInList const wxString &  fileName  )  [protected]
 

Indicates if the specified file is present in the list.

The given file name must be an absolute path.

Parameters:
fileName File name to test the presence in the list.
Returns:
true if the file is present in the list, false otherwise.

Definition at line 1051 of file lvwSums.cpp.

References SumFile::getChecksumDataBegin(), SumFile::getChecksumDataEnd(), SumFile::getFileName(), isInList(), and sumFile.

Referenced by isInList().

void ChecksumsListView::itpAddDirectoriesClick wxCommandEvent &  event  )  [protected]
 

Event handler a pop-up menu click on 'Add directories...'.

Parameters:
event event parameters.

Definition at line 1604 of file lvwSums.cpp.

References itpAddDirectoriesClick(), and selectDirectoriesToAdd().

Referenced by itpAddDirectoriesClick().

void ChecksumsListView::itpAddFilesClick wxCommandEvent &  event  )  [protected]
 

Event handler a pop-up menu click on 'Add files...'.

Parameters:
event event parameters.

Definition at line 1592 of file lvwSums.cpp.

References itpAddFilesClick(), and selectFilesToAdd().

Referenced by itpAddFilesClick().

void ChecksumsListView::itpAddMatchingFilesClick wxCommandEvent &  event  )  [protected]
 

Event handler a pop-up menu click on 'Add matching files...'.

Parameters:
event event parameters.

Definition at line 1616 of file lvwSums.cpp.

References itpAddMatchingFilesClick(), and selectMatchingFilesToAdd().

Referenced by itpAddMatchingFilesClick().

void ChecksumsListView::itpRemoveClick wxCommandEvent &  event  )  [protected]
 

Event handler a pop-up menu click on 'Remove'.

Parameters:
event event parameters.

Definition at line 1628 of file lvwSums.cpp.

References itpRemoveClick(), and removeSelectedChecksums().

Referenced by itpRemoveClick().

void ChecksumsListView::OnRightUp wxMouseEvent &  event  )  [protected]
 

Event handler for the context menu demand.

Parameters:
event event parameters.

Definition at line 1544 of file lvwSums.cpp.

References OnRightUp(), and ShowContextMenu().

Referenced by OnRightUp().

bool ChecksumsListView::openChecksumFile const wxFileName &  fileName  ) 
 

Open a checksum file.

Parameters:
fileName Name of the file to open.
Returns:
true if the has has been opened successfully, false otherwise.

Definition at line 1295 of file lvwSums.cpp.

References check(), AppPrefs::get(), AppPrefs::readBool(), and setSumFile().

Referenced by frmSums::initializeFromCmdLine(), frmSums::itmFileOpenClick(), and frmSums::itmFileOpenRecentClick().

void ChecksumsListView::recompute  ) 
 

Recomputes the checksums.

Definition at line 1429 of file lvwSums.cpp.

References ChecksumFileCalculator::calculate(), ChecksumsListView::ChecksumProgress::finished(), ChecksumData::getChecksum(), SumFile::getChecksumCalculator(), SumFile::getChecksumData(), ChecksumData::getFileName(), getSumFile(), setChecksum(), ChecksumData::setChecksum(), SumFile::setChecksumData(), setChecksumState(), ChecksumsListView::ChecksumProgress::setFileName(), sort(), sumFile, wxCGetFileLength, and wxCOff_t.

Referenced by frmSums::itmSumsRecomputeClick().

void ChecksumsListView::reformat  ) 
 

Reformats the list.

Definition at line 1520 of file lvwSums.cpp.

Referenced by setColumns().

void ChecksumsListView::reformat Columns  oldColumns[LVW_SUMS_NBCOLS]  )  [protected]
 

Reformats the list.

Parameters:
oldColumns Old order of the columns. NULL if the order has not changed.

Definition at line 1752 of file lvwSums.cpp.

References Columns, columns, getColumnName(), LVW_SUMS_NBCOLS, setChecksum(), and sort().

Referenced by frmSums::initializeFromCmdLine(), frmSums::itmToolsConfigureClick(), and frmSums::saveChecksumFile().

bool ChecksumsListView::removeFilesInList wxArrayString &  files,
wxArrayString *  in = NULL
[protected]
 

Removes the files that are already in the listview.

Parameters:
files List of files to be checked. The files already present in the listview will be removed list of files.
in Pointer on an array string where the files already present in the listview will be stored. Could be NULL.
Returns:
true if the user hasn't canceled.

Definition at line 933 of file lvwSums.cpp.

References SumFile::getChecksumDataBegin(), SumFile::getChecksumDataCount(), SumFile::getChecksumDataEnd(), SumFile::getFileName(), dlgProgress::isPaused(), removeFilesInList(), removeFilesInListCompare(), sumFile, dlgProgress::Update(), and UPDATE_PROGRESS_DLG.

Referenced by addFiles(), and removeFilesInList().

void ChecksumsListView::removeSelectedChecksums  ) 
 

Removes the selected checksums from the list.

Definition at line 1177 of file lvwSums.cpp.

References getSumFile(), SumFile::removeChecksumData(), and sumFile.

Referenced by frmSums::itmSumsRemoveClick(), and itpRemoveClick().

void ChecksumsListView::selectAll  ) 
 

Selects all the items.

Definition at line 654 of file lvwSums.cpp.

Referenced by frmSums::itmSumsSelectAllClick().

void ChecksumsListView::selectDirectoriesToAdd  ) 
 

Open a dialog to select the directories to add to the list.

Definition at line 719 of file lvwSums.cpp.

References addFiles(), SumFile::getFileName(), getSumFile(), and sumFile.

Referenced by frmSums::itmSumsAddDirectoriesClick(), and itpAddDirectoriesClick().

void ChecksumsListView::selectFilesToAdd  ) 
 

Open a dialog to select the files to add to the list.

Definition at line 690 of file lvwSums.cpp.

References addFiles(), wxFileDialogFilterMaker::AddFilter(), SumFile::getFileName(), wxFileDialogFilterMaker::GetFilters(), getSumFile(), and sumFile.

Referenced by frmSums::itmSumsAddFilesClick(), and itpAddFilesClick().

void ChecksumsListView::selectMatchingFilesToAdd  ) 
 

Open a dialog to select files to add from matching patterns.

Definition at line 743 of file lvwSums.cpp.

References dlgAddMatchFiles::ArrayMatchPattern::add(), addFiles(), dlgAddMatchFiles::ArrayMatchPattern::getCount(), dlgAddMatchFiles::getMatchPatterns(), and getSumFile().

Referenced by frmSums::itmSumsAddMatchingFilesClick(), and itpAddMatchingFilesClick().

void ChecksumsListView::setChecksum long  item,
const wxString &  stateMsg
[protected]
 

Sets an item.

This function doesn't set the item picture and the data associated with the item.

Parameters:
item Item to set.
stateMsg Information about the state.

Definition at line 1109 of file lvwSums.cpp.

References columns, AppPrefs::get(), ChecksumData::getChecksum(), SumFile::getChecksumData(), SumFile::getFileName(), ChecksumData::getFileName(), LVW_SUMS_NBCOLS, AppPrefs::readBool(), setChecksum(), and sumFile.

Referenced by addChecksum(), recompute(), reformat(), and setChecksum().

void ChecksumsListView::setChecksumState long  item,
const ChecksumData::State  state,
const wxString &  msg
[protected]
 

Sets the state of a checksum.

Parameters:
item Item which to state should be modified.
state New state of the checksum corresponding to the item.
msg Information about the state.

Definition at line 1156 of file lvwSums.cpp.

References columns, SumFile::getChecksumData(), LVW_SUMS_NBCOLS, SumFile::setChecksumState(), setChecksumState(), and sumFile.

Referenced by addChecksum(), check(), recompute(), and setChecksumState().

bool ChecksumsListView::setColumns Columns  newColumns[LVW_SUMS_NBCOLS]  ) 
 

Sets the columns.

Parameters:
newColumns The new columns order.
Returns:
true if the order of the columns has been changed, false otherwise.

Definition at line 1691 of file lvwSums.cpp.

References columns, Columns, LVW_SUMS_NBCOLS, reformat(), and setColumns().

Referenced by frmSums::createControls(), frmSums::itmToolsConfigureClick(), and setColumns().

void ChecksumsListView::setColumnToSort const int  col,
const SortOrder  newSortOrder
 

Sets the column to be sorted.

Parameters:
col The column with witch the sort will be done.
newSortOrder New sort order.
See also:
getSortOrder(), setColumnToSort(int)

Definition at line 506 of file lvwSums.cpp.

References setColumnToSort(), and setSortOrder().

void ChecksumsListView::setColumnToSort const int  col  ) 
 

Sets the column to be sorted.

Parameters:
col The column with witch the sort will be done. If the given column is invalid, the first column of the list will be taken.

Definition at line 489 of file lvwSums.cpp.

References colToSort, and setColumnToSort().

Referenced by frmSums::createControls(), init(), frmSums::itmSumsSortByClick(), frmSums::lvwSumsColumnClick(), and setColumnToSort().

void ChecksumsListView::setSortOrder const SortOrder  newSortOrder  ) 
 

Sets the sort order.

Parameters:
newSortOrder New sort order. Must be ASCENDING or DESCENDING. If other value is given, ASCENDING is assumed by default.

Definition at line 455 of file lvwSums.cpp.

References setSortOrder(), and sortOrder.

Referenced by frmSums::itmSumsSortByClick(), frmSums::lvwSumsColumnClick(), setColumnToSort(), and setSortOrder().

void ChecksumsListView::setSumFile SumFile pSumFile  ) 
 

Sets the checksum file.

  • Deletes the old checksums' file instance in memory.
  • Deletes all the items.
  • Creates new item from the given checksums file if not NULL.

Parameters:
pSumFile A pointer on the new checksums file.
Remarks:
The given SumFile* instance will be deleted by this class.

Definition at line 625 of file lvwSums.cpp.

References addChecksum(), SumFile::getChecksumDataKeys(), setSumFile(), sort(), and sumFile.

Referenced by frmSums::initializeFromCmdLine(), frmSums::itmFileCloseClick(), frmSums::itmFileNewClick(), openChecksumFile(), and setSumFile().

void ChecksumsListView::ShowContextMenu const wxPoint &  p  )  [protected]
 

Shows the context menu.

Parameters:
p Position of the context menu.

Definition at line 1557 of file lvwSums.cpp.

References ShowContextMenu(), and sumFile.

Referenced by OnRightUp(), and ShowContextMenu().

void ChecksumsListView::sort  ) 
 

Sort the list.

Definition at line 589 of file lvwSums.cpp.

References getSumFile(), and SumListCompareFnct().

Referenced by addFiles(), check(), frmSums::itmSumsSortByClick(), frmSums::lvwSumsColumnClick(), recompute(), reformat(), and setSumFile().

wxString ChecksumsListView::sumUpStates const bool  onlySelected = false  )  const
 

Sums up the total of each state in the list of checksums.

Parameters:
onlySelected If true gets the state of the selected checksums/files. If false gets the state of all the files.
Returns:
A string which contains a sum up of the total of each state in the list of checksums or an empty string if there is no checksum file opened.

Definition at line 1240 of file lvwSums.cpp.

References getStates(), getSumFile(), and sumUpStates().

Referenced by check(), and sumUpStates().


Member Data Documentation

int ChecksumsListView::colToSort [protected]
 

Column to sort.

Definition at line 210 of file lvwSums.hpp.

Referenced by getColumnToSort(), and setColumnToSort().

Columns ChecksumsListView::columns[LVW_SUMS_NBCOLS] [protected]
 

List of the columns (size = nb elements of enum Columns).

Must contain once one of the elements of enum Columns.

Definition at line 116 of file lvwSums.hpp.

Referenced by getColumns(), init(), reformat(), setChecksum(), setChecksumState(), and setColumns().

SortOrder ChecksumsListView::sortOrder [protected]
 

Sort order.

Definition at line 209 of file lvwSums.hpp.

Referenced by getSortOrder(), and setSortOrder().

SumFile* ChecksumsListView::sumFile [protected]
 

Checksums file linked with the list.

Definition at line 208 of file lvwSums.hpp.

Referenced by addChecksum(), addFiles(), check(), ChecksumsListView(), getSumFile(), isInList(), recompute(), removeFilesInList(), removeSelectedChecksums(), selectDirectoriesToAdd(), selectFilesToAdd(), setChecksum(), setChecksumState(), setSumFile(), ShowContextMenu(), and ~ChecksumsListView().


The documentation for this class was generated from the following files:
Generated on Sun May 30 13:38:03 2004 for wxChecksums by doxygen 1.3.7