main.cpp

Go to the documentation of this file.
00001 /***************************************************************************
00002    This file is part of the KDE games lskat program
00003    Copyright (c) 2006 Martin Heni <kde@heni-online.de>
00004 
00005    This library is free software; you can redistribute it and/or
00006    modify it under the terms of the GNU Library General Public
00007    License as published by the Free Software Foundation; either
00008    version 2 of the License, or (at your option) any later version.
00009 
00010    This library is distributed in the hope that it will be useful,
00011    but WITHOUT ANY WARRANTY; without even the implied warranty of
00012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013    Library General Public License for more details.
00014 
00015    You should have received a copy of the GNU Library General Public License
00016    along with this library; see the file COPYING.LIB.  If not, write to
00017    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00018    Boston, MA 02110-1301, USA.
00019 
00020                           Lskat
00021                           -----
00022     begin                : March 2000 
00023     copyright            : (C) 1995-2007 by Martin Heni
00024     email                : kde@heni-online.de
00025  ***************************************************************************/
00026 
00045 #include <kapplication.h>
00046 #include <kcmdlineargs.h>
00047 #include <kdebug.h>
00048 #include <kaboutdata.h>
00049 #include <klocale.h>
00050 #include <kglobal.h>
00051 
00052 #include "mainwindow.h"
00053 #include "lskatglobal.h"
00054 
00055 #define LSKAT_VERSION "v1.40"
00056 
00057 static KCmdLineOptions options[] =
00058 {
00059   { "d", 0, 0},
00060   { "debug <level>", I18N_NOOP("Enter debug level"), 0 },
00061   { "skipintro", I18N_NOOP("Skip intro animation"), 0 },
00062   { "demo", I18N_NOOP("Run game in demo (autoplay) mode"), 0 },
00063   KCmdLineLastOption
00064 };
00065 
00066 
00067 // Debug level for the program
00068 int global_debug = 0;
00069 // Skip intro
00070 bool global_skip_intro = false;
00071 // Demo (autoplay mode)
00072 bool global_demo_mode  = false;
00073 
00074 
00075 int main(int argc, char *argv[])
00076 {
00077   global_debug=0;
00078   KAboutData aboutData( "lskat", I18N_NOOP("LSkat"),
00079                         LSKAT_VERSION,
00080                         I18N_NOOP("Lskat: A desktop card game"),
00081                         KAboutData::License_GPL,
00082                         "(c) 1995-2007, Martin Heni");
00083   aboutData.addAuthor("Martin Heni",0, "kde@heni-online.de");
00084   aboutData.addCredit("KDE", I18N_NOOP("KDE"), 0);
00085   aboutData.addAuthor("Benjamin Meyer", I18N_NOOP("Code Improvements"), 0);
00086   KCmdLineArgs::init( argc, argv, &aboutData );
00087   KCmdLineArgs::addCmdLineOptions( options ); // Add our own options.
00088 
00089   /* command line handling */
00090   KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
00091 
00092 
00093   // Check for debug command line option
00094   if (args->isSet("debug"))
00095   {
00096     global_debug=QString(args->getOption("debug")).toInt();
00097     kDebug(12010) << "Debug level set to " << global_debug << endl;
00098   }
00099   // Check for debug command line option
00100   if (args->isSet("skipintro"))
00101   {
00102     global_skip_intro = true;
00103     kDebug(12010) << "Skip intro cmd line choosen " << global_skip_intro << endl;
00104   }
00105   // Check for debug command line option
00106   if (args->isSet("demo"))
00107   {
00108     global_demo_mode = true;
00109     kDebug(12010) << "Running in demo mode " << global_demo_mode << endl;
00110   }
00111   
00112   KApplication application(true);
00113   KGlobal::locale()->insertCatalog("libkdegames");
00114 
00115   if (application.isSessionRestored())
00116   {
00117     RESTORE(Mainwindow);
00118   }
00119   else
00120   {
00121     Mainwindow *mainwindow = new Mainwindow();
00122     mainwindow->show();
00123   }
00124 
00125   return application.exec();
00126 }
00127 

Generated on Tue May 1 09:34:40 2007 for LSkat by  doxygen 1.4.6