1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-21 13:21:52 +02:00

* Prevent users from creating playlists with an empty title.

This commit is contained in:
Christian Muehlhaeuser
2011-01-21 03:59:22 +01:00
parent 82486fdfd4
commit 3a1faf17ec
2 changed files with 19 additions and 6 deletions

View File

@@ -23,12 +23,14 @@ NewPlaylistWidget::NewPlaylistWidget( QWidget* parent )
{
ui->setupUi( this );
QPushButton* saveButton = new QPushButton( tr( "&Create Playlist" ) );
saveButton->setDefault( true );
m_saveButton = new QPushButton( tr( "&Create Playlist" ) );
m_saveButton->setDefault( true );
m_saveButton->setEnabled( false );
ui->buttonBox->addButton( saveButton, QDialogButtonBox::AcceptRole );
ui->buttonBox->addButton( m_saveButton, QDialogButtonBox::AcceptRole );
connect( ui->tagEdit, SIGNAL( textChanged( QString ) ), SLOT( tagChanged() ) );
connect( ui->titleEdit, SIGNAL( textChanged( QString ) ), SLOT( onTitleChanged( QString ) ) );
connect( ui->tagEdit, SIGNAL( textChanged( QString ) ), SLOT( onTagChanged() ) );
connect( ui->buttonBox, SIGNAL( accepted() ), SLOT( savePlaylist() ) );
connect( ui->buttonBox, SIGNAL( rejected() ), SLOT( cancel() ) );
@@ -62,7 +64,14 @@ NewPlaylistWidget::changeEvent( QEvent* e )
void
NewPlaylistWidget::tagChanged()
NewPlaylistWidget::onTitleChanged( const QString& title )
{
m_saveButton->setEnabled( !title.isEmpty() );
}
void
NewPlaylistWidget::onTagChanged()
{
m_tag = ui->tagEdit->text();

View File

@@ -10,6 +10,7 @@
#include "dllmacro.h"
class QPushButton;
class PlaylistModel;
namespace Ui
@@ -32,7 +33,9 @@ signals:
void destroyed( QWidget* widget );
private slots:
void tagChanged();
void onTitleChanged( const QString& title );
void onTagChanged();
void updateSuggestions();
void suggestionsFound();
@@ -47,6 +50,7 @@ private:
QTimer m_filterTimer;
QString m_tag;
QPushButton* m_saveButton;
};
#endif // NEWPLAYLISTWIDGET_H