[vlc-devel] commit: Rework a bit the OpenDialog calls in order to fix the double-click issue when transcoding . (Jean-Baptiste Kempf )
git version control
git at videolan.org
Sun Jul 27 02:55:38 CEST 2008
vlc | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Sat Jul 26 14:49:24 2008 -0700| [d0389324b91b56a96bc6bbcb2c417ca824a892ab]
Rework a bit the OpenDialog calls in order to fix the double-click issue when transcoding.
should Close #1698
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=d0389324b91b56a96bc6bbcb2c417ca824a892ab
---
modules/gui/qt4/components/open_panels.cpp | 2 +-
modules/gui/qt4/dialogs/open.cpp | 30 ++++++++++++++++-----------
modules/gui/qt4/dialogs/open.hpp | 23 ++++++++++++++++++--
modules/gui/qt4/dialogs/vlm.cpp | 2 +-
modules/gui/qt4/dialogs_provider.cpp | 10 ++++----
modules/gui/qt4/dialogs_provider.hpp | 17 +--------------
6 files changed, 46 insertions(+), 38 deletions(-)
diff --git a/modules/gui/qt4/components/open_panels.cpp b/modules/gui/qt4/components/open_panels.cpp
index 100e529..5270983 100644
--- a/modules/gui/qt4/components/open_panels.cpp
+++ b/modules/gui/qt4/components/open_panels.cpp
@@ -183,7 +183,7 @@ void FileOpenPanel::accept()
void FileOpenBox::accept()
{
- OpenDialog::getInstance( NULL, NULL )->play();
+ OpenDialog::getInstance( NULL, NULL, true )->selectSlots();
}
/* Function called by Open Dialog when clicked on cancel */
diff --git a/modules/gui/qt4/dialogs/open.cpp b/modules/gui/qt4/dialogs/open.cpp
index ea2c5e1..02826db 100644
--- a/modules/gui/qt4/dialogs/open.cpp
+++ b/modules/gui/qt4/dialogs/open.cpp
@@ -37,31 +37,36 @@
OpenDialog *OpenDialog::instance = NULL;
OpenDialog* OpenDialog::getInstance( QWidget *parent, intf_thread_t *p_intf,
- int _action_flag, bool modal )
+ bool b_rawInstance, int _action_flag, bool b_selectMode )
{
/* Creation */
if( !instance )
- instance = new OpenDialog( parent, p_intf, modal, _action_flag );
- else
+ instance = new OpenDialog( parent, p_intf, b_selectMode, _action_flag );
+ else if( !b_rawInstance )
{
/* Request the instance but change small details:
- Button menu
- Modality on top of the parent dialog */
+ if( b_selectMode )
+ {
+ instance->setWindowModality( Qt::WindowModal );
+ _action_flag = SELECT; /* This should be useless, but we never know
+ if the call is correct */
+ }
instance->i_action_flag = _action_flag;
instance->setMenuAction();
- if( modal ) instance->setWindowModality( Qt::WindowModal );
}
return instance;
}
OpenDialog::OpenDialog( QWidget *parent,
intf_thread_t *_p_intf,
- bool modal,
+ bool b_selectMode,
int _action_flag ) : QVLCDialog( parent, _p_intf )
{
i_action_flag = _action_flag;
- if( modal ) /* Select mode */
+ if( b_selectMode ) /* Select mode */
{
setWindowModality( Qt::WindowModal );
i_action_flag = SELECT;
@@ -142,7 +147,7 @@ OpenDialog::OpenDialog( QWidget *parent,
CONNECT( ui.slaveText, textChanged( QString ), this, updateMRL() );
CONNECT( ui.cacheSpinBox, valueChanged( int ), this, updateMRL() );
CONNECT( ui.startTimeSpinBox, valueChanged( int ), this, updateMRL() );
- BUTTONACT( ui.advancedCheckBox , toggleAdvancedPanel() );
+ BUTTONACT( ui.advancedCheckBox, toggleAdvancedPanel() );
/* Buttons action */
BUTTONACT( playButton, selectSlots() );
@@ -190,12 +195,12 @@ void OpenDialog::setMenuAction()
playButton->setText( qtr( "&Play" ) );
}
playButton->show();
- playButton->setDefault( true );
selectButton->hide();
+ playButton->setDefault( true );
}
}
-void OpenDialog::showTab( int i_tab=0 )
+void OpenDialog::showTab( int i_tab )
{
ui.Tab->setCurrentIndex( i_tab );
show();
@@ -243,14 +248,15 @@ void OpenDialog::cancel()
mainMRL.clear();
/* If in Select Mode, reject instead of hiding */
- if( windowModality() != Qt::NonModal ) reject();
+ if( i_action_flag == SELECT ) reject();
else hide();
}
/* If EnterKey is pressed */
void OpenDialog::close()
{
- if( windowModality() != Qt::NonModal )
+ /* If in Select Mode, accept instead of selecting a Slot */
+ if( i_action_flag == SELECT )
accept();
else
selectSlots();
@@ -292,7 +298,7 @@ void OpenDialog::finish( bool b_enqueue = false )
toggleVisible();
mrl = ui.advancedLineInput->text();
- if( windowModality() == Qt::NonModal )
+ if( i_action_flag != SELECT )
{
QStringList tempMRL = SeparateEntries( mrl );
for( size_t i = 0; i < tempMRL.size(); i++ )
diff --git a/modules/gui/qt4/dialogs/open.hpp b/modules/gui/qt4/dialogs/open.hpp
index 1f2a025..73a07e4 100644
--- a/modules/gui/qt4/dialogs/open.hpp
+++ b/modules/gui/qt4/dialogs/open.hpp
@@ -35,6 +35,23 @@
#include "ui/open.h"
#include "components/open_panels.hpp"
+enum {
+ OPEN_FILE_TAB,
+ OPEN_DISC_TAB,
+ OPEN_NETWORK_TAB,
+ OPEN_CAPTURE_TAB,
+ OPEN_TAB_MAX
+};
+
+enum {
+ OPEN_AND_PLAY,
+ OPEN_AND_ENQUEUE,
+ OPEN_AND_STREAM,
+ OPEN_AND_SAVE,
+ SELECT /* Special mode to select a MRL (for VLM or similar */
+};
+
+
class QString;
class QTabWidget;
@@ -43,7 +60,7 @@ class OpenDialog : public QVLCDialog
Q_OBJECT;
public:
static OpenDialog * getInstance( QWidget *parent, intf_thread_t *p_intf,
- int _action_flag = 0, bool modal = false );
+ bool b_rawInstance = false, int _action_flag = 0, bool b_selectMode = false );
static void killInstance()
{
@@ -52,7 +69,7 @@ public:
}
virtual ~OpenDialog();
- void showTab( int );
+ void showTab( int = OPEN_FILE_TAB );
QString getMRL(){ return mrl; }
public slots:
@@ -63,7 +80,7 @@ public slots:
void transcode();
private:
- OpenDialog( QWidget *parent, intf_thread_t *, bool modal,
+ OpenDialog( QWidget *parent, intf_thread_t *, bool b_selectMode,
int _action_flag = 0 );
static OpenDialog *instance;
diff --git a/modules/gui/qt4/dialogs/vlm.cpp b/modules/gui/qt4/dialogs/vlm.cpp
index 12bf3b4..12ad9bf 100644
--- a/modules/gui/qt4/dialogs/vlm.cpp
+++ b/modules/gui/qt4/dialogs/vlm.cpp
@@ -375,7 +375,7 @@ void VLMDialog::clearWidgets()
void VLMDialog::selectInput()
{
- OpenDialog *o = OpenDialog::getInstance( this, p_intf, SELECT, true );
+ OpenDialog *o = OpenDialog::getInstance( this, p_intf, false, SELECT, true );
o->exec();
ui.inputLedit->setText( o->getMRL() );
}
diff --git a/modules/gui/qt4/dialogs_provider.cpp b/modules/gui/qt4/dialogs_provider.cpp
index 98d11ab..4d7992a 100644
--- a/modules/gui/qt4/dialogs_provider.cpp
+++ b/modules/gui/qt4/dialogs_provider.cpp
@@ -260,7 +260,7 @@ void DialogsProvider::openCaptureDialog()
/* Same as the open one, but force the enqueue */
void DialogsProvider::PLAppendDialog()
{
- OpenDialog::getInstance( p_intf->p_sys->p_mi , p_intf, OPEN_AND_ENQUEUE)
+ OpenDialog::getInstance( p_intf->p_sys->p_mi, p_intf, false, OPEN_AND_ENQUEUE)
->showTab( OPEN_FILE_TAB );
}
@@ -453,14 +453,14 @@ void DialogsProvider::streamingDialog( QWidget *parent, QString mrl,
void DialogsProvider::openThenStreamingDialogs()
{
- OpenDialog::getInstance( p_intf->p_sys->p_mi , p_intf, OPEN_AND_STREAM )
- ->showTab( 0 );
+ OpenDialog::getInstance( p_intf->p_sys->p_mi, p_intf, false, OPEN_AND_STREAM )
+ ->showTab( OPEN_FILE_TAB );
}
void DialogsProvider::openThenTranscodingDialogs()
{
- OpenDialog::getInstance( p_intf->p_sys->p_mi , p_intf, OPEN_AND_SAVE )
- ->showTab( 0 );
+ OpenDialog::getInstance( p_intf->p_sys->p_mi , p_intf, false, OPEN_AND_SAVE )
+ ->showTab( OPEN_FILE_TAB );
}
/****************************************************************************
diff --git a/modules/gui/qt4/dialogs_provider.hpp b/modules/gui/qt4/dialogs_provider.hpp
index 7d661a5..97c19c6 100644
--- a/modules/gui/qt4/dialogs_provider.hpp
+++ b/modules/gui/qt4/dialogs_provider.hpp
@@ -35,6 +35,7 @@
#include "qt4.hpp"
#include "dialogs/interaction.hpp"
+#include "dialogs/open.hpp"
#include <QObject>
#include <QTimer>
@@ -77,22 +78,6 @@ enum {
EXT_FILTER_SUBTITLE = 0x10,
};
-enum {
- OPEN_FILE_TAB,
- OPEN_DISC_TAB,
- OPEN_NETWORK_TAB,
- OPEN_CAPTURE_TAB,
- OPEN_TAB_MAX
-};
-
-enum {
- OPEN_AND_PLAY,
- OPEN_AND_STREAM,
- OPEN_AND_SAVE,
- OPEN_AND_ENQUEUE,
- SELECT
-};
-
class QEvent;
class QSignalMapper;
class QVLCMenu;
More information about the vlc-devel
mailing list