Ejemplo n.º 1
0
void JoyControlStick::reset()
{
    deadZone = 8000;
    maxZone = JoyAxis::AXISMAXZONE;
    diagonalRange = 45;
    isActive = false;

    /*if (activeButton1)
    {
        activeButton1->reset();
    }
    activeButton1 = 0;

    if (activeButton2)
    {
        activeButton2->reset();
    }

    activeButton2 = 0;*/

    activeButton1 = 0;
    activeButton2 = 0;
    activeButton3 = 0;
    safezone = false;
    currentDirection = StickCentered;
    currentMode = StandardMode;
    stickName.clear();
    resetButtons();
}
Ejemplo n.º 2
0
GroupWidget::GroupWidget(QList <Group*> *group, QWidget *parent)
    : QWidget(parent), groupList(group)
{
    QHBoxLayout *h1 = new QHBoxLayout();

    {
        QLabel *l = new QLabel(tr("Group: "));
        addGroupEdit = new QLineEdit(this);
        connect(addGroupEdit, SIGNAL(editingFinished()), SLOT(createGroup()));
        addButton = new QPushButton(tr("Create"), this);
        connect(addGroupEdit, SIGNAL(textChanged(QString)),
                SLOT(changeAddGroup(QString)));
        connect(addButton, SIGNAL(clicked()), SLOT(createGroup()));
        addButton->setEnabled(false);
        h1->addWidget(l);
        h1->addWidget(addGroupEdit);
        h1->addWidget(addButton);
    }
    QHBoxLayout *h2 = new QHBoxLayout();
    {
        h2->setMargin(0);
        upButton = new QPushButton(this);
        upButton->setIcon(QIcon(":images/uparrow.png"));
        downButton = new QPushButton(this);
        downButton->setIcon(QIcon(":images/downarrow.png"));
        h2->addStretch();
        h2->addWidget(upButton);
        h2->addWidget(downButton);
        editButton = new QPushButton(this);
        editButton->setIcon(QIcon(":images/edit.png"));
        h2->addWidget(editButton);
        delButton = new QPushButton(this);
        delButton->setIcon(QIcon(":images/delete.png"));
        h2->addWidget(delButton);
    }
    groupListWidget = new QListWidget(this);
    QVBoxLayout *v = new QVBoxLayout;
    v->setMargin(0);
    v->setSpacing(0);
    v->addLayout(h1);
    v->addWidget(groupListWidget);
    v->addLayout(h2);
    setLayout(v);
    //qDebug() << "BookWidget 3";
    connect(upButton, SIGNAL(clicked()), SLOT(upItem()));
    connect(downButton, SIGNAL(clicked()), SLOT(downItem()));
    connect(editButton, SIGNAL(clicked()), SLOT(editItem()));
    connect(delButton, SIGNAL(clicked()), SLOT(delItem()));
    connect(groupListWidget, SIGNAL(currentRowChanged(int)),
            SLOT(changeRow(int)));
    connect(groupListWidget, SIGNAL(itemChanged(QListWidgetItem*)),
            SLOT(changeName(QListWidgetItem*)));
    connect(groupListWidget, SIGNAL(itemDoubleClicked(QListWidgetItem*)),
            SLOT(editItem(QListWidgetItem*)));
    connect(groupListWidget,
            SIGNAL(currentItemChanged(QListWidgetItem *, QListWidgetItem*)),
            SLOT(changeSelect(QListWidgetItem *, QListWidgetItem*)));
    initGroup();
    resetButtons();
}
Ejemplo n.º 3
0
void imagesequence::stopSequence()
{
 
  retries              = 0;
  seqTotalCount        = 0;
  seqCurrentCount      = 0;
  active               = false;
  
  imgProgress->setEnabled(false);
  fullImgCountOUT->setText("");
  currentImgCountOUT->setText("");
  
  resetButtons();
  seqTimer->stop();
  
  if (stdDevCCD)
  {
    stdDevCCD->seqCount     = 0;
    stdDevCCD->batchMode    = false;
    stdDevCCD->ISOMode      = false;
    
    stdDevCCD->disconnect( SIGNAL(FITSReceived(QString)));
  }

}
Ejemplo n.º 4
0
SettingsPageScreenSaver::SettingsPageScreenSaver(QWidget* parent) : FullScreenWidget(parent)
{
    qDebug() << Q_FUNC_INFO;
    setupUi(this);

    connect(backBtn,                SIGNAL(clicked()), this, SIGNAL(hideMe()));
    connect(screenSaverDefaultBtn,  SIGNAL(clicked()), this, SLOT(handleScreenSaverDefault()));
    connect(imageRecentBookBtn,     SIGNAL(clicked()), this, SLOT(handleImageRecentBook()));
    connect(storedImagesBtn,        SIGNAL(clicked()), this, SLOT(handleStoredImages()));

    resetButtons();
    switch(QBook::settings().value("setting/screensaver", QBookScreenSaver::BOOK_COVER).toInt()){
    case QBookScreenSaver::DEFAULT_IMAGE:
        setBtnChecked(screenSaverDefaultBtn, true);
        break;
    case QBookScreenSaver::BOOK_COVER:
        setBtnChecked(imageRecentBookBtn, true);
        break;
    case QBookScreenSaver::STORED_IMAGES:
        setBtnChecked(storedImagesBtn, true);
        break;
    default:
        qWarning() << Q_FUNC_INFO << "Unexpected setting";
    }

}
void ECCalibrateScreen::drawScreen()
{
	//Clear What was there.
	myUTFT.clrScr();
	myUTFT.setBackColor(0, 0, 255);
	resetButtons();
	myButtons.setButtonColors(VGA_WHITE, VGA_GRAY, VGA_BLACK, VGA_RED, VGA_BLUE);


	resetButton = myButtons.addButton( 10, 10, MAIN_BUTTON_X, MAIN_BUTTON_Y, mainButton);
	infoButton = myButtons.addButton( 160, 10, MAIN_BUTTON_X, MAIN_BUTTON_Y, mainButton);
	readButton = myButtons.addButton( 10, 64, MAIN_BUTTON_X, MAIN_BUTTON_Y, mainButton);
	tempReadButton = myButtons.addButton( 160, 64, MAIN_BUTTON_X, MAIN_BUTTON_Y, mainButton);
	stopButton = myButtons.addButton( 10, 116, MAIN_BUTTON_X, MAIN_BUTTON_Y, mainButton);
	startButton = myButtons.addButton( 160, 116, MAIN_BUTTON_X, MAIN_BUTTON_Y, mainButton);
	backButton = myButtons.addButton( 10, 170, MAIN_BUTTON_X, MAIN_BUTTON_Y, mainButton);
	calibrateButton = myButtons.addButton( 160, 170, MAIN_BUTTON_X, MAIN_BUTTON_Y, mainButton);

	myButtons.drawButtons();

	//Add text to buttons.
	myUTFT.setBackColor (161,190,237);
	myUTFT.print("Reset", 55, 30);
	myUTFT.print("Info", 190, 30);
	myUTFT.print("Read", 55, 90);
	myUTFT.print("TRead", 190, 90);
	myUTFT.print("Stop", 55, 146);
	myUTFT.print("Start", 190, 146);
	myUTFT.print("Back", 55, 195);
	myUTFT.print("Calibrate", 185, 195);
}
Ejemplo n.º 6
0
void Focus::startFocus()
{
    lastFocusDirection = FOCUS_NONE;

    HFR = 0;

    if (canAbsMove)
    {
        absIterations = 0;
        getAbsFocusPosition();
        //pulseDuration = (absMotionMax - absMotionMin) * 0.05;
        pulseDuration = stepIN->value();
    }
    else
      /* Start 1000 ms */
      pulseDuration=1000;

    capture();

    inAutoFocus = true;

    resetButtons();

    reverseDir = false;

    qDeleteAll(HFRPoints);
    HFRPoints.clear();

    Options::setFocusTicks(stepIN->value());
    Options::setFocusTolerance(toleranceIN->value());
    Options::setFocusExposure(exposureIN->value());

    appendLogText(i18n("Autofocus in progress..."));
}
Ejemplo n.º 7
0
void HangmanWidget::newGame()
{
   Word = RandomWord(Dict);
   Title->setText(L"Guess the word, " + User + L"!");
   NewGameButton->hide(); // don't let the player chicken out

   // Bring widget to initial state
   resetImages();
   resetButtons();
   BadGuesses = DisplayedLetters = 0;
   HangmanImages[0]->show();

   // Prepare the widgets for the new word
   WordContainer->clear();
   WordLetters.clear();
   for(unsigned int i = 0; i < Word.size(); ++i) {
      WText *c = new WText(L"-", WordContainer);
      WordLetters.push_back(c);
   }

   // resize appropriately so that the border nooks nice.
   WordContainer->resize(WLength(Word.size() * 1.5, WLength::FontEx),
			 WLength());

   StatusText->setText(L"");
}
Ejemplo n.º 8
0
void GameOfLight::begin() {
  #if defined(GameOfLightHW)
    Serial.begin(500000);  //DEBUG
    // Initialize the communication with the display controller
    SPI.begin();
    SPI.setClockDivider(SPI_CLOCK_DIV8);
    pinMode(SCREEN_SS_PIN, OUTPUT);
    pinMode(controller[0], INPUT);
    pinMode(controller[1], INPUT);
    pinMode(controller[2], INPUT);
    pinMode(controller[3], INPUT);
    pinMode(SNES_CLK_PIN, OUTPUT);
    pinMode(SNES_LATCH_PIN, OUTPUT);
    digitalWrite(SCREEN_SS_PIN, HIGH);
    digitalWrite(SCREEN_SS_PIN, LOW);
    clearDisplay();
    controller[0] = 4;
    controller[1] = 5;
    controller[2] = 2;
    controller[3] = 3; //pins on Arduino where the SNES-controller data pins are connected
    MsTimer2::set(1, btnCallBack); //Autotriggering of the getButton-routine every 1ms    
    Serial.println("HW");  //DEBUG
  #else
    Serial.begin(500000);
    MsTimer2::set(15, btnCallBack);
    btnRequestSent = 0;
    Serial.println("Sim"); //DEBUG
  #endif

  _screen_line = 0;
  _screen_index = 0;
  resetButtons();
  setFont(FONT_5x7);
  MsTimer2::start();
}
Ejemplo n.º 9
0
void imagesequence::newFITS(QString deviceLabel)
{
  // If the FITS is not for our device, simply ignore
  if (deviceLabel != currentCCD)
   return;

  seqCurrentCount++;
  imgProgress->setProgress(seqCurrentCount);
  
  currentImgCountOUT->setText( QString("%1").arg(seqCurrentCount));
  
  // if we're done
  if (seqCurrentCount == seqTotalCount)
  {
    stdDevCCD->batchMode    = false;
    stdDevCCD->ISOMode      = false;
    retries              = 0;
    seqTotalCount        = 0;
    seqCurrentCount      = 0;
    active               = false;
    seqTimer->stop();
    
    if (stdDevCCD)
    	stdDevCCD->disconnect( SIGNAL(FITSReceived(QString)));
    
    resetButtons();
  }
  else
   seqTimer->start(seqDelay);
   
}
Ejemplo n.º 10
0
void PlugScreen::drawScreen(  )
{
	//Clear What was there.
	 myUTFT.clrScr();

	 resetButtons();
	 myUTFT.setBackColor (0, 0, 0);
	 myUTFT.print("Plug Setup", CENTER, 1);
	 myUTFT.setBackColor(0, 0, 255);

	 //Draw Lights button
	 lightsButton = myButtons.addButton( 10, 54, 145, 53, mainButton);
	 myButtons.drawButton(lightsButton);
	 myUTFT.print("Lights", 35, 71);

	 heaterButton = myButtons.addButton( 10, 110, 145, 53, mainButton);
	 myButtons.drawButton(heaterButton);
	 myUTFT.print("Heater", 35, 135);


	 pumpButton = myButtons.addButton( 160, 54, 145, 53, mainButton);
	 myButtons.drawButton(pumpButton);
	 myUTFT.print("Pump", 190, 71);

	 settingsButton = myButtons.addButton( 160, 110, 145, 53, mainButton);
	 myButtons.drawButton(settingsButton);
	 myUTFT.print("Override", 175, 135);

	 //Draw back button
	 back2SetupButton = myButtons.addButton( 10, 170, 145, 53, mainButton);
	 myButtons.drawButton(back2SetupButton);
	 myUTFT.print("Back", 55, 195);

}
Ejemplo n.º 11
0
GameOfLight::GameOfLight() {
    for (uint8_t i = 0; i < 8; i++) {
        red[i] = &buff[i][64];
        green[i] = &buff[i][0];
    }
    resetButtons();
    setFont(FONT_5x7);
}
Ejemplo n.º 12
0
int PlugScreen::handleScreen()
{
	//return handleScreenButtons(myButtons.checkButtons());
	int pressed_button = myButtons.checkButtons();

	if (pressed_button==back2SetupButton)
		{
		NewRemoteReceiver::deinit();
		return BACK2SETUP_BUTTON;
		}
	if (pressed_button==lightsButton)
		{
		resetButtons();
		drawPrepareScreen();
		plugDevice.lights = true;
		NewRemoteReceiver::init(RECEIVER_PIN, 1, waitForReceiver);
		Serial.println("PlugScreen::handlePlugScreen SET TIMER \n");
		}
	if (pressed_button==heaterButton)
		{
		resetButtons();
		drawPrepareScreen();
		plugDevice.heater = true;
		NewRemoteReceiver::init(RECEIVER_PIN, 1, waitForReceiver);
		}
	if (pressed_button==pumpButton)
		{
		resetButtons();
		drawPrepareScreen();
		plugDevice.pump = true;
		NewRemoteReceiver::init(RECEIVER_PIN, 1, waitForReceiver);
		}
	if (pressed_button==settingsButton)
		{
			NewRemoteReceiver::deinit();
			return PLUGS_SETTINGS_BUTTON;
		}
	if (pressed_button==exitButton)
		{
			NewRemoteReceiver::deinit();
			drawScreen();
		}

	Serial.println("PlugScreen::handlePlugScreen end \n");
}
Ejemplo n.º 13
0
void SettingsPageScreenSaver::handleImageRecentBook()
{
    qDebug() << Q_FUNC_INFO;

    resetButtons();
    setBtnChecked(imageRecentBookBtn, true);

    QBook::settings().setValue("setting/screensaver", QBookScreenSaver::BOOK_COVER);
}
Ejemplo n.º 14
0
void SettingsPageScreenSaver::handleScreenSaverDefault()
{
    qDebug() << Q_FUNC_INFO;

    resetButtons();
    setBtnChecked(screenSaverDefaultBtn, true);

    QBook::settings().setValue("setting/screensaver", QBookScreenSaver::DEFAULT_IMAGE);
}
Ejemplo n.º 15
0
void SettingsPageScreenSaver::handleStoredImages()
{
    qDebug() << Q_FUNC_INFO;

    resetButtons();
    setBtnChecked(storedImagesBtn, true);

    QBook::settings().setValue("setting/screensaver", QBookScreenSaver::STORED_IMAGES);
}
Ejemplo n.º 16
0
void DialogConversionStatus::step(int conv_status, QString fileName) // avviene quando un'immagine è stata processata (o saltata)
{
    counter(conv_status);
    conversionStatus(conv_status, fileName);
    progressBar->setValue(c_tot);

    if (c_tot == m_totimages)
        resetButtons();
}
Ejemplo n.º 17
0
void TransportMenu::deselect(){
    sourceTerritory = NULL;

    destinationTerritory = NULL;

    resetMateriel();

    resetButtons();

    emit deselectAll();
}
Ejemplo n.º 18
0
void Login::incomingStateChange(GuiState newState) {
  if (newState == LOGGED_IN) {
    close(); 
  }
  else if (newState == LOGGING_IN) {
  }
  else if (newState == LOGGED_OUT) {
    resetButtons();
  }

}
Ejemplo n.º 19
0
void Focus::startLooping()
{


    inFocusLoop = true;

    resetButtons();

    appendLogText(i18n("Starting continuous exposure..."));

    capture();
}
void CCountButtonClicks::doit()
{
	// reset button clicked at least one time
	if(m_ResetButton.getValue() > 0){
		resetButtons();
	}
	// read value, convert to binary form and show with LEDs (pin 8 is highest value)
	int value = m_CountButton.getValue();
	for(int i=0; i<4; ++i){
		digitalWrite(11-i, ((((value >> i) & 1) == 0) ? LOW : HIGH));
	}
}
Ejemplo n.º 21
0
void Focus::toggleAutofocus(bool enable)
{
    if (enable)
        focusType = FOCUS_AUTO;
    else
        focusType = FOCUS_MANUAL;

    if (inFocusLoop || inAutoFocus)
        stopFocus();
    else
        resetButtons();
}
CCountButtonClicks::CCountButtonClicks() :
		m_CountButton(CCountingButtons::instance0()), m_ResetButton(CCountingButtons::instance1())
{
	// configure buttons
	resetButtons();
	// configure button pins
	pinMode(2 , INPUT); // interrupt pin 0 -> Button 0
	pinMode(3 , INPUT); // interrupt pin 1 -> Button 1
	// configure LED pins
	pinMode(8 , OUTPUT);
	pinMode(9 , OUTPUT);
	pinMode(10, OUTPUT);
	pinMode(11, OUTPUT);
}
Ejemplo n.º 23
0
Focus::Focus()
{
    setupUi(this);

    currentFocuser = NULL;
    currentCCD     = NULL;

    canAbsMove     = false;
    inAutoFocus    = false;
    inFocusLoop    = false;

    HFRInc =0;
    reverseDir = false;

    pulseDuration = 1000;

    connect(startFocusB, SIGNAL(clicked()), this, SLOT(startFocus()));
    connect(stopFocusB, SIGNAL(clicked()), this, SLOT(stopFocus()));

    connect(focusOutB, SIGNAL(clicked()), this, SLOT(FocusOut()));
    connect(focusInB, SIGNAL(clicked()), this, SLOT(FocusIn()));

    connect(captureB, SIGNAL(clicked()), this, SLOT(capture()));

    connect(AutoModeR, SIGNAL(toggled(bool)), this, SLOT(toggleAutofocus(bool)));

    connect(startLoopB, SIGNAL(clicked()), this, SLOT(startLooping()));

    connect(CCDCaptureCombo, SIGNAL(activated(int)), this, SLOT(checkCCD(int)));

    lastFocusDirection = FOCUS_NONE;

    focusType = FOCUS_MANUAL;

    HFRPlot->axis( KPlotWidget::LeftAxis )->setLabel( i18nc("Half Flux Radius", "HFR") );
    HFRPlot->axis( KPlotWidget::BottomAxis )->setLabel( i18n("Absolute Position") );

    resetButtons();

    appendLogText(i18n("Idle."));

    foreach(QString filter, FITSViewer::filterTypes)
        filterCombo->addItem(filter);

    exposureIN->setValue(Options::focusExposure());
    toleranceIN->setValue(Options::focusTolerance());
    stepIN->setValue(Options::focusTicks());


}
Ejemplo n.º 24
0
void Focus::stopFocus()
{

    inAutoFocus = false;
    inFocusLoop = false;

    currentCCD->disconnect(this);

    resetButtons();

    absIterations = 0;
    HFRInc=0;
    reverseDir = false;

}
Ejemplo n.º 25
0
void Focus::setFocuser(ISD::GDInterface *newFocuser)
{
    currentFocuser = static_cast<ISD::Focuser *> (newFocuser);

    if (currentFocuser->canAbsMove())
    {
        canAbsMove = true;
        getAbsFocusPosition();
    }

    connect(currentFocuser, SIGNAL(numberUpdated(INumberVectorProperty*)), this, SLOT(processFocusProperties(INumberVectorProperty*)));

    AutoModeR->setEnabled(true);

    resetButtons();
}
/*
 * Delivering this instruction will instruct the E.C. Circuit to transmit it device info.
	Full proper syntax: i<cr> or I<CR>
	The E.C. Circuit will respond: E,V3.0,4/11<CR>
	Where:
	E =E.C. Circuit
	V3.1= Firmware version
	5/13= Date firmware was written
 */
void ECCalibrateScreen::getInfo()
{
	inputstring = "I\r";  //Command to get info
	Serial3.print(inputstring); //send command to sensor.

	//Draw part of the screen here and the info when we have it.
	//info comes after the loop has iterated.
	myUTFT.clrScr();
	resetButtons();
	//Draw back button
	subBackButton = myButtons.addButton( 10, 168, 145, 53, mainButton);
	myButtons.drawButton(subBackButton);
	myUTFT.setBackColor (161,190,237);
	myUTFT.print("Back", 45, 185);

	waiting_for_info = true;

}
void ECCalibrateScreen::getTempSingleReading()
{
	inputstring = ( waterTempString + "\r");  //"17.8\r"Command to get reading.
	Serial3.print(inputstring); //send command to sensor.
	delay(1000); //This takes 1000ms to complete.

	//Draw part of the screen here and the info when we have it.
	//info comes after the loop has iterated.
	myUTFT.clrScr();
	resetButtons();
	//Draw back button
	subBackButton = myButtons.addButton( 10, 168, 145, 53, mainButton);
	myButtons.drawButton(subBackButton);
	myUTFT.setBackColor (161,190,237);
	myUTFT.print("Back", 45, 185);

	waiting_for_single_reading = true;

}
void ECCalibrateScreen::drawStoppingScreen()
{
	myUTFT.clrScr();
	resetButtons();

	myButtons.setButtonColors(VGA_WHITE, VGA_GRAY, VGA_BLACK, VGA_RED, VGA_BLACK);

	myUTFT.setBackColor (VGA_BLACK);
	myUTFT.print("EC STOPPED", CENTER, 1);

	myUTFT.print("All EC Readings", CENTER, 30);
	myUTFT.print("Now Stopped", CENTER, 54);
	myUTFT.print("Sensor Standby", CENTER, 78);

	//Draw back button
	subBackButton = myButtons.addButton( 10, 168, 145, 53, mainButton);
	myButtons.drawButton(subBackButton);
	myUTFT.setBackColor (161,190,237);
	myUTFT.print("Back", 45, 185);
}
Ejemplo n.º 29
0
TransportMenu::TransportMenu(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::TransportMenu)
{
    ui->setupUi(this);
//    mapView = view;
//    mapScene = mapView->scene();
//    mapImage = (MapImage*)(mapScene->items().front());
//    mapEdit = mapImage->parentWindow->mapCreator->getMapEditor();

    sourceTerritory = NULL;
    destinationTerritory = NULL;
    resetMateriel();

    QObject::connect(this, SIGNAL(finished()), this, SLOT(deselect()));
    resetButtons();

    //ui->doneButton->setEnabled(false);
    //QObject::connect(radioGroup, radioGroup.buttonClicked(), this, enableDoneButton();)


}
Ejemplo n.º 30
0
Screen* HardwareDeviceScreen::touch(int16_t x, int16_t y) {
  for ( auto &button : outputButtons ) {
    if (button->contains(x, y)) {
      button->press(true);
    } else {
      button->press(false);
    }
    if (button->justReleased()) {
      button->select();
      resetButtons();
    }
  }
  if (ok_btn.contains(x, y)) {
    ok_btn.press(true);
  } else {
    ok_btn.press(false);
  }
  if (ok_btn.justReleased())
    return new HomeScreen();

  return NULL;
}