• Skip to content
  • Skip to link menu
KDE 4.2 API Reference
  • KDE API Reference
  • API Reference
  • Sitemap
  • Contact Us
 

Plasma

main.cpp

Go to the documentation of this file.
00001 /*
00002  *   Copyright 2006 Aaron Seigo <aseigo@kde.org>
00003  *
00004  *   This program is free software; you can redistribute it and/or modify
00005  *   it under the terms of the GNU General Public License as
00006  *   published by the Free Software Foundation; either version 2,
00007  *   or (at your option) any later version.
00008  *
00009  *   This program is distributed in the hope that it will be useful,
00010  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  *   GNU General Public License for more details
00013  *
00014  *   You should have received a copy of the GNU Library General Public
00015  *   License along with this program; if not, write to the
00016  *   Free Software Foundation, Inc.,
00017  *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
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     //get pos if available
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     //get size
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     //set interval
00074     int interval = args->getOption("interval").toInt(&ok1);
00075     if (ok1) {
00076         w->setInterval(interval);
00077     }
00078 
00079     //set engine
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 }

Plasma

Skip menu "Plasma"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members

API Reference

Skip menu "API Reference"
  • KWin
  •   KWin Libraries
  • Libraries
  •   libkworkspace
  •   libsolidcontrol
  •   libtaskmanager
  • Plasma
  •   Animators
  •   Applets
  •   Engines
  • Solid Modules
Generated for API Reference by doxygen 1.5.7
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal