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 aboutdialog.cpp 00013 ** \version $Id: aboutdialog.cpp 2983 2008-08-17 05:59:43Z edmanm $ 00014 ** \brief Displays information about Vidalia, Tor, and Qt 00015 */ 00016 00017 #include <QFile> 00018 #include <vidalia.h> 00019 #include "aboutdialog.h" 00020 00021 00022 /** Default Constructor **/ 00023 AboutDialog::AboutDialog(QWidget *parent, Qt::WFlags flags) 00024 : VidaliaWindow("AboutDialog", parent, flags) 00025 { 00026 ui.setupUi(this); 00027 00028 /* Pressing 'Esc' or 'Ctrl+W' will close the window */ 00029 setShortcut("Esc", SLOT(close())); 00030 setShortcut("Ctrl+W", SLOT(close())); 00031 00032 /* Save the TorControl object to use later */ 00033 _torControl = Vidalia::torControl(); 00034 00035 /* Get Vidalia's version number */ 00036 ui.lblVidaliaVersion->setText(Vidalia::version()); 00037 00038 /* Get Qt's version number */ 00039 ui.lblQtVersion->setText(QT_VERSION_STR); 00040 00041 /* Load the brief licensing information and hide it initally */ 00042 loadLicense(); 00043 } 00044 00045 /** Loads the license information */ 00046 void 00047 AboutDialog::loadLicense() 00048 { 00049 QFile licenseFile(":/docs/short_license.txt"); 00050 licenseFile.open(QFile::ReadOnly); 00051 ui.txtLicense->setPlainText(licenseFile.readAll()); 00052 licenseFile.close(); 00053 } 00054 00055 /** Displays the About dialog window **/ 00056 void 00057 AboutDialog::showWindow() 00058 { 00059 /* Access the TorControl object to retrieve version */ 00060 if (_torControl->isRunning()) { 00061 QString version = _torControl->getTorVersionString(); 00062 if (version.isEmpty()) { 00063 version = tr("<Unavailable>"); 00064 } 00065 ui.lblTorVersion->setText(version); 00066 } else { 00067 ui.lblTorVersion->setText(tr("<Not Running>")); 00068 } 00069 VidaliaWindow::showWindow(); 00070 } 00071