[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [vidalia-plugins/master] Skeleton for the plugin done for the tutorial
commit fbc6c26922dfefddbe3b5ba8401a425558e78a2f
Author: Tomás Touceda <chiiph@xxxxxxxxxxxxxx>
Date: Mon Apr 16 20:31:27 2012 -0300
Skeleton for the plugin done for the tutorial
---
tutorial/info.xml | 10 +++++++++
tutorial/tutorial.js | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 62 insertions(+), 0 deletions(-)
diff --git a/tutorial/info.xml b/tutorial/info.xml
new file mode 100644
index 0000000..33c488f
--- /dev/null
+++ b/tutorial/info.xml
@@ -0,0 +1,10 @@
+<VidaliaPlugin>
+ <name>Bandwidth history</name>
+ <date>16/04/2012</date>
+ <author>chiiph</author>
+ <type persistent="true" gui="true" />
+ <files>
+ <file>tutorial.js</file>
+ </files>
+ <namespace>tutorial</namespace>
+</VidaliaPlugin>
diff --git a/tutorial/tutorial.js b/tutorial/tutorial.js
new file mode 100644
index 0000000..197928e
--- /dev/null
+++ b/tutorial/tutorial.js
@@ -0,0 +1,52 @@
+importExtension("qt");
+importExtension("qt.core");
+importExtension("qt.gui");
+importExtension("qt.uitools");
+
+var tutorial = {
+ start: function() {
+ vdebug("Tutorial@start");
+ torControl["bandwidthUpdate(quint64, quint64)"].connect(this, this.saveBandwidth);
+ },
+
+ saveBandwidth: function(recv, sent) {
+ vdebug("Tutorial::Recv", recv);
+ vdebug("Totorial::Sent", sent);
+ },
+
+ buildGUI: function() {
+ vdebug("Tutorial@buildGUI");
+ // Load the GUI file
+ this.tab = new VidaliaTab("Display bandwidth history", "BandwidthHistory");
+
+ var file = new QFile(pluginPath+"/tutorial/tutorial.ui");
+ var loader = new QUiLoader(this.tab);
+ file.open(QIODevice.ReadOnly);
+ this.widget = loader.load(file);
+ var layout = new QVBoxLayout();
+ layout.addWidget(this.widget, 0, Qt.AlignCenter);
+ this.tab.setLayout(layout);
+ file.close();
+
+ var groupBox = this.widget.children()[findWidget(this.widget, "browserBox")];
+ if(groupBox == null) {
+ return this.tab;
+ }
+
+ this.btnSave = this.widget.children()[findWidget(this.widget, "btnSave")];
+ if(this.btnSave != null) {
+ this.btnSave["clicked()"].connect(this, this.saveSettings);
+ }
+
+ this.btnLaunch = groupBox.children()[findWidget(groupBox, "btnLaunch")];
+ if(this.btnLaunch != null) {
+ this.btnLaunch["clicked()"].connect(this, this.startSubProcess);
+ }
+
+ return this.tab;
+ },
+
+ stop: function() {
+ vdebug("Tutorial@stop");
+ },
+};
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits