~ubuntu-branches/ubuntu/saucy/digikam/saucy

« back to all changes in this revision

Viewing changes to extra/kipi-plugins/metadataedit/xmp/xmpsubjects.cpp

  • Committer: Package Import Robot
  • Author(s): Felix Geyer, Rohan Garg, Philip Muškovac, Felix Geyer
  • Date: 2011-09-23 18:18:55 UTC
  • mfrom: (1.2.36 upstream)
  • Revision ID: package-import@ubuntu.com-20110923181855-ifs67wxkugshev9k
Tags: 2:2.1.1-0ubuntu1
[ Rohan Garg ]
* New upstream release (LP: #834190)
  - debian/control
    + Build with libqtwebkit-dev
 - debian/kipi-plugins-common
    + Install libkvkontakte required by kipi-plugins
 - debian/digikam
    + Install panoramagui

[ Philip Muškovac ]
* New upstream release
  - debian/control:
    + Add libcv-dev, libcvaux-dev, libhighgui-dev, libboost-graph1.46-dev,
      libksane-dev, libxml2-dev, libxslt-dev, libqt4-opengl-dev, libqjson-dev,
      libgpod-dev and libqca2-dev to build-deps
    + Add packages for kipi-plugins, libmediawiki, libkface, libkgeomap and
      libkvkontakte
  - debian/rules:
    + Don't build with gphoto2 since it doesn't build with it.
  - Add kubuntu_fix_test_linking.diff to fix linking of the dngconverter test
  - update install files
  - update kubuntu_01_mysqld_executable_name.diff for new cmake layout
    and rename to kubuntu_mysqld_executable_name.diff
* Fix typo in digikam-data description (LP: #804894)
* Fix Vcs links

[ Felix Geyer ]
* Move library data files to the new packages libkface-data, libkgeomap-data
  and libkvkontakte-data.
* Override version of the embedded library packages to 1.0~digikam<version>.
* Exclude the library packages from digikam-dbg to prevent file conflicts in
  the future.
* Call dh_install with --list-missing.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* ============================================================
 
2
 *
 
3
 * This file is a part of kipi-plugins project
 
4
 * http://www.kipi-plugins.org
 
5
 *
 
6
 * Date        : 2006-10-15
 
7
 * Description : XMP subjects settings page.
 
8
 *
 
9
 * Copyright (C) 2006-2011 by Gilles Caulier <caulier dot gilles at gmail dot com>
 
10
 * Copyright (C) 2009      by Andi Clemens <andi dot clemens at gmx dot net>
 
11
 *
 
12
 * This program is free software; you can redistribute it
 
13
 * and/or modify it under the terms of the GNU General
 
14
 * Public License as published by the Free Software Foundation;
 
15
 * either version 2, or (at your option) any later version.
 
16
 *
 
17
 * This program is distributed in the hope that it will be useful,
 
18
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
19
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
20
 * GNU General Public License for more details.
 
21
 *
 
22
 * ============================================================ */
 
23
 
 
24
#include "xmpsubjects.moc"
 
25
 
 
26
// Qt includes
 
27
 
 
28
#include <QValidator>
 
29
 
 
30
// KDE includes
 
31
 
 
32
#include <klocale.h>
 
33
 
 
34
// LibKExiv2 includes
 
35
 
 
36
#include <libkexiv2/kexiv2.h>
 
37
 
 
38
namespace KIPIMetadataEditPlugin
 
39
{
 
40
 
 
41
XMPSubjects::XMPSubjects(QWidget* parent)
 
42
           : SubjectWidget(parent)
 
43
{
 
44
    // Subject string do not accept these characters:
 
45
    // - '*' (\x2A)
 
46
    // - ':' (\x3A)
 
47
    // - '?' (\x3F)
 
48
    QRegExp subjectRx("[^*:?]+$");
 
49
    QValidator* subjectValidator = new QRegExpValidator(subjectRx, this);
 
50
 
 
51
    // --------------------------------------------------------
 
52
 
 
53
    m_iprEdit->setText(QString("XMP"));
 
54
    m_iprEdit->setValidator(subjectValidator);
 
55
    m_iprEdit->setWhatsThis(i18n("Enter here the Informative Provider Reference. "
 
56
                                  "I.P.R is a name registered with the XMP/NAA, identifying the "
 
57
                                  "provider that provides an indicator of the content. "
 
58
                                  "The default value for the I.P.R is \"XMP\" if a standard Reference "
 
59
                                  "Code is used."));
 
60
 
 
61
    m_refEdit->setWhatsThis(i18n("Enter here the Subject Reference Number. "
 
62
                                 "Provides a numeric code to indicate the Subject Name plus "
 
63
                                 "optional Subject Matter and Subject Detail Names in the "
 
64
                                 "language of the service. Subject Reference is a number "
 
65
                                 "from the range 01000000 to 17999999 and represent a "
 
66
                                 "language independent international reference to "
 
67
                                 "a Subject. A Subject is identified by its Reference Number "
 
68
                                 "and corresponding Names taken from a standard lists given "
 
69
                                 "by XMP/NAA. If a standard reference code is used, these lists "
 
70
                                 "are the English language reference versions. "
 
71
                                 "This field is limited to 8 digit code."));
 
72
 
 
73
    m_nameEdit->setValidator(subjectValidator);
 
74
    m_nameEdit->setWhatsThis(i18n("Enter here the Subject Name. English language is used "
 
75
                                  "if you selected a standard XMP/NAA reference code."));
 
76
 
 
77
    m_matterEdit->setValidator(subjectValidator);
 
78
    m_matterEdit->setWhatsThis(i18n("Enter here the Subject Matter Name. English language is used "
 
79
                                    "if you selected a standard XMP/NAA reference code."));
 
80
 
 
81
    m_detailEdit->setValidator(subjectValidator);
 
82
    m_detailEdit->setWhatsThis(i18n("Enter here the Subject Detail Name. English language is used "
 
83
                                    "if you selected a standard XMP/NAA reference code."));
 
84
 
 
85
    // reset the note label, not used in XMP view
 
86
    delete m_note;
 
87
 
 
88
    m_subjectsCheck->setVisible(true);
 
89
}
 
90
 
 
91
XMPSubjects::~XMPSubjects()
 
92
{
 
93
}
 
94
 
 
95
void XMPSubjects::readMetadata(QByteArray& xmpData)
 
96
{
 
97
    KExiv2 exiv2Iface;
 
98
    exiv2Iface.setXmp(xmpData);
 
99
    setSubjectsList(exiv2Iface.getXmpSubjects());
 
100
}
 
101
 
 
102
void XMPSubjects::applyMetadata(QByteArray& xmpData)
 
103
{
 
104
    KExiv2 exiv2Iface;
 
105
    exiv2Iface.setXmp(xmpData);
 
106
    QStringList newSubjects = subjectsList();
 
107
 
 
108
    // We remove in first all existing subjects.
 
109
    exiv2Iface.removeXmpTag("Xmp.iptc.SubjectCode");
 
110
 
 
111
    // And add new list if necessary.
 
112
    if (m_subjectsCheck->isChecked())
 
113
        exiv2Iface.setXmpSubjects(newSubjects);
 
114
 
 
115
    xmpData = exiv2Iface.getXmp();
 
116
}
 
117
 
 
118
}  // namespace KIPIMetadataEditPlugin