AboutDialog.cpp

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 AboutDialog.cpp
00013 ** \version $Id: AboutDialog.cpp 3735 2009-04-28 20:28:01Z edmanm $
00014 ** \brief Displays information about Vidalia, Tor, and Qt
00015 */
00016 
00017 #include "AboutDialog.h"
00018 #include "LicenseDialog.h"
00019 #include "Vidalia.h"
00020 
00021 #include <QFile>
00022 #include <QDialog>
00023 #include <QPushButton>
00024 
00025 
00026 /** Default Constructor. */
00027 AboutDialog::AboutDialog(QWidget *parent, Qt::WindowFlags flags)
00028   : QDialog(parent, Qt::CustomizeWindowHint | Qt::WindowSystemMenuHint)
00029 {
00030   ui.setupUi(this);
00031 
00032   /* Add a "License" button to the button box at the bottom */
00033   QPushButton *licenseButton;
00034   licenseButton = ui.buttonBox->addButton(tr("License"),
00035                                           QDialogButtonBox::ActionRole);
00036   
00037   /* Get Vidalia's version number */
00038   ui.lblVidaliaVersion->setText(QString("Vidalia %1").arg(Vidalia::version()));
00039 
00040   /* Get Tor's version number or hide it if Tor isn't running */
00041   if (Vidalia::torControl()->isConnected()) {
00042     QString version = Vidalia::torControl()->getTorVersionString();
00043     if (! version.isEmpty())
00044       ui.lblTorVersion->setText(QString("Tor %1").arg(version));
00045     else
00046       ui.lblTorVersion->setVisible(false);
00047   } else {
00048     ui.lblTorVersion->setVisible(false);
00049   }
00050 
00051   /* Get Qt's version number */
00052   ui.lblQtVersion->setText(QString("Qt %1").arg(QT_VERSION_STR));
00053 
00054   /* Display the license information dialog when the "License" button 
00055    * is clicked. */
00056   connect(licenseButton, SIGNAL(clicked()),
00057           new LicenseDialog(this), SLOT(exec()));
00058 
00059   /* Close this dialog when the "Close" button is clicked */
00060   connect(ui.buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
00061 }
00062 
Generated on Mon Aug 30 22:58:54 2010 for Vidalia by  doxygen 1.6.3