1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-07-31 03:10:12 +02:00

add a quick spinbox to control generated number

This commit is contained in:
Leo Franchi
2011-01-13 18:41:50 -05:00
parent 327df4bedc
commit c465325cdf
2 changed files with 12 additions and 2 deletions

View File

@@ -27,6 +27,7 @@
#include "trackproxymodel.h" #include "trackproxymodel.h"
#include "dynamic/GeneratorInterface.h" #include "dynamic/GeneratorInterface.h"
#include "dynamic/GeneratorFactory.h" #include "dynamic/GeneratorFactory.h"
#include <QSpinBox>
using namespace Tomahawk; using namespace Tomahawk;
@@ -64,6 +65,11 @@ DynamicWidget::DynamicWidget( const Tomahawk::dynplaylist_ptr& playlist, QWidget
m_headerLayout->addStretch( 1 ); m_headerLayout->addStretch( 1 );
m_genNumber = new QSpinBox( this );
m_genNumber->setValue( 15 );
m_genNumber->setMinimum( 0 );
m_genNumber->hide();
m_logo = new QLabel( this ); m_logo = new QLabel( this );
if( !playlist->generator()->logo().isNull() ) { if( !playlist->generator()->logo().isNull() ) {
QPixmap p = playlist->generator()->logo().scaledToHeight( m_headerText->height(), Qt::SmoothTransformation ); QPixmap p = playlist->generator()->logo().scaledToHeight( m_headerText->height(), Qt::SmoothTransformation );
@@ -147,7 +153,7 @@ DynamicWidget::generateOrStart()
if( m_playlist->mode() == Static ) if( m_playlist->mode() == Static )
{ {
// get the items from the generator, and put them in the playlist // get the items from the generator, and put them in the playlist
m_playlist->generator()->generate( 15 ); m_playlist->generator()->generate( m_genNumber->value() );
} }
} }
@@ -166,9 +172,11 @@ void DynamicWidget::applyModeChange( int mode )
if( mode == OnDemand ) if( mode == OnDemand )
{ {
m_generateButton->setText( tr( "Play" ) ); m_generateButton->setText( tr( "Play" ) );
m_genNumber->hide();
} else if( mode == Static ) { } else if( mode == Static ) {
m_generateButton->setText( tr( "Generate" ) ); m_generateButton->setText( tr( "Generate" ) );
m_genNumber->show();
m_headerLayout->insertWidget( 4, m_genNumber );
} }
} }

View File

@@ -23,6 +23,7 @@
#include "dynamic/DynamicPlaylist.h" #include "dynamic/DynamicPlaylist.h"
#include "dynamic/DynamicControl.h" #include "dynamic/DynamicControl.h"
class QSpinBox;
class QVBoxLayout; class QVBoxLayout;
class QHBoxLayout; class QHBoxLayout;
class QPushButton; class QPushButton;
@@ -76,6 +77,7 @@ private:
QComboBox* m_generatorCombo; QComboBox* m_generatorCombo;
QLabel* m_logo; QLabel* m_logo;
QPushButton* m_generateButton; QPushButton* m_generateButton;
QSpinBox* m_genNumber;
DynamicControlList* m_controls; DynamicControlList* m_controls;
AnimatedSplitter* m_splitter; AnimatedSplitter* m_splitter;