コード例 #1
0
void temperatureCalcWindow::startStopPressed()
{
    if( _running )
    {
        _ui->btn_startStop->setText( START );
        _ui->lbl_status->setText( PAUSING );
        _ui->lbl_status->setStyleSheet( STYLE_ERROR );

        emit changeWindowState( this->windowTitle(), false );
    }
    else
    {
        if( _ui->cob_resistance->currentText().isEmpty() )
        {
            return;
        }

        _ui->btn_startStop->setText( STOP );
        _ui->lbl_status->setText( RUNNING );
        _ui->lbl_status->setStyleSheet( STYLE_OK );

        emit changeWindowState( this->windowTitle(), true );
    }

    _running = !_running;
}
コード例 #2
0
void eaps8000UsbUICharWindow::portError( QString error )
{
    LOG(INFO) << this->windowTitle().toStdString() << ": port error: "
              << error.toStdString();
    _ui->lbl_info->setText( error );
    _ui->lbl_info->setStyleSheet( STYLE_ERROR );

    emit newError( this->windowTitle() + ": " + error );
    emit changeWindowState( this->windowTitle(), false );
}
コード例 #3
0
void eaps8000UsbUICharWindow::disconnectPort()
{
    _port.closePort();

    _ui->btn_startStop->setEnabled( false );
    _ui->lbl_status->setText( NOT_CONNECTED );
    _ui->lbl_status->setStyleSheet( STYLE_ERROR );
    _ui->btn_connect->setText( CONNECT_PORT );

    emit changeWindowState( this->windowTitle(), false );
}
コード例 #4
0
ファイル: elflowwindow.cpp プロジェクト: bchjoerni/mlab
void elFlowWindow::emergencyStop()
{
    if( _port.isOpen() )
    {
        _port.setValue( elFlowPort::setValueType::setTypeFlow, 0, false );

        _ui->lbl_info->setText( EMERGENCY_STOP );
        _ui->lbl_info->setStyleSheet( STYLE_ERROR );
        emit changeWindowState( this->windowTitle(), false );
    }
}
コード例 #5
0
ファイル: elflowwindow.cpp プロジェクト: bchjoerni/mlab
void elFlowWindow::disconnectPort()
{
    _port.closePort();

    _ui->btn_setValue->setEnabled( false );
    _ui->lbl_status->setText( NOT_CONNECTED );
    _ui->lbl_status->setStyleSheet( STYLE_ERROR );
    _ui->btn_connect->setText( CONNECT_PORT );
    _ui->lbl_setValueSet->setText( "-" );

    emit changeWindowState( this->windowTitle(), false );
}
コード例 #6
0
void temperatureCalcWindow::mLabSignal( char signal, const QString& cmd )
{
    if( signal == SIGNAL_SHUTDOWN )
    {
        if( _running )
        {
            _running = false;
            _ui->lbl_status->setText( EMERGENCY_STOP );
            _ui->lbl_status->setStyleSheet( STYLE_ERROR );
            emit changeWindowState( this->windowTitle(), false );
        }
    }
    else if( signal == SIGNAL_STOP )
    {
        if( _running )
        {
            _running = false;
            _ui->lbl_status->setText( STOP_RECEIVED );
            _ui->lbl_status->setStyleSheet( STYLE_ERROR );
            emit changeWindowState( this->windowTitle(), false );
        }
    }
}
コード例 #7
0
ファイル: eaps8000usbwindow.cpp プロジェクト: bchjoerni/mlab
void eaps8000UsbWindow::initFinished( const QString &idString )
{
    LOG(INFO) << this->windowTitle().toStdString() << ": init finished, id: "
              << idString.toStdString();
    _ui->lbl_info->setText( idString );

    _ui->btn_setValue->setEnabled( true );
    _ui->lbl_status->setText( CONNECTED );
    _ui->lbl_status->setStyleSheet( STYLE_OK );
    _ui->btn_connect->setText( DISCONNECT_PORT );

    emit changeWindowState( this->windowTitle(), true );
    updateUnitRange();
}
コード例 #8
0
ファイル: eaps8000usbwindow.cpp プロジェクト: bchjoerni/mlab
void eaps8000UsbWindow::emergencyStop()
{
    if( _port.isOpen() )
    {
        _port.setValue( eaps8000UsbPort::setValueType::setTypeVoltage, 0.0,
                        false );
        _port.setValue( eaps8000UsbPort::setValueType::setTypeCurrent, 0.0,
                        false );

        _ui->lbl_info->setText( EMERGENCY_STOP );
        _ui->lbl_info->setStyleSheet( STYLE_ERROR );
        emit changeWindowState( this->windowTitle(), false );
    }
}
コード例 #9
0
ファイル: pairsavewindow.cpp プロジェクト: bchjoerni/mlab
void pairSaveWindow::startStopPressed()
{
    bool start = (_ui->btn_startStop->text() == START_RECORDING);

    if( start )
    {
        if( _dataRecorded )
        {
            if( QMessageBox::warning( this, "Warning", "Old data will be "
                                      "overwritten!\nContinue?",
                                      QMessageBox::StandardButtons(
                                          QMessageBox::Yes | QMessageBox::No ),
                                      QMessageBox::StandardButton::No )
                    == QMessageBox::StandardButton::No )
            {
                return;
            }
        }

        _fileStream.open( _fileName.toStdString().c_str(), std::ios_base::out );
        if( !_fileStream.is_open() )
        {
            _ui->lbl_status->setText( "ERROR!" );
            _ui->lbl_status->setStyleSheet( STYLE_ERROR );
            emit newError( this->windowTitle() + ": unable to open file!" );
            return;
        }
        _fileStream.close();
        _ui->lbl_status->setText( RECORDING );
        _ui->lbl_status->setStyleSheet( STYLE_OK );
        _ui->btn_startStop->setText( STOP_RECORDING );
    }
    else
    {
        _ui->btn_startStop->setText( START_RECORDING );
        _ui->lbl_status->setText( PAUSING );
        _ui->lbl_status->setStyleSheet( STYLE_ERROR );
    }

    _ui->btn_selectFile->setEnabled( !start );
    _ui->cob_delimiter->setEnabled( !start );
    _ui->cob_x->setEnabled( !start );
    _ui->cob_y->setEnabled( !start );

    _intervalCounter = 0;
    _recording = start;

    emit changeWindowState( this->windowTitle(), start );
}
コード例 #10
0
ファイル: elflowwindow.cpp プロジェクト: bchjoerni/mlab
void elFlowWindow::mLabSignal( char signal, const QString& cmd )
{
    if( signal == SIGNAL_SHUTDOWN )
    {
        emergencyStop();
    }
    else if( signal == SIGNAL_STOP && _port.isOpen() )
    {
        _port.setValue( elFlowPort::setValueType::setTypeFlow, 0, false );

        _ui->lbl_info->setText( STOP_RECEIVED );
        _ui->lbl_info->setStyleSheet( STYLE_ERROR );
        emit changeWindowState( this->windowTitle(), false );
    }
}
コード例 #11
0
void eaps8000UsbUICharWindow::startStop()
{
    calculateRemainingTicks();
    bool started = (_ui->btn_startStop->text() == START);

    _increasing = (_ui->dsb_fromValue->value() <= _ui->dsb_toValue->value());

    _ui->btn_startStop->setText( started ? STOP : START );
    _running = started;
    _tickCounter = 0;
    _loopCounter = 0;
    _ui->frame_setValues->setEnabled( !started );
    _setUiValue = _ui->dsb_fromValue->value() +
            (_increasing ? -1 : 1)*_ui->dsb_stepSize->value();
    _lastMeasuredValue = _setUiValue;

    emit changeWindowState( this->windowTitle(), started );
}
コード例 #12
0
void eaps8000UsbUICharWindow::emergencyStop()
{
    _running = false;
    _tickCounter = 0;
    _ui->frame_setValues->setEnabled( true );
    _ui->btn_startStop->setText( START );
    calculateRemainingTicks();

    if( _port.isOpen() )
    {
        _port.setValue( eaps8000UsbPort::setValueType::setTypeVoltage,
                                0.0, false );
        _port.setValue( eaps8000UsbPort::setValueType::setTypeCurrent,
                                0.0, false );
    }

    _ui->lbl_info->setText( EMERGENCY_STOP );
    _ui->lbl_info->setStyleSheet( STYLE_ERROR );
    emit changeWindowState( this->windowTitle(), false );
}
コード例 #13
0
void eaps8000UsbUICharWindow::resetInfo()
{
    _port.clearPortErrors();

    if( _port.isRunning() )
    {
        _ui->lbl_info->setText( _port.idString() );
        _ui->lbl_info->setStyleSheet( "" );
        _ui->btn_connect->setText( DISCONNECT_PORT );
        _ui->btn_connect->setEnabled( true );

        emit changeWindowState( this->windowTitle(), true );
    }
    else
    {
        _ui->lbl_info->setText( "-" );
        _ui->lbl_info->setStyleSheet( "" );
        _ui->btn_connect->setText( CONNECT_PORT );
        refreshPortList();
    }
}
コード例 #14
0
ファイル: pairsavewindow.cpp プロジェクト: bchjoerni/mlab
void pairSaveWindow::mLabSignal( char signal, const QString& cmd )
{    
    if( signal == SIGNAL_SHUTDOWN
            || (signal == SIGNAL_STOP &&
                _ui->chb_setZeroAtStopSignal->isChecked()) )
    {
        if( _recording )
        {
            _recording = false;
            _ui->btn_startStop->setText( START_RECORDING );
            _ui->lbl_status->setText( signal == SIGNAL_SHUTDOWN ?
                                          EMERGENCY_STOP : STOP_RECEIVED );
            _ui->lbl_status->setStyleSheet( STYLE_ERROR );
            _ui->btn_selectFile->setEnabled( true );
            _ui->cob_delimiter->setEnabled( true );
            _ui->cob_x->setEnabled( true );
            _ui->cob_y->setEnabled( true );
            _intervalCounter = 0;
            emit changeWindowState( this->windowTitle(), false );
        }
    }
    else if( signal == 10 )
    {
        if( _ui->btn_startStop->text() == STOP_RECORDING )
        {
            startStopPressed();
        }
    }
    else if( signal == 11 )
    {
        if( _ui->btn_startStop->text() == START_RECORDING )
        {
            startStopPressed();
        }
    }
    else if( signal == 19 )
    {
        resetCounter();
    }
}
コード例 #15
0
static void
sessionHandleEvent (CompDisplay *d,
		    XEvent      *event)
{
    CompWindow   *w;
    unsigned int state;

    SESSION_DISPLAY (d);

    w = NULL;
    state = 0;

    switch (event->type) {
    case MapRequest:
	w = findWindowAtDisplay (d, event->xmaprequest.window);
	if (w)
	{
	    state = w->state;
	    if (!sessionReadWindow (w))
		w = NULL;
	}
	break;
    }

    UNWRAP (sd, d, handleEvent);
    (*d->handleEvent) (d, event);
    WRAP (sd, d, handleEvent, sessionHandleEvent);

    switch (event->type) {
    case MapRequest:
	if (w && !(state & CompWindowStateDemandsAttentionMask))
	{
	    state = w->state & ~CompWindowStateDemandsAttentionMask;
	    changeWindowState (w, state);
	}
	break;
    }
}
コード例 #16
0
ファイル: group-group.c プロジェクト: noodlylight/fusilli
/*
 * groupShadeWindows
 *
 */
static void
groupShadeWindows (CompWindow     *top,
                   GroupSelection *group,
                   Bool           shade)
{
	int i;
	unsigned int state;

	for (i = 0; i < group->nWins; i++)
	{
		CompWindow *w = group->windows[i];
		if (w->id == top->id)
			continue;

		if (shade)
			state = w->state | CompWindowStateShadedMask;
		else
			state = w->state & ~CompWindowStateShadedMask;

		changeWindowState (w, state);
		updateWindowAttributes (w, CompStackingUpdateModeNone);
	}
}
コード例 #17
0
ファイル: winrules.c プロジェクト: noodlylight/fusilli
static void
winrulesUpdateState (CompWindow *w,
                     CompMatch  *match,
                     int        mask)
{
	unsigned int newState = w->state;

	WINRULES_WINDOW (w);

	if (!isWinrulesWindow (w))
		return;

	if (matchEval (match, w))
	{
		newState |= mask;
		newState = constrainWindowState (newState, w->actions);
		ww->stateSetMask |= (newState & mask);
	}
	else if (ww->stateSetMask & mask)
	{
		newState &= ~mask;
		ww->stateSetMask &= ~mask;
	}

	if (newState != w->state)
	{
		changeWindowState (w, newState);

		if (mask & (CompWindowStateFullscreenMask |
		            CompWindowStateAboveMask      |
		            CompWindowStateBelowMask       ))
			updateWindowAttributes (w, CompStackingUpdateModeNormal);
		else
			updateWindowAttributes (w, CompStackingUpdateModeNone);
	}
}
コード例 #18
0
void eaps8000UsbUICharWindow::uiCharFinished()
{
    _running = false;
    _tickCounter = 0;
    _ui->frame_setValues->setEnabled( true );
    _ui->btn_startStop->setText( START );
    calculateRemainingTicks();

    if( _ui->chb_setZeroWhenFinished->isChecked() && _port.isOpen() )
    {
        if( _ui->cob_setValue->currentText() == VOLTAGE )
        {
            _port.setValue( eaps8000UsbPort::setValueType::setTypeVoltage,
                            0.0, false );
        }
        else if( _ui->cob_setValue->currentText() == CURRENT )
        {
            _port.setValue( eaps8000UsbPort::setValueType::setTypeCurrent,
                            0.0, false );
        }
    }

    emit changeWindowState( this->windowTitle(), false );
}
コード例 #19
0
void EscapeDialog::handleFullScreenCheckBoxStateChange(int state)
{
    emit changeWindowState(state);
}
コード例 #20
0
ファイル: eaps8000usbwindow.cpp プロジェクト: bchjoerni/mlab
void eaps8000UsbWindow::mLabSignal( char signal, const QString& cmd )
{
    if( signal == SIGNAL_SHUTDOWN )
    {
        emergencyStop();
    }
    else if( signal == SIGNAL_STOP )
    {
        if( _ui->chb_setZeroAtStopSignal->isChecked()
                && _port.isOpen() )
        {
            _port.setValue( eaps8000UsbPort::setValueType::setTypeVoltage, 0.0,
                            false );
            _port.setValue( eaps8000UsbPort::setValueType::setTypeCurrent, 0.0,
                            false );

            _ui->lbl_info->setText( STOP_RECEIVED );
            _ui->lbl_info->setStyleSheet( STYLE_ERROR );
            emit changeWindowState( this->windowTitle(), false );
        }
    }
    else if( signal == 12 )
    {
        if( _ui->btn_connect->text() == CONNECT_PORT )
        {
            connectPort();
        }
    }
    else if( signal == 13 )
    {
        if( _ui->btn_connect->text() == DISCONNECT_PORT )
        {
            disconnectPort();
        }
    }
    else if( signal == 18
             || signal == 19 )
    {
        resetInfo();
    }
    else if( signal == 30 )
    {
        if( _port.isRunning() )
        {
            _ui->dsp_setValue->setValue( 0.0 );
            _ui->chb_adjustSetValue->setChecked( false );
            _port.setValue( eaps8000UsbPort::setValueType::setTypeVoltage,
                            0.0, false );
            _port.setValue( eaps8000UsbPort::setValueType::setTypeCurrent,
                            0.0, false );
        }
    }
    else if( signal >= 31
             && signal <= 39 )
    {
        if( !_port.isRunning() )
        {
            return;
        }
        if( cmd.at( 0 ) != 'a'
                && cmd.at( 0 ) != 'n' )
        {
            return;
        }
        bool adjustValue = false;
        if( cmd.at( 0 ) == 'a' )
        {
            adjustValue = true;
        }
        bool convOk = false;
        double value = cmd.mid( 1 ).toDouble( &convOk );
        if( !convOk )
        {
            return;
        }

        QString type;
        QString unit;
        if( signal == 31 )
        {
            type = VOLTAGE;
            unit = UNIT_VOLT;
        }
        else if( signal == 32 )
        {
            type = CURRENT;
            unit = UNIT_AMPERE;
        }
        else if( signal == 33 )
        {
            type = POWER;
            unit = UNIT_WATT;
        }
        else if( signal == 34 )
        {
            type = POWER_BY_VOLTAGE;
            unit = UNIT_WATT;
        }
        else if( signal == 35 )
        {
            type == POWER_BY_CURRENT;
            unit = UNIT_WATT;
        }
        else if( signal == 36 )
        {
            type == RESISTANCE_BY_VOLTAGE;
            unit = UNIT_OHM;
        }
        else if( signal == 37 )
        {
            type == RESISTANCE_BY_CURRENT;
            unit = UNIT_OHM;
        }
        else if( signal == 38 )
        {
            type = _ui->cob_setValue->currentText();
            unit = _ui->cob_setValueUnit->currentText();
            value += _ui->dsp_setValue->value();
        }
        else if( signal == 39 )
        {
            type = _ui->cob_setValue->currentText();
            unit = _ui->cob_setValueUnit->currentText();
            value *= _ui->dsp_setValue->value();
        }

        int indexType = _ui->cob_setValue->findText( type );
        int indexUnit = _ui->cob_setValue->findText( unit );
        if( indexType == -1
                || indexUnit == -1 )
        {
            return;
        }
        _ui->dsp_setValue->setValue( value );
        _ui->cob_setValue->setCurrentIndex( indexType );
        _ui->cob_setValueUnit->setCurrentIndex( indexUnit );
        _ui->chb_adjustSetValue->setChecked( adjustValue );
        setValue();
    }
}
コード例 #21
0
static Bool
sessionReadWindow (CompWindow *w)
{
    CompDisplay        *d = w->screen->display;
    XWindowChanges     xwc;
    unsigned int       xwcm = 0;
    char               *title, *role, *clientId, *command;
    SessionWindowList  *cur;

    SESSION_CORE (&core);
    SESSION_DISPLAY (d);

    /* optimization: don't mess around with getting X properties
       if there is nothing to match */
    if (!sc->windowList)
	return FALSE;

    if (!isSessionWindow (w))
	return FALSE;

    clientId = sessionGetClientLeaderProperty (w, sd->clientIdAtom);
    if (!clientId && !sd->opt[SESSION_DISPLAY_OPTION_SAVE_LEGACY].value.b)
	return FALSE;

    command  = sessionGetClientLeaderProperty (w, sd->commandAtom);
    title    = sessionGetWindowTitle (w);
    role     = sessionGetTextProperty (d, w->id, sd->roleAtom);

    for (cur = sc->windowList; cur; cur = cur->next)
    {
	if (clientId && cur->clientId && strcmp (clientId, cur->clientId) == 0)
	{
	    /* try to match role as well if possible (see ICCCM 5.1) */
	    if (role && cur->role)
	    {
		if (strcmp (role, cur->role) == 0)
		    break;
	    }
	    else
	    {
		if (sessionMatchWindowClass (w, cur))
		    break;
	    }
	}
	else if (sd->opt[SESSION_DISPLAY_OPTION_SAVE_LEGACY].value.b)
	{
	    if (cur->command && command && sessionMatchWindowClass (w, cur))
	    {
		/* match by command, class and name as second try */
		break;
	    }
	    else if (title && cur->title && strcmp (title, cur->title) == 0)
	    {
		/* last resort: match by window title */
		break;
	    }
	}
    }

    if (clientId)
	free (clientId);
    if (command)
	free (command);
    if (title)
	free (title);
    if (role)
	free (role);

    if (!cur)
	return FALSE;

    /* found a window */

    changeWindowState (w, (w->state & ~SAVED_WINDOW_STATE) | cur->state);

    if (cur->geometryValid)
    {
	xwcm = CWX | CWY;

	xwc.x = cur->geometry.x + w->input.left;
	xwc.y = cur->geometry.y + w->input.top;

	if (!sessionWindowIsOnAllViewports (w))
	{
	    xwc.x -= (w->screen->x * w->screen->width);
	    xwc.y -= (w->screen->y * w->screen->height);
	}

	if (cur->geometry.width != w->serverWidth)
	{
	    xwc.width = cur->geometry.width;
	    xwcm |= CWWidth;
	}
	if (cur->geometry.height != w->serverHeight)
	{
	    xwc.height = cur->geometry.height;
	    xwcm |= CWHeight;
	}

	if (w->mapNum && (xwcm & (CWWidth | CWHeight)))
	    sendSyncRequest (w);

	configureXWindow (w, xwcm, &xwc);
	w->placed = TRUE;
    }

    if (cur->minimized)
	minimizeWindow (w);

    if (cur->workspace != -1)
	setDesktopForWindow (w, cur->workspace);

    updateWindowAttributes (w, CompStackingUpdateModeNone);

    /* remove item from list */
    sessionRemoveWindowListItem (cur);

    return TRUE;
}