[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[vidalia-svn] r3874: Added code for a dynamic web browser plugin (its ignored for (in vidalia/branches/extension-api/src: plugins plugins/WebBrowserPlugin vidalia)
Author: tyree731
Date: 2009-06-20 23:12:08 -0400 (Sat, 20 Jun 2009)
New Revision: 3874
Added:
vidalia/branches/extension-api/src/plugins/WebBrowserPlugin/
vidalia/branches/extension-api/src/plugins/WebBrowserPlugin/CMakeLists.txt
vidalia/branches/extension-api/src/plugins/WebBrowserPlugin/WebBrowser.cpp
vidalia/branches/extension-api/src/plugins/WebBrowserPlugin/WebBrowser.h
vidalia/branches/extension-api/src/plugins/WebBrowserPlugin/WebBrowser.ui
vidalia/branches/extension-api/src/plugins/WebBrowserPlugin/WebBrowserPlugin.cpp
vidalia/branches/extension-api/src/plugins/WebBrowserPlugin/WebBrowserPlugin.h
Modified:
vidalia/branches/extension-api/src/plugins/CMakeLists.txt
vidalia/branches/extension-api/src/vidalia/VidaliaPanel.h
Log:
Added code for a dynamic web browser plugin (its ignored for now). Fixed the vidalia panel some.
Modified: vidalia/branches/extension-api/src/plugins/CMakeLists.txt
===================================================================
--- vidalia/branches/extension-api/src/plugins/CMakeLists.txt 2009-06-20 18:14:47 UTC (rev 3873)
+++ vidalia/branches/extension-api/src/plugins/CMakeLists.txt 2009-06-21 03:12:08 UTC (rev 3874)
@@ -18,6 +18,7 @@
${CMAKE_CURRENT_SOURCE_DIR}/DashboardPlugin
${CMAKE_CURRENT_SOURCE_DIR}/MessageLogPlugin
${CMAKE_CURRENT_SOURCE_DIR}/NetworkMapPlugin
+# ${CMAKE_CURRENT_SOURCE_DIR}/WebBrowserPlugin
)
link_directories(
${CMAKE_CURRENT_BINARY_DIR}/HomePlugin
@@ -30,3 +31,4 @@
add_subdirectory(DashboardPlugin)
add_subdirectory(MessageLogPlugin)
add_subdirectory(NetworkMapPlugin)
+#add_subdirectory(WebBrowserPlugin)
Added: vidalia/branches/extension-api/src/plugins/WebBrowserPlugin/CMakeLists.txt
===================================================================
--- vidalia/branches/extension-api/src/plugins/WebBrowserPlugin/CMakeLists.txt (rev 0)
+++ vidalia/branches/extension-api/src/plugins/WebBrowserPlugin/CMakeLists.txt 2009-06-21 03:12:08 UTC (rev 3874)
@@ -0,0 +1,31 @@
+##
+## $Id$
+##
+## 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.vidalia-project.net/. No part of Vidalia, including this file,
+## may be copied, modified, propagated, or distributed except according to
+## the terms described in the LICENSE file.
+##
+
+include_directories(
+ ${CMAKE_CURRENT_BINARY_DIR}
+ ${CMAKE_CURRENT_SOURCE_DIR}
+)
+
+set(webbrowserplugin_SRCS
+ WebBrowserPlugin.cpp
+ WebBrowser.cpp
+)
+qt4_wrap_cpp(webbrowserplugin_SRCS
+ WebBrowserPlugin.h
+ WebBrowser.h
+)
+qt4_wrap_ui(webbrowserplugin_SRCS
+ WebBrowser.ui
+)
+
+add_library(webbrowserplugin SHARED ${webbrowserplugin_SRCS})
+target_link_libraries(webbrowserplugin ${QT_LIBRARIES})
Property changes on: vidalia/branches/extension-api/src/plugins/WebBrowserPlugin/CMakeLists.txt
___________________________________________________________________
Added: svn:keywords
+ Id
Added: svn:eol-style
+ native
Added: vidalia/branches/extension-api/src/plugins/WebBrowserPlugin/WebBrowser.cpp
===================================================================
--- vidalia/branches/extension-api/src/plugins/WebBrowserPlugin/WebBrowser.cpp (rev 0)
+++ vidalia/branches/extension-api/src/plugins/WebBrowserPlugin/WebBrowser.cpp 2009-06-21 03:12:08 UTC (rev 3874)
@@ -0,0 +1,49 @@
+/*
+** 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.vidalia-project.net/. 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 WebBrowser.cpp
+** \version $Id$
+** \brief A VidaliaPanel containing a WebKit based web browser.
+*/
+
+#include "WebBrowser.h"
+
+WebBrowser::WebBrowser()
+{
+ ui.setupUi(this);
+
+ /* When the user presses enter, the page they entered is loaded */
+ connect(ui.lineUrlEntry, SIGNAL(returnPressed()), this, SLOT(loadURL()));
+
+ /* Set the appropriate button actions */
+ connect(ui.buttonBack, SIGNAL(clicked()), ui.webView, SLOT(back()));
+ connect(ui.buttonForward, SIGNAL(clicked()), ui.webView, SLOT(forward()));
+ connect(ui.buttonRefresh, SIGNAL(clicked()), ui.webView, SLOT(reload()));
+ connect(ui.buttonLoad, SIGNAL(clicked()), this, SLOT(loadURL()));
+}
+
+WebBrowser::~WebBrowser() {
+}
+
+QString WebBrowser::tabLabel() const
+{
+ return QString("Web Browser");
+}
+
+QIcon WebBrowser::tabIcon() const
+{
+ return QIcon();
+}
+
+void WebBrowser::loadURL()
+{
+ ui.webView->load(ui.lineUrlEntry->displayText());
+}
Property changes on: vidalia/branches/extension-api/src/plugins/WebBrowserPlugin/WebBrowser.cpp
___________________________________________________________________
Added: svn:keywords
+ Id
Added: svn:eol-style
+ native
Added: vidalia/branches/extension-api/src/plugins/WebBrowserPlugin/WebBrowser.h
===================================================================
--- vidalia/branches/extension-api/src/plugins/WebBrowserPlugin/WebBrowser.h (rev 0)
+++ vidalia/branches/extension-api/src/plugins/WebBrowserPlugin/WebBrowser.h 2009-06-21 03:12:08 UTC (rev 3874)
@@ -0,0 +1,57 @@
+/*
+** 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.vidalia-project.net/. 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 WebBrowser.h
+** \version $Id$
+** \brief A VidaliaPanel containing a WebKit based web browser.
+*/
+
+#ifndef _WEBBROWSER_H
+#define _WEBBROWSER_H
+
+#include "ui_WebBrowser.h"
+
+#include <vidalia/PluginManager.h>
+#include <vidalia/VidaliaPanel.h>
+
+#include <QIcon>
+#include <QLineEdit>
+#include <QMenuBar>
+#include <QStatusBar>
+#include <QString>
+#include <QWebView>
+
+/** Panel which provides the user with a fully functioning WebKit based browser
+ * running over the Tor network. */
+class WebBrowser : public VidaliaPanel
+{
+ Q_OBJECT
+
+public:
+ /** Default constructor. */
+ WebBrowser();
+ /** Destructor. */
+ ~WebBrowser();
+ /** tabLabel provides a hook for the Vidalia plugin API to populate a given
+ * panel's tab with text. */
+ QString tabLabel() const;
+ /** tabIcon provides a hook for the Vidalia plugin API to populate a given
+ * panel's tab with an icon. */
+ QIcon tabIcon() const;
+private slots:
+ /** Loads the URL inside of the URL entry box. */
+ void loadURL();
+private:
+ /** Required to use Qt Designer object */
+ Ui::WebBrowser ui;
+};
+
+#endif
Property changes on: vidalia/branches/extension-api/src/plugins/WebBrowserPlugin/WebBrowser.h
___________________________________________________________________
Added: svn:keywords
+ Id
Added: svn:eol-style
+ native
Added: vidalia/branches/extension-api/src/plugins/WebBrowserPlugin/WebBrowser.ui
===================================================================
--- vidalia/branches/extension-api/src/plugins/WebBrowserPlugin/WebBrowser.ui (rev 0)
+++ vidalia/branches/extension-api/src/plugins/WebBrowserPlugin/WebBrowser.ui 2009-06-21 03:12:08 UTC (rev 3874)
@@ -0,0 +1,98 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>WebBrowser</class>
+ <widget class="QMainWindow" name="WebBrowser">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>761</width>
+ <height>586</height>
+ </rect>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="windowTitle">
+ <string>WebBrowser</string>
+ </property>
+ <widget class="QWidget" name="centralwidget">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <layout class="QGridLayout" name="gridLayout">
+ <item row="0" column="0">
+ <widget class="QPushButton" name="buttonBack">
+ <property name="text">
+ <string><-</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1">
+ <widget class="QPushButton" name="buttonForward">
+ <property name="text">
+ <string>-></string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="3">
+ <widget class="QLineEdit" name="lineUrlEntry"/>
+ </item>
+ <item row="1" column="0" colspan="5">
+ <widget class="QWebView" name="webView">
+ <property name="url">
+ <url>
+ <string>about:blank</string>
+ </url>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="2">
+ <widget class="QPushButton" name="buttonRefresh">
+ <property name="text">
+ <string>@</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="4">
+ <widget class="QPushButton" name="buttonLoad">
+ <property name="text">
+ <string>Go</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QMenuBar" name="menubar">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>761</width>
+ <height>22</height>
+ </rect>
+ </property>
+ </widget>
+ <widget class="QStatusBar" name="statusbar"/>
+ <action name="actionOpen_URL">
+ <property name="text">
+ <string>Open URL</string>
+ </property>
+ </action>
+ </widget>
+ <customwidgets>
+ <customwidget>
+ <class>QWebView</class>
+ <extends>QWidget</extends>
+ <header>QtWebKit/QWebView</header>
+ </customwidget>
+ </customwidgets>
+ <resources/>
+ <connections/>
+</ui>
Property changes on: vidalia/branches/extension-api/src/plugins/WebBrowserPlugin/WebBrowser.ui
___________________________________________________________________
Added: svn:keywords
+ Id
Added: svn:eol-style
+ native
Added: vidalia/branches/extension-api/src/plugins/WebBrowserPlugin/WebBrowserPlugin.cpp
===================================================================
--- vidalia/branches/extension-api/src/plugins/WebBrowserPlugin/WebBrowserPlugin.cpp (rev 0)
+++ vidalia/branches/extension-api/src/plugins/WebBrowserPlugin/WebBrowserPlugin.cpp 2009-06-21 03:12:08 UTC (rev 3874)
@@ -0,0 +1,40 @@
+/*
+** 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.vidalia-project.net/. 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 WebBrowserPlugin.cpp
+** \version $Id$
+** \brief A plugin which contains a Webkit based browser which runs over Tor
+*/
+
+#include "WebBrowserPlugin.h"
+
+WebBrowserPlugin::WebBrowserPlugin()
+{
+ _webBrowser = new WebBrowser();
+}
+
+WebBrowserPlugin::~WebBrowserPlugin()
+{
+ delete _webBrowser;
+}
+
+QString WebBrowserPlugin::pluginHumanName() const
+{
+ return QString("Web Browser");
+}
+
+VidaliaPanel* WebBrowserPlugin::panel() const
+{
+ return _webBrowser;
+}
+
+Q_EXPORT_PLUGIN2(webbrowserplugin, WebBrowserPlugin)
+
Property changes on: vidalia/branches/extension-api/src/plugins/WebBrowserPlugin/WebBrowserPlugin.cpp
___________________________________________________________________
Added: svn:keywords
+ Id
Added: svn:eol-style
+ native
Added: vidalia/branches/extension-api/src/plugins/WebBrowserPlugin/WebBrowserPlugin.h
===================================================================
--- vidalia/branches/extension-api/src/plugins/WebBrowserPlugin/WebBrowserPlugin.h (rev 0)
+++ vidalia/branches/extension-api/src/plugins/WebBrowserPlugin/WebBrowserPlugin.h 2009-06-21 03:12:08 UTC (rev 3874)
@@ -0,0 +1,44 @@
+/*
+** 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.vidalia-project.net/. 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 WebBrowserPlugin.h
+** \version $Id$
+** \brief A plugin which contains a Webkit based browser which runs over Tor
+*/
+
+#ifndef _WEBBROWSERPLUGIN_H
+#define _WEBBROWSERPLUGIN_H
+
+#include <QObject>
+
+#include <vidalia/VidaliaPluginInterface.h>
+
+#include "WebBrowser.h"
+
+class WebBrowserPlugin : public QObject, public VidaliaPluginInterface
+{
+ Q_OBJECT
+ Q_INTERFACES(VidaliaPluginInterface)
+
+public:
+ WebBrowserPlugin();
+ ~WebBrowserPlugin();
+
+ /** Hook in the Vidalia plugin API to return the WebBrowser panel associated
+ * with this plugin instance. */
+ VidaliaPanel* panel() const;
+ /** Hook for Vidalia plugin API to return the name of the plugin. */
+ QString pluginHumanName() const;
+private:
+ WebBrowser* _webBrowser;
+};
+
+#endif
Property changes on: vidalia/branches/extension-api/src/plugins/WebBrowserPlugin/WebBrowserPlugin.h
___________________________________________________________________
Added: svn:keywords
+ Id
Added: svn:eol-style
+ native
Modified: vidalia/branches/extension-api/src/vidalia/VidaliaPanel.h
===================================================================
--- vidalia/branches/extension-api/src/vidalia/VidaliaPanel.h 2009-06-20 18:14:47 UTC (rev 3873)
+++ vidalia/branches/extension-api/src/vidalia/VidaliaPanel.h 2009-06-21 03:12:08 UTC (rev 3874)
@@ -11,9 +11,12 @@
/*
** \file VidaliaPanel.h
** \version $Id$
-** \brief Defines the Vidalia panel containing a tab and corresponding QMainWindow.
+** \brief Defines the Vidalia panel containing a tab and corresponding panel.
*/
+#ifndef _VIDALIAPANEL_H
+#define _VIDALIAPANEL_H
+
#include <QIcon>
#include <QMainWindow>
#include <QString>
@@ -23,12 +26,12 @@
class VidaliaPanel : public QMainWindow
{
public:
- /** Constructor for a Vidalia Panel. */
- VidaliaPanel();
/** Destructor for a Vidalia Panel. */
- ~VidaliaPanel();
- /** Returns the label to be displayed on the plugin's tab. */
- QString* tabLabel();
+ virtual ~VidaliaPanel() = 0;
+ /** Returns the label to be displayed on the panel's tab. */
+ virtual QString tabLabel() const = 0;
/** Returns the icon to be displayed adjacent to the tabLabel. */
- QIcon* tabIcon();
+ virtual QIcon tabIcon() const = 0;
};
+
+#endif