void InstrumentWidgetMaskTab::showEvent(QShowEvent *) {
  setActivity();
  m_instrWidget->setMouseTracking(true);
  enableApplyButtons();
  m_instrWidget->updateInstrumentView(true);
  m_instrWidget->getSurface()->changeBorderColor(getShapeBorderColor());
}
/**
  * Initialize the tab when new projection surface is created.
  */
void InstrumentWindowMaskTab::initSurface()
{
  connect(m_instrWindow->getSurface().get(),SIGNAL(shapeCreated()),this,SLOT(shapeCreated()));
  connect(m_instrWindow->getSurface().get(),SIGNAL(shapeSelected()),this,SLOT(shapeSelected()));
  connect(m_instrWindow->getSurface().get(),SIGNAL(shapesDeselected()),this,SLOT(shapesDeselected()));
  connect(m_instrWindow->getSurface().get(),SIGNAL(shapeChanged()),this,SLOT(shapeChanged()));
  connect(m_instrWindow->getSurface().get(),SIGNAL(shapesCleared()),this,SLOT(shapesCleared()));
  enableApplyButtons();
}
void mdtSerialPortSetupDialog::on_buttonBox_clicked(QAbstractButton *button)
{
  Q_ASSERT(pvPortManager != 0);
  Q_ASSERT(button != 0);

  QDialogButtonBox::StandardButton type;

  type = buttonBox->standardButton(button);
  if((type == QDialogButtonBox::Apply)||(type == QDialogButtonBox::Ok)){
    diseableApplyButtons();
    // Close port
    lbState->setText(tr("Stopping ..."));
    pvPortManager->closePort();
    // Get current config
    updateConfig();
    // Open the port
    if(!pvPortManager->setPortName(cbPort->currentText())){
      setStateError(tr("Cannot fetch port attributes"));
      enableApplyButtons();
      return;
    }
    if(!pvPortManager->openPort()){
      setStateError(tr("Cannot open port"));
      enableApplyButtons();
      return;
    }
    // Start R/W
    lbState->setText(tr("Starting ..."));
    if(!pvPortManager->start()){
      setStateError(tr("Cannot start threads"));
      enableApplyButtons();
      return;
    }
    setStateRunning();
    enableApplyButtons();
  }
}
/**
  * Slot responding on removing all masking shapes.
  */
void InstrumentWindowMaskTab::shapesCleared()
{
    enableApplyButtons();
}
/**
  * Slot responding on creation of a new masking shape.
  */
void InstrumentWindowMaskTab::shapeCreated()
{
  setSelectActivity();
  enableApplyButtons();
}