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("interval <ms>", ki18n("Update Interval in milliseconds."));
00048 KCmdLineArgs::addCmdLineOptions(options);
00049
00050 KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
00051
00052 KApplication app;
00053 EngineExplorer* w = new EngineExplorer;
00054
00055 bool ok1,ok2 = false;
00056
00057 int x = args->getOption("height").toInt(&ok1);
00058 int y = args->getOption("width").toInt(&ok2);
00059 if (ok1 & ok2) {
00060 w->resize(x,y);
00061 }
00062
00063
00064 x = args->getOption("x").toInt(&ok1);
00065 y = args->getOption("y").toInt(&ok2);
00066 if (ok1 & ok2) {
00067 w->move(x,y);
00068 }
00069
00070
00071 int interval = args->getOption("interval").toInt(&ok1);
00072 if (ok1) {
00073 w->setInterval(interval);
00074 }
00075
00076
00077 QString engine = args->getOption("engine");
00078 if (!engine.isEmpty()) {
00079 w->setEngine(engine);
00080 }
00081
00082 args->clear();
00083
00084 w->show();
00085 return app.exec();
00086 }