Author: kmachalkova Date: Wed Jul 8 18:24:55 2009 New Revision: 57955 URL: http://svn.opensuse.org/viewcvs/yast?rev=57955&view=rev Log: Process CLI options ( --help only so far) Modified: trunk/control-center/src/main.cpp Modified: trunk/control-center/src/main.cpp URL: http://svn.opensuse.org/viewcvs/yast/trunk/control-center/src/main.cpp?rev=57955&r1=57954&r2=57955&view=diff ============================================================================== --- trunk/control-center/src/main.cpp (original) +++ trunk/control-center/src/main.cpp Wed Jul 8 18:24:55 2009 @@ -1,19 +1,51 @@ #include <QApplication> #include <QTimer> +#include <iostream> + +using std::cout; +using std::cerr; +using std::endl; + #include "main_window.h" +void printhelpandexit() +{ + cout << "Usage:" + << "\n y2controlcenter [OPTIONS]" + << "\n" + << "\nOPTIONS:" + << "\n" + << "\n --help -h this message" + << "\n --root -r also show \"root only\" modules" + << "\n --fullscreen use full screen" + << "\n --noborder no window manager border for main window" + << endl; + exit (0); +} int main(int argc, char **argv) { -QApplication app(argc, argv); - -MainWindow mainWin; - -mainWin.show(); - -QTimer::singleShot(60, &mainWin, SLOT( initialMsg() )); + QApplication app(argc, argv); -return app.exec(); + for ( int i=0 ;i < argc ;i++ ) + { + QString opt = argv[i]; + + // Normalize command line option - accept "--xy" as well as "-xy" + + if ( opt.startsWith( "--" ) ) + opt.remove(0, 1); + + if ( opt == "-h" || opt == "-help" ) printhelpandexit(); + } + + MainWindow mainWin; + + mainWin.show(); + + QTimer::singleShot(60, &mainWin, SLOT( initialMsg() )); + + return app.exec(); } -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org