OscController::OscController(MemoryAppParameters& appParams, CommandsController& commands) : _params(appParams.core.osc) , _appParams(appParams) , _commands(commands) { TEvent<bool>::VoidFunctor handler = [this]() { handleOpen(); // closes if disabled }; _params.enabled.changed.addVoidListener(handler, this); _params.inputEnabled.changed.addVoidListener(handler, this); _params.outputEnabled.changed.addVoidListener(handler, this); handleOpen(); }
WITH_PLATFORM_STRING(env, path, ps) { FD fd; #if defined(__linux__) || defined(_ALLBSD_SOURCE) /* Remove trailing slashes, since the kernel won't */ char *p = (char *)ps + strlen(ps) - 1; while ((p > ps) && (*p == '/')) *p-- = '\0'; #endif fd = handleOpen(ps, flags, 0666); if (fd != -1) { jobject fdobj; jboolean append; SET_FD(this, fd, fid); fdobj = (*env)->GetObjectField(env, this, fid); if (fdobj != NULL) { append = (flags & O_APPEND) == 0 ? JNI_FALSE : JNI_TRUE; (*env)->SetBooleanField(env, fdobj, IO_append_fdID, append); } } else { throwFileNotFoundException(env, path); } } END_PLATFORM_STRING(env, ps);
void Helper::readCommand() { QString command = readLine(); if( input.atEnd()) { #ifdef DEBUG_KDE QTextStream( stderr ) << "EOF, existing." << endl; #endif QCoreApplication::exit(); return; } #ifdef DEBUG_KDE QTextStream( stderr ) << "COMMAND:" << command << endl; #endif bool status; if( command == "CHECK" ) status = handleCheck(); else if( command == "GETPROXY" ) status = handleGetProxy(); else if( command == "HANDLEREXISTS" ) status = handleHandlerExists(); else if( command == "GETFROMEXTENSION" ) status = handleGetFromExtension(); else if( command == "GETFROMTYPE" ) status = handleGetFromType(); else if( command == "GETAPPDESCFORSCHEME" ) status = handleGetAppDescForScheme(); else if( command == "APPSDIALOG" ) status = handleAppsDialog(); else if( command == "GETOPENFILENAME" ) status = handleGetOpenX( false ); else if( command == "GETOPENURL" ) status = handleGetOpenX( true ); else if( command == "GETSAVEFILENAME" ) status = handleGetSaveX( false ); else if( command == "GETSAVEURL" ) status = handleGetSaveX( true ); else if( command == "GETDIRECTORYFILENAME" ) status = handleGetDirectoryX( false ); else if( command == "GETDIRECTORYURL" ) status = handleGetDirectoryX( true ); else if( command == "OPEN" ) status = handleOpen(); else if( command == "REVEAL" ) status = handleReveal(); else if( command == "RUN" ) status = handleRun(); else if( command == "GETDEFAULTFEEDREADER" ) status = handleGetDefaultFeedReader(); else if( command == "OPENMAIL" ) status = handleOpenMail(); else if( command == "OPENNEWS" ) status = handleOpenNews(); else if( command == "ISDEFAULTBROWSER" ) status = handleIsDefaultBrowser(); else if( command == "SETDEFAULTBROWSER" ) status = handleSetDefaultBrowser(); else if( command == "DOWNLOADFINISHED" ) status = handleDownloadFinished(); else { QTextStream( stderr ) << "Unknown command for KDE helper: " << command << endl; status = false; } // status done as \1 (==ok) and \0 (==not ok), because otherwise this cannot happen // in normal data (\ is escaped otherwise) outputLine( status ? "\\1" : "\\0", false ); // do not escape }