From 7ddeb068d79fac7361c9476ec4b0a3b6f7d9fe5a Mon Sep 17 00:00:00 2001 From: Milian Wolff Date: Mon, 15 Jun 2015 23:29:31 +0200 Subject: [PATCH] Add about data, enable loading of multiple files. --- gui/gui.cpp | 42 ++++++++++++++++++++++++++++++++++-------- 1 file changed, 34 insertions(+), 8 deletions(-) diff --git a/gui/gui.cpp b/gui/gui.cpp index c65054e..b023200 100644 --- a/gui/gui.cpp +++ b/gui/gui.cpp @@ -18,22 +18,48 @@ */ #include +#include -#include "mainwindow.h" - -#include +#include +#include -using namespace std; +#include "mainwindow.h" int main(int argc, char** argv) { QApplication app(argc, argv); + KAboutData aboutData(QStringLiteral("heaptrack_gui"), i18n("Heaptrack GUI"), QStringLiteral("0.1"), + i18n("A visualizer for heaptrack data files."), KAboutLicense::LGPL, + i18n("Copyright 2015, Milian Wolff "), QString(), QStringLiteral("mail@milianw.de")); + + aboutData.addAuthor(i18n("Milian Wolff"), i18n("Original author, maintainer"), + QStringLiteral("mail@milianw.de"), QStringLiteral("http://milianw.de")); + + aboutData.setOrganizationDomain("kde.org"); + KAboutData::setApplicationData(aboutData); + + app.setApplicationName(aboutData.componentName()); + app.setApplicationDisplayName(aboutData.displayName()); + app.setOrganizationDomain(aboutData.organizationDomain()); + app.setWindowIcon(QIcon::fromTheme(QStringLiteral("office-chart-area"))); + app.setApplicationVersion(aboutData.version()); + + QCommandLineParser parser; + KAboutData::setApplicationData(aboutData); + parser.addVersionOption(); + parser.addHelpOption(); + aboutData.setupCommandLine(&parser); + + parser.addPositionalArgument(QStringLiteral("files"), i18n( "Files to load" ), i18n("[FILE...]")); + + parser.process(app); + aboutData.processCommandLine(&parser); - MainWindow window; - if (app.arguments().size() > 1) { - window.loadFile(app.arguments().last()); + foreach (const QString &file, parser.positionalArguments()) { + MainWindow* window = new MainWindow; + window->loadFile(file); + window->show(); } - window.show(); return app.exec(); } \ No newline at end of file -- 2.7.4