Class: Smagacor::GameMenu
- Defined in:
- lib/smagacor/smagacor-ui.rb
Overview
Widget for listing all installed games.
Instance Method Summary collapse
- #init_game_list ⇒ Object
-
#initialize(p) ⇒ GameMenu
constructor
Returns a default version of the class.
- #toggleShown ⇒ Object
Constructor Details
#initialize(p) ⇒ GameMenu
Returns a default version of the class.
53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/smagacor/smagacor-ui.rb', line 53 def initialize( p ) super( p ) @categories = {} setRootIsDecorated( true ) addColumn( "Games" ) setSorting( 0 ) setColumnWidthMode( 0, Qt::ListView::Maximum ) setShowToolTips( true ) setResizeMode( Qt::ListView::LastColumn ) setFixedWidth( 250 ) init_game_list end |
Instance Method Details
#init_game_list ⇒ Object
66 67 68 69 70 71 72 73 74 |
# File 'lib/smagacor/smagacor-ui.rb', line 66 def init_game_list clear Config.load_games Config.games.each do |game| @categories[game.category] ||= Qt::ListViewItem.new( self, game.category ) item = GameMenuItem.new( @categories[game.category], game ) item.setPixmap( 0, Qt::Pixmap.new( File.join( game.directory, game.icon ) ) ) end end |
#toggleShown ⇒ Object
76 77 78 |
# File 'lib/smagacor/smagacor-ui.rb', line 76 def toggleShown if isShown then hide else show end end |