Ejemplo n.º 1
0
/*=macfunc ENDWHILE
 *
 *  what:   Terminate the @code{WHILE} Template Block
 *  in-context:
 *
 *  desc:
 *    This macro ends the @code{WHILE} function template block.
 *    For a complete description @xref{WHILE}.
=*/
tMacro*
mFunc_While(tTemplate* pT, tMacro* pMac)
{
    tMacro* pRet = pT->aMacros + pMac->endIndex;
    int     ct   = 0;

    if (OPT_VALUE_TRACE >= TRACE_BLOCK_MACROS)
        fprintf(pfTrace, TRACE_FN_WHILE_START,
                pCurTemplate->pzTemplText + pCurMacro->ozText,
                pT->pzTplFile, pMac->lineNo);

    for (;;) {
        pCurTemplate = pT;
        pCurMacro    = pMac;

        if (! eval_true())
            break;
        ct++;
        generateBlock(pT, pMac+1, pT->aMacros + pMac->sibIndex);
    }

    if (OPT_VALUE_TRACE >= TRACE_BLOCK_MACROS) {
        fprintf(pfTrace, TRACE_FN_WHILE_END, ct);

        if (OPT_VALUE_TRACE == TRACE_EVERYTHING)
            fprintf(pfTrace, TAB_FILE_LINE_FMT, pT->pzTplFile, pMac->lineNo);
    }

    return pRet;
}
Ejemplo n.º 2
0
void dMap::generateMap()
{
  for(int i=0; i<4; i++)
    mOpenTop[0][i] = 0;
  
  for(int i=1; i<3; i++)
  {
    for(int j=0; j<4; j++)
      mOpenTop[i][j] = mOpenBottom[i-1][j] = random(0,1);
    if(!mOpenTop[i][0] && !mOpenTop[i][1] && !mOpenTop[i][2] && !mOpenTop[i][3])
      i--;
  }
  
  do
  {
    for(int j=0; j<3; j++)
      mOpenBottom[2][j] = random(0,1);
  } while(!mOpenBottom[2][0] && !mOpenBottom[2][1] && !mOpenBottom[2][2] && !mOpenBottom[2][3]);

  /*for(int i=0; i<4; i++)
  {
    mOpenTop[0][i] = 0;
    mOpenBottom[2][i] = random(0,1);

    for(int j=1; j<3; j++)
      mOpenTop[j][i] = mOpenBottom[j-1][i] = random(0,1);
  }*/
  
  for(int i=0; i<3; i++)
    generateBlock(i);
}
Ejemplo n.º 3
0
/*=macfunc INCLUDE
 *
 *  what:   Read in and emit a template block
 *  handler_proc:
 *  load_proc:
 *
 *  desc:
 *
 *  The entire contents of the named file is inserted at this point.
 *  The contents of the file are processed for macro expansion.  The
 *  arguments are eval-ed, so you may compute the name of the file to
 *  be included.  The included file must not contain any incomplete
 *  function blocks.  Function blocks are template text beginning with
 *  any of the macro functions @samp{CASE}, @samp{DEFINE}, @samp{FOR},
 *  @samp{IF} and @samp{WHILE}; extending through their respective
 *  terminating macro functions.
=*/
tMacro*
mFunc_Include(tTemplate* pT, tMacro* pMac)
{
    tTemplate *   pNewTpl;
    ag_bool       needFree;
    char const *  pzFile = evalExpression(&needFree);
    tMacro*       pM;

    if (*pzFile != NUL) {
        pNewTpl = loadTemplate(pzFile, pT->pzTplFile);

        /*
         *  Strip off trailing white space from included templates
         */
        pM = pNewTpl->aMacros + (pNewTpl->macroCt - 1);
        if (pM->funcCode == FTYP_TEXT) {
            char* pz  = pNewTpl->pzTemplText + pM->ozText;
            char* pzE = pz + strlen(pz);
            while ((pzE > pz) && IS_WHITESPACE_CHAR(pzE[-1]))  --pzE;

            /*
             *  IF there is no text left, remove the macro entirely
             */
            if (pz == pzE)
                 pNewTpl->macroCt--;
            else *pzE = NUL;
        }

        if (OPT_VALUE_TRACE > TRACE_DEBUG_MESSAGE) {
            fprintf(pfTrace, TRACE_FN_INC_TPL, pNewTpl->pzTplFile);
            if (OPT_VALUE_TRACE == TRACE_EVERYTHING)
                fprintf(pfTrace, TRACE_FN_INC_LINE, pCurTemplate->pzTplFile,
                        pMac->lineNo);
        }

        generateBlock(pNewTpl, pNewTpl->aMacros,
                      pNewTpl->aMacros + pNewTpl->macroCt);
        unloadTemplate(pNewTpl);
        pCurTemplate = pT;
    }

    if (needFree)
        AGFREE((void*)pzFile);

    return pMac + 1;
}
Ejemplo n.º 4
0
/*=macfunc ENDIF
 *
 *  what:   Terminate the @code{IF} Template Block
 *  in-context:
 *
 *  desc:
 *    This macro ends the @code{IF} function template block.
 *    For a complete description @xref{IF}.
=*/
tMacro*
mFunc_If(tTemplate* pT, tMacro* pMac)
{
    tMacro* pRet = pT->aMacros + pMac->endIndex;
    tMacro* pIf  = pMac;

    do  {
        /*
         *  The current macro becomes the 'ELIF' or 'ELSE' macro
         */
        pCurMacro = pMac;

        /*
         *  'ELSE' is equivalent to 'ELIF true'
         */
        if (  (pMac->funcCode == FTYP_ELSE)
           || eval_true()) {

            if (OPT_VALUE_TRACE >= TRACE_BLOCK_MACROS) {
                fprintf(pfTrace, TRACE_FN_IF, (pMac->funcCode == FTYP_ELSE)
                        ? FN_IF_ELSE : pT->pzTemplText + pMac->ozText,
                        pMac->lineNo);

                if (OPT_VALUE_TRACE == TRACE_EVERYTHING)
                    fprintf(pfTrace, TAB_FILE_LINE_FMT,
                            pCurTemplate->pzTplFile, pIf->lineNo);
            }

            generateBlock(pT, pMac+1, pT->aMacros + pMac->sibIndex);
            break;
        }
        pMac = pT->aMacros + pMac->sibIndex;
    } while (pMac < pRet);

    if ((OPT_VALUE_TRACE >= TRACE_BLOCK_MACROS) && (pMac >= pRet)) {
        fprintf(pfTrace, TRACE_FN_IF_NOTHING,
                pCurTemplate->pzTemplText + pCurMacro->ozText);

        if (OPT_VALUE_TRACE == TRACE_EVERYTHING)
            fprintf(pfTrace, TAB_FILE_LINE_FMT,
                    pCurTemplate->pzTplFile, pIf->lineNo);
    }

    return pRet;
}
Ejemplo n.º 5
0
/*=macfunc ESAC
 *
 *  what:   Terminate the @code{CASE} Template Block
 *  in-context:
 *
 *  desc:
 *    This macro ends the @code{CASE} function template block.
 *    For a complete description, @xref{CASE}.
=*/
tMacro*
mFunc_Case(tTemplate* pT, tMacro* pMac)
{
    typedef tSuccess (t_match_proc)(char const *, char const *);
    /*
     *  There are only 15 procedures because the case insenstive matching
     *  get mapped into the previous four.  The last three are "match always",
     *  "match if a value was found" "match if no value found".
     */
    static t_match_proc * const match_procs[] = {
        &Select_Compare_Full,
        &Select_Compare_End,
        &Select_Compare_Start,
        &Select_Compare,

        &Select_Equivalent_Full,
        &Select_Equivalent_End,
        &Select_Equivalent_Start,
        &Select_Equivalent,

        &Select_Match_Full,
        &Select_Match_End,
        &Select_Match_Start,
        &Select_Match,

        &Select_Match_Always,
        &Select_Match_Existence,
        &Select_Match_NonExistence
    };

    static char const * const match_names[] = {
        "COMPARE_FULL",
        "COMPARE_END",
        "COMPARE_START",
        "CONTAINS",

        "EQUIVALENT_FULL",
        "EQUIVALENT_END",
        "EQUIVALENT_START",
        "EQUIV_CONTAINS",

        "MATCH_FULL",
        "MATCH_END",
        "MATCH_START",
        "MATCH_WITHIN",

        "MATCH_ALWAYS",
        "MATCH_EXISTENCE",
        "MATCH_NONEXISTENCE"
    };

    tMacro*   pEnd = pT->aMacros + pMac->endIndex;
    ag_bool needFree;
    char const * pzSampleText = evalExpression(&needFree);

    /*
     *  Search through the selection clauses until we either
     *  reach the end of the list for this CASE macro, or we match.
     */
    for (;;) {
        tSuccess mRes;
        pMac = pT->aMacros + pMac->sibIndex;
        if (pMac >= pEnd) {
            if (OPT_VALUE_TRACE >= TRACE_BLOCK_MACROS) {
                fprintf(pfTrace, "CASE string `%s' did not match\n",
                        pzSampleText);

                if (OPT_VALUE_TRACE == TRACE_EVERYTHING)
                    fprintf(pfTrace, zFileLine, pCurTemplate->pzTplFile,
                            pMac->lineNo);
            }

            break;
        }

        /*
         *  The current macro becomes the selected selection macro
         */
        pCurMacro = pMac;
        mRes = (*(match_procs[pMac->funcCode & 0x0F])
               )(pzSampleText, pT->pzTemplText + pMac->ozText);

        /*
         *  IF match, THEN generate and stop looking for a match.
         */
        if (SUCCEEDED(mRes)) {
            if (OPT_VALUE_TRACE >= TRACE_BLOCK_MACROS) {
                fprintf(pfTrace, "CASE string `%s' %s matched `%s'\n",
                        pzSampleText,
                        match_names[pMac->funcCode & 0x0F],
                        pT->pzTemplText + pMac->ozText);

                if (OPT_VALUE_TRACE == TRACE_EVERYTHING)
                    fprintf(pfTrace, zFileLine, pCurTemplate->pzTplFile,
                            pMac->lineNo);
            }

            generateBlock(pT, pMac + 1, pT->aMacros + pMac->sibIndex);
            break;
        }
        else if (OPT_VALUE_TRACE == TRACE_EVERYTHING) {
            fprintf(pfTrace, "CASE no match: `%s' %s vs. `%s'\n",
                    pzSampleText,
                    match_names[pMac->funcCode & 0x0F],
                    pT->pzTemplText + pMac->ozText);
        }
    }

    if (needFree)
        AGFREE((void*)pzSampleText);

    return pEnd;
}
Ejemplo n.º 6
0
LOCAL void
processTemplate(tTemplate* pTF)
{
    forInfo.fi_depth = 0;

    /*
     *  IF the template file does not specify any output suffixes,
     *  THEN we will generate to standard out with the suffix set to zNoSfx.
     *  With output going to stdout, we don't try to remove output on errors.
     */
    if (pOutSpecList == NULL) {
        do_stdout_tpl(pTF);
        return;
    }

    do  {
        tOutSpec*  pOS    = pOutSpecList;

        /*
         * We cannot be in Scheme processing.  We've either just started
         * or we've made a long jump from our own code.  If we've made a
         * long jump, we've printed a message that is sufficient and we
         * don't need to print any scheme expressions.
         */
        pzLastScheme = NULL;

        /*
         *  HOW was that we got here?
         */
        switch (setjmp(fileAbort)) {
        case SUCCESS:
            if (OPT_VALUE_TRACE >= TRACE_EVERYTHING) {
                fprintf(pfTrace, PROC_TPL_START, pOS->zSuffix);
                fflush(pfTrace);
            }
            /*
             *  Set the output file name buffer.
             *  It may get switched inside open_output.
             */
            open_output(pOS);
            memcpy(&fpRoot, pCurFp, sizeof(fpRoot));
            AGFREE(pCurFp);
            pCurFp         = &fpRoot;
            pzCurSfx       = pOS->zSuffix;
            currDefCtx     = rootDefCtx;
            pCurFp->flags &= ~FPF_FREE;
            pCurFp->pPrev  = NULL;
            generateBlock(pTF, pTF->aMacros, pTF->aMacros + pTF->macroCt);

            do  {
                out_close(AG_FALSE);  /* keep output */
            } while (pCurFp->pPrev != NULL);
            break;

        case PROBLEM:
            /*
             *  We got here by a long jump.  Close/purge the open files.
             */
            do  {
                out_close(AG_TRUE);  /* discard output */
            } while (pCurFp->pPrev != NULL);
            pzLastScheme = NULL; /* "problem" means "drop current output". */
            break;

        default:
            fprintf(pfTrace, PROC_TPL_BOGUS_RET, pzOopsPrefix);
            pzOopsPrefix = zNil;
            /* FALLTHROUGH */

        case FAILURE:
            /*
             *  We got here by a long jump.  Close/purge the open files.
             */
            do  {
                out_close(AG_TRUE);  /* discard output */
            } while (pCurFp->pPrev != NULL);

            /*
             *  On failure (or unknown jump type), we quit the program, too.
             */
            procState = PROC_STATE_ABORTING;
            do pOS = nextOutSpec(pOS);
            while (pOS != NULL);
            exit(EXIT_FAILURE);
        }

        pOutSpecList = nextOutSpec(pOS);
    } while (pOutSpecList != NULL);
}
Ejemplo n.º 7
0
/**
 *  The template output goes to stdout.  Perhaps because output
 *  is for a CGI script.  In any case, this case must be handled
 *  specially.
 */
static void
do_stdout_tpl(tTemplate * pTF)
{
    char   const *    pzRes;
    SCM    res;

    pzLastScheme = NULL; /* We cannot be in Scheme processing */

    switch (setjmp (fileAbort)) {
    case SUCCESS:
        break;

    case PROBLEM:
        if (*pzOopsPrefix != NUL) {
            fprintf(stdout, DO_STDOUT_TPL_ABANDONED, pzOopsPrefix);
            pzOopsPrefix = zNil;
        }
        fclose(stdout);
        return;

    default:
        fprintf(stdout, DO_STDOUT_TPL_BADR, pzOopsPrefix);

    case FAILURE:
        exit(EXIT_FAILURE);
    }

    pzCurSfx      = DO_STDOUT_TPL_NOSFX;
    currDefCtx    = rootDefCtx;
    pCurFp        = &fpRoot;
    fpRoot.pFile  = stdout;
    fpRoot.pzOutName = DO_STDOUT_TPL_STDOUT;
    fpRoot.flags  = FPF_NOUNLINK | FPF_STATIC_NM;
    if (OPT_VALUE_TRACE >= TRACE_EVERYTHING)
        fputs(DO_STDOUT_TPL_START_STD, pfTrace);

    /*
     *  IF there is a CGI prefix for error messages,
     *  THEN divert all output to a temporary file so that
     *  the output will be clean for any error messages we have to emit.
     */
    if (*pzOopsPrefix == NUL)
        generateBlock(pTF, pTF->aMacros, pTF->aMacros + pTF->macroCt);

    else {
        (void)ag_scm_out_push_new(SCM_UNDEFINED);

        generateBlock(pTF, pTF->aMacros, pTF->aMacros + pTF->macroCt);

        /*
         *  Read back in the spooled output.  Make sure it starts with
         *  a content-type: prefix.  If not, we supply our own HTML prefix.
         */
        res   = ag_scm_out_pop(SCM_BOOL_T);
        pzRes = AG_SCM_CHARS(res);

        /* 13:  "content-type:" */
        if (strneqvcmp(pzRes, DO_STDOUT_TPL_CONTENT, 13) != 0)
            fputs(DO_STDOUT_TPL_CONTENT, stdout);

        fwrite(pzRes, AG_SCM_STRLEN(res), (size_t)1, stdout);
    }

    fclose(stdout);
}
QList<PreferencePanelBlock> KNPreferencePanelData::getPanelData(
        int panelIndex)
{
    //Prepare the panel data and block data cache.
    QList<PreferencePanelBlock> panelData;
    PreferencePanelBlock block;
    //Check the panel.
    switch(panelIndex)
    {
    case PanelGeneral:
    {
#ifdef Q_OS_WIN
        //System Tray Settings.
        block=generateBlock(tr("System Tray Icon"));
        addItem(block, tr("Minimize to system tray"),
                "User/Global/SystemTray/MinimizeToTray", false, TypeBoolean,
                tr("When click the minimize button of the window, Mu won't "
                   "simply minimize the main window to task bar but minimize "
                   "to the system tray.\n"
                   "When click the icon in the system tray, Mu will pop up "
                   "back."),
                false);
        addItem(block, tr("Close to system tray"),
                "User/Global/SystemTray/CloseToTray", false, TypeBoolean,
                tr("When click the close button of the window, Mu won't quit "
                   "but minimize to the system tray.\n"
                   "When click the icon in the system tray, Mu will pop up "
                   "back."),
                false);
        panelData.append(block);
#endif
        //Appearance settings.
        block=generateBlock(tr("Appearance"));
        addFontItem(block, tr("Application font"),
                    "User/Global/ApplicationFont", QApplication::font(),
                    tr("This option will change the font used for the whole "
                       "application.\n"
                       "This option will be applied after the application "
                       "restarted."), false, false, false);
        addItem(block, tr("Show status bar"),
                "User/Global/Appearance/ShowStatusBar", true, TypeBoolean,
                tr("Show the status bar at the top right corner."), false);
        panelData.append(block);
        //Behaviour settings.
        block=generateBlock(tr("Behaviour"), true);
        addIntItem(block, tr("Search delay (ms)"),
                   "User/Global/Behaviour/SearchDelay", 150,
                   tr("Mu will start to search once user change the content of "
                      "the search box.\nWhen set the delay larger than 0ms, Mu "
                      "will not start to search if user change the text less "
                      "than the delay duration."),
                   0, 500, false);
        panelData.append(block);
        //Library settings.
        block=generateBlock(tr("Library"));
        addItem(block, tr("Ignore CUE data file"),
                "User/Music/MusicLibrary/IgnoreCueData", true, TypeBoolean,
                tr("When adding the data file of one CUE file, "
                   "ignore the data file."), false);
        addItem(block, tr("Category by album artist"),
                "User/Music/MusicLibrary/UseAlbumArt", true, TypeBoolean,
                tr("When category the album, use the album artist metadata "
                   "field instead of statistic all the artists.\n"
                   "This option will be applied after the application "
                   "restarted."), true);
        panelData.append(block);
        break;
    }
    case PanelPlayback:
    {
        //Playing parameters.
        block=generateBlock(tr("Output Parameter"));
#ifdef Q_OS_WIN64
        addItem(block, tr("Use exclusive mode WASAPI"),
                "System/Backend/WASAPI", false, TypeBoolean,
                tr("Using WASAPI with exclusive mode instead of DirectX for "
                   "sound output.\nWhen this feature is enabled, the output "
                   "sample rate will be changed to the sample rate of the real "
                   "device.\nWhen this feature is enabled, all the music "
                   "preview feature will be disabled.\nThis option will be "
                   "applied after the application restarted."), false);
#endif
        addItem(block, tr("Use 32-bit float point"),
                "System/Backend/Float", true, TypeBoolean,
                tr("Produce 32-bit floating-point output.\nWDM drivers are "
                   "required to use this feature in Windows.\nThis option will"
                   " be applied after the application restarted."), false);
        addItem(block, tr("Use Buffer"),
                "System/Backend/Buffer", true, TypeBoolean,
                tr("Enable the playback buffering.\nA playing music is "
                   "normally asked to render data to its playback buffer in "
                   "advance to produce the final signal that is given to the "
                   "output device.\nWhen this option is off, buffering is "
                   "skipped and the playing thread will only be asked to "
                   "produce data as it is needed during the generation of the "
                   "output data.\nThis option will"
                   " be applied after the application restarted."), false);
        addIntItem(block, tr("Buffer Length"),
                   "System/Backend/BufferLength", 500,
                   tr("The buffer length in milliseconds.\n"
                      "Increasing the length, decreases the chance of the "
                      "sound possibly breaking-up on slower computers, \nbut "
                      "also increases the latency for DSP/FX.\nThis option "
                      "will be applied after the application restarted."),
                   10, 5000, false);
        addItem(block, tr("Force Stereo Output"),
                "System/Backend/Stero", false, TypeBoolean,
                tr("Limit the output to stereo, saving some CPU if the device "
                   "has more speakers available.\nThis option will be applied "
                   "after the application restarted."), true);
        addItem(block, tr("Output Device"),
                "System/Backend/OutputDevice", QVariant(), TypeAudioDevice,
                tr("Select the audio output device for music playing.\nThis "
                   "option will be applied after the application restarted."),
                false);
        QStringList sampleRates;
        QString defaultSampleRate=tr("Use Device Default Sample Rate");
        sampleRates << defaultSampleRate << "8000" << "11025" << "22050"
                    << "32000" << "44100" << "47250" << "48000" << "50000"
                    << "50400" << "96000" << "192000";
        addComboItem(block, tr("Sample Rate (Hz)"),
                     "System/Backend/SampleRate", defaultSampleRate,
                     tr("This option will change the output sample rate of the "
                        "playback backend.\nThis option will be applied after "
                        "the application restarted."),
                     sampleRates, false, true);
        panelData.append(block);
        //Playing parameters.
        block=generateBlock(tr("Player Parameters"));
        addIntItem(block, tr("Volume Level (%)"),
                   "User/Backend/VolumeLevel", 10,
                   tr("Mu supports changing volume via shortcut key or mouse "
                      "scroll wheel.\nThis option could change the volume size "
                      "increase or decrease for each shortcut pressing and "
                      "wheel scrolling.\nThe minimum size is 1%, the maximum "
                      "size is 20%."),
                   1, 20, false);
        panelData.append(block);
        break;
    }
    case PanelLyrics:
    {
        //Header lyrics.
        block=generateBlock(tr("Header Lyrics"));
        addFontItem(block, tr("Header lyrics font"),
                    "User/Music/MusicHeaderPlayer/Lyrics/Font",
                    QApplication::font(),
                    tr("This option will change the font used on the header "
                       "player lyrics."), true, true, false);
        addIntItem(block, tr("Header lyrics spacing"),
                   "User/Music/MusicHeaderPlayer/Lyrics/Spacing", 2,
                   tr("This option will change the spacing of the text line on "
                      "the header player lyrics."), 1, 20, true);
        panelData.append(block);
        //Online lyrics.
        block=generateBlock(tr("Online Lyrics"));
        addItem(block, tr("Allow downloading lyrics"),
                "User/Music/Lyrics/Online/Enable", true, TypeBoolean,
                tr("If there is no lyrics existed in the lyrics search folder,"
                   "\nallows Mu to download lyrics from the Internet."), false);
        addItem(block, tr("Combine translation"),
                "User/Music/Lyrics/Online/CombineTranslation", false,
                TypeBoolean,
                tr("Some lyrics downloader will provide translated version. \n"
                   "This option will allow Mu to combine the translated version"
                   " and the raw lyrics into a single file."), false);
        panelData.append(block);
        break;
    }
    case PanelShortcuts:
    {
        //Global shortcut settings.
        block=generateBlock(tr("Global Shortcut"));
        addItem(block, tr("Use global shortcut"),
                "User/Shortcut/Global", false, TypeBoolean,
                tr("Allow the shortcut key bindings to be triggered system "
                   "wide."), false);
        panelData.append(block);
        //Main window controls.
        block=generateBlock(tr("Window Controls"));
        addItem(block, tr("Full Screen"),
                "User/Shortcut/FullScreen",
                QVariant::fromValue(QKeySequence(QKeySequence::FullScreen)),
                TypeShortcut,
                tr("This shortcut will be used to control the shortcut for "
                   "entering or exiting the full screen state."), false);
        panelData.append(block);
        //Playback controls.
        block=generateBlock(tr("Playing Controls"));
        addItem(block, tr("Play and Pause"),
                "User/Shortcut/PlayNPause",
                QVariant::fromValue(QKeySequence(Qt::Key_F8,
                                                 Qt::Key_MediaTogglePlayPause)),
                TypeShortcut,
                tr("This shortcut will be used in the whole application to "
                   "play or pause the current playing music."), false);
        addItem(block, tr("Previous Song"),
                "User/Shortcut/Previous",
                QVariant::fromValue(QKeySequence(Qt::Key_F7,
                                                 Qt::Key_MediaPrevious)),
                TypeShortcut,
                tr("This shortcut will be used in the whole application to "
                   "switch the current playing music to the previous song."),
                false);
        addItem(block, tr("Next Song"),
                "User/Shortcut/Next",
                QVariant::fromValue(QKeySequence(Qt::Key_F9,
                                                 Qt::Key_MediaNext)),
                TypeShortcut,
                tr("This shortcut will be used in the whole application to "
                   "switch the current playing music to the next song."),
                false);
        panelData.append(block);
        //Volume controls.
        block=generateBlock(tr("Volume Controls"));
        addItem(block, tr("Mute"),
                "User/Shortcut/Mute",
                QVariant::fromValue(QKeySequence()),
                TypeShortcut,
                tr("This shortcut will be used in the whole application to "
                   "enter and exit the mute state."), false);
        addItem(block, tr("Volume Up"),
                "User/Shortcut/VolumeUp",
                QVariant::fromValue(QKeySequence()),
                TypeShortcut,
                tr("This shortcut will be used in the whole application to "
                   "increase amount of volume."), false);
        addItem(block, tr("Volume Down"),
                "User/Shortcut/VolumeDown",
                QVariant::fromValue(QKeySequence()),
                TypeShortcut,
                tr("This shortcut will be used in the whole application to "
                   "decrease amount of volume."), false);
        panelData.append(block);
        break;
    }
    case PanelFileAsso:
    {
        //For some quick controls.
        block=generateBlock(tr("Auto Set File Types Association"));
        panelData.append(block);
        block=generateBlock(tr("Lossless Compressed File Types"));
        addFileTypeItem(block, "ape", "", QVariant(), "",
                        ".ape", "org.kreogist.monkeysaudio-format", false);
        addFileTypeItem(block, "caf", "", QVariant(), "",
                        ".caf", "com.apple.coreaudio-format", false);
        addFileTypeItem(block, "dsd", "", QVariant(), "",
                        ".dsd", "org.kreogist.dsd-format", false);
        addFileTypeItem(block, "flac", "", QVariant(), "",
                        ".flac", "org.kreogist.flac-format", false);
        addFileTypeItem(block, "tta", "", QVariant(), "",
                        ".tta", "org.kreogist.trueaudio-format", false);
        addFileTypeItem(block, "wav", "", QVariant(), "",
                        ".wav", "com.microsoft.waveform-audio", false);
        addFileTypeItem(block, "wv", "", QVariant(), "",
                        ".wv", "org.kreogist.wavpack-audio", false);
        panelData.append(block);
        block=generateBlock(tr("Lossy Compressed File Types"));
        addFileTypeItem(block, "aac", "", QVariant(), "",
                        ".aac", "public.aac-audio", false);
        addFileTypeItem(block, "ac3", "", QVariant(), "",
                        ".ac3", "public.ac3-audio", false);
        addFileTypeItem(block, "aiff", "", QVariant(), "",
                        ".aiff", "public.aiff-audio", false);
        addFileTypeItem(block, "mp1", "", QVariant(), "",
                        ".mp1", "public.mp1", false);
        addFileTypeItem(block, "mp2", "", QVariant(), "",
                        ".mp2", "public.mp2", false);
        addFileTypeItem(block, "mp3", "", QVariant(), "",
                        ".mp3", "public.mp3", false);
        addFileTypeItem(block, "mpc", "", QVariant(), "",
                        ".mpc", "org.kreogist.musepack-format", false);
        addFileTypeItem(block, "ofr", "", QVariant(), "",
                        ".ofr", "org.kreogist.optimfrog-format", false);
        addFileTypeItem(block, "opus", "", QVariant(), "",
                        ".opus", "org.kreogist.opus-format", false);
        addFileTypeItem(block, "spx", "", QVariant(), "",
                        ".spx", "org.kreogist.speex-format", false);
        panelData.append(block);
        block=generateBlock(tr("Other File Types Association"));
        addFileTypeItem(block, "m4a", "", QVariant(), "",
                        ".m4a", "com.apple.m4a-audio", false);
        addFileTypeItem(block, "mid", "", QVariant(), "",
                        ".mid", "public.midi-audio", false);
        addFileTypeItem(block, "midi", "", QVariant(), "",
                        ".midi", "public.midi-audio", false);
        addFileTypeItem(block, "ogg", "", QVariant(), "",
                        ".ogg", "org.kreogist.ogg-format", false);
#ifdef Q_OS_WIN
        addFileTypeItem(block, "wma", "", QVariant(), "",
                        ".wma", "com.microsoft.windows-media-wma", false);
#endif
        panelData.append(block);
        break;
    }
    default:
        break;
    }
    //Give back the panel data.
    return panelData;
}
Ejemplo n.º 9
0
uint8_t RandomNumberGenerator::generateByte()
{
	uint8_t result;
	generateBlock(&result, 1);
	return result;
}
Ejemplo n.º 10
0
void CBlockMgr::makeBlock()
{	
	srand(GetTickCount());
	generateBlock((int *)block,NUM_OF_BLOCK_CREATION);	
}
Ejemplo n.º 11
0
void dMap::shiftUp()
{
  mDepth += 20;
  for(int i=0; i<40; i++)
    for(int j=0; j<30; j++)
    {
      delete mMap[i][j];
      mMap[i][j] = mMap[i][j+15];
      mMap[i][j+15] = NULL;
      mVisible[i][j] = mVisible[i][j+15];
    }

  for(int i=0; i<40; i++)
    for(int j=30; j<45; j++)
      mVisible[i][j] = 0;

  for(deque<dNPC*>::iterator i = mMonsters.begin(); i != mMonsters.end(); i++)
    (*i)->getY() -= 15;

  for(deque<dItem*>::iterator i = mItems.begin(); i != mItems.end(); i++)
  {
    (*i)->getY() -= 15;
    if((*i)->getY() < 0)
    {
      delete (*i);
      *i = NULL;
    }
  }

  while(1)
  {
    deque<dItem*>::iterator i;
    for(i = mItems.begin(); i != mItems.end(); i++)
    {
      if(!(*i))
      {
        mItems.erase(i);
        break;
      }
    }
    if(i == mItems.end())
      break;
  }

  for(int i=0; i<2; i++)
    for(int j=0; j<4; j++)
    {
      mOpenTop[i][j] = mOpenTop[i+1][j];
      mOpenBottom[i][j] = mOpenBottom[i+1][j];
    }

  for(int j=0; j<4; j++)
    mOpenTop[2][j] = mOpenBottom[2][j];

  if(mDepth == DMAX_DEPTH)
    mOpenBottom[2][0] = mOpenBottom[2][1] = mOpenBottom[2][2] = mOpenBottom[2][3] = false;
  else do
  {
    for(int j=0; j<3; j++)
      mOpenBottom[2][j] = random(0,1);
  } while(!mOpenBottom[2][0] && !mOpenBottom[2][1] && !mOpenBottom[2][2] && !mOpenBottom[2][3]);

  generateBlock(2);
}