本文整理汇总了C++中KCmdLineArgs::getOptionList方法的典型用法代码示例。如果您正苦于以下问题:C++ KCmdLineArgs::getOptionList方法的具体用法?C++ KCmdLineArgs::getOptionList怎么用?C++ KCmdLineArgs::getOptionList使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KCmdLineArgs
的用法示例。
在下文中一共展示了KCmdLineArgs::getOptionList方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: slotAllPluginsLoaded
void KopeteApplication::slotAllPluginsLoaded()
{
KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
// --noconnect not specified?
if ( args->isSet( "connect" ) && KopetePrefs::prefs()->autoConnect() )
Kopete::AccountManager::self()->connectAll();
// Handle things like '--autoconnect foo,bar --autoconnect foobar'
KStringList connectArgsC = args->getOptionList( "autoconnect" );
QStringList connectArgs;
for ( KStringList::ConstIterator it = connectArgsC.begin(); it != connectArgsC.end(); ++it )
{
QStringList split = QStringList::split( ',', QString::fromLatin1( *it ) );
for ( QStringList::ConstIterator it2 = split.begin(); it2 != split.end(); ++it2 )
{
connectArgs.append( *it2 );
}
}
for ( QStringList::ConstIterator i = connectArgs.begin(); i != connectArgs.end(); ++i )
{
QRegExp rx( QString::fromLatin1( "([^\\|]*)\\|\\|(.*)" ) );
rx.search( *i );
QString protocolId = rx.cap( 1 );
QString accountId = rx.cap( 2 );
if ( accountId.isEmpty() )
{
if ( protocolId.isEmpty() )
accountId = *i;
else
continue;
}
QPtrListIterator<Kopete::Account> it( Kopete::AccountManager::self()->accounts() );
Kopete::Account *account;
while ( ( account = it.current() ) != 0 )
{
++it;
if ( ( account->accountId() == accountId ) )
{
if ( protocolId.isEmpty() || account->protocol()->pluginId() == protocolId )
{
account->connect();
break;
}
}
}
}
// Parse any passed URLs/files
handleURLArgs();
}
示例2: main
int main(int argc, char *argv[])
{
xsltStylesheetPtr cur = NULL;
xmlDocPtr doc, res;
const char *params[16 + 1];
int nbparams = 0;
params[nbparams] = NULL;
KAboutData aboutData( "umbodoc", 0, ki18n("Umbrello UML Modeller autonomous code generator"),
umbrelloVersion(), ki18n(description), KAboutData::License_GPL,
ki18n("(c) 2006 Gael de Chalendar (aka Kleag), (c) 2002-2006 Umbrello UML Modeller Authors"), KLocalizedString(),
"http://uml.sf.net/");
aboutData.addAuthor(ki18n("Gael de Chalendar (aka Kleag)"),KLocalizedString(), "[email protected]");
aboutData.addAuthor(ki18n("Umbrello UML Modeller Authors"), KLocalizedString(), "[email protected]");
KCmdLineArgs::init( argc, argv, &aboutData );
KCmdLineOptions options;
options.add("+[File]", ki18n("File to transform"));
options.add("xslt <url>", ki18n("The XSLT file to use"));
KCmdLineArgs::addCmdLineOptions( options ); // Add our own options.
KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
QCStringList xsltOpt = args->getOptionList("xslt");
if (xsltOpt.size() > 0)
{
QString xsltFile(xsltOpt.last());
xmlSubstituteEntitiesDefault(1);
xmlLoadExtDtdDefaultValue = 1;
cur = xsltParseStylesheetFile((const xmlChar *)xsltFile.latin1());
doc = xmlParseFile(args->url( 0 ).url().latin1());
res = xsltApplyStylesheet(cur, doc, params);
xsltSaveResultToFile(stdout, res, cur);
xsltFreeStylesheet(cur);
xmlFreeDoc(res);
xmlFreeDoc(doc);
xsltCleanupGlobals();
xmlCleanupParser();
}
return(0);
}
示例3: newInstance
int Application::newInstance()
{
if(!isRestored())
{
DCOPRef akr("akregator", "AkregatorIface");
KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
if(!mMainWindow)
{
mMainWindow = new Akregator::MainWindow();
setMainWidget(mMainWindow);
mMainWindow->loadPart();
mMainWindow->setupProgressWidgets();
if(!args->isSet("hide-mainwindow"))
mMainWindow->show();
akr.send("openStandardFeedList");
}
QString addFeedGroup = !args->getOption("group").isEmpty()
? QString::fromLocal8Bit(args->getOption("group"))
: i18n("Imported Folder");
KStringList feeds = args->getOptionList("addfeed");
QStringList feedsToAdd;
KStringList::ConstIterator end(feeds.end());
for(KStringList::ConstIterator it = feeds.begin(); it != end; ++it)
feedsToAdd.append(*it);
if(!feedsToAdd.isEmpty())
akr.send("addFeedsToGroup", feedsToAdd, addFeedGroup);
args->clear();
}
return KUniqueApplication::newInstance();
}
示例4: slotPrint
void PrintWrapper::slotPrint()
{
KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
#if defined(HAVE_SIGACTION) && !defined(HAVE_SIGSET)
struct sigaction action;
#endif /* HAVE_SIGACTION && !HAVE_SIGSET*/
// read variables from command line
QString printer = args->getOption("d");
QString title = args->getOption("t");
int ncopies = QString(args->getOption("n")).toInt();
QString job_mode = args->getOption("j");
QString system = args->getOption("system");
KStringList optlist = args->getOptionList("o");
QMap< QString, QString > opts;
KURL::List files;
QStringList filestoprint;
force_stdin = args->isSet("stdin");
docopy = args->isSet("c");
bool nodialog = !(args->isSet("dialog"));
if(isatty(0))
{
kdDebug(500) << "stdin is a terminal, disabling it" << endl;
check_stdin = false;
}
// parse options
for(KStringList::ConstIterator it = optlist.begin(); it != optlist.end(); ++it)
{
QStringList l = QStringList::split('=', QString(*it), false);
if(l.count() >= 1)
opts[l[0]] = (l.count() == 2 ? l[1] : QString::null);
}
// read file list
for(int i = 0; i < args->count(); i++)
files.append(args->url(i));
// some clean-up
args->clear();
// set default values if necessary
if(job_mode == "console")
job_output = 1;
else if(job_mode == "none")
job_output = 2;
else
job_output = 0;
// some checking
if(files.count() > 0)
{
check_stdin = false;
if(force_stdin)
{
showmsg(i18n("A file has been specified on the command line. Printing from STDIN will be disabled."), 1);
force_stdin = false;
}
}
if(nodialog && files.count() == 0 && !force_stdin && !check_stdin)
{
errormsg(i18n("When using '--nodialog', you must at least specify one file to print or use the '--stdin' flag."));
}
if(check_stdin)
{ // check if there's any input on stdin
fd_set in;
struct timeval tm;
tm.tv_sec = 0;
tm.tv_usec = 0;
FD_ZERO(&in);
FD_SET(0, &in);
if(select(1, &in, NULL, NULL, &tm))
{ // we have data on stdin
if(read(0, &readchar, 1) > 0)
{
force_stdin = true;
check_stdin = false;
dataread = true;
kdDebug(500) << "input detected on stdin" << endl;
}
else
{
force_stdin = check_stdin = false;
kdDebug(500) << "stdin closed and empty" << endl;
}
}
else
kdDebug(500) << "no input on stdin at startup" << endl;
}
// force_stdin ? or also check_stdin ?
KPrinter::ApplicationType dialog_mode = (force_stdin || nodialog ? KPrinter::StandAlone : KPrinter::StandAlonePersistent);
KPrinter::setApplicationType(dialog_mode);
if(!force_stdin)
KPrinter::addStandardPage(KPrinter::FilesPage);
//.........这里部分代码省略.........
示例5: main
int main(int argc, char *argv[]) {
int i_file, i_v, i_curve;
int i_plot;
KAboutData aboutData( "kst", I18N_NOOP("Kst"),
"0.95-devel", description, KAboutData::License_GPL,
I18N_NOOP("(c) 2000-2003 Barth Netterfield"),
0,
"http://extragear.kde.org/apps/kst.php");
aboutData.addAuthor("Barth Netterfield",
I18N_NOOP("Original author and maintainer."),
"[email protected]",
"http://omega.astro.utoronto.ca/");
aboutData.addAuthor("Staikos Computing Services Inc.",
I18N_NOOP("Developed for the University of Toronto."),
"[email protected]",
"http://www.staikos.net/");
KCmdLineArgs::init( argc, argv, &aboutData );
KCmdLineArgs::addCmdLineOptions( options ); // Add our own options.
KApplication app;
KImageIO::registerFormats();
if (app.isRestored()) {
RESTORE(KstApp)
} else {
KstApp *kst = new KstApp;
struct InType in;
QColor color;
QCStringList ycolList;
QCStringList yEqList;
QCStringList psdList;
QCStringList hsList;
QCStringList errorList;
unsigned int i_ycol;
QCStringList::Iterator psd;
QCStringList::Iterator hs;
QCStringList::Iterator eq_i;
bool nOK;
/* temp variables: these all get stuck into list objects */
KstDataSourcePtr file;
KstRVector *xvector=NULL;
KstRVector *yvector;
KstRVector *evector;
KstVCurve *curve;
KstPSDCurve *psdcurve;
KstEquationCurve *eqcurve;
KstHistogram *hscurve;
KstPlot *plot;
int n_y, n_eq=0;
/* Parse command line args */
KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
CheckForCMDErrors(args);
// Initialise the plugin loader and collection.
PluginCollection::self();
/* get Y axis collums */
ycolList = args->getOptionList("y");
yEqList = args->getOptionList("ye");
psdList = args->getOptionList("p");
hsList = args->getOptionList("h");
errorList = args->getOptionList("e");
// y axis or PSD specified, so the files are data files, not kst files.
n_y = ycolList.count() + psdList.count() + hsList.count()
+ yEqList.count();
if (n_y > 0) {
SetCMDOptions(args, in, n_y);
CreatePlots(in);
i_plot = 0;
plot = KST::plotList.at(i_plot);
/* make stand alone equations if there are no files */
if (args->count()<1) {
if (!yEqList.isEmpty()) {
QString eqS;
double max, min;
int n;
bool xeq;
SetEqXRanges(args->getOption("xe"), &min, &max, &n, &xeq);
if (xeq) {
for (eq_i = yEqList.begin(); eq_i != yEqList.end(); ++eq_i) {
eqS = *eq_i;
if (NoVectorEq(eqS)) {
eqcurve =
new KstEquationCurve(QString("E")+QString::number(n_eq+1)+
"-" + eqS,
eqS,
min,max,n, KstColorSequence::next());
KST::dataObjectList.lock().writeLock();
//.........这里部分代码省略.........
示例6: main
//.........这里部分代码省略.........
QCStringList errorList;
unsigned int i_ycol;
QCStringList::Iterator hs_string;
QCStringList::Iterator eq_i;
QCStringList::Iterator mat_i;
bool showQuickStart = false;
bool showDataWizard = false;
bool nOK;
int n_y = 0;
KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
CheckForCMDErrors(args);
QString wizardfile = args->getOption("w");
QString printfile = args->getOption("print");
QString pngfile = args->getOption("png");
bool print_and_exit = false;
if (printfile != "<none>") {
print_and_exit = true;
}
if (pngfile != "<none>") {
print_and_exit = true;
}
if (!print_and_exit) {
app.setMainWidget(kst);
QRect rect = KGlobalSettings::desktopGeometry(kst);
kst->resize(5 * rect.width() / 6, 5 * rect.height() / 6);
kst->show();
}
// get Y axis columns
ycolList = args->getOptionList("y");
matrixList = args->getOptionList("z");
yEqList = args->getOptionList("ye");
psdList = args->getOptionList("p");
hsList = args->getOptionList("h");
errorList = args->getOptionList("e");
// y axis or PSD specified, so the files are data files, not kst files.
n_y = ycolList.count() + psdList.count() + hsList.count() + yEqList.count() + matrixList.count();
if (n_y > 0) {
QString creatingEquations = i18n("Creating equations");
QString creatingCurves = i18n("Creating curves");
QString creatingPlots = i18n("Creating plots");
int count;
int handled;
kst->slotUpdateProgress( 0, 0, QString::null );
SetCMDOptions(args, in, n_y);
KstTopLevelViewPtr tlv = kst->activeView();
if (!tlv) {
// if there was no active view then we create one...
kst->newWindow(false);
tlv = kst->activeView();
}
if (!tlv) {
kstdError() << i18n("Can't create a view.") << endl;
return 0;
}