bool CQueryWindowOptionsTab::save(CConfig *cfg) { bool ret = cfg->writeEntry("Query New Tab", booltostr(queryNewTab->isChecked())); ret &= cfg->writeEntry("Follow Query Tab", booltostr(followQueryTab->isChecked())); ret &= cfg->writeEntry("Follow Results Tab", booltostr(followResultsTab->isChecked())); ret &= cfg->writeEntry("Max Results to Save", maxResults->value()); ret &= cfg->writeEntry("Multiple Query Options", multipleQueries->id(multipleQueries->selected())); return ret; }
void CDatabaseItem::refreshWidget(bool b) { #ifdef DEBUG qDebug("CDatabaseItem::refreshWidget(%s)", debug_string(booltostr(b))); #endif if (isBlocked()) return; setBlocked(true); if (widget_id == int_type()) { CShowDatabaseGroupProperties * w = (CShowDatabaseGroupProperties *) widgetStack()->widget(int_type()); w->setMySQL(mysql()); w->setTitle(mysql()->connectionName()); if (b || widgetData.isEmpty()) { w->refresh(); w->saveData(&widgetData); } else w->loadData(widgetData); } else ((CDatabaseListViewItem *) QListViewItem::parent())->refreshWidget(b); widgetStack()->raiseWidget(widget_id); setBlocked(false); }
void CDatabaseItem::setConnected(bool isconnected) { #ifdef DEBUG qDebug("CDatabaseItem::setConnected(%s)", debug_string(booltostr(isconnected))); #endif if (isBlocked()) return; setBlocked(true); if (isconnected) is_connected = isconnected && mysql()->mysql()->mysqlSelectDb(text(0)); else is_connected = false; setPixmap(0, is_connected ? databaseConnectedIcon : databaseDisconnectedIcon); if (is_connected) { new CTableGroupItem(this, text(0), mysql()); setOpen(true); } else deleteChilds(); createWindowMenu(consoleWindow()->itemToolBar()); setBlocked(false); }
void CUserAdminItem::init(bool c, bool refresh_toolbar) { #ifdef DEBUG qDebug("CUserAdminItem::init(%s)", debug_string(booltostr(c))); #endif widgetData.setAutoDelete(true); userIcon = getPixmapIcon("userIcon"); setText( 0, tr("User Administration")); setConnected(c, refresh_toolbar); }
void CAdministrationWindow::showMessages(bool b) { #ifdef DEBUG qDebug("CAdministrationWindow::showMessages(%s)", debug_string(booltostr(b))); #endif if (b) messageWindow()->show(); else messageWindow()->hide(); }
void CQueryTable::sortColumn(int col, bool ascending, bool wholeRows) { #ifdef DEBUG qDebug("CQueryTable::sortColumn(%d, %s, %s)", col, debug_string(booltostr(ascending)), debug_string(booltostr(wholeRows))); #endif if (!query()->isResultNull()) mySortColumn(col, IS_NUM(query()->fields(col).type) ? cmpIntTableItems : cmpTableItems, ascending, wholeRows); else CTable::sortColumn(col, ascending, wholeRows); }
bool CQueryOptionsTab::save(CConfig *cfg) { #ifdef DEBUG qDebug("CQueryOptionsTab::save()"); #endif bool ret = cfg->writeEntry("Force Queries", booltostr(force->isChecked())); ret &= cfg->writeEntry("Silent", booltostr(silent->isChecked())); ret &= cfg->writeEntry("Append Queries to History", booltostr(use_history_file->isChecked())); ret &= cfg->writeEntry("sql_auto_is_null", sql_auto_is_null->currentItem()); ret &= cfg->writeEntry("big_tables", big_tables->currentItem()); ret &= cfg->writeEntry("sql_buffer_result", sql_buffer_result->currentItem()); ret &= cfg->writeEntry("query_cache_type", query_cache_type->currentItem()); ret &= cfg->writeEntry("sql_log_off", sql_log_off->currentItem()); ret &= cfg->writeEntry("sql_quote_show_create", sql_quote_show_create->currentItem()); ret &= cfg->writeEntry("autocommit", autocommit->currentItem()); ret &= cfg->writeEntry("sql_big_selects", sql_big_selects->currentItem()); ret &= cfg->writeEntry("low_priority_updates", low_priority_updates->currentItem()); ret &= cfg->writeEntry("sql_safe_updates", sql_safe_updates->currentItem()); ret &= cfg->writeEntry("sql_log_update", sql_log_update->currentItem()); return ret; }
void CUserAdminItem::setConnected(bool connected, bool refresh_toolbar) { #ifdef DEBUG qDebug("CUserAdminItem::setConnected(%s)", debug_string(booltostr(connected))); #endif if (isBlocked()) return; setBlocked(true); if (connected && !is_connected) { mysql()->mysql()->setEmitErrors(false); if (mysql()->mysql()->mysqlSelectDb("mysql")) is_connected = displayUsers(); else printAccessError(); mysql()->mysql()->setEmitErrors(true); } else is_connected = false; if (!is_connected && !connected) { while (this->childCount() > 0) deleteChilds(); } else if (is_connected) setOpen(true); setPixmap(0, getPixmapIcon(!is_connected ? "databaseUsersDisconnectedIcon" : "databaseUsersIcon")); if (refresh_toolbar) createWindowMenu(consoleWindow()->itemToolBar()); setBlocked(false); }
static DebugNode* getParams(DebugGraph *graph) { DebugNode *n; n = newDebugNode(graph, "params", "params"); Assert(n); addDebugNodeAttributeArgs(n, "seq_page_cost", "%lf", seq_page_cost); addDebugNodeAttributeArgs(n, "random_page_cost", "%lf", random_page_cost); addDebugNodeAttributeArgs(n, "cpu_tuple_cost", "%lf", cpu_tuple_cost); addDebugNodeAttributeArgs(n, "cpu_index_tuple_cost", "%lf", cpu_index_tuple_cost); addDebugNodeAttributeArgs(n, "cpu_operator_cost", "%lf", cpu_operator_cost); addDebugNodeAttributeArgs(n, "BLCKSZ", "%d", BLCKSZ); addDebugNodeAttributeArgs(n, "sizeof(HeapTupleHeaderData)", "%u", sizeof(HeapTupleHeaderData)); addDebugNodeAttributeArgs(n, "MAXIMUM_ALIGNOF", "%u", MAXIMUM_ALIGNOF); addDebugNodeAttributeArgs(n, "effective_cache_size", "%d", effective_cache_size); addDebugNodeAttributeArgs(n, "work_mem", "%d", work_mem); addDebugNodeAttributeArgs(n, "disable_cost", "%lf", disable_cost); addDebugNodeAttributeArgs(n, "enable_seqscan", "%s", booltostr(enable_seqscan)); addDebugNodeAttributeArgs(n, "enable_indexscan", "%s", booltostr(enable_indexscan)); addDebugNodeAttributeArgs(n, "enable_indexonlyscan", "%s", booltostr(enable_indexonlyscan)); addDebugNodeAttributeArgs(n, "enable_bitmapscan", "%s", booltostr(enable_bitmapscan)); addDebugNodeAttributeArgs(n, "enable_tidscan", "%s", booltostr(enable_tidscan)); addDebugNodeAttributeArgs(n, "enable_sort", "%s", booltostr(enable_sort)); addDebugNodeAttributeArgs(n, "enable_hashagg", "%s", booltostr(enable_hashagg)); addDebugNodeAttributeArgs(n, "enable_nestloop", "%s", booltostr(enable_nestloop)); addDebugNodeAttributeArgs(n, "enable_material", "%s", booltostr(enable_material)); addDebugNodeAttributeArgs(n, "enable_mergejoin", "%s", booltostr(enable_mergejoin)); addDebugNodeAttributeArgs(n, "enable_hashjoin", "%s", booltostr(enable_hashjoin)); return n; }
void CToolBar::addButton(const QPixmap &pix, int val, QPopupMenu *p, bool ena, const QString &label) { #ifdef DEBUG qDebug("CToolBar::addButton(const QPixmap &, %d, QPopupMenu *, %s)", val, debug_string(booltostr(ena))); #endif CToolBarButton * b = new CToolBarButton(this, val, p); b->setPixmap(pix); b->setEnabled(ena); if (!label.isEmpty()) b->setTextLabel(label, true); connect(b, SIGNAL(button_clicked(int)), this, SLOT(button_clicked(int))); buttons_dict.insert(cnt++, b); }
/** \brief send the contents and description of all camera parameters to the client */ void writeParameters(TCPIPserver* server, int connection, const std::string& singleparam=std::string("")) { // RETURNS A LIST OF THE AVAILABLE CAMERA PARAMETERS // SEND ANSWER TO CLIENT/QF3 // { (PARAM_FLOAT | PARAM_INT | PARAM_BOOL | PARAM_STRING);<parameter_name>;<parameter_value_as_string>;<parameter_description_as_string>;[<param_range_min>];[<param_range_max>];[(RW|RO)}\n }* \n std::string p; p="pixel_width"; if (singleparam.size()==0 || singleparam==p) server->write(connection, format("PARAM_FLOAT;%s;%f;pixel width time in microns;;;RO", p.c_str(), pixelsize)); // pixel width is read-only float, unlimited range if (singleparam.size()==0) server->write(connection, std::string("\n")); p="pixel_height"; if (singleparam.size()==0 || singleparam==p) server->write(connection, format("PARAM_FLOAT;%s;%f;pixel height time in microns;;;RO", p.c_str(), pixelsize)); // pixel height is read-only float, unlimited range if (singleparam.size()==0) server->write(connection, std::string("\n")); p="camera_name"; if (singleparam.size()==0 || singleparam==p) server->write(connection, format("PARAM_STRING;%s;%s;camera server name;;;RO", p.c_str(), cam_name)); // camera server name is read-only string if (singleparam.size()==0) server->write(connection, std::string("\n")); p="exposure"; if (singleparam.size()==0 || singleparam==p) server->write(connection, format("PARAM_FLOAT;%s;%f;exposure time;0;1;RW", p.c_str(), exposure)); // camera exposure time is read/write float with range [0..1] if (singleparam.size()==0) server->write(connection, std::string("\n")); p="image_amplitude"; if (singleparam.size()==0 || singleparam==p) server->write(connection, format("PARAM_FLOAT;%s;%f;pattern amplitude;0;4900;RW", p.c_str(), image_amplitude)); // pattern amplitude is read/write float with range [0..4900] if (singleparam.size()==0) server->write(connection, std::string("\n")); p="image_wavelength"; if (singleparam.size()==0 || singleparam==p) server->write(connection, format("PARAM_FLOAT;%s;%f;pattern wavelength;0;100;RW", p.c_str(), image_wavelength)); // pattern wavelength is read/write float with range [0..100] if (singleparam.size()==0) server->write(connection, std::string("\n")); p="acquisition_duration"; if (singleparam.size()==0 || singleparam==p) server->write(connection, format("PARAM_FLOAT;%s;%f;acquisition duration;0;100;RO", p.c_str(), acquisition_duration)); // acquisition duraction is read-only float with range [0..100] if (singleparam.size()==0) server->write(connection, std::string("\n")); p="FRAMES"; if (singleparam.size()==0 || singleparam==p) server->write(connection, format("PARAM_INT;%s;%d;number of frames to aquire;0;100000;RW", p.c_str(), frames)); // number of frames to acquire is read/write int with range [0..1000000] if (singleparam.size()==0) server->write(connection, std::string("\n")); p="image_decay"; if (singleparam.size()==0 || singleparam==p) server->write(connection, format("PARAM_BOOL;%s;%s;pattern decay;;;RW", p.c_str(), booltostr(image_decay).c_str())); // pattern decay component is read/write boolean property if (singleparam.size()==0) server->write(connection, std::string("\n")); p="HAS_INSTRUCTION_PROGRESS"; if (singleparam.size()==0 || singleparam==p) server->write(connection, format("PARAM_BOOL;%s;true;;;;RO", p.c_str())); // tells QuickFit, that the parameter PROGRESS is supported by this plugin! if (singleparam.size()==0) server->write(connection, std::string("\n")); p="HAS_INSTRUCTION_CANCEL_ACQUISITION"; if (singleparam.size()==0 || singleparam==p) server->write(connection, format("PARAM_BOOL;%s;true;;;;RO", p.c_str())); // tells QuickFit, that the parameter CANCEL_ACQUISITION is supported by this plugin! if (singleparam.size()!=0) { // special parameters, which indicate the progress of an acquisition ... may only be queried with PARAMETER_GET if (singleparam.size()==0) server->write(connection, std::string("\n")); p="ACQ_RUNNING"; if (singleparam.size()==0 || singleparam==p) { pthread_mutex_lock(&mutexframesCompleted); server->write(connection, format("PARAM_BOOL;%s;%s;;;;RO", p.c_str(), booltostr(cam_acquisition_running).c_str())); // send, whether an acquisition is running pthread_mutex_unlock(&mutexframesCompleted); } if (singleparam.size()==0) server->write(connection, std::string("\n")); p="PROGRESS"; if (singleparam.size()==0 || singleparam==p) { pthread_mutex_lock(&mutexframesCompleted); int prog=0; if (maxWriteFrames>0) prog=floor(100.0*double(framesCompleted)/double(maxWriteFrames)); server->write(connection, format("PARAM_INT;%s;%d;;;;RO", p.c_str(), prog)); // send the progress (0..100) of the acquisition pthread_mutex_unlock(&mutexframesCompleted); } } }
void CAdministrationWindow::saveSettings(CConfig *cfg) { cfg->writeEntry("Refresh Rate", delay->value()); cfg->writeEntry("Status Traditional Mode", booltostr(status->isTraditionalMode())); }
int main(int argc, char *argv[]) { if (argc != 5) { show_usage(); return EXIT_FAILURE; } const char *type = argv[1]; const char *elf_path = argv[2]; const char *export_path = argv[3]; const char *import_path = argv[4]; char buffer[100]; int is_kernel = 0; // check if kernel or user if (strcmp(type, "kernel") == 0 || strcmp(type, "k") == 0) { is_kernel = 1; } else if (strcmp(type, "user") == 0 || strcmp(type, "u") == 0) { is_kernel = 0; } else { fprintf(stderr, "error: invalid mod-type '%s'. see usage for more info\n", type); return EXIT_FAILURE; } // load our exports vita_export_t *exports = vita_exports_load(export_path, elf_path, 0); if (!exports) return EXIT_FAILURE; yaml_emitter_t emitter; yaml_event_t event; /* Create the Emitter object. */ yaml_emitter_initialize(&emitter); FILE *fp = fopen(import_path, "w"); if (!fp) { // TODO: handle this fprintf(stderr, "could not open '%s' for writing\n", import_path); return EXIT_FAILURE; } yaml_emitter_set_output_file(&emitter, fp); /* Create and emit the STREAM-START event. */ if(!yamlemitter_stream_start(&emitter, &event)) goto error; if(!yamlemitter_document_start(&emitter, &event)) goto error; if(!yamlemitter_mapping_start(&emitter, &event)) goto error; if(!yamlemitter_key(&emitter, &event,"modules")) goto error; if(!yamlemitter_mapping_start(&emitter, &event)) goto error; if(!yamlemitter_key(&emitter, &event,exports->name)) goto error; if(!yamlemitter_mapping_start(&emitter, &event)) goto error; if(!yamlemitter_key_value(&emitter, &event,"nid",hextostr(exports->nid))) goto error; if(!yamlemitter_key(&emitter, &event,"libraries")) goto error; if(!yamlemitter_mapping_start(&emitter, &event)) goto error; for (int i = 0; i < exports->module_n; ++i) { vita_library_export *lib = exports->modules[i]; int kernel_lib = is_kernel; if (lib->syscall) { if (is_kernel) { kernel_lib = 0; } else { fprintf(stderr, "error: got syscall flag for user module. did you mean to pass as kernel module?"); return EXIT_FAILURE; } } if(!yamlemitter_key(&emitter, &event, lib->name)) goto error; if(!yamlemitter_mapping_start(&emitter, &event)) goto error; if(!yamlemitter_key_value(&emitter, &event,"nid",hextostr(lib->nid))) goto error; if(!yamlemitter_key_value(&emitter, &event,"kernel",booltostr(kernel_lib))) goto error; if(lib->function_n){ if(!yamlemitter_key(&emitter, &event, "functions")) goto error; if(!pack_export_symbols(&emitter, &event, lib->functions, lib->function_n)) goto error; } if(lib->variable_n){ if(!yamlemitter_key(&emitter, &event, "variables")) goto error; if(!pack_export_symbols(&emitter, &event, lib->variables, lib->variable_n)) goto error; } yaml_mapping_end_event_initialize(&event); if (!yaml_emitter_emit(&emitter, &event)) goto error; } if(!yamlemitter_mapping_end(&emitter, &event)) goto error; if(!yamlemitter_mapping_end(&emitter, &event)) goto error; if(!yamlemitter_mapping_end(&emitter, &event)) goto error; if(!yamlemitter_mapping_end(&emitter, &event)) goto error; if(!yamlemitter_document_end(&emitter, &event)) goto error; if(!yamlemitter_stream_end(&emitter, &event)) goto error; /* On error. */ error: fclose(fp); /* Destroy the Emitter object. */ yaml_emitter_delete(&emitter); // TODO: free exports, free json return 0; }