File indexing completed on 2024-04-28 17:02:19

0001 /*
0002    This file is part of Massif Visualizer
0003 
0004    Copyright 2010 Milian Wolff <mail@milianw.de>
0005 
0006    This program is free software; you can redistribute it and/or
0007    modify it under the terms of the GNU General Public License as
0008    published by the Free Software Foundation; either version 2 of
0009    the License or (at your option) version 3 or any later version
0010    accepted by the membership of KDE e.V. (or its successor approved
0011    by the membership of KDE e.V.), which shall act as a proxy
0012    defined in Section 14 of version 3 of the license.
0013 
0014    This program is distributed in the hope that it will be useful,
0015    but WITHOUT ANY WARRANTY; without even the implied warranty of
0016    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0017    GNU General Public License for more details.
0018 
0019    You should have received a copy of the GNU General Public License
0020    along with this program.  If not, see <http://www.gnu.org/licenses/>.
0021 */
0022 
0023 #include <KLocalizedString>
0024 #include <KAboutData>
0025 
0026 #include <QApplication>
0027 #include <QUrl>
0028 #include <QDir>
0029 #include <QCommandLineParser>
0030 #include <QDebug>
0031 
0032 #include "mainwindow.h"
0033 
0034 int main( int argc, char *argv[] )
0035 {
0036     QApplication app(argc, argv);
0037 
0038     KLocalizedString::setApplicationDomain("massif-visualizer");
0039 
0040     KAboutData aboutData(QStringLiteral("massif-visualizer"), i18n("Massif Visualizer"), QStringLiteral("0.6"),
0041                          i18n("A visualizer for output generated by Valgrind's massif tool."), KAboutLicense::LGPL,
0042                          i18n("Copyright 2010-2015, Milian Wolff <mail@milianw.de>"), QString(), QStringLiteral("massif-visualizer@kde.org"));
0043 
0044     aboutData.addAuthor(i18n("Milian Wolff"), i18n("Original author, maintainer"),
0045                         QStringLiteral("mail@milianw.de"), QStringLiteral("http://milianw.de"));
0046 
0047     aboutData.addAuthor(i18n("Arnold Dumas"), i18n("Multiple document interface, bug fixes"),
0048                         QStringLiteral("contact@arnolddumas.fr"), QStringLiteral("http://arnolddumas.fr"));
0049 
0050     aboutData.setOrganizationDomain("kde.org");
0051     KAboutData::setApplicationData(aboutData);
0052 
0053     app.setApplicationName(aboutData.componentName());
0054     app.setApplicationDisplayName(aboutData.displayName());
0055     app.setOrganizationDomain(aboutData.organizationDomain());
0056     app.setWindowIcon(QIcon::fromTheme(QStringLiteral("office-chart-area")));
0057     app.setApplicationVersion(aboutData.version());
0058 
0059     QCommandLineParser parser;
0060     KAboutData::setApplicationData(aboutData);
0061     parser.addVersionOption();
0062     parser.addHelpOption();
0063     aboutData.setupCommandLine(&parser);
0064 
0065     parser.addPositionalArgument(QStringLiteral("files"), i18n( "Files to load" ), i18n("[FILE...]"));
0066 
0067     parser.process(app);
0068     aboutData.processCommandLine(&parser);
0069 
0070     Massif::MainWindow* window = new Massif::MainWindow;
0071 
0072     foreach (const QString &file, parser.positionalArguments()) {
0073         window->openFile(QUrl::fromUserInput(file, QDir::currentPath(), QUrl::AssumeLocalFile));
0074     }
0075 
0076     window->show();
0077     return app.exec();
0078 }