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:
@@ -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();
|
||||
|
||||
|
@@ -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
|
||||
|
Reference in New Issue
Block a user