Ejemplo n.º 1
0
void ToolBox::buttonCallback ( int buttonIndex, Vrui::InputDevice::ButtonCallbackData* cbData )
{
	updateDeviceTransformations ( ) ;
	int deviceIndex = 0;
	ButtonId button ( deviceIndex, buttonIndex ) ;
	if ( cbData -> newButtonState )
	{
		ButtonPressEvent buttonPressEvent ( this, currentTool ( ), button ) ;
		tellExtensions ( & Extension::buttonPressed, buttonPressEvent ) ;
		if ( currentTool ( ) ) {
			// In case an extension modified ToolBox state:
			buttonPressEvent . tool = currentTool ( ) ;

			if ( button == mainButton ( ) )
				currentTool ( ) -> mainButtonPressed ( buttonPressEvent ) ;
			else
				currentTool ( ) -> otherButtonPressed ( buttonPressEvent ) ;
		}
	}
	else
	{
		ButtonReleaseEvent buttonReleaseEvent ( this, currentTool ( ), button ) ;
		tellExtensions ( & Extension::buttonReleased, buttonReleaseEvent ) ;
		if ( currentTool ( ) ) {
			// In case an extension modified ToolBox state:
			buttonReleaseEvent . tool = currentTool ( ) ;

			if ( button == mainButton ( ) )
				currentTool ( ) -> mainButtonReleased ( buttonReleaseEvent ) ;
			else
				currentTool ( ) -> otherButtonReleased ( buttonReleaseEvent ) ;
		}
	}
}
Ejemplo n.º 2
0
TouchScreen::TouchScreen(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::TouchScreen)
{
    mainSystem = new LaserSystem(this);

    ui->setupUi(this);

    //Setup slots for widgets
    connect(mainSystem, SIGNAL(EDFAEmission(bool)), this, SLOT(EDFAEmissionLight(bool)));
    connect(mainSystem, SIGNAL(laserEmission(bool)), this, SLOT(laserEmissionLight(bool)));
    connect(mainSystem, SIGNAL(systemEmission(bool)), this, SLOT(mainButtonState(bool)));

    connect(ui->EDFAOn, SIGNAL(pressed()), this, SLOT(EDFAOnOff()));
    connect(ui->EDFAOff, SIGNAL(pressed()), this, SLOT(EDFAOnOff()));


    connect(ui->TurnOnBtn, SIGNAL(pressed()), this, SLOT(mainButton()));
    connect(ui->TurnOffBtn, SIGNAL(pressed()), this, SLOT(mainButton()));

    connect(ui->LaserQuestOff, SIGNAL(pressed()), this, SLOT(laserOnOff()));
    connect(ui->LaserQuestOn, SIGNAL(pressed()), this, SLOT(laserOnOff()));

    //Connects a system wavelength update to a slot which updates the text in the UI.
    connect(mainSystem, SIGNAL(laserWavelengthUpdate(float)), this, SLOT(updateWavelength(float)));

    //Updates all of the variables in the system.
    mainSystem -> updateSystemState();

    ui->wavelengthSb->setValue(mainSystem->getWavelength(false)); //This probably isnt needed as wavelength should be automatically updated.
    connect(ui->wavelengthSb, SIGNAL(editingFinished()), this, SLOT(setNewWavelength()));

    //Not yet implimented
    ui->StableOff->show();
    ui->StableOn->hide();

    //Change these timers so that all of the system variables are checked at intervals
    QTimer *wavelengthTimer = new QTimer(this);
    connect(wavelengthTimer, SIGNAL(timeout()),this, SLOT(wavelength = ui->hsWavelength->value()));

    //Setup similar system to origional interface where the button type is automatically updated uing signals.

    //Update timer. Every second, system variables will be checked to update the UI to the current settings.
    timer = new QTimer(this);
    connect(timer, SIGNAL(timeout()),mainSystem,SLOT(updateSystemState()));
    timer->start(1000);
}