~neon/ktuberling/master

375 by Albert Astals Cid
Commit my SVG port of KTuberling, Johann agreed it should be moved if i grant it'll be finished before 4.0
1
/***************************************************************************
2
 *   Copyright (C) 1999-2006 by Éric Bischoff <ebischoff@nerim.net>        *
3
 *   Copyright (C) 2007 by Albert Astals Cid <aacid@kde.org>               *
4
 *                                                                         *
5
 *   This program is free software; you can redistribute it and/or modify  *
6
 *   it under the terms of the GNU General Public License as published by  *
7
 *   the Free Software Foundation; either version 2 of the License, or     *
8
 *   (at your option) any later version.                                   *
9
 ***************************************************************************/
1 by Éric Bischoff
First beta for KTuberling - I hope you will enjoy it !
10
761 by Montel Laurent
port to qcommandparser
11
760 by Montel Laurent
Fix includes
12
#include <KLocalizedString>
761 by Montel Laurent
port to qcommandparser
13
14
#include <KAboutData>
803 by Frederik Schwarzer
Use KCrash.
15
#include <KCrash>
761 by Montel Laurent
port to qcommandparser
16
#include <QApplication>
17
#include <QCommandLineParser>
18
#include <QCommandLineOption>
777 by Albert Astals Cid
Use correct from user input
19
#include <QDir>
764 by Montel Laurent
dbus support
20
#include <KDBusService>
1 by Éric Bischoff
First beta for KTuberling - I hope you will enjoy it !
21
#include "toplevel.h"
22
780 by Albert Astals Cid
Increase version just because we're KF5 based now
23
static const char version[] = "1.0.0";
56 by Waldo Bastian
WABA: Use KCmdLineArgs
24
164 by Éric Bischoff
Ooops! Forgot Agnieszka. Sorry.
25
// Main function
1 by Éric Bischoff
First beta for KTuberling - I hope you will enjoy it !
26
int main(int argc, char *argv[])
27
{
764 by Montel Laurent
dbus support
28
  QApplication app(argc, argv);
783 by Albert Astals Cid
Use KLocalizedString::setApplicationDomain instead of -DTRANSLATION_DOMAIN
29
30
  KLocalizedString::setApplicationDomain("ktuberling");
31
795 by Montel Laurent
Use new connect api + QStringLiteral
32
  KAboutData aboutData( QStringLiteral("ktuberling"), i18n("KTuberling"), 
803.1.3 by Burkhard Lück
removed text + make description translated in the about dialog, ack'ed by aacid
33
          version, i18n("Potato game for kids"), KAboutLicense::GPL, 
803 by Frederik Schwarzer
Use KCrash.
34
          i18n("(c) 1999-2009, The KTuberling Developers"));
795 by Montel Laurent
Use new connect api + QStringLiteral
35
  aboutData.addAuthor(i18n("Albert Astals Cid"), i18n("Maintainer"), QStringLiteral("aacid@kde.org"));
36
  aboutData.addAuthor(i18n("Éric Bischoff"), i18n("Former Developer"), QStringLiteral("ebischoff@nerim.net"));
761 by Montel Laurent
port to qcommandparser
37
  aboutData.addCredit(i18n("John Calhoun"), i18n("Original concept and artwork"));
795 by Montel Laurent
Use new connect api + QStringLiteral
38
  aboutData.addCredit(i18n("Agnieszka Czajkowska"), i18n("New artwork"), QStringLiteral("agnieszka@imagegalaxy.de"));
39
  aboutData.addCredit(i18n("Bas Willems"), i18n("New artwork"), QStringLiteral("cybersurfer@euronet.nl"));
40
  aboutData.addCredit(i18n("Roger Larsson"), i18n("Sounds tuning"), QStringLiteral("roger.larsson@norran.net"));
41
  aboutData.addCredit(i18n("Dolores Almansa"), i18n("New artwork"), QStringLiteral("dolores.almansa@corazondemaria.org"));
797 by Frederik Schwarzer
Fix homepage link in about dialog.
42
  aboutData.setHomepage(QStringLiteral("http://games.kde.org/ktuberling"));
803 by Frederik Schwarzer
Use KCrash.
43
  QCommandLineParser parser;
44
  KAboutData::setApplicationData(aboutData);
45
  KCrash::initialize();
795 by Montel Laurent
Use new connect api + QStringLiteral
46
  parser.addOption(QCommandLineOption(QStringList() <<  QStringLiteral("+<tuberling-file>"), i18n("Potato to open")));
761 by Montel Laurent
port to qcommandparser
47
803 by Frederik Schwarzer
Use KCrash.
48
  aboutData.setupCommandLine(&parser);
49
  parser.process(app);
50
  aboutData.processCommandLine(&parser);
761 by Montel Laurent
port to qcommandparser
51
764 by Montel Laurent
dbus support
52
  KDBusService service;
1 by Éric Bischoff
First beta for KTuberling - I hope you will enjoy it !
53
  TopLevel *toplevel=0;
54
286 by Stephan Kulow
some porting
55
  if (app.isSessionRestored())
803 by Frederik Schwarzer
Use KCrash.
56
      RESTORE(TopLevel)
1 by Éric Bischoff
First beta for KTuberling - I hope you will enjoy it !
57
  else {
803 by Frederik Schwarzer
Use KCrash.
58
      toplevel = new TopLevel();
59
      toplevel->show();
867 by Laurent Montel
Use isEmpty
60
      if (!parser.positionalArguments().isEmpty())
803 by Frederik Schwarzer
Use KCrash.
61
          toplevel->open(QUrl::fromUserInput(parser.positionalArguments().at(0), QDir::currentPath()));
62
1 by Éric Bischoff
First beta for KTuberling - I hope you will enjoy it !
63
  }
64
799 by Frederik Schwarzer
Set window icon.
65
  app.setWindowIcon(QIcon::fromTheme(QStringLiteral("ktuberling")));
66
1 by Éric Bischoff
First beta for KTuberling - I hope you will enjoy it !
67
  return app.exec();
68
}