vidaliawindow.h

Go to the documentation of this file.
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.vidalia-project.net/. No part of Vidalia, including this file,
00007 **  may be copied, modified, propagated, or distributed except according to the
00008 **  terms described in the LICENSE file.
00009 */
00010 
00011 /*
00012 ** \file vidaliawindow.h
00013 ** \version $Id: vidaliawindow.h 2982 2008-08-17 05:58:13Z edmanm $
00014 ** \brief Common superclass for all Vidalia windows
00015 */
00016 
00017 #ifndef _VIDALIAWINDOW_H
00018 #define _VIDALIAWINDOW_H
00019 
00020 #include <QString>
00021 #include <QWidget>
00022 #include <QVariant>
00023 #include <QMainWindow>
00024 #include <vsettings.h>
00025 
00026 
00027 class VidaliaWindow : public QMainWindow
00028 {
00029   Q_OBJECT
00030 
00031 public:
00032   /** Default constructor. */
00033   VidaliaWindow(const QString &name, QWidget *parent = 0,
00034                 Qt::WFlags flags = 0);
00035   /** Destructor. */
00036   ~VidaliaWindow();
00037   
00038   /** Associates a shortcut key sequence with a slot. */
00039   void setShortcut(const QString &shortcut, const char *slot);
00040   /** Saves the size and location of the window. */
00041   void saveWindowState();
00042   /** Restores the last size and location of the window. */
00043   void restoreWindowState();
00044 
00045   /** Gets the saved value of a property associated with this window object.
00046    * If no value was saved, the default value is returned. */
00047   QVariant getSetting(QString name, QVariant defaultValue);
00048   /** Saves a value associated with a setting name for this window object. */
00049   void saveSetting(QString name, QVariant value);
00050 
00051 public slots:
00052   /** Shows or hides this window. */
00053   virtual void setVisible(bool visible);
00054   /** Show this window. This method really just exists for subclasses to 
00055    * override, since QMainWindow::show() is non-virtual. */
00056   virtual void showWindow() { QMainWindow::show(); }
00057 
00058 signals:
00059   /** Emitted when a VidaliaWindow requests help information on the specified
00060    * <b>topic</b>. */
00061   void helpRequested(const QString &topic);
00062 
00063 private:
00064   QString _name;  /**< Name associated with this window. */
00065   VSettings* _settings; /**< Object used to store window properties */
00066 };
00067 
00068 #endif
00069 

Generated on Wed Nov 26 21:03:58 2008 for Vidalia by  doxygen 1.5.6