Exemplo n.º 1
0
void DlgSettingsPointMatch::load (CmdMediator &cmdMediator)
{
  LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsPointMatch::load";

  setCmdMediator (cmdMediator);

  // Flush old data
  if (m_modelPointMatchBefore != 0) {
    delete m_modelPointMatchBefore;
  }
  if (m_modelPointMatchAfter != 0) {
    delete m_modelPointMatchAfter;
  }

  // Save new data
  m_modelPointMatchBefore = new DocumentModelPointMatch (cmdMediator.document());
  m_modelPointMatchAfter = new DocumentModelPointMatch (cmdMediator.document());

  // Sanity checks. Incoming defaults must be acceptable to the local limits
  ENGAUGE_ASSERT (POINT_SEPARATION_MIN <= m_modelPointMatchAfter->minPointSeparation());
  ENGAUGE_ASSERT (POINT_SEPARATION_MAX > m_modelPointMatchAfter->minPointSeparation());
  ENGAUGE_ASSERT (POINT_SIZE_MIN <= m_modelPointMatchAfter->maxPointSize());
  ENGAUGE_ASSERT (POINT_SIZE_MAX > m_modelPointMatchAfter->maxPointSize());

  // Populate controls
  m_spinMinPointSeparation->setValue(m_modelPointMatchAfter->minPointSeparation());
  m_spinPointSize->setValue(m_modelPointMatchAfter->maxPointSize());

  int indexAccepted = m_cmbAcceptedPointColor->findData(QVariant(m_modelPointMatchAfter->paletteColorAccepted()));
  ENGAUGE_ASSERT (indexAccepted >= 0);
  m_cmbAcceptedPointColor->setCurrentIndex(indexAccepted);

  int indexCandidate = m_cmbCandidatePointColor->findData(QVariant(m_modelPointMatchAfter->paletteColorCandidate()));
  ENGAUGE_ASSERT (indexCandidate >= 0);
  m_cmbCandidatePointColor->setCurrentIndex(indexCandidate);

  int indexRejected = m_cmbRejectedPointColor->findData(QVariant(m_modelPointMatchAfter->paletteColorRejected()));
  ENGAUGE_ASSERT (indexRejected >= 0);
  m_cmbRejectedPointColor->setCurrentIndex(indexRejected);

  initializeBox ();

  // Fix the preview size using an invisible boundary
  QGraphicsRectItem *boundary = m_scenePreview->addRect (QRect (0,
                                                                0,
                                                                cmdMediator.document().pixmap().width (),
                                                                cmdMediator.document().pixmap().height ()));
  boundary->setVisible (false);

  m_scenePreview->addPixmap (cmdMediator.document().pixmap());

  updateControls();
  enableOk (false); // Disable Ok button since there not yet any changes
  updatePreview();
}
Exemplo n.º 2
0
void setup() {
#ifdef DEBUG
  Serial.begin(9600);
#endif

  initializeBox();
  delay(COMM_INIT_DELAY);

  logMsg(String("\n\nConnecting to ") + SSID);  
  WiFi.begin(SSID, PASS);
  
  while (WiFi.status() != WL_CONNECTED) {
    delay(COMM_CONNECT_DELAY);    
  }  
  logMsg("WiFi connected");
  
  // Start the server
  server.begin();
  logMsg(String("Server started at ") + WiFi.localIP().toString());
}