Vidalia  0.2.17
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.torproject.org/projects/vidalia.html. No part of Vidalia, 
00007 **  including this file, may be copied, modified, propagated, or distributed 
00008 **  except according to the terms described in the LICENSE file.
00009 */
00010 
00011 /*
00012 ** \file AboutDialog.cpp
00013 ** \brief Displays information about Vidalia, Tor, and Qt
00014 */
00015 
00016 #include "AboutDialog.h"
00017 #include "LicenseDialog.h"
00018 #include "Vidalia.h"
00019 
00020 #include <QFile>
00021 #include <QDialog>
00022 #include <QPushButton>
00023 
00024 
00025 /** Default Constructor. */
00026 AboutDialog::AboutDialog(QWidget *parent, Qt::WindowFlags flags)
00027   : QDialog(parent, Qt::CustomizeWindowHint | Qt::WindowSystemMenuHint)
00028 {
00029   ui.setupUi(this);
00030 
00031   /* Add a "License" button to the button box at the bottom */
00032   QPushButton *licenseButton;
00033   licenseButton = ui.buttonBox->addButton(tr("License"),
00034                                           QDialogButtonBox::ActionRole);
00035   
00036   /* Get Vidalia's version number */
00037   ui.lblVidaliaVersion->setText(QString("Vidalia %1").arg(Vidalia::version()));
00038 
00039   /* Get Tor's version number or hide it if Tor isn't running */
00040   if (Vidalia::torControl()->isConnected()) {
00041     QString version = Vidalia::torControl()->getTorVersionString();
00042     if (! version.isEmpty())
00043       ui.lblTorVersion->setText(QString("Tor %1").arg(version));
00044     else
00045       ui.lblTorVersion->setVisible(false);
00046   } else {
00047     ui.lblTorVersion->setVisible(false);
00048   }
00049 
00050   /* Get Qt's version number */
00051   ui.lblQtVersion->setText(QString("Qt %1").arg(QT_VERSION_STR));
00052 
00053   /* Display the license information dialog when the "License" button 
00054    * is clicked. */
00055   connect(licenseButton, SIGNAL(clicked()),
00056           new LicenseDialog(this), SLOT(exec()));
00057 
00058   /* Close this dialog when the "Close" button is clicked */
00059   connect(ui.buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
00060 }
00061