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 2362 2008-02-29 04:30:11Z 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 #if defined(Q_WS_WIN) 00028 setShortcut("Esc", SLOT(close())); 00029 #else 00030 setShortcut("Ctrl+W", SLOT(close())); 00031 #endif 00032 00033 /* Save the TorControl object to use later */ 00034 _torControl = Vidalia::torControl(); 00035 00036 /* Get Vidalia's version number */ 00037 ui.lblVidaliaVersion->setText(Vidalia::version()); 00038 00039 /* Get Qt's version number */ 00040 ui.lblQtVersion->setText(QT_VERSION_STR); 00041 00042 /* Load the brief licensing information and hide it initally */ 00043 loadLicense(); 00044 } 00045 00046 /** Loads the license information */ 00047 void 00048 AboutDialog::loadLicense() 00049 { 00050 QFile licenseFile(":/docs/short_license.txt"); 00051 licenseFile.open(QFile::ReadOnly); 00052 ui.txtLicense->setPlainText(licenseFile.readAll()); 00053 licenseFile.close(); 00054 } 00055 00056 /** Displays the About dialog window **/ 00057 void 00058 AboutDialog::showWindow() 00059 { 00060 /* Access the TorControl object to retrieve version */ 00061 if (_torControl->isRunning()) { 00062 QString version = _torControl->getTorVersionString(); 00063 if (version.isEmpty()) { 00064 version = tr("<Unavailable>"); 00065 } 00066 ui.lblTorVersion->setText(version); 00067 } else { 00068 ui.lblTorVersion->setText(tr("<Not Running>")); 00069 } 00070 VidaliaWindow::showWindow(); 00071 } 00072