Ticket #9267: jump_to_random.patch
| File jump_to_random.patch, 2.3 KB (added by , 15 years ago) |
|---|
-
libs/libmythui/mythmainwindow.cpp
1041 1041 RegisterKey("Global", "PASTE", QT_TRANSLATE_NOOP("MythControls", 1042 1042 "Paste text into textedit"), "Ctrl+V"); 1043 1043 1044 RegisterKey("Global", "RANDOM", QT_TRANSLATE_NOOP("MythControls", 1045 "Jump to a random choice"), "R,F12"); 1046 1044 1047 RegisterKey("Global", "0", QT_TRANSLATE_NOOP("MythControls","0"), "0"); 1045 1048 RegisterKey("Global", "1", QT_TRANSLATE_NOOP("MythControls","1"), "1"); 1046 1049 RegisterKey("Global", "2", QT_TRANSLATE_NOOP("MythControls","2"), "2"); -
libs/libmythui/mythuibuttonlist.h
6 6 #include <QString> 7 7 #include <QVariant> 8 8 9 #include <cstdlib> 10 9 11 #include "mythuitype.h" 10 12 #include "mythuiimage.h" 11 13 #include "mythuitext.h" … … 157 159 158 160 virtual bool MoveDown(MovementUnit unit = MoveItem, uint amount = 0); 159 161 virtual bool MoveUp(MovementUnit unit = MoveItem, uint amount = 0); 162 bool MoveToRandom(); 160 163 bool MoveToNamedPosition(const QString &position_name); 161 164 162 165 void RemoveItem(MythUIButtonListItem *item); -
libs/libmythui/mythuibuttonlist.cpp
1920 1920 return true; 1921 1921 } 1922 1922 1923 bool MythUIButtonList::MoveToRandom() 1924 { 1925 if (!m_initialized) 1926 Init(); 1927 1928 if (m_selPosition < 0 || m_itemList.isEmpty() || !m_initialized) 1929 return false; 1930 1931 int newPosition = random() % m_itemList.size(); 1932 1933 if (m_selPosition == newPosition) 1934 return false; 1935 1936 SetItemCurrent(newPosition); 1937 return true; 1938 } 1939 1923 1940 bool MythUIButtonList::MoveToNamedPosition(const QString &position_name) 1924 1941 { 1925 1942 if (!m_initialized) … … 2184 2201 { 2185 2202 MoveDown(MoveMax); 2186 2203 } 2204 else if (action == "RANDOM") 2205 { 2206 MoveToRandom(); 2207 } 2187 2208 else if (action == "SELECT") 2188 2209 { 2189 2210 MythUIButtonListItem *item = GetItemCurrent();
