File indexing completed on 2024-12-22 04:17:24

0001 /***************************************************************************
0002  *                                                                         *
0003  *   copyright : (C) 2009 The University of Toronto                        *
0004  *                   netterfield@astro.utoronto.ca                         *
0005  *                                                                         *
0006  *   This program is free software; you can redistribute it and/or modify  *
0007  *   it under the terms of the GNU General Public License as published by  *
0008  *   the Free Software Foundation; either version 2 of the License, or     *
0009  *   (at your option) any later version.                                   *
0010  *                                                                         *
0011  ***************************************************************************/
0012 
0013 #include <config.h>
0014 #include "aboutdialog.h"
0015 
0016 #ifdef KST_HAVE_REVISION_H
0017 #include "kstrevision.h"
0018 #include "authors.h"
0019 #endif
0020 
0021 #include <QDesktopServices>
0022 #include <QDebug>
0023 #include <QTextEdit>
0024 
0025 #include <QStringList>
0026 
0027 namespace Kst {
0028 
0029 AboutDialog::AboutDialog(QWidget *parent)
0030   : QDialog(parent) {
0031    setupUi(this);
0032 
0033 #ifdef KST_HAVE_REVISION_H
0034    QStringList utf8Authors = QString::fromUtf8(kst_authors).trimmed().split(';');
0035    QStringList authors;
0036    foreach(const QString& a, utf8Authors) {
0037      if (!a.startsWith('#')) {
0038       authors << a;
0039      }
0040    }
0041 #else
0042 // qmake support
0043   QStringList authors = QStringList()
0044     << "Barth Netterfield"
0045     << "Joshua Netterfield"
0046     << "Matthew Truch"
0047     << "Nicolas Brisset"
0048     << "Staikos Computing Services Inc."
0049     << "Rick Chern"
0050     << "Sumus Technology Limited"
0051     << "Ted Kisner"
0052     << "The University of British Columbia"
0053     << "The University of Toronto"
0054     << "Andrew Walker"
0055     << "Peter Kümmel"
0056     << "Zongyi Zang";
0057 #endif
0058 
0059   //authors.sort();
0060   authors.replaceInStrings("<", "&lt;");
0061   authors.replaceInStrings(">", "&gt;");
0062   authors.replaceInStrings(QRegExp("^(.*)"), "<li>\\1</li>");
0063 
0064   QStringList msg = QStringList()
0065   << tr("<qt><h2>Kst %1").arg(KSTVERSION)
0066 #ifdef KST_REVISION
0067   << tr(" Revision %1").arg(KST_REVISION)
0068 #endif
0069   << tr("</h2>")
0070   << tr("<h2>A data viewing program.</h2>")
0071   << tr("Copyright &copy; 2000-2017 Barth Netterfield<br><hr>")
0072   << tr("Homepage: <a href=\"http://kst-plot.kde.org/\">http://kst-plot.kde.org/</a><br>")
0073   << tr("Please report bugs with the 'Bug Report Wizard' of the 'Help' menu.<br>")
0074   << tr("<br>Authors and contributors:")
0075   << QString("<ul>")
0076   << authors
0077   << QString("</ul>");
0078   
0079   text->setText(msg.join("\n"));
0080   connect(text, SIGNAL(anchorClicked(QUrl)), this, SLOT(launchURL(QUrl)));
0081 }
0082 
0083 
0084 AboutDialog::~AboutDialog() {
0085 }
0086 
0087 
0088 void AboutDialog::launchURL(const QUrl &link) {
0089   QDesktopServices::openUrl ( link );
0090 }
0091 
0092 }
0093 // vim: ts=2 sw=2 et