1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-04-05 00:22:31 +02:00

Added more tag attributes from metadata editor.

This commit is contained in:
Christopher Reichert 2012-06-30 18:39:06 -05:00
parent ac93b7e9f6
commit a928436eb5
3 changed files with 233 additions and 108 deletions

View File

@ -32,6 +32,7 @@
#include "taglib/fileref.h"
#include "filemetadata/taghandlers/tag.h"
#include "utils/TomahawkUtils.h"
MetadataEditor::MetadataEditor( Tomahawk::result_ptr result, QWidget *parent )
: QDialog( parent )
@ -46,8 +47,14 @@ MetadataEditor::MetadataEditor( Tomahawk::result_ptr result, QWidget *parent )
setArtist( result->artist()->name() );
setAlbum( result->album()->name() );
setDiscNumber( result->albumpos() );
setDuration( result->duration() );
setYear( result->year() );
setBitrate( result->bitrate() );
QFileInfo fi( QUrl( m_result->url() ).toLocalFile() );
setFileName( fi.fileName() );
setFileSize( TomahawkUtils::filesizeToString( fi.size() ) );
connect( ui->buttonBox, SIGNAL( accepted() ), SLOT( writeMetadata() ) );
connect( ui->buttonBox, SIGNAL( rejected() ), SLOT( close() ) );
}
@ -119,8 +126,36 @@ MetadataEditor::setDiscNumber( unsigned int num )
}
void
MetadataEditor::setDuration( unsigned int duration )
{
ui->durationLineEdit->setText( TomahawkUtils::timeToString( duration ) );
}
void
MetadataEditor::setYear( int year )
{
ui->yearLineEdit->setText( QString( "%1" ).arg( year ) );
}
void
MetadataEditor::setBitrate( unsigned int bitrate )
{
ui->bitrateLabel->setNum( (int) bitrate );
ui->bitrateLineEdit->setText( QString( "%1" ).arg( bitrate ) );
}
void
MetadataEditor::setFileName( const QString& fn )
{
ui->fileNameLineEdit->setText( fn );
}
void
MetadataEditor::setFileSize( const QString& size )
{
ui->fileSizeLineEdit->setText( size );
}

View File

@ -46,12 +46,19 @@ public:
private slots:
void writeMetadata();
/* tag attributes */
void setTitle( const QString& title );
void setArtist( const QString& artist );
void setAlbum( const QString& album );
void setDiscNumber( unsigned int num );
void setDuration( unsigned int duration );
void setYear( int year );
void setBitrate( unsigned int num );
/* file attributes */
void setFileName( const QString& fn );
void setFileSize( const QString& size );
private:
Ui::MetadataEditor* ui;

View File

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>367</width>
<height>223</height>
<width>404</width>
<height>298</height>
</rect>
</property>
<property name="windowTitle">
@ -15,118 +15,201 @@
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QGroupBox" name="groupBox">
<widget class="QTabWidget" name="tabWidget">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="title">
<string>Tags</string>
<property name="currentIndex">
<number>0</number>
</property>
<property name="flat">
<bool>false</bool>
</property>
<property name="checkable">
<bool>false</bool>
</property>
<layout class="QFormLayout" name="formLayout">
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Title:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="titleLineEdit">
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
<property name="placeholderText">
<string>Title...</string>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QLineEdit" name="artistLineEdit">
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
<property name="placeholderText">
<string>Artist...</string>
</property>
</widget>
</item>
<item row="9" column="1">
<widget class="QLineEdit" name="albumLineEdit">
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
<property name="placeholderText">
<string>Album...</string>
</property>
</widget>
</item>
<item row="12" column="1">
<widget class="QSpinBox" name="discNumberSpinBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
<property name="buttonSymbols">
<enum>QAbstractSpinBox::NoButtons</enum>
</property>
<property name="minimum">
<number>1</number>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Artist:</string>
</property>
</widget>
</item>
<item row="9" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Album</string>
</property>
</widget>
</item>
<item row="12" column="0">
<widget class="QLabel" name="label_5">
<property name="text">
<string>Disc Number:</string>
</property>
</widget>
</item>
<item row="13" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Bitrate:</string>
</property>
</widget>
</item>
<item row="13" column="1">
<widget class="QLabel" name="bitrateLabel">
<property name="text">
<string/>
</property>
</widget>
</item>
</layout>
<widget class="QWidget" name="tabWidgetPage1" native="true">
<attribute name="title">
<string>Tags</string>
</attribute>
<layout class="QFormLayout" name="formLayout">
<property name="fieldGrowthPolicy">
<enum>QFormLayout::ExpandingFieldsGrow</enum>
</property>
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Title:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="titleLineEdit">
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
<property name="placeholderText">
<string>Title...</string>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Artist:</string>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QLineEdit" name="artistLineEdit">
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
<property name="placeholderText">
<string>Artist...</string>
</property>
</widget>
</item>
<item row="9" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Album</string>
</property>
</widget>
</item>
<item row="9" column="1">
<widget class="QLineEdit" name="albumLineEdit">
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
<property name="placeholderText">
<string>Album...</string>
</property>
</widget>
</item>
<item row="12" column="0">
<widget class="QLabel" name="label_5">
<property name="text">
<string>Disc Number:</string>
</property>
</widget>
</item>
<item row="12" column="1">
<widget class="QSpinBox" name="discNumberSpinBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
<property name="buttonSymbols">
<enum>QAbstractSpinBox::NoButtons</enum>
</property>
<property name="minimum">
<number>1</number>
</property>
</widget>
</item>
<item row="15" column="0">
<widget class="QLabel" name="label_6">
<property name="text">
<string>Duration:</string>
</property>
</widget>
</item>
<item row="15" column="1">
<widget class="QLineEdit" name="durationLineEdit">
<property name="readOnly">
<bool>true</bool>
</property>
<property name="placeholderText">
<string>00.00</string>
</property>
</widget>
</item>
<item row="19" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Bitrate:</string>
</property>
</widget>
</item>
<item row="19" column="1">
<widget class="QLineEdit" name="bitrateLineEdit">
<property name="readOnly">
<bool>true</bool>
</property>
<property name="placeholderText">
<string>Bitrate...</string>
</property>
</widget>
</item>
<item row="17" column="1">
<widget class="QLineEdit" name="yearLineEdit">
<property name="readOnly">
<bool>true</bool>
</property>
<property name="placeholderText">
<string>Year...</string>
</property>
</widget>
</item>
<item row="17" column="0">
<widget class="QLabel" name="label_9">
<property name="text">
<string>Year:</string>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="tab">
<attribute name="title">
<string>File</string>
</attribute>
<layout class="QFormLayout" name="formLayout_2">
<item row="0" column="0">
<widget class="QLabel" name="label_7">
<property name="text">
<string>File Name:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="fileNameLineEdit">
<property name="readOnly">
<bool>true</bool>
</property>
<property name="placeholderText">
<string>File Name...</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="fileSizeLineEdit">
<property name="text">
<string>File Size...</string>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
<property name="placeholderText">
<string>File size...</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_8">
<property name="text">
<string>File Size:</string>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
<item>