Commit aa1be167 authored by Boudewijn Rempt's avatar Boudewijn Rempt

Show the annotations in the image properties dialog.

This can be handy when editing presets.
parent 82ffd8f8
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
#include <QSpinBox> #include <QSpinBox>
#include <QSlider> #include <QSlider>
#include <QCheckBox> #include <QCheckBox>
#include <QPlainTextEdit>
#include <QTextEdit> #include <QTextEdit>
#include <klocale.h> #include <klocale.h>
...@@ -36,14 +37,14 @@ ...@@ -36,14 +37,14 @@
#include "KoID.h" #include "KoID.h"
#include "kis_types.h" #include "kis_types.h"
#include "kis_image.h" #include "kis_image.h"
#include "kis_annotation.h"
#include "kis_config.h" #include "kis_config.h"
#include "kis_factory2.h" #include "kis_factory2.h"
#include "widgets/kis_cmb_idlist.h" #include "widgets/kis_cmb_idlist.h"
#include "widgets/squeezedcombobox.h" #include "widgets/squeezedcombobox.h"
KisDlgImageProperties::KisDlgImageProperties(KisImageWSP image, QWidget *parent, const char *name) KisDlgImageProperties::KisDlgImageProperties(KisImageWSP image, QWidget *parent, const char *name)
: KDialog(parent) : KDialog(parent)
{ {
setButtons(Ok | Cancel); setButtons(Ok | Cancel);
setDefaultButton(Ok); setDefaultButton(Ok);
...@@ -65,6 +66,24 @@ KisDlgImageProperties::KisDlgImageProperties(KisImageWSP image, QWidget *parent, ...@@ -65,6 +66,24 @@ KisDlgImageProperties::KisDlgImageProperties(KisImageWSP image, QWidget *parent,
m_page->colorSpaceSelector->setCurrentColorSpace(image->colorSpace()); m_page->colorSpaceSelector->setCurrentColorSpace(image->colorSpace());
vKisAnnotationSP_it beginIt = image->beginAnnotations();
vKisAnnotationSP_it endIt = image->endAnnotations();
vKisAnnotationSP_it it = beginIt;
while (it != endIt) {
if (!(*it) || (*it)->type().isEmpty()) {
dbgFile << "Warning: empty annotation";
it++;
continue;
}
m_page->cmbAnnotations->addItem((*it) -> type());
it++;
}
connect(m_page->cmbAnnotations, SIGNAL(activated(QString)), SLOT(setAnnotation(QString)));
setAnnotation(m_page->cmbAnnotations->currentText());
} }
KisDlgImageProperties::~KisDlgImageProperties() KisDlgImageProperties::~KisDlgImageProperties()
...@@ -77,4 +96,19 @@ const KoColorSpace * KisDlgImageProperties::colorSpace() ...@@ -77,4 +96,19 @@ const KoColorSpace * KisDlgImageProperties::colorSpace()
return m_page->colorSpaceSelector->currentColorSpace(); return m_page->colorSpaceSelector->currentColorSpace();
} }
void KisDlgImageProperties::setAnnotation(const QString &type)
{
KisAnnotationSP annotation = m_image->annotation(type);
if (annotation) {
m_page->lblDescription->clear();
m_page->txtAnnotation->clear();
m_page->lblDescription->setText(annotation->description());
m_page->txtAnnotation->appendPlainText(QString::fromUtf8(annotation->annotation()));
}
else {
m_page->lblDescription->clear();
m_page->txtAnnotation->clear();
}
}
#include "kis_dlg_image_properties.moc" #include "kis_dlg_image_properties.moc"
...@@ -49,6 +49,9 @@ public: ...@@ -49,6 +49,9 @@ public:
const KoColorSpace * colorSpace(); const KoColorSpace * colorSpace();
private slots:
void setAnnotation(const QString& type);
private: private:
WdgImageProperties * m_page; WdgImageProperties * m_page;
......
...@@ -7,14 +7,14 @@ ...@@ -7,14 +7,14 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>448</width> <width>448</width>
<height>193</height> <height>340</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
<string>New Image</string> <string>New Image</string>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_2"> <layout class="QGridLayout" name="gridLayout_2">
<item> <item row="0" column="0">
<widget class="QGroupBox" name="grpImage"> <widget class="QGroupBox" name="grpImage">
<property name="title"> <property name="title">
<string>Image Size</string> <string>Image Size</string>
...@@ -108,7 +108,7 @@ ...@@ -108,7 +108,7 @@
</layout> </layout>
</widget> </widget>
</item> </item>
<item> <item row="1" column="0">
<widget class="QGroupBox" name="grpMode"> <widget class="QGroupBox" name="grpMode">
<property name="title"> <property name="title">
<string>Mode</string> <string>Mode</string>
...@@ -133,7 +133,50 @@ ...@@ -133,7 +133,50 @@
</layout> </layout>
</widget> </widget>
</item> </item>
<item> <item row="2" column="0">
<widget class="QGroupBox" name="grpAnnotations">
<property name="title">
<string>Annotations</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QComboBox" name="cmbAnnotations"/>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLabel" name="label_3">
<property name="text">
<string>Type:</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="lblDescription">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>TextLabel</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QPlainTextEdit" name="txtAnnotation">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="3" column="0">
<spacer name="verticalSpacer"> <spacer name="verticalSpacer">
<property name="orientation"> <property name="orientation">
<enum>Qt::Vertical</enum> <enum>Qt::Vertical</enum>
......
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