void ServerConfEditor::initCustomField() { getForm()->removeWidget("internet_protocol"); getForm()->removeWidget("virtual_user_auth"); InputChoice* selectProtocol = new InputChoice("internet_protocol", InputChoice::SELECT); { selectProtocol->addOption("IPv4", "IPv4"); selectProtocol->addOption("IPv6", "IPv6"); } getForm()->addWidget("editor", selectProtocol); InputChoice* selectVirtual = new InputChoice("virtual_user_auth", InputChoice::SELECT); { selectVirtual->addOption("0", "Anonymous"); } getForm()->addWidget("editor", selectVirtual); Input* hidden = new Input("type", Input::HIDDEN); { hidden->setValue("general"); hidden->setLabel(""); } getForm()->addWidget("editor", hidden); // Set attribute getContent()->removeAttribute("class"); }
ServerModelEditor::ServerModelEditor() : ModelEntityEditor< ::Model::Server >() { getForm()->removeWidget("id"); getForm()->getWidget("name")->setLabel("Name"); getForm()->getWidget("address")->setLabel("Address"); getForm()->getWidget("port")->setLabel("Port"); getForm()->getWidget("corba_id")->setLabel("Daemon Reference"); }
// Eine überladene Funktion, die einen String zurückgibt. QString verbSpanish::getForm(int t, int p) { QString st[3]; if (getForm(t, p, normal, st)) return st[2]; return ""; }
void FormFrame::setupFields() { FieldSlistIter *iter = getForm()->getFieldsIterator(); Field *f; while( f = (*iter)() ) f->openWindow( window->parent() ); delete iter; }
ServerConfEditor::ServerConfEditor() : ModelEntityEditor< ::UI::ServerConfWrapper >() { // Create Custom Field initCustomField(); // Change order initOrder(); QString label; QString help; QList<IWidgetForm*> widget = getForm()->getWidgets(); for (QList<IWidgetForm*>::iterator it = widget.begin(); it != widget.end(); it++) { Translate::instance()->group("server_editor_label"); label = Translate::instance()->tr((*it)->getName()); Translate::instance()->group("server_editor_help"); help = Translate::instance()->tr((*it)->getName()); (*it)->setLabel(label, help); } getForm()->getWidget("type")->setLabel(""); }
LLSD LLNotification::asLLSD() { LLSD output; output["name"] = mTemplatep->mName; output["form"] = getForm()->asLLSD(); output["substitutions"] = mSubstitutions; output["payload"] = mPayload; output["time"] = mTimestamp; output["expiry"] = mExpiresAt; output["priority"] = (S32)mPriority; output["responseFunctor"] = mResponseFunctorName; return output; }
//_________________________________________________________________________________________________ void Inst::makeNative(IRManager * irManager) { if (getForm()==Form_Native || hasKind(Kind_PseudoInst) ) return; assert(opcodeGroup); Node* bb = getNode(); U_32 * opndRoles = getOpndRoles(); Constraint * constraints = getConstraints(); I_32 defs[IRMaxNativeOpnds]={ -1, -1, -1, -1 }; for (U_32 i=0; i<opndCount; i++){ U_32 r = opndRoles[i]; if ((r & OpndRole_Explicit) == 0) continue; U_32 extendedIdx = r >> 16; U_32 nativeIdx = opcodeGroup->extendedToNativeMap[extendedIdx]; assert(nativeIdx < IRMaxNativeOpnds); I_32 defNativeIdx = defs[nativeIdx]; if (defNativeIdx != -1){ assert(i >= defOpndCount); opndRoles[defNativeIdx] |= OpndRole_Use; if (bb && opnds[defNativeIdx] != opnds[i]){ Inst * moveInst=irManager->newCopySequence(Mnemonic_MOV, opnds[defNativeIdx], opnds[i]); moveInst->insertBefore(this); } opnds[i] = NULL; }else defs[nativeIdx] = i; } U_32 packedOpnds = 0, explicitOpnds = 0; for (U_32 i = 0, n = opndCount; i < n; i++){ if (opnds[i] == NULL) continue; U_32 r = opndRoles[i]; if ((r & OpndRole_Explicit) != 0){ r = (r & 0xffff) | (explicitOpnds << 16); explicitOpnds++; } if (i > packedOpnds){ opnds[packedOpnds] = opnds[i]; constraints[packedOpnds] = constraints[i]; opndRoles[packedOpnds] = r; } packedOpnds++; } opndCount=packedOpnds; form = Form_Native; }
//_________________________________________________________________________________________________ void Inst::fixOpndsForOpcodeGroup(IRManager * irManager) { U_32 handledExplicitOpnds = 0, handledImplicitOpnds = 0; U_32 * roles = getOpndRoles(); Constraint * constraints = getConstraints(); Form f = getForm(); for (U_32 i=0, n=opndCount; i<n; i++){ if (roles[i] & Inst::OpndRole_Explicit){ U_32 idx, r; if (f == Form_Native){ idx = handledExplicitOpnds; r = Encoder::getOpndRoles(opcodeGroup->opndRoles, idx); if ( (r & OpndRole_Def) != 0 && defOpndCount<=i) defOpndCount = i + 1; }else{ idx = opcodeGroup->extendedToNativeMap[handledExplicitOpnds]; r = i < defOpndCount ? OpndRole_Def : OpndRole_Use; } r |= Inst::OpndRole_Explicit | (handledExplicitOpnds << 16); roles[i] = r; constraints[i] = opcodeGroup->opndConstraints[idx]; handledExplicitOpnds++; }else if (roles[i] & Inst::OpndRole_Implicit){ assert(handledImplicitOpnds < opcodeGroup->implicitOpndRoles.count); assert(opnds[i]->getRegName() == opcodeGroup->implicitOpndRegNames[handledImplicitOpnds]); handledImplicitOpnds++; } } for (U_32 i = handledImplicitOpnds; i < opcodeGroup->implicitOpndRoles.count; i++){ RegName iorn = opcodeGroup->implicitOpndRegNames[i]; Opnd * implicitOpnd = irManager->getRegOpnd(iorn); U_32 implicitOpndRoles = Encoder::getOpndRoles(opcodeGroup->implicitOpndRoles, i) | Inst::OpndRole_Implicit; if (implicitOpndRoles & OpndRole_Def){ insertOpnd(defOpndCount, implicitOpnd, implicitOpndRoles); constraints[defOpndCount - 1] = Constraint(iorn); }else{ insertOpnd(opndCount, implicitOpnd, implicitOpndRoles); constraints[opndCount - 1] = Constraint(iorn); } } }
void ServerConfEditor::initOrder() { getForm()->removeAllSections(); getForm()->addSection("network", "Network Management"); getForm()->addSection("miscs", "Miscs"); getForm()->addSection("submit", ""); QList<QString> order; order << "server_name" << "server_port" << "internet_protocol" << "idle_timeout" << "data_timeout"; getForm()->setFieldOrder("network", order); order.clear(); order << "welcome_message" << "log_file" << "type"; getForm()->setFieldOrder("miscs", order); }
//_________________________________________________________________________________________________ void Inst::assignOpcodeGroup(IRManager * irManager) { if (hasKind(Inst::Kind_PseudoInst)){ assert(getForm() == Form_Extended); opcodeGroup= (Encoder::OpcodeGroup *)Encoder::getDummyOpcodeGroup(); U_32 * roles = getOpndRoles(); U_32 i = 0; for (U_32 n = defOpndCount; i < n; i++) roles[i] = OpndRole_Auxilary | OpndRole_Def; for (U_32 n = opndCount; i < n; i++) roles[i] = OpndRole_Auxilary | OpndRole_Use; }else{ Encoder::FindInfo fi; initFindInfo(fi, Opnd::ConstraintKind_Initial); opcodeGroup=(Encoder::OpcodeGroup *)Encoder::findOpcodeGroup(fi); assert(opcodeGroup); // Checks that the requested mnemonic is implemented in Ia32EncodingTable fixOpndsForOpcodeGroup(irManager); } properties = opcodeGroup->properties; }
void caGraphics::paintEvent( QPaintEvent *event ) { Q_UNUSED(event); if(thisHide) return; int m_margin = 3; QPointF p1,p2; QPainter painter( this ); painter.setRenderHint( QPainter::Antialiasing ); int margin = thisLineSize/2; int w = width() - 2 * margin; int h = height() - 2 * margin; // do not increase linesize beyond the canvas size if(w <= 0 || h <= 0) { setLineSize(thisLineSize-1); } margin = thisLineSize/2; w = width() - 2 * margin; h = height() - 2 * margin; int x = margin; int y = margin; if(thisLineStyle == Dash) { painter.setPen( QPen( getLineColor(), getLineSize(), Qt::DotLine, Qt::SquareCap) ); } else if (thisLineStyle == BigDash) { painter.setPen( QPen( getLineColor(), getLineSize(), Qt::DashLine, Qt::SquareCap) ); } else { painter.setPen( QPen( getLineColor(), getLineSize(), Qt::SolidLine, Qt::SquareCap) ); } if(thisFillStyle == Filled) { painter.setBrush(getForeground()); } if(getForm() == Rectangle) { QPolygonF rectangle; rectangle.append(QPointF(x,y)); rectangle.append(QPointF(x+w,y)); rectangle.append(QPointF(x+w,y+h)); rectangle.append(QPointF(x,y+h)); rectangle.append(QPointF(x,y)); // rotate QPolygonF rotated = rotateObject(thisTiltAngle, w, h, thisLineSize, rectangle); painter.drawPolygon(rotated); } else if(getForm() == Circle) { // rotate my calculated ellipse QPolygonF rotated = rotateObject(thisTiltAngle, w, h, thisLineSize, drawCircle(x, x+w, y, y+h)); painter.drawPolygon(rotated); } else if(getForm() == Triangle) { QPolygonF triangle; triangle.append(QPointF(x+w/2,0)); triangle.append(QPointF(x,y+h)); triangle.append(QPointF(x+w,y+h)); triangle.append(QPointF(x+w/2,0)); // rotate QPolygonF rotated = rotateObject(thisTiltAngle, w, h, thisLineSize, triangle); painter.drawPolygon(rotated); } else if(getForm() == Arc) { if(thisFillStyle == Filled) { painter.drawPie (x, y, w, h, thisStartAngle * 16, thisSpanAngle * 16); } else { painter.drawArc (x, y, w, h, thisStartAngle * 16, thisSpanAngle * 16); } } else if(getForm() == Line) { QPolygonF line; line.append(QPointF(x,y+h/2)); line.append(QPointF(x+w,y+h/2)); // rotate QPolygonF rotated = rotateObject(thisTiltAngle, w, h, thisLineSize, line); painter.drawPolygon(rotated); } else if(getForm() == Arrow) { QPolygonF lines; QPolygonF head1; QPolygonF head2; p1 = QPointF( m_margin, height()/2 ); p2 = QPointF( width()-m_margin, height()/2 ); lines.append(p1); lines.append(p2); head1 = getHead(p1,p2); if (getArrowMode() == Double) { head2 = getHead(p2,p1); } for(int i=0; i<head1.count(); i++) lines.append(head1.at(i)); for(int i=0; i<head2.count(); i++) lines.append(head2.at(i)); // rotate QPolygonF rotated = rotateObject(thisTiltAngle, w, h, thisLineSize, lines); painter.drawPolygon(rotated); } }
UserModelEditor::UserModelEditor() : ModelEntityEditor< ::Model::User >() { // Remove unsed widget getForm()->removeWidget("id"); getForm()->removeWidget("created_at"); getForm()->removeWidget("last_access"); getForm()->removeWidget("puppetftp_role"); getForm()->removeWidget("passwd"); // Set label getForm()->getWidget("firstname")->setLabel("First Name"); getForm()->getWidget("lastname")->setLabel("Last Name"); getForm()->getWidget("email")->setLabel("Email"); // Add custom attribute getForm()->getWidget("email")->setAttribute("autocomplete", "off"); // Get role ITable* table = DatabaseManager::instance()->getTable("puppetftp_role"); if (table == NULL) { // rediriger ou gérer le cas d'erreur } QList<QObject*> roles = table->getAll(); // Create custom widget InputChoice* selectRole = new InputChoice("puppetftp_role", InputChoice::SELECT); selectRole->setLabel("Role"); for (QList<QObject*>::const_iterator it = roles.begin(); it != roles.end(); it++) { Model::Role* role = dynamic_cast<Model::Role*>(*it); selectRole->addOption(QString::number(role->getId()), role->getName()); } getForm()->addWidget("editor", selectRole); Input* password = new Input("passwd", Input::PASSWORD); password->setLabel("Password"); password->setAttribute("autocomplete", "off"); getForm()->addWidget("editor", password); roles.clear(); delete table; }
int main(void) { int number = 0; /*表示する発言番号*/ int i; /*カウンタ*/ char fname[FNAME_LEN]; /*ファイル名作成*/ char *buffer; /*バッファ*/ char **file2Dim; /*発言ファイルを格納*/ char **name, **value; /*QUERY_STRINGのname=value*/ int count; /*name=valueの組数*/ char Title[BUFSIZE]; CF config; if(!getConfig( &config )) { fatal_error("■ 設定ファイルの読み込みに失敗しました。", body); return 1; } count = getForm(&name, &value); buffer = getValue( "number", name, value ); if( buffer == NULL ) { fatal_error("■ システムエラーです。このCGIの実行方法をお確かめください。", body); exit(1); } else { number = atoi( buffer ); if( number == 0 ) { fatal_error("■ システムエラーです。再度実行してください。", body); exit(1); } } sprintf( fname,"./file/%d", number ); file2Dim = readFile( fname ); if( file2Dim == NULL ) { fatal_error("■ システムエラーです。再度実行してください。", body); exit(1); } /*--- フォーム出力 ---*/ sprintf( Title, "#%d (%s)", number, config.aptitle ); printPageHeader(Title); puts(body); printf(" %05d %s <A HREF=\"mailto:%s\">%s</A> <B>%s</B>\n", number, *(file2Dim + 1), *(file2Dim + 3), *(file2Dim + 2), *(file2Dim + 5)); printf( "<HR>\n" "<BLOCKQUOTE>\n" "<PRE>%s" , font ); for( i = 15; *(file2Dim + i); i++ ) { if( **(file2Dim) == '>' ) /*引用行は斜体にする*/ printf( "<EM>%s</EM>", *(file2Dim + i) ); else fputs( *(file2Dim + i), stdout ); } printUrl( *(file2Dim + 11) ); printf( "</FONT>" "</PRE>\n" "</BLOCKQUOTE>\n" "<HR>\n" "</BODY>\n" "</HTML>\n" ); freeTwoDimArray( file2Dim ); if(count > 0) freedata(name, value); exit(0); }
//_________________________________________________________________________________________________ void Inst::setOpnd(U_32 index, Opnd * opnd) { Opnd ** opnds = getOpnds(); if (index < opndCount) { Constraint cc = opnds[index]->getConstraint(Opnd::ConstraintKind_Initial); opnds[index] = opnd; if(!hasKind(Kind_PseudoInst) && (getOpndRoles()[index] & OpndRole_Explicit) && cc != opnd->getConstraint(Opnd::ConstraintKind_Initial) && !Encoder::isOpndAllowed(opcodeGroup, getExplicitOpndIndexFromOpndRoles(getOpndRoles()[index]), opnd->getConstraint(Opnd::ConstraintKind_Initial), getForm()==Form_Extended, true) ) { BasicBlock * bb = getBasicBlock(); //instruction must be inserted into a basic block to be modifiable. //it caused by necessity of reference to irManager for implicit operands //assigning (flags, for example) assert(bb); assignOpcodeGroup(&bb->getIRManager()); assert(opcodeGroup); } } else{ opnds[(index - opndCount) / 4]->setMemOpndSubOpnd((MemOpndSubOpndKind)((index - opndCount) & 3), opnd); } verify(); }