aboutdialog.cpp
1 //------------------------------------------------------------------------------
2 // aboutdialog.cpp
3 //------------------------------------------------------------------------------
4 //
5 // This program is free software; you can redistribute it and/or
6 // modify it under the terms of the GNU General Public License
7 // as published by the Free Software Foundation; either version 2
8 // of the License, or (at your option) any later version.
9 //
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
14 //
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software
17 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
18 // 02110-1301, USA.
19 //
20 //------------------------------------------------------------------------------
21 // Copyright (C) 2009 "Blzut3" <admin@maniacsvault.net>
22 //------------------------------------------------------------------------------
23 
24 #include "aboutdialog.h"
25 #include "plugins/engineplugin.h"
26 #include "plugins/pluginloader.h"
27 #include "ui_aboutdialog.h"
28 #include "wadseeker/wadseekerversioninfo.h"
29 #include "version.h"
30 #include <QPixmap>
31 
32 DClass<AboutDialog> : public Ui::AboutDialog
33 {
34 };
35 
36 DPointered(AboutDialog)
37 
38 AboutDialog::AboutDialog(QWidget* parent) : QDialog(parent)
39 {
40  d->setupUi(this);
41 
42  connect(d->buttonBox, SIGNAL( clicked(QAbstractButton *) ), SLOT( close() ));
43 
44  // Doomseeker
45  d->versionChangeset->setText(Version::changeset());
46  d->versionNumber->setText(Version::versionRevision());
47  d->lblRevision->setText(QString::number(Version::revisionNumber()));
48  d->logo->setPixmap(QPixmap(":/logo.png"));
49 
50  // Wadseeker
51  d->wadseekerAuthor->setText(WadseekerVersionInfo::author());
52  d->wadseekerDescription->setText(WadseekerVersionInfo::description());
53  d->wadseekerVersion->setText(WadseekerVersionInfo::version());
54  d->wadseekerYearSpan->setText(WadseekerVersionInfo::yearSpan());
55 
56  // Populate plugins dialog
57  for(unsigned i = 0; i < gPlugins->numPlugins(); ++i)
58  {
59  d->pluginBox->addItem( gPlugins->plugin(i)->info()->data()->name);
60  }
61  connect(d->pluginBox, SIGNAL( currentIndexChanged(int) ), SLOT( changePlugin(int) ));
62  changePlugin(0);
63 
64  adjustSize();
65 }
66 
67 AboutDialog::~AboutDialog()
68 {
69 }
70 
71 void AboutDialog::changePlugin(int pluginIndex)
72 {
73  if(static_cast<unsigned> (pluginIndex) >= gPlugins->numPlugins())
74  return; // Invalid plugin.
75 
76  const EnginePlugin* plug = gPlugins->plugin(pluginIndex)->info();
77 
78  d->pluginAuthor->setText(plug->data()->author);
79  d->pluginVersion->setText(QString("Version: %1.%2").arg(plug->data()->abiVersion).arg(plug->data()->version));
80 }
static QString versionRevision()
Combines version and revision strings.
Definition: version.cpp:69
static QString changeset()
Definition: version.cpp:26