Exemple #1
0
/** Function  oyProfile_FromStd
 *  @memberof oyProfile_s
 *  @brief    Create from default colour space settings
 *
 *  @param[in]    type           default colour space
 *  @param[in]    object         the optional base
 *
 *  @since Oyranos: version 0.1.8
 *  @date  november 2007 (API 0.1.8)
 */
OYAPI oyProfile_s * OYEXPORT
oyProfile_FromStd     ( oyPROFILE_e       type,
                        oyObject_s        object)
{
  oyProfile_s_ * s = 0;
  char * name = 0;
  oyAlloc_f allocateFunc = 0;
  int pos = type - oyDEFAULT_PROFILE_START;

  if(!oy_profile_s_std_cache_)
  {
    int len = sizeof(oyProfile_s*) *
                            (oyDEFAULT_PROFILE_END - oyDEFAULT_PROFILE_START);
    oy_profile_s_std_cache_ = oyAllocateFunc_( len );
    memset( oy_profile_s_std_cache_, 0, len );
  }

  if(oyDEFAULT_PROFILE_START < type && type < oyDEFAULT_PROFILE_END)
    if(oy_profile_s_std_cache_[pos])
      return oyProfile_Copy( oy_profile_s_std_cache_[pos], 0 );

  if(object)
    allocateFunc = object->allocateFunc_;

  if(type)
    name = oyGetDefaultProfileName ( type, allocateFunc );

  s = oyProfile_FromFile_( name, 0, object );

  if(s)
    s->use_default_ = type;

  if(oyDEFAULT_PROFILE_START < type && type < oyDEFAULT_PROFILE_END)
    oy_profile_s_std_cache_[pos] = oyProfile_Copy( (oyProfile_s*)s, 0 );

  oyProfile_GetID( (oyProfile_s*)s );

  return (oyProfile_s*)s;
}
Exemple #2
0
//  Refresh profile combo boxes with profiles associated with the current policy.
void SySettingsModule::refreshProfileSettings()
{
    int profileSearchIndex;  // Index to match profile stored in a combobox.

    QString xmlToString;     // String used to grab each default colorspace
                             // profile from Oyranos.

    /* Each item will grab the default profile, and match it with an available profile
       under each combo box in "Default Profiles".  The combobox will then display
       the default profile.                                                     */
    xmlToString = oyGetDefaultProfileName (oyEDITING_RGB, 0); 
    profileSearchIndex = ui->combo_EDITING_RGB->findText( xmlToString, Qt::MatchExactly);
    ui->combo_EDITING_RGB->setCurrentIndex(profileSearchIndex);
     
    xmlToString = oyGetDefaultProfileName (oyEDITING_CMYK, 0);
    profileSearchIndex = ui->combo_EDITING_CMYK->findText( xmlToString, Qt::MatchExactly);
    ui->combo_EDITING_CMYK->setCurrentIndex(profileSearchIndex);
     
    xmlToString = oyGetDefaultProfileName (oyEDITING_XYZ, 0);
    profileSearchIndex = ui->combo_EDITING_XYZ->findText( xmlToString, Qt::MatchExactly);
    ui->combo_EDITING_XYZ->setCurrentIndex(profileSearchIndex);
    
    xmlToString = oyGetDefaultProfileName (oyEDITING_LAB, 0);
    profileSearchIndex = ui->combo_EDITING_LAB->findText( xmlToString, Qt::MatchExactly);
    ui->combo_EDITING_LAB->setCurrentIndex(profileSearchIndex);

    xmlToString = oyGetDefaultProfileName (oyEDITING_GRAY, 0);
    profileSearchIndex = ui->combo_EDITING_GRAY->findText( xmlToString, Qt::MatchExactly);
    ui->combo_EDITING_GRAY->setCurrentIndex(profileSearchIndex);  
     
    xmlToString = oyGetDefaultProfileName (oyASSUMED_RGB, 0);
    profileSearchIndex = ui->combo_ASSUMED_RGB->findText( xmlToString, Qt::MatchExactly);
    ui->combo_ASSUMED_RGB->setCurrentIndex(profileSearchIndex);
     
    xmlToString = oyGetDefaultProfileName (oyASSUMED_CMYK, 0);
    profileSearchIndex = ui->combo_EDITING_CMYK->findText( xmlToString, Qt::MatchExactly);
    ui->combo_ASSUMED_CMYK->setCurrentIndex(profileSearchIndex);
     
    xmlToString = oyGetDefaultProfileName (oyASSUMED_XYZ, 0);
    profileSearchIndex = ui->combo_EDITING_XYZ->findText( xmlToString, Qt::MatchExactly);
    ui->combo_ASSUMED_XYZ->setCurrentIndex(profileSearchIndex);
    
    xmlToString = oyGetDefaultProfileName (oyASSUMED_LAB, 0);
    profileSearchIndex = ui->combo_ASSUMED_LAB->findText( xmlToString, Qt::MatchExactly);
    ui->combo_ASSUMED_LAB->setCurrentIndex(profileSearchIndex);  

    xmlToString = oyGetDefaultProfileName (oyASSUMED_GRAY, 0);
    profileSearchIndex = ui->combo_ASSUMED_GRAY->findText( xmlToString, Qt::MatchExactly);
    ui->combo_ASSUMED_GRAY->setCurrentIndex(profileSearchIndex);  

    xmlToString = oyGetDefaultProfileName (oyPROFILE_PROOF, 0);
    profileSearchIndex = ui->combo_PROFILE_PROOF->findText( xmlToString, Qt::MatchExactly);
    ui->combo_PROFILE_PROOF->setCurrentIndex(profileSearchIndex);    

    xmlToString = oyGetDefaultProfileName (oyPROFILE_EFFECT, 0);
    profileSearchIndex = ui->combo_PROFILE_EFFECT->findText( xmlToString, Qt::MatchExactly);
    ui->combo_PROFILE_EFFECT->setCurrentIndex(profileSearchIndex);    
}