void CFileBrowser::runApp(void){
    struct link_stat st;
    int err;
    CNotify notify;
    QTreeWidgetItem* item;
    item = ui->tree->currentItem();
    if( item == 0 ){
        notify.execError("Invalid Selection");
        return;
    }

    err = link()->stat( item->text(1).toLocal8Bit().constData(),
                        &st);

    if ( err < 0 ){
        notify.execLinkError(link_errno);
        return;
    }

    if ( (st.st_mode & LINK_S_IFMT) != LINK_S_IFREG ){
        notify.execError("File is not executable");
        return;
    }

    if( st.st_mode & (LINK_S_IXGRP|LINK_S_IXOTH|LINK_S_IXUSR) ){
        //Execute a program on the target device
        emit runApplication( ui->tree->currentItem()->text(1) );
    } else {
        notify.execError("File is not executable");
    }
}
Beispiel #2
0
    void ApplicationResource::doPOST(Descriptor& socket, HttpMessage& request, const char* remainingPath)
    {
        std::string key;
        if (request.queryParameterMap.find("action") < 0) {
            key = "_default";
        }
        else {
            key = request.queryParameterMap["action"][0];
        }

        std::shared_lock<std::shared_mutex> readLock(mutex);

        if (! getJson()["_actions"].contains(key)) throw HttpCode::Http406;

        runApplication(getJson()["_actions"][key].toString());
        sendStatus(socket, HttpCode::Http204);
    }
static DIALStatus youtube_start(DIALServer *ds, const char *appname,
                                const char *args, size_t arglen,
                                DIAL_run_t *run_id, void *callback_data) {
    printf("\n\n ** LAUNCH YouTube ** with args %s\n\n", args);

    char url[512] = {0,}, data[512] = {0,};
    sprintf( url, "https://www.youtube.com/tv?%s", args);
    sprintf( data, "--user-data-dir=%s/.config/google-chrome-dial", getenv("HOME") );

    const char * const youtube_args[] = { spAppYouTubeExecutable,
      spYouTubePS3UserAgent,
      data, "--app", url, NULL
    };
    runApplication( youtube_args, run_id );

    return kDIALStatusRunning;
}
Beispiel #4
0
///
/// run GammaComboEngine, main steering function
///
void GammaComboEngine::run()
{
    if ( arg->usage ) usage(); // print usage and exit
    checkCombinationArg();
    checkColorArg();
    checkAsimovArg();
    //scaleDownErrors();
    if ( arg->nosyst ) disableSystematics();
    makeAddDelCombinations();
    if ( arg->nbatchjobs>0 ) writebatchscripts();
    defineColors();
    customizeCombinerTitles();
    setUpPlot();
    scan();
    if (!arg->isAction("pluginbatch")) savePlot();
    cout << endl;
    t.Stop();
    t.Print();
    runApplication();
}
static DIALStatus netflix_start(DIALServer *ds, const char *appname,
                                const char *args, size_t arglen,
                                DIAL_run_t *run_id, void *callback_data) {
    int shouldRelaunchApp = 0;
    int payloadLen = 0;
    int appPid = 0;

    // only launch Netflix if it isn't running
    appPid = isAppRunning( spAppNetflix, NULL );
    shouldRelaunchApp = shouldRelaunch( ds, appname, args );

    // construct the payload to determine if it has changed from the previous launch
    payloadLen = strlen(args);
    memset( sQueryParam, 0, DIAL_MAX_PAYLOAD );
    strcat( sQueryParam, defaultLaunchParam );
    if( payloadLen )
    {
        char * pUrlEncodedParams;
        pUrlEncodedParams = url_encode( args );
        if( pUrlEncodedParams )
        {
            strcat( sQueryParam, "&dial=");
            strcat( sQueryParam, pUrlEncodedParams );
            free( pUrlEncodedParams );
        }
    }

    printf("appPid = %s, shouldRelaunch = %s queryParams = %s\n",
          appPid?"TRUE":"FALSE",
          shouldRelaunchApp?"TRUE":"FALSE",
          sQueryParam );

    // if its not running, launch it.  The Netflix application should
    // never be relaunched
    if( !appPid )
    {
        const char * const netflix_args[] = {spNetflix, "-Q", sQueryParam, 0};
        return runApplication( netflix_args, run_id );
    }
    else return kDIALStatusRunning;
}
Beispiel #6
0
static DIALStatus youtube_start(DIALServer *ds, const char *appname,
                                const char *payload, const char *additionalDataUrl,
                                DIAL_run_t *run_id, void *callback_data) {
    printf("\n\n ** LAUNCH YouTube ** with payload %s\n\n", payload);

    char url[512] = {0,}, data[512] = {0,};
    if (strlen(payload) && strlen(additionalDataUrl)){
        sprintf( url, "https://www.youtube.com/tv?%s&%s", payload, additionalDataUrl);
    }else if (strlen(payload)){
        sprintf( url, "https://www.youtube.com/tv?%s", payload);
    }else{
        sprintf( url, "https://www.youtube.com/tv");
    }
    sprintf( data, "--user-data-dir=%s/.config/google-chrome-dial", getenv("HOME") );

    const char * const youtube_args[] = { spAppYouTubeExecutable,
      spYouTubePS3UserAgent,
      data, "--app", url, NULL
    };
    runApplication( youtube_args, run_id );

    return kDIALStatusRunning;
}
Beispiel #7
0
void commandLine(){
	inputKey = 0;
	exit = 0;
	temp = 0;
	counter = 0;

	vgaSetup(3);
	vgaSetPos(0,0);
	vgaPrintString( getOSVersion() );

	while( 1 ){
		exit = 0;
		counter = 0;
		vgaPrintString( "BuenOS >" );//prompt input

		while( ( exit == 0 && inputKey == 0 ) || exit == 0 ){//fill input buffer
			inputKey = getKey();

			if( isInput( inputKey ) ){
				if( inputKey == 27 ){//esc
					cursorPos = vgaGetPos();
					vgaSetPos( ( cursorPos->x - counter ), cursorPos->y );
					for( temp = 0; temp < counter; temp++){
						vgaPrint( ' ' );
					}
					vgaSetPos( ( cursorPos->x - counter ), cursorPos->y );
					counter = 0;
					inputBuffer[counter] = 0;
				}
				else if( inputKey == 13 ){//enter
					exit = 1;//finish buffer loop
					inputBuffer[counter] = 0;//null terminate string
					while( counter < sizeOfBuffer ){//null out remaining buffer
						inputBuffer[counter] = 0;
						counter++;
					}
					vgaPrintString( "\r\n" );
				}

				else if( inputKey == 8 ){//backspace
					if( counter != 0 ){
						vgaPrintString( "\b \b" );
						counter--;
						inputBuffer[counter] = 0;
					}
				}
				else if( counter != sizeOfBuffer ){
					vgaPrint( inputKey );
					inputBuffer[counter] = inputKey;
					counter++;
				}
			}
		}
		stringCopy( inputBuffer, tempBuffer );
		stringParseInfo = stringParse( tempBuffer );
		stringParseInfo->argc++;
		stringUppercase( stringParseInfo->argv[0] );

		if( stringLength( stringParseInfo->argv[0] ) != 0 ){
			if( stringEqual( stringParseInfo->argv[0], "HELP" ) )  vgaPrintString( helpString );
			else if( stringEqual( stringParseInfo->argv[0], "CLEAR" ) )  vgaSetup( 3 );
			else if( stringEqual( stringParseInfo->argv[0], "VERSION" ) )  vgaPrintString( getOSVersion() );
			else if( stringEqual( stringParseInfo->argv[0], "ECHO" ) ) {
				stringStrip( stringParseInfo->argv[1], '"' );
				vgaPrintString( stringParseInfo->argv[1] );
				vgaPrintString( "\r\n" );
			}
			else if( stringEqual( stringParseInfo->argv[0], "DIR" ) ){
				getFileList( tempBuffer );
				stringFindAndReplace( tempBuffer, ',', ' ' );
				stringParseInfo = stringParse( tempBuffer );
				temp = 0;
				while( temp <= stringParseInfo->argc ){
					vgaPrintString( stringParseInfo->argv[temp] );
					cursorPos = vgaGetPos();
					vgaSetPos( 12, cursorPos->y );
					vgaPrintString( intToString( getFileSize( stringParseInfo->argv[temp] ) ) );
					vgaPrintString( " bytes\r\n" );
					temp++;
				}
			}
			else if( stringEqual( stringParseInfo->argv[0], "SIZEOF" ) ){
				vgaPrintString( intToString( getFileSize( stringParseInfo->argv[1] ) ) );
				vgaPrintString( " bytes\r\n" );
			}
			else if( stringEqual( stringParseInfo->argv[0], "RENAME" ) ){
				stringUppercase( stringParseInfo->argv[1] );
				stringUppercase( stringParseInfo->argv[2] );
				if( fileExists( stringParseInfo->argv[1] ) && stringLength( stringParseInfo->argv[1] ) != 0 && stringLength( stringParseInfo->argv[2] ) != 0 ){
					if( stringEqual( stringParseInfo->argv[1], "KERNEL.BIN" ) ) vgaPrintString( "Nice try.\r\n" );
					else if( fileExists( stringParseInfo->argv[2] ) || renameFile( stringParseInfo->argv[1], stringParseInfo->argv[2] ) ){
						vgaPrintString( "File " );
						vgaPrintString( stringParseInfo->argv[1] );
						vgaPrintString( " could not be renamed to " );
						vgaPrintString( stringParseInfo->argv[2] );
						vgaPrintString( "\r\n" );
					}
					else{
						vgaPrintString( "File " );
						vgaPrintString( stringParseInfo->argv[1] );
						vgaPrintString( " successfully renamed to " );
						vgaPrintString( stringParseInfo->argv[2] );
						vgaPrintString( "\r\n" );
					}
				}
				else{
					vgaPrintString( "File " );
					vgaPrintString( stringParseInfo->argv[1] );
					vgaPrintString( " cannot be found.\r\n" );
				}
			}
			else if( stringEqual( stringParseInfo->argv[0], "DELETE" ) ){
				stringUppercase( stringParseInfo->argv[1] );
				if( fileExists( stringParseInfo->argv[1] ) && stringLength( stringParseInfo->argv[1] ) != 0 ){
					if( stringEqual( stringParseInfo->argv[1], "KERNEL.BIN" ) != 1 ){
						if( removeFile( stringParseInfo->argv[1] ) ){
							vgaPrintString( "File " );
							vgaPrintString( stringParseInfo->argv[1] );
							vgaPrintString( " could not be deleted\r\n" );
						}
						else{
							vgaPrintString( "File " );
							vgaPrintString( stringParseInfo->argv[1] );
							vgaPrintString( " successfully deleted\r\n" );
						}
					}
					else vgaPrintString( "OMG just stop it. I NEED THAT!\r\n\nIT'S NOT FUNNY! ARGH!\r\n\n\n" );
				}
			}
			else if( stringEqual( stringParseInfo->argv[0], "SHUTDOWN" ) )  shutdown();
			else if( stringEqual( stringParseInfo->argv[0], "RESTART" ) )  restart();
			else runApplication( stringParseInfo );
		}
	}
}