00001 /* 00002 00003 Copyright (C) 2005-2007 by Peter Dimov. 00004 00005 This file is part of Calitko (http://www.calitko.org). 00006 00007 Calitko is free software; you can redistribute it and/or modify 00008 it under the terms of the GNU General Public License as published by 00009 the Free Software Foundation; either version 2 of the License, or 00010 (at your option) any later version. 00011 00012 Calitko is distributed in the hope that it will be useful, 00013 but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 GNU General Public License for more details. 00016 00017 You should have received a copy of the GNU General Public License 00018 along with Calitko; if not, write to the Free Software 00019 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 00020 00021 */ 00022 00023 #ifndef PACKET_DUMP_TREE_VIEW_H 00024 #define PACKET_DUMP_TREE_VIEW_H 00025 00026 #include "PacketModel.h" 00027 00028 namespace UIs { 00030 00031 #define NUM_PACKETS 8 00032 00033 class PacketDumpTreeViewDelegate : public QItemDelegate 00034 { 00035 public: 00036 PacketDumpTreeViewDelegate (QWidget *parent=0) : QItemDelegate (parent){}; 00037 00038 void paint ( QPainter * painter, const QStyleOptionViewItem & option, const QModelIndex & index ) const; 00039 bool event (QEvent *e); 00040 }; 00041 00042 class ManagePacketsDialog : public QDialog 00043 { 00044 Q_OBJECT 00045 REFERENCE_OBJECT (ManagePacketsDialog) 00046 00047 public: 00048 ManagePacketsDialog(QWidget *parent = NULL); 00049 ~ManagePacketsDialog(); 00050 00051 PacketFlags packetFlags(); 00052 void setPacketFlags(PacketFlags &packetFlags); 00053 00054 private slots: 00055 void isDone(); 00056 00057 private: 00058 QCheckBox *packetCheckBox [NUM_PACKETS]; 00059 QVBoxLayout *mainLayout; 00060 QPushButton *doneButton; 00061 }; 00062 00063 class PacketDumpTreeView : public QTreeView 00064 { 00065 Q_OBJECT 00066 REFERENCE_OBJECT (PacketDumpTreeView) 00067 00068 public: 00069 PacketDumpTreeView (QWidget *parent = NULL, QAbstractItemModel *model = NULL); 00070 ~PacketDumpTreeView (); 00071 00072 protected: 00073 void mouseReleaseEvent ( QMouseEvent * e ); 00074 00075 public slots: 00076 void managePackets(); 00077 00078 private: 00079 QMenu *menu; 00080 ManagePacketsDialog *managePacketsDlg; 00081 PacketDumpTreeViewDelegate *delegate; 00082 }; 00083 00084 } // namespace UIs 00086 00087 #endif // PACKET_DUMP_TREE_VIEW_H