Commits

Steve Borho  committed dc23fbf

filedialogs: add a revpanel widget above the HgFileView

  • Participants
  • Parent commits b3521ef
  • Tags 1.9.2

Comments (0)

Files changed (1)

File tortoisehg/hgqt/filedialogs.py

 from tortoisehg.hgqt.lexers import get_lexer
 from tortoisehg.hgqt.fileview import HgFileView
 from tortoisehg.hgqt.repoview import HgRepoView
+from tortoisehg.hgqt.revpanel import RevPanelWidget
 
 sides = ('left', 'right')
 otherside = {'left': 'right', 'right': 'left'}
         s = QSettings()
         s.beginGroup('filelog')
         try:
+            self.textView.loadSettings(s, 'fileview')
             self.restoreGeometry(s.value('geom').toByteArray())
             self.splitter.restoreState(s.value('splitter').toByteArray())
+            self.revpanel.set_expanded(s.value('revpanel.expanded').toBool())
         finally:
             s.endGroup()
 
         s = QSettings()
         s.beginGroup('filelog')
         try:
+            self.textView.saveSettings(s, 'fileview')
+            s.setValue('revpanel.expanded', self.revpanel.is_expanded())
             s.setValue('geom', self.saveGeometry())
             s.setValue('splitter', self.splitter.saveState())
         finally:
 
         self.splitter = QSplitter(Qt.Vertical)
         self.setCentralWidget(self.splitter)
-        self.repoview = HgRepoView(self.repo, self)
+        self.repoview = HgRepoView(self.repo, self.splitter)
+        self.contentframe = QFrame(self.splitter)
+
+        vbox = QVBoxLayout()
+        vbox.setSpacing(0)
+        vbox.setMargin(0)
+        self.contentframe.setLayout(vbox)
+
+        self.revpanel = RevPanelWidget(self.repo)
+        self.revpanel.linkActivated.connect(self.linkActivated)
+        vbox.addWidget(self.revpanel, 0)
+
         self.textView = HgFileView(self.repo, self)
         self.textView.forceMode('file')
-        self.splitter.addWidget(self.repoview)
-        self.splitter.addWidget(self.textView)
+        vbox.addWidget(self.textView, 1)
+
+    @pyqtSlot(unicode)
+    def linkActivated(self, link):
+        link = unicode(link)
+        if ':' in link:
+            scheme, param = link.split(':', 1)
+            if scheme == 'cset':
+                rev = self.repo[param].rev()
+                return self.goto(rev)
+        QDesktopServices.openUrl(QUrl(link))
 
     def setupViews(self):
         self.textView.setFont(self._font)
         self.textView.setContext(ctx)
         self.textView.displayFile(self.filerevmodel.graph.filename(rev))
         self.textView.verticalScrollBar().setValue(pos)
+        self.revpanel.set_revision(rev)
+        self.revpanel.update(repo = self.repo)
 
     def goto(self, rev):
         index = self.filerevmodel.indexFromRev(rev)