diff --git a/Messages.sh b/Messages.sh index b6def52223..f718f64b6c 100755 --- a/Messages.sh +++ b/Messages.sh @@ -1,30 +1,34 @@ #! /bin/sh source kundo2_aware_xgettext.sh $EXTRACTRC `find . -name \*.ui | grep -v '/tests/'` >> rc.cpp RCFILES=`find . -name \*.xmlgui \ | grep -v plugins/extensions/metadataeditor/editors/dublincore.xmlgui \ | grep -v plugins/extensions/metadataeditor/editors/exif.xmlgui \ | grep -v krita/sketch/KritaSketchWin.xmlgui \ | grep -v krita/gemini/KritaGeminiWin.xmlgui ` $EXTRACTRC $RCFILES >> rc.cpp ACTIONFILES=`find . -name \*.action` ./action_i18n.pl --context=action $ACTIONFILES >> rc.cpp # extracti18n.pl extracts additional data from brushes, palettes etc. perl extracti18n.pl >> rc.cpp +# Extract the name of configuration pages in the metadata editor plugin. +$EXTRACTATTR --attr=MetaDataEditor,name --context='metadata editor page' \ + plugins/extensions/metadataeditor/editors/*.xmlgui >> rc.cpp + # Ignore sdk/templates which contains templates for writing future plugins. # Also ignore crashreporter, it has it's own catalog # None of the placeholder strings inside will be seen by users. kundo2_aware_xgettext krita.pot rc.cpp \ `find . -name \*.cc -o -name \*.h -o -name \*.cpp | \ grep -v '/tests/' | grep -v './sdk/templates' | grep -v './krita/crashreporter/'` # Extract the messages in Python plugins. $XGETTEXT -L Python `find . -name \*.py` -j -o $podir/krita.pot # Clean up rm -f rc.cpp diff --git a/plugins/extensions/metadataeditor/kis_meta_data_editor.cc b/plugins/extensions/metadataeditor/kis_meta_data_editor.cc index 0dcac5a5ec..47b87c9bb9 100644 --- a/plugins/extensions/metadataeditor/kis_meta_data_editor.cc +++ b/plugins/extensions/metadataeditor/kis_meta_data_editor.cc @@ -1,156 +1,156 @@ /* * Copyright (c) 2007,2010 Cyrille Berger * * This library is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 2.1 of the License, or * (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "kis_meta_data_editor.h" #include #include #include #include #include #include #include #include #include #include #include #include "kis_entry_editor.h" #include #include "kis_meta_data_model.h" #include struct KisMetaDataEditor::Private { KisMetaData::Store* originalStore; KisMetaData::Store* store; QMultiHash entryEditors; }; KisMetaDataEditor::KisMetaDataEditor(QWidget* parent, KisMetaData::Store* originalStore) : KPageDialog(parent), d(new Private) { d->originalStore = originalStore; d->store = new KisMetaData::Store(*originalStore); QStringList files = KoResourcePaths::findAllResources("data", "kritaplugins/metadataeditor/*.xmlgui"); QMap widgets; widgets["dublincore.ui"] = new WdgDublinCore(this); widgets["exif.ui"] = new WdgExif(this); Q_FOREACH (const QString & file, files) { QFile xmlFile(file); xmlFile.open(QFile::ReadOnly); QString errMsg; int errLine, errCol; QDomDocument document; if (!document.setContent(&xmlFile, false, &errMsg, &errLine, &errCol)) { dbgMetaData << "Error reading XML at line" << errLine << " column" << errCol << " :" << errMsg; } QDomElement rootElement = document.documentElement(); if (rootElement.tagName() != "MetaDataEditor") { dbgMetaData << "Invalid XML file"; } const QString uiFileName = rootElement.attribute("uiFile"); - const QString pageName = rootElement.attribute("name"); + const QString pageName = i18nc("metadata editor page", rootElement.attribute("name").toUtf8()); const QString iconName = rootElement.attribute("icon"); if (uiFileName == "") continue; QWidget *widget = widgets[uiFileName]; QDomNodeList list = rootElement.childNodes(); const int size = list.size(); for (int i = 0; i < size; ++i) { QDomElement elem = list.item(i).toElement(); if (elem.isNull() || elem.tagName() != "EntryEditor") continue; const QString editorName = elem.attribute("editorName"); const QString schemaUri = elem.attribute("schemaUri"); const QString entryName = elem.attribute("entryName"); const QString editorSignal = '2' + elem.attribute("editorSignal"); const QString propertyName = elem.attribute("propertyName"); const QString structureField = elem.attribute("structureField"); bool ok; int arrayIndex = elem.attribute("arrayIndex", "-1").toInt(&ok); if (!ok) arrayIndex = -1; dbgMetaData << ppVar(editorName) << ppVar(arrayIndex); QWidget* obj = widget->findChild(editorName); if (obj) { const KisMetaData::Schema* schema = KisMetaData::SchemaRegistry::instance()->schemaFromUri(schemaUri); if (schema) { if (!d->store->containsEntry(schema, entryName)) { dbgMetaData << " Store does not have yet entry :" << entryName << " in" << schemaUri << " ==" << schema->generateQualifiedName(entryName); } QString key = schema->generateQualifiedName(entryName); KisEntryEditor* ee = new KisEntryEditor(obj, d->store, key, propertyName, structureField, arrayIndex); connect(obj, editorSignal.toLatin1(), ee, SLOT(valueEdited())); QList otherEditors = d->entryEditors.values(key); Q_FOREACH (KisEntryEditor* oe, otherEditors) { connect(ee, SIGNAL(valueHasBeenEdited()), oe, SLOT(valueChanged())); connect(oe, SIGNAL(valueHasBeenEdited()), ee, SLOT(valueChanged())); } d->entryEditors.insert(key, ee); } else { dbgMetaData << "Unknown schema :" << schemaUri; } } else { dbgMetaData << "Unknown object :" << editorName; } } xmlFile.close(); KPageWidgetItem *page = new KPageWidgetItem(widget, pageName); if (!iconName.isEmpty()) { page->setIcon(KisIconUtils::loadIcon(iconName)); } addPage(page); } // Add the list page QTableView* tableView = new QTableView; KisMetaDataModel* model = new KisMetaDataModel(d->store); tableView->setModel(model); tableView->verticalHeader()->setVisible(false); tableView->resizeColumnsToContents(); KPageWidgetItem *page = new KPageWidgetItem(tableView, i18n("List")); page->setIcon(KisIconUtils::loadIcon("format-list-unordered")); addPage(page); } KisMetaDataEditor::~KisMetaDataEditor() { Q_FOREACH (KisEntryEditor* e, d->entryEditors) { delete e; } delete d->store; delete d; } void KisMetaDataEditor::accept() { KPageDialog::accept(); d->originalStore->copyFrom(d->store); }