00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
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
00068 int global_debug = 0;
00069
00070 bool global_skip_intro = false;
00071
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 );
00088
00089
00090 KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
00091
00092
00093
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
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
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