static kcontext_t* new_RootContext(void) { kcontext_t *ctx = (kcontext_t*)new_hcontext(NULL); const knh_LoaderAPI_t *kapi = knh_getLoaderAPI(); kshare_t *share = (kshare_t*)malloc(sizeof(kshare_t) + sizeof(kstatinfo_t) + sizeof(knh_ServiceSPI_t)); ctx->share = share; knh_bzero(share, sizeof(kshare_t) + sizeof(kstatinfo_t) + sizeof(knh_ServiceSPI_t)); share->syslock = knh_mutex_malloc(_ctx); ctx->stat = (kstatinfo_t*)((share+1)); ctx->spi = (const knh_ServiceSPI_t*)(_ctx->stat + 1); initServiceSPI((knh_ServiceSPI_t*)ctx->spi); kmemshare_init(_ctx); share->ClassTBL = (kclass_t**)KMALLOC((CTX)ctx, sizeof(struct _kclass*)*(K_CLASSTABLE_INIT)); knh_bzero(share->ClassTBL, sizeof(struct _kclass*)*(K_CLASSTABLE_INIT)); share->sizeClassTBL = 0; share->capacityClassTBL = K_CLASSTABLE_INIT; share->EventTBL = (knh_EventTBL_t*)KCALLOC(SIZEOF_TEXPT(K_EVENTTBL_INIT)); knh_bzero((void*)share->EventTBL, SIZEOF_TEXPT(K_EVENTTBL_INIT)); share->sizeEventTBL = 0; share->capacityEventTBL = K_EVENTTBL_INIT; kshare_loadStructData(_ctx, kapi); KINITv(share->funcDictSet, new_DictSet0(_ctx, 0, 0, "funcDictSet")); KINITv(share->constPtrMap, new_PtrMap(_ctx, 0)); KINITv(share->inferPtrMap, new_PtrMap(_ctx, 0)); KINITv(share->xdataPtrMap, new_PtrMap(_ctx, 0)); KINITv(share->constPools, new_Array0(_ctx, 0)); knh_loadSystemTypeMapRule(_ctx); knh_ClassTBL_setConstPool(_ctx, ClassTBL(CLASS_Int)); knh_ClassTBL_setConstPool(_ctx, ClassTBL(CLASS_Float)); #ifdef K_USING_STRINGPOOL knh_ClassTBL_setConstPool(_ctx, ClassTBL(CLASS_String)); #endif { kObject *p = (kObject*)new_hObject_(_ctx, ClassTBL(CLASS_Object)); Object_setNullObject(p, 1); KINITv(share->constNull, p); } { kBoolean *o = new_H(Boolean); o->n.bvalue = 1; KINITv(share->constTrue, o); o = new_H(Boolean); o->n.bvalue = 0; KINITv(share->constFalse, o); } { static const kdim_t dimINIT = {}; kArray *a = new_H(Array); (a)->size = 0; (a)->dim = &dimINIT; KINITv(share->emptyArray, a); } share->tString = (kString**)KCALLOC(SIZEOF_TSTRING); knh_bzero(share->tString, SIZEOF_TSTRING); knh_loadScriptSystemString(_ctx); KINITv(share->cwdPath, new_CurrentPath(_ctx)); /* These are not shared, but needed to initialize System*/ knh_stack_initexpand(_ctx, NULL, K_STACKSIZE); KINITv(share->packageDictMap, new_DictMap0(_ctx, 0, 1/*isCaseMap*/, "packageDictMap")); KINITv(share->secfileidtyDictMap, new_DictMap0(_ctx, 0, 1/*isCaseMap*/, "secfileidtyDictMap")); // added by Wakamori KINITv(share->classNameDictSet, new_DictSet0(_ctx, 128, 1/*isCaseMap*/, "classNameDictSet")); KINITv(share->eventDictSet, new_DictSet0(_ctx, 32, 1/*isCaseMap*/, "eventDictSet")); KINITv(share->streamDpiDictSet, new_DictSet0(_ctx, 0, 1/*isCaseMap*/, "streamDpiDictSet")); KINITv(share->mapDpiDictSet, new_DictSet0(_ctx, 0, 1/*isCaseMap*/, "mapDpiDictSet")); KINITv(share->convDpiDictSet, new_DictSet0(_ctx, 0, 1/*isCaseMap*/, "convDpiDictSet")); KINITv(share->rconvDpiDictSet, new_DictSet0(_ctx, 0, 1/*isCaseMap*/, "convDpiDictSet")); KINITv(share->enc, new_T(knh_getSystemEncoding())); KINITv(share->in, new_InputStreamStdIn(_ctx, share->enc)); KINITv(share->out, new_OutputStreamStdOut(_ctx, share->enc)); KINITv(share->err, new_OutputStreamStdErr(_ctx, share->enc)); KINITv(share->props, new_DictMap0(_ctx, 20, 1/*isCaseMap*/, "System.props")); KINITv(share->symbolDictCaseSet, new_DictSet0(_ctx, K_TFIELD_SIZE + 10, 1/*isCaseMap*/, "System.symbolDictSet")); KINITv(share->symbolList, new_Array0(_ctx, K_TFIELD_SIZE + 10)); KINITv(share->urnDictSet, new_DictSet0(_ctx, 0, 0/*isCaseMap*/, "System.urnDictSet")); KINITv(share->urns, new_Array0(_ctx, 1)); KINITv(share->corelang, new_(Lang)); knh_initSugarData(_ctx); KINITv(share->tokenDictSet, new_DictSet0(_ctx, (TT_MAX - STT_MAX), 0/*isCaseMap*/, "System.tokenDictSet")); // KINITv(share->URNAliasDictMap, new_DictMap0(_ctx, 0, 0/*isCaseMap*/, "System.URNAliasDictMap")); KINITv(share->rootks, new_(KonohaSpace)); knh_loadScriptSystemData(_ctx, share->rootks, kapi); knh_System_initPath(_ctx); // require rootks KINITv(_ctx->script, new_(Script)); // require rootks KINITv(_ctx->gma, new_(GammaBuilder)); // require script knh_loadScriptSystemKonohaCode(_ctx); // require gamma loadPolicy(_ctx); // added by Wakamori knh_loadScriptSystemMethod(_ctx, kapi); CommonContext_init(_ctx, ctx); knh_loadScriptTermData(_ctx); knh_loadScriptAliasTermData(_ctx); share->ctx0 = ctx; knh_GammaBuilder_init(_ctx); // initalize gamma->gf, reported by uh knh_initBuiltInPackage(_ctx, knh_getLoaderAPI()); /* CompilerAPI */ KINITv(share->konoha_compiler, K_NULL); share->compilerAPI = NULL; share->contextCounter = 1; share->threadCounter = 1; share->stopCounter = 0; share->gcStopCounter = 0; KINITv(share->contextListNULL, new_Array0(_ctx, 4)); kArray_add(ctx->share->contextListNULL, knh_toContext(_ctx)); #if defined(K_USING_THREAD) share->stop_cond = kthread_cond_init(_ctx); share->start_cond = kthread_cond_init(_ctx); share->close_cond = kthread_cond_init(_ctx); #endif return ctx; }
SySettingsModule::SySettingsModule(QWidget * parent) : SyModule(parent) { setModuleName(sy_settings_module_name); setDescription("Set system-wide profile parameters."); // select profiles matching actual capabilities icc_profile_flags = oyICCProfileSelectionFlagsFromOptions( OY_CMM_STD, "//" OY_TYPE_STD "/icc_color", NULL, 0 ); ui = new Ui::sySettingsWidget(); ui->setupUi(this); SySettingsConfig * settingsConfig = new SySettingsConfig(0, sy_settings_module_name); setConfigWidget(settingsConfig); setEditable(true); loadPolicy(); ui->removePolicyButton->setEnabled(false); loadEditableItems(); // Store all setting widgets into a convenient list structure. populateProfiles(); // Load all Oyranos-specified profiles // into each combobox in the "Default Profiles" tab. modified = false; /* i18n */ QString qs; int i; int count = 0, current = 0, flags = 0; const char * tooltip = NULL; const char ** names = NULL; const char * name = NULL, * description = NULL; oyWidgetTitleGet( oyWIDGET_GROUP_ALL, NULL, &name, NULL, NULL ); oyWidgetDescriptionGet( oyWIDGET_GROUP_ALL, &description, 0 ); setModuleName(QString::fromLocal8Bit(name)); setDescription(QString::fromLocal8Bit(description)); oyWidgetTitleGet( oyWIDGET_POLICY_ACTIVE, NULL, &name, &tooltip, &flags ); qs = QString::fromLocal8Bit(name); ui->currentPolicyTitleLabel->setText(qs); oyWidgetTitleGet( oyWIDGET_POLICY, NULL, &name, &tooltip, &flags ); qs = QString::fromLocal8Bit(name); ui->policySettingsBox->setTitle(qs); ui->kmsettingsTab->setTabText(0,qs); qs = QString::fromLocal8Bit( tooltip ); ui->policyLabel->setText(qs); oyWidgetTitleGet( oyWIDGET_GROUP_DEFAULT_PROFILES, NULL, &name, &tooltip, &flags ); qs = QString::fromLocal8Bit(name); ui->kmsettingsTab->setTabText(1,qs); oyWidgetTitleGet( oyWIDGET_GROUP_BEHAVIOUR, NULL, &name, &tooltip, &flags ); qs = QString::fromLocal8Bit(name); ui->kmsettingsTab->setTabText(2,qs); oyWidgetTitleGet( oyWIDGET_GROUP_BEHAVIOUR_EFFECT, NULL, &name, &tooltip, &flags ); qs = QString::fromLocal8Bit(name); ui->kmsettingsTab->setTabText(3,qs); #define SET_OY_PROFILE_WIDGET( widget ) \ oyWidgetTitleGet( oyWIDGET_##widget, NULL, &name, &tooltip, &flags ); \ qs = QString::fromLocal8Bit(name); \ ui->label_##widget->setText( qs ); \ qs = QString::fromLocal8Bit( tooltip ); \ ui->label_##widget->setToolTip( qs ); \ ui->combo_##widget->setToolTip( qs ); #define SET_OY_BOX_WIDGET( widget ) \ oyWidgetTitleGet( oyWIDGET_##widget, NULL, &name, &tooltip, &flags ); \ qs = QString::fromLocal8Bit(name); \ ui->box_##widget->setTitle( qs ); \ qs = QString::fromLocal8Bit( tooltip ); \ ui->box_##widget->setToolTip( qs ); #define SET_OY_COMBO_WIDGET( widget ) \ oyWidgetTitleGet( oyWIDGET_##widget, NULL, &name, &tooltip, &flags ); \ oyOptionChoicesGet( oyWIDGET_##widget, &count, &names, ¤t ); \ qs = QString::fromLocal8Bit( tooltip ); \ ui->combo_##widget->setToolTip( qs ); \ ui->combo_##widget->clear(); \ for(i = 0; i < count; ++i) \ { \ qs = QString::fromLocal8Bit( names[i] ); \ ui->combo_##widget->addItem( qs ); \ } #define SET_OY_CHECK_WIDGET( widget ) \ oyWidgetTitleGet( oyWIDGET_##widget, NULL, &name, &tooltip, &flags ); \ qs = QString::fromLocal8Bit( name ); \ ui->check_##widget->setText( qs ); \ qs = QString::fromLocal8Bit( tooltip ); \ ui->check_##widget->setToolTip( qs ); #define SET_OY_LABEL_WIDGET( widget ) \ oyWidgetTitleGet( oyWIDGET_##widget, NULL, &name, &tooltip, &flags ); \ qs = QString::fromLocal8Bit(name); \ ui->label_##widget->setText( qs ); \ qs = QString::fromLocal8Bit( tooltip ); \ ui->label_##widget->setToolTip( qs ); SET_OY_PROFILE_WIDGET( EDITING_RGB ); SET_OY_PROFILE_WIDGET( EDITING_CMYK ); SET_OY_PROFILE_WIDGET( EDITING_LAB ); SET_OY_PROFILE_WIDGET( EDITING_XYZ ); SET_OY_PROFILE_WIDGET( EDITING_GRAY ); SET_OY_PROFILE_WIDGET( ASSUMED_RGB ); SET_OY_PROFILE_WIDGET( ASSUMED_CMYK ); SET_OY_PROFILE_WIDGET( ASSUMED_LAB ); SET_OY_PROFILE_WIDGET( ASSUMED_XYZ ); SET_OY_PROFILE_WIDGET( ASSUMED_GRAY ); SET_OY_PROFILE_WIDGET( ASSUMED_WEB ); SET_OY_PROFILE_WIDGET( PROFILE_PROOF ); SET_OY_PROFILE_WIDGET( PROFILE_EFFECT ); SET_OY_BOX_WIDGET( GROUP_BEHAVIOUR_RENDERING ); SET_OY_BOX_WIDGET( GROUP_BEHAVIOUR_MIXED_MODE_DOCUMENTS ); SET_OY_BOX_WIDGET( GROUP_BEHAVIOUR_MISSMATCH ); SET_OY_BOX_WIDGET( GROUP_BEHAVIOUR_PROOF ); SET_OY_BOX_WIDGET( GROUP_BEHAVIOUR_EFFECT ); SET_OY_BOX_WIDGET( GROUP_BEHAVIOUR_DISPLAY ); SET_OY_COMBO_WIDGET( ACTION_UNTAGGED_ASSIGN ); SET_OY_LABEL_WIDGET( ACTION_UNTAGGED_ASSIGN ); SET_OY_COMBO_WIDGET( ACTION_OPEN_MISMATCH_RGB ); SET_OY_LABEL_WIDGET( ACTION_OPEN_MISMATCH_RGB ); SET_OY_COMBO_WIDGET( ACTION_OPEN_MISMATCH_CMYK ); SET_OY_LABEL_WIDGET( ACTION_OPEN_MISMATCH_CMYK ); SET_OY_COMBO_WIDGET( MIXED_MOD_DOCUMENTS_PRINT ); SET_OY_LABEL_WIDGET( MIXED_MOD_DOCUMENTS_PRINT ); SET_OY_COMBO_WIDGET( MIXED_MOD_DOCUMENTS_SCREEN ); SET_OY_LABEL_WIDGET( MIXED_MOD_DOCUMENTS_SCREEN ); SET_OY_COMBO_WIDGET( DISPLAY_WHITE_POINT ); SET_OY_LABEL_WIDGET( DISPLAY_WHITE_POINT ); SET_OY_COMBO_WIDGET( DISPLAY_WHITE_POINT_DAEMON ); SET_OY_LABEL_WIDGET( DISPLAY_WHITE_POINT_DAEMON ); SET_OY_COMBO_WIDGET( RENDERING_INTENT ); SET_OY_COMBO_WIDGET( RENDERING_INTENT_PROOF ); SET_OY_LABEL_WIDGET( RENDERING_INTENT_PROOF ); SET_OY_CHECK_WIDGET( RENDERING_BPC ); SET_OY_CHECK_WIDGET( PROOF_SOFT ); SET_OY_CHECK_WIDGET( PROOF_HARD ); SET_OY_CHECK_WIDGET( RENDERING_GAMUT_WARNING ); SET_OY_CHECK_WIDGET( EFFECT ); // Load behavior settings and display current default policy. reload(); // QT-related SIGNAL/SLOT functions, such as button presses and clicking // on a particular item. connect(ui->policySettingsList, SIGNAL(itemClicked(QListWidgetItem*)), this, SLOT(selectPolicy(QListWidgetItem*))); connect(ui->currentPolicyCombo, SIGNAL(activated(int)), this, SLOT(selectPolicy(int))); connect(ui->addNewPolicyButton, SIGNAL(clicked()), this, SLOT(addNewPolicy())); connect(ui->removePolicyButton, SIGNAL(clicked()), this, SLOT(removeCustomPolicy())); int k = 0, n = editableComboItems.size(); // When a user clicks on any combo box, the "Apply" button will be enabled. for(k = 0; k < n; ++k) connect(editableComboItems.value(k), SIGNAL(activated(int)), this, SLOT(emitChanged())); n = editableCheckBoxItems.size(); // When a user clicks on a radio box, the "Apply" button will be enabled. for(k = 0; k < n; ++k) connect(editableCheckBoxItems.value(k), SIGNAL(clicked()), this, SLOT(emitChanged())); #ifdef HAVE_QT_DBUS if( QDBusConnection::sessionBus().connect( QString(), "/org/libelektra/configuration", "org.libelektra", QString(), this, SLOT( configChanged( QString ) )) ) fprintf(stderr, "=================== connect settings to libelektra\n" ); #endif acceptDBusUpdate = true; }