Commit 766acd38 authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

Qt4 - Make Open dialog KDE/GNOME/WIN32 compliant for buttons...

parent f5a1e36b
...@@ -47,6 +47,7 @@ OpenDialog::OpenDialog( QWidget *parent, intf_thread_t *_p_intf, bool modal, ...@@ -47,6 +47,7 @@ OpenDialog::OpenDialog( QWidget *parent, intf_thread_t *_p_intf, bool modal,
setWindowTitle( qtr("Open" ) ); setWindowTitle( qtr("Open" ) );
resize( 500, 300); resize( 500, 300);
/* Tab definition and creation */
fileOpenPanel = new FileOpenPanel( ui.Tab , p_intf ); fileOpenPanel = new FileOpenPanel( ui.Tab , p_intf );
diskOpenPanel = new DiskOpenPanel( ui.Tab , p_intf ); diskOpenPanel = new DiskOpenPanel( ui.Tab , p_intf );
netOpenPanel = new NetOpenPanel( ui.Tab , p_intf ); netOpenPanel = new NetOpenPanel( ui.Tab , p_intf );
...@@ -57,8 +58,38 @@ OpenDialog::OpenDialog( QWidget *parent, intf_thread_t *_p_intf, bool modal, ...@@ -57,8 +58,38 @@ OpenDialog::OpenDialog( QWidget *parent, intf_thread_t *_p_intf, bool modal,
ui.Tab->addTab( netOpenPanel, qtr( "&Network" ) ); ui.Tab->addTab( netOpenPanel, qtr( "&Network" ) );
ui.Tab->addTab( captureOpenPanel, qtr( "Capture &Device" ) ); ui.Tab->addTab( captureOpenPanel, qtr( "Capture &Device" ) );
/* Hide the advancedPanel */
ui.advancedFrame->hide(); ui.advancedFrame->hide();
/* Buttons Creation */
QSizePolicy buttonSizePolicy(static_cast<QSizePolicy::Policy>(7), static_cast<QSizePolicy::Policy>(1));
buttonSizePolicy.setHorizontalStretch(0);
buttonSizePolicy.setVerticalStretch(0);
playButton = new QToolButton();
playButton->setText( qtr( "&Play" ) );
playButton->setSizePolicy( buttonSizePolicy );
playButton->setMinimumSize(QSize(90, 0));
playButton->setPopupMode(QToolButton::MenuButtonPopup);
playButton->setToolButtonStyle(Qt::ToolButtonTextOnly);
cancelButton = new QToolButton();
cancelButton->setText( qtr( "&Cancel" ) );
cancelButton->setSizePolicy( buttonSizePolicy );
QMenu * openButtonMenu = new QMenu( "Open" ); QMenu * openButtonMenu = new QMenu( "Open" );
openButtonMenu->addAction( qtr("&Enqueue"), this, SLOT( enqueue() ),
QKeySequence( "Alt+E") );
openButtonMenu->addAction( qtr("&Play"), this, SLOT( play() ),
QKeySequence( "Alt+P" ) );
openButtonMenu->addAction( qtr("&Stream"), this, SLOT( stream() ) ,
QKeySequence( "Alt+S" ) );
playButton->setMenu( openButtonMenu );
ui.buttonsBox->addButton( playButton, QDialogButtonBox::AcceptRole );
ui.buttonsBox->addButton( cancelButton, QDialogButtonBox::RejectRole );
/* Force MRL update on tab change */ /* Force MRL update on tab change */
CONNECT( ui.Tab, currentChanged(int), this, signalCurrent()); CONNECT( ui.Tab, currentChanged(int), this, signalCurrent());
...@@ -79,20 +110,12 @@ OpenDialog::OpenDialog( QWidget *parent, intf_thread_t *_p_intf, bool modal, ...@@ -79,20 +110,12 @@ OpenDialog::OpenDialog( QWidget *parent, intf_thread_t *_p_intf, bool modal,
CONNECT( ui.slaveText, textChanged(QString), this, updateMRL()); CONNECT( ui.slaveText, textChanged(QString), this, updateMRL());
CONNECT( ui.cacheSpinBox, valueChanged(int), this, updateMRL()); CONNECT( ui.cacheSpinBox, valueChanged(int), this, updateMRL());
openButtonMenu->addAction( qtr("&Enqueue"), this, SLOT( enqueue() ), /* Buttons action */
QKeySequence( "Alt+E") ); BUTTONACT( playButton, play());
openButtonMenu->addAction( qtr("&Play"), this, SLOT( play() ), BUTTONACT( cancelButton, cancel());
QKeySequence( "Alt+P" ) );
openButtonMenu->addAction( qtr("&Stream"), this, SLOT( stream() ) ,
QKeySequence( "Alt+S" ) );
ui.playButton->setMenu( openButtonMenu );
BUTTONACT( ui.playButton, play());
if ( b_stream_after ) setAfter(); if ( b_stream_after ) setAfter();
BUTTONACT( ui.cancelButton, cancel());
BUTTONACT( ui.advancedCheckBox , toggleAdvancedPanel() ); BUTTONACT( ui.advancedCheckBox , toggleAdvancedPanel() );
/* Initialize caching */ /* Initialize caching */
...@@ -110,13 +133,13 @@ void OpenDialog::setAfter() ...@@ -110,13 +133,13 @@ void OpenDialog::setAfter()
{ {
if (!b_stream_after ) if (!b_stream_after )
{ {
ui.playButton->setText( qtr("&Play") ); playButton->setText( qtr("&Play") );
BUTTONACT( ui.playButton, play() ); BUTTONACT( playButton, play() );
} }
else else
{ {
ui.playButton->setText( qtr("&Stream") ); playButton->setText( qtr("&Stream") );
BUTTONACT( ui.playButton, stream() ); BUTTONACT( playButton, stream() );
} }
} }
...@@ -132,7 +155,9 @@ void OpenDialog::signalCurrent() { ...@@ -132,7 +155,9 @@ void OpenDialog::signalCurrent() {
} }
} }
/* Actions */ /***********
* Actions *
***********/
/* If Cancel is pressed or escaped */ /* If Cancel is pressed or escaped */
void OpenDialog::cancel() void OpenDialog::cancel()
......
...@@ -34,6 +34,8 @@ ...@@ -34,6 +34,8 @@
#include <QBoxLayout> #include <QBoxLayout>
#include <QString> #include <QString>
class QToolButton;
class OpenDialog : public QVLCDialog class OpenDialog : public QVLCDialog
{ {
Q_OBJECT; Q_OBJECT;
...@@ -78,7 +80,9 @@ private: ...@@ -78,7 +80,9 @@ private:
int advHeight, mainHeight; int advHeight, mainHeight;
bool b_stream_after; bool b_stream_after;
QStringList SeparateEntries( QString ); QStringList SeparateEntries( QString );
QToolButton *cancelButton;
QToolButton *playButton;
void playOrEnqueue( bool ); void playOrEnqueue( bool );
private slots: private slots:
......
...@@ -186,44 +186,12 @@ ...@@ -186,44 +186,12 @@
</spacer> </spacer>
</item> </item>
<item> <item>
<widget class="QToolButton" name="cancelButton" > <widget class="QDialogButtonBox" name="buttonsBox" >
<property name="sizePolicy" > <property name="orientation" >
<sizepolicy> <enum>Qt::Horizontal</enum>
<hsizetype>7</hsizetype>
<vsizetype>1</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text" >
<string>&amp;Cancel</string>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="playButton" >
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>7</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize" >
<size>
<width>90</width>
<height>0</height>
</size>
</property>
<property name="text" >
<string>&amp;Play</string>
</property>
<property name="popupMode" >
<enum>QToolButton::MenuButtonPopup</enum>
</property> </property>
<property name="toolButtonStyle" > <property name="standardButtons" >
<enum>Qt::ToolButtonTextOnly</enum> <set>QDialogButtonBox::NoButton</set>
</property> </property>
</widget> </widget>
</item> </item>
...@@ -235,8 +203,6 @@ ...@@ -235,8 +203,6 @@
<tabstop>cacheSpinBox</tabstop> <tabstop>cacheSpinBox</tabstop>
<tabstop>advancedLineInput</tabstop> <tabstop>advancedLineInput</tabstop>
<tabstop>Tab</tabstop> <tabstop>Tab</tabstop>
<tabstop>playButton</tabstop>
<tabstop>cancelButton</tabstop>
</tabstops> </tabstops>
<resources/> <resources/>
<connections> <connections>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment