Class: QT4::SearchLyricsDialog

Inherits:
BaseDialog
  • Object
show all
Defined in:
lib/wiki_lyrics/gui/gui-qt4.rb

Instance Attribute Summary

Attributes inherited from BaseDialog

#values

Instance Method Summary collapse

Methods inherited from BaseDialog

#accepted

Constructor Details

#initialize(values) ⇒ SearchLyricsDialog

Returns a new instance of SearchLyricsDialog.



762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
# File 'lib/wiki_lyrics/gui/gui-qt4.rb', line 762

def initialize( values )
	super( values )

	setWindowTitle( I18n.get( "gui.searchlyrics.title" ) )

	group = Qt::GroupBox.new( I18n.get( "gui.searchlyrics.search" ), self )

	artist_label = Qt::Label.new( I18n.get( "gui.common.artist" ), group )
	@artist_lineedit = Qt::LineEdit.new( values["artist"], group )

	title_label = Qt::Label.new( I18n.get( "gui.common.song" ), group )
	@title_lineedit = Qt::LineEdit.new( values["title"], group )

	album_label = Qt::Label.new( I18n.get( "gui.common.album" ), group )
	@album_lineedit = Qt::LineEdit.new( values["album"], group )

	year_label = Qt::Label.new( I18n.get( "gui.common.year" ), group )
	@year_spinbox = Qt::SpinBox.new( group )
	@year_spinbox.setRange( 1900, Date.today().year() )
	@year_spinbox.setValue( values["year"] )

	buttons = create_action_buttons()

	group_layout = Qt::GridLayout.new()
	group_layout.margin = 5
	group_layout.spacing = 4
	group_layout.setRowStretch( 4 , 1 )
	group_layout.addWidget( artist_label, 0, 0 )
	group_layout.addWidget( @artist_lineedit, 0, 1 )
	group_layout.addWidget( title_label, 1, 0 )
	group_layout.addWidget( @title_lineedit, 1, 1 )
	group_layout.addWidget( album_label, 2, 0 )
	group_layout.addWidget( @album_lineedit, 2, 1 )
	group_layout.addWidget( year_label, 3, 0 )
	group_layout.addWidget( @year_spinbox, 3, 1 )
	group.setLayout( group_layout )

	layout = Qt::VBoxLayout.new( self )
	layout.margin = 4
	layout.spacing = 4
	layout.addWidget( group )
	layout.addLayout( buttons )

	resize( 300, 100 )
end

Instance Method Details

#acceptObject



808
809
810
811
812
813
814
815
816
# File 'lib/wiki_lyrics/gui/gui-qt4.rb', line 808

def accept()
	@values = {
		"artist" => @artist_lineedit.text(),
		"title"  => @title_lineedit.text(),
		"album"  => @album_lineedit.text(),
		"year"   => @year_spinbox.value(),
	}
	super()
end