Class: QT3::UploadCoverDialog
- Inherits:
-
BaseDialog
- Object
- Qt::Dialog
- BaseDialog
- QT3::UploadCoverDialog
- Defined in:
- lib/wiki_lyrics/gui/gui-qt3.rb
Instance Attribute Summary
Attributes inherited from BaseDialog
Instance Method Summary collapse
- #accept ⇒ Object
- #browse_image ⇒ Object
-
#initialize(values) ⇒ UploadCoverDialog
constructor
A new instance of UploadCoverDialog.
Methods inherited from BaseDialog
Constructor Details
#initialize(values) ⇒ UploadCoverDialog
Returns a new instance of UploadCoverDialog.
566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 |
# File 'lib/wiki_lyrics/gui/gui-qt3.rb', line 566 def initialize( values ) super( values ) setCaption( I18n.get( "gui.uploadcover.title", values["site_name"] ) ) album_group = Qt::GroupBox.new( 2, Qt::Horizontal, I18n.get( "gui.common.album" ), self ) Qt::Label.new( I18n.get( "gui.common.artist" ), album_group ) @artist_lineedit = Qt::LineEdit.new( values["artist"], album_group ) Qt::Label.new( I18n.get( "gui.common.album" ), album_group ) @album_lineedit = Qt::LineEdit.new( values["album"], album_group ) Qt::Label.new( I18n.get( "gui.common.year" ), album_group ) @year_spinbox = Qt::SpinBox.new( album_group ) @year_spinbox.setMinValue( 1900 ) @year_spinbox.setMaxValue( Date.today().year() ) @year_spinbox.setValue( values["year"] ) image_group = Qt::GroupBox.new( 3, Qt::Horizontal, I18n.get( "gui.common.image" ), self ) Qt::Label.new( I18n.get( "gui.uploadcover.imagepath" ), image_group ) @image_path_lineedit = Qt::LineEdit.new( values["image_path"], image_group ) @image_path_lineedit.setText( values["image_path"] ) @image_button = Qt::PushButton.new( "...", image_group ) connect( @image_button, SIGNAL( "clicked()" ), self, SLOT( "browse_image()" ) ) = () layout = Qt::VBoxLayout.new( self, 5 ) layout.addWidget( album_group ) layout.addWidget( image_group ) layout.addLayout( ) resize( 400, 100 ) end |
Instance Method Details
#accept ⇒ Object
624 625 626 627 628 629 630 631 632 |
# File 'lib/wiki_lyrics/gui/gui-qt3.rb', line 624 def accept() @values = { "artist" => @artist_lineedit.text(), "album" => @album_lineedit.text(), "year" => @year_spinbox.value(), "image_path" => @image_path_lineedit.text() } super() end |
#browse_image ⇒ Object
605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 |
# File 'lib/wiki_lyrics/gui/gui-qt3.rb', line 605 def browse_image() dirname = @image_path_lineedit.text().strip() dirname = QT3.empty_string?( dirname ) ? (ENV["HOME"] ? ENV["HOME"] : ".") : File.dirname( dirname ) dialog = Qt::FileDialog.new( dirname, I18n.get( "gui.uploadcover.browseimage.images" ) + " (*.jpg *.JPG *.png *.PNG *.bmp *.BMP);;" + I18n.get( "gui.uploadcover.browseimage.allfiles" ) + " (*)", self, nil, true ) dialog.setCaption( I18n.get( "gui.uploadcover.browseimage.title" ) ) dialog.setMode( Qt::FileDialog::ExistingFile ) if dialog.exec() == Qt::Dialog::Accepted image_path = dialog.selectedFile() @image_path_lineedit.setText( image_path.strip() ) if ! QT3.empty_string?( image_path ) end end |