Ticket #5626: jump_random.patch

File jump_random.patch, 1.7 KB (added by mythtv@…, 17 years ago)

Patch to add jumpToRandom to core code

  • libs/libmyth/uitypes.cpp

     
    44524452    return false;
    44534453}
    44544454
     4455bool UIManagedTreeListType::jumpToRandom()
     4456{
     4457    if (!current_node)
     4458    {
     4459        return false;
     4460    }
     4461
     4462    //
     4463    //  Move the active node to a random node in the list
     4464    //
     4465
     4466    int position = random() % current_node->siblingCount();
     4467    GenericTree *new_node = current_node->getParent()->getChildAt(position, visual_order);
     4468
     4469    if (new_node)
     4470    {
     4471        current_node = new_node;
     4472        if (show_whole_tree)
     4473        {
     4474            for(int i = active_bin; i <= bins; i++)
     4475            {
     4476                emit requestUpdate(screen_corners[i]);
     4477            }
     4478        }
     4479        else
     4480        {
     4481            refresh();
     4482        }
     4483
     4484        emit nodeEntered(current_node->getInt(), current_node->getAttributes());
     4485        current_node->becomeSelectedChild();
     4486        return true;
     4487    }
     4488    return false;
     4489}
     4490
    44554491int UIManagedTreeListType::calculateEntriesInBin(int bin_number)
    44564492{
    44574493    //
  • libs/libmyth/uitypes.h

     
    11131113    bool    moveUpByAmount(int number_up = 1, bool do_refresh = true);
    11141114    bool    moveDown(bool do_refresh = true);
    11151115    bool    moveDownByAmount(int number_down = 1, bool do_refresh = true);
     1116    bool    jumpToRandom();
    11161117    bool    pageUp();
    11171118    bool    pageDown();
    11181119    bool    nextActive(bool wrap_around, bool traverse_up_down);