krita
kis_dlg_apply_profile.cc00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #include <qcombobox.h>
00020 #include <klocale.h>
00021 #include <qbuttongroup.h>
00022
00023 #include "kis_factory.h"
00024 #include "kis_colorspace_factory_registry.h"
00025 #include "kis_types.h"
00026 #include "kis_profile.h"
00027 #include "kis_colorspace.h"
00028 #include "kis_dlg_apply_profile.h"
00029 #include "kis_config.h"
00030 #include "kis_id.h"
00031 #include <kis_meta_registry.h>
00032 #include "kis_cmb_idlist.h"
00033 #include "squeezedcombobox.h"
00034 #include "wdgapplyprofile.h"
00035
00036
00037 KisDlgApplyProfile::KisDlgApplyProfile(QWidget *parent, const char *name)
00038 : super(parent, name, true, "", Ok | Cancel)
00039 {
00040
00041 setCaption(i18n("Apply Image Profile to Clipboard Data"));
00042 m_page = new WdgApplyProfile(this);
00043
00044 setMainWidget(m_page);
00045 resize(m_page->sizeHint());
00046
00047
00048 fillCmbProfiles(KisID("RGBA", ""));
00049 KisConfig cfg;
00050 m_page->grpRenderIntent->setButton(cfg.renderIntent());
00051
00052 }
00053
00054 KisDlgApplyProfile::~KisDlgApplyProfile()
00055 {
00056 delete m_page;
00057 }
00058
00059
00060 KisProfile * KisDlgApplyProfile::profile() const
00061 {
00062 QString profileName;
00063
00064 profileName = m_page->cmbProfile->currentText();
00065
00066 return KisMetaRegistry::instance()->csRegistry()->getProfileByName(profileName);
00067 }
00068
00069 int KisDlgApplyProfile::renderIntent() const
00070 {
00071 return m_page->grpRenderIntent->selectedId();
00072 }
00073
00074
00075
00076 void KisDlgApplyProfile::fillCmbProfiles(const KisID & s)
00077 {
00078 m_page->cmbProfile->clear();
00079
00080 if (!KisMetaRegistry::instance()->csRegistry()->exists(s)) {
00081 return;
00082 }
00083
00084 KisColorSpaceFactory * csf = KisMetaRegistry::instance()->csRegistry()->get(s);
00085 if (csf == 0) return;
00086
00087 QValueVector<KisProfile *> profileList = KisMetaRegistry::instance()->csRegistry()->profilesFor( csf );
00088 QValueVector<KisProfile *> ::iterator it;
00089 for ( it = profileList.begin(); it != profileList.end(); ++it ) {
00090 m_page->cmbProfile->insertItem((*it)->productName());
00091 }
00092 m_page->cmbProfile->setCurrentText(csf->defaultProfile());
00093 }
00094
00095 #include "kis_dlg_apply_profile.moc"
00096
|