当前位置: 首页>>代码示例>>C++>>正文


C++ KApplication::processEvents方法代码示例

本文整理汇总了C++中KApplication::processEvents方法的典型用法代码示例。如果您正苦于以下问题:C++ KApplication::processEvents方法的具体用法?C++ KApplication::processEvents怎么用?C++ KApplication::processEvents使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在KApplication的用法示例。


在下文中一共展示了KApplication::processEvents方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: main

int main( int argc, char *argv[] )
{
    KAboutData about("kooka",				// appName
                     "",				// catalogName
                     ki18n("Kooka"),			// programName
#if VCS_AVAILABLE
                     (VERSION " (" VCS_TYPE " " VCS_REVISION ")"),
#else
                     VERSION,				// version
#endif
                     ki18n(shortDesc),			// shortDescription
                     KAboutData::License_GPL_V2,	// licenseType
                     ki18n(copyright),			// copyrightStatement
                     ki18n(longDesc),			// text
                     "http://techbase.kde.org/Projects/Kooka");

    about.addAuthor(ki18n("Jonathan Marten"), ki18n("Current maintainer, KDE4 port"), "[email protected]");
    about.addAuthor(ki18n("Klaas Freitag"), ki18n("Developer"), "[email protected]");
    about.addCredit(ki18n("Mat Colton"), ki18n("Graphics, web"), "[email protected]");
    about.addCredit(ki18n("Ivan Shvedunov"), ki18n("Original kscan application"), "[email protected]");
    about.addCredit(ki18n("Alex Kempshall"), ki18n("Photocopy facility"), "[email protected]");
    about.addLicenseText(ki18n(addLicense));

    KCmdLineArgs::init(argc, argv, &about);

    KCmdLineOptions options;
    options.add("d <device>", ki18n("The SANE device specification (e.g. 'umax:/dev/sg0')"));
    options.add("g", ki18n("Gallery mode - do not connect to scanner"));
    KCmdLineArgs::addCmdLineOptions(options);		// Add my own options

    KApplication app;
    KGlobal::locale()->insertCatalog("libkscan");

    KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
    QString devToUse = args->getOption("d");
    if (args->isSet("g"))
    {
        devToUse = "gallery";
    }
    kDebug() << "DevToUse is" << devToUse;

// TODO: not sure what this did
//    if (args->count()==1)
//    {
//        args->usage();
//        // exit(-1);
//    }

    // TODO: try ScanGlobal::init(), if that fails no point in carrying on
    // so show an error box and give up (or can we carry on and run in
    // gallery mode only?)

    Kooka *kooka = new Kooka(devToUse.toLocal8Bit());
    kooka->show();
    app.processEvents();
    kooka->startup();
    args->clear();

    return (app.exec());
}
开发者ID:KDE,项目名称:kooka,代码行数:60,代码来源:main.cpp

示例2: main

int main(int argc, char *argv[])
{
    KCmdLineArgs::init(argc, argv, appName, I18N_NOOP("KLock"), description, version);

    KCmdLineArgs::addCmdLineOptions(options);

    KApplication app;

    KCrash::setCrashHandler( crashHandler );

    DemoWindow *demoWidget = 0;
    Window saveWin = 0;

    KCmdLineArgs *args = KCmdLineArgs::parsedArgs();

    if (args->isSet("setup"))
    {
       setupScreenSaver();
       exit(0);
    }

    if (args->isSet("window-id"))
    {
        saveWin = atol(args->getOption("window-id"));
    }

    if (args->isSet("root"))
    {
        saveWin = TQApplication::desktop()->handle();
    }

    if (args->isSet("demo"))
    {
        saveWin = 0;
    }

    if (saveWin == 0)
    {
        demoWidget = new DemoWindow();
        demoWidget->setBackgroundMode(TQWidget::NoBackground);
//        demoWidget->setBackgroundColor(TQt::black);
        demoWidget->show();
        saveWin = demoWidget->winId();
        app.setMainWidget(demoWidget);
        app.processEvents();
    }

    startScreenSaver(saveWin);
    app.exec();
    stopScreenSaver();

    if (demoWidget)
    {
        delete demoWidget;
    }

    return 0;
}
开发者ID:Fat-Zer,项目名称:kdeartwork,代码行数:58,代码来源:main.cpp

示例3: main

int main(int argc, char *argv[])
{
  static const char description[] = I18N_NOOP("The KDevelop Integrated Development Environment:\nassistant and documentation viewer");
  KAboutData aboutData("kdevassistant", I18N_NOOP("KDevelop Assistant"),
                       VERSION, description, KAboutData::License_GPL,
                       I18N_NOOP("(c) 1999-2007, The KDevelop developers"), "", "http://www.kdevelop.org");
  aboutData.addAuthor("Alexander Dymo", I18N_NOOP("Release coordinator, Overall improvements, Pascal support, C++ support, New File and Documentation parts"), "[email protected]");
  aboutData.addAuthor("Amilcar do Carmo Lucas", I18N_NOOP("Release coordinator, API documentation, Doxygen and autoproject patches"), "[email protected]");
  aboutData.addAuthor("Bernd Gehrmann", I18N_NOOP("Initial idea, basic architecture, much initial source code"), "[email protected]");
  aboutData.addAuthor("Caleb Tennis", I18N_NOOP("KTabBar, bugfixes"), "[email protected]");
  aboutData.addAuthor("Richard Dale", I18N_NOOP("Java & Objective C support"), "[email protected]");
  aboutData.addAuthor("John Birch", I18N_NOOP("Debugger frontend"), "[email protected]");
  aboutData.addAuthor("Sandy Meier", I18N_NOOP("PHP support, context menu stuff"), "[email protected]");
  aboutData.addAuthor("Kurt Granroth", I18N_NOOP("KDE application templates"), "[email protected]");
  aboutData.addAuthor("Ian Reinhart Geiser", I18N_NOOP("Dist part, bash support, application templates"), "[email protected]");
  aboutData.addAuthor("Matthias Hoelzer-Kluepfel", I18N_NOOP("Several components, htdig indexing"), "[email protected]");
  aboutData.addAuthor("Victor Roeder", I18N_NOOP("Help with Automake manager and persistent class store"), "[email protected]");
  aboutData.addAuthor("Harald Fernengel", I18N_NOOP("Ported to Qt 3, patches, valgrind, diff and perforce support"), "[email protected]");
  aboutData.addAuthor("Roberto Raggi", I18N_NOOP("QEditor component, code completion, Abbrev component, C++ support, Java support"), "[email protected]");
  aboutData.addAuthor("Simon Hausmann", I18N_NOOP("Help with KParts infrastructure"), "[email protected]");
  aboutData.addAuthor("Oliver Kellogg", I18N_NOOP("Ada support"), "[email protected]");
  aboutData.addAuthor("Jakob Simon-Gaarde", I18N_NOOP("QMake projectmanager"), "[email protected]");
  aboutData.addAuthor("[email protected] Brettschneider", I18N_NOOP("MDI modes, QEditor, bugfixes"), "[email protected]");
  aboutData.addAuthor("Mario Scalas", I18N_NOOP("PartExplorer, redesign of CvsPart, patches, bugs(fixes)"), "[email protected]");
  aboutData.addAuthor("Jens Dagerbo", I18N_NOOP("Replace, Bookmarks, FileList and CTags2 plugins. Overall improvements and patches"), "[email protected]");
  aboutData.addAuthor("Julian Rockey", I18N_NOOP("Filecreate part and other bits and patches"), "[email protected]");
  aboutData.addCredit("Ajay Guleria", I18N_NOOP("ClearCase support"), "[email protected]");
  aboutData.addCredit("Marek Janukowicz", I18N_NOOP("Ruby support"), "[email protected]");

  aboutData.addCredit("The KWrite authors", I18N_NOOP("Kate editor component"), "[email protected]");
  aboutData.addCredit("The KHTML authors", I18N_NOOP("HTML documentation component"), "[email protected]");
  aboutData.addCredit("Robert Moniot", I18N_NOOP("Fortran documentation"), "[email protected]");
  aboutData.addCredit("Ka-Ping Yee", I18N_NOOP("Python documentation utility"), "[email protected]");
  aboutData.addCredit("Dimitri van Heesch", I18N_NOOP("Doxygen wizard"), "[email protected]");
  aboutData.addCredit("Hugo Varotto", I18N_NOOP("Fileselector component"), "[email protected]");
  aboutData.addCredit("Matt Newell", I18N_NOOP("Fileselector component"), "[email protected]");
  aboutData.addCredit("Trolltech AS", I18N_NOOP("Designer code"), "[email protected]");
  aboutData.addCredit("Daniel Engelschalt", I18N_NOOP("C++ code completion, persistent class store"), "[email protected]");
  aboutData.addCredit("Stephane ANCELOT", I18N_NOOP("Patches"), "[email protected]");
  aboutData.addCredit("Jens Zurheide", I18N_NOOP("Patches"), "[email protected]");
  aboutData.addCredit("Luc Willems", I18N_NOOP("Help with Perl support"), "[email protected]");
  aboutData.addCredit("Marcel Turino", I18N_NOOP("Documentation index view"), "[email protected]");
  aboutData.addCredit("Yann Hodique", I18N_NOOP("Patches"), "[email protected]");
  aboutData.addCredit("Tobias Gl\303\244\303\237er" , I18N_NOOP("Documentation Finder,  qmake projectmanager patches, usability improvements, bugfixes ... "), "[email protected]");
  aboutData.addCredit("Andreas Koepfle" , I18N_NOOP("QMake project manager patches"), "[email protected]");
  aboutData.addCredit("Sascha Cunz" , I18N_NOOP("Cleanup and bugfixes for qEditor, AutoMake and much other stuff"), "[email protected]");

  KCmdLineArgs::init(argc, argv, &aboutData);
  KCmdLineArgs::addCmdLineOptions( options );
//  KCmdLineArgs* args = KCmdLineArgs::parsedArgs();

  KApplication app;

  KDevAssistantExtension::init();

  KDevSplashScreen *splash = 0;
  QString splashFile = locate("data", "kdevelop/pics/kdevassistant-splash.png");
  if (!splashFile.isEmpty())
  {
    QPixmap pm;
    pm.load(splashFile);
    splash = new KDevSplashScreen( pm );
  }
  if (splash) splash->show();

  app.processEvents();

  QObject::connect(PluginController::getInstance(), SIGNAL(loadingPlugin(const QString &)),
		   splash, SLOT(showMessage(const QString &)));

  if (splash) splash->message( i18n( "Loading Settings" ) );
  TopLevel::getInstance()->loadSettings();

  PluginController::getInstance()->loadInitialPlugins();

  if (splash) splash->message( i18n( "Starting GUI" ) );
  TopLevel::getInstance()->main()->show();

  Core::getInstance()->doEmitCoreInitialized();

  if (splash) delete splash;

  kapp->dcopClient()->registerAs("kdevassistant");

  return app.exec();
}
开发者ID:serghei,项目名称:kde3-kdevelop,代码行数:86,代码来源:main_assistant.cpp

示例4: main

int main( int argc, char** argv )
{
    QString version = CalligraVersionWrapper::versionString(true);

    K4AboutData aboutData("calligragemini",
                         "calligrawords",
                         ki18n("Calligra Gemini"),
                         version.toLatin1(),
                         ki18n("Calligra Gemini: Writing and Presenting at Home and on the Go"),
                         K4AboutData::License_GPL,
                         ki18n("(c) 1999-%1 The Calligra team and KO GmbH.\n").subs(CalligraVersionWrapper::versionYear()),
                         KLocalizedString(),
                         "http://www.calligra.org",
                         "[email protected]");

    KCmdLineArgs::init (argc, argv, &aboutData);

    KCmdLineOptions options;
    options.add( "+[files]", ki18n( "Document to open" ) );
    options.add( "vkb", ki18n( "Use the virtual keyboard" ) );
    KCmdLineArgs::addCmdLineOptions( options );

    KCmdLineArgs* args = KCmdLineArgs::parsedArgs();
    QStringList fileNames;
    if (args->count() > 0) {
        for (int i = 0; i < args->count(); ++i) {
            QString fileName = args->arg(i);
            if (QFile::exists(fileName)) {
                fileNames << fileName;
            }
        }
    }

    KApplication app;
    app.setApplicationName("calligragemini");
    KIconLoader::global()->addAppDir("calligrawords");
    KIconLoader::global()->addAppDir("words");
    KIconLoader::global()->addAppDir("calligrastage");
    KIconLoader::global()->addAppDir("stage");

#ifdef Q_OS_WIN
    QDir appdir(app.applicationDirPath());
    appdir.cdUp();

    QString envStringSet;
    QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
    if (!env.contains("KDESYCOCA")) {
        _putenv_s("KDESYCOCA", QString(appdir.absolutePath() + "/sycoca").toLocal8Bit());
        envStringSet.append("KDESYCOCA ");
    }
    if (!env.contains("XDG_DATA_DIRS")) {
        _putenv_s("XDG_DATA_DIRS", QString(appdir.absolutePath() + "/share").toLocal8Bit());
        envStringSet.append("XDG_DATA_DIRS ");
    }
    _putenv_s("PATH", QString(appdir.absolutePath() + "/bin" + ";"
              + appdir.absolutePath() + "/lib" + ";"
              + appdir.absolutePath() + "/lib"  +  "/kde4" + ";"
              + appdir.absolutePath()).toLocal8Bit());

    if(envStringSet.length() > 0) {
        qDebug() << envStringSet << "were set from main, restarting application in new environment!";
        // Pass all the arguments along, but don't include the application name...
        QProcess::startDetached(app.applicationFilePath(), KCmdLineArgs::allArguments().mid(1));
        exit(0);
    }

    app.addLibraryPath(appdir.absolutePath());
    app.addLibraryPath(appdir.absolutePath() + "/bin");
    app.addLibraryPath(appdir.absolutePath() + "/lib");
    app.addLibraryPath(appdir.absolutePath() + "/lib/kde4");

    QStringList iconThemePaths;
    iconThemePaths << appdir.absolutePath() + "/share/icons";
    QIcon::setThemeSearchPaths(iconThemePaths);
    QIcon::setThemeName("oxygen");
#endif

    if (qgetenv("KDE_FULL_SESSION").isEmpty()) {
        // There are two themes that work for Krita, oxygen and plastique. Try to set plastique first, then oxygen
        qobject_cast<QApplication*>(QApplication::instance())->setStyle("Plastique");
        qobject_cast<QApplication*>(QApplication::instance())->setStyle("Oxygen");
    }

    // then create the pixmap from an xpm: we cannot get the
    // location of our datadir before we've started our components,
    // so use an xpm.
//     QPixmap pm(splash_screen_xpm);
//     QSplashScreen splash(pm);
//     splash.show();
//     splash.showMessage(".");
    app.processEvents();

#if defined HAVE_X11
    QApplication::setAttribute(Qt::AA_X11InitThreads);
#endif

    MainWindow window(fileNames);

    if (args->isSet("vkb")) {
//        app.setInputContext(new SketchInputContext(&app));
//.........这里部分代码省略.........
开发者ID:foren197316,项目名称:calligra,代码行数:101,代码来源:main.cpp

示例5: kScreenSaverMain

int kScreenSaverMain( int argc, char** argv, KScreenSaverInterface& screenSaverInterface )
{
    KLocale::setMainCatalog("libkscreensaver");
    KCmdLineArgs::init(argc, argv, screenSaverInterface.aboutData());


    KCmdLineOptions options;

    options.add("setup", ki18n("Setup screen saver"));

    options.add("window-id wid", ki18n("Run in the specified XWindow"));

    options.add("root", ki18n("Run in the root XWindow"));

    options.add("demo", ki18n("Start screen saver in demo mode"), "default");

    KCmdLineArgs::addCmdLineOptions(options);

    KApplication app;

    // Set a useful default icon.
    app.setWindowIcon(KIcon("preferences-desktop-screensaver"));


    if (!pipe(termPipe))
    {
#ifndef Q_WS_WIN
        struct sigaction sa;
        sa.sa_handler = termHandler;
        sigemptyset(&sa.sa_mask);
        sa.sa_flags = 0;
        sigaction(SIGTERM, &sa, 0);
#endif
        QSocketNotifier *sn = new QSocketNotifier(termPipe[0], QSocketNotifier::Read, &app);
        QObject::connect(sn, SIGNAL(activated(int)), &app, SLOT(quit()));
    }

#ifdef Q_WS_X11
    oldXErrorHandler = XSetErrorHandler(xErrorHandler);
#endif
    KCrash::setCrashHandler( crashHandler );
    KGlobal::locale()->insertCatalog("klock");
    KGlobal::locale()->insertCatalog("kscreensaver");

    DemoWindow *demoWidget = 0;
    Window saveWin = 0;
    KScreenSaver *target;

    KCmdLineArgs *args = KCmdLineArgs::parsedArgs();

    if (args->isSet("setup"))
    {
       QDialog *dlg = screenSaverInterface.setup();
       args->clear();
       dlg->exec();
       delete dlg;
       return 0;
    }

    if (args->isSet("window-id"))
    {
#ifdef Q_WS_WIN
        saveWin = (HWND)(args->getOption("window-id").toULong());
#else
        saveWin = args->getOption("window-id").toInt();
#endif
    }

#ifdef Q_WS_X11 //FIXME
    if (args->isSet("root"))
    {
		QX11Info inf;
        saveWin = RootWindow(QX11Info::display(), inf.screen());
    }
#endif

    if (args->isSet("demo"))
    {
        saveWin = 0;
    }

    if (saveWin == 0)
    {
        demoWidget = new DemoWindow();
        demoWidget->setAttribute(Qt::WA_NoSystemBackground);
        demoWidget->setAttribute(Qt::WA_PaintOnScreen);
        demoWidget->show();
        app.processEvents();
        saveWin = demoWidget->winId();
    }

    target = screenSaverInterface.create( saveWin );
    target->setAttribute(Qt::WA_PaintOnScreen);
    target->show();

    if (demoWidget)
    {
        target->installEventFilter( demoWidget );
    }

//.........这里部分代码省略.........
开发者ID:mgottschlag,项目名称:kwin-tiling,代码行数:101,代码来源:main.cpp

示例6: main


//.........这里部分代码省略.........
        for (int i = 0; i < args->count(); ++i) {
            QString fileName = args->arg(i);
            if (QFile::exists(fileName)) {
                fileNames << fileName;
            }
        }
    }

    KApplication app;
    app.setApplicationName("kritagemini");
    KIconLoader::global()->addAppDir("krita");
    KIconLoader::global()->addAppDir("kritasketch");

#ifdef Q_OS_WIN
    QDir appdir(app.applicationDirPath());
    appdir.cdUp();

    QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
    // If there's no kdehome, set it and restart the process.
    //QMessageBox::information(0, "krita sketch", "KDEHOME: " + env.value("KDEHOME"));
    if (!env.contains("KDEHOME") ) {
        _putenv_s("KDEHOME", QDesktopServices::storageLocation(QDesktopServices::DataLocation).toLocal8Bit());
    }
    if (!env.contains("KDESYCOCA")) {
        _putenv_s("KDESYCOCA", QString(appdir.absolutePath() + "/sycoca").toLocal8Bit());
    }
    if (!env.contains("XDG_DATA_DIRS")) {
        _putenv_s("XDG_DATA_DIRS", QString(appdir.absolutePath() + "/share").toLocal8Bit());
    }
    if (!env.contains("KDEDIR")) {
        _putenv_s("KDEDIR", appdir.absolutePath().toLocal8Bit());
    }
    if (!env.contains("KDEDIRS")) {
        _putenv_s("KDEDIRS", appdir.absolutePath().toLocal8Bit());
    }
    _putenv_s("PATH", QString(appdir.absolutePath() + "/bin" + ";"
              + appdir.absolutePath() + "/lib" + ";"
              + appdir.absolutePath() + "/lib"  +  "/kde4" + ";"
              + appdir.absolutePath()).toLocal8Bit());

    app.addLibraryPath(appdir.absolutePath());
    app.addLibraryPath(appdir.absolutePath() + "/bin");
    app.addLibraryPath(appdir.absolutePath() + "/lib");
    app.addLibraryPath(appdir.absolutePath() + "/lib/kde4");
#endif

#if defined Q_OS_WIN
    KisTabletSupportWin::init();
    app.setEventFilter(&KisTabletSupportWin::eventFilter);
#elif defined Q_WS_X11
    KisTabletSupportX11::init();
    app.setEventFilter(&KisTabletSupportX11::eventFilter);
#endif
	
	if (qgetenv("KDE_FULL_SESSION").isEmpty()) {
        // There are two themes that work for Krita, oxygen and plastique. Try to set plastique first, then oxygen
        qobject_cast<QApplication*>(QApplication::instance())->setStyle("Plastique");
		qobject_cast<QApplication*>(QApplication::instance())->setStyle("Oxygen");
    }

	bool showFullscreen = false;
	if (args->isSet("fullscreen")) {
        showFullscreen = true;
    }

    // then create the pixmap from an xpm: we cannot get the
    // location of our datadir before we've started our components,
    // so use an xpm.
    // If fullscreen, hide splash screen
    QPixmap pm(splash_screen_xpm);
    QSplashScreen splash(pm);
    if (!showFullscreen) {
        splash.show();
        splash.showMessage(".");
        app.processEvents();
    }

#if defined Q_WS_X11 && QT_VERSION >= 0x040800
    QApplication::setAttribute(Qt::AA_X11InitThreads);
#endif

    MainWindow window(fileNames);

    if (args->isSet("vkb")) {
        app.setInputContext(new SketchInputContext(&app));
    }

    if (showFullscreen) {
        window.showFullScreen();
    } else {
#ifdef Q_OS_WIN
		window.showMaximized();
#else
		window.show();
#endif
	}
    splash.finish(&window);

    return app.exec();
}
开发者ID:,项目名称:,代码行数:101,代码来源:

示例7: main

int main(int argc, char *argv[])
{
  timer.start();

  QString feature;

  if (!feature.isEmpty())
    feature = I18N_NOOP("Compiled with the following settings:\n") + feature;

  KAboutData aboutData("kmymoney", 0, ki18n("KMyMoney"),
                       VERSION, ki18n("\nKMyMoney, the Personal Finance Manager for KDE.\n\nPlease consider contributing to this project with code and/or suggestions."), KAboutData::License_GPL,
                       ki18n("(c) 2000-2014 The KMyMoney development team"), /*feature*/KLocalizedString(),
                       I18N_NOOP("http://kmymoney.org/")/*,
                                                      "[email protected]")*/);

  //Temporarily, the product name to report bugs in BKO is different than the application name
  aboutData.setProductName("kmymoney4");

  aboutData.addAuthor(ki18n("Michael Edwardes."), ki18n("Initial idea, much initial source code, Project admin"), "[email protected]");
  aboutData.addAuthor(ki18n("Thomas Baumgart"), ki18n("Core engine, Release Manager, Project admin"), "[email protected]");
  aboutData.addAuthor(ki18n("Ace Jones"), ki18n("Reporting logic, OFX Import"), "[email protected]");
  aboutData.addAuthor(ki18n("Tony Bloomfield"), ki18n("Database backend, maintainer stable branch"), "[email protected]");
  aboutData.addAuthor(ki18n("Alvaro Soliverez"), ki18n("Forecast, Reports"), "[email protected]");
  aboutData.addAuthor(ki18n("Felix Rodriguez"), ki18n("Project Admin"), "[email protected]");
  aboutData.addAuthor(ki18n("John C"), ki18n("Developer"), "[email protected]");
  aboutData.addAuthor(ki18n("Fernando Vilas"), ki18n("Database backend"), "[email protected]");
  aboutData.addAuthor(ki18n("Cristian Oneț"), ki18n("Developer"), "[email protected]");

  aboutData.addCredit(ki18n("Kevin Tambascio"), ki18n("Initial investment support"), "[email protected]");
  aboutData.addCredit(ki18n("Javier Campos Morales"), ki18n("Developer & Artist"), "[email protected]");
  aboutData.addCredit(ki18n("Robert Wadley"), ki18n("Icons & splash screen"), "[email protected]");
  aboutData.addCredit(ki18n("Laurent Montel"), ki18n("Patches and port to kde4"), "[email protected]");
  aboutData.addCredit(ki18n("Wolfgang Rohdewald"), ki18n("Patches"), "[email protected]");
  aboutData.addCredit(ki18n("Marko Käning"), ki18n("Patches and packaging for OS X"), "[email protected]");
  aboutData.setOrganizationDomain("kde.org");
  KCmdLineOptions options;
  options.add("lang <lang-code>", ki18n("language to be used"));
  options.add("n", ki18n("do not open last used file"));
  options.add("timers", ki18n("enable performance timers"));
  options.add("nocatch", ki18n("do not globally catch uncaught exceptions"));

#ifdef KMM_DEBUG
  // The following options are only available when compiled in debug mode
  options.add("trace", ki18n("turn on program traces"));
  options.add("dump-actions", ki18n("dump the names of all defined KAction objects to stdout and quit"));
#endif

  // INSERT YOUR COMMANDLINE OPTIONS HERE
  options.add("+[File]", ki18n("file to open"));

  KCmdLineArgs::init(argc, argv, &aboutData);
  KCmdLineArgs::addCmdLineOptions(options);   // Add our own options.

  // create the singletons before we start memory checking
  // to avoid false error reports
  MyMoneyFile::instance();

  KMyMoneyUtils::checkConstants();

  KApplication* a = new KApplication();

  if (KGlobal::locale()->monetaryDecimalSymbol().isEmpty()) {
    KMessageBox::error(0, i18n("The monetary decimal symbol is not correctly set in the KDE System Settings module Country/Region & Language. Please set it to a reasonable value and start KMyMoney again."), i18n("Invalid settings"));
    delete a;
    exit(1);
  }

  // show startup logo
  KStartupLogo* splash = new KStartupLogo();
  a->processEvents();

  args = KCmdLineArgs::parsedArgs();

  // setup the MyMoneyMoney locale settings according to the KDE settings
  MyMoneyMoney::setThousandSeparator(KGlobal::locale()->monetaryThousandsSeparator()[0]);
  MyMoneyMoney::setDecimalSeparator(KGlobal::locale()->monetaryDecimalSymbol()[0]);
  MyMoneyMoney::setNegativeMonetarySignPosition(static_cast<MyMoneyMoney::signPosition>(KGlobal::locale()->negativeMonetarySignPosition()));
  MyMoneyMoney::setPositiveMonetarySignPosition(static_cast<MyMoneyMoney::signPosition>(KGlobal::locale()->positiveMonetarySignPosition()));
  MyMoneyMoney::setNegativePrefixCurrencySymbol(KGlobal::locale()->negativePrefixCurrencySymbol());
  MyMoneyMoney::setPositivePrefixCurrencySymbol(KGlobal::locale()->positivePrefixCurrencySymbol());

  QString language = args->getOption("lang");
  if (!language.isEmpty()) {
    if (!KGlobal::locale()->setLanguage(QStringList() << language)) {
      qWarning("Unable to select language '%s'. This has one of two reasons:\n\ta) the standard KDE message catalog is not installed\n\tb) the KMyMoney message catalog is not installed", qPrintable(language));
    }
  }

#ifdef KMM_DEBUG
  if (args->isSet("trace"))
    MyMoneyTracer::on();
  timersOn = args->isSet("timers");
#endif

  kmymoney = 0;
  kmymoney = new KMyMoneyApp();

#ifdef KMM_DEBUG
  if (args->isSet("dump-actions")) {
    kmymoney->dumpActions();
//.........这里部分代码省略.........
开发者ID:CGenie,项目名称:kmymoney,代码行数:101,代码来源:main.cpp


注:本文中的KApplication::processEvents方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。