mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-22 05:33:32 +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 );
|
ui->setupUi( this );
|
||||||
|
|
||||||
QPushButton* saveButton = new QPushButton( tr( "&Create Playlist" ) );
|
m_saveButton = new QPushButton( tr( "&Create Playlist" ) );
|
||||||
saveButton->setDefault( true );
|
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( accepted() ), SLOT( savePlaylist() ) );
|
||||||
connect( ui->buttonBox, SIGNAL( rejected() ), SLOT( cancel() ) );
|
connect( ui->buttonBox, SIGNAL( rejected() ), SLOT( cancel() ) );
|
||||||
|
|
||||||
@@ -62,7 +64,14 @@ NewPlaylistWidget::changeEvent( QEvent* e )
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
NewPlaylistWidget::tagChanged()
|
NewPlaylistWidget::onTitleChanged( const QString& title )
|
||||||
|
{
|
||||||
|
m_saveButton->setEnabled( !title.isEmpty() );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
NewPlaylistWidget::onTagChanged()
|
||||||
{
|
{
|
||||||
m_tag = ui->tagEdit->text();
|
m_tag = ui->tagEdit->text();
|
||||||
|
|
||||||
|
@@ -10,6 +10,7 @@
|
|||||||
|
|
||||||
#include "dllmacro.h"
|
#include "dllmacro.h"
|
||||||
|
|
||||||
|
class QPushButton;
|
||||||
class PlaylistModel;
|
class PlaylistModel;
|
||||||
|
|
||||||
namespace Ui
|
namespace Ui
|
||||||
@@ -32,7 +33,9 @@ signals:
|
|||||||
void destroyed( QWidget* widget );
|
void destroyed( QWidget* widget );
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void tagChanged();
|
void onTitleChanged( const QString& title );
|
||||||
|
void onTagChanged();
|
||||||
|
|
||||||
void updateSuggestions();
|
void updateSuggestions();
|
||||||
void suggestionsFound();
|
void suggestionsFound();
|
||||||
|
|
||||||
@@ -47,6 +50,7 @@ private:
|
|||||||
|
|
||||||
QTimer m_filterTimer;
|
QTimer m_filterTimer;
|
||||||
QString m_tag;
|
QString m_tag;
|
||||||
|
QPushButton* m_saveButton;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // NEWPLAYLISTWIDGET_H
|
#endif // NEWPLAYLISTWIDGET_H
|
||||||
|
Reference in New Issue
Block a user