Commit b74a7b1a authored by Francois Cartegnie's avatar Francois Cartegnie

Qt: info_panels: use validation mask for tracknumber/total input

parent 712c81e7
......@@ -107,16 +107,12 @@ MetaPanel::MetaPanel( QWidget *parent,
label->setFont( smallFont ); label->setContentsMargins( 3, 2, 0, 0 );
metaLayout->addWidget( label, line - 1, 7, 1, 3 );
seqnum_text = new QLineEdit;
seqnum_text->setMaximumWidth( 60 );
metaLayout->addWidget( seqnum_text, line, 7, 1, 1 );
tracknumber_text = new QLineEdit;
tracknumber_text->setAlignment( Qt::AlignRight );
tracknumber_text->setInputMask("0000/0000");
tracknumber_text->setMaximumWidth( 128 );
metaLayout->addWidget( tracknumber_text, line, 7, 1, -1 );
label = new QLabel( "/" ); label->setFont( smallFont );
metaLayout->addWidget( label, line, 8, 1, 1 );
seqtot_text = new QLineEdit;
seqtot_text->setMaximumWidth( 60 );
metaLayout->addWidget( seqtot_text, line, 9, 1, 1 );
line++;
/* Rating - on the same line */
......@@ -165,8 +161,7 @@ MetaPanel::MetaPanel( QWidget *parent,
metaLayout->setRowStretch( line, 10 );
#undef ADD_META
CONNECT( seqnum_text, textEdited( QString ), this, enterEditMode() );
CONNECT( seqtot_text, textEdited( QString ), this, enterEditMode() );
CONNECT( tracknumber_text, textEdited( QString ), this, enterEditMode() );
CONNECT( date_text, textEdited( QString ), this, enterEditMode() );
CONNECT( THEMIM->getIM(), artChanged( QString ), this, enterEditMode() );
......@@ -231,8 +226,16 @@ void MetaPanel::update( input_item_t *p_item )
UPDATE_META( EncodedBy, encodedby_text );
UPDATE_META( Date, date_text );
UPDATE_META( TrackNum, seqnum_text );
UPDATE_META( TrackTotal, seqtot_text );
QString trackposition( "%1/%2" );
psz_meta = input_item_GetTrackNum( p_item );
trackposition = trackposition.arg( psz_meta );
free( psz_meta );
psz_meta = input_item_GetTrackTotal( p_item );
trackposition = trackposition.arg( psz_meta );
free( psz_meta );
tracknumber_text->setText( trackposition );
// UPDATE_META( Setting, setting_text );
// UPDATE_META_INT( Rating, rating_text );
......@@ -281,8 +284,9 @@ void MetaPanel::saveMeta()
input_item_SetArtist( p_input, qtu( artist_text->text() ) );
input_item_SetAlbum( p_input, qtu( collection_text->text() ) );
input_item_SetGenre( p_input, qtu( genre_text->text() ) );
input_item_SetTrackNum( p_input, qtu( seqnum_text->text() ) );
input_item_SetTrackTotal( p_input, qtu( seqtot_text->text() ) );
QStringList trackparts = tracknumber_text->text().split( "/" );
input_item_SetTrackNum( p_input, qtu( trackparts[0] ) );
input_item_SetTrackTotal( p_input, qtu( trackparts[1] ) );
input_item_SetDate( p_input, qtu( date_text->text() ) );
input_item_SetCopyright( p_input, qtu( copyright_text->text() ) );
......@@ -324,8 +328,7 @@ void MetaPanel::clear()
genre_text->clear();
copyright_text->clear();
collection_text->clear();
seqnum_text->clear();
seqtot_text->clear();
tracknumber_text->clear();
description_text->clear();
date_text->clear();
language_text->clear();
......
......@@ -72,8 +72,7 @@ private:
QLineEdit *genre_text;
QLineEdit *copyright_text;
QLineEdit *collection_text;
QLineEdit *seqnum_text;
QLineEdit *seqtot_text;
QLineEdit *tracknumber_text;
QTextEdit *description_text;
// QSpinBox *rating_text;
......
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