thg-qt-mq / mani-filetree-visibility.diff

# HG changeset patch
# Parent d7a5f889e2055167d0aa48d112a12162c70477a7
diff --git a/tortoisehg/hgqt/manifestdialog.py b/tortoisehg/hgqt/manifestdialog.py
--- a/tortoisehg/hgqt/manifestdialog.py
+++ b/tortoisehg/hgqt/manifestdialog.py
@@ -45,6 +45,8 @@ class ManifestDialog(QMainWindow):
         self._manifest_widget.editSelected.connect(self._openInEditor)
         self._manifest_widget.grepRequested.connect(self._openSearchWidget)
         self.setCentralWidget(self._manifest_widget)
+
+        self._initvisibilitybar()
         self.addToolBar(self._manifest_widget.toolbar)
 
         self._searchbar = qscilib.SearchToolBar()
@@ -57,6 +59,17 @@ class ManifestDialog(QMainWindow):
         self._readsettings()
         self._updatewindowtitle()
 
+    def _initvisibilitybar(self):
+        self._visibilitybar = QToolBar('Visibility', self,
+                                       objectName='visibility')
+        self.addToolBar(self._visibilitybar)
+        self._action_showtree = QAction(qtlib.geticon('repobrowse'),
+                                        _('Show File Tree'), self,
+                                        checkable=True,
+                                        checked=self._manifest_widget.isFileTreeVisible())
+        self._action_showtree.toggled.connect(self._manifest_widget.setFileTreeVisible)
+        self._visibilitybar.addAction(self._action_showtree)
+
     @pyqtSlot()
     def _updatewindowtitle(self):
         self.setWindowTitle(_('Hg manifest viewer - %s:%s') % (
@@ -193,6 +206,14 @@ class ManifestWidget(QWidget):
         if 'C' not in self._statusfilter.text:
             self._treeview.expandAll()
 
+    @pyqtSlot(bool)
+    def setFileTreeVisible(self, visible):
+        self._treeview.setVisible(visible)
+        self._toolbar.setDisabled(not visible)
+
+    def isFileTreeVisible(self):
+        return self._treeview.isVisible()
+
     def reload(self):
         # TODO
         pass
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.