diff options
| author | Tannin <devnull@localhost> | 2014-01-16 20:43:42 +0100 |
|---|---|---|
| committer | Tannin <devnull@localhost> | 2014-01-16 20:43:42 +0100 |
| commit | 40d20ab294ad7afd4b5747b306e45d0f8712a386 (patch) | |
| tree | ca97a4b4c404fc426e3239b0d0262624cca6c65d /src/aboutdialog.cpp | |
| parent | 6ed82866b07414e91dfe0c47ee5f580bfd4fe479 (diff) | |
- added an about dialog
- updated json library
Diffstat (limited to 'src/aboutdialog.cpp')
| -rw-r--r-- | src/aboutdialog.cpp | 82 |
1 files changed, 82 insertions, 0 deletions
diff --git a/src/aboutdialog.cpp b/src/aboutdialog.cpp new file mode 100644 index 00000000..94e4e54c --- /dev/null +++ b/src/aboutdialog.cpp @@ -0,0 +1,82 @@ +/*
+Copyright (C) 2014 Sebastian Herbord. All rights reserved.
+
+This file is part of Mod Organizer.
+
+Mod Organizer is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+Mod Organizer is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+
+#include "aboutdialog.h"
+#include "ui_aboutdialog.h"
+#include <utility.h>
+
+
+AboutDialog::AboutDialog(const QString &version, QWidget *parent)
+ : QDialog(parent)
+ , ui(new Ui::AboutDialog)
+{
+ ui->setupUi(this);
+
+ m_LicenseFiles[LICENSE_LGPL3] = "lgpl-3.0.txt";
+ m_LicenseFiles[LICENSE_GPL3] = "gpl-3.0.txt";
+ m_LicenseFiles[LICENSE_BSD3] = "bsd3.txt";
+ m_LicenseFiles[LICENSE_BOOST] = "boost.txt";
+ m_LicenseFiles[LICENSE_CCBY3] = "by-sa3.txt";
+ m_LicenseFiles[LICENSE_ZLIB] = "zlib.txt";
+
+ addLicense("Qt 4.8.5", LICENSE_LGPL3);
+ addLicense("Qt Json", LICENSE_GPL3);
+ addLicense("Boost Library", LICENSE_BOOST);
+ addLicense("Tango Icon Theme", LICENSE_NONE);
+ addLicense("RRZE Icon Set", LICENSE_CCBY3);
+ addLicense("7-zip", LICENSE_LGPL3);
+ addLicense("ZLib", LICENSE_ZLIB);
+ addLicense("NIF File Format Library", LICENSE_BSD3);
+
+ ui->nameLabel->setText(QString("<span style=\"font-size:12pt; font-weight:600;\">%1 %2</span>").arg(ui->nameLabel->text()).arg(version));
+#ifdef HGID
+ ui->revisionLabel->setText(ui->revisionLabel->text() + " " + HGID);
+#else
+ ui->revisionLabel->setText(ui->revisionLabel->text() + " unknown");
+#endif
+}
+
+
+AboutDialog::~AboutDialog()
+{
+ delete ui;
+}
+
+
+void AboutDialog::addLicense(const QString &name, Licenses license)
+{
+ QListWidgetItem *item = new QListWidgetItem(name);
+ item->setData(Qt::UserRole, license);
+ ui->creditsList->addItem(item);
+}
+
+
+void AboutDialog::on_creditsList_currentItemChanged(QListWidgetItem *current, QListWidgetItem*)
+{
+ auto iter = m_LicenseFiles.find(current->data(Qt::UserRole).toInt());
+ if (iter != m_LicenseFiles.end()) {
+ QString filePath = qApp->applicationDirPath() + "/license/" + iter->second;
+qDebug("%s", qPrintable(filePath));
+ QString text = MOBase::readFileText(filePath);
+ ui->licenseText->setText(text);
+ } else {
+ ui->licenseText->setText(tr("No license"));
+ }
+}
|
