[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[vidalia-svn] r3477: Bring back the ZImageView-based network map (renamed to TorM (in vidalia/branches/marble: . debian src/vidalia src/vidalia/network src/vidalia/res src/vidalia/res/map)
Author: edmanm
Date: 2009-01-28 22:36:47 -0500 (Wed, 28 Jan 2009)
New Revision: 3477
Added:
vidalia/branches/marble/src/vidalia/network/tormapimageview.cpp
vidalia/branches/marble/src/vidalia/network/tormapimageview.h
vidalia/branches/marble/src/vidalia/network/zimageview.cpp
vidalia/branches/marble/src/vidalia/network/zimageview.h
vidalia/branches/marble/src/vidalia/res/map/
vidalia/branches/marble/src/vidalia/res/map/world-map.png
Removed:
vidalia/branches/marble/src/vidalia/res/map/world-map.png
Modified:
vidalia/branches/marble/CMakeLists.txt
vidalia/branches/marble/config.h.in
vidalia/branches/marble/debian/faq
vidalia/branches/marble/src/vidalia/CMakeLists.txt
vidalia/branches/marble/src/vidalia/network/circuitlistwidget.cpp
vidalia/branches/marble/src/vidalia/network/netviewer.cpp
vidalia/branches/marble/src/vidalia/network/netviewer.h
vidalia/branches/marble/src/vidalia/res/vidalia.qrc
vidalia/branches/marble/src/vidalia/vidalia.cpp
Log:
Bring back the ZImageView-based network map (renamed to TorMapImageView)
and all its little friends. Add a USE_MARBLE CMake option to enable or
disable building with Marble (disabled by default). If configured with
-DUSE_MARBLE=1, we will build with the MarbleWidget-based map support.
Modified: vidalia/branches/marble/CMakeLists.txt
===================================================================
--- vidalia/branches/marble/CMakeLists.txt 2009-01-28 20:32:49 UTC (rev 3476)
+++ vidalia/branches/marble/CMakeLists.txt 2009-01-29 03:36:47 UTC (rev 3477)
@@ -25,9 +25,17 @@
cmake_policy(SET CMP0003 OLD)
endif(COMMAND cmake_policy)
-## Require Qt >= 4.3.0
-set(QT_MIN_VERSION "4.3.0")
+## We declare this option here, because it determines the minimum
+## required Qt version
+option(USE_MARBLE "Enable the KDE Marble-based map widget." OFF)
+## Specify the minimum version of Qt required
+if (USE_MARBLE)
+ set(QT_MIN_VERSION "4.4.0")
+else(USE_MARBLE)
+ set(QT_MIN_VERSION "4.2.0")
+endif(USE_MARBLE)
+
## Specify the Qt libraries used
include(FindQt4)
find_package(Qt4 REQUIRED)
@@ -83,8 +91,10 @@
option(USE_AUTOUPDATE "Enable automatic software update support." OFF)
endif(WIN32)
-## Use the KDE Marble library
-include(${CMAKE_SOURCE_DIR}/cmake/FindMarble.cmake)
+## Find the KDE Marble library
+if (USE_MARBLE)
+ include(${CMAKE_SOURCE_DIR}/cmake/FindMarble.cmake)
+endif(USE_MARBLE)
## Check for system header files
check_include_file("limits.h" HAVE_LIMITS_H)
Modified: vidalia/branches/marble/config.h.in
===================================================================
--- vidalia/branches/marble/config.h.in 2009-01-28 20:32:49 UTC (rev 3476)
+++ vidalia/branches/marble/config.h.in 2009-01-29 03:36:47 UTC (rev 3477)
@@ -30,5 +30,7 @@
#cmakedefine USE_AUTOUPDATE
+#cmakedefine USE_MARBLE
+
#endif
Property changes on: vidalia/branches/marble/debian/faq
___________________________________________________________________
Deleted: svn:mergeinfo
-
Modified: vidalia/branches/marble/src/vidalia/CMakeLists.txt
===================================================================
--- vidalia/branches/marble/src/vidalia/CMakeLists.txt 2009-01-28 20:32:49 UTC (rev 3476)
+++ vidalia/branches/marble/src/vidalia/CMakeLists.txt 2009-01-29 03:36:47 UTC (rev 3477)
@@ -169,9 +169,6 @@
network/routerlistitem.cpp
network/routerlistwidget.cpp
network/streamitem.cpp
- network/tormapwidget.cpp
- network/tormapwidgetinputhandler.cpp
- network/tormapwidgetpopupmenu.cpp
)
qt4_wrap_cpp(vidalia_SRCS
network/circuitlistwidget.h
@@ -180,10 +177,28 @@
network/routerdescriptorview.h
network/routerinfodialog.h
network/routerlistwidget.h
- network/tormapwidget.h
- network/tormapwidgetinputhandler.h
- network/tormapwidgetpopupmenu.h
)
+if (USE_MARBLE)
+ set(vidalia_SRCS ${vidalia_SRCS}
+ network/tormapwidget.cpp
+ network/tormapwidgetinputhandler.cpp
+ network/tormapwidgetpopupmenu.cpp
+ )
+ qt4_wrap_cpp(vidalia_SRCS
+ network/tormapwidget.h
+ network/tormapwidgetinputhandler.h
+ network/tormapwidgetpopupmenu.h
+ )
+else(USE_MARBLE)
+ set(vidalia_SRCS ${vidalia_SRCS}
+ network/tormapimageview.cpp
+ network/zimageview.cpp
+ )
+ qt4_wrap_cpp(vidalia_SRCS
+ network/tormapimageview.h
+ network/zimageview.h
+ )
+endif(USE_MARBLE)
## Choose the correct tray icon implementation for the current platform
set(vidalia_SRCS ${vidalia_SRCS} tray/trayicon.cpp)
@@ -325,57 +340,19 @@
)
## Copy the Marble data into the bundle
- foreach(it ${marble_DATA})
- get_filename_component(outdir ${it} PATH)
- get_filename_component(outfile ${it} NAME)
- set(outdir Vidalia.app/Contents/Resources/data/${outdir})
-
- add_custom_command(TARGET ${vidalia_BIN} POST_BUILD
- COMMAND ${CMAKE_COMMAND}
- ARGS -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/${outdir}
- COMMAND ${CMAKE_COMMAND}
- ARGS -E copy_if_different
- ${MARBLE_DATA_DIR}/${it}
- ${CMAKE_CURRENT_BINARY_DIR}/${outdir}/${outfile}
- )
- endforeach(it)
-
- ## Create the Marble plugins directory and copy in any wanted plugins
- if (MARBLE_PLUGINS)
- add_custom_command(TARGET ${vidalia_BIN} POST_BUILD
- COMMAND ${CMAKE_COMMAND}
- ARGS -E make_directory
- ${CMAKE_CURRENT_BINARY_DIR}/Vidalia.app/Contents/Resources/plugins
- )
- foreach(it ${MARBLE_PLUGINS})
- add_custom_command(TARGET ${vidalia_BIN} POST_BUILD
- COMMAND ${CMAKE_COMMAND}
- ARGS -E copy_if_different ${it}
- ${CMAKE_CURRENT_BINARY_DIR}/Vidalia.app/Contents/Resources/plugins/
- )
- endforeach(it)
- endif(MARBLE_PLUGINS)
-
-else(APPLE)
- ## Set the output file name
- set(vidalia_BIN vidalia)
-
- if (WIN32)
- ## Create a Windows binary
- win32_wrap_rc(vidalia_SRCS res/vidalia_win.rc)
- add_executable(${vidalia_BIN} WIN32 ${vidalia_SRCS})
-
- ## Copy the Marble data into the data/ directory under the binary
+ if (USE_MARBLE)
foreach(it ${marble_DATA})
get_filename_component(outdir ${it} PATH)
get_filename_component(outfile ${it} NAME)
+ set(outdir Vidalia.app/Contents/Resources/data/${outdir})
add_custom_command(TARGET ${vidalia_BIN} POST_BUILD
COMMAND ${CMAKE_COMMAND}
ARGS -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/${outdir}
COMMAND ${CMAKE_COMMAND}
- ARGS -E copy_if_different ${MARBLE_DATA_DIR}/${it}
- ${CMAKE_CURRENT_BINARY_DIR}/data/${it}
+ ARGS -E copy_if_different
+ ${MARBLE_DATA_DIR}/${it}
+ ${CMAKE_CURRENT_BINARY_DIR}/${outdir}/${outfile}
)
endforeach(it)
@@ -383,17 +360,58 @@
if (MARBLE_PLUGINS)
add_custom_command(TARGET ${vidalia_BIN} POST_BUILD
COMMAND ${CMAKE_COMMAND}
- ARGS -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/plugins
+ ARGS -E make_directory
+ ${CMAKE_CURRENT_BINARY_DIR}/Vidalia.app/Contents/Resources/plugins
)
foreach(it ${MARBLE_PLUGINS})
add_custom_command(TARGET ${vidalia_BIN} POST_BUILD
COMMAND ${CMAKE_COMMAND}
- ARGS -E copy_if_different ${it}
- ${CMAKE_CURRENT_BINARY_DIR}/plugins/
+ ARGS -E copy_if_different ${it}
+ ${CMAKE_CURRENT_BINARY_DIR}/Vidalia.app/Contents/Resources/plugins/
)
endforeach(it)
endif(MARBLE_PLUGINS)
+ endif(USE_MARBLE)
+else(APPLE)
+ ## Set the output file name
+ set(vidalia_BIN vidalia)
+ if (WIN32)
+ ## Create a Windows binary
+ win32_wrap_rc(vidalia_SRCS res/vidalia_win.rc)
+ add_executable(${vidalia_BIN} WIN32 ${vidalia_SRCS})
+
+ ## Copy the Marble data into the data/ directory under the binary
+ if (USE_MARBLE)
+ foreach(it ${marble_DATA})
+ get_filename_component(outdir ${it} PATH)
+ get_filename_component(outfile ${it} NAME)
+
+ add_custom_command(TARGET ${vidalia_BIN} POST_BUILD
+ COMMAND ${CMAKE_COMMAND}
+ ARGS -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/${outdir}
+ COMMAND ${CMAKE_COMMAND}
+ ARGS -E copy_if_different ${MARBLE_DATA_DIR}/${it}
+ ${CMAKE_CURRENT_BINARY_DIR}/data/${it}
+ )
+ endforeach(it)
+
+ ## Create the Marble plugins directory and copy in any wanted plugins
+ if (MARBLE_PLUGINS)
+ add_custom_command(TARGET ${vidalia_BIN} POST_BUILD
+ COMMAND ${CMAKE_COMMAND}
+ ARGS -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/plugins
+ )
+ foreach(it ${MARBLE_PLUGINS})
+ add_custom_command(TARGET ${vidalia_BIN} POST_BUILD
+ COMMAND ${CMAKE_COMMAND}
+ ARGS -E copy_if_different ${it}
+ ${CMAKE_CURRENT_BINARY_DIR}/plugins/
+ )
+ endforeach(it)
+ endif(MARBLE_PLUGINS)
+ endif(USE_MARBLE)
+
else (WIN32)
## Non-Windows, non-Mac
add_executable(${vidalia_BIN} ${vidalia_SRCS})
@@ -412,6 +430,9 @@
if (USE_MINIUPNPC)
target_link_libraries(${vidalia_BIN} miniupnpc)
endif(USE_MINIUPNPC)
+if (USE_MARBLE)
+ target_link_libraries(${vidalia_BIN} ${MARBLE_LIBRARIES})
+endif(USE_MARBLE)
if (WIN32)
target_link_libraries(${vidalia_BIN}
Modified: vidalia/branches/marble/src/vidalia/network/circuitlistwidget.cpp
===================================================================
--- vidalia/branches/marble/src/vidalia/network/circuitlistwidget.cpp 2009-01-28 20:32:49 UTC (rev 3476)
+++ vidalia/branches/marble/src/vidalia/network/circuitlistwidget.cpp 2009-01-29 03:36:47 UTC (rev 3477)
@@ -18,6 +18,7 @@
#include <QTimer>
#include <vidalia.h>
+#include "config.h"
#include "circuitlistwidget.h"
#define IMG_CLOSE ":/images/22x22/edit-delete.png"
@@ -83,13 +84,15 @@
return;
/* Set up the circuit context menu */
-// QAction *zoomAct = new QAction(QIcon(IMG_ZOOM),
-// tr("Zoom to Circuit"), this);
+ QAction *zoomAct = new QAction(QIcon(IMG_ZOOM),
+ tr("Zoom to Circuit"), this);
QAction *closeAct = new QAction(QIcon(IMG_CLOSE),
tr("Close Circuit (Del)"), this);
-// zoomAct->setEnabled(circuitItem->circuit().status() == Circuit::Built);
-// menu.addAction(zoomAct);
-// menu.addSeparator();
+#if defined(USE_MARBLE)
+ zoomAct->setEnabled(circuitItem->circuit().status() == Circuit::Built);
+ menu.addAction(zoomAct);
+ menu.addSeparator();
+#endif
menu.addAction(closeAct);
/* Display the context menu and find out which (if any) action was
@@ -97,8 +100,8 @@
QAction* action = menu.exec(mapToGlobal(pos));
if (action == closeAct)
emit closeCircuit(circuitItem->id());
-// else if (action == zoomAct)
-// emit zoomToCircuit(circuitItem->id());
+ else if (action == zoomAct)
+ emit zoomToCircuit(circuitItem->id());
} else {
/* A stream was selected */
StreamItem *streamItem = dynamic_cast<StreamItem *>(item);
Modified: vidalia/branches/marble/src/vidalia/network/netviewer.cpp
===================================================================
--- vidalia/branches/marble/src/vidalia/network/netviewer.cpp 2009-01-28 20:32:49 UTC (rev 3476)
+++ vidalia/branches/marble/src/vidalia/network/netviewer.cpp 2009-01-29 03:36:47 UTC (rev 3477)
@@ -67,11 +67,16 @@
resizeSection(CircuitListWidget::ConnectionColumn, 235);
/* Create the TorMapWidget and add it to the dialog */
+#if defined(USE_MARBLE)
_map = new TorMapWidget();
- ui.gridLayout->addWidget(_map);
connect(_map, SIGNAL(displayRouterInfo(QString)),
this, SLOT(displayRouterInfo(QString)));
+#else
+ _map = new TorMapImageView();
+#endif
+ ui.gridLayout->addWidget(_map);
+
/* Connect zoom buttons to TorMapWidget zoom slots */
connect(ui.actionZoomIn, SIGNAL(triggered()), this, SLOT(zoomIn()));
connect(ui.actionZoomOut, SIGNAL(triggered()), this, SLOT(zoomOut()));
@@ -531,14 +536,21 @@
void
NetViewer::zoomIn()
{
+#if defined(USE_MARBLE)
_map->zoomViewBy(40);
+#else
+ _map->zoomIn();
+#endif
}
/** Called when the user clicks the "Zoom Out" button. */
void
NetViewer::zoomOut()
{
+#if defined(USE_MARBLE)
_map->zoomViewBy(-40);
+#else
+ _map->zoomOut();
+#endif
}
-
Modified: vidalia/branches/marble/src/vidalia/network/netviewer.h
===================================================================
--- vidalia/branches/marble/src/vidalia/network/netviewer.h 2009-01-28 20:32:49 UTC (rev 3476)
+++ vidalia/branches/marble/src/vidalia/network/netviewer.h 2009-01-29 03:36:47 UTC (rev 3477)
@@ -26,9 +26,13 @@
#include <vidaliawindow.h>
#include "geoipresolver.h"
-#include "tormapwidget.h"
#include "ui_netviewer.h"
+#if defined(USE_MARBLE)
+#include "tormapwidget.h"
+#else
+#include "tormapimageview.h"
+#endif
class NetViewer : public VidaliaWindow
{
@@ -103,8 +107,6 @@
TorControl* _torControl;
/** Timer that fires once an hour to update the router list. */
QTimer _refreshTimer;
- /** TorMapWidget that displays the map. */
- TorMapWidget* _map;
/** GeoIpResolver used to geolocate routers by IP address. */
GeoIpResolver _geoip;
/** Queue for IPs pending resolution to geographic information. */
@@ -120,7 +122,14 @@
* MAX_RESOLVE_QUEUE_DELAY milliseconds after inserting the first item
* into the queue. */
QTimer _maxResolveQueueTimer;
-
+
+ /** Widget that displays the Tor network map. */
+#if defined(USE_MARBLE)
+ TorMapWidget* _map;
+#else
+ TorMapImageView* _map;
+#endif
+
/** Qt Designer generated object **/
Ui::NetViewer ui;
};
Copied: vidalia/branches/marble/src/vidalia/network/tormapimageview.cpp (from rev 3474, vidalia/trunk/src/vidalia/network/tormapwidget.cpp)
===================================================================
--- vidalia/branches/marble/src/vidalia/network/tormapimageview.cpp (rev 0)
+++ vidalia/branches/marble/src/vidalia/network/tormapimageview.cpp 2009-01-29 03:36:47 UTC (rev 3477)
@@ -0,0 +1,326 @@
+/*
+** 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 tormapimageview.cpp
+** \version $Id$
+** \brief Displays Tor servers and circuits on a map of the world
+*/
+
+#include <QStringList>
+#include <cmath>
+#include "tormapimageview.h"
+
+#define IMG_WORLD_MAP ":/images/map/world-map.png"
+
+/** QPens to use for drawing different map elements */
+#define PEN_ROUTER QPen(QColor("#ff030d"), 1.0)
+#define PEN_CIRCUIT QPen(Qt::yellow, 0.5)
+#define PEN_SELECTED QPen(Qt::green, 2.0)
+
+/** Size of the map image */
+#define IMG_WIDTH 1000
+#define IMG_HEIGHT 507
+
+/** Border between the edge of the image and the actual map */
+#define MAP_TOP 2
+#define MAP_BOTTOM 2
+#define MAP_RIGHT 5
+#define MAP_LEFT 5
+#define MAP_WIDTH (IMG_WIDTH-MAP_LEFT-MAP_RIGHT)
+#define MAP_HEIGHT (IMG_HEIGHT-MAP_TOP-MAP_BOTTOM)
+
+/** Map offset from zero longitude */
+#define MAP_ORIGIN -10
+
+/** Minimum allowable size for this widget */
+#define MIN_SIZE QSize(512,256)
+
+/** Robinson projection table */
+/** Length of the parallel of latitude */
+static float plen[] = {
+ 1.0000, 0.9986, 0.9954, 0.9900,
+ 0.9822, 0.9730, 0.9600, 0.9427,
+ 0.9216, 0.8962, 0.8679, 0.8350,
+ 0.7986, 0.7597, 0.7186, 0.6732,
+ 0.6213, 0.5722, 0.5322
+ };
+
+/** Distance of corresponding parallel from equator */
+static float pdfe[] = {
+ 0.0000, 0.0620, 0.1240, 0.1860,
+ 0.2480, 0.3100, 0.3720, 0.4340,
+ 0.4958, 0.5571, 0.6176, 0.6769,
+ 0.7346, 0.7903, 0.8435, 0.8936,
+ 0.9394, 0.9761, 1.0000
+ };
+
+/** Default constructor */
+TorMapImageView::TorMapImageView(QWidget *parent)
+: ZImageView(parent)
+{
+ QImage map(IMG_WORLD_MAP);
+ setImage(map);
+}
+
+/** Destructor */
+TorMapImageView::~TorMapImageView()
+{
+ clear();
+}
+
+/** Adds a router to the map. */
+void
+TorMapImageView::addRouter(const RouterDescriptor &desc, const GeoIp &geoip)
+{
+ QString id = desc.id();
+ QPointF routerCoord = toMapSpace(geoip.latitude(), geoip.longitude());
+
+ /* Add data the hash of known routers, and plot the point on the map */
+ if (_routers.contains(id))
+ _routers.value(id)->first = routerCoord;
+ else
+ _routers.insert(id, new QPair<QPointF,bool>(routerCoord, false));
+}
+
+/** Adds a circuit to the map using the given ordered list of router IDs. */
+void
+TorMapImageView::addCircuit(const CircuitId &circid, const QStringList &path)
+{
+ QPainterPath *circPainterPath = new QPainterPath;
+
+ /* Build the new circuit */
+ for (int i = 0; i < path.size()-1; i++) {
+ QString fromNode = path.at(i);
+ QString toNode = path.at(i+1);
+
+ /* Add the coordinates of the hops to the circuit */
+ if (_routers.contains(fromNode) && _routers.contains(toNode)) {
+ /* Find the two endpoints for this path segment */
+ QPointF fromPos = _routers.value(fromNode)->first;
+ QPointF endPos = _routers.value(toNode)->first;
+
+ /* Draw the path segment */
+ circPainterPath->moveTo(fromPos);
+ circPainterPath->lineTo(endPos);
+ circPainterPath->moveTo(endPos);
+ }
+ }
+
+ /** Add the data to the hash of known circuits and plot the circuit on the map */
+ if (_circuits.contains(circid)) {
+ /* This circuit is being updated, so just update the path, making sure we
+ * free the memory allocated to the old one. */
+ QPair<QPainterPath*,bool> *circuitPair = _circuits.value(circid);
+ delete circuitPair->first;
+ circuitPair->first = circPainterPath;
+ } else {
+ /* This is a new path, so just add it to our list */
+ _circuits.insert(circid, new QPair<QPainterPath*,bool>(circPainterPath,false));
+ }
+}
+
+/** Removes a circuit from the map. */
+void
+TorMapImageView::removeCircuit(const CircuitId &circid)
+{
+ QPair<QPainterPath*,bool> *circ = _circuits.take(circid);
+ QPainterPath *circpath = circ->first;
+ if (circpath) {
+ delete circpath;
+ }
+ delete circ;
+}
+
+/** Selects and highlights the router on the map. */
+void
+TorMapImageView::selectRouter(const QString &id)
+{
+ if (_routers.contains(id)) {
+ QPair<QPointF, bool> *routerPair = _routers.value(id);
+ routerPair->second = true;
+ }
+ repaint();
+}
+
+/** Selects and highlights the circuit with the id <b>circid</b>
+ * on the map. */
+void
+TorMapImageView::selectCircuit(const CircuitId &circid)
+{
+ if (_circuits.contains(circid)) {
+ QPair<QPainterPath*, bool> *circuitPair = _circuits.value(circid);
+ circuitPair->second = true;
+ }
+ repaint();
+}
+
+/** Deselects any highlighted routers or circuits */
+void
+TorMapImageView::deselectAll()
+{
+ /* Deselect all router points */
+ foreach (QString router, _routers.keys()) {
+ QPair<QPointF,bool> *routerPair = _routers.value(router);
+ routerPair->second = false;
+ }
+ /* Deselect all circuit paths */
+ foreach (CircuitId circid, _circuits.keys()) {
+ QPair<QPainterPath*,bool> *circuitPair = _circuits.value(circid);
+ circuitPair->second = false;
+ }
+}
+
+/** Clears the list of routers and removes all the data on the map */
+void
+TorMapImageView::clear()
+{
+ /* Clear out all the router points and free their memory */
+ foreach (QString router, _routers.keys()) {
+ delete _routers.take(router);
+ }
+ /* Clear out all the circuit paths and free their memory */
+ foreach (CircuitId circid, _circuits.keys()) {
+ QPair<QPainterPath*,bool> *circuitPair = _circuits.take(circid);
+ delete circuitPair->first;
+ delete circuitPair;
+ }
+}
+
+/** Draws the routers and paths onto the map image. */
+void
+TorMapImageView::paintImage(QPainter *painter)
+{
+ painter->setRenderHint(QPainter::Antialiasing);
+
+ /* Draw the router points */
+ foreach(QString router, _routers.keys()) {
+ QPair<QPointF,bool> *routerPair = _routers.value(router);
+ painter->setPen((routerPair->second ? PEN_SELECTED : PEN_ROUTER));
+ painter->drawPoint(routerPair->first);
+ }
+ /* Draw the circuit paths */
+ foreach(CircuitId circid, _circuits.keys()) {
+ QPair<QPainterPath*,bool> *circuitPair = _circuits.value(circid);
+ painter->setPen((circuitPair->second ? PEN_SELECTED : PEN_CIRCUIT));
+ painter->drawPath(*(circuitPair->first));
+ }
+}
+
+/** Converts world space coordinates into map space coordinates */
+QPointF
+TorMapImageView::toMapSpace(float latitude, float longitude)
+{
+ float width = MAP_WIDTH;
+ float height = MAP_HEIGHT;
+ float deg = width / 360.0;
+ longitude += MAP_ORIGIN;
+
+ float lat;
+ float lon;
+
+ lat = floor(longitude * (deg * lerp(abs(int(latitude)), plen))
+ + width/2 + MAP_LEFT);
+
+ if (latitude < 0) {
+ lon = floor((height/2) + (lerp(abs(int(latitude)), pdfe) * (height/2))
+ + MAP_TOP);
+ } else {
+ lon = floor((height/2) - (lerp(abs(int(latitude)), pdfe) * (height/2))
+ + MAP_TOP);
+ }
+
+ return QPointF(lat, lon);
+}
+
+/** Linearly interpolates using the values in the Robinson projection table */
+float
+TorMapImageView::lerp(float input, float *table)
+{
+ int x = int(floor(input / 5));
+
+ return ((table[x+1] - table[x]) /
+ (((x+1)*5) - (x*5))) * (input - x*5) + table[x];
+}
+
+/** Returns the minimum size of the widget */
+QSize
+TorMapImageView::minimumSizeHint() const
+{
+ return MIN_SIZE;
+}
+
+/** Zooms to fit all currently displayed circuits on the map. If there are no
+ * circuits on the map, the viewport will be returned to its default position
+ * (zoomed all the way out and centered). */
+void
+TorMapImageView::zoomToFit()
+{
+ QRectF rect = circuitBoundingBox();
+
+ if (rect.isNull()) {
+ /* If there are no circuits, zoom all the way out */
+ resetZoomPoint();
+ zoom(0.0);
+ } else {
+ /* Zoom in on the displayed circuits */
+ float zoomLevel = 1.0 - qMax(rect.height()/float(MAP_HEIGHT),
+ rect.width()/float(MAP_WIDTH));
+
+ zoom(rect.center().toPoint(), zoomLevel+0.2);
+ }
+}
+
+/** Zoom to the circuit on the map with the given <b>circid</b>. */
+void
+TorMapImageView::zoomToCircuit(const CircuitId &circid)
+{
+ if (_circuits.contains(circid)) {
+ QPair<QPainterPath*,bool> *pair = _circuits.value(circid);
+ QRectF rect = ((QPainterPath *)pair->first)->boundingRect();
+ if (!rect.isNull()) {
+ float zoomLevel = 1.0 - qMax(rect.height()/float(MAP_HEIGHT),
+ rect.width()/float(MAP_WIDTH));
+
+ zoom(rect.center().toPoint(), zoomLevel+0.2);
+ }
+ }
+}
+
+/** Zooms in on the router with the given <b>id</b>. */
+void
+TorMapImageView::zoomToRouter(const QString &id)
+{
+ QPair<QPointF,bool> *routerPair;
+
+ if (_routers.contains(id)) {
+ deselectAll();
+ routerPair = _routers.value(id);
+ routerPair->second = true; /* Set the router point to "selected" */
+ zoom(routerPair->first.toPoint(), 1.0);
+ }
+}
+
+/** Computes a bounding box around all currently displayed circuit paths on
+ * the map. */
+QRectF
+TorMapImageView::circuitBoundingBox()
+{
+ QRectF rect;
+
+ /* Compute the union of bounding rectangles for all circuit paths */
+ foreach (CircuitId circid, _circuits.keys()) {
+ QPair<QPainterPath*,bool> *pair = _circuits.value(circid);
+ QPainterPath *circuit = pair->first;
+ rect = rect.unite(circuit->boundingRect());
+ }
+ return rect;
+}
+
Property changes on: vidalia/branches/marble/src/vidalia/network/tormapimageview.cpp
___________________________________________________________________
Added: svn:keywords
+ Id
Added: svn:mergeinfo
+
Added: svn:eol-style
+ native
Copied: vidalia/branches/marble/src/vidalia/network/tormapimageview.h (from rev 3474, vidalia/trunk/src/vidalia/network/tormapwidget.h)
===================================================================
--- vidalia/branches/marble/src/vidalia/network/tormapimageview.h (rev 0)
+++ vidalia/branches/marble/src/vidalia/network/tormapimageview.h 2009-01-29 03:36:47 UTC (rev 3477)
@@ -0,0 +1,86 @@
+/*
+** 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 tormapimageview.h
+** \version $Id$
+** \brief Displays Tor servers and circuits on a map of the world
+*/
+
+#ifndef _TORMAPIMAGEVIEW_H
+#define _TORMAPIMAGEVIEW_H
+
+#include <QHash>
+#include <QPair>
+#include <QPainter>
+#include <QPainterPath>
+#include <circuit.h>
+#include <routerdescriptor.h>
+#include <network/geoip.h>
+
+#include "zimageview.h"
+
+
+class TorMapImageView : public ZImageView
+{
+ Q_OBJECT
+
+public:
+ /** Default constructor. */
+ TorMapImageView(QWidget *parent = 0);
+ /** Destructor. */
+ ~TorMapImageView();
+
+ /** Plots the given router on the map using the given coordinates. */
+ void addRouter(const RouterDescriptor &desc, const GeoIp &geoip);
+ /** Plots the given circuit on the map. */
+ void addCircuit(const CircuitId &circid, const QStringList &path);
+ /** Selects and hightlights a router on the map. */
+ void selectRouter(const QString &id);
+ /** Selects and highlights a circuit on the map. */
+ void selectCircuit(const CircuitId &circid);
+ /** Returns the minimum size of the widget */
+ QSize minimumSizeHint() const;
+
+public slots:
+ /** Removes a circuit from the map. */
+ void removeCircuit(const CircuitId &circid);
+ /** Deselects all the highlighted circuits and routers */
+ void deselectAll();
+ /** Clears the known routers and removes all the data from the map */
+ void clear();
+ /** Zooms to fit all currently displayed circuits on the map. */
+ void zoomToFit();
+ /** Zoom to a particular router on the map. */
+ void zoomToRouter(const QString &id);
+ /** Zoom to the circuit on the map with the given <b>circid</b>. */
+ void zoomToCircuit(const CircuitId &circid);
+
+protected:
+ /** Paints the current circuits and streams on the image. */
+ virtual void paintImage(QPainter *painter);
+
+private:
+ /** Converts world space coordinates into map space coordinates */
+ QPointF toMapSpace(float latitude, float longitude);
+ /** Linearly interpolates using the values in the projection table */
+ float lerp(float input, float *table);
+ /** Computes a bounding box around all currently displayed circuit paths on
+ * the map. */
+ QRectF circuitBoundingBox();
+
+ /** Stores map locations for tor routers */
+ QHash<QString, QPair<QPointF,bool>* > _routers;
+ /** Stores circuit information */
+ QHash<CircuitId, QPair<QPainterPath *,bool>* > _circuits;
+};
+
+#endif
+
Property changes on: vidalia/branches/marble/src/vidalia/network/tormapimageview.h
___________________________________________________________________
Added: svn:keywords
+ Id
Added: svn:mergeinfo
+
Added: svn:eol-style
+ native
Copied: vidalia/branches/marble/src/vidalia/network/zimageview.cpp (from rev 3476, vidalia/trunk/src/vidalia/network/zimageview.cpp)
===================================================================
--- vidalia/branches/marble/src/vidalia/network/zimageview.cpp (rev 0)
+++ vidalia/branches/marble/src/vidalia/network/zimageview.cpp 2009-01-29 03:36:47 UTC (rev 3477)
@@ -0,0 +1,373 @@
+/*
+** 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 zimageview.cpp
+** \version $Id$
+** \brief Displays an image and allows zooming and panning
+*/
+
+#include <cmath>
+#include <QPainter>
+#include <QMouseEvent>
+
+#include "zimageview.h"
+
+#if QT_VERSION >= 0x040200
+#define CURSOR_NORMAL QCursor(Qt::OpenHandCursor)
+#define CURSOR_MOUSE_PRESS QCursor(Qt::ClosedHandCursor)
+#else
+#define CURSOR_NORMAL QCursor(Qt::CrossCursor)
+#define CURSOR_MOUSE_PRESS QCursor(Qt::SizeAllCursor)
+#endif
+
+
+/** Constructor. */
+ZImageView::ZImageView(QWidget *parent)
+ : QWidget(parent)
+{
+ /* Initialize members */
+ _zoom = 0.0;
+ _desiredX = 0.0;
+ _desiredY = 0.0;
+ _maxZoomFactor = 2.0;
+ _padding = 60;
+
+ setCursor(CURSOR_NORMAL);
+ updateViewport();
+ resetZoomPoint();
+ repaint();
+}
+
+/** Sets the displayed image. */
+void
+ZImageView::setImage(QImage& img)
+{
+ _image = img.copy();
+ updateViewport();
+ resetZoomPoint();
+
+ if (isVisible()) {
+ repaint();
+ }
+}
+
+/** Draws the scaled image on the widget. */
+void
+ZImageView::drawScaledImage()
+{
+ if (!isVisible()) {
+ return;
+ }
+
+ QBrush background(QColor("#fdfdfd"));
+ if (_image.isNull()) {
+ QPainter p(this);
+ p.fillRect(rect(), background);
+ return;
+ }
+
+ QRect sRect = rect();
+ QRect iRect = _image.rect();
+ QRect r = _view;
+
+ // Think of the _view as being overlaid on the image. The _view has the same
+ // aspect ratio as the screen, so we cut the _view region out of the _image
+ // and scale it to the screen dimensions and paint it.
+
+ // There is a slight catch in that the _view may be larger than the image in
+ // one or both directions. In that case, we need to reduce the _view region
+ // to lie within the image, then paint the background around it. Copying
+ // a region from an image where the region is bigger than the image results
+ // in the parts outside the image being black, which is not what we want.
+
+ // The view has the same aspect ratio as the screen, so the vertical and
+ // horizontal scale factors will be equal.
+
+ double scaleFactor = double(sRect.width()) / double(_view.width());
+
+ // Constrain r to lie entirely within the image.
+ if (r.top() < 0) {
+ r.setTop(0);
+ }
+ if (iRect.bottom() < r.bottom()) {
+ r.setBottom(iRect.bottom());
+ }
+ if (r.left() < 0) {
+ r.setLeft(0);
+ }
+ if (iRect.right() < r.right()) {
+ r.setRight(iRect.right());
+ }
+
+ // Figure out the size that the 'r' region will be when drawn to the screen.
+ QSize scaleTo(int(double(r.width()) * scaleFactor),
+ int(double(r.height()) * scaleFactor));
+
+ /** Make a copy of the image so we don't ruin the original */
+ QImage i = _image.copy();
+
+ /** Create a QPainter that draws directly on the copied image and call the
+ * virtual function to draw whatever the subclasses need to on the image. */
+ QPainter painter;
+ painter.begin(&i);
+ paintImage(&painter);
+ painter.end();
+
+ /** Rescale the image copy */
+ i = i.copy(r).scaled(scaleTo,
+ Qt::KeepAspectRatioByExpanding,
+ Qt::SmoothTransformation);
+
+ int extraWidth = int(double(sRect.width() - i.width()) / 2.0);
+ int extraHeight = int(double(sRect.height() - i.height()) / 2.0);
+
+ // We don't want to paint the background
+ // because this isn't double buffered and that would flicker.
+ // We could double buffer it, but that would cost ~3 MB of memory.
+
+ QPainter p(this);
+ if (extraWidth > 0) {
+ p.fillRect(0, 0, extraWidth, sRect.height(), background);
+ p.fillRect(sRect.width() - extraWidth, 0,
+ sRect.width(), sRect.height(), background);
+ }
+
+ if (extraHeight > 0) {
+ p.fillRect(0, 0, sRect.width(), extraHeight, background);
+ p.fillRect(0, sRect.height() - extraHeight,
+ sRect.width(), sRect.height(), background);
+ }
+
+ // Finally, paint the image copy.
+ p.drawImage(extraWidth, extraHeight, i);
+}
+
+/** Updates the displayed viewport. */
+void
+ZImageView::updateViewport(int screendx, int screendy)
+{
+ /* The gist of this is to find the biggest and smallest possible viewports,
+ * then use the _zoom factor to interpolate between them. Also pan the
+ * viewport, but constrain each dimension to lie within the image or to be
+ * centered if the image is too small in that direction. */
+
+ QRect sRect = rect();
+ QRect iRect = _image.rect();
+
+ float sw = float(sRect.width());
+ float sh = float(sRect.height());
+ float iw = float(iRect.width());
+ float ih = float(iRect.height());
+
+ // Get the initial max and min sizes for the viewport. These won't have the
+ // correct aspect ratio. They will actually be the least upper bound and
+ // greatest lower bound of the set containing the screen and image rects.
+ float maxw = float(std::max<int>(sRect.width(), iRect.width())) + _padding;
+ float maxh = float(std::max<int>(sRect.height(), iRect.height())) + _padding;
+ float minw = std::ceil(float(sRect.width()) / _maxZoomFactor);
+ float minh = std::ceil(float(sRect.height()) / _maxZoomFactor);
+
+ // Now that we have the glb and the lub, we expand/shrink them until
+ // the aspect ratio is that of the screen.
+ float aspect = sw / sh;
+
+ // Fix the max rect.
+ float newmaxh = maxh;
+ float newmaxw = aspect * newmaxh;
+ if (newmaxw < maxw) {
+ newmaxw = maxw;
+ newmaxh = maxw / aspect;
+ }
+
+ // Fix the min rect.
+ float newminh = minh;
+ float newminw = aspect * newminh;
+ if (minw < newminw) {
+ newminw = minw;
+ newminh = newminw / aspect;
+ }
+
+ // Now interpolate between max and min.
+ float vw = (1.0f - _zoom) * (newmaxw - newminw) + newminw;
+ float vh = (1.0f - _zoom) * (newmaxh - newminh) + newminh;
+
+ _view.setWidth(int(vw));
+ _view.setHeight(int(vh));
+
+ // Now pan the view
+
+ // Convert the pan delta from screen coordinates to view coordinates.
+ float vdx = vw * (float(screendx) / sw);
+ float vdy = vh * (float(screendy) / sh);
+
+ // Constrain the center of the viewport to the image rect.
+ _desiredX = qBound(0.0f, _desiredX + vdx, iw);
+ _desiredY = qBound(0.0f, _desiredY + vdy, ih);
+ _view.moveCenter(QPoint(int(_desiredX), int(_desiredY)));
+
+ QPoint viewCenter = _view.center();
+ float vx = viewCenter.x();
+ float vy = viewCenter.y();
+
+ // The viewport may be wider than the height and/or width. In that case,
+ // center the view over the image in the appropriate directions.
+ //
+ // If the viewport is smaller than the image in either direction, then make
+ // sure the edge of the viewport isn't past the edge of the image.
+
+ vdx = 0;
+ vdy = 0;
+
+ if (iw <= vw) {
+ vdx = (iw / 2.0f) - vx; // Center horizontally.
+ } else {
+ // Check that the edge of the view isn't past the edge of the image.
+ float vl = float(_view.left());
+ float vr = float(_view.right());
+ if (vl < 0) {
+ vdx = -vl;
+ } else if (vr > iw) {
+ vdx = iw - vr;
+ }
+ }
+
+ if (ih <= vh) {
+ vdy = (ih / 2.0f) - vy; // Center vertically.
+ } else {
+ // Check that the edge of the view isn't past the edge of the image.
+ float vt = float(_view.top());
+ float vb = float(_view.bottom());
+ if (vt < 0) {
+ vdy = -vt;
+ } else if (vb > ih) {
+ vdy = ih - vb;
+ }
+ }
+
+ _view.translate(int(vdx), int(vdy));
+}
+
+/** Resets the zoom point back to the center of the viewport. */
+void
+ZImageView::resetZoomPoint()
+{
+ QPoint viewCenter = _view.center();
+ _desiredX = viewCenter.x();
+ _desiredY = viewCenter.y();
+}
+
+/** Handles repainting this widget by updating the viewport and drawing the
+ * scaled image. */
+void
+ZImageView::paintEvent(QPaintEvent*)
+{
+ updateViewport();
+ drawScaledImage();
+}
+
+/** Sets the current zoom percentage to the given value and scrolls the
+ * viewport to center the given point. */
+void
+ZImageView::zoom(QPoint zoomAt, float pct)
+{
+ _desiredX = zoomAt.x();
+ _desiredY = zoomAt.y();
+ zoom(pct);
+}
+
+/** Sets the current zoom percentage to the given value. */
+void
+ZImageView::zoom(float pct)
+{
+ _zoom = qBound(0.0f, pct, 1.0f);
+ repaint();
+}
+
+/** Zooms into the image by 10% */
+void
+ZImageView::zoomIn()
+{
+ zoom(_zoom + .1);
+}
+
+/** Zooms away from the image by 10% */
+void
+ZImageView::zoomOut()
+{
+ zoom(_zoom - .1);
+}
+
+/** Responds to the user pressing a mouse button. */
+void
+ZImageView::mousePressEvent(QMouseEvent *e)
+{
+ e->accept();
+ setCursor(CURSOR_MOUSE_PRESS);
+ _mouseX = e->x();
+ _mouseY = e->y();
+}
+
+/** Responds to the user releasing a mouse button. */
+void
+ZImageView::mouseReleaseEvent(QMouseEvent *e)
+{
+ e->accept();
+ setCursor(CURSOR_NORMAL);
+ updateViewport();
+ resetZoomPoint();
+}
+
+/** Responds to the user double-clicking a mouse button on the image. A left
+ * double-click zooms in on the image and a right double-click zooms out.
+ * Zooming is centered on the location of the double-click. */
+void
+ZImageView::mouseDoubleClickEvent(QMouseEvent *e)
+{
+ e->accept();
+
+ QPoint center = rect().center();
+ int dx = e->x() - center.x();
+ int dy = e->y() - center.y();
+ updateViewport(dx, dy);
+ resetZoomPoint();
+
+ Qt::MouseButton btn = e->button();
+ if (btn == Qt::LeftButton)
+ zoomIn();
+ else if (btn == Qt::RightButton)
+ zoomOut();
+}
+
+/** Responds to the user moving the mouse. */
+void
+ZImageView::mouseMoveEvent(QMouseEvent *e)
+{
+ e->accept();
+ int dx = _mouseX - e->x();
+ int dy = _mouseY - e->y();
+ _mouseX = e->x();
+ _mouseY = e->y();
+
+ updateViewport(dx, dy);
+ if (0.001 <= _zoom) {
+ repaint();
+ }
+}
+
+void
+ZImageView::wheelEvent(QWheelEvent *e)
+{
+ if (e->delta() > 0) {
+ zoomIn();
+ } else {
+ zoomOut();
+ }
+}
Copied: vidalia/branches/marble/src/vidalia/network/zimageview.h (from rev 3476, vidalia/trunk/src/vidalia/network/zimageview.h)
===================================================================
--- vidalia/branches/marble/src/vidalia/network/zimageview.h (rev 0)
+++ vidalia/branches/marble/src/vidalia/network/zimageview.h 2009-01-29 03:36:47 UTC (rev 3477)
@@ -0,0 +1,88 @@
+/*
+** 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 zimageview.h
+** \version $Id$
+** \brief Displays an image and allows zooming and panning
+*/
+
+#ifndef ZIMAGEVIEW_H
+#define ZIMAGEVIEW_H
+
+#include <QImage>
+#include <QPixmap>
+#include <QWidget>
+
+
+class ZImageView : public QWidget
+{
+ Q_OBJECT
+
+public:
+ /** Default constructor. */
+ ZImageView(QWidget *parent = 0);
+ /** Sets the displayed image. */
+ void setImage(QImage& pixmap);
+
+public slots:
+ /** Resets the center zoom point back to the center of the viewport. */
+ void resetZoomPoint();
+ /** Sets the current zoom level to the given percent. */
+ void zoom(float pct);
+ /** Sets the current zoom level to the given percent and scrolls the window
+ * to place the specified point in the middle. */
+ void zoom(QPoint zoomAt, float pct);
+ /** Zooms into the displayed image by 5% */
+ void zoomIn();
+ /** Zooms away from the displayed image by 5% */
+ void zoomOut();
+
+protected:
+ /** Virtual method to let subclasses paint on the image before it's scaled. */
+ virtual void paintImage(QPainter *painter) { Q_UNUSED(painter); }
+ /** Updates the viewport and repaints the displayed image. */
+ virtual void paintEvent(QPaintEvent*);
+ /** Handles the user pressing a mouse button. */
+ virtual void mousePressEvent(QMouseEvent* e);
+ /** Handles the user releasing a mouse button. */
+ virtual void mouseReleaseEvent(QMouseEvent* e);
+ /** Handles the user moving the mouse. */
+ virtual void mouseMoveEvent(QMouseEvent* e);
+ /** Handles the user double-clicking a mouse button. */
+ virtual void mouseDoubleClickEvent(QMouseEvent *e);
+ /** Handles the wheel events. */
+ virtual void wheelEvent(QWheelEvent *e);
+
+ /** Update the viewport. This will set _view to a region that,
+ * when copied from the image and scaled to the screen size, will
+ * show what is expected. The _view may be larger in one or more
+ * directions than the image, and you must deal with the
+ * non-overlapping regions. */
+ void updateViewport(int screendx=0, int screendy=0);
+ /** Redraws the scaled image in the viewport. */
+ void drawScaledImage();
+
+private:
+ float _zoom; /**< The current zoom level. */
+ QImage _image; /**< The displayed image. */
+ float _padding; /**< Amount of padding to use on the side of the image. */
+ float _maxZoomFactor; /**< Maximum amount to zoom into the image. */
+
+ int _mouseX; /**< The x-coordinate of the current mouse position. */
+ int _mouseY; /**< The y-coordinate of the current mouse position. */
+
+ QRect _view; /**< The displayed viewport. */
+ float _desiredX; /**< The X value we desire (???). */
+ float _desiredY; /**< The Y value we desire (???). */
+};
+
+#endif
+
Property changes on: vidalia/branches/marble/src/vidalia/res/map
___________________________________________________________________
Added: svn:ignore
+ vidalia_win.rc
Thumbs.db
Copied: vidalia/branches/marble/src/vidalia/res/map/world-map.png (from rev 3437, vidalia/branches/marble/src/vidalia/res/map/world-map.png)
===================================================================
(Binary files differ)
Modified: vidalia/branches/marble/src/vidalia/res/vidalia.qrc
===================================================================
--- vidalia/branches/marble/src/vidalia/res/vidalia.qrc 2009-01-28 20:32:49 UTC (rev 3476)
+++ vidalia/branches/marble/src/vidalia/res/vidalia.qrc 2009-01-29 03:36:47 UTC (rev 3477)
@@ -281,6 +281,9 @@
<file>flags/zw.png</file>
<file>flags/unknown.png</file>
</qresource>
+ <qresource prefix="/images">
+ <file>map/world-map.png</file>
+ </qresource>
<qresource prefix="/geoip">
<file>cacert_root.crt</file>
</qresource>
Modified: vidalia/branches/marble/src/vidalia/vidalia.cpp
===================================================================
--- vidalia/branches/marble/src/vidalia/vidalia.cpp 2009-01-28 20:32:49 UTC (rev 3476)
+++ vidalia/branches/marble/src/vidalia/vidalia.cpp 2009-01-29 03:36:47 UTC (rev 3477)
@@ -26,14 +26,16 @@
#include <stringutil.h>
#include <html.h>
#include <stdlib.h>
-#include <MarbleDirs.h>
+#include "config.h"
+#include "vidalia.h"
#ifdef Q_OS_MACX
#include <Carbon/Carbon.h>
#endif
+#ifdef USE_MARBLE
+#include <MarbleDirs.h>
+#endif
-#include "vidalia.h"
-
/* Available command-line arguments. */
#define ARG_LANGUAGE "lang" /**< Argument specifying language. */
#define ARG_GUISTYLE "style" /**< Argument specfying GUI style. */
@@ -121,8 +123,10 @@
/* Creates a TorControl object, used to talk to Tor. */
_torControl = new TorControl();
+#ifdef USE_MARBLE
/* Tell Marble where to stash its generated data */
Marble::MarbleDirs::setMarbleDataPath(dataDirectory());
+#endif
}
/** Destructor */