Vidalia 0.2.15
|
00001 /* 00002 ** This file is part of Vidalia, and is subject to the license terms in the 00003 ** LICENSE file, found in the top level directory of this distribution. If you 00004 ** did not receive the LICENSE file with this file, you may obtain it from the 00005 ** Vidalia source package distributed by the Vidalia Project at 00006 ** http://www.torproject.org/projects/vidalia.html. No part of Vidalia, 00007 ** including this file, may be copied, modified, propagated, or distributed 00008 ** except according to the terms described in the LICENSE file. 00009 */ 00010 00011 /* 00012 ** \file RouterDescriptorView.h 00013 ** \brief Formats and displays a router descriptor as HTML 00014 */ 00015 00016 #ifndef _ROUTERDESCRIPTORVIEW_H 00017 #define _ROUTERDESCRIPTORVIEW_H 00018 00019 #include "RouterDescriptor.h" 00020 00021 #include <QObject> 00022 #include <QTextEdit> 00023 #include <QList> 00024 #include <QContextMenuEvent> 00025 00026 00027 class RouterDescriptorView : public QTextEdit 00028 { 00029 Q_OBJECT 00030 00031 public: 00032 /** Default constructor. */ 00033 RouterDescriptorView(QWidget *parent = 0); 00034 00035 public slots: 00036 /** Shows the given router descriptor. */ 00037 void display(RouterDescriptor rd); 00038 /** Shows all router descriptors in the given list. */ 00039 void display(QList<RouterDescriptor> rdlist); 00040 /** Copies any selected text to the clipboard. */ 00041 void copySelectedText(); 00042 00043 protected: 00044 /** Displays a context menu for the user when they right-click on the 00045 * widget. */ 00046 virtual void contextMenuEvent(QContextMenuEvent *event); 00047 00048 private: 00049 /** Adjusts the displayed uptime to include time since the 00050 * router's descriptor was last published. */ 00051 quint64 adjustUptime(quint64 uptime, QDateTime published); 00052 }; 00053 00054 #endif 00055