moved kdeaccessibility kdeaddons kdeadmin kdeartwork kdebindings kdeedu kdegames...
[kdeedu.git] / kwordquiz / src / main.cpp
blob8fcde10081ad4390b03da9db0f767693c695c4c7
1 /***************************************************************************
2 main.cpp - description
3 -------------------
4 begin : Wed Jul 24 20:12:30 PDT 2002
5 copyright : (C) 2002-2003 by Peter Hedlund
6 email : peter@peterandlinda.com
7 ***************************************************************************/
9 /***************************************************************************
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 ***************************************************************************/
18 #include <kcmdlineargs.h>
19 #include <kaboutdata.h>
21 #include "kwordquiz.h"
22 #include "version.h"
24 static const char *description = I18N_NOOP("A powerful flashcard and vocabulary learning program");
26 static KCmdLineOptions options[] =
28 { "m", 0, 0 },
29 { "mode <number>", I18N_NOOP("A number 1-5 corresponding to the \nentries in the Mode menu"), 0 },
30 { "g", 0, 0 },
31 { "goto <session>", I18N_NOOP("Type of session to start with: \n'flash' for flashcard, \n'mc' for multiple choice, \n'qa' for question and answer"), 0 },
32 { "+[File]", I18N_NOOP("File to open"), 0 },
33 { 0, 0, 0 }
36 int main(int argc, char *argv[])
38 KAboutData aboutData( "kwordquiz", I18N_NOOP("KWordQuiz"), KWQ_VERSION, description, KAboutData::License_GPL, "(c) 2003-2005, Peter Hedlund", 0, 0, "peter@peterandlinda.com");
39 aboutData.addAuthor("Peter Hedlund", 0, "peter@peterandlinda.com");
40 aboutData.addCredit("Anne-Marie Mahfouf", I18N_NOOP("KDE Edutainment Maintainer"), "annma@kde.org", 0);
42 KCmdLineArgs::init( argc, argv, &aboutData );
43 KCmdLineArgs::addCmdLineOptions( options ); // Add our own options.
45 KApplication app;
47 if (app.isRestored())
49 RESTORE(KWordQuizApp);
51 else
53 KWordQuizApp *kwordquiz = new KWordQuizApp();
54 kwordquiz->show();
56 KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
58 if (args->count())
60 kwordquiz->openDocumentFile(args->arg(args->count() - 1));
61 QCString mode = args->getOption("mode");
62 if (!mode.isEmpty())
64 if (mode == "1")
65 kwordquiz->slotMode1();
66 if (mode == "2")
67 kwordquiz->slotMode2();
68 if (mode == "3")
69 kwordquiz->slotMode3();
70 if (mode == "4")
71 kwordquiz->slotMode4();
72 if (mode == "5")
73 kwordquiz->slotMode5();
75 QCString go_to = args->getOption("goto");
76 if (!go_to.isEmpty())
78 if (go_to == "flash")
79 kwordquiz->slotQuizFlash();
80 if (go_to == "mc")
81 kwordquiz->slotQuizMultiple();
82 if (go_to == "qa")
83 kwordquiz->slotQuizQA();
86 else
88 kwordquiz->openDocumentFile();
90 args->clear();
92 return app.exec();