Exemplo n.º 1
0
void
MainMenu::gotoMainMenu()
{
    getSound()->playSound( "Click" );
    loadMainMenu();
    switchMenu(mainMenu.get());
}
Exemplo n.º 2
0
void
MainMenu::saveGameButtonClicked(Button* )
{
    getSound()->playSound( "Click" );
    loadSaveGameMenu();
    switchMenu(saveGameMenu.get());
}
Exemplo n.º 3
0
void
MainMenu::loadGameBackButtonClicked(Button* )
{
    getSound()->playSound( "Click" );
    loadMainMenu();
    switchMenu(mainMenu.get());
}
Exemplo n.º 4
0
void
MainMenu::optionsButtonClicked(Button* )
{
    getSound()->playSound( "Click" );
    loadOptionsMenu();
    switchMenu(optionsMenu.get());
}
Exemplo n.º 5
0
void
MainMenu::newGameButtonClicked(Button* )
{
    getSound()->playSound( "Click" );
    loadNewGameMenu();
    switchMenu(newGameMenu.get());
}
Exemplo n.º 6
0
void SettingsDateMenu::button2() {
  if (selection == 6) {
    switchMenu(MENU_SETTINGS);
  } else {
    uint16_t year = state.now.year();
    uint8_t month = state.now.month();
    uint8_t day = state.now.day();
    if (selection == 2) {
      year += 1;
    } else if (selection == 5) {
      year -= 1;
    } else if (selection == 1) {
      month = (month % 12) + 1;
    } else if (selection == 4) {
      month = month == 1 ? 12 : (month - 1);
    } else if (selection == 0) {
      day = (day % 31) + 1;
    } else if (selection == 3) {
      day = day == 1 ? 31 : (day - 1);
    }
    state.now = DateTime(year, month, day, state.now.hour(), state.now.minute(), state.now.second());
    state.timeUpdated = true;
    state.timeMinuteUpdated = true;
    RTC.adjust(state.now);
  }
}
Exemplo n.º 7
0
void
MainMenu::creditsButtonClicked(Button* )
{
    getSound()->playSound( "Click" );
    loadCreditsMenu();
    switchMenu(creditsMenu.get());
}
Exemplo n.º 8
0
void SettingsClockfaceMenu::button2() {
  if (selection == FACE_MAX) {
    switchMenu(MENU_SETTINGS);
  } else {
    state.enabled_faces ^= _BV(selection);
    state.save();
  }
}
Exemplo n.º 9
0
void menuNewGame() {
	// inizializzazione scena
	gameState = GAME_RUNNING;
	switchMenu(MNUT_PAUSE);
	srandom(SDL_GetTicks());
	if (initScene())
		exit(3);
}
Exemplo n.º 10
0
// partita finita: l'utente ha perso
// viene richiamata da game.c
void gameOver(int points) {
	// partita persa: chiudo tutto
	// e torno al menù iniziale
	switchMenu(MNUT_MAIN);
	gameState = GAME_STOPPED;
	printf("Hai realizzato %d punti!\n", points);
	destroyScene();
}
Exemplo n.º 11
0
/*
 * GUI: funzioni di callback dal menu
 */
void menuExit() {
	if(gameState == GAME_PAUSED) {
		switchMenu(MNUT_MAIN);
		gameState = GAME_STOPPED;
		destroyScene();
	} else {
		quit = 1;
	}
}
Exemplo n.º 12
0
MainMenu::MainMenu()
{
    loadMainMenu();
    switchMenu(mainMenu.get());
    baseName = "";
    lastClickTick = 0;
    doubleClickButtonName = "";
    mFilename = "";
    baseName = "";
}
Exemplo n.º 13
0
void ClockfaceMenu::button2() {
  switchMenu(MENU_SETTINGS);
}
Exemplo n.º 14
0
int main3( int /*argc*/, char** /*argv*/)
{
  int                     exitStatus = EXIT_SUCCESS;
  LOW_link::linkPtrVec_t  oneWireLinks;

  try {
        
    //
    // Automatically log any exception when it is created
    //
    //LOW_exception::setLogOnCreation( true);

    // if debugging is enabled then enable according log level
#ifdef DEBUG_LOCKING
    //LOW_helper_msglog::setDebugLevelEnabled( LOW_helper_msglog::objSync_getLock_dl);
    //LOW_helper_msglog::setDebugLevelEnabled( LOW_helper_msglog::objSync_lockFailed_dl);
#endif

    //
    // Uncomment to activate various debugging levels
    //
    //LOW_helper_msglog::setDebugLevelEnabled( LOW_helper_msglog::portSerial_dl);
    //LOW_helper_msglog::setDebugLevelEnabled( LOW_helper_msglog::devDS1820_dl);
    //LOW_helper_msglog::setDebugLevelEnabled( LOW_helper_msglog::linkLock_dl);
    //LOW_helper_msglog::setDebugLevelEnabled( LOW_helper_msglog::linkDS2490_dl);

    //
    // This is our whole network
    //
    LOW_helper_msglog::printMessage( "Creating network class.\n");
    LOW_network  oneWireNet;
    std::string hostName = LOW_platformMisc::getHostname();
    // predefined setup for Harald's machine
    if ( hostName == "raspberrypi" ) {

      // stuff for the active adapter
//      LOW_linkDS2480B        *activeLink = 0;
//      try {
//        hlp_printDashline();
//        LOW_helper_msglog::printMessage( "Harald's predefined setup: Adding active adapter to network.\n");
//        LOW_portSerialFactory::portSpecifier_t  ttyS0 = LOW_portSerialFactory::portSpecifier_t( "/dev/ttyAMA0");
//        activeLink = new LOW_linkDS2480B( ttyS0, LOW_linkDS2480B::RXPOL_INV, true, true);
//        oneWireNet.addLink( activeLink);
//        oneWireLinks.push_back( activeLink);
//      }
//      catch( LOW_exception ex) {
//        ex.logException();
//        if ( activeLink ) delete activeLink;
//      }

//      // stuff for the passive adapter
      LOW_linkPassiveSerial  *passiveLink = 0;
      try {
        hlp_printDashline();
        LOW_helper_msglog::printMessage( "Harald's predefined setup: Adding passive adapter to network.\n");
        LOW_portSerialFactory::portSpecifier_t  ttyS1 = LOW_portSerialFactory::portSpecifier_t( "/dev/ttyAMA0");
        passiveLink = new LOW_linkPassiveSerial( ttyS1);
        oneWireNet.addLink( passiveLink);
        //LOW_devDS1820::devDS1820PtrVec_t allTDevs = oneWireNet.getDevices<LOW_devDS1820>();
        //getInfoDS1820( hlp_selectDevices( allTDevs));
        //tempMenu( oneWireNet);

        oneWireLinks.push_back( passiveLink);
      }
      catch( LOW_exception ex) {
        ex.logException();
        if ( passiveLink ) delete passiveLink;
      }


      // stuff for the USB adapter
//      try {
//        hlp_printDashline();
//        LOW_helper_msglog::printMessage( "Harald's predefined setup: Adding all USB adapters to network.\n");
//
//        LOW_portUsb_Factory::usbDevSpecVec_t  specifierList = LOW_portUsb_Factory::getPortSpecifiers( LOW_linkDS2490::usbVendorID, LOW_linkDS2490::usbProductID);
//        for( unsigned int a=0; a<specifierList.size(); a++) {
//          LOW_linkDS2490  *usbLink = 0;
//          try {
//            usbLink = new LOW_linkDS2490( specifierList[a], true, true);
//            oneWireNet.addLink( usbLink);
//            oneWireLinks.push_back( usbLink);
//          }
//          catch( LOW_exception ex) {
//            ex.logException();
//            if ( usbLink ) delete usbLink;
//          }
//        }
//      }
//      catch( LOW_exception ex) {
//        ex.logException();
//      }

    }

        
    bool keepLooping = true;
    while ( keepLooping) {
      hlp_printDashline();
      printf( "OneWire++ Library Testing Main Menu\n");
      printf( "\n");
      printf( "  <l> Links\n");
      printf( "\n");
      printf( "  <n> Network\n");
      printf( "\n");
      printf( "  <t> Temperature devices\n");
      printf( "  <1> PIO DS2413 devices\n");
      printf( "  <5> PIO DS2505 devices\n");
      printf( "  <6> PIO DS2506 devices\n");
      printf( "  <9> Digital potentiometer DS2890 devices\n");
      printf( "\n");
      printf( "  <s> Switch components\n");
      printf( "  <j> Jalousie components\n");
      printf( "\n");
      printf( "  <m> Message logging and debugging\n");
      printf( "  <o> Locks test\n");
      printf( "  <h> Thread test\n");
      printf( "\n");
      printf( "  <q> Quit\n");

      int key = hlp_getMenuKey( "lnt1569sjmohq");

      switch( key ) {
        case 'l': linkMenu( oneWireLinks, oneWireNet); break;
        case 'n': netMenu( oneWireNet);                break;
        case 't': tempMenu( oneWireNet);               break;
        case '1': ds2413Menu( oneWireNet);				break;
        case '5': ds2405Menu( oneWireNet);             break;
        case '6': ds2406Menu( oneWireNet);             break;
        case '9': ds2890Menu( oneWireNet);             break;
        case 's': switchMenu( oneWireNet);             break;
        case 'j': jalousieMenu( oneWireNet);           break;
        case 'm': msgLoggingMenu();                    break;
        case 'o': lockMenu( oneWireNet);               break;
        case 'h': threadMenu( oneWireNet);             break;
        case 'q': keepLooping=false;                   break;
      }
    }
  }
  catch( LOW_exception ex) {
    ex.logException();
    exitStatus = EXIT_FAILURE;
  }

  for( unsigned int a=0; a<oneWireLinks.size(); a++ )
    delete oneWireLinks[a];
        
  return exitStatus;
}
Exemplo n.º 15
0
void MainWindow::startSensorThread()
{
    sensorThread = new SensorThread();
    //QObject::connect(sensorThread, SIGNAL(receivedData(QPair<SensorData*,SensorData*>,QPair<SensorData*,SensorData*>,QPair<SensorData*,SensorData*>)), this, SLOT(printData(QPair<SensorData*,SensorData*>,QPair<SensorData*,SensorData*>,QPair<SensorData*,SensorData*>)));
    QObject::connect(sensorThread, SIGNAL(receivedData(QPair<SensorData*,SensorData*>,QPair<SensorData*,SensorData*>,QPair<SensorData*,SensorData*>)), this, SLOT(updateCursors(QPair<SensorData*,SensorData*>,QPair<SensorData*,SensorData*>,QPair<SensorData*,SensorData*>)));
    QObject::connect(sensorThread, SIGNAL(receivedData(QPair<SensorData*,SensorData*>,QPair<SensorData*,SensorData*>,QPair<SensorData*,SensorData*>)), getWidget(WidgetType::settingsWidget), SLOT(displayData(QPair<SensorData*,SensorData*>,QPair<SensorData*,SensorData*>,QPair<SensorData*,SensorData*>)));
    QObject::connect(sensorThread, SIGNAL(receivedData(QPair<SensorData*,SensorData*>,QPair<SensorData*,SensorData*>,QPair<SensorData*,SensorData*>)), getWidget(WidgetType::homeWidget), SLOT(switchMenu(QPair<SensorData*,SensorData*>,QPair<SensorData*,SensorData*>,QPair<SensorData*,SensorData*>)));
    QObject::connect(sensorThread, SIGNAL(receivedData(QPair<SensorData*,SensorData*>,QPair<SensorData*,SensorData*>,QPair<SensorData*,SensorData*>)), getWidget(WidgetType::desktopWidget), SLOT(switchMenu(QPair<SensorData*,SensorData*>,QPair<SensorData*,SensorData*>,QPair<SensorData*,SensorData*>)));
    QObject::connect(sensorThread, SIGNAL(receivedData(QPair<SensorData*,SensorData*>,QPair<SensorData*,SensorData*>,QPair<SensorData*,SensorData*>)), getWidget(WidgetType::galleryWidget), SLOT(displayData(QPair<SensorData*,SensorData*>,QPair<SensorData*,SensorData*>,QPair<SensorData*,SensorData*>)));
    QObject::connect(sensorThread, SIGNAL(connectionChanged(QString)), getWidget(WidgetType::loadingWidget), SLOT(updateSubtitle(QString)));
    QObject::connect(sensorThread, SIGNAL(initializationChanged(WidgetType)), this, SLOT(setActiveWidget(WidgetType)));
    QObject::connect(getWidget(WidgetType::homeWidget), SIGNAL(menuSelected(WidgetType)), this, SLOT(setActiveWidget(WidgetType)));
    QObject::connect(sensorThread, SIGNAL(finished()), sensorThread, SLOT(deleteLater()));
    for (int i = 0; i < widgetsList.size(); i++){
        QObject::connect(sensorThread, SIGNAL(receivedData(QPair<SensorData*,SensorData*>,QPair<SensorData*,SensorData*>,QPair<SensorData*,SensorData*>)), widgetsList[i], SLOT(collapse(QPair<SensorData*,SensorData*>,QPair<SensorData*,SensorData*>,QPair<SensorData*,SensorData*>)));
        QObject::connect(widgetsList[i], SIGNAL(returnHome(WidgetType)), this, SLOT(setActiveWidget(WidgetType)));}
    sensorThread->start();
}