Commit 99b1edc0 authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

Qt: remove random and repeat buttons from playlist

And clean the code.
parent de5baa43
......@@ -62,7 +62,7 @@ private:
QWidget *parent;
QLabel *title;
QTreeView *view;
QPushButton *repeatButton, *randomButton, *addButton, *gotoPlayingButton;
QPushButton *addButton, *gotoPlayingButton;
int currentRootId;
QSignalMapper *selectColumnsSigMapper;
......@@ -72,8 +72,6 @@ public slots:
private slots:
void deleteSelection();
void handleExpansion( const QModelIndex& );
void toggleRandom();
void toggleRepeat();
void gotoPlayingItem();
void doPopup( QModelIndex index, QPoint point );
void search( const QString& searchText );
......
......@@ -456,35 +456,6 @@ QStringList PLModel::selectedURIs()
return lst;
}
/************************* General playlist status ***********************/
bool PLModel::hasRandom()
{
return var_GetBool( p_playlist, "random" );
}
bool PLModel::hasRepeat()
{
return var_GetBool( p_playlist, "repeat" );
}
bool PLModel::hasLoop()
{
return var_GetBool( p_playlist, "loop" );
}
void PLModel::setLoop( bool on )
{
var_SetBool( p_playlist, "loop", on ? true:false );
config_PutInt( p_playlist, "loop", on ? 1: 0 );
}
void PLModel::setRepeat( bool on )
{
var_SetBool( p_playlist, "repeat", on ? true:false );
config_PutInt( p_playlist, "repeat", on ? 1: 0 );
}
void PLModel::setRandom( bool on )
{
var_SetBool( p_playlist, "random", on ? true:false );
config_PutInt( p_playlist, "random", on ? 1: 0 );
}
/************************* Lookups *****************************/
......
......@@ -81,7 +81,6 @@ public:
/* Lookups */
QStringList selectedURIs();
bool hasRandom(); bool hasLoop(); bool hasRepeat();
QModelIndex index( PLItem *, int c ) const;
QModelIndex currentIndex( ) { return index( currentItem, 0 ); };
bool isCurrent( const QModelIndex &index ) const;
......@@ -144,9 +143,6 @@ signals:
public slots:
void activateItem( const QModelIndex &index );
void activateItem( playlist_item_t *p_item );
void setRandom( bool );
void setLoop( bool );
void setRepeat( bool );
private slots:
void popupPlay();
......
/*****************************************************************************
* standardpanel.cpp : The "standard" playlist panel : just a treeview
****************************************************************************
* Copyright (C) 2000-2005 the VideoLAN team
* Copyright (C) 2000-2009 VideoLAN
* $Id$
*
* Authors: Clément Stenac <zorglub@videolan.org>
* JB Kempf
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
......@@ -118,38 +119,6 @@ StandardPLPanel::StandardPLPanel( PlaylistWidget *_parent,
BUTTONACT( addButton, popupAdd() );
buttons->addWidget( addButton );
/* Random 2-state button */
randomButton = new QPushButton( this );
randomButton->setIcon( QIcon( ":/buttons/playlist/shuffle_on" ));
randomButton->setToolTip( qtr( I_PL_RANDOM ));
randomButton->setCheckable( true );
randomButton->setChecked( model->hasRandom() );
BUTTONACT( randomButton, toggleRandom() );
buttons->addWidget( randomButton );
/* Repeat 3-state button */
repeatButton = new QPushButton( this );
repeatButton->setToolTip( qtr( "Click to toggle between loop one, loop all" ) );
repeatButton->setCheckable( true );
if( model->hasRepeat() )
{
repeatButton->setIcon( QIcon( ":/buttons/playlist/repeat_one" ) );
repeatButton->setChecked( true );
}
else if( model->hasLoop() )
{
repeatButton->setIcon( QIcon( ":/buttons/playlist/repeat_all" ) );
repeatButton->setChecked( true );
}
else
{
repeatButton->setIcon( QIcon( ":/buttons/playlist/repeat_one" ) );
repeatButton->setChecked( false );
}
BUTTONACT( repeatButton, toggleRepeat() );
buttons->addWidget( repeatButton );
/* Goto */
gotoPlayingButton = new QPushButton;
BUTTON_SET_ACT_I( gotoPlayingButton, "", buttons/playlist/jump_to,
......@@ -186,36 +155,6 @@ StandardPLPanel::StandardPLPanel( PlaylistWidget *_parent,
CONNECT( selectColumnsSigMapper, mapped( int ), this, toggleColumnShown( int ) );
}
/* Function to toggle between the Repeat states */
void StandardPLPanel::toggleRepeat()
{
if( model->hasRepeat() )
{
model->setRepeat( false ); model->setLoop( true );
repeatButton->setIcon( QIcon( ":/buttons/playlist/repeat_all" ) );
repeatButton->setChecked( true );
}
else if( model->hasLoop() )
{
model->setRepeat( false ) ; model->setLoop( false );
repeatButton->setChecked( false );
repeatButton->setIcon( QIcon( ":/buttons/playlist/repeat_one" ) );
}
else
{
model->setRepeat( true ); model->setLoop( false );
repeatButton->setChecked( true );
repeatButton->setIcon( QIcon( ":/buttons/playlist/repeat_one" ) );
}
}
/* Function to toggle between the Random states */
void StandardPLPanel::toggleRandom()
{
bool prev = model->hasRandom();
model->setRandom( !prev );
}
void StandardPLPanel::gotoPlayingItem()
{
view->scrollTo( model->currentIndex() );
......
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