void OpenDtp::runServer() { this->server = new OpenDTPServer(); this->scripterCore = new OpenDTPScripterCore(); qRegisterMetaType<std::string>(); qRegisterMetaType<std::vector<std::string> >(); QObject::connect(this->server->getThread(), SIGNAL(hasRequest(std::string, std::vector<std::string>)), this->scripterCore, SLOT(runScriptFile(std::string, std::vector<std::string>)), Qt::QueuedConnection); this->server->start(); }
int main(int argc, char **argv) { std::vector<std::string> strs; strs.push_back("1"); app = new QApplication(argc, argv); app->setApplicationName("krosstest"); app->setApplicationVersion("0.1"); app->setOrganizationDomain("dipe.org"); /*K4AboutData about("krosstest", 0, ki18n("KrossTest"), "0.1", ki18n("KDE application to test the Kross framework."), K4AboutData::License_LGPL, ki18n("(C) 2005-2007 Sebastian Sauer"), ki18n("Test the Kross framework!"), "http://kross.dipe.org", "*****@*****.**");*/ //about.addAuthor(ki18n("Sebastian Sauer"), ki18n("Author"), "*****@*****.**"); QCommandLineParser parser; parser.setApplicationDescription(QCoreApplication::translate("main", "KDE application to test the Kross framework.")); parser.addHelpOption(); parser.addPositionalArgument("file", QCoreApplication::translate("main", "Scriptfile")); parser.process(*app); const QStringList args = parser.positionalArguments(); if (args.count() < 1) { std::cerr << "No scriptfile to execute defined. See --help" << std::endl; return ERROR_HELP; } QStringList scriptfiles; for (int i = 0; i < args.count(); i++) { scriptfiles.append(args.at(i)); } // init TestObject *testobj1 = new TestObject(0, "TestObject1"); TestObject *testobj2 = new TestObject(0, "TestObject2"); Kross::Manager::self().addObject(testobj1); Kross::Manager::self().addObject(testobj2); Kross::Manager::self().registerMetaTypeHandler("OtherObject*", OtherObjectHandler); int result = 0; foreach (const QString &file, scriptfiles) { result = runScriptFile(file); if (result != ERROR_OK) { break; } }
int main(int argc, char** argv) { int fd; boolean nReturn = FALSE; char* pszScript = SCRIPT_FILE; if (argc > 1) { pszScript = argv[1]; } nReturn = runScriptFile(pszScript, STDOUT, LOG_FILE); return nReturn ? 0 : 1; }
int main(int argc, char **argv) { QApplication *app = new QApplication(argc, argv); app->setApplicationName("kross"); app->setApplicationVersion("0.1"); app->setOrganizationDomain("dipe.org"); QScriptEngine *engine = new QScriptEngine(); engine->installTranslatorFunctions(); /*K4AboutData about("kross",0,ki18n("Kross"),"0.1", ki18n("KDE application to run Kross scripts."), K4AboutData::License_LGPL, ki18n("(C) 2006 Sebastian Sauer"), ki18n("Run Kross scripts."), "http://kross.dipe.org","*****@*****.**");*/ //about.addAuthor(ki18n("Sebastian Sauer"), ki18n("Author"), "*****@*****.**"); // Initialize command line args // Tell which options are supported and parse them. QCommandLineParser parser; parser.setApplicationDescription(QCoreApplication::translate("main", "KDE application to run Kross scripts.")); parser.addHelpOption(); parser.addOption(QCommandLineOption(QStringList() << "+file", QCoreApplication::translate("main", "Scriptfile"))); parser.process(*app); const QStringList args = parser.positionalArguments(); // If no options are defined. if (args.count() < 1) { parser.showHelp(); //std::cout << "Syntax: " << "kross" << " scriptfile1 [scriptfile2] [scriptfile3] ..." << std::endl; return -1; } QScriptValue global = engine->globalObject(); //qDebug()<<"QLibraryInfo::PluginsPath="<<QLibraryInfo::location(QLibraryInfo::PluginsPath); engine->importExtension("kross").toString(); foreach (const QString &file, args) { runScriptFile(engine, file); }