SVN_SILENT made messages (.desktop file)
[kdeaccessibility.git] / kttsd / kspeak / main.cpp
blob3149f0d9f3282027cefe20e1295f7f69d04f17f6
1 /***************************************************** vim:set ts=4 sw=4 sts=4:
2 kspeak
4 Command-line utility for sending commands to KTTSD service via D-Bus.
5 --------------------------------------------------------------------
6 Copyright:
7 (C) 2006 by Gary Cramblitt <garycramblitt@comcast.net>
8 -------------------
9 Original author: Gary Cramblitt <garycramblitt@comcast.net>
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.
16 This program is distributed in the hope that it will be useful,
17 but WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 GNU General Public License for more details.
21 You should have received a copy of the GNU General Public License
22 along with this program; if not, write to the Free Software
23 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
24 ******************************************************************************/
26 // Qt includes.
28 // KDE includes.
29 #include <klocale.h>
30 #include <kaboutdata.h>
31 #include <kapplication.h>
32 #include <kcmdlineargs.h>
34 #include <stdlib.h>
36 // kspeak includes.
37 #include "kspeak.h"
39 /**
40 * Main routine.
42 int main(int argc, char *argv[])
44 KAboutData aboutdata(
45 "kspeak", 0, ki18n("kspeak"),
46 "0.1.0", ki18n("A utility for sending speech commands to KTTSD service via D-Bus."),
47 KAboutData::License_GPL, ki18n("Copyright 2006, Gary Cramblitt &lt;garycramblitt@comcast.net&gt;"));
48 aboutdata.addAuthor(ki18n("Gary Cramblitt"), ki18n("Maintainer"),"garycramblitt@comcast.net");
50 KCmdLineArgs::init(argc, argv, &aboutdata);
51 // Tell which options are supported
53 KCmdLineOptions options;
54 options.add("e");
55 options.add("echo", ki18n("Echo commands. [off]"));
56 options.add("r");
57 options.add("replies", ki18n("Show KTTSD D-Bus replies. [off]"));
58 options.add("s");
59 options.add("signals", ki18n("Show KTTSD D-Bus signals. [off]"));
60 options.add("k");
61 options.add("startkttsd", ki18n("Start KTTSD if not already running. [off]"));
62 options.add("x");
63 options.add("nostoponerror", ki18n("Continue on error."));
64 options.add("+scriptfile", ki18n("Name of script to run. Use '-' for stdin."));
65 options.add("!+[args...]", ki18n("Optional arguments passed to script."));
66 options.add("", ki18n("Type 'help' for kspeak commands."));
67 KCmdLineArgs::addCmdLineOptions(options);
69 KApplication app(false);
71 KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
72 if (args->count() == 0) KCmdLineArgs::usageError(i18n("No script file specified"));
74 // Create KSpeak object.
75 KSpeak kspeak(args, 0);
76 kspeak.setEcho(args->isSet("echo"));
77 kspeak.setStopOnError(args->isSet("stoponerror"));
78 kspeak.setShowReply(args->isSet("replies"));
79 kspeak.setShowSignals(args->isSet("signals"));
80 if (!kspeak.isKttsdRunning(args->isSet("startkttsd"))) exit (1);
82 // Main event loop.
83 int result = app.exec();
84 return result;