Browse Source

qt: remove `QVLCDialog::keyPressEvent()`

- `QDialog` already handles this.
- The implementation is not correct here,
  enter key should accept the dialog. It is
  also not clear why a dialog specific `reject()`
  is not called when encountering escape key.
pull/179/head
Fatih Uzunoglu 12 months ago
committed by Steve Lhomme
parent
commit
6a330a63e4
  1. 14
      modules/gui/qt/dialogs/gototime/gototime.cpp
  2. 6
      modules/gui/qt/dialogs/gototime/gototime.hpp
  3. 2
      modules/gui/qt/dialogs/open/openurl.hpp
  4. 14
      modules/gui/qt/dialogs/sout/convert.cpp
  5. 5
      modules/gui/qt/dialogs/sout/convert.hpp
  6. 8
      modules/gui/qt/dialogs/sout/profile_selector.cpp
  7. 4
      modules/gui/qt/dialogs/sout/profile_selector.hpp
  8. 13
      modules/gui/qt/widgets/native/qvlcframe.cpp
  9. 10
      modules/gui/qt/widgets/native/qvlcframe.hpp

14
modules/gui/qt/dialogs/gototime/gototime.cpp

@ -70,8 +70,9 @@ GotoTimeDialog::GotoTimeDialog( qt_intf_t *_p_intf)
mainLayout->addWidget( buttonBox, 1, 0, 1, 3 );
BUTTONACT( gotoButton, &GotoTimeDialog::close );
BUTTONACT( cancelButton, &GotoTimeDialog::cancel );
connect( buttonBox, &QDialogButtonBox::accepted, this, &GotoTimeDialog::accept );
connect( buttonBox, &QDialogButtonBox::rejected, this, &GotoTimeDialog::reject );
BUTTONACT( resetButton, &GotoTimeDialog::reset );
QVLCTools::restoreWidgetPosition( p_intf, "gototimedialog", this );
@ -95,20 +96,21 @@ void GotoTimeDialog::toggleVisible()
activateWindow();
}
void GotoTimeDialog::cancel()
void GotoTimeDialog::reject()
{
reset();
toggleVisible();
QVLCDialog::reject();
}
void GotoTimeDialog::close()
void GotoTimeDialog::accept()
{
if ( THEMIM->hasInput() )
{
int i_time = QTime( 0, 0, 0 ).msecsTo( timeEdit->time() );
THEMIM->setTime( VLC_TICK_FROM_MS(i_time) );
}
toggleVisible();
QVLCDialog::accept();
}
void GotoTimeDialog::reset()

6
modules/gui/qt/dialogs/gototime/gototime.hpp

@ -36,9 +36,11 @@ public:
void toggleVisible();
public slots:
void accept() override;
void reject() override;
private slots:
void close() override;
void cancel() override;
void reset();
private:

2
modules/gui/qt/dialogs/open/openurl.hpp

@ -55,7 +55,7 @@ public:
void showEvent( QShowEvent *ev ) override;
public slots:
void close() override { play(); }
void accept() override { play(); QVLCDialog::accept(); }
};

14
modules/gui/qt/dialogs/sout/convert.cpp

@ -143,8 +143,8 @@ ConvertDialog::ConvertDialog( QWindow *parent, qt_intf_t *_p_intf,
mainLayout->addWidget( buttonBox, 5, 3 );
BUTTONACT( okButton, &ConvertDialog::close );
BUTTONACT( cancelButton, &ConvertDialog::cancel );
connect( buttonBox, &QDialogButtonBox::accepted, this, &ConvertDialog::accept );
connect( buttonBox, &QDialogButtonBox::rejected, this, &ConvertDialog::reject );
connect( convertRadio, &QRadioButton::toggled, convertPanel, &QWidget::setEnabled );
connect( profile, &VLCProfileSelector::optionsChanged, this, &ConvertDialog::setDestinationFileExtension );
@ -166,12 +166,7 @@ void ConvertDialog::fileBrowse()
setDestinationFileExtension();
}
void ConvertDialog::cancel()
{
reject();
}
void ConvertDialog::close()
void ConvertDialog::accept()
{
hide();
@ -250,7 +245,8 @@ void ConvertDialog::close()
msg_Dbg( p_intf, "Transcode chain: %s", qtu( mrl.to_string() ) );
mrls.append(mrl.to_string());
}
accept();
QVLCDialog::accept();
}
void ConvertDialog::setDestinationFileExtension()

5
modules/gui/qt/dialogs/sout/convert.hpp

@ -55,9 +55,10 @@ private:
QUrl outgoingMRL;
QStringList mrls;
public slots:
void accept() override;
private slots:
void close() override;
void cancel() override;
void fileBrowse();
void setDestinationFileExtension();
void validate();

8
modules/gui/qt/dialogs/sout/profile_selector.cpp

@ -443,10 +443,10 @@ VLCProfileEditor::VLCProfileEditor( const QString& qs_name, const QString& value
QPushButton *saveButton = new QPushButton(
( qs_name.isEmpty() ) ? qtr( "Create" ) : qtr( "Save" ) );
ui.buttonBox->addButton( saveButton, QDialogButtonBox::AcceptRole );
BUTTONACT( saveButton, &VLCProfileEditor::close );
connect( ui.buttonBox, &QDialogButtonBox::accepted, this, &VLCProfileEditor::accept );
QPushButton *cancelButton = new QPushButton( qtr( "Cancel" ) );
ui.buttonBox->addButton( cancelButton, QDialogButtonBox::RejectRole );
BUTTONACT( cancelButton, &VLCProfileEditor::reject );
connect( ui.buttonBox, &QDialogButtonBox::rejected, this, &VLCProfileEditor::reject );
connect( ui.valueholder_video_copy, &QtCheckboxChanged,
this, &VLCProfileEditor::activatePanels );
@ -776,7 +776,7 @@ void VLCProfileEditor::fillProfileOldFormat( const QString& qs )
ui.valueholder_subtitles_overlay->setChecked( options[15].toInt() );
}
void VLCProfileEditor::close()
void VLCProfileEditor::accept()
{
if( ui.profileLine->text().isEmpty() )
{
@ -787,7 +787,7 @@ void VLCProfileEditor::close()
}
name = ui.profileLine->text();
accept();
QVLCDialog::accept();
}
#define currentData( box ) box->itemData( box->currentIndex() )

4
modules/gui/qt/dialogs/sout/profile_selector.hpp

@ -84,8 +84,8 @@ private:
QHash<QString, resultset> caps;
void loadCapabilities();
void reset();
protected slots:
void close() override;
public slots:
void accept() override;
private slots:
void muxSelected();
void codecSelected();

13
modules/gui/qt/widgets/native/qvlcframe.cpp

@ -220,19 +220,6 @@ void QVLCFrame::keyPressEvent(QKeyEvent *keyEvent)
}
}
void QVLCDialog::keyPressEvent(QKeyEvent *keyEvent)
{
if (keyEvent->key() == Qt::Key_Escape)
{
this->cancel();
}
else if (keyEvent->key() == Qt::Key_Return ||
keyEvent->key() == Qt::Key_Enter)
{
this->close();
}
}
void QVLCDialog::setWindowTransientParent(QWidget* widget, QWindow* parent, qt_intf_t* p_intf)
{
assert(widget);

10
modules/gui/qt/widgets/native/qvlcframe.hpp

@ -121,16 +121,6 @@ public:
protected:
qt_intf_t *p_intf;
virtual void cancel()
{
hide();
}
virtual void close()
{
hide();
}
void keyPressEvent( QKeyEvent *keyEvent ) override;
};
#endif

Loading…
Cancel
Save