2 Description: files tree view
4 Author: Marco Costalba (C) 2005-2007
6 Copyright: See COPYING file that comes with this distribution
12 #include <QTreeWidget>
22 class FileItem
: public QTreeWidgetItem
{
24 FileItem(FileItem
* p
, SCRef nm
) : QTreeWidgetItem(p
, QStringList(nm
)) {}
25 FileItem(QTreeWidget
* p
, SCRef nm
) : QTreeWidgetItem(p
, QStringList(nm
)) {}
27 virtual QString
fullName() const;
31 class DirItem
: public FileItem
{
33 DirItem(QTreeWidget
* parent
, SCRef ts
, SCRef nm
);
34 DirItem(DirItem
* parent
, SCRef ts
, SCRef nm
);
37 friend class TreeView
;
42 class TreeView
: public QTreeWidget
{
45 TreeView(QWidget
* par
) : QTreeWidget(par
), d(NULL
), git(NULL
), treeIsValid(false) {}
46 void setup(Domain
* d
, Git
* g
);
47 void setTreeName(SCRef treeName
) { rootName
= treeName
; }
49 const QString
fullName(QTreeWidgetItem
* item
);
50 bool isDir(SCRef fileName
);
51 bool isModified(SCRef path
, bool isDir
= false);
53 void getTreeSelectedItems(QStringList
& selectedItems
);
54 bool getTree(SCRef tSha
, Git::TreeInfo
& ti
, bool wd
, SCRef tPath
);
56 const QPixmap
* folderClosed
;
57 const QPixmap
* folderOpen
;
58 const QPixmap
* fileDefault
;
61 void updateViews(const QString
& newRevSha
, const QString
& newFileName
);
62 void contextMenu(const QString
&, int type
);
65 void on_customContextMenuRequested(const QPoint
&);
66 void on_currentItemChanged(QTreeWidgetItem
*, QTreeWidgetItem
*);
67 void on_itemExpanded(QTreeWidgetItem
*);
68 void on_itemCollapsed(QTreeWidgetItem
*);
71 void setTree(SCRef treeSha
);
72 void setFile(SCRef fileName
);
79 QStringList modifiedFiles
; // no need a map, should not be a lot
80 QStringList modifiedDirs
;
81 bool ignoreCurrentChanged
;