aboutdialog.cpp

Go to the documentation of this file.
00001 /****************************************************************
00002  *  Vidalia is distributed under the following license:
00003  *
00004  *  Copyright (C) 2006,  Matt Edman, Justin Hipple
00005  *
00006  *  This program is free software; you can redistribute it and/or
00007  *  modify it under the terms of the GNU General Public License
00008  *  as published by the Free Software Foundation; either version 2
00009  *  of the License, or (at your option) any later version.
00010  *
00011  *  This program is distributed in the hope that it will be useful,
00012  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  *  GNU General Public License for more details.
00015  *
00016  *  You should have received a copy of the GNU General Public License
00017  *  along with this program; if not, write to the Free Software
00018  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, 
00019  *  Boston, MA  02110-1301, USA.
00020  ****************************************************************/
00021 
00022 /** 
00023  * \file aboutdialog.cpp
00024  * \version $Id: aboutdialog.cpp 1563 2006-12-26 06:06:04Z edmanm $
00025  * \brief Displays information about Vidalia, Tor, and Qt
00026  */
00027 
00028 #include <QFile>
00029 #include <vidalia.h>
00030 #include "aboutdialog.h"
00031 
00032 
00033 /** Default Constructor **/
00034 AboutDialog::AboutDialog(QWidget *parent, Qt::WFlags flags)
00035 : VidaliaWindow("AboutDialog", parent, flags)
00036 {
00037   ui.setupUi(this);
00038 #if defined(Q_WS_WIN)
00039   setShortcut("Esc", SLOT(close()));
00040 #else
00041   setShortcut("Ctrl+W", SLOT(close()));
00042 #endif
00043 
00044   /* Save the TorControl object to use later */
00045   _torControl = Vidalia::torControl();
00046 
00047   /* Get Vidalia's version number */
00048   ui.lblVidaliaVersion->setText(Vidalia::version());
00049 
00050   /* Get Qt's version number */
00051   ui.lblQtVersion->setText(QT_VERSION_STR);
00052 
00053   /* Load the brief licensing information and hide it initally */
00054   loadLicense();
00055 }
00056 
00057 /** Loads the license information */
00058 void
00059 AboutDialog::loadLicense()
00060 {
00061   QFile licenseFile(":/docs/short_license.txt");
00062   licenseFile.open(QFile::ReadOnly);
00063   ui.txtLicense->setPlainText(licenseFile.readAll());
00064   licenseFile.close();
00065 }
00066 
00067 /** Displays the About dialog window **/
00068 void
00069 AboutDialog::showWindow()
00070 {
00071   /* Access the TorControl object to retrieve version */
00072   if (_torControl->isRunning()) {
00073     QString version = _torControl->getTorVersionString();
00074     if (version.isEmpty()) {
00075       version = tr("<Unavailable>");
00076     }
00077     ui.lblTorVersion->setText(version);
00078   } else {
00079     ui.lblTorVersion->setText(tr("<Not Running>"));
00080   }
00081   VidaliaWindow::showWindow();
00082 }
00083 

Generated on Wed Sep 5 15:49:27 2007 for Vidalia by  doxygen 1.5.3