本文整理汇总了C++中KCmdLineArgs::count方法的典型用法代码示例。如果您正苦于以下问题:C++ KCmdLineArgs::count方法的具体用法?C++ KCmdLineArgs::count怎么用?C++ KCmdLineArgs::count使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KCmdLineArgs
的用法示例。
在下文中一共展示了KCmdLineArgs::count方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char **argv)
{
KAboutData about("KNetworkStatusTestClient", 0, ki18n("knetworkstatustestclient"), version, ki18n(description), KAboutData::License_GPL, ki18n("(C) 2007 Will Stephenson"), KLocalizedString(), 0, "[email protected]");
about.addAuthor( ki18n("Will Stephenson"), KLocalizedString(), "[email protected]" );
KCmdLineArgs::init(argc, argv, &about);
KCmdLineOptions options;
KCmdLineArgs::addCmdLineOptions(options);
KApplication app;
KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
if (args->count() == 0)
{
TestClient *widget = new TestClient;
widget->show();
}
else
{
int i = 0;
for (; i < args->count(); i++)
{
TestClient *widget = new TestClient;
widget->show();
}
}
args->clear();
return app.exec();
}
示例2: newInstance
int Application::newInstance()
{
KUniqueApplication::newInstance();
// Open the basket archive or template file supplied as argument:
KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
if (args && args->count() >= 1) {
QString fileName = args->arg(args->count() - 1);
if (QFile::exists(fileName)) {
QFileInfo fileInfo(fileName);
if (fileInfo.absoluteFilePath().contains(Global::basketsFolder())) {
QString folder = fileInfo.absolutePath().split("/").last();
folder.append("/");
BNPView::s_basketToOpen = folder;
QTimer::singleShot(100, Global::bnpView, SLOT(delayedOpenBasket()));
} else if (!fileInfo.isDir()) { // Do not mis-interpret data-folder param!
// Tags are not loaded until Global::bnpView::lateInit() is called.
// It is called 0ms after the application start.
BNPView::s_fileToOpen = fileName;
QTimer::singleShot(100, Global::bnpView, SLOT(delayedOpenArchive()));
// Global::bnpView->openArchive(fileName);
args->clear();
}
}
}
return 0;
}
示例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)
{
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();
}
示例5: main
int main(int argc, char **argv)
{
KAboutData about("khipu", "gplacs", ki18n(I18N_NOOP("Khipu")), version, ki18n(description),
KAboutData::License_GPL, ki18n("(C) 2010-2012, Percy Camilo Triveño Aucahuasi"));
about.addAuthor(ki18n("Percy Camilo Triveño Aucahuasi"), ki18n("Main developer"), "[email protected]");
about.addCredit(ki18n("Punit Mehta"), ki18n("GSoC-2013 student - Persistance file support. Plot-dictionary support. Worked for application actions, command-line improvements and space filtering. Several bug fixings"), "[email protected]");
about.addCredit(ki18n("Manuel Álvarez Blanco"), ki18n("Thesis mentor - Guide and supervision during project conception. Bibliographical support. Numeric Mathematics and Algorithms support"), "");
about.addCredit(ki18n("José Ignacio Cuevas Gonzáles"), ki18n("Thesis mentor - Supervision, Product Guide, Product promotion and former Client"), "[email protected]");
about.addCredit(ki18n("Eduardo Fernandini Capurro"), ki18n("Thesis mentor - Supervision, Bibliographical Support, Product Guide and former Client"), "[email protected]");
about.addCredit(ki18n("Jaime Urbina Pereyra"), ki18n("Thesis mentor - Supervision and former Main Project Mentor"), "[email protected]");
about.addCredit(ki18n("Aleix Pol Gonzalez"), ki18n("KAlgebra and Analitza parser author, both vitals for the project"));
about.addCredit(ki18n("José Fernando Ramos Ramirez"), ki18n("First version of Famous Curves Database. Build former windows installer"), "[email protected]");
about.addCredit(ki18n("Susan Pamela Rios Sarmiento"), ki18n("First version of Famous Curves Database"), "[email protected]");
about.addCredit(ki18n("Edgar Velasquez"), ki18n("2D Improvements"));
about.addCredit(ki18n("Jose Torres Cardenas"), ki18n("3D Improvements"));
about.addCredit(ki18n("Elizabeth Portilla Flores"), ki18n("3D Improvements"));
about.addCredit(ki18n("Paul Murat Landauro Minaya"), ki18n("3D Improvements"));
KCmdLineArgs::init(argc, argv, &about);
KCmdLineOptions options;
options.add("+[URL]", ki18n( "A Khipu-file to open" ));
KCmdLineArgs::addCmdLineOptions(options);
KApplication app;
MainWindow *mainWindow = new MainWindow;
if (app.isSessionRestored()) {
RESTORE(MainWindow)
} else {
KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
if (args->count() == 0) {
mainWindow->checkforAutoSavedFile();
mainWindow->show();
} else {
int i = 0;
bool exit = false;
for (; i < args->count(); i++) {
if (i==0) {
if(args->arg(0)!="ignoreautosavedfile"){
if (!(mainWindow->openFile(args->url(0).path())))
exit = true;
}
}
mainWindow->show();
}
if (exit)
mainWindow->deleteLater(); // can't open a khipu file, so just exit !
}
args->clear();
}
return app.exec();
}
示例6: cg
KonfUpdate::KonfUpdate()
: m_textStream(0), m_file(0)
{
bool updateAll = false;
m_oldConfig1 = 0;
m_oldConfig2 = 0;
m_newConfig = 0;
m_config = new KConfig("kconf_updaterc");
KConfigGroup cg(m_config, QString());
QStringList updateFiles;
KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
m_debug = args->isSet("debug");
m_bUseConfigInfo = false;
if (args->isSet("check")) {
m_bUseConfigInfo = true;
QString file = KStandardDirs::locate("data", "kconf_update/" + args->getOption("check"));
if (file.isEmpty()) {
qWarning("File '%s' not found.", args->getOption("check").toLocal8Bit().data());
log() << "File '" << args->getOption("check") << "' passed on command line not found" << endl;
return;
}
updateFiles.append(file);
} else if (args->count()) {
for (int i = 0; i < args->count(); i++) {
KUrl url = args->url(i);
if (!url.isLocalFile()) {
KCmdLineArgs::usageError(i18n("Only local files are supported."));
}
updateFiles.append(url.path());
}
} else {
if (cg.readEntry("autoUpdateDisabled", false))
return;
updateFiles = findUpdateFiles(true);
updateAll = true;
}
for (QStringList::ConstIterator it = updateFiles.constBegin();
it != updateFiles.constEnd();
++it) {
updateFile(*it);
}
if (updateAll && !cg.readEntry("updateInfoAdded", false)) {
cg.writeEntry("updateInfoAdded", true);
updateFiles = findUpdateFiles(false);
for (QStringList::ConstIterator it = updateFiles.constBegin();
it != updateFiles.constEnd();
++it) {
checkFile(*it);
}
updateFiles.clear();
}
}
示例7: main
int main(int argc, char **argv)
{
KAboutData aboutData("kstartperf", 0, ki18n("KStartPerf"),
"1.0", ki18n("Measures start up time of a KDE application"),
KAboutData::License_Artistic,
ki18n("Copyright (c) 2000 Geert Jansen and libkmapnotify authors"));
aboutData.addAuthor(ki18n("Geert Jansen"), ki18n("Maintainer"),
"[email protected]", "http://www.stack.nl/~geertj/");
KCmdLineArgs::init(argc, argv, &aboutData);
KCmdLineOptions options;
options.add("+command", ki18n("Specifies the command to run"));
options.add("!+[args]", ki18n("Arguments to 'command'"));
KCmdLineArgs::addCmdLineOptions(options);
KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
KComponentData componentData( &aboutData );
QCoreApplication app( KCmdLineArgs::qtArgc(), KCmdLineArgs::qtArgv() );
// Check arguments
if (args->count() == 0)
{
fprintf(stderr, "No command specified!\n");
fprintf(stderr, "usage: kstartperf command [arguments]\n");
exit(1);
}
// Build command
char cmd[1024];
snprintf(cmd, sizeof(cmd), "LD_PRELOAD=%s %s",
qPrintable( libkstartperf() ), qPrintable(args->arg(0)));
for (int i=1; i<args->count(); i++)
{
strcat(cmd, " ");
strcat(cmd, args->arg(i).toLocal8Bit());
}
// Put the current time in the environment variable `KSTARTPERF'
struct timeval tv;
if (gettimeofday(&tv, 0L) != 0)
{
perror("gettimeofday()");
exit(1);
}
char env[100];
sprintf(env, "KSTARTPERF=%ld:%ld", tv.tv_sec, tv.tv_usec);
putenv(env);
// And exec() the command
execl("/bin/sh", "sh", "-c", cmd, (void *)0);
perror("execl()");
exit(1);
}
示例8: newInstance
int KOrganizerApp::newInstance()
{
kdDebug(5850) << "KOApp::newInstance()" << endl;
static bool first = true;
if ( isRestored() && first ) {
KOrg::MainWindow *korg = ActionManager::findInstance( KURL() );
if ( korg ) {
KOrg::StdCalendar::self()->load();
korg->view()->updateCategories();
korg->view()->updateView();
}
first = false;
return 0;
}
first = false;
KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
KOGlobals::self()->alarmClient()->startDaemon();
// No filenames given => all other args are meaningless, show main Window
if ( args->count() <= 0 ) {
processCalendar( KURL() );
return 0;
}
// If filenames wer given as arguments, load them as calendars, one per window.
if ( args->isSet( "open" ) ) {
for( int i = 0; i < args->count(); ++i ) {
processCalendar( args->url( i ) );
}
} else {
// Import, merge, or ask => we need the resource calendar window anyway.
processCalendar( KURL() );
KOrg::MainWindow *korg = ActionManager::findInstance( KURL() );
if ( !korg ) {
kdError() << "Unable to find default calendar resources view." << endl;
return -1;
}
// Check for import, merge or ask
if ( args->isSet( "import" ) ) {
for( int i = 0; i < args->count(); ++i ) {
korg->actionManager()->addResource( args->url( i ) );
}
} else if ( args->isSet( "merge" ) ) {
for( int i = 0; i < args->count(); ++i ) {
korg->actionManager()->mergeURL( args->url( i ).url() );
}
} else {
for( int i = 0; i < args->count(); ++i ) {
korg->actionManager()->importCalendar( args->url( i ) );
}
}
}
kdDebug(5850) << "KOApp::newInstance() done" << endl;
return 0;
}
示例9: main
int main(int argc, char *argv[])
{
KAboutData aboutData( "kimagemapeditor", I18N_NOOP("KImageMapEditor"),
VERSION, description, KAboutData::License_GPL,
"(C) 2001-2008 Jan Schaefer", 0, "http://www.nongnu.org/kimagemap/", "[email protected]");
aboutData.addAuthor("Jan Schaefer",0, "[email protected]");
aboutData.addCredit("Joerg Jaspert",I18N_NOOP("For helping me with the Makefiles, and creating the Debian package"));
aboutData.addCredit("Aaron Seigo and Michael",I18N_NOOP("For helping me fixing --enable-final mode"));
aboutData.addCredit("Antonio Crevillen",I18N_NOOP("For the Spanish translation"));
aboutData.addCredit("Fabrice Mous",I18N_NOOP("For the Dutch translation"));
aboutData.addCredit("Germain Chazot",I18N_NOOP("For the French translation"));
KCmdLineArgs::init( argc, argv, &aboutData );
KCmdLineArgs::addCmdLineOptions( options ); // Add our own options.
KApplication a;
a.dcopClient()->registerAs(a.name());
if (a.isRestored())
{
RESTORE(KimeShell);
}
else
{
KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
if ( args->count() == 0 )
{
KimeShell *kimeShell = new KimeShell();
kimeShell->setStdout(args->isSet("stdout"));
kimeShell->readConfig();
kimeShell->show();
kimeShell->openLastFile();
}
else
{
int i = 0;
for (; i < args->count(); i++ )
{
KimeShell *kimeShell = new KimeShell();
kimeShell->setStdout(args->isSet("stdout"));
kimeShell->readConfig();
kimeShell->show();
kimeShell->openFile(args->url(i));
}
}
args->clear();
}
return a.exec();
}
示例10: main
int main(int argc, char *argv[])
{
KCmdLineArgs::init(argc, argv, appName, I18N_NOOP("KXSConfig"), description, version);
KCmdLineArgs::addCmdLineOptions(options);
KApplication app;
KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
if(args->count()==0)
exit(1);
/* We must read exactly the same resources as xscreensaver.
That means we must have both the same progclass *and* progname,
at least as far as the resource database is concerned. So,
put "xscreensaver" in argv[0] while initializing Xt.
*/
const char *dummyargs[] = { "xscreensaver" };
int dummyargc = 1;
progname = dummyargs[0];
// Teach Xt to use the Display that TQt has already opened.
XtToolkitInitialize ();
XtAppContext xtApp = XtCreateApplicationContext ();
Display *dpy = qt_xdisplay();
XtAppSetFallbackResources (xtApp, const_cast<char**>(defaults));
XtDisplayInitialize (xtApp, dpy, progname, progclass, 0, 0,
&dummyargc,
const_cast<char**>(dummyargs));
Widget toplevel_shell = XtAppCreateShell (progname, progclass,
applicationShellWidgetClass,
dpy, 0, 0);
dpy = XtDisplay (toplevel_shell);
db = XtDatabase (dpy);
XtGetApplicationNameAndClass (dpy, const_cast<char**>(&progname),
const_cast<char**>(&progclass));
TQString name = TQString::fromLocal8Bit(args->arg(args->count() - 1));
KXSConfigDialog *dialog=new KXSConfigDialog(args->arg(0), name);
if ( dialog->create() ) {
dialog->show();
app.setMainWidget(dialog);
app.exec();
} else {
KMessageBox::sorry(0,
i18n("No configuration available for %1").tqarg(name),
name );
}
delete dialog;
}
示例11: aboutData
extern "C" KDE_EXPORT int kdemain (int argc, char *argv[]) {
setsid ();
KAboutData aboutData ("kmplayer", 0, ki18n("KMPlayer"),
KMPLAYER_VERSION_STRING,
ki18n ("Media player."),
KAboutData::License_GPL,
ki18n ("(c) 2002-2009, Koos Vriezen"),
KLocalizedString(),
I18N_NOOP ("http://kmplayer.kde.org"));
aboutData.addAuthor(ki18n("Koos Vriezen"), ki18n("Maintainer"),"[email protected]");
KCmdLineArgs::init (argc, argv, &aboutData);
KCmdLineOptions options;
options.add ("+[File]", ki18n ("file to open"));
KCmdLineArgs::addCmdLineOptions (options);
KMPlayer::Ids::init();
KApplication app;
QPointer <KMPlayerApp> kmplayer;
if (app.isSessionRestored ()) {
RESTORE (KMPlayerApp);
} else {
kmplayer = new KMPlayerApp ();
kmplayer->show();
KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
KUrl url;
if (args->count () == 1)
url = args->url (0);
if (args->count () > 1)
for (int i = 0; i < args->count (); i++) {
KUrl url = args->url (i);
if (url.url ().indexOf ("://") < 0)
url = KUrl (QFileInfo (url.url ()).absoluteFilePath ());
if (url.isValid ())
kmplayer->addUrl (url);
}
kmplayer->openDocumentFile (url);
args->clear ();
}
int retvalue = app.exec ();
delete kmplayer;
KMPlayer::Ids::reset();
return retvalue;
}
示例12: newInstance
virtual int newInstance()
{
KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
if (args->count() > 0)
{
menuEdit->selectMenu(args->arg(0));
if (args->count() > 1)
{
menuEdit->selectMenuEntry(args->arg(1));
}
}
args->clear();
return KUniqueApplication::newInstance();
}
示例13: main
int main(int argc, char **argv)
{
KLocale::setMainCatalogue("kasablanca");
KAboutData about("kasablanca", I18N_NOOP("kasablanca"), version, description,
KAboutData::License_GPL, "(C) 2004 Magnus Kulke", 0, 0,
"[email protected]");
about.addAuthor( "Magnus Kulke", 0, "[email protected]" );
about.addAuthor( "Big Biff", 0, "[email protected]" );
about.addCredit( "Stefan Bogner", 0, "[email protected]" );
about.addCredit( "Christoph Thielecke", 0, "[email protected]" );
about.addCredit( "Richard Stellingwerf", 0, "[email protected]" );
KCmdLineArgs::init(argc, argv, &about);
KCmdLineArgs::addCmdLineOptions(options);
KApplication app;
// register ourselves as a dcop client
app.dcopClient()->registerAs(app.name(), false);
// see if we are starting with session management
if (app.isRestored())
{
RESTORE(Kasablanca);
}
else
{
// no session.. just start up normally
KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
if (args->count() == 0)
{
Kasablanca *widget = new Kasablanca;
widget->show();
}
else
{
int i = 0;
for (; i < args->count(); i++)
{
Kasablanca *widget = new Kasablanca;
widget->show();
// TODO: Load the ftp url passed on the command line.
// widget->load(args->url(i));
}
}
args->clear();
}
return app.exec();
}
示例14: main
int main(int argc, char** argv) {
KAboutData about("kphotobook", I18N_NOOP("KPhotoBook"), version, description,
KAboutData::License_GPL, "(C) 2003 Michael Christen",
0, // free text, can contain new lines
"http://kphotobook.sourceforge.net",
"[email protected]");
about.addAuthor("Michael Christen", "The master chief developer.", "[email protected]" );
about.addAuthor("Thomas Christen", "One of Santa's greater helpers.\nHelps me creating icons and writing the website and the documentation.", "[email protected]");
about.addAuthor("Stefan Fink", "One of Santa's little helpers.\nAdvises in design and usability questions.");
about.addAuthor("Daniel Gerber", "One of Santa's little helpers.\nAdvises in design and usability questions.");
about.addCredit("George W. Bush, President of the USA", "For being a stupid little git.", "[email protected]" );
KCmdLineArgs::init(argc, argv, &about);
KCmdLineArgs::addCmdLineOptions(options);
KApplication app;
KMdi::MdiMode mdiMode = KMdi::IDEAlMode;
if (Settings::generalViewMode() == Settings::EnumGeneralViewMode::TabPageMode) {
mdiMode = KMdi::TabPageMode;
}
KCmdLineArgs* args = KCmdLineArgs::parsedArgs();
if (args->count() == 0) {
KPhotoBook* widget = new KPhotoBook(mdiMode);
widget->show();
// try to load last opened file
QString lastFileName = Settings::fileSystemLastOpenedFile();
if (!lastFileName.isEmpty()) {
QFileInfo lastFile(lastFileName);
widget->load(lastFile);
}
} else {
int i = 0;
for (; i < args->count(); i++) {
QFileInfo file(args->url(i).path());
KPhotoBook* widget = new KPhotoBook(mdiMode);
widget->show();
widget->load(file);
}
}
args->clear();
return app.exec();
}
示例15: main
int main(int argc, char **argv)
{
KAboutData about("moviemanager", 0, ki18n("MovieManager"), version, ki18n(description),
KAboutData::License_GPL, ki18n("(C) 2012 Sandeep Raju P & Sadan Sohan M"), KLocalizedString(), 0, "[email protected]\[email protected]");
about.addAuthor( ki18n("Sandeep Raju P"), KLocalizedString(), "[email protected]" );
about.addAuthor( ki18n("Sadan Sohan M"), KLocalizedString(), "[email protected]" );
KCmdLineArgs::init(argc, argv, &about);
KCmdLineOptions options;
options.add("+[URL]", ki18n( "Document to open" ));
KCmdLineArgs::addCmdLineOptions(options);
KApplication app;
MovieManager *widget = new MovieManager();
// see if we are starting with session management
if (app.isSessionRestored())
{
RESTORE(MovieManager);
}
else
{
// no session.. just start up normally
KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
if (args->count() == 0)
{
//moviemanager *widget = new moviemanager;
//widget->setMaximumSize(200,200);
widget->show();
//mainListScroll->show();
// widget->mainListScroll->show();
}
else
{
int i = 0;
for (; i < args->count(); i++)
{
//moviemanager *widget = new moviemanager;
//widget->setMaximumSize(200,200);
widget->show();
//widget->mainListScroll->show();
}
}
args->clear();
}
return app.exec();
}