main.cpp 3.58 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
/***************************************************************************
                          main.cpp  -  description
                             -------------------
    begin                : mer jui 11 22:27:28 EDT 2001
    copyright            : (C) 2001 by Gaël de Chalendar
    email                : Gael.de.Chalendar@free.fr

This is the standard main function of a KDE application simplified for KsirK

 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
16 17
 *   the Free Software Foundation; either either version 2
   of the License, or (at your option) any later version.of the License, or     *
18 19 20 21 22 23
 *   (at your option) any later version.                                   *
 *                                                                         *
 ***************************************************************************/

#include "kgamewin.h"
#include "GameLogic/gameautomaton.h"
Nemanja Hiršl's avatar
Nemanja Hiršl committed
24
#include <KAboutData>
Frederik Schwarzer's avatar
Frederik Schwarzer committed
25
#include <KCrash>
26
#include "ksirk_debug.h"
Nemanja Hiršl's avatar
Nemanja Hiršl committed
27 28
#include <QApplication>
#include <QCommandLineParser>
29

30 31
#include "../ksirk_version.h"

32 33
int main(int argc, char *argv[])
{
34
  qCDebug(KSIRK_LOG) << "Hello KsirK";
35 36 37
  QApplication app(argc, argv);

  KLocalizedString::setApplicationDomain("ksirk");
Nemanja Hiršl's avatar
Nemanja Hiršl committed
38 39 40

  KAboutData aboutData(QStringLiteral("ksirk"),
                       i18n("KsirK"),
41
                       QStringLiteral(KSIRK_VERSION_STRING),
Nemanja Hiršl's avatar
Nemanja Hiršl committed
42 43 44 45
                       i18n("KsirK - World Domination Strategy Game"),
                       KAboutLicense::GPL,
                       i18n("(c) 2002-2015, Gaël de Chalendar\n"),
                       i18n("For help and user manual, please see\nthe KsirK web site."),
46
                       QStringLiteral("https://kde.org/applications/games/org.kde.ksirk"));
47

Nemanja Hiršl's avatar
Nemanja Hiršl committed
48 49 50 51 52 53 54
  aboutData.addAuthor(i18n("Gael de Chalendar aka Kleag"),QStringLiteral(), QStringLiteral("kleag@free.fr"));
  aboutData.addAuthor(i18n("Nemanja Hirsl"),i18n("Current maintainer"), QStringLiteral("nemhirsl@gmail.com"));
  aboutData.addAuthor(i18n("Robin Doer"));
  aboutData.addAuthor(i18n("Albert Astals Cid"));
  aboutData.addAuthor(i18n("Michal Golunski (Polish translation)"),QStringLiteral(), QStringLiteral("michalgolunski@o2.pl"));
  aboutData.addAuthor(i18n("French students of the 'IUP ISI 2007-2008':"));
  aboutData.addAuthor(i18n("&nbsp;&nbsp;Anthony Rey<br/>&nbsp;&nbsp;Benjamin Lucas<br/>&nbsp;&nbsp;Benjamin Moreau<br/>&nbsp;&nbsp;Gaël Clouet<br/>&nbsp;&nbsp;Guillaume Pelouas<br/>&nbsp;&nbsp;Joël Marco<br/>&nbsp;&nbsp;Laurent Dang<br/>&nbsp;&nbsp;Nicolas Linard<br/>&nbsp;&nbsp;Vincent Sac"));
55

Nemanja Hiršl's avatar
Nemanja Hiršl committed
56 57 58 59 60
  aboutData.setOrganizationDomain(QByteArray("kde.org"));
  aboutData.setProductName(QByteArray("ksirk"));

  app.setWindowIcon(QIcon::fromTheme(QStringLiteral("ksirk")));
  KAboutData::setApplicationData(aboutData);
Frederik Schwarzer's avatar
Frederik Schwarzer committed
61
  KCrash::initialize();
Nemanja Hiršl's avatar
Nemanja Hiršl committed
62 63 64 65 66 67
  QCommandLineParser parser;
  parser.addVersionOption();
  parser.addHelpOption();
  aboutData.setupCommandLine(&parser);
  parser.process(app);
  aboutData.processCommandLine(&parser);
68

69 70
  if (app.isSessionRestored())
  {
71
      kRestoreMainWindows<Ksirk::KGameWindow>();
72 73 74
  }
  else
  {
75
    qCDebug(KSIRK_LOG) << "Creating main window";
76
    Ksirk::KGameWindow *ksirk = new Ksirk::KGameWindow();
Nemanja Hiršl's avatar
Nemanja Hiršl committed
77
    ksirk->show();
78
  }
Nemanja Hiršl's avatar
Nemanja Hiršl committed
79

Frederik Schwarzer's avatar
Frederik Schwarzer committed
80 81
  app.setWindowIcon(QIcon::fromTheme(QStringLiteral("ksirk")));

82
  qCDebug(KSIRK_LOG) << "Executing app";
Nemanja Hiršl's avatar
Nemanja Hiršl committed
83 84
  return app.exec();
}