File indexing completed on 2024-12-22 04:15:06

0001 /*
0002  *  SPDX-FileCopyrightText: 2007 Cyrille Berger <cberger@cberger.net>
0003  *
0004  *  SPDX-License-Identifier: LGPL-2.1-or-later
0005  */
0006 
0007 #include "metadataeditor.h"
0008 #include <stdlib.h>
0009 
0010 #include <QDialog>
0011 #include <QVBoxLayout>
0012 
0013 #include <kis_debug.h>
0014 #include <kpluginfactory.h>
0015 #include <klocalizedstring.h>
0016 
0017 #include "kis_config.h"
0018 #include "kis_cursor.h"
0019 #include "kis_global.h"
0020 #include "kis_layer.h"
0021 #include "kis_node_manager.h"
0022 #include "kis_types.h"
0023 #include "KisViewManager.h"
0024 #include "kis_action.h"
0025 #include "kis_image.h"
0026 
0027 #include <kis_meta_data_store.h>
0028 #include <kis_meta_data_entry.h>
0029 #include <kis_meta_data_value.h>
0030 #include <kis_meta_data_schema.h>
0031 
0032 #include "kis_entry_editor.h"
0033 #include "kis_meta_data_editor.h"
0034 
0035 K_PLUGIN_FACTORY_WITH_JSON(metadataeditorPluginFactory, "kritametadataeditor.json", registerPlugin<metadataeditorPlugin>();)
0036 
0037 metadataeditorPlugin::metadataeditorPlugin(QObject *parent, const QVariantList &)
0038         : KisActionPlugin(parent)
0039 {
0040     KisAction *action  = createAction("EditLayerMetaData");
0041     connect(action, SIGNAL(triggered()), this, SLOT(slotEditLayerMetaData()));
0042 }
0043 
0044 metadataeditorPlugin::~metadataeditorPlugin()
0045 {
0046 }
0047 
0048 void metadataeditorPlugin::slotEditLayerMetaData()
0049 {
0050     KisImageWSP image = viewManager()->image();
0051     if (!image) return;
0052 
0053     KisMetaDataEditor editor(viewManager()->mainWindowAsQWidget(), viewManager()->nodeManager()->activeLayer()->metaData());
0054     editor.exec();
0055 }
0056 
0057 #include "metadataeditor.moc"