Vidalia  0.3.1
RouterDescriptorView.h
Go to the documentation of this file.
1 /*
2 ** This file is part of Vidalia, and is subject to the license terms in the
3 ** LICENSE file, found in the top level directory of this distribution. If you
4 ** did not receive the LICENSE file with this file, you may obtain it from the
5 ** Vidalia source package distributed by the Vidalia Project at
6 ** http://www.torproject.org/projects/vidalia.html. No part of Vidalia,
7 ** including this file, may be copied, modified, propagated, or distributed
8 ** except according to the terms described in the LICENSE file.
9 */
10 
11 /*
12 ** \file RouterDescriptorView.h
13 ** \brief Formats and displays a router descriptor as HTML
14 */
15 
16 #ifndef _ROUTERDESCRIPTORVIEW_H
17 #define _ROUTERDESCRIPTORVIEW_H
18 
19 #include "RouterDescriptor.h"
20 
21 #include <QObject>
22 #include <QTextEdit>
23 #include <QList>
24 #include <QContextMenuEvent>
25 
26 
27 class RouterDescriptorView : public QTextEdit
28 {
29  Q_OBJECT
30 
31 public:
32  /** Default constructor. */
33  RouterDescriptorView(QWidget *parent = 0);
34 
35 public slots:
36  /** Shows the given router descriptor. */
37  void display(RouterDescriptor rd);
38  /** Shows all router descriptors in the given list. */
39  void display(QList<RouterDescriptor> rdlist);
40  /** Copies any selected text to the clipboard. */
41  void copySelectedText();
42 
43 protected:
44  /** Displays a context menu for the user when they right-click on the
45  * widget. */
46  virtual void contextMenuEvent(QContextMenuEvent *event);
47 
48 private:
49  /** Adjusts the displayed uptime to include time since the
50  * router's descriptor was last published. */
51  quint64 adjustUptime(quint64 uptime, QDateTime published);
52 };
53 
54 #endif
55