/*****************************************************************************
- * ToolbarEdit.cpp : ToolbarEdit dialog
+ * toolbar.cpp : ToolbarEdit dialog
****************************************************************************
* Copyright (C) 2008-2009 the VideoLAN team
* $Id$
#include "dialogs/toolbar.hpp"
+/* Widgets */
#include "util/input_slider.hpp"
#include "util/customwidgets.hpp"
#include "components/interface_widgets.hpp"
+#include "util/buttons/DeckButtonsLayout.hpp"
+#include "util/buttons/BrowseButton.hpp"
+#include "util/buttons/RoundButton.hpp"
+
+#include "qt4.hpp"
+#include "input_manager.hpp"
+#include <vlc_vout.h> /* vout_thread_t for aspect ratio combobox */
-#include <QScrollArea>
#include <QGroupBox>
#include <QLabel>
#include <QComboBox>
#include <QListWidget>
-
+#include <QSpinBox>
+#include <QRubberBand>
+#include <QDrag>
#include <QDragEnterEvent>
#include <QDialogButtonBox>
#include <QInputDialog>
+#include <QMimeData>
+
+#include <assert.h>
ToolbarEditDialog::ToolbarEditDialog( QWidget *_w, intf_thread_t *_p_intf)
: QVLCDialog( _w, _p_intf )
{
setWindowTitle( qtr( "Toolbars Editor" ) );
+ setWindowRole( "vlc-toolbars-editor" );
QGridLayout *mainLayout = new QGridLayout( this );
setMinimumWidth( 600 );
setAttribute( Qt::WA_DeleteOnClose );
getSettings()->value( "MainWindow/ToolbarPos", 0 ).toInt() ) );
mainTboxLayout->addWidget( positionCombo, 0, 2, 1, 1 );
- QLabel *line1Label = new QLabel( "Line 1:" );
+ QLabel *line1Label = new QLabel( qtr("Line 1:") );
QString line1 = getSettings()->value( "MainWindow/MainToolbar1",
MAIN_TB1_DEFAULT ).toString();
controller1 = new DroppingController( p_intf, line1,
mainTboxLayout->addWidget( line1Label, 1, 0, 1, 1 );
mainTboxLayout->addWidget( controller1, 1, 1, 1, 2 );
- QLabel *line2Label = new QLabel( "Line 2:" );
+ QLabel *line2Label = new QLabel( qtr("Line 2:") );
QString line2 = getSettings()->value( "MainWindow/MainToolbar2",
MAIN_TB2_DEFAULT ).toString();
controller2 = new DroppingController( p_intf, line2,
QToolButton *newButton = new QToolButton;
newButton->setIcon( QIcon( ":/new" ) );
+ newButton->setToolTip( qtr("New profile") );
QToolButton *deleteButton = new QToolButton;
deleteButton->setIcon( QIcon( ":/toolbar/clear" ) );
deleteButton->setToolTip( qtr( "Delete the current profile" ) );
user might hit on delete a bit too much, but discussion is opened. -- jb */
if( i_size == 0 )
{
+ profileCombo->addItem( PROFILE_NAME_6, QString( VALUE_6 ) );
profileCombo->addItem( PROFILE_NAME_1, QString( VALUE_1 ) );
profileCombo->addItem( PROFILE_NAME_2, QString( VALUE_2 ) );
profileCombo->addItem( PROFILE_NAME_3, QString( VALUE_3 ) );
void ToolbarEditDialog::close()
{
- msg_Dbg( p_intf, "Close and save" );
getSettings()->setValue( "MainWindow/ToolbarPos",
positionCombo->itemData( positionCombo->currentIndex() ).toInt() );
getSettings()->setValue( "MainWindow/MainToolbar1", controller1->getValue() );
/* Normal options */
setViewMode( QListView::IconMode );
- setSpacing( 20 );
+ setSpacing( 8 );
+ setGridSize( QSize(90, 50) );
+ setWrapping( true );
+ setWordWrap( true );
+ setTextElideMode( Qt::ElideNone );
setDragEnabled( true );
/* All the buttons do not need a special rendering */
{
QListWidgetItem *widgetItem = new QListWidgetItem( this );
widgetItem->setText( qtr( nameL[i] ) );
- widgetItem->setIcon( QIcon( iconL[i] ) );
+ QPixmap pix( iconL[i] );
+ widgetItem->setIcon( pix.scaled( 16, 16, Qt::KeepAspectRatio, Qt::SmoothTransformation ) );
widgetItem->setData( Qt::UserRole, QVariant( i ) );
addItem( widgetItem );
}
break;
case INPUT_SLIDER:
{
- InputSlider *slider = new InputSlider( Qt::Horizontal, this );
+ SeekSlider *slider = new SeekSlider( Qt::Horizontal, this );
widget = slider;
}
widgetItem->setText( qtr("Time Slider") );
QToolButton *prevSectionButton = new QToolButton( discFrame );
prevSectionButton->setIcon( QIcon( ":/toolbar/dvd_prev" ) );
+ prevSectionButton->setToolTip( qtr("Previous chapter") );
discLayout->addWidget( prevSectionButton );
QToolButton *menuButton = new QToolButton( discFrame );
menuButton->setIcon( QIcon( ":/toolbar/dvd_menu" ) );
+ menuButton->setToolTip( qtr("Go to the DVD menu") );
discLayout->addWidget( menuButton );
QToolButton *nextButton = new QToolButton( discFrame );
nextButton->setIcon( QIcon( ":/toolbar/dvd_next" ) );
+ nextButton->setToolTip( qtr("Next chapter") );
discLayout->addWidget( nextButton );
widget = discFrame;
telexLayout->addWidget( telexOn );
QToolButton *telexTransparent = new QToolButton;
- telexOn->setIcon( QIcon( ":/toolbar/tvtelx" ) );
+ telexTransparent->setIcon( QIcon( ":/toolbar/tvtelx" ) );
+ telexTransparent->setToolTip( qtr("Teletext transparency") );
telexLayout->addWidget( telexTransparent );
QSpinBox *telexPage = new QSpinBox;
}
widgetItem->setText( qtr("Advanced Buttons") );
break;
+ case PLAYBACK_BUTTONS:
+ {
+ widget = new QWidget;
+ DeckButtonsLayout *layout = new DeckButtonsLayout( widget );
+ BrowseButton *prev = new BrowseButton( widget, BrowseButton::Backward );
+ BrowseButton *next = new BrowseButton( widget );
+ RoundButton *play = new RoundButton( widget );
+ layout->setBackwardButton( prev );
+ layout->setForwardButton( next );
+ layout->setRoundButton( play );
+ }
+ widgetItem->setText( qtr("Playback Buttons") );
+ break;
+ case ASPECT_RATIO_COMBOBOX:
+ widget = new AspectRatioComboBox( p_intf );
+ widgetItem->setText( qtr("Aspect ratio selector") );
+ break;
+ case SPEED_LABEL:
+ widget = new SpeedLabel( p_intf, this );
+ widgetItem->setText( qtr("Speed selector") );
+ break;
+ case TIME_LABEL_ELAPSED:
+ widget = new QLabel( "2:42", this );
+ widgetItem->setText( qtr("Elapsed time") );
+ break;
+ case TIME_LABEL_REMAINING:
+ widget = new QLabel( "-2:42", this );
+ widgetItem->setText( qtr("Total/Remaining time") );
+ break;
default:
msg_Warn( p_intf, "This should not happen %i", i );
break;
QWidget *_parent )
: AbstractController( _p_intf, _parent )
{
+ RTL_UNAFFECTED_WIDGET
rubberband = NULL;
b_draging = false;
setAcceptDrops( true );
controlLayout->setMargin( 0 );
setFrameShape( QFrame::StyledPanel );
setFrameShadow( QFrame::Raised );
+ setMinimumHeight( 20 );
parseAndCreate( line, controlLayout );
}
{
hide();
QLayoutItem *child;
- int i =0;
while( (child = controlLayout->takeAt( 0 ) ) != 0 )
{
child->widget()->hide();
/* Overloading the AbstractController one, because we don't manage the
Spacing items in the same ways */
-void DroppingController::createAndAddWidget( QBoxLayout *controlLayout,
+void DroppingController::createAndAddWidget( QBoxLayout *newControlLayout,
int i_index,
buttonType_e i_type,
int i_option )
/* Install event Filter for drag'n drop */
label->installEventFilter( this );
- controlLayout->insertWidget( i_index, label );
+ newControlLayout->insertWidget( i_index, label );
}
/* Normal Widgets */
foreach( child, children )
{
QWidget *childWidg;
- if( childWidg = qobject_cast<QWidget *>( child ) )
+ if( ( childWidg = qobject_cast<QWidget *>( child ) ) )
{
child->installEventFilter( this );
childWidg->setEnabled( true );
/* Some Widgets are deactivated at creation */
widg->setEnabled( true );
widg->show();
- controlLayout->insertWidget( i_index, widg );
+ newControlLayout->insertWidget( i_index, widg );
}
/* QList and QBoxLayout don't act the same with insert() */
- if( i_index < 0 ) i_index = controlLayout->count() - 1;
+ if( i_index < 0 ) i_index = newControlLayout->count() - 1;
widgetList.insert( i_index, value );
}
}
if( i == -1 ) return true;
+ i_dragIndex = i;
+
doubleInt *dI = widgetList.at( i );
int i_type = dI->i_type;
/* Remove before the drag to not mess DropEvent,
that will createAndAddWidget */
widgetList.removeAt( i );
+ controlLayout->removeWidget( widg );
+ widg->hide();
/* Start the effective drag */
drag->exec(Qt::CopyAction | Qt::MoveAction, Qt::MoveAction);
- widg->hide();
- controlLayout->removeWidget( widg );
b_draging = false;
}
return true;
return false;
}
}
-