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 1260 2006-10-03 04:13:23Z edmanm $ 00025 * \brief Displays information about Vidalia, Tor, and Qt 00026 */ 00027 00028 #include <vidalia.h> 00029 #include "aboutdialog.h" 00030 00031 00032 /** Default Constructor **/ 00033 AboutDialog::AboutDialog(QWidget *parent, Qt::WFlags flags) 00034 : VidaliaWindow("AboutDialog", parent, flags) 00035 { 00036 ui.setupUi(this); 00037 #if defined(Q_WS_MAC) 00038 setShortcut("Ctrl+W", SLOT(close())); 00039 #else 00040 setShortcut("Esc", SLOT(close())); 00041 #endif 00042 00043 /* Save the TorControl object to use later */ 00044 _torControl = Vidalia::torControl(); 00045 00046 /* Get Vidalia's version number */ 00047 ui.lblVidaliaVersion->setText(Vidalia::version()); 00048 00049 /* Get Qt's version number */ 00050 ui.lblQtVersion->setText(QT_VERSION_STR); 00051 00052 /* Load the brief licensing information and hide it initally */ 00053 loadLicense(); 00054 } 00055 00056 /** Loads the license information */ 00057 void 00058 AboutDialog::loadLicense() 00059 { 00060 QFile licenseFile(":/docs/short_license.txt"); 00061 licenseFile.open(QFile::ReadOnly); 00062 ui.txtLicense->setPlainText(licenseFile.readAll()); 00063 licenseFile.close(); 00064 } 00065 00066 /** Displays the About dialog window **/ 00067 void 00068 AboutDialog::show() 00069 { 00070 /* Access the TorControl object to retrieve version */ 00071 if (_torControl->isRunning()) { 00072 QString version = _torControl->getTorVersionString(); 00073 if (version.isEmpty()) { 00074 version = tr("<Unavailable>"); 00075 } 00076 ui.lblTorVersion->setText(version); 00077 } else { 00078 ui.lblTorVersion->setText(tr("<Not Running>")); 00079 } 00080 VidaliaWindow::show(); 00081 } 00082