KOffice – TDE office suite
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

kis_dlg_apply_profile.cc 2.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. /*
  2. * Copyright (c) 2004 Boudewijn Rempt <boud@valdyas.org>
  3. *
  4. * This program is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License as published by
  6. * the Free Software Foundation; either version 2 of the License, or
  7. * (at your option) any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program; if not, write to the Free Software
  16. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  17. */
  18. #include <tqcombobox.h>
  19. #include <klocale.h>
  20. #include <tqbuttongroup.h>
  21. #include "kis_factory.h"
  22. #include "kis_colorspace_factory_registry.h"
  23. #include "kis_types.h"
  24. #include "kis_profile.h"
  25. #include "kis_colorspace.h"
  26. #include "kis_dlg_apply_profile.h"
  27. #include "kis_config.h"
  28. #include "kis_id.h"
  29. #include <kis_meta_registry.h>
  30. #include "kis_cmb_idlist.h"
  31. #include "squeezedcombobox.h"
  32. #include "wdgapplyprofile.h"
  33. // XXX: Hardcode RGBA name. This should be a constant, somewhere.
  34. KisDlgApplyProfile::KisDlgApplyProfile(TQWidget *parent, const char *name)
  35. : super(parent, name, true, "", Ok | Cancel)
  36. {
  37. setCaption(i18n("Apply Image Profile to Clipboard Data"));
  38. m_page = new WdgApplyProfile(this);
  39. setMainWidget(m_page);
  40. resize(m_page->sizeHint());
  41. // XXX: This is BAD! (bsar)
  42. fillCmbProfiles(KisID("RGBA", ""));
  43. KisConfig cfg;
  44. m_page->grpRenderIntent->setButton(cfg.renderIntent());
  45. }
  46. KisDlgApplyProfile::~KisDlgApplyProfile()
  47. {
  48. delete m_page;
  49. }
  50. KisProfile * KisDlgApplyProfile::profile() const
  51. {
  52. TQString profileName;
  53. profileName = m_page->cmbProfile->currentText();
  54. return KisMetaRegistry::instance()->csRegistry()->getProfileByName(profileName);
  55. }
  56. int KisDlgApplyProfile::renderIntent() const
  57. {
  58. return m_page->grpRenderIntent->selectedId();
  59. }
  60. // XXX: Copy & paste from kis_custom_image_widget -- refactor to separate class
  61. void KisDlgApplyProfile::fillCmbProfiles(const KisID & s)
  62. {
  63. m_page->cmbProfile->clear();
  64. if (!KisMetaRegistry::instance()->csRegistry()->exists(s)) {
  65. return;
  66. }
  67. KisColorSpaceFactory * csf = KisMetaRegistry::instance()->csRegistry()->get(s);
  68. if (csf == 0) return;
  69. TQValueVector<KisProfile *> profileList = KisMetaRegistry::instance()->csRegistry()->profilesFor( csf );
  70. TQValueVector<KisProfile *> ::iterator it;
  71. for ( it = profileList.begin(); it != profileList.end(); ++it ) {
  72. m_page->cmbProfile->insertItem((*it)->productName());
  73. }
  74. m_page->cmbProfile->setCurrentText(csf->defaultProfile());
  75. }
  76. #include "kis_dlg_apply_profile.moc"