Vidalia 0.3.1
VidaliaWindow.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 VidaliaWindow.h
13** \brief Common superclass for all Vidalia windows
14*/
15
16#ifndef _VIDALIAWINDOW_H
17#define _VIDALIAWINDOW_H
18
19#include "VSettings.h"
20
21#include <QString>
22#include <QWidget>
23#include <QVariant>
24#include <QMainWindow>
25
26
27class VidaliaWindow : public QMainWindow
28{
29 Q_OBJECT
30
31public:
32 /** Default constructor. */
33 VidaliaWindow(const QString &name, QWidget *parent = 0,
34 Qt::WFlags flags = 0);
35 /** Destructor. */
37
38 /** Associates a shortcut key sequence with a slot. */
39 void setShortcut(const QString &shortcut, const char *slot);
40 /** Saves the size and location of the window. */
41 void saveWindowState();
42 /** Restores the last size and location of the window. */
43 void restoreWindowState();
44
45 /** Gets the saved value of a property associated with this window object.
46 * If no value was saved, the default value is returned. */
47 QVariant getSetting(QString name, QVariant defaultValue);
48 /** Saves a value associated with a setting name for this window object. */
49 void saveSetting(QString name, QVariant value);
50
51protected:
52 /** Reimplement the windows' changeEvent() method to check if the event
53 * is a QEvent::LanguageChange event. If so, call retranslateUi(), which
54 * subclasses of VidaliaWindow can reimplement to update their UI. */
55 virtual void changeEvent(QEvent *e);
56 /** Called when the user wants to change the currently visible language. */
57 virtual void retranslateUi();
58
59public slots:
60 /** Shows or hides this window. */
61 virtual void setVisible(bool visible);
62 /** Show this window. This method really just exists for subclasses to
63 * override, since QMainWindow::show() is non-virtual. */
64 virtual void showWindow() { QMainWindow::show(); }
65
66signals:
67 /** Emitted when a VidaliaWindow requests help information on the specified
68 * <b>topic</b>. */
69 void helpRequested(const QString &topic);
70
71private:
72 QString _name; /**< Name associated with this window. */
73 VSettings* _settings; /**< Object used to store window properties */
74};
75
76#endif
77
stop errmsg QVariant
virtual void retranslateUi()
virtual void changeEvent(QEvent *e)
void restoreWindowState()
VidaliaWindow(const QString &name, QWidget *parent=0, Qt::WFlags flags=0)
QVariant getSetting(QString name, QVariant defaultValue)
virtual void showWindow()
Definition: VidaliaWindow.h:64
void saveSetting(QString name, QVariant value)
virtual void setVisible(bool visible)
void saveWindowState()
void setShortcut(const QString &shortcut, const char *slot)
void helpRequested(const QString &topic)
VSettings * _settings
Definition: VidaliaWindow.h:73