00001 #ifndef FOLDERTABLEVIEW_H 00002 #define FOLDERTABLEVIEW_H 00003 00004 #include <QtCore/QHash> 00005 #include <QtCore/QModelIndex> 00006 #include <QtGui/QTableView> 00007 00008 class QContextMenuEvent; 00009 class QItemSelectionModel; 00010 class QWidget; 00011 class FolderTableModel; 00012 class FolderTableDelegate; 00013 class FillCellsDialog; 00014 00015 00016 class FolderTableView : public QTableView 00017 { 00018 Q_OBJECT 00019 00020 public: 00021 FolderTableView( QWidget* parent, FolderTableModel* theModel ); 00022 ~FolderTableView(); 00023 void enableSorting( bool enabled = true ); 00024 void setRowsHidden( QList< int > rows, bool hide ); 00025 void showAllRows(); 00026 00027 FolderTableModel* getFolderTableModel() const; 00028 00029 protected: 00030 void contextMenuEvent( QContextMenuEvent* event ); 00031 00032 private: 00033 enum SelectionCategories { oldRows, newRows, duplicateOldRows, duplicateNewRows }; 00034 FolderTableModel* folderTableModel; 00035 FillCellsDialog* fillCellsDialog; 00036 QAction* actionClone; 00037 QAction* actionCommit; 00038 QAction* actionRemove; 00039 QAction* actionFillCells; 00040 QAction* actionDisplayAsDec; 00041 QAction* actionDisplayAsHex; 00042 QAction* actionDisplayAsOct; 00043 QAction* actionDisplayAsDateTime; 00044 QAction* actionDisplayAs_Remove; 00045 QItemSelectionModel* currentSelectionModel; 00046 FolderTableDelegate* folderTableDelegate; 00047 QHash< SelectionCategories, QModelIndexList > selectionInspectionResults; 00048 00049 void createActions(); 00050 int selectionRowCount( QModelIndexList& currentSelectionList ); 00051 void testSelection( QModelIndexList& currentSelectionList ); 00052 QModelIndexList excludeHiddenItems( QModelIndexList fullSelection ); 00053 void focusInEvent( QFocusEvent* event ); 00054 void focusOutEvent( QFocusEvent* event ); 00055 00056 signals: 00057 void checkButtons( bool force = true ); 00058 void updateFilterTarget( FolderTableModel*, QString ); 00059 00060 private slots: 00061 void slotNewRow(); 00062 void slotCommit(); 00063 void slotRemove(); 00064 void slotFillCells(); 00065 void slotDisplayAsHex(); 00066 void slotDisplayAsDec(); 00067 void slotDisplayAsOct(); 00068 void slotDisplayAs_Remove(); 00069 void slotDisplayAsDateTime(); 00070 void slotSetFocus(); 00071 void slotApplyFilter( FolderTableModel* tableModel, QList< int > hiddenRows ); 00072 00073 }; 00074 00075 #endif 00076