unsigned handle_nbtstat_rr(struct Output *out, const unsigned char *px, unsigned length, unsigned ip_them, unsigned port_them) { unsigned char banner[65536]; unsigned banner_length = 0; unsigned offset = 0; unsigned name_count; if (offset >= length) return 0; name_count = px[offset++]; while (offset + 18 <= length && name_count) { append_name(banner, sizeof(banner), &banner_length, &px[offset]); offset += 18; name_count--; } { unsigned i; for (i=0; i<6; i++) { if (offset + i < length) { unsigned char c = px[offset]; append_char(banner, sizeof(banner), &banner_length, "0123456789ABCDEF"[c>>4]); append_char(banner, sizeof(banner), &banner_length, "0123456789ABCDEF"[c&0xF]); if (i < 5) append_char(banner, sizeof(banner), &banner_length, '-'); } } }
AlgorithmWidget::AlgorithmWidget(FrameData& framedata, QWidget *parent) : QWidget(parent), framedata(framedata) { setWindowTitle("Algorithm"); algo_chooser = new QComboBox; QStringList list; framedata.for_each_algorithm(append_name(list)); algo_chooser->addItems(list); connect(algo_chooser, SIGNAL(currentIndexChanged(int)), // this, SLOT(choose(int))); int_manager = new QtIntPropertyManager(this); bool_manager = new QtBoolPropertyManager(this); double_manager = new QtDoublePropertyManager(this); enum_manager = new QtEnumPropertyManager(this); color_manager = new QtColorPropertyManager(this); filepath_manager = new FilePathManager(this); vector2d_manager = new QVector2DPropertyManager(this); vector3d_manager = new QVector3DPropertyManager(this); vector4d_manager = new QVector4DPropertyManager(this); connect(int_manager, SIGNAL(valueChanged(QtProperty*, int)), this, SLOT(value_changed(QtProperty*, int))); connect(bool_manager, SIGNAL(valueChanged(QtProperty*, bool)), this, SLOT(value_changed(QtProperty*, bool))); connect(double_manager, SIGNAL(valueChanged(QtProperty*, double)), this, SLOT(value_changed(QtProperty*, double))); connect(enum_manager, SIGNAL(valueChanged(QtProperty*, int)), this, SLOT(value_changed(QtProperty*, int))); connect(color_manager, SIGNAL(valueChanged(QtProperty*, QColor)), this, SLOT(value_changed(QtProperty*, QColor))); connect(filepath_manager, SIGNAL(valueChanged(QtProperty*, QString)), this, SLOT(value_changed(QtProperty*, QString))); connect(vector2d_manager, SIGNAL(valueChanged(QtProperty*, Vec2)), this, SLOT(value_changed(QtProperty*, Vec2))); connect(vector3d_manager, SIGNAL(valueChanged(QtProperty*, Vec3)), this, SLOT(value_changed(QtProperty*, Vec3))); connect(vector4d_manager, SIGNAL(valueChanged(QtProperty*, Vec4)), this, SLOT(value_changed(QtProperty*, Vec4))); QtDoubleSpinBoxFactory* double_factory = new QtDoubleSpinBoxFactory(this); QtCheckBoxFactory* bool_factory = new QtCheckBoxFactory(this); QtSpinBoxFactory* int_factory = new QtSpinBoxFactory(this); QtEnumEditorFactory* enum_factory = new QtEnumEditorFactory(this); QtColorEditorFactory* color_factory = new QtColorEditorFactory(this); FileEditFactory* filepath_factory = new FileEditFactory(this); property_browser = new QtTreePropertyBrowser; property_browser->setFactoryForManager(int_manager, int_factory); property_browser->setFactoryForManager(bool_manager, bool_factory); property_browser->setFactoryForManager(double_manager, double_factory); property_browser->setFactoryForManager(enum_manager, enum_factory); property_browser->setFactoryForManager(color_manager, color_factory); property_browser->setFactoryForManager( color_manager->subIntPropertyManager(), int_factory); property_browser->setFactoryForManager(filepath_manager, filepath_factory); property_browser->setFactoryForManager( vector2d_manager->subDoublePropertyManager(), double_factory); property_browser->setFactoryForManager( vector3d_manager->subDoublePropertyManager(), double_factory); property_browser->setFactoryForManager( vector4d_manager->subDoublePropertyManager(), double_factory); QVBoxLayout* layout = new QVBoxLayout; if (framedata.num_algorithms() > 1) layout->addWidget(algo_chooser); layout->addWidget(property_browser); setLayout(layout); choose(0); }