Пример #1
0
 // implement pure virtual of form display
 bool form_display( void )
 {
   bool breturn = true;
   script << makeTop( "store_ui.cgi", "Stores" )
          << makeStaticBox(  "Store ID","Id",StoreID,"12" ) 
          << makeComboBox( "Marketer*:","MarketerID",MarketerID,
                           "select MarketerID, MarketerName from Marketer" )
          << makeComboBox( "Sub-Categories*:","SubcategoryID",SubcategoryIDs,
                           "select SubcategoryID, concat(CategoryName, ' - ',  SubcategoryName) "
                           "from Subcategory s inner join Category c on s.CategoryID = "
                           "c.CategoryID", "", " multiple='multiple' size='6'" )  
          << makeTextBox(  "Marketer Store ID","MarketerStoreID",MarketerStoreID,"55" )                                                   
          << makeTextBox(  "Store Name*:","StoreName",StoreName,"55" )
          << makeTextBox(  "Store Link*:","StoreLink",StoreLink,"512","55" )           
          << makeTextArea( "Store Info*:","StoreInfo",StoreInfo ) 
          << makeComboBox( "Store Template:","StoreTemplateID", StoreTemplateID,
                           "select StoreTemplateID, StoreTemplateName from StoreTemplate" )                              
          << makeImageBox( "Store Image*:","StoreImage", StoreImage,"35" ) 
          << makeManualComboBox("Commission Type*:","CommissionType", 
                                CommissionType, "Dollar ($)=$,Percentage (%)=%" ) 
          << makeTextBox( "Commission*:","Commission",Commission,"8" ) 
          << makeTextBox( "Discount*:","Discount",Discount,"8" ) 
          << makeTextBox( "Footnote: ","Footnote",Footnote,"55" ) 
          << makeBoolBox(  "Featured Store?:","Featured", Featured) 
          << makeBoolBox(  "Store Enabled?:","Enabled", Enabled)                   
          << makeButtons( key() )
          << makeBottom( m_result ) << endl; 
   return breturn;
 }      
Пример #2
0
 // implement pure virtual of form display
 bool form_display( void )
 {
   bool breturn = true;
   ocString group_sql = "select id, name from groups";
   if( !oLogin.SiteAdmin() )
   {
     group_sql += " where id = ";
     group_sql += oLogin.GroupId();
   }
   group_sql += " order by name";
   script << endl << "<!--" << group_sql << "-->" << endl;
   script << makeTop("users_ui.cgi", "USERS")
          << makeStaticBox("Id","id",id,"12" )
          << makeComboBox("Group", "group_id", group_id, 
                           group_sql)                
          << makeTextBox("First","first",first,"24")
          << makeTextBox("Last","last",last,"24")
          << makeTextBox("Login","login",login,"24")
          << makeTextBox("Password","password",password,"12")
          << makeTextBox("Phone Number","phone_number",phone_number,"16")
          << makeTextBox("Email","email",email,"64");
   if( group_id != 0 )
   {
     ocString select = "select r.id, r.name from roles r inner join group_roles gr on "
                       "r.id = gr.role_id where gr.group_id = ";
     select.append(group_id);                   
     script
          << makeComboBox("Roles","role_id",user_roles,
                          select.c_str(), 
                          "", " multiple='multiple' size='6'" );  
   }                                    
   script << makeButtons( key() )
          << makeBottom( m_result ) << endl; 
   return breturn;
 }      
Пример #3
0
 // implement pure virtual of form display
 bool form_display( void )
 {
   bool breturn = true;
   script << makeTop("group_sites_ui.cgi", "GROUP SITES")
          << makeStaticBox("Id", "id", id, "12")           
          << makeComboBox( "Group", "group_id", group_id, 
                           "select id, name from groups order by name" )  
          << makeComboBox( "Site", "site_id", site_id, 
                           "select id, name from metasite.sites order by name" )                            
          << makeButtons( key() )
          << makeBottom( m_result ) << endl; 
   return breturn;
 }      
Пример #4
0
 // implement pure virtual of form display
 bool form_display( void )
 {
   bool breturn = true;
   script << makeTop("roles_ui.cgi", "ROLES")
          << makeStaticBox("Id","id",id,"12" )             
          << makeTextBox("Name","name",name,"24")
          << makeTextArea("Comments","comment",comment,  "2", "50")
          << makeComboBox( "Services","service_id",role_services,
                           "select id,  name from services", 
                           "", " multiple='multiple' size='6'" );
   script << makeButtons( key() )
          << makeBottom( m_result ) << endl; 
   return breturn;
 }
Пример #5
0
int gnoclComboEntryCmd( ClientData data, Tcl_Interp *interp,
      int objc, Tcl_Obj * const objv[] )
{
   return makeComboBox( interp, objc, objv, 1 );
}
Пример #6
0
BlockPropertiesPanel::BlockPropertiesPanel(GraphBlock *block, QWidget *parent):
    QWidget(parent),
    _ignoreChanges(true),
    _idLabel(new QLabel(this)),
    _idLineEdit(new QLineEdit(this)),
    _affinityZoneLabel(new QLabel(this)),
    _affinityZoneBox(nullptr),
    _blockErrorLabel(new QLabel(this)),
    _updateTimer(new QTimer(this)),
    _formLayout(nullptr),
    _block(block)
{
    auto blockDesc = block->getBlockDesc();

    //master layout for this widget
    auto layout = new QVBoxLayout(this);

    //create a scroller and a form layout
    auto scroll = new QScrollArea(this);
    scroll->setWidgetResizable(true);
    scroll->setWidget(new QWidget(scroll));
    _formLayout = new QFormLayout(scroll);
    scroll->widget()->setLayout(_formLayout);
    layout->addWidget(scroll);

    //title
    {
        auto label = new QLabel(QString("<h1>%1</h1>").arg(_block->getTitle().toHtmlEscaped()), this);
        label->setAlignment(Qt::AlignCenter);
        _formLayout->addRow(label);
    }

    //errors
    {
        _formLayout->addRow(_blockErrorLabel);
    }

    //id
    {
        _idOriginal = _block->getId();
        _formLayout->addRow(_idLabel, _idLineEdit);
        connect(_idLineEdit, SIGNAL(textEdited(const QString &)), this, SLOT(handleEditWidgetChanged(const QString &)));
        connect(_idLineEdit, SIGNAL(returnPressed(void)), this, SLOT(handleCommitButton(void)));
    }

    //properties
    for (const auto &prop : _block->getProperties())
    {
        _propIdToOriginal[prop.getKey()] = _block->getPropertyValue(prop.getKey());
        auto paramDesc = _block->getParamDesc(prop.getKey());
        assert(paramDesc);

        //create editable widget
        auto editWidget = new BlockPropertyEditWidget(paramDesc, this);
        connect(editWidget, SIGNAL(valueChanged(void)), this, SLOT(handleEditWidgetChanged(void)));
        connect(editWidget, SIGNAL(commitRequested(void)), this, SLOT(handleCommitButton(void)));
        _propIdToEditWidget[prop.getKey()] = editWidget;

        //create labels
        _propIdToFormLabel[prop.getKey()] = new QLabel(this);
        _propIdToErrorLabel[prop.getKey()] = new QLabel(this);
        editWidget->setToolTip(this->getParamDocString(_block->getParamDesc(prop.getKey())));

        //layout stuff
        auto editLayout = new QVBoxLayout();
        editLayout->addWidget(editWidget);
        editLayout->addWidget(_propIdToErrorLabel[prop.getKey()]);
        _formLayout->addRow(_propIdToFormLabel[prop.getKey()], editLayout);
    }

    //affinity zone
    {
        _affinityZoneOriginal = _block->getAffinityZone();
        auto dock = dynamic_cast<AffinityZonesDock *>(getObjectMap()["affinityZonesDock"]);
        assert(dock != nullptr);
        _affinityZoneBox = dock->makeComboBox(this);
        _formLayout->addRow(_affinityZoneLabel, _affinityZoneBox);
        connect(_affinityZoneBox, SIGNAL(activated(const QString &)), this, SLOT(handleEditWidgetChanged(const QString &)));
    }

    //draw the block's preview onto a mini pixmap
    //this is cool, maybe useful, but its big, where can we put it?
    /*
    {
        const auto bounds = _block->getBoundingRect();
        QPixmap pixmap(bounds.size().toSize()+QSize(2,2));
        pixmap.fill(Qt::transparent);
        QPainter painter(&pixmap);
        painter.translate(-bounds.topLeft()+QPoint(1,1));
        painter.setRenderHint(QPainter::Antialiasing);
        painter.setRenderHint(QPainter::HighQualityAntialiasing);
        painter.setRenderHint(QPainter::SmoothPixmapTransform);
        _block->render(painter);
        painter.end();
        auto label = new QLabel(this);
        label->setPixmap(pixmap);
        _formLayout->addRow(label);
        _formLayout->setAlignment(label, Qt::AlignHCenter);
    }
    */

    //block level description
    if (blockDesc->isArray("docs"))
    {
        QString output;
        output += QString("<h1>%1</h1>").arg(QString::fromStdString(blockDesc->get("name").convert<std::string>()));
        output += QString("<p>%1</p>").arg(QString::fromStdString(block->getBlockDescPath()));
        output += "<p>";
        for (const auto &lineObj : *blockDesc->getArray("docs"))
        {
            const auto line = lineObj.extract<std::string>();
            if (line.empty()) output += "<p /><p>";
            else output += QString::fromStdString(line)+"\n";
        }
        output += "</p>";

        //enumerate properties
        if (not _block->getProperties().empty())
        {
            output += QString("<h2>%1</h2>").arg(tr("Properties"));
            for (const auto &prop : _block->getProperties())
            {
                output += this->getParamDocString(_block->getParamDesc(prop.getKey()));
            }
        }

        //enumerate slots
        if (not block->getSlotPorts().empty())
        {
            output += QString("<h2>%1</h2>").arg(tr("Slots"));
            output += "<ul>";
            for (const auto &port : block->getSlotPorts())
            {
                output += QString("<li>%1(...)</li>").arg(port.getName());
            }
            output += "</ul>";
        }

        //enumerate signals
        if (not block->getSignalPorts().empty())
        {
            output += QString("<h2>%1</h2>").arg(tr("Signals"));
            output += "<ul>";
            for (const auto &port : block->getSignalPorts())
            {
                output += QString("<li>%1(...)</li>").arg(port.getName());
            }
            output += "</ul>";
        }

        auto text = new QLabel(output, this);
        text->setStyleSheet("QLabel{background:white;margin:1px;}");
        text->setWordWrap(true);
        _formLayout->addRow(text);
    }

    //buttons
    {
        auto buttonLayout = new QHBoxLayout();
        layout->addLayout(buttonLayout);
        auto commitButton = new QPushButton(makeIconFromTheme("dialog-ok-apply"), tr("Commit"), this);
        connect(commitButton, SIGNAL(pressed(void)), this, SLOT(handleCommitButton(void)));
        buttonLayout->addWidget(commitButton);
        auto cancelButton = new QPushButton(makeIconFromTheme("dialog-cancel"), tr("Cancel"), this);
        connect(cancelButton, SIGNAL(pressed(void)), this, SLOT(handleCancelButton(void)));
        buttonLayout->addWidget(cancelButton);
    }

    //update timer
    _updateTimer->setSingleShot(true);
    _updateTimer->setInterval(UPDATE_TIMER_MS);
    connect(_updateTimer, SIGNAL(timeout(void)), this, SLOT(handleUpdateTimerExpired(void)));

    //connect state change to the graph editor
    auto draw = dynamic_cast<GraphDraw *>(_block->parent());
    auto editor = draw->getGraphEditor();
    connect(this, SIGNAL(stateChanged(const GraphState &)), editor, SLOT(handleStateChange(const GraphState &)));
    connect(_block, SIGNAL(destroyed(QObject*)), this, SLOT(handleBlockDestroyed(QObject*)));

    this->updateAllForms();
    _ignoreChanges = false;
}