[vlc-devel] [PATCH 2/2] 'Open files' UI fixes. Full usage of QT4 Qpushbutton's functionalities. Suppressed duplicate 'play' action button.
Francois Cartegnie
fcvlcdev at free.fr
Thu May 28 15:55:16 CEST 2009
---
modules/gui/qt4/dialogs/open.cpp | 55 +++--
modules/gui/qt4/dialogs/open.hpp | 19 ++
modules/gui/qt4/ui/open.ui | 448 +++++++++++++++++++------------------
3 files changed, 281 insertions(+), 241 deletions(-)
diff --git a/modules/gui/qt4/dialogs/open.cpp b/modules/gui/qt4/dialogs/open.cpp
index 372cb06..5f0c938 100644
--- a/modules/gui/qt4/dialogs/open.cpp
+++ b/modules/gui/qt4/dialogs/open.cpp
@@ -97,11 +97,14 @@ OpenDialog::OpenDialog( QWidget *parent,
captureOpenPanel = new CaptureOpenPanel( this, p_intf );
/* Insert the tabs */
- ui.Tab->insertTab( OPEN_FILE_TAB, fileOpenPanel, qtr( "&File" ) );
- ui.Tab->insertTab( OPEN_DISC_TAB, discOpenPanel, qtr( "&Disc" ) );
- ui.Tab->insertTab( OPEN_NETWORK_TAB, netOpenPanel, qtr( "&Network" ) );
+ ui.Tab->insertTab( OPEN_FILE_TAB, fileOpenPanel,
+ UI_ICON_MEDIA_FILE, qtr( "&File" ) );
+ ui.Tab->insertTab( OPEN_DISC_TAB, discOpenPanel,
+ UI_ICON_MEDIA_DVD, qtr( "&Disc" ) );
+ ui.Tab->insertTab( OPEN_NETWORK_TAB, netOpenPanel,
+ UI_ICON_MEDIA_NETWORK, qtr( "&Network" ) );
ui.Tab->insertTab( OPEN_CAPTURE_TAB, captureOpenPanel,
- qtr( "Capture &Device" ) );
+ UI_ICON_MEDIA_CAPTURE, qtr( "Capture &Device" ) );
/* Hide the Slave input widgets */
ui.slaveLabel->hide();
@@ -109,33 +112,36 @@ OpenDialog::OpenDialog( QWidget *parent,
ui.slaveBrowseButton->hide();
/* Buttons Creation */
- /* Play Button */
- playButton = ui.playButton;
/* Cancel Button */
- cancelButton = new QPushButton( qtr( "&Cancel" ) );
+ cancelButton = new QPushButton( UI_TEXT_CANCEL );
+ cancelButton->setIcon( UI_ICON_CANCEL );
/* Select Button */
- selectButton = new QPushButton( qtr( "&Select" ) );
+ selectButton = new QPushButton( UI_TEXT_SELECT );
+ selectButton->setIcon( UI_ICON_SELECT );
/* Menu for the Play button */
QMenu * openButtonMenu = new QMenu( "Open" );
- openButtonMenu->addAction( qtr( "&Enqueue" ), this, SLOT( enqueue() ),
+ openButtonMenu->addAction( UI_ICON_ENQUEUE, UI_TEXT_ENQUEUE, this, SLOT( enqueue() ),
QKeySequence( "Alt+E" ) );
- openButtonMenu->addAction( qtr( "&Play" ), this, SLOT( play() ),
+ openButtonMenu->addAction( UI_ICON_PLAY, UI_TEXT_PLAY, this, SLOT( play() ),
QKeySequence( "Alt+P" ) );
- openButtonMenu->addAction( qtr( "&Stream" ), this, SLOT( stream() ) ,
+ openButtonMenu->addAction( UI_ICON_STREAM, UI_TEXT_STREAM, this, SLOT( stream() ) ,
QKeySequence( "Alt+S" ) );
- openButtonMenu->addAction( qtr( "&Convert" ), this, SLOT( transcode() ) ,
+ openButtonMenu->addAction( UI_ICON_CONVERT, UI_TEXT_CONVERT, this, SLOT( transcode() ) ,
QKeySequence( "Alt+C" ) );
ui.menuButton->setMenu( openButtonMenu );
- ui.menuButton->setIcon( QIcon( ":/down_arrow" ) );
/* Add the three Buttons */
- ui.buttonsBox->addButton( selectButton, QDialogButtonBox::AcceptRole );
+ ui.buttonsBox->addButton( selectButton, QDialogButtonBox::ApplyRole );
ui.buttonsBox->addButton( cancelButton, QDialogButtonBox::RejectRole );
+ /* Move the menuButton into buttonsBox for by-role layout management */
+ ui.buttonsZone->layout()->removeWidget( ui.menuButton );
+ ui.buttonsBox->addButton( ui.menuButton, QDialogButtonBox::AcceptRole );
+
/* At creation time, modify the default buttons */
setMenuAction();
@@ -168,8 +174,8 @@ OpenDialog::OpenDialog( QWidget *parent,
BUTTONACT( ui.advancedCheckBox, toggleAdvancedPanel() );
BUTTONACT( ui.slaveBrowseButton, browseInputSlave() );
- /* Buttons action */
- BUTTONACT( playButton, selectSlots() );
+ /* Buttons action */
+ BUTTONACT( ui.menuButton, selectSlots() );
BUTTONACT( selectButton, close() );
BUTTONACT( cancelButton, cancel() );
@@ -206,7 +212,7 @@ void OpenDialog::setMenuAction()
{
if( i_action_flag == SELECT )
{
- playButton->hide();
+ ui.menuButton->hide();
selectButton->show();
selectButton->setDefault( true );
}
@@ -215,21 +221,24 @@ void OpenDialog::setMenuAction()
switch ( i_action_flag )
{
case OPEN_AND_STREAM:
- playButton->setText( qtr( "&Stream" ) );
+ ui.menuButton->setText( UI_TEXT_STREAM );
+ ui.menuButton->setIcon( UI_ICON_STREAM );
break;
case OPEN_AND_SAVE:
- playButton->setText( qtr( "&Convert / Save" ) );
+ ui.menuButton->setText( UI_TEXT_CONVERT );
+ ui.menuButton->setIcon( UI_ICON_CONVERT );
break;
case OPEN_AND_ENQUEUE:
- playButton->setText( qtr( "&Enqueue" ) );
+ ui.menuButton->setText( UI_TEXT_ENQUEUE );
+ ui.menuButton->setIcon( UI_ICON_ENQUEUE );
break;
case OPEN_AND_PLAY:
default:
- playButton->setText( qtr( "&Play" ) );
+ ui.menuButton->setText( UI_TEXT_PLAY );
+ ui.menuButton->setIcon( UI_ICON_PLAY );
}
- playButton->show();
+ ui.menuButton->show();
selectButton->hide();
- playButton->setDefault( true );
}
}
diff --git a/modules/gui/qt4/dialogs/open.hpp b/modules/gui/qt4/dialogs/open.hpp
index 7ba13fc..848b143 100644
--- a/modules/gui/qt4/dialogs/open.hpp
+++ b/modules/gui/qt4/dialogs/open.hpp
@@ -34,6 +34,25 @@
#include "ui/open.h"
#include "components/open_panels.hpp"
+/* controls consistency */
+#define UI_ICON_PLAY QIcon( ":/play" )
+#define UI_ICON_ENQUEUE QIcon( ":/enqueue" )
+#define UI_ICON_STREAM QIcon( ":/stream" )
+#define UI_ICON_CONVERT QIcon( ":/convert" )
+#define UI_ICON_MEDIA_DVD QIcon( ":/disc" )
+#define UI_ICON_MEDIA_FILE QIcon( ":/folder-grey" )
+#define UI_ICON_MEDIA_NETWORK QIcon( ":/network" )
+#define UI_ICON_MEDIA_CAPTURE QIcon( ":/capture-card" )
+#define UI_ICON_CANCEL QIcon( ":/quit" )
+#define UI_ICON_SELECT QIcon( ":/play" )
+
+#define UI_TEXT_PLAY qtr( "&Play" )
+#define UI_TEXT_ENQUEUE qtr( "&Enqueue" )
+#define UI_TEXT_STREAM qtr( "&Stream" )
+#define UI_TEXT_CONVERT qtr( "&Convert" )
+#define UI_TEXT_CANCEL qtr( "&Cancel" )
+#define UI_TEXT_SELECT qtr( "&Select" )
+
enum {
OPEN_FILE_TAB,
OPEN_DISC_TAB,
diff --git a/modules/gui/qt4/ui/open.ui b/modules/gui/qt4/ui/open.ui
index a374868..525cef3 100644
--- a/modules/gui/qt4/ui/open.ui
+++ b/modules/gui/qt4/ui/open.ui
@@ -10,7 +10,7 @@
<rect>
<x>0</x>
<y>0</y>
- <width>556</width>
+ <width>557</width>
<height>387</height>
</rect>
</property>
@@ -29,260 +29,272 @@
<property name="windowTitle">
<string>Dialog</string>
</property>
- <layout class="QGridLayout" name="gridLayout">
- <item row="0" column="0" colspan="4">
- <widget class="QTabWidget" name="Tab"/>
- </item>
- <item row="1" column="0" colspan="4">
- <widget class="QCheckBox" name="advancedCheckBox">
- <property name="toolTip">
- <string>Show extended options</string>
- </property>
- <property name="text">
- <string>Show &more options</string>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
+ <widget class="QGroupBox" name="groupBox_2">
+ <property name="title">
+ <string>Media source</string>
</property>
+ <layout class="QVBoxLayout" name="verticalLayout_2">
+ <property name="leftMargin">
+ <number>0</number>
+ </property>
+ <item>
+ <widget class="QTabWidget" name="Tab"/>
+ </item>
+ </layout>
</widget>
</item>
- <item row="2" column="0" colspan="4">
- <widget class="QGroupBox" name="advancedFrame">
- <layout class="QGridLayout" name="gridLayout_2">
+ <item>
+ <widget class="QGroupBox" name="groupBox">
+ <property name="title">
+ <string>Additional options</string>
+ </property>
+ <layout class="QGridLayout" name="gridLayout">
+ <property name="leftMargin">
+ <number>0</number>
+ </property>
+ <property name="rightMargin">
+ <number>9</number>
+ </property>
+ <property name="spacing">
+ <number>0</number>
+ </property>
<item row="0" column="0">
- <widget class="QLabel" name="cacheLabel">
- <property name="text">
- <string>Caching</string>
- </property>
- <property name="buddy">
- <cstring>cacheSpinBox</cstring>
- </property>
- </widget>
- </item>
- <item row="0" column="2">
- <widget class="QSpinBox" name="cacheSpinBox">
+ <widget class="QCheckBox" name="advancedCheckBox">
<property name="toolTip">
- <string>Change the caching for the media</string>
+ <string>Show extended options</string>
</property>
- <property name="alignment">
- <set>Qt::AlignRight</set>
- </property>
- <property name="suffix">
- <string> ms</string>
- </property>
- <property name="maximum">
- <number>65535</number>
- </property>
- </widget>
- </item>
- <item row="0" column="3">
- <spacer>
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>16</width>
- <height>24</height>
- </size>
- </property>
- </spacer>
- </item>
- <item row="0" column="4">
- <widget class="QLabel" name="label_3">
<property name="text">
- <string>Start Time</string>
- </property>
- <property name="buddy">
- <cstring>startTimeDoubleSpinBox</cstring>
+ <string>Show &more options</string>
</property>
</widget>
</item>
- <item row="0" column="7">
- <spacer>
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>40</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- <item row="1" column="2" colspan="6">
- <widget class="Line" name="line"/>
- </item>
- <item row="2" column="0" colspan="8">
- <widget class="QCheckBox" name="slaveCheckbox">
- <property name="text">
- <string>Play another media synchronously (extra audio file, ...)</string>
+ <item row="1" column="0">
+ <widget class="QGroupBox" name="advancedFrame">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
</property>
+ <layout class="QGridLayout" name="gridLayout_2">
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="horizontalSpacing">
+ <number>6</number>
+ </property>
+ <item row="0" column="0">
+ <widget class="QLabel" name="cacheLabel">
+ <property name="layoutDirection">
+ <enum>Qt::RightToLeft</enum>
+ </property>
+ <property name="text">
+ <string>Caching</string>
+ </property>
+ <property name="buddy">
+ <cstring>cacheSpinBox</cstring>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="2">
+ <widget class="QSpinBox" name="cacheSpinBox">
+ <property name="toolTip">
+ <string>Change the caching for the media</string>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignRight</set>
+ </property>
+ <property name="suffix">
+ <string> ms</string>
+ </property>
+ <property name="maximum">
+ <number>65535</number>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="3">
+ <spacer>
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>16</width>
+ <height>24</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="0" column="4">
+ <widget class="QLabel" name="label_3">
+ <property name="layoutDirection">
+ <enum>Qt::RightToLeft</enum>
+ </property>
+ <property name="text">
+ <string>Start Time</string>
+ </property>
+ <property name="buddy">
+ <cstring>startTimeDoubleSpinBox</cstring>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="7">
+ <spacer>
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="2" column="0" colspan="8">
+ <widget class="QCheckBox" name="slaveCheckbox">
+ <property name="text">
+ <string>Play another media synchronously (extra audio file, ...)</string>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="0">
+ <widget class="QLabel" name="slaveLabel">
+ <property name="text">
+ <string>Extra media</string>
+ </property>
+ <property name="buddy">
+ <cstring>slaveText</cstring>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="2" colspan="4">
+ <widget class="QLineEdit" name="slaveText"/>
+ </item>
+ <item row="3" column="6" colspan="2">
+ <widget class="QPushButton" name="slaveBrowseButton">
+ <property name="toolTip">
+ <string>Select the file</string>
+ </property>
+ <property name="text">
+ <string>Browse...</string>
+ </property>
+ </widget>
+ </item>
+ <item row="5" column="0">
+ <widget class="QLabel" name="advancedLabel">
+ <property name="text">
+ <string>MRL</string>
+ </property>
+ <property name="buddy">
+ <cstring>advancedLineInput</cstring>
+ </property>
+ </widget>
+ </item>
+ <item row="5" column="2" colspan="6">
+ <widget class="QLineEdit" name="mrlLine">
+ <property name="readOnly">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item row="6" column="2" colspan="6">
+ <widget class="QLineEdit" name="advancedLineInput">
+ <property name="toolTip">
+ <string>Complete MRL for VLC internal</string>
+ </property>
+ </widget>
+ </item>
+ <item row="6" column="0">
+ <widget class="QLabel" name="label">
+ <property name="text">
+ <string>Edit Options</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="5" colspan="2">
+ <widget class="QDoubleSpinBox" name="startTimeDoubleSpinBox">
+ <property name="toolTip">
+ <string>Change the start time for the media</string>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignRight</set>
+ </property>
+ <property name="suffix">
+ <string>s</string>
+ </property>
+ <property name="decimals">
+ <number>1</number>
+ </property>
+ </widget>
+ </item>
+ <item row="4" column="2" colspan="6">
+ <widget class="Line" name="line"/>
+ </item>
+ <item row="1" column="1" colspan="7">
+ <widget class="Line" name="line"/>
+ </item>
+ </layout>
</widget>
</item>
- <item row="3" column="0">
- <widget class="QLabel" name="slaveLabel">
- <property name="text">
- <string>Extra media</string>
- </property>
- <property name="buddy">
- <cstring>slaveText</cstring>
- </property>
- </widget>
- </item>
- <item row="3" column="2" colspan="4">
- <widget class="QLineEdit" name="slaveText"/>
- </item>
- <item row="3" column="6" colspan="2">
- <widget class="QPushButton" name="slaveBrowseButton">
- <property name="toolTip">
- <string>Select the file</string>
- </property>
- <property name="text">
- <string>Browse...</string>
- </property>
- </widget>
- </item>
- <item row="4" column="2" colspan="6">
- <widget class="Line" name="line"/>
- </item>
- <item row="5" column="0">
- <widget class="QLabel" name="advancedLabel">
- <property name="text">
- <string>MRL</string>
- </property>
- <property name="buddy">
- <cstring>advancedLineInput</cstring>
+ </layout>
+ </widget>
+ </item>
+ <item>
+ <widget class="QWidget" name="buttonsZone" native="true">
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <item>
+ <widget class="QDialogButtonBox" name="buttonsBox">
+ <property name="standardButtons">
+ <set>QDialogButtonBox::NoButton</set>
</property>
</widget>
</item>
- <item row="5" column="2" colspan="6">
- <widget class="QLineEdit" name="mrlLine">
- <property name="readOnly">
- <bool>true</bool>
+ <item>
+ <widget class="QToolButton" name="menuButton">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
</property>
- </widget>
- </item>
- <item row="6" column="2" colspan="6">
- <widget class="QLineEdit" name="advancedLineInput">
- <property name="toolTip">
- <string>Complete MRL for VLC internal</string>
+ <property name="minimumSize">
+ <size>
+ <width>0</width>
+ <height>27</height>
+ </size>
</property>
- </widget>
- </item>
- <item row="6" column="0">
- <widget class="QLabel" name="label">
<property name="text">
- <string>Edit Options</string>
+ <string>&Play</string>
</property>
- </widget>
- </item>
- <item row="0" column="5" colspan="2">
- <widget class="QDoubleSpinBox" name="startTimeDoubleSpinBox">
- <property name="toolTip">
- <string>Change the start time for the media</string>
+ <property name="icon">
+ <iconset>
+ <normaloff>:/play</normaloff>:/play</iconset>
</property>
- <property name="alignment">
- <set>Qt::AlignRight</set>
+ <property name="popupMode">
+ <enum>QToolButton::MenuButtonPopup</enum>
</property>
- <property name="suffix">
- <string>s</string>
+ <property name="toolButtonStyle">
+ <enum>Qt::ToolButtonTextBesideIcon</enum>
</property>
- <property name="decimals">
- <number>1</number>
+ <property name="arrowType">
+ <enum>Qt::NoArrow</enum>
</property>
</widget>
</item>
</layout>
</widget>
</item>
- <item row="3" column="0">
- <spacer>
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>40</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- <item row="3" column="1">
- <widget class="QToolButton" name="menuButton">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Fixed" vsizetype="Minimum">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="maximumSize">
- <size>
- <width>16</width>
- <height>16777215</height>
- </size>
- </property>
- <property name="focusPolicy">
- <enum>Qt::ClickFocus</enum>
- </property>
- <property name="toolTip">
- <string>Select play mode</string>
- </property>
- <property name="popupMode">
- <enum>QToolButton::InstantPopup</enum>
- </property>
- <property name="arrowType">
- <enum>Qt::NoArrow</enum>
- </property>
- </widget>
- </item>
- <item row="3" column="2">
- <widget class="QPushButton" name="playButton">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Minimum" vsizetype="Minimum">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="minimumSize">
- <size>
- <width>0</width>
- <height>0</height>
- </size>
- </property>
- <property name="text">
- <string>Play</string>
- </property>
- <property name="default">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item row="3" column="3">
- <widget class="QDialogButtonBox" name="buttonsBox">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Maximum" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="standardButtons">
- <set>QDialogButtonBox::NoButton</set>
- </property>
- </widget>
- </item>
</layout>
</widget>
<tabstops>
- <tabstop>Tab</tabstop>
- <tabstop>advancedCheckBox</tabstop>
<tabstop>cacheSpinBox</tabstop>
<tabstop>startTimeDoubleSpinBox</tabstop>
<tabstop>slaveCheckbox</tabstop>
<tabstop>slaveText</tabstop>
<tabstop>slaveBrowseButton</tabstop>
- <tabstop>playButton</tabstop>
- <tabstop>menuButton</tabstop>
- <tabstop>buttonsBox</tabstop>
</tabstops>
<resources/>
<connections>
--
1.6.2.4
More information about the vlc-devel
mailing list