mirror of
https://bitbucket.org/smil3y/kdelibs.git
synced 2025-02-23 18:32:49 +00:00
kio: use kio4 catalog in metadata plugins
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
2485fe0959
commit
b4f5cc99f6
5 changed files with 21 additions and 9 deletions
|
@ -17,10 +17,13 @@
|
|||
*/
|
||||
|
||||
#include "kfilemetadata.h"
|
||||
#include "kglobal.h"
|
||||
#include "klocale.h"
|
||||
|
||||
KFileMetaDataPlugin::KFileMetaDataPlugin(QObject *parent)
|
||||
: QObject(parent)
|
||||
{
|
||||
KGlobal::locale()->insertCatalog("kio4");
|
||||
}
|
||||
|
||||
KFileMetaDataPlugin::~KFileMetaDataPlugin()
|
||||
|
|
|
@ -30,6 +30,12 @@
|
|||
/*!
|
||||
Base class for plugins to retrieve file metadata.
|
||||
|
||||
There are two template strings that are localized and can be used by plugins where appropriate:
|
||||
@code
|
||||
const QString bitratestring = i18nc("kfilemetadata", "%1 kb/s", bitrate);
|
||||
const QString sampleratestring = i18nc("kfilemetadata", "%1 Hz", samplerate);
|
||||
@endcode
|
||||
|
||||
@since 4.21
|
||||
@note all virtual methods, despite not being pure-virtual, must be reimplemented
|
||||
*/
|
||||
|
|
|
@ -231,6 +231,9 @@ QStringList KFileMetaInfo::supportedKeys()
|
|||
|
||||
QString KFileMetaInfo::name(const QString& key)
|
||||
{
|
||||
I18N_NOOP2("kfilemetadata", "%1 kb/s");
|
||||
I18N_NOOP2("kfilemetadata", "%1 Hz");
|
||||
|
||||
typedef std::map<QString,QString> TranslationMap;
|
||||
|
||||
static const TranslationMap s_translations = {
|
||||
|
@ -251,6 +254,11 @@ QString KFileMetaInfo::name(const QString& key)
|
|||
{ "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#channels", i18nc("@label", "Channels") },
|
||||
{ "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#duration", i18nc("@label", "Duration") },
|
||||
{ "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#frameRate", i18nc("@label", "Frame Rate") },
|
||||
{ "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#videoCodec", i18nc("@label", "Video Codec") },
|
||||
{ "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#audioCodec", i18nc("@label", "Audio Codec") },
|
||||
{ "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#subtitleCodec", i18nc("@label", "Subtitle Codec") },
|
||||
{ "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#audioBitRate", i18nc("@label", "Audio Bit Rate") },
|
||||
{ "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#videoBitRate", i18nc("@label", "Video Bit Rate") },
|
||||
{ "http://www.semanticdesktop.org/ontologies/2007/01/19/nie#copyright", i18nc("@label", "Copyright") },
|
||||
{ "http://www.semanticdesktop.org/ontologies/2007/01/19/nie#comment", i18nc("@label", "Comment") },
|
||||
{ "http://www.semanticdesktop.org/ontologies/2007/01/19/nie#title", i18nc("@label music title", "Title") },
|
||||
|
@ -285,11 +293,6 @@ QString KFileMetaInfo::name(const QString& key)
|
|||
{ "http://www.semanticdesktop.org/ontologies/2007/05/10/nexif#isoSpeedRatings", i18nc("@label EXIF", "ISO Speed Ratings") },
|
||||
{ "http://www.semanticdesktop.org/ontologies/2007/05/10/nexif#meteringMode", i18nc("@label EXIF", "Metering Mode") },
|
||||
{ "http://www.semanticdesktop.org/ontologies/2007/05/10/nexif#whiteBalance", i18nc("@label EXIF", "White Balance") },
|
||||
{ "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#videoCodec", i18nc("@label", "Video Codec") },
|
||||
{ "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#audioCodec", i18nc("@label", "Audio Codec") },
|
||||
{ "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#subtitleCodec", i18nc("@label", "Subtitle Codec") },
|
||||
{ "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#audioBitRate", i18nc("@label", "Audio Bit Rate") },
|
||||
{ "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#videoBitRate", i18nc("@label", "Video Bit Rate") },
|
||||
// TODO: implement
|
||||
{ "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#pageCount", i18nc("@label", "Page Count") },
|
||||
{ "http://www.semanticdesktop.org/ontologies/2007/03/22/nco#creator", i18nc("@label", "Creator") },
|
||||
|
|
|
@ -132,7 +132,7 @@ QList<KFileMetaInfoItem> KFileMetaDataFFmpegPlugin::metaData(const KUrl &url, co
|
|||
);
|
||||
}
|
||||
if (ffmpegcodec->bit_rate > 0) {
|
||||
const QString ffmpegbitrate = i18n("%1 kb/s", ffmpegcodec->bit_rate / 1000);
|
||||
const QString ffmpegbitrate = i18nc("kfilemetadata", "%1 kb/s", ffmpegcodec->bit_rate / 1000);
|
||||
result.append(
|
||||
KFileMetaInfoItem(
|
||||
QString::fromLatin1("http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#videoBitRate"),
|
||||
|
@ -164,7 +164,7 @@ QList<KFileMetaInfoItem> KFileMetaDataFFmpegPlugin::metaData(const KUrl &url, co
|
|||
);
|
||||
}
|
||||
if (ffmpegcodec->bit_rate > 0) {
|
||||
const QString ffmpegbitrate = i18n("%1 kb/s", ffmpegcodec->bit_rate / 1000);
|
||||
const QString ffmpegbitrate = i18nc("kfilemetadata", "%1 kb/s", ffmpegcodec->bit_rate / 1000);
|
||||
result.append(
|
||||
KFileMetaInfoItem(
|
||||
QString::fromLatin1("http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#audioBitRate"),
|
||||
|
|
|
@ -186,7 +186,7 @@ QList<KFileMetaInfoItem> KFileMetaDataTagLibPlugin::metaData(const KUrl &url, co
|
|||
)
|
||||
);
|
||||
}
|
||||
const QString taglibbitrate = i18n("%1 kb/s", taglibaudio->bitrate());
|
||||
const QString taglibbitrate = i18nc("kfilemetadata", "%1 kb/s", taglibaudio->bitrate());
|
||||
if (!taglibbitrate.isEmpty() && taglibaudio->bitrate() > 0) {
|
||||
result.append(
|
||||
KFileMetaInfoItem(
|
||||
|
@ -195,7 +195,7 @@ QList<KFileMetaInfoItem> KFileMetaDataTagLibPlugin::metaData(const KUrl &url, co
|
|||
)
|
||||
);
|
||||
}
|
||||
const QString taglibsamplerate = i18n("%1 Hz", taglibaudio->sampleRate());
|
||||
const QString taglibsamplerate = i18nc("kfilemetadata", "%1 Hz", taglibaudio->sampleRate());
|
||||
if (!taglibsamplerate.isEmpty() && taglibaudio->sampleRate() > 0) {
|
||||
result.append(
|
||||
KFileMetaInfoItem(
|
||||
|
|
Loading…
Add table
Reference in a new issue