Vidalia  0.2.21
AboutDialog.cpp
Go to the documentation of this file.
1 /*
2 ** This file is part of Vidalia, and is subject to the license terms in the
3 ** LICENSE file, found in the top level directory of this distribution. If you
4 ** did not receive the LICENSE file with this file, you may obtain it from the
5 ** Vidalia source package distributed by the Vidalia Project at
6 ** http://www.torproject.org/projects/vidalia.html. No part of Vidalia,
7 ** including this file, may be copied, modified, propagated, or distributed
8 ** except according to the terms described in the LICENSE file.
9 */
10 
11 /*
12 ** \file AboutDialog.cpp
13 ** \brief Displays information about Vidalia, Tor, and Qt
14 */
15 
16 #include "AboutDialog.h"
17 #include "LicenseDialog.h"
18 #include "Vidalia.h"
19 
20 #include <QFile>
21 #include <QDialog>
22 #include <QPushButton>
23 
24 
25 /** Default Constructor. */
26 AboutDialog::AboutDialog(QWidget *parent, Qt::WindowFlags flags)
27  : QDialog(parent, Qt::CustomizeWindowHint | Qt::WindowSystemMenuHint)
28 {
29  ui.setupUi(this);
30 
31  /* Add a "License" button to the button box at the bottom */
32  QPushButton *licenseButton;
33  licenseButton = ui.buttonBox->addButton(tr("License"),
34  QDialogButtonBox::ActionRole);
35 
36  /* Get Vidalia's version number */
37  ui.lblVidaliaVersion->setText(QString("Vidalia %1").arg(Vidalia::version()));
38 
39  /* Get Tor's version number or hide it if Tor isn't running */
40  if (Vidalia::torControl()->isConnected()) {
41  QString version = Vidalia::torControl()->getTorVersionString();
42  if (! version.isEmpty())
43  ui.lblTorVersion->setText(QString("Tor %1").arg(version));
44  else
45  ui.lblTorVersion->setVisible(false);
46  } else {
47  ui.lblTorVersion->setVisible(false);
48  }
49 
50  /* Get Qt's version number */
51  ui.lblQtVersion->setText(QString("Qt %1").arg(QT_VERSION_STR));
52 
53  /* Display the license information dialog when the "License" button
54  * is clicked. */
55  connect(licenseButton, SIGNAL(clicked()),
56  new LicenseDialog(this), SLOT(exec()));
57 
58  /* Close this dialog when the "Close" button is clicked */
59  connect(ui.buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
60 }
61