Plasma
main.cpp
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #include <KApplication>
00021 #include <KAboutData>
00022 #include <KCmdLineArgs>
00023 #include <KLocale>
00024
00025 #include "engineexplorer.h"
00026
00027 static const char description[] = I18N_NOOP("Explore the data published by Plasma DataEngines");
00028 static const char version[] = "0.0";
00029
00030 int main(int argc, char **argv)
00031 {
00032 KAboutData aboutData("plasmaengineexplorer", 0, ki18n("Plasma Engine Explorer"),
00033 version, ki18n(description), KAboutData::License_GPL,
00034 ki18n("(c) 2006, The KDE Team"));
00035 aboutData.addAuthor(ki18n("Aaron J. Seigo"),
00036 ki18n( "Author and maintainer" ),
00037 "aseigo@kde.org");
00038
00039 KCmdLineArgs::init(argc, argv, &aboutData);
00040
00041 KCmdLineOptions options;
00042 options.add("height <pixels>", ki18n("The desired height in pixels"));
00043 options.add("width <pixels>", ki18n("The desired width in pixels"));
00044 options.add("x <pixels>", ki18n("The desired x position in pixels"));
00045 options.add("y <pixels>", ki18n("The desired y position in pixels"));
00046 options.add("engine <data engine>", ki18n("The data engine to use"));
00047 options.add("source <data engine>", ki18n("The source to request"));
00048 options.add("interval <ms>", ki18n("Update interval in milliseconds"));
00049 options.add("app <application>", ki18n("Only show engines associated with the parent application; "
00050 "maps to the X-KDE-ParentApp entry in the DataEngine's .desktop file."));
00051 KCmdLineArgs::addCmdLineOptions(options);
00052
00053 KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
00054
00055 KApplication app;
00056 EngineExplorer* w = new EngineExplorer;
00057
00058 bool ok1, ok2 = false;
00059
00060 int x = args->getOption("height").toInt(&ok1);
00061 int y = args->getOption("width").toInt(&ok2);
00062 if (ok1 && ok2) {
00063 w->resize(x,y);
00064 }
00065
00066
00067 x = args->getOption("x").toInt(&ok1);
00068 y = args->getOption("y").toInt(&ok2);
00069 if (ok1 && ok2) {
00070 w->move(x,y);
00071 }
00072
00073
00074 int interval = args->getOption("interval").toInt(&ok1);
00075 if (ok1) {
00076 w->setInterval(interval);
00077 }
00078
00079
00080 QString engine = args->getOption("engine");
00081 if (!engine.isEmpty()) {
00082 w->setEngine(engine);
00083
00084 QString source = args->getOption("source");
00085 if (!source.isEmpty()) {
00086 w->requestSource(source);
00087 }
00088 }
00089
00090 if (args->isSet("app")) {
00091 w->setApp(args->getOption("app"));
00092 }
00093
00094 args->clear();
00095
00096 w->show();
00097 return app.exec();
00098 }