vlc | branch: master | Francois Cartegnie <[email protected]> | Fri Apr 4 08:14:05 2014 +0200| [64c4b59ca7c5908cf16d21d3c6afbd9284bc7ce8] | committer: Francois Cartegnie
Qt: don't allow empty file on convert dialog (fix #11072) > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=64c4b59ca7c5908cf16d21d3c6afbd9284bc7ce8 --- modules/gui/qt4/dialogs/convert.cpp | 10 +++++++++- modules/gui/qt4/dialogs/convert.hpp | 3 +++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/modules/gui/qt4/dialogs/convert.cpp b/modules/gui/qt4/dialogs/convert.cpp index 62cf840..2674928 100644 --- a/modules/gui/qt4/dialogs/convert.cpp +++ b/modules/gui/qt4/dialogs/convert.cpp @@ -105,7 +105,7 @@ ConvertDialog::ConvertDialog( QWidget *parent, intf_thread_t *_p_intf, mainLayout->addWidget( settingBox, 1, 0, 1, -1 ); /* Buttons */ - QPushButton *okButton = new QPushButton( qtr( "&Start" ) ); + okButton = new QPushButton( qtr( "&Start" ) ); QPushButton *cancelButton = new QPushButton( qtr( "&Cancel" ) ); QDialogButtonBox *buttonBox = new QDialogButtonBox; @@ -121,6 +121,9 @@ ConvertDialog::ConvertDialog( QWidget *parent, intf_thread_t *_p_intf, CONNECT( convertRadio, toggled(bool), convertPanel, setEnabled(bool) ); CONNECT(profile, optionsChanged(), this, setDestinationFileExtension()); CONNECT(fileLine, editingFinished(), this, setDestinationFileExtension()); + CONNECT(fileLine, textChanged(const QString&), this, validate()); + + validate(); } void ConvertDialog::fileBrowse() @@ -182,3 +185,8 @@ void ConvertDialog::setDestinationFileExtension() } } } + +void ConvertDialog::validate() +{ + okButton->setEnabled( !fileLine->text().isEmpty() ); +} diff --git a/modules/gui/qt4/dialogs/convert.hpp b/modules/gui/qt4/dialogs/convert.hpp index a2e8296..c2b6a38 100644 --- a/modules/gui/qt4/dialogs/convert.hpp +++ b/modules/gui/qt4/dialogs/convert.hpp @@ -29,6 +29,7 @@ class QLineEdit; class QCheckBox; class QRadioButton; +class QPushButton; class VLCProfileSelector; class ConvertDialog : public QVLCDialog @@ -45,6 +46,7 @@ private: QCheckBox *displayBox, *deinterBox; QRadioButton *dumpRadio; + QPushButton *okButton; VLCProfileSelector *profile; QString mrl; private slots: @@ -52,6 +54,7 @@ private slots: virtual void cancel(); void fileBrowse(); void setDestinationFileExtension(); + void validate(); }; #endif _______________________________________________ vlc-commits mailing list [email protected] https://mailman.videolan.org/listinfo/vlc-commits
