[tor-commits] [vidalia-plugins/master] Improve bwgraph plugin

chiiph at torproject.org chiiph at torproject.org
Fri Jul 20 23:46:40 UTC 2012


commit c5a44ff8140917674ceb746bc6dd7b3a264943ee
Author: Tomás Touceda <chiiph at torproject.org>
Date:   Fri Jul 20 20:45:05 2012 -0300

    Improve bwgraph plugin
    
    - Add a working alwaysOnTop setting
    - Toggle buttons along with hiding/showing their corresponding frame
---
 bwgraph/bwgraph.js |   21 ++++++++++++++++++++-
 1 files changed, 20 insertions(+), 1 deletions(-)

diff --git a/bwgraph/bwgraph.js b/bwgraph/bwgraph.js
index 565d6a0..a733b58 100644
--- a/bwgraph/bwgraph.js
+++ b/bwgraph/bwgraph.js
@@ -56,7 +56,6 @@ var bwgraph = {
         file.open(QIODevice.ReadOnly);
         this.widget = loader.load(file);
         var layout = new QVBoxLayout(this.tab);
-        vdebug(layout);
         layout.sizeConstraint = QLayout.SetMinAndMaxSize;
         layout.addWidget(this.widget, 100, Qt.AlignCenter);
         this.tab.setLayout(layout);
@@ -112,6 +111,15 @@ var bwgraph = {
         this.frame.showRecv = (this.chkReceiveRate.checkState() == Qt.Checked);
         this.frame.showSend = (this.chkSendRate.checkState() == Qt.Checked);
         this.toggleSettings(false);
+        if(this.chkAlwaysOnTop.checkState() == Qt.Checked)
+        {
+          this.tab.setWindowFlags(Qt.WindowFlags(this.tab.windowFlags() ^ Qt.WindowStaysOnTopHint));
+          if(this.tab.visible)
+          {
+            this.tab.show();
+            this.tab.activateWindow();
+          }
+        }
     },
 
     loadSettings: function() {
@@ -127,6 +135,15 @@ var bwgraph = {
         this.cmbGraphStyle.currentIndex = this.frame.graphStyle;
         this.frame.showRecv = dorecv;
         this.frame.showSend = dosend;
+        if(this.chkAlwaysOnTop.checkState() == Qt.Checked)
+        {
+          this.tab.setWindowFlags(Qt.WindowFlags(this.tab.windowFlags() ^ Qt.WindowStaysOnTopHint));
+          if(this.tab.visible)
+          {
+            this.tab.show();
+            this.tab.activateWindow();
+          }
+        }
     },
 
     buildGUI: function() {
@@ -136,10 +153,12 @@ var bwgraph = {
 
     toggleHistory: function(toggle) {
       this.grpBandwidth.setVisible(toggle);
+      this.btnHistory.checked = toggle;
     },
 
     toggleSettings: function(toggle) {
       this.frmSettings.setVisible(toggle);
+      this.btnSettings.checked = toggle;
     },
 
     stop: function() {



More information about the tor-commits mailing list