summaryrefslogtreecommitdiffstats
path: root/chalk/ui/kis_dlg_image_properties.cc
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-06-26 00:41:16 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-06-26 00:41:16 +0000
commit698569f8428ca088f764d704034a1330517b98c0 (patch)
treebf45be6946ebbbee9cce5a5bcf838f4c952d87e6 /chalk/ui/kis_dlg_image_properties.cc
parent2785103a6bd4de55bd26d79e34d0fdd4b329a73a (diff)
downloadkoffice-698569f8428ca088f764d704034a1330517b98c0.tar.gz
koffice-698569f8428ca088f764d704034a1330517b98c0.zip
Finish rebranding of Krita as Chalk
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/koffice@1238363 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'chalk/ui/kis_dlg_image_properties.cc')
-rw-r--r--chalk/ui/kis_dlg_image_properties.cc173
1 files changed, 173 insertions, 0 deletions
diff --git a/chalk/ui/kis_dlg_image_properties.cc b/chalk/ui/kis_dlg_image_properties.cc
new file mode 100644
index 00000000..72c26ec5
--- /dev/null
+++ b/chalk/ui/kis_dlg_image_properties.cc
@@ -0,0 +1,173 @@
+/*
+ * Copyright (c) 2004 Boudewijn Rempt <boud@valdyas.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU 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 <tqbuttongroup.h>
+#include <tqpushbutton.h>
+#include <tqradiobutton.h>
+#include <tqgroupbox.h>
+#include <tqlayout.h>
+#include <tqlabel.h>
+#include <tqspinbox.h>
+#include <tqslider.h>
+#include <tqtextedit.h>
+#include <tqcheckbox.h>
+
+#include <klocale.h>
+#include <kcolorcombo.h>
+
+#include <KoUnitWidgets.h>
+
+#include "kis_factory.h"
+#include "kis_meta_registry.h"
+#include "kis_colorspace_factory_registry.h"
+#include "kis_dlg_image_properties.h"
+#include "kis_profile.h"
+#include "kis_types.h"
+#include "kis_image.h"
+#include "kis_config.h"
+#include "kis_id.h"
+#include "kis_cmb_idlist.h"
+#include "squeezedcombobox.h"
+#include "wdgnewimage.h"
+
+KisDlgImageProperties::KisDlgImageProperties(KisImageSP image, TQWidget *tqparent, const char *name)
+ : super(tqparent, name, true, "", Ok | Cancel)
+{
+
+ setCaption(i18n("Image Properties"));
+ m_page = new WdgNewImage(this);
+
+ m_page->lblResolution->hide();
+ m_page->doubleResolution->hide();
+
+
+ m_image = image;
+
+ setMainWidget(m_page);
+ resize(m_page->tqsizeHint());
+
+ m_page->txtName->setText(image->name());
+ m_page->m_createButton->hide();
+ KisConfig cfg;
+
+ m_page->intWidth->setValue(image->width());
+ m_page->intHeight->setValue(image->height());
+ m_page->txtDescription->setText(image->description());
+ m_page->doubleResolution->setValue(image->xRes()); // XXX: separate values for x & y?
+
+ //m_page->cmbColorSpaces->hide();
+ //m_page->lblColorSpaces->setText(image->colorSpace()->id().name());
+ KisIDList colorSpaces = KisMetaRegistry::instance()->csRegistry()->listKeys();
+ KisIDList::iterator i = colorSpaces.tqfind(KisID("WET",""));
+ if (i != colorSpaces.end()) {
+ colorSpaces.remove(i);
+ }
+ m_page->cmbColorSpaces->setIDList(colorSpaces);
+ m_page->cmbColorSpaces->setCurrent(image->colorSpace()->id());
+
+ fillCmbProfiles(image->colorSpace()->id());
+
+ if (image->getProfile()) {
+ m_page->cmbProfile->setCurrentText(image->getProfile()->productName());
+ }
+ else {
+ m_page->cmbProfile->setCurrentItem(0);
+ }
+
+ m_page->sliderOpacity->setEnabled(false); // XXX re-enable when figured out a way to do this
+ m_page->opacityPanel->hide();
+ m_page->lblOpacity->hide();
+
+ m_page->cmbColor->setEnabled(false); // XXX re-enable when figured out a way to do this
+ m_page->cmbColor->hide();
+ m_page->lblColor->hide();
+
+ connect(m_page->cmbColorSpaces, TQT_SIGNAL(activated(const KisID &)),
+ this, TQT_SLOT(fillCmbProfiles(const KisID &)));
+
+
+}
+
+KisDlgImageProperties::~KisDlgImageProperties()
+{
+ delete m_page;
+}
+
+int KisDlgImageProperties::imageWidth()
+{
+ return m_page->intWidth->value();
+}
+
+int KisDlgImageProperties::imageHeight()
+{
+ return m_page->intHeight->value();
+}
+
+int KisDlgImageProperties::opacity()
+{
+ return m_page->sliderOpacity->value();
+}
+
+TQString KisDlgImageProperties::imageName()
+{
+ return m_page->txtName->text();
+}
+
+double KisDlgImageProperties::resolution()
+{
+ return m_page->doubleResolution->value();
+}
+
+TQString KisDlgImageProperties::description()
+{
+ return m_page->txtDescription->text();
+}
+
+KisColorSpace * KisDlgImageProperties::colorSpace()
+{
+ return KisMetaRegistry::instance()->csRegistry()->getColorSpace(m_page->cmbColorSpaces->currentItem(), m_page->cmbProfile->currentText());
+}
+
+KisProfile * KisDlgImageProperties::profile()
+{
+ TQValueVector<KisProfile *> profileList = KisMetaRegistry::instance()->csRegistry()->profilesFor( m_image->colorSpace()->id() );
+ TQ_UINT32 index = m_page->cmbProfile->currentItem();
+
+ if (index < profileList.count()) {
+ return profileList.at(index);
+ } else {
+ return 0;
+ }
+}
+
+// XXX: Copy & paste from kis_dlg_create_img -- refactor to separate class
+void KisDlgImageProperties::fillCmbProfiles(const KisID & s)
+{
+
+ KisColorSpaceFactory * csf = KisMetaRegistry::instance()->csRegistry()->get(s);
+ m_page->cmbProfile->clear();
+ TQValueVector<KisProfile *> profileList = KisMetaRegistry::instance()->csRegistry()->profilesFor( csf );
+ TQValueVector<KisProfile *> ::iterator it;
+ for ( it = profileList.begin(); it != profileList.end(); ++it ) {
+ m_page->cmbProfile->insertItem((*it)->productName());
+ }
+
+
+}
+
+#include "kis_dlg_image_properties.moc"
+