Commit 76daf6f9 authored by Urs Fleisch's avatar Urs Fleisch
Browse files

New function app.selectionInfo.formatString() in QML API.

parent 538f9d18
......@@ -4117,6 +4117,7 @@ app.selectionInfo.filePath: Absoluter Dateiname
app.selectionInfo.detailInfo: Format Details
app.selectionInfo.tagFormatV1: Tag 1 Format
app.selectionInfo.tagFormatV2: Tag 2 Format
app.selectionInfo.formatString(tag, format): Ersetze Format-Codes
</programlisting>
<para>
......
......@@ -3946,6 +3946,7 @@ app.selectionInfo.filePath: Absolute file path
app.selectionInfo.detailInfo: Format details
app.selectionInfo.tagFormatV1: Tag 1 format
app.selectionInfo.tagFormatV2: Tag 2 format
app.selectionInfo.formatString(tag, format): Substitute codes in format string
</programlisting>
<para>
......
......@@ -26,7 +26,7 @@
#include "taggedfileselection.h"
#include "taggedfile.h"
#include "frame.h"
#include "trackdata.h"
#include "frametablemodel.h"
#include "fileproxymodel.h"
#include "pictureframe.h"
......@@ -275,6 +275,22 @@ QByteArray TaggedFileSelection::getPicture() const
return data;
}
/**
* Replace codes in format string with information from the tags.
* @param tagVersion tag version
* @param fmt format string
* @return string with format codes replaced.
*/
QString TaggedFileSelection::formatString(Frame::TagVersion tagVersion,
const QString& fmt)
{
if (!m_state.m_singleFile)
return fmt;
TrackData trackData(*m_state.m_singleFile, tagVersion);
return trackData.formatString(fmt);
}
/**
* Select changed frames in the tables if multiple files are selected.
*/
......
......@@ -28,6 +28,7 @@
#define TAGGEDFILESELECTION_H
#include <QObject>
#include "frame.h"
#include "kid3api.h"
class FrameTableModel;
......@@ -184,6 +185,15 @@ public:
*/
QByteArray getPicture() const;
/**
* Replace codes in format string with information from the tags.
* @param tagVersion tag version
* @param fmt format string
* @return string with format codes replaced.
*/
Q_INVOKABLE QString formatString(Frame::TagVersion tagVersion,
const QString& fmt);
/**
* Select changed frames in the tables if multiple files are selected.
*/
......
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