Exemple #1
0
settingseditor::settingseditor(QWidget *parent) :
    QWidget(parent)
{
    settings = browserapplication::settings();
    settingstabs = new QTabWidget(this);
    searchtab = new QWidget();
    settingstabs->addTab(searchtab , "search");
    searchformlayout = new QFormLayout(searchtab);
    searchonkeyup = new QLabel("search when text editing is finished");
    choosekeyup = new QCheckBox();
    savebutton = new QPushButton("save");
    searchformlayout->addRow(searchonkeyup , choosekeyup);
    searchformlayout->addRow("" , savebutton);
    readsettings();
    QObject::connect(savebutton , SIGNAL(clicked()) , this , SLOT(savesettings()));
}
Exemple #2
0
/* this is the plugin entry point */
enum plugin_status plugin_start(const void* parameter)
{
    PLUGIN_IRAM_INIT(rb)

    rb->lcd_setfont(0);

    rb->lcd_clear_display();

    if (!parameter)
    {
        rb->splash(HZ*3, "Play gameboy ROM file! (.gb/.gbc)");
        return PLUGIN_OK;
    }
    if(rb->audio_status())
    {
        audio_bufferbase = audio_bufferpointer
            = rb->plugin_get_buffer(&audio_buffer_free);
        plugbuf=true;
    }
    else
    {
        audio_bufferbase = audio_bufferpointer
            = rb->plugin_get_audio_buffer(&audio_buffer_free);
        plugbuf=false;
    }
#if MEM <= 8 && !defined(SIMULATOR)
    /* loaded as an overlay plugin, protect from overwriting ourselves */
    if ((unsigned)(plugin_start_addr - (unsigned char *)audio_bufferbase)
        < audio_buffer_free)
        audio_buffer_free = plugin_start_addr - (unsigned char *)audio_bufferbase;
#endif
    setoptions();

    shut=0;
    cleanshut=0;

#ifdef HAVE_WHEEL_POSITION
    rb->wheel_send_events(false);
#endif

#if defined(HAVE_LCD_MODES) && (HAVE_LCD_MODES & LCD_MODE_PAL256)
    rb->lcd_set_mode(LCD_MODE_PAL256);
#endif

    gnuboy_main(parameter);

#ifdef HAVE_WHEEL_POSITION
    rb->wheel_send_events(true);
#endif

#if defined(HAVE_LCD_MODES) && (HAVE_LCD_MODES & LCD_MODE_PAL256)
    rb->lcd_set_mode(LCD_MODE_RGB565);
#endif

    if(shut&&!cleanshut)
    {
        rb->splash(HZ/2, errormsg);
        return PLUGIN_ERROR;
    }
    if(!rb->audio_status())
        pcm_close();
        
    rb->splash(HZ/2, "Closing Rockboy");

    savesettings();

    cleanup();

    return PLUGIN_OK;
}
Exemple #3
0
/* this is the plugin entry point */
enum plugin_status plugin_start(const void* parameter)
{
    rb->lcd_setfont(FONT_SYSFIXED);

    rb->lcd_clear_display();

    if (!parameter)
    {
        rb->splash(HZ*3, "Play gameboy ROM file! (.gb/.gbc)");
        return PLUGIN_OK;
    }
    if(rb->audio_status())
    {
        audio_bufferbase = audio_bufferpointer
            = rb->plugin_get_buffer(&audio_buffer_free);
        plugbuf=true;
    }
    else
    {
        audio_bufferbase = audio_bufferpointer
            = rb->plugin_get_audio_buffer(&audio_buffer_free);
        plugbuf=false;
    }
#if MEMORYSIZE <= 8 && (CONFIG_PLATFORM & PLATFORM_NATIVE)
    /* loaded as an overlay plugin, protect from overwriting ourselves */
    if ((unsigned)(plugin_start_addr - (unsigned char *)audio_bufferbase)
        < audio_buffer_free)
        audio_buffer_free = plugin_start_addr - (unsigned char *)audio_bufferbase;
#endif
    setoptions();

    shut=0;
    cleanshut=0;

#ifdef HAVE_WHEEL_POSITION
    rb->wheel_send_events(false);
#endif

#if defined(HAVE_LCD_MODES) && (HAVE_LCD_MODES & LCD_MODE_PAL256)
    rb->lcd_set_mode(LCD_MODE_PAL256);
#endif

    /* ignore backlight time out */
    backlight_ignore_timeout();

    gnuboy_main(parameter);

#ifdef HAVE_WHEEL_POSITION
    rb->wheel_send_events(true);
#endif

#if defined(HAVE_LCD_MODES) && (HAVE_LCD_MODES & LCD_MODE_PAL256)
    rb->lcd_set_mode(LCD_MODE_RGB565);
#endif

    backlight_use_settings();

    if(!rb->audio_status())
        rockboy_pcm_close();

    if(shut&&!cleanshut)
    {
        rb->splash(HZ/2, errormsg);
        return PLUGIN_ERROR;
    }

    rb->splash(HZ/2, "Closing Rockboy");

    savesettings();

    cleanup();

    return PLUGIN_OK;
}
Exemple #4
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);

    pc_node = 0;
    plc_node=0;
    fins_sid = 0;
    retry_count=0;

    fins_handshake = {
                    qToBigEndian<quint32>(FINSTCP_FINS_SELF),\
                    qToBigEndian<quint32>(FINSTCP_HANDSHAKE_LEN),\
                    qToBigEndian<quint32>(FINSTCP_CMD_HANDSHAKE),\
                    qToBigEndian<quint32>(FINSTCP_ERR_CODE_NULL),\
                    qToBigEndian<quint32>(FINSTCP_ASK_NODE_ADDR)\
                   };


    tcp_send = new QTcpSocket(this);

    tcp_recv = new QTcpSocket(this);

//    QSettings plc_settings(QSettings::IniFormat, QSettings::UserScope,
//                           "SHNU", "PLC_Trans");
    QSettings plc_settings("./settings.ini",QSettings::IniFormat);

    ui->ip_lineEdit->setText(plc_settings.value("data_source_ip").toString());
    ui->ip_port->setText(plc_settings.value("data_source_port").toString());
    ui->plc_distance_address->setText(plc_settings.value("data_distance_pos").toString());
    ui->plc_avg_address->setText(plc_settings.value("data_avg_pos").toString());
    ui->plc_ip_address->setText(plc_settings.value("plc_ip").toString());
    ui->plc_ip_port->setText(plc_settings.value("plc_port").toString());

    connect(ui->ip_lineEdit,SIGNAL(textChanged(QString)),  this, SLOT(savesettings()));
    connect(ui->ip_port,SIGNAL(textChanged(QString)),  this, SLOT(savesettings()));
    connect(ui->plc_distance_address,SIGNAL(textChanged(QString)),  this, SLOT(savesettings()));
    connect(ui->plc_avg_address,SIGNAL(textChanged(QString)),  this, SLOT(savesettings()));
    connect(ui->plc_ip_address,SIGNAL(textChanged(QString)),  this, SLOT(savesettings()));
    connect(ui->plc_ip_port,SIGNAL(textChanged(QString)),  this, SLOT(savesettings()));



    connect(tcp_recv, SIGNAL(readyRead()), this, SLOT(data_coming()));//数据接收
    connect(tcp_recv , SIGNAL(connected()) , this , SLOT(cli_connected()));
    connect(tcp_recv , SIGNAL(disconnected()) , this , SLOT(cli_disconnected()));

    connect(this , SIGNAL(readFromPLC_signal(plc_send_node)),this,SLOT(readFromPLC(plc_send_node)));
    connect(this , SIGNAL(writeToPLC_signal(plc_send_node)),this,SLOT(writeToPLC(plc_send_node)));


    ui->start_server_button->setEnabled(false);
//    ui->ip_lineEdit->setText("127.0.0.1");
//    ui->ip_port->setText("4701");
    connect(ui->start_client_button,SIGNAL(clicked()),this,SLOT(cli_connectToHost()));


    //for debug
    ui->debug_length->setText("2");
    ui->debug_length->setEnabled(false);
    connect(ui->debug_start,SIGNAL(clicked()),this,SLOT(startdebug()));

    //for plc setting
//    ui->plc_ip_address->setText("192.168.11.5");
//    ui->plc_ip_port->setText("9600");

//    ui->plc_distance_address->setText("0");
//    ui->plc_avg_address->setText("10");

    //cli_connectToHost();
}
Exemple #5
0
// GLUT keyboard function
void keyboardfunc(unsigned char key,int x,int y)
   {
   float mousex,mousey;

   mousex=(float)x/(winwidth-1);
   mousey=(float)y/(winwidth-1);

   if (mousex<0.0f) mousex=0.0f;
   else if (mousex>1.0f) mousex=1.0f;

   if (mousey<0.0f) mousey=0.0f;
   else if (mousey>1.0f) mousey=1.0f;

   switch (key)
      {
      case ' ':
         if (topspeed==0.0) topspeed=speedinc*maxspeed;
         else topspeed=0.0;
         break;
      case 'w':
         topspeed+=speedinc*maxspeed;
         if (topspeed>maxspeed) topspeed=maxspeed;
         break;
      case 'W':
         topspeed+=speedinc*maxspeed*fast;
         if (topspeed>maxspeed*fast) topspeed=maxspeed*fast;
         break;
      case 'a':
         turn-=oneturn;
         break;
      case 'A':
         turn-=oneturn/slow;
         break;
      case 'd':
         turn+=oneturn;
         break;
      case 'D':
         turn+=oneturn/slow;
         break;
      case 's':
         topspeed-=speedinc*maxspeed;
         if (topspeed<-maxspeed) topspeed=-maxspeed;
         break;
      case 'S':
         topspeed-=speedinc*maxspeed*fast;
         if (topspeed<-maxspeed*fast) topspeed=-maxspeed*fast;
         break;
      case '<':
         incline+=oneincline;
         break;
      case '>':
         incline-=oneincline;
         break;
      case 'j':
         dez=jump;
         break;
      case 'J':
         dez=jump*fast;
         break;
      case 'g':
         if (gravity==0.0) gravity=earthg;
         else gravity=0.0;
         break;
      case 'G':
         if (gravity==0.0) gravity=earthg*boost;
         else gravity=0.0;
         break;
      case 't':
         tparams->relres1/=1.1f;
         if (tparams->relres1<1.0E-3f) tparams->relres1=1.0E-3f;
         viewer->propagate();
         break;
      case 'T':
         tparams->relres1*=1.1f;
         if (tparams->relres1>1.0E6f) tparams->relres1=1.0E6f;
         viewer->propagate();
         break;
      case 'r':
         tparams->relrange1/=1.1f;
         if (tparams->relrange1<1.0E-3f) tparams->relrange1=1.0E-3f;
         viewer->propagate();
         break;
      case 'R':
         tparams->relrange1*=1.1f;
         if (tparams->relrange1>1.0E3f) tparams->relrange1=1.0E3f;
         viewer->propagate();
         break;
      case 'f':
         params->farp/=1.1f;
         if (params->farp<2*params->nearp) params->farp=2*params->nearp;
         viewer->propagate();
         break;
      case 'F':
         params->farp*=1.1f;
         if (params->farp>1.0E10f*params->nearp) params->farp=1.0E10f*params->nearp;
         viewer->propagate();
         break;
      case 'v':
         params->fovy-=5.0f;
         if (params->fovy<10.0f) params->fovy=10.0f;
         viewer->propagate();
         break;
      case 'V':
         params->fovy+=5.0f;
         if (params->fovy>170.0f) params->fovy=170.0f;
         viewer->propagate();
         break;
      case 'u':
         if (tparams->sealevel==-MAXFLOAT) tparams->sealevel=0.0f;
         else
            {
            tparams->sealevel+=0.5f;
            if (tparams->sealevel==0.0f) tparams->sealevel=-MAXFLOAT;
            }
         viewer->propagate();
         viewer->getearth()->getterrain()->update();
         break;
      case 'U':
         if (tparams->sealevel==-MAXFLOAT) tparams->sealevel=0.0f;
         else
            {
            tparams->sealevel-=0.5f;
            if (tparams->sealevel==0.0f) tparams->sealevel=-MAXFLOAT;
            }
         viewer->propagate();
         viewer->getearth()->getterrain()->update();
         break;
      case 'm':
         eparams->fogdensity*=0.9f;
         if (eparams->fogdensity<1.0E-3f) eparams->fogdensity=1.0E-3f;
         viewer->propagate();
         break;
      case 'M':
         eparams->fogdensity*=1.1f;
         if (eparams->fogdensity>2.0f) eparams->fogdensity=2.0f;
         viewer->propagate();
         break;
      case '9':
         if (!eparams->usefog) eparams->usefog=TRUE;
         else eparams->usefog=FALSE;
         viewer->propagate();
         break;
      case '8':
         if (!eparams->usebathymap) eparams->usebathymap=TRUE;
         else eparams->usebathymap=FALSE;
         viewer->propagate();
         break;
      case '7':
         if (!eparams->usecontours) eparams->usecontours=TRUE;
         else eparams->usecontours=FALSE;
         viewer->propagate();
         break;
      case '6':
         if (!eparams->useskydome) eparams->useskydome=TRUE;
         else eparams->useskydome=FALSE;
         break;
      case '5':
         if (!eparams->useearth) eparams->useearth=TRUE;
         else eparams->useearth=FALSE;
         break;
      case 'p':
         if (!eparams->usewaypoints) eparams->usewaypoints=TRUE;
         else eparams->usewaypoints=FALSE;
         viewer->propagate();
         break;
      case 'E':
         if (!eparams->useflat) eparams->useflat=TRUE;
         else eparams->useflat=FALSE;
         viewer->propagate();
         break;
      case '0':
         if (!eparams->nonlin) eparams->nonlin=TRUE;
         else eparams->nonlin=FALSE;
         viewer->propagate();
         break;
      case '1':
         viewer->getearth()->getterrain()->flatten(1.0f/VIEWER_EXAGGER);
         viewer->propagate();
         break;
      case '2':
         viewer->getearth()->getterrain()->flatten(2.0f/VIEWER_EXAGGER);
         viewer->propagate();
         break;
      case '3':
         viewer->getearth()->getterrain()->flatten(1.0f);
         viewer->propagate();
         break;
      case '-':
         tparams->seatrans=1.0f-tparams->seatrans;
         break;
      case 'N':
         if (!eparams->usenprshader) eparams->usenprshader=TRUE;
         else eparams->usenprshader=FALSE;
         eparams->usevisshader=!eparams->usenprshader;
         viewer->propagate();
         break;
      case '~':
         if (!params->autoadapt) params->autoadapt=TRUE;
         else params->autoadapt=FALSE;
         break;
      case 'l':
         if (!params->usewireframe) params->usewireframe=TRUE;
         else params->usewireframe=FALSE;
         break;
      case 'L':
         if (!eparams->usediffuse) eparams->usediffuse=TRUE;
         else eparams->usediffuse=FALSE;
         viewer->propagate();
         break;
      case 'h':
         if (sw_hud==0) sw_hud=1;
         else sw_hud=0;
         break;
      case 'H':
         if (sw_hide==0) sw_hide=1;
         else sw_hide=0;
         break;
      case 'c':
         if (sw_cross==0) sw_cross=1;
         else sw_cross=0;
         break;
      case 'o':
         loadsettings();
         break;
      case 'O':
         savesettings();
         break;
      case 'P':
         screenshot();
         break;
      case 'Q':
      case 27:
         delete cam;
         delete viewer;
         if (sw_full==0) glutDestroyWindow(winid);
         else glutLeaveGameMode();
         exit(0);
      }

   wakeup=TRUE;
   }