本文整理汇总了C++中KCmdLineOptions类的典型用法代码示例。如果您正苦于以下问题:C++ KCmdLineOptions类的具体用法?C++ KCmdLineOptions怎么用?C++ KCmdLineOptions使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了KCmdLineOptions类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char *argv[])
{
KAboutData aboutData( "qCheckGMail",
0,
ki18n( "qCheckGMail" ),
"1.0.0",
ki18n( "a qt based gmail checker" ),
KAboutData::License_GPL_V2,
ki18n( "(c)2013,ink Francis\nemail:[email protected]" ),
ki18n( "[email protected]" ),
"(c)2013,ink Francis\nemail:[email protected]",
"https://github.com/mhogomchungu/qCheckGMail/issues" );
KCmdLineArgs::init( argc,argv,&aboutData );
KCmdLineOptions options;
options.add( "a",ki18n( "auto start application" ) ) ;
KCmdLineArgs::addCmdLineOptions( options ) ;
KUniqueApplication::addCmdLineOptions();
if( KCmdLineArgs::allArguments().contains( "-a" ) ){
if( configurationoptionsdialog::autoStartEnabled() ){
return startApp() ;
}else{
return qCheckGMail::autoStartDisabled() ;
}
}else{
return startApp() ;
}
}
示例2: main
int main(int argc, char *argv[])
{
KAboutData aboutData(
"gwenview", /* appname */
0, /* catalogName */
ki18n("Gwenview"), /* programName */
GWENVIEW_VERSION); /* version */
aboutData.setShortDescription(ki18n("An Image Viewer"));
aboutData.setLicense(KAboutData::License_GPL);
aboutData.setCopyrightStatement(ki18n("Copyright 2000-2010 Aurélien Gâteau"));
aboutData.addAuthor(
ki18n("Aurélien Gâteau"),
ki18n("Main developer"),
"[email protected]");
KCmdLineArgs::init(argc, argv, &aboutData);
KCmdLineOptions options;
options.add("f", ki18n("Start in fullscreen mode"));
options.add("s", ki18n("Start in slideshow mode"));
options.add("+[file or folder]", ki18n("A starting file or folder"));
KCmdLineArgs::addCmdLineOptions(options);
KApplication app;
Gwenview::ImageFormats::registerPlugins();
// startHelper must live for the whole live of the application
StartHelper startHelper;
if (app.isSessionRestored()) {
kRestoreMainWindows<Gwenview::MainWindow>();
} else {
startHelper.createMainWindow();
}
return app.exec();
}
示例3: main
int main(int argc, char **argv)
{
KAboutData about("khotnewstuff", 0, ki18n("KHotNewStuff"), "0.4");
about.setProgramIconName("get-hot-new-stuff");
KCmdLineArgs *args;
KCmdLineArgs::init(argc, argv, &about);
KCmdLineOptions op;
op.add("+filename", ki18n("Name of .knsrc file to use"));
op.add("+filename", ki18n("Name of file to upload"));
KCmdLineArgs::addCmdLineOptions(op);
args = KCmdLineArgs::parsedArgs();
KApplication i;
if (args->count() > 0) {
KNS3::UploadDialog dialog(args->arg(0));
if (args->count() > 1) {
dialog.setUploadFile(KUrl(args->arg(1)));
}
dialog.exec();
}
else
{
args->usage();
return -1;
}
return 0;
}
示例4: main
int main(int argc, char **argv)
{
KCmdLineArgs::init(argc, argv, &aboutData);
KCmdLineOptions options;
options.add("embed <winid>", ki18n("Makes the dialog transient for an X app specified by winid"));
options.add("+[URL]", ki18n("URL to install"));
KCmdLineArgs::addCmdLineOptions(options);
QSet<KUrl> urls;
KCmdLineArgs *args(KCmdLineArgs::parsedArgs());
for(int i=0; i < args->count(); i++)
urls.insert(args->url(i));
if(urls.count())
{
KApplication app;
QString opt(args->getOption("embed"));
KFI::CInstaller inst(createParent(opt.size() ? opt.toInt(0, 16) : 0));
return inst.install(urls);
}
return -1;
}
示例5: main
int main(int argc, char** argv)
{
qsrand(time(0));
KAboutData about("palapeli", 0, ki18nc("The application's name", "Palapeli"), "2.0", ki18n("KDE Jigsaw Puzzle Game"), KAboutData::License_GPL, ki18n("Copyright 2009, 2010, Stefan Majewsky"));
about.addAuthor(ki18n("Stefan Majewsky"), KLocalizedString(), "[email protected]", "http://majewsky.wordpress.com");
about.addCredit (ki18n ("Johannes Loehnert"),
ki18n ("The option to preview the completed puzzle"),
"[email protected]");
about.setHomepage("https://www.kde.org/applications/games/palapeli/");
KCmdLineArgs::init(argc, argv, &about);
KCmdLineOptions options;
options.add("+puzzlefile", ki18n("Path to puzzle file (will be opened if -i is not given)"));
options.add("i").add("import", ki18n("Import the given puzzle file into the local collection (does nothing if no puzzle file is given)"));
options.add("", ki18n("If the -i/--import option is specified, the main window will not be shown after importing the given puzzle."));
KCmdLineArgs::addCmdLineOptions(options);
KApplication app;
KCmdLineArgs* args = KCmdLineArgs::parsedArgs();
//NOTE: Syntax errors are reported on stderr, while file errors are presented to the user.
if (args->isSet("import"))
//perform import request
new Palapeli::ImportHelper(args);
else
//no import request, show main window
(new Palapeli::MainWindow(args))->show();
return app.exec();
}
示例6: main
int main(int argc,char **argv)
{
KLocale::setMainCatalog( "kdepimwizards" );
KAboutData aboutData( "groupwisewizard", 0,
ki18n( "Novell GroupWise Configuration Wizard" ),
"0.1" );
KCmdLineArgs::init( argc, argv, &aboutData );
KCmdLineOptions options;
options.add("verbose", ki18n("Verbose output"));
KCmdLineArgs::addCmdLineOptions( options );
KApplication app;
KGlobal::locale()->insertCatalog( "libkdepim" );
KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
bool verbose = false;
if ( args->isSet( "verbose" ) ) verbose = true;
args->clear();
GroupwiseWizard wizard;
return wizard.exec();
}
示例7: main
int main(int argc, char **argv)
{
KAboutData about("active-documentviewer", 0, ki18n("Reader"), version, ki18n(description),
KAboutData::License_GPL, ki18n("Copyright 2012 Marco Martin"), KLocalizedString(), 0, "[email protected]");
about.addAuthor( ki18n("Marco Martin"), KLocalizedString(), "[email protected]" );
about.setProgramIconName("okular");
KCmdLineArgs::init(argc, argv, &about);
KCmdLineOptions options;
options.add("+[url]", ki18n( "URL of the file to open" ));
KCmdLineArgs::addCmdLineOptions(options);
KApplication app;
KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
KGlobal::locale()->insertCatalog("org.kde.okular");
//kDebug() << "ARGS:" << args << args->count();
KDeclarativeMainWindow *mainWindow = new KDeclarativeMainWindow();
mainWindow->declarativeView()->setPackageName("org.kde.active.documentviewer");
mainWindow->show();
args->clear();
return app.exec();
}
示例8: main
int main(int argc, char* argv[])
{
PLEAboutData aboutData;
aboutData.setAppName("photolayoutseditor");
aboutData.setCatalogName("kipiplugin_photolayoutseditor");
KCmdLineArgs::init(argc,argv,&aboutData);
KCmdLineOptions options;
options.add("+file", ki18n("Input file"));
KCmdLineArgs::addCmdLineOptions(options);
KApplication app;
aboutData.setProgramLogo(KIcon("photolayoutseditor"));
PhotoLayoutsEditor* w = PhotoLayoutsEditor::instance(0);
w->setAttribute(Qt::WA_DeleteOnClose, true);
KCmdLineArgs* args = KCmdLineArgs::parsedArgs();
if (args->count())
{
KUrl url = args->url(0);
if (url.isValid())
w->open(url);
}
w->show();
int result = app.exec();
return result;
}
示例9: main
int main(int argc, char **argv)
{
KAboutData aboutData( "husky_test", "husky_test",
ki18n("husky_test"), "0.1",
ki18n("test."),
KAboutData::License_GPL,
ki18n("Copyright (c) 2013") );
KCmdLineArgs::init( argc, argv, &aboutData );
KCmdLineOptions options;
options.add("+[file]", ki18n("demo argument"));
KCmdLineArgs::addCmdLineOptions(options);
// parse command line arguments
KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
if(args->count()) {
std::cout << "have args " << args->count() << std::endl;
}
KApplication app;
Mainwin *p = new Mainwin;
p->show();
return app.exec();
}
示例10: main
int main( int argc, char **argv )
{
KAboutData aboutData( "testkabcdlg", 0, ki18n( "TestKabc" ), "0.1" );
KCmdLineArgs::init( argc, argv, &aboutData );
KCmdLineOptions options;
options.add( "multiple", ki18n( "Allow selection of multiple addressees" ) );
KCmdLineArgs::addCmdLineOptions( options );
KApplication app;
KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
if ( args->isSet( "multiple" ) ) {
Addressee::List al = AddresseeDialog::getAddressees( 0 );
Addressee::List::ConstIterator it;
kDebug() << "Selected Addressees:";
for ( it = al.constBegin(); it != al.constEnd(); ++it ) {
kDebug() << " " << ( *it ).fullEmail();
}
} else {
Addressee a = AddresseeDialog::getAddressee( 0 );
if ( !a.isEmpty() ) {
kDebug() << "Selected Addressee:";
kDebug() << a.toString();
} else {
kDebug() << "No Addressee selected.";
}
}
}
示例11: main
int main(int argc, char *argv[])
{
const KAboutData about(
"konstruktor", "konstruktor",
ki18n("Part database updater for Konstruktor"), "0.9.0-beta1",
ki18n("Updates the part database. Must be called internally by Konstruktor."),
KAboutData::License_GPL_V3,
ki18n("(c)2006-2011, Park \"segfault\" Joon-Kyu"));
KCmdLineArgs::init(argc, argv, &about);
KCmdLineOptions options;
options.add("+[location]", ki18n("Path to LDraw part library"));
options.add("rescan", ki18n("Rescan the entire library"));
KCmdLineArgs::addCmdLineOptions(options);
KApplication app;
int status;
try {
Konstruktor::DBUpdater updater;
status = updater.start();
} catch (const std::runtime_error &e) {
QMessageBox::critical(0L, i18n("Error"), QString(e.what()));
status = -1;
}
app.exit(status);
return status;
}
示例12: main
int
main(int argc, char *argv[])
{
KAboutData about("kapptest", 0, ki18n("kapptest"), "version");
KCmdLineArgs::init(argc, argv, &about);
KCmdLineOptions options;
options.add("t");
options.add("type <name>", ki18n("The type of shutdown to emulate: Default, None, Reboot, Halt or Logout"), "None");
KCmdLineArgs::addCmdLineOptions(options);
KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
KApplication a;
KIconLoader::global()->addAppDir("ksmserver");
KSMShutdownFeedback::start();
QString sdtypeOption = args->getOption("type").toLower();
KWorkSpace::ShutdownType sdtype = KWorkSpace::ShutdownTypeDefault;
if (sdtypeOption == "reboot") {
sdtype = KWorkSpace::ShutdownTypeReboot;
} else if (sdtypeOption == "halt") {
sdtype = KWorkSpace::ShutdownTypeHalt;
} else if (sdtypeOption == "logout") {
sdtype = KWorkSpace::ShutdownTypeNone;
}
QString bopt;
(void)KSMShutdownDlg::confirmShutdown( true, true, sdtype, bopt, "default" );
/* (void)KSMShutdownDlg::confirmShutdown( false, false, sdtype, bopt ); */
KSMShutdownFeedback::stop();
}
示例13: main
int main( int argc, char **argv )
{
KAboutData aboutData("kmenuedit", 0, ki18n("KDE Menu Editor"),
version, ki18n(description), KAboutData::License_GPL,
ki18n("(C) 2000-2003, Waldo Bastian, Raffaele Sandrini, Matthias Elter"));
aboutData.addAuthor(ki18n("Waldo Bastian"), ki18n("Maintainer"), "[email protected]");
aboutData.addAuthor(ki18n("Raffaele Sandrini"), ki18n("Previous Maintainer"), "[email protected]");
aboutData.addAuthor(ki18n("Matthias Elter"), ki18n("Original Author"), "[email protected]");
aboutData.addAuthor(ki18n("Montel Laurent"), KLocalizedString(), "[email protected]");
KCmdLineArgs::init( argc, argv, &aboutData );
KUniqueApplication::addCmdLineOptions();
KCmdLineOptions options;
options.add("+[menu]", ki18n("Sub menu to pre-select"));
options.add("+[menu-id]", ki18n("Menu entry to pre-select"));
KCmdLineArgs::addCmdLineOptions( options );
if (!KUniqueApplication::start())
return 1;
KMenuApplication app;
menuEdit = new KMenuEdit();
menuEdit->show();
return app.exec();
}
示例14: main
int main(int argc, char** argv)
{
KAboutData aboutData(
"fractal-viewer",
0,
ki18n("Fractal Viewer"),
"1.0",
ki18n("Test program."),
KAboutData::License_GPL,
ki18n("(c) 2014 Jordan Melo"),
ki18n("Enables the exploration and rendering of fractals."),
"http://jmelo.net/",
"[email protected]"
);
KCmdLineArgs::init(argc, argv, &aboutData);
KCmdLineOptions options;
options.add("+[file]", ki18n("Document to open"));
KCmdLineArgs::addCmdLineOptions(options);
KApplication app;
MainWindow* window = new MainWindow();
window->show();
KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
return app.exec();
}
示例15: main
int main(int argc, char *argv[])
{
KAboutData about(
"konstruktor", 0, ki18nc("@title", "Konstruktor"), version, ki18nc("@title", description),
KAboutData::License_GPL_V3, ki18nc("@info:credit", "(c) 2011, Park \"segfault\" Joon-Kyu")
);
about.setHomepage("http://konstruktor.influx.kr");
about.addAuthor(ki18nc("@info:credit", "Park \"segfault\" Joon-Kyu"),
ki18nc("@info:credit", "Main developer"),
"[email protected]", "http://planetmono.org");
about.addCredit(ki18nc("@info:credit", "Lee Olson"),
ki18nc("@info:credit", "Application icon"),
"[email protected]");
about.addCredit(ki18nc("@info:credit", "Nathaniel Titane"),
ki18nc("@info:credit", "Testing"),
"[email protected]");
KCmdLineArgs::init(argc, argv, &about);
KCmdLineOptions options;
options.add("+[Url]", ki18nc("@info:shell", "Document to open"));
KCmdLineArgs::addCmdLineOptions(options);
KApplication app;
Konstruktor::Application mainapp;
return app.exec();
}