Vidalia  0.3.1
VidaliaTab.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.vidalia-project.net/. No part of Vidalia, including this file,
7 ** may be copied, modified, propagated, or distributed except according to the
8 ** terms described in the LICENSE file.
9 */
10 
11 /*
12 ** \file VidaliaTab.h
13 ** \brief Main tab that shows the current Tor status
14 */
15 
16 #ifndef _VIDALIATAB_H
17 #define _VIDALIATAB_H
18 
19 #include "VSettings.h"
20 
21 #include <QtGui>
22 
23 class VidaliaTab : public QWidget
24 {
25  Q_OBJECT
26 
27 public:
28  /** Default constructor. */
29  VidaliaTab(const QString &title, const QString &name = "", QWidget *parent = 0);
30  /** Destructor. */
31  ~VidaliaTab();
32 
33  /** Returns the tab's title */
34  QString getTitle() const { return _title; }
35  /** Sets the tab's title to title */
36  void setTitle(const QString &title) { _title = title; }
37 
38  /** Associates a shortcut key sequence with a slot. */
39  void setShortcut(const QString &shortcut, const char *slot);
40 
41  /** Gets the saved value of a property associated with this window object.
42  * If no value was saved, the default value is returned. */
43  QVariant getSetting(QString name, QVariant defaultValue);
44  /** Saves a value associated with a setting name for this window object. */
45  void saveSetting(QString name, QVariant value);
46  /** Sets the onTop property of the tab to top */
47  void setOnTop(bool top);
48 
49 signals:
50  /** Emitted when a VidaliaWindow requests help information on the specified
51  * <b>topic</b>. */
52  void helpRequested(const QString &topic);
53 
54  void closeTab();
55 
56 protected:
57  /** Reimplement the windows' changeEvent() method to check if the event
58  * is a QEvent::LanguageChange event. If so, call retranslateUi(), which
59  * subclasses of VidaliaWindow can reimplement to update their UI. */
60  virtual void changeEvent(QEvent *e);
61  /** Called when the user wants to change the currently visible language. */
62  virtual void retranslateUi();
63 
64  virtual void closeEvent(QCloseEvent *event);
65 
66  bool _onTop; /**< True if the current tab is the one being displayed */
67 
68 private:
69  QString _title; /**< Title displayed in the tab */
70  VSettings* _settings; /**< Object used to store window properties */
71 };
72 
73 #endif
74