Commit eaf18917 authored by Cyrille Berger's avatar Cyrille Berger

make the image properties dialog use the color space selector

svn path=/trunk/koffice/; revision=1075695
parent 99c5dab2
......@@ -64,24 +64,8 @@ KisDlgImageProperties::KisDlgImageProperties(KisImageWSP image, QWidget *parent,
m_page->lblResolutionValue->setText(KGlobal::locale()->formatNumber(image->xRes()*72, 2)); // XXX: separate values for x & y?
QList<KoID> colorSpaces = KoColorSpaceRegistry::instance()->listKeys();
qint32 i = colorSpaces.indexOf(KoID("WET", ""));
if (i >= 0) {
colorSpaces.removeAt(i);
}
m_page->cmbColorSpaces->setIDList(colorSpaces);
m_page->cmbColorSpaces->setCurrent(image->colorSpace()->id());
fillCmbProfiles(KoID(image->colorSpace()->id()));
if (image->profile()) {
m_page->cmbProfile->setCurrent(image->profile()->name());
} else {
m_page->cmbProfile->setCurrentIndex(0);
}
connect(m_page->cmbColorSpaces, SIGNAL(activated(const KoID &)),
this, SLOT(fillCmbProfiles(const KoID &)));
m_page->colorSpaceSelector->setCurrentColorSpace(image->colorSpace());
}
KisDlgImageProperties::~KisDlgImageProperties()
......@@ -91,34 +75,7 @@ KisDlgImageProperties::~KisDlgImageProperties()
const KoColorSpace * KisDlgImageProperties::colorSpace()
{
return KoColorSpaceRegistry::instance()->colorSpace(m_page->cmbColorSpaces->currentItem(), m_page->cmbProfile->itemHighlighted());
}
const KoColorProfile * KisDlgImageProperties::profile()
{
QList<const KoColorProfile *> profileList = KoColorSpaceRegistry::instance()->profilesFor(m_image->colorSpace()->id());
qint32 index = m_page->cmbProfile->currentIndex();
if (index < profileList.count()) {
return profileList.at(index);
} else {
return 0;
}
}
// XXX: Copy & paste from kis_dlg_create_image -- refactor to separate class
void KisDlgImageProperties::fillCmbProfiles(const KoID & s)
{
KoColorSpaceFactory * csf = KoColorSpaceRegistry::instance()->value(s.id());
m_page->cmbProfile->clear();
if (csf) {
QList<const KoColorProfile *> profileList = KoColorSpaceRegistry::instance()->profilesFor(csf);
foreach(const KoColorProfile *profile, profileList) {
m_page->cmbProfile->addSqueezedItem(profile->name());
}
}
return m_page->colorSpaceSelector->currentColorSpace();
}
#include "kis_dlg_image_properties.moc"
......@@ -49,11 +49,6 @@ public:
virtual ~KisDlgImageProperties();
const KoColorSpace * colorSpace();
const KoColorProfile * profile();
private slots:
void fillCmbProfiles(const KoID &);
private:
......
......@@ -7,13 +7,13 @@
<x>0</x>
<y>0</y>
<width>590</width>
<height>227</height>
<height>164</height>
</rect>
</property>
<property name="windowTitle">
<string>New Image</string>
</property>
<layout class="QVBoxLayout">
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QGroupBox" name="grpImage">
<property name="title">
......@@ -116,61 +116,37 @@
<property name="title">
<string>Mode</string>
</property>
<layout class="QGridLayout">
<property name="margin">
<number>11</number>
</property>
<property name="spacing">
<number>6</number>
</property>
<item row="0" column="0">
<widget class="QLabel" name="lblColorSpaces">
<property name="text">
<string>Color space:</string>
</property>
<property name="buddy">
<cstring>cmbColorSpaces</cstring>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="KisCmbIDList" name="cmbColorSpaces" native="true"/>
</item>
<item row="1" column="1">
<widget class="SqueezedComboBox" name="cmbProfile"/>
</item>
<item row="1" column="0">
<widget class="QLabel" name="lblProfiles">
<property name="text">
<string>Profile:</string>
</property>
<property name="buddy">
<cstring>cmbProfile</cstring>
</property>
</widget>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="KisColorSpaceSelector" name="colorSpaceSelector" native="true"/>
</item>
</layout>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<layoutdefault spacing="6" margin="11"/>
<customwidgets>
<customwidget>
<class>KisCmbIDList</class>
<class>KisColorSpaceSelector</class>
<extends>QWidget</extends>
<header>widgets/kis_cmb_idlist.h</header>
</customwidget>
<customwidget>
<class>SqueezedComboBox</class>
<extends>QComboBox</extends>
<header>widgets/squeezedcombobox.h</header>
<header>widgets/kis_color_space_selector.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<tabstops>
<tabstop>cmbColorSpaces</tabstop>
<tabstop>cmbProfile</tabstop>
</tabstops>
<resources/>
<connections/>
</ui>
......@@ -104,6 +104,13 @@ void KisColorSpaceSelector::setCurrentProfile(const QString& name)
d->colorSpaceSelector->cmbProfile->setCurrent(name);
}
void KisColorSpaceSelector::setCurrentColorSpace(const KoColorSpace* colorSpace)
{
setCurrentColorModel(colorSpace->colorModelId());
setCurrentColorDepth(colorSpace->colorDepthId());
setCurrentProfile(colorSpace->profile()->name());
}
void KisColorSpaceSelector::colorSpaceChanged()
{
emit(selectionChanged(d->colorSpaceSelector->cmbProfile->count() != 0));
......
......@@ -34,6 +34,7 @@ public:
void setCurrentColorModel(const KoID& id);
void setCurrentColorDepth(const KoID& id);
void setCurrentProfile(const QString& name);
void setCurrentColorSpace(const KoColorSpace* colorSpace);
signals:
/**
* This signal is emited when a new color space is selected.
......
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