Esempio n. 1
0
int memory_save(int position)
{
	char filename[256];
	
	printf("Enter save file name: ");
	fgets(filename, 256, stdin);
	filename[strlen(filename) - 1] = '\0';
	if (sc_memorySave(filename) == 0) {
		refresh_gui(position);
		printf("File successfully saved");
		return 0;
	}
	else {
		printf("Cannot save file: %s", filename);
		return -1;
	}
}
Esempio n. 2
0
Cconditions_list_boxItemDialog::Cconditions_list_boxItemDialog(QWidget *parent, QString projectPath)
{
    this->setParent( parent );
    this->setParent( 0 );
    this->setModal( true );
    this->setAttribute( Qt::WA_DeleteOnClose, true );

    // the names we receive are fully worked out and cleaned

    //gui
    this->btn_cancel = new QPushButton( QIcon( ":/resources/img/cancel.png" ), tr( "Cancel" ) );
    this->btn_ok = new QPushButton( QIcon( ":/resources/img/ok.png" ), tr( "Ok" ) );

    //bool1
    this->bool1_0rad = new QRadioButton( tr( "When a bool matches a state" ) );
    this->bool1_1boolIndex_box = new QComboBox();
    this->bool1_1boolIndex_box->addItems( cev_api::getSwitchesNames( projectPath ) );
    this->bool1_2state = new QComboBox( );
    this->bool1_2state->addItem( QIcon( ":/resources/img/bool_off.png" ), tr( "OFF" ) );
    this->bool1_2state->addItem( QIcon( ":/resources/img/bool_off.png" ), tr( "ON" ) );
    this->bool1_2state->setCurrentIndex( 1 );

    //bool2
    this->bool2_0rad = new QRadioButton( tr( "When a bool matches the\nstate of another one" ) );
    this->bool2_1bool1Index_box = new QComboBox();
    this->bool2_1bool1Index_box->addItems( cev_api::getSwitchesNames( projectPath )  );
    this->bool2_2comperator_box = new QComboBox();
    this->bool2_2comperator_box->addItem( tr( "not equal to" ) );
    this->bool2_2comperator_box->addItem( tr( "equal to" ) );
    this->bool2_2comperator_box->setCurrentIndex( 1 );
    this->bool2_3bool2Index_box = new QComboBox();
    this->bool2_3bool2Index_box->addItems( cev_api::getSwitchesNames( projectPath )  );

    //var1
    this->var1_0rad = new QRadioButton( tr( "When a variable matches\na const value" ) );
    this->var1_1varIndex_box = new QComboBox();
    this->var1_1varIndex_box->addItems( cev_api::getVariablesNames( projectPath ));
    this->var1_2comperator = new QComboBox();
    this->var1_2comperator->addItem( tr( "not equal to" ) );
    this->var1_2comperator->addItem( tr( "equal to" ) );
    this->var1_2comperator->addItem( tr( "bigger then" ) );
    this->var1_2comperator->addItem( tr( "smaller then" ) );
    this->var1_2comperator->setCurrentIndex( 1 );
    this->var1_3const_value_spinbox = new QSpinBox();
    this->var1_3const_value_spinbox->setMinimum(0);
    this->var1_3const_value_spinbox->setValue( 10 );

    //var2
    this->var2_0rad = new QRadioButton( tr( "When a variable matches\nta other variable's value" ) );
    this->var2_1var1Index_box = new QComboBox();
    this->var2_1var1Index_box->addItems( cev_api::getVariablesNames( projectPath ) );
    this->var2_2comperator_box = new QComboBox();
    this->var2_2comperator_box->addItem( tr( "not equal to" ) );
    this->var2_2comperator_box->addItem( tr( "equal to" ) );
    this->var2_2comperator_box->addItem( tr( "bigger then" ) );
    this->var2_2comperator_box->addItem( tr( "smaller then" ) );
    this->var2_2comperator_box->setCurrentIndex( 1 );
    this->var2_3var2Index_box = new QComboBox();
    this->var2_3var2Index_box->addItems( cev_api::getVariablesNames( projectPath ) );

    //refreshing gui
    this->bool1_0rad->setChecked( true );
    QObject::connect( this->bool2_0rad, SIGNAL(clicked()), this, SLOT(refresh_gui()) );
    QObject::connect( this->bool1_0rad, SIGNAL(clicked()), this, SLOT(refresh_gui()) );
    QObject::connect(  this->var1_0rad, SIGNAL(clicked()), this, SLOT(refresh_gui()) );
    QObject::connect(  this->var2_0rad, SIGNAL(clicked()), this, SLOT(refresh_gui()) );

    this->refresh_gui();

    //layouting
    QGridLayout* l = new QGridLayout();
    l->addWidget( this->bool1_0rad,             0,0,1,1 );
    l->addWidget( this->bool1_1boolIndex_box,   0,1,1,1 );
    l->addWidget( this->bool1_2state,           0,2,1,1 );
    l->addWidget( this->bool2_0rad,             1,0,1,1 );
    l->addWidget( this->bool2_1bool1Index_box,  1,1,1,1 );
    l->addWidget( this->bool2_2comperator_box,  1,2,1,1 );
    l->addWidget( this->bool2_3bool2Index_box,  1,3,1,1 );
    l->addWidget( this->var1_0rad,              2,0,1,1 );
    l->addWidget( this->var1_1varIndex_box,     2,1,1,1 );
    l->addWidget( this->var1_2comperator,       2,2,1,1 );
    l->addWidget( this->var1_3const_value_spinbox,2,3,1,1 );
    l->addWidget( this->var2_0rad,              3,0,1,1 );
    l->addWidget( this->var2_1var1Index_box,    3,1,1,1 );
    l->addWidget( this->var2_2comperator_box,   3,2,1,1 );
    l->addWidget( this->var2_3var2Index_box,    3,3,1,1 );
    l->addWidget( this->btn_cancel,             4,2,1,1 );
    l->addWidget( this->btn_ok,                 4,3,1,1 );

    this->setLayout( l );

    //final connections
    QObject::connect( this->btn_ok, SIGNAL(clicked()), this, SLOT(prepare_data_return()) );
    QObject::connect( this->btn_cancel, SIGNAL(clicked()), this, SLOT(close()) );

    this->setWindowTitle( tr( "Add Existence Condition" ) );
}