コード例 #1
0
ファイル: settings.cpp プロジェクト: Nikita6000/EncChat
void Settings::on_pbSave_clicked()
{
    emit NewSettings(ui->tlName->text(), ui->tlPort->text().toUInt());
}
コード例 #2
0
ファイル: gui_ca.c プロジェクト: BackupTheBerlios/arp2-svn
void EventLoop(void) {
  ULONG signal  = NULL, rc;
  WORD  code;
  BOOL  running = TRUE;

  GetAttr( WINDOW_SigMask, WO_Window, &signal );
  if(signal) {
    do {
      if(Wait(signal | SIGBREAKF_CTRL_C) & SIGBREAKF_CTRL_C ) {
        running=FALSE;
      }

      while (( rc = CA_HandleInput( WO_Window, &code)) != WMHI_LASTMSG) {

        switch(rc & WMHI_CLASSMASK) {

          case WMHI_CLOSEWINDOW:
            running=FALSE;
            break;

          case WMHI_GADGETUP:
          case WMHI_MENUPICK:
          {

            if((rc & WMHI_CLASSMASK) == WMHI_MENUPICK) {
              struct MenuItem *mi;
              
              mi = ItemAddress(Menu, rc & WMHI_MENUMASK);
              
              if(mi) {
                rc = (ULONG) GTMENUITEM_USERDATA(mi);
              }
            }


            switch( rc & WMHI_GADGETMASK) {

#if 0
              case ACTID_OPEN:
              {
                if(DoMethod( openreq, FRM_DOREQUEST ) == FRQ_OK) {
                  char *file = NULL;
    
                  GetAttr( FRQ_Path, openreq, (ULONG *) &file);
                  NewSettings(file);
                  GUINewSettings();
                }
                break;
              }
    
              case ACTID_SAVEAS:
              {
                FillUnit();
                if(DoMethod( savereq, FRM_DOREQUEST ) == FRQ_OK) {
                  char *file = NULL;
    
                  GetAttr( FRQ_Path, savereq, (ULONG *) &file);
                  SaveSettings(file, UnitList);
                  if(SaveIcons) {
                    WriteIcon(file);
                  }
                }
                break;
              
              }
              
#endif
              case ACTID_ABOUT:
                Req( (char *) msgButtonOK,
                    (char *) msgTextCopyright,
                    "",(char *) msgTextProgramName,
                    "1996-2003 Martin Blom" );
                break;

              case ACTID_SAVE:
                FillUnit();
                SaveSettings(ENVFILE, UnitList);
                SaveSettings(ENVARCFILE, UnitList);
                running=FALSE;
                break;
    
              case ACTID_USE:
                FillUnit();
                SaveSettings(ENVFILE, UnitList);
                running=FALSE;
                break;
    
              case ACTID_QUIT:
                running=FALSE;
                break;
    
              case ACTID_DEFAULT:
                SetAttrs( WO_Window, WA_BusyPointer, TRUE, TAG_DONE);
                NewSettings(NULL);    // This is VERY slow!!
                SetAttrs( WO_Window, WA_BusyPointer, FALSE, TAG_DONE);
                GUINewSettings();
                break;
    
              case ACTID_LASTSAVED:
                NewSettings(ENVARCFILE);
                GUINewSettings();
                break;
    
              case ACTID_RESTORE:
                NewSettings(args.from);
                GUINewSettings();
                break;

              case ACTID_ICONS:
              {
                struct MenuItem *item;
    
                item = FindMenuItem(ACTID_ICONS);
    
                if(item) {
                  if(item->Flags & CHECKED)
                    SaveIcons = TRUE;
                  else
                    SaveIcons = FALSE;
                }
                break;
              }

#if 0
    
              case ACTID_HELP: {
                APTR lock = BGUI_LockWindow(Window);
                if(!BGUI_Help( Window, HELPFILE, "AHI", NULL)) {
                  Req( (char *) msgButtonOK, (char *) msgTextNoFind, HELPFILE);
                }
                BGUI_UnlockWindow(lock);
                break;
              }
    
              case ACTID_GUIDE: {
                APTR lock = BGUI_LockWindow(Window);
                if(!BGUI_Help( Window, HELPFILE, NULL, NULL)) {
                  Req( (char *) msgButtonOK, (char *) msgTextNoFind, HELPFILE);
                }
                BGUI_UnlockWindow(lock);
                break;
              }
    
              case ACTID_HELPINDEX: {
                APTR lock = BGUI_LockWindow(Window);
                if(!BGUI_Help( Window, HELPFILE, "Concept Index", 0)) {
                  Req( (char *) msgButtonOK, (char *) msgTextNoFind, HELPFILE);
                }
                BGUI_UnlockWindow(lock);
                break;
              }
#endif
    
              case ACTID_UNIT: {
                FillUnit();
                NewUnit(code);
                GUINewUnit();
                break;
              }
    
              case ACTID_MODE: {
                FillUnit();
                NewMode(code);
                GUINewMode();
                break;
              }

              case ACTID_DEBUG:
              case ACTID_SURROUND:
              case ACTID_ECHO:
              case ACTID_CPULIMIT:
              case ACTID_CLIPMV:
              {
                ULONG debug = AHI_DEBUG_NONE, surround = FALSE, echo = 0, cpu = 90;
                ULONG clip = FALSE;
    
                GetAttr( CHOOSER_Active, Window_Objs[ACTID_DEBUG],    &debug);
                GetAttr( CHOOSER_Active, Window_Objs[ACTID_SURROUND], &surround);
                GetAttr( CHOOSER_Active, Window_Objs[ACTID_ECHO],     &echo);
                GetAttr( CHOOSER_Active, Window_Objs[ACTID_CLIPMV],   &clip);
                GetAttr( INTEGER_Number, Window_Objs[ACTID_CPULIMIT], &cpu);
    
                globalprefs.ahigp_DebugLevel      = debug;
                globalprefs.ahigp_DisableSurround = surround;
                globalprefs.ahigp_DisableEcho     = (echo == 2);
                globalprefs.ahigp_FastEcho        = (echo == 1);
                globalprefs.ahigp_MaxCPU = (cpu << 16) / 100;
                globalprefs.ahigp_ClipMasterVolume= clip;
    
                break;
              }
            } /* switch(GADGETMASK) */
          }
        } /* switch(CLASSMASK) */
      } /* HandleInput */
    } while(running);
  }
}
コード例 #3
0
ファイル: gui_mui.c プロジェクト: BackupTheBerlios/arp2-svn
void EventLoop(void)
{
  ULONG sigs = 0UL;

  while (1)
  {
    ULONG rc = DoMethod(MUIApp, MUIM_Application_NewInput, &sigs);

    switch(rc)
    {
      case MUIV_Application_ReturnID_Quit:
        return;

      case ACTID_OPEN:
      {
        struct FileRequester *request;

        request = MUI_AllocAslRequestTags(ASL_FileRequest, 
            ASLFR_Window, xget(MUIWindow, MUIA_Window_Window),
            ASLFR_TitleText, msgTextProgramName, 
            ASLFR_RejectIcons, TRUE, 
            ASLFR_InitialDrawer, "SYS:Prefs/Presets",
            TAG_DONE );
        if( request != NULL )
        {
          DoMethod(MUIApp, MUIA_Application_Sleep, TRUE);
          if (MUI_AslRequest(request, NULL))
          {
            char *file;

            DoMethod(MUIApp, MUIA_Application_Sleep, FALSE);
            
            file = AllocVec(strlen(request->fr_Drawer)+128,0);
            
            if( file != NULL )
            {
              CopyMem(request->fr_Drawer, file, strlen(request->fr_Drawer)+1);
              AddPart(file, request->fr_File, 128);
              NewSettings(file);
              GUINewSettings();
              FreeVec(file);
            }
          }
          else
          {
            DoMethod(MUIApp, MUIA_Application_Sleep, FALSE);
          }
          MUI_FreeAslRequest(request);
        }
        break;
      }

      case ACTID_SAVEAS:
      {
        struct FileRequester *request;

        request = MUI_AllocAslRequestTags(ASL_FileRequest,
            ASLFR_Window, xget(MUIWindow, MUIA_Window_Window),
            ASLFR_TitleText, msgTextProgramName,
            ASLFR_RejectIcons, TRUE,
            ASLFR_DoSaveMode, TRUE,
            ASLFR_InitialDrawer, "SYS:Prefs/Presets",
            TAG_DONE);
            
        if(request != NULL )
        {
          DoMethod(MUIApp, MUIA_Application_Sleep, TRUE);
          FillUnit();
          if (MUI_AslRequest(request, NULL))
          {
            char *file;

            DoMethod(MUIApp, MUIA_Application_Sleep, FALSE);
            
            file = AllocVec(strlen(request->fr_Drawer)+128,0);
            
            if( file != NULL )
            {
              CopyMem(request->fr_Drawer, file, strlen(request->fr_Drawer)+1);
              AddPart(file, request->fr_File, 128);
              SaveSettings(file, UnitList);
              if(SaveIcons)
              {
                WriteIcon(file);
              }
              FreeVec(file);
            }
          }
          else
          {
            DoMethod(MUIApp, MUIA_Application_Sleep, FALSE);
          }
          MUI_FreeAslRequest(request);
        }
        break;
      }

      case ACTID_ABOUT:
      {
        char* args[] = { "\033c", 
                         (char*)msgTextProgramName,
                         "1996-2004 Stéphane Barbaray/Martin Blom"
                       };

        MUI_RequestA(MUIApp, MUIWindow, 0, (char *) msgTextProgramName,
            (char*)msgButtonOK, (char*)msgTextCopyright, args );
        break;
      }

      case ACTID_SAVE:
        FillUnit();
        SaveSettings(ENVFILE, UnitList);
        SaveSettings(ENVARCFILE, UnitList);
        return;

      case ACTID_USE:
        FillUnit();
        SaveSettings(ENVFILE, UnitList);
        return;

      case ACTID_QUIT:
        return;

      case ACTID_DEFAULT:
        NewSettings(NULL);
        GUINewSettings();
        break;

      case ACTID_LASTSAVED:
        NewSettings(ENVARCFILE);
        GUINewSettings();
        break;

      case ACTID_RESTORE:
        NewSettings(args.from);
        GUINewSettings();
        break;

      case ACTID_ICONS:
      {
        APTR item = (APTR)DoMethod(MUIMenu,MUIM_FindUData,ACTID_ICONS);

        if(item)
        {
          if(xget(item, MUIA_Menuitem_Checked))
          {
            SaveIcons = TRUE;
          }
          else
          {
            SaveIcons = FALSE;
          }
        }
        break;
      }

      case ACTID_HELP:
        DoMethod(MUIApp,MUIM_Application_ShowHelp,NULL,NULL,"AHI",0);
        break;

      case ACTID_GUIDE:
        DoMethod(MUIApp,MUIM_Application_ShowHelp,NULL,NULL,"MAIN",0);
        break;

      case ACTID_HELPINDEX:
        DoMethod(MUIApp,MUIM_Application_ShowHelp,NULL,NULL,"Concept Index",0);
        break;

      case ACTID_UNIT:
        FillUnit();
        NewUnit(xget(MUIUnit,MUIA_Cycle_Active));
        GUINewUnit();
        break;

      case ACTID_MODE:
        FillUnit();
        NewMode(xget(MUIList, MUIA_List_Active));
        GUINewMode();
        break;
        
      case ACTID_PLAY:
      {
        int              unit_id;
        struct UnitNode* unit;

        FillUnit();
        unit_id = xget( MUIUnit, MUIA_Cycle_Active );
        unit    = (struct UnitNode *) GetNode( unit_id, UnitList );
        
        PlaySound( &unit->prefs );
        break;
      }

      case ACTID_DEBUG:
      case ACTID_SURROUND:
      case ACTID_ECHO:
      case ACTID_CPULIMIT:
      case ACTID_CLIPMV:
      case ACTID_ACTIME:
      case ACTID_SCALEMODE:
      {
        ULONG debug = AHI_DEBUG_NONE, surround = FALSE, echo = 0, cpu = 90;
        ULONG clip = FALSE, actime = 0, scalemode = AHI_SCALE_FIXED_0_DB;

        get(MUIDebug, MUIA_Cycle_Active, &debug);
        get(MUISurround, MUIA_Cycle_Active, &surround);
        get(MUIEcho, MUIA_Cycle_Active, &echo);
        get(MUIClipvol, MUIA_Cycle_Active, &clip);
        get(MUICpu, MUIA_Numeric_Value, &cpu);
        get(MUIACTime, MUIA_Numeric_Value, &actime);
        get(MUIScalemode, MUIA_Cycle_Active, &scalemode);

        globalprefs.ahigp_DebugLevel       = debug;
        globalprefs.ahigp_DisableSurround  = surround;
        globalprefs.ahigp_DisableEcho      = (echo == 2);
        globalprefs.ahigp_FastEcho         = (echo == 1);
        globalprefs.ahigp_MaxCPU           = ((cpu << 16) + 50) / 100;
        globalprefs.ahigp_ClipMasterVolume = clip;
        globalprefs.ahigp_AntiClickTime    = ((actime << 16) + 500) / 1000;
	globalprefs.ahigp_ScaleMode        = scalemode;

        break;
      }
    }

    if (sigs)
    {
      sigs = Wait(sigs | SIGBREAKF_CTRL_C);
      if (sigs & SIGBREAKF_CTRL_C)
	return;
    }
  }
}
コード例 #4
0
ファイル: gui_bgui.c プロジェクト: BackupTheBerlios/arp2-svn
void EventLoop(void) {
  ULONG signal  = NULL, rc;
  BOOL  running = TRUE;

  GetAttr( WINDOW_SigMask, WO_Window, &signal );
  if(signal) {
    do {
      if(Wait(signal | SIGBREAKF_CTRL_C) & SIGBREAKF_CTRL_C ) {
        running=FALSE;
      }

      while (( rc = HandleEvent( WO_Window )) != WMHI_NOMORE ) {
        switch(rc) {

          case WMHI_CLOSEWINDOW:
            running=FALSE;
            break;

          case ACTID_OPEN:
          {
            if(DoMethod( openreq, FRM_DOREQUEST ) == FRQ_OK) {
              char *file = NULL;

              GetAttr( FRQ_Path, openreq, (ULONG *) &file);
              NewSettings(file);
              GUINewSettings();
            }
            break;
          }

          case ACTID_SAVEAS:
          {
            FillUnit();
            if(DoMethod( savereq, FRM_DOREQUEST ) == FRQ_OK) {
              char *file = NULL;

              GetAttr( FRQ_Path, savereq, (ULONG *) &file);
              SaveSettings(file, UnitList);
              if(SaveIcons) {
                WriteIcon(file);
              }
            }
            break;
          
          }
          
          case ACTID_ABOUT:
            Req( (char *) msgButtonOK,
                (char *) msgTextCopyright,
                ISEQ_C,  msgTextProgramName,
                "1996-2003 Martin Blom" );
            break;

          case ACTID_SAVE:
            FillUnit();
            SaveSettings(ENVFILE, UnitList);
            SaveSettings(ENVARCFILE, UnitList);
            running=FALSE;
            break;

          case ACTID_USE:
            FillUnit();
            SaveSettings(ENVFILE, UnitList);
            running=FALSE;
            break;

          case ACTID_QUIT:
            running=FALSE;
            break;

          case ACTID_DEFAULT:
            NewSettings(NULL);
            GUINewSettings();
            break;

          case ACTID_LASTSAVED:
            NewSettings(ENVARCFILE);
            GUINewSettings();
            break;

          case ACTID_RESTORE:
            NewSettings(args.from);
            GUINewSettings();
            break;

          case ACTID_ICONS:
          {
            struct MenuItem *item;

            item = FindMenuItem(ACTID_ICONS);

            if(item) {
              if(item->Flags & CHECKED)
                SaveIcons = TRUE;
              else
                SaveIcons = FALSE;
            }
            break;
          }

          case ACTID_HELP: {
            APTR lock = BGUI_LockWindow(window);
            if(!BGUI_Help( window, HELPFILE, "AHI", NULL)) {
              Req( (char *) msgButtonOK, (char *) msgTextNoFind, HELPFILE);
            }
            BGUI_UnlockWindow(lock);
            break;
          }

          case ACTID_GUIDE: {
            APTR lock = BGUI_LockWindow(window);
            if(!BGUI_Help( window, HELPFILE, NULL, NULL)) {
              Req( (char *) msgButtonOK, (char *) msgTextNoFind, HELPFILE);
            }
            BGUI_UnlockWindow(lock);
            break;
          }

          case ACTID_HELPINDEX: {
            APTR lock = BGUI_LockWindow(window);
            if(!BGUI_Help( window, HELPFILE, "Concept Index", 0)) {
              Req( (char *) msgButtonOK, (char *) msgTextNoFind, HELPFILE);
            }
            BGUI_UnlockWindow(lock);
            break;
          }

          case ACTID_UNIT: {
            ULONG unit;

            FillUnit();
            GetAttr( CYC_Active, Window_Objs[rc], &unit);
            NewUnit(unit);
            GUINewUnit();
            break;
          }

          case ACTID_MODE: {
            ULONG mode;

            FillUnit();
            GetAttr( LISTV_LastClickedNum, Window_Objs[rc], &mode);
            NewMode(mode);
            GUINewMode();
            break;
          }

          case ACTID_DEBUG:
          case ACTID_SURROUND:
          case ACTID_ECHO:
          case ACTID_CPULIMIT:
          case ACTID_CLIPMV:
          {
            ULONG debug = AHI_DEBUG_NONE, surround = FALSE, echo = 0, cpu = 90;
            ULONG clip = FALSE;

            GetAttr( CYC_Active,   Window_Objs[ACTID_DEBUG],    &debug);
            GetAttr( CYC_Active,   Window_Objs[ACTID_SURROUND], &surround);
            GetAttr( CYC_Active,   Window_Objs[ACTID_ECHO],     &echo);
            GetAttr( CYC_Active,   Window_Objs[ACTID_CLIPMV],   &clip);
            GetAttr( SLIDER_Level, Window_Objs[ACTID_CPULIMIT], &cpu);

            globalprefs.ahigp_DebugLevel      = debug;
            globalprefs.ahigp_DisableSurround = surround;
            globalprefs.ahigp_DisableEcho     = (echo == 2);
            globalprefs.ahigp_FastEcho        = (echo == 1);
            globalprefs.ahigp_MaxCPU = (cpu << 16) / 100;
            globalprefs.ahigp_ClipMasterVolume= clip;

            break;
          }
        }
      }
    } while(running);
  }
}
コード例 #5
0
ファイル: ahi.c プロジェクト: BackupTheBerlios/arp2-svn
int main(int argc, char **argv) {
  struct RDArgs *rdargs = NULL;
  int i;
  char pubscreen[32];

  if(argc) {
    rdargs=ReadArgs( TEMPLATE , (LONG *) &args, NULL);
    SaveIcons  = FALSE;
  }
  else {
    struct WBStartup *WBenchMsg = (struct WBStartup *)argv;
    struct WBArg *wbarg;
    BPTR olddir;
    struct DiskObject *dobj;
    STRPTR* toolarray;
    UBYTE *s;

    SaveIcons  = TRUE;

    for(i=0, wbarg=WBenchMsg->sm_ArgList;
      i < WBenchMsg->sm_NumArgs;
      i++, wbarg++) {

      olddir = (BPTR) -1;
      if((wbarg->wa_Lock)&&(*wbarg->wa_Name))
          olddir = CurrentDir(wbarg->wa_Lock);


      if((*wbarg->wa_Name) && (dobj=GetDiskObject(wbarg->wa_Name))) {
        toolarray = dobj->do_ToolTypes;

        s = FindToolType(toolarray,"CREATEICONS");

        if( s != NULL ) {
          if( MatchToolValue(s,"NO") ||
              MatchToolValue(s,"FALSE")) {
            SaveIcons = FALSE;
          }
        }

        s = (char *) FindToolType(toolarray,"PUBSCREEN");

        if( s != NULL ) {
          strncpy(pubscreen, s, sizeof pubscreen);
          args.pubscreen = pubscreen;
        }

        s = (char *) FindToolType(toolarray,"ACTION");

        if( s != NULL ) {
          if(MatchToolValue(s,"EDIT")) {
            args.edit = TRUE;
          }
          else if(MatchToolValue(s,"USE")) {
            args.use = TRUE;
          }
          else if(MatchToolValue(s,"SAVE")) {
            args.save = TRUE;
          }
        }

        FreeDiskObject(dobj);
      }

      if((i>0)&&(*wbarg->wa_Name)) {
        args.from = wbarg->wa_Name;
      }

      if(olddir != (BPTR) -1) {
        CurrentDir(olddir); /* CD back where we were */
      }
    }
  
  }

  if(args.from == NULL) {
    args.from = ENVFILE;
  }

  if(args.edit) {
    args.use  = FALSE;
    args.save = FALSE;
  }

  if((SetSignal(0L,SIGBREAKF_CTRL_C) & SIGBREAKF_CTRL_C) == 0) {
    if(Initialize()) {

      NewSettings(args.from);

      if((!args.use && !args.save) || args.edit) {
        if(BuildGUI(args.pubscreen)) {
          EventLoop();
        }
        CloseGUI();
      }

      if(args.use || args.save) {
        SaveSettings(ENVFILE, UnitList);
      }

      if(args.save) {
        SaveSettings(ENVARCFILE, UnitList);
      }
    }
  }

  if(rdargs) {
    FreeArgs(rdargs);
  }

  FreeVec(Units);
  FreeVec(Modes);
  FreeVec(Outputs);
  FreeVec(Inputs);
  FreeList(ModeList);
  FreeList(UnitList);

  CleanUp();

  return 0;
}