[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [vidalia/alpha] Add headers and temporary disable the include function
commit bad8cdb7ad327116311daca0c102c747aa0de568
Author: Tomas Touceda <chiiph@xxxxxxxxxxxxxx>
Date: Sat Jul 2 18:12:16 2011 -0300
Add headers and temporary disable the include function
The include function won't be on the 0.3.1 release, it doesn't work as of
today, so I'm disabling it.
---
src/vidalia/plugin/DebugDialog.cpp | 16 +++
src/vidalia/plugin/DebugDialog.h | 16 +++
src/vidalia/plugin/PluginEngine.cpp | 142 +++++++++----------
src/vidalia/plugin/PluginEngine.h | 19 +++-
src/vidalia/plugin/PluginWrapper.cpp | 15 ++
src/vidalia/plugin/PluginWrapper.h | 15 ++
.../plugin/prototypes/HelperProcessPrototype.cpp | 21 +++-
.../plugin/prototypes/TorControlPrototype.cpp | 15 ++
.../plugin/prototypes/TorControlPrototype.h | 10 +-
.../plugin/prototypes/VidaliaTabPrototype.cpp | 21 +++-
.../plugin/prototypes/VidaliaTabPrototype.h | 15 ++
11 files changed, 219 insertions(+), 86 deletions(-)
diff --git a/src/vidalia/plugin/DebugDialog.cpp b/src/vidalia/plugin/DebugDialog.cpp
index df2aa1e..683ed6a 100644
--- a/src/vidalia/plugin/DebugDialog.cpp
+++ b/src/vidalia/plugin/DebugDialog.cpp
@@ -1,3 +1,19 @@
+/*
+** This file is part of Vidalia, and is subject to the license terms in the
+** LICENSE file, found in the top level directory of this distribution. If you
+** did not receive the LICENSE file with this file, you may obtain it from the
+** Vidalia source package distributed by the Vidalia Project at
+** http://www.torproject.org/projects/vidalia.html. No part of Vidalia,
+** including this file, may be copied, modified, propagated, or distributed
+** except according to the terms described in the LICENSE file.
+*/
+
+/*
+** \file DebugDialog.cpp
+** \brief Simple dialog to see exceptions, syntaxis problems, and general
+** output for pluging
+*/
+
#include "DebugDialog.h"
QStringList DebugDialog::outputBuffer;
diff --git a/src/vidalia/plugin/DebugDialog.h b/src/vidalia/plugin/DebugDialog.h
index 76b3bb6..7f6ff0a 100644
--- a/src/vidalia/plugin/DebugDialog.h
+++ b/src/vidalia/plugin/DebugDialog.h
@@ -1,3 +1,19 @@
+/*
+** This file is part of Vidalia, and is subject to the license terms in the
+** LICENSE file, found in the top level directory of this distribution. If you
+** did not receive the LICENSE file with this file, you may obtain it from the
+** Vidalia source package distributed by the Vidalia Project at
+** http://www.torproject.org/projects/vidalia.html. No part of Vidalia,
+** including this file, may be copied, modified, propagated, or distributed
+** except according to the terms described in the LICENSE file.
+*/
+
+/*
+** \file DebugDialog.h
+** \brief Simple dialog to see exceptions, syntaxis problems, and general
+** output for pluging
+*/
+
#ifndef DEBUGDIALOG_H
#define DEBUGDIALOG_H
diff --git a/src/vidalia/plugin/PluginEngine.cpp b/src/vidalia/plugin/PluginEngine.cpp
index f51607e..41f9712 100644
--- a/src/vidalia/plugin/PluginEngine.cpp
+++ b/src/vidalia/plugin/PluginEngine.cpp
@@ -1,3 +1,18 @@
+/*
+** This file is part of Vidalia, and is subject to the license terms in the
+** LICENSE file, found in the top level directory of this distribution. If you
+** did not receive the LICENSE file with this file, you may obtain it from the
+** Vidalia source package distributed by the Vidalia Project at
+** http://www.torproject.org/projects/vidalia.html. No part of Vidalia,
+** including this file, may be copied, modified, propagated, or distributed
+** except according to the terms described in the LICENSE file.
+*/
+
+/*
+** \file PluginEngine.cpp
+** \brief Engine that handles all plugin related features
+*/
+
#include "PluginEngine.h"
#include "VidaliaSettings.h"
#include "PluginWrapper.h"
@@ -17,7 +32,7 @@ PluginEngine::PluginEngine(QObject *parent)
globalObject().setProperty("torControl", newQObject(Vidalia::torControl()));
globalObject().setProperty("vidaliaApp", newQObject(vApp));
- globalObject().setProperty("include", newFunction(includeScript));
+// globalObject().setProperty("include", newFunction(includeScript));
globalObject().setProperty("importExtension", newFunction(importExtension));
globalObject().setProperty("vdebug", newFunction(vdebug));
globalObject().setProperty("findWidget", newFunction(findWidget));
@@ -30,9 +45,6 @@ PluginEngine::PluginEngine(QObject *parent)
DebugDialog::outputDebug(QString(" %1").arg(ext));
loadAllPlugins();
-
-// debugger.attachTo(this);
-// debugger.standardWindow()->show();
}
PluginEngine::~PluginEngine()
@@ -104,75 +116,54 @@ PluginEngine::importExtension(QScriptContext *context, QScriptEngine *engine)
return engine->importExtension(context->argument(0).toString());
}
-QScriptValue
-PluginEngine::includeScript(QScriptContext *context, QScriptEngine *engine)
-{
- QString currentFileName = engine->globalObject().property("qs").property("script").property("absoluteFilePath").toString();
- QFileInfo currentFileInfo(currentFileName);
- QString path = currentFileInfo.path();
- QString importFile = context->argument(0).toString();
- QFileInfo importInfo(importFile);
- if (importInfo.isRelative()) {
- importFile = path + "/" + importInfo.filePath();
- }
- if (!loadFile(importFile, engine)) {
- return context->throwError(QString("Failed to resolve include: %1").arg(importFile));
- }
- return engine->toScriptValue(true);
-}
-
-bool
-PluginEngine::loadFile(QString fileName, QScriptEngine *engine)
-{
- // avoid loading files more than once
- static QSet<QString> loadedFiles;
- QFileInfo fileInfo(fileName);
- QString absoluteFileName = fileInfo.absoluteFilePath();
- QString absolutePath = fileInfo.absolutePath();
- QString canonicalFileName = fileInfo.canonicalFilePath();
- if (loadedFiles.contains(canonicalFileName)) {
- return true;
- }
- loadedFiles.insert(canonicalFileName);
- QString path = fileInfo.path();
-
- // load the file
- QFile file(fileName);
- if (file.open(QFile::ReadOnly)) {
- QTextStream stream(&file);
- QString contents = stream.readAll();
- file.close();
-
- int endlineIndex = contents.indexOf('\n');
- QString line = contents.left(endlineIndex);
- int lineNumber = 1;
-
- // strip off #!/usr/bin/env qscript line
- if (line.startsWith("#!")) {
- contents.remove(0, endlineIndex+1);
- ++lineNumber;
- }
-
- // set qt.script.absoluteFilePath
- QScriptValue script = engine->globalObject().property("qs").property("script");
- QScriptValue oldFilePathValue = script.property("absoluteFilePath");
- QScriptValue oldPathValue = script.property("absolutePath");
- script.setProperty("absoluteFilePath", engine->toScriptValue(absoluteFileName));
- script.setProperty("absolutePath", engine->toScriptValue(absolutePath));
-
- QScriptValue r = engine->evaluate(contents, fileName, lineNumber);
- if (engine->hasUncaughtException()) {
- QStringList backtrace = engine->uncaughtExceptionBacktrace();
- qDebug() << QString(" %1\n%2\n\n").arg(r.toString()).arg(backtrace.join("\n"));
- return true;
- }
- script.setProperty("absoluteFilePath", oldFilePathValue); // if we come from includeScript(), or whereever
- script.setProperty("absolutePath", oldPathValue); // if we come from includeScript(), or whereever
- } else {
- return false;
- }
- return true;
-}
+//QScriptValue
+//PluginEngine::includeScript(QScriptContext *context, QScriptEngine *engine)
+//{
+// VidaliaSettings settings;
+// QString path = settings.pluginPath();
+// QString importFile = context->argument(0).toString();
+// QFileInfo importInfo(importFile);
+// if (importInfo.isRelative()) {
+// importFile = path + "/" + importInfo.filePath();
+// }
+
+// if (!loadFile(importFile, engine)) {
+// return context->throwError(QString("Failed to resolve include: %1").arg(importFile));
+// }
+// return engine->toScriptValue(true);
+//}
+
+//bool
+//PluginEngine::loadFile(QString fileName, QScriptEngine *engine)
+//{
+// static QSet<QString> loadedFiles;
+// QFileInfo fileInfo(fileName);
+// QString absoluteFileName = fileInfo.absoluteFilePath();
+// QString absolutePath = fileInfo.absolutePath();
+// QString canonicalFileName = fileInfo.canonicalFilePath();
+// if (loadedFiles.contains(canonicalFileName)) {
+// return true;
+// }
+// loadedFiles.insert(canonicalFileName);
+// QString path = fileInfo.path();
+
+// QFile file(fileName);
+// if (file.open(QFile::ReadOnly)) {
+// QTextStream stream(&file);
+// QString contents = stream.readAll();
+// file.close();
+
+// QScriptValue r = engine->evaluate(contents);
+// if (engine->hasUncaughtException()) {
+// QStringList backtrace = engine->uncaughtExceptionBacktrace();
+// qDebug() << QString(" %1\n%2\n\n").arg(r.toString()).arg(backtrace.join("\n"));
+// return true;
+// }
+// } else {
+// return false;
+// }
+// return true;
+//}
QScriptValue
PluginEngine::vdebug(QScriptContext *context, QScriptEngine *engine)
@@ -184,13 +175,14 @@ PluginEngine::vdebug(QScriptContext *context, QScriptEngine *engine)
result.append(context->argument(i).toString());
}
- qWarning() << result;
+ vInfo(result);
return engine->undefinedValue();
}
QScriptValue
-PluginEngine::findWidget(QScriptContext *context, QScriptEngine *engine) {
+PluginEngine::findWidget(QScriptContext *context, QScriptEngine *engine)
+{
if(context->argumentCount() != 2)
return context->throwError(QString("findWidget called with the wrong argument count. Expected 2."));
diff --git a/src/vidalia/plugin/PluginEngine.h b/src/vidalia/plugin/PluginEngine.h
index 854ed15..d8dc273 100644
--- a/src/vidalia/plugin/PluginEngine.h
+++ b/src/vidalia/plugin/PluginEngine.h
@@ -1,3 +1,18 @@
+/*
+** This file is part of Vidalia, and is subject to the license terms in the
+** LICENSE file, found in the top level directory of this distribution. If you
+** did not receive the LICENSE file with this file, you may obtain it from the
+** Vidalia source package distributed by the Vidalia Project at
+** http://www.torproject.org/projects/vidalia.html. No part of Vidalia,
+** including this file, may be copied, modified, propagated, or distributed
+** except according to the terms described in the LICENSE file.
+*/
+
+/*
+** \file PluginEngine.h
+** \brief Engine that handles all plugin related features
+*/
+
#ifndef PLUGINENGINE_H
#define PLUGINENGINE_H
@@ -32,8 +47,8 @@ class PluginEngine : public QScriptEngine {
protected:
static QScriptValue importExtension(QScriptContext *context, QScriptEngine *engine);
- static bool loadFile(QString fileName, QScriptEngine *engine);
- static QScriptValue includeScript(QScriptContext *context, QScriptEngine *engine);
+// static bool loadFile(QString fileName, QScriptEngine *engine);
+// static QScriptValue includeScript(QScriptContext *context, QScriptEngine *engine);
static QScriptValue vdebug(QScriptContext *context, QScriptEngine *engine);
static QScriptValue findWidget(QScriptContext *context, QScriptEngine *engine);
diff --git a/src/vidalia/plugin/PluginWrapper.cpp b/src/vidalia/plugin/PluginWrapper.cpp
index 2736dbc..87a6ff1 100644
--- a/src/vidalia/plugin/PluginWrapper.cpp
+++ b/src/vidalia/plugin/PluginWrapper.cpp
@@ -1,3 +1,18 @@
+/*
+** This file is part of Vidalia, and is subject to the license terms in the
+** LICENSE file, found in the top level directory of this distribution. If
+** you did not receive the LICENSE file with this file, you may obtain it
+** from the Vidalia source package distributed by the Vidalia Project at
+** http://www.torproject.org/projects/vidalia.html. No part of Vidalia,
+** including this file, may be copied, modified, propagated, or distributed
+** except according to the terms described in the LICENSE file.
+*/
+
+/*
+** \file PluginWrapper.cpp
+** \brief Wrapper for the plugin scripts
+*/
+
#include "PluginWrapper.h"
#include "PluginEngine.h"
#include "DebugDialog.h"
diff --git a/src/vidalia/plugin/PluginWrapper.h b/src/vidalia/plugin/PluginWrapper.h
index 15f7853..1253bee 100644
--- a/src/vidalia/plugin/PluginWrapper.h
+++ b/src/vidalia/plugin/PluginWrapper.h
@@ -1,3 +1,18 @@
+/*
+** This file is part of Vidalia, and is subject to the license terms in the
+** LICENSE file, found in the top level directory of this distribution. If
+** you did not receive the LICENSE file with this file, you may obtain it
+** from the Vidalia source package distributed by the Vidalia Project at
+** http://www.torproject.org/projects/vidalia.html. No part of Vidalia,
+** including this file, may be copied, modified, propagated, or distributed
+** except according to the terms described in the LICENSE file.
+*/
+
+/*
+** \file PluginWrapper.h
+** \brief Wrapper for the plugin scripts
+*/
+
#ifndef PLUGINWRAPPER_H
#define PLUGINWRAPPER_H
diff --git a/src/vidalia/plugin/prototypes/HelperProcessPrototype.cpp b/src/vidalia/plugin/prototypes/HelperProcessPrototype.cpp
index c2232e1..2fcd126 100644
--- a/src/vidalia/plugin/prototypes/HelperProcessPrototype.cpp
+++ b/src/vidalia/plugin/prototypes/HelperProcessPrototype.cpp
@@ -1,3 +1,18 @@
+/*
+** This file is part of Vidalia, and is subject to the license terms in the
+** LICENSE file, found in the top level directory of this distribution. If
+** you did not receive the LICENSE file with this file, you may obtain it
+** from the Vidalia source package distributed by the Vidalia Project at
+** http://www.torproject.org/projects/vidalia.html. No part of Vidalia,
+** including this file, may be copied, modified, propagated, or distributed
+** except according to the terms described in the LICENSE file.
+*/
+
+/*
+** \file HelperProcessPrototype.cpp
+** \brief Prototype for the HelperProcess class
+*/
+
#include "HelperProcessPrototype.h"
HelperProcessPrototype::HelperProcessPrototype(QObject *parent)
@@ -11,12 +26,14 @@ HelperProcessPrototype::constructor(QScriptContext *context, QScriptEngine *engi
}
int
-HelperProcessPrototype::metaTypeId() {
+HelperProcessPrototype::metaTypeId()
+{
return qMetaTypeId<HelperProcess *>();
}
QString
-HelperProcessPrototype::name() {
+HelperProcessPrototype::name()
+{
return QString("HelperProcess");
}
diff --git a/src/vidalia/plugin/prototypes/TorControlPrototype.cpp b/src/vidalia/plugin/prototypes/TorControlPrototype.cpp
index 56bccc0..742a428 100644
--- a/src/vidalia/plugin/prototypes/TorControlPrototype.cpp
+++ b/src/vidalia/plugin/prototypes/TorControlPrototype.cpp
@@ -1,3 +1,18 @@
+/*
+** This file is part of Vidalia, and is subject to the license terms in the
+** LICENSE file, found in the top level directory of this distribution. If you
+** did not receive the LICENSE file with this file, you may obtain it from the
+** Vidalia source package distributed by the Vidalia Project at
+** http://www.torproject.org/projects/vidalia.html. No part of Vidalia,
+** including this file, may be copied, modified, propagated, or distributed
+** except according to the terms described in the LICENSE file.
+*/
+
+/*
+** \file TorControlPrototype.cpp
+** \brief Prototype for TorControl class
+*/
+
#include "TorControlPrototype.h"
#define GET_AND_CALL(type, func, res) \
diff --git a/src/vidalia/plugin/prototypes/TorControlPrototype.h b/src/vidalia/plugin/prototypes/TorControlPrototype.h
index 8127c76..eb0cc6b 100644
--- a/src/vidalia/plugin/prototypes/TorControlPrototype.h
+++ b/src/vidalia/plugin/prototypes/TorControlPrototype.h
@@ -1,16 +1,16 @@
/*
** This file is part of Vidalia, and is subject to the license terms in the
-** LICENSE file, found in the top level directory of this distribution. If
-** you did not receive the LICENSE file with this file, you may obtain it
-** from the Vidalia source package distributed by the Vidalia Project at
+** LICENSE file, found in the top level directory of this distribution. If you
+** did not receive the LICENSE file with this file, you may obtain it from the
+** Vidalia source package distributed by the Vidalia Project at
** http://www.torproject.org/projects/vidalia.html. No part of Vidalia,
** including this file, may be copied, modified, propagated, or distributed
** except according to the terms described in the LICENSE file.
*/
-/*
+/*
** \file TorControlPrototype.h
-** \brief Object for interacting with the Tor process and control interface
+** \brief Prototype for TorControl class
*/
#ifndef _TORCONTROLPROTO_H
diff --git a/src/vidalia/plugin/prototypes/VidaliaTabPrototype.cpp b/src/vidalia/plugin/prototypes/VidaliaTabPrototype.cpp
index 52b8fef..8f71a37 100644
--- a/src/vidalia/plugin/prototypes/VidaliaTabPrototype.cpp
+++ b/src/vidalia/plugin/prototypes/VidaliaTabPrototype.cpp
@@ -1,3 +1,18 @@
+/*
+** This file is part of Vidalia, and is subject to the license terms in the
+** LICENSE file, found in the top level directory of this distribution. If you
+** did not receive the LICENSE file with this file, you may obtain it from the
+** Vidalia source package distributed by the Vidalia Project at
+** http://www.torproject.org/projects/vidalia.html. No part of Vidalia,
+** including this file, may be copied, modified, propagated, or distributed
+** except according to the terms described in the LICENSE file.
+*/
+
+/*
+** \file VidaliaTabPrototype.cpp
+** \brief Prototype for VidaliaTab class
+*/
+
#include "VidaliaTabPrototype.h"
VidaliaTabPrototype::VidaliaTabPrototype(QObject *parent)
@@ -21,12 +36,14 @@ VidaliaTabPrototype::constructor(QScriptContext *context, QScriptEngine *engine)
}
int
-VidaliaTabPrototype::metaTypeId() {
+VidaliaTabPrototype::metaTypeId()
+{
return qMetaTypeId<VidaliaTab *>();
}
QString
-VidaliaTabPrototype::name() {
+VidaliaTabPrototype::name()
+{
return QString("VidaliaTab");
}
diff --git a/src/vidalia/plugin/prototypes/VidaliaTabPrototype.h b/src/vidalia/plugin/prototypes/VidaliaTabPrototype.h
index 59d640d..dcc355b 100644
--- a/src/vidalia/plugin/prototypes/VidaliaTabPrototype.h
+++ b/src/vidalia/plugin/prototypes/VidaliaTabPrototype.h
@@ -1,3 +1,18 @@
+/*
+** This file is part of Vidalia, and is subject to the license terms in the
+** LICENSE file, found in the top level directory of this distribution. If you
+** did not receive the LICENSE file with this file, you may obtain it from the
+** Vidalia source package distributed by the Vidalia Project at
+** http://www.torproject.org/projects/vidalia.html. No part of Vidalia,
+** including this file, may be copied, modified, propagated, or distributed
+** except according to the terms described in the LICENSE file.
+*/
+
+/*
+** \file VidaliaTabPrototype.h
+** \brief Prototype for VidaliaTab class
+*/
+
#ifndef VIDALIATABPROT_H
#define VIDALIATABPROT_H
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits