Exemple #1
0
djvFileEdit::djvFileEdit(QWidget * parent) :
    QWidget(parent),
    _p(new P)
{
    // Create the widgets.

    _p->edit = new QLineEdit;

    QPushButton * button = new QPushButton(tr("&Browse"));

    // Layout the widgets.

    QHBoxLayout * layout = new QHBoxLayout(this);
    layout->setMargin(0);
    layout->addWidget(_p->edit, 1);
    layout->addWidget(button);

    // Initialize.

    widgetUpdate();

    // Setup the callbacks.

    connect(_p->edit, SIGNAL(editingFinished()), SLOT(editCallback()));
    
    connect(button, SIGNAL(clicked()), SLOT(buttonCallback()));
}
void StaticEditMenu::editItem(uint8_t item, uint8_t key)
{
    int16_t * valuePtr = getEditAddress(item);
    uint8_t index = getSelectedIndexOrSize(item);
    EditData d = pgm::read(&staticEditData[index].edit);
    int dir = 1;
    if(key == BUTTON_DEC) dir = -1;

    if(d.step == CE_STEP_TYPE_SMART) {
        change0ToInfSmart((uint16_t*)valuePtr, dir);
    } else if(d.step == CE_STEP_TYPE_METHOD) {
        d.editMethod(dir);
        goto callback; //TODO:: ?? rewrite
    } else {
         *valuePtr += dir*d.step;
    }
    if(*valuePtr < d.minValue) *valuePtr = d.minValue;
    if(*valuePtr > d.maxValue) *valuePtr = d.maxValue;

callback:
    if(editCallback) {
        editCallback(this, (uint16_t*)valuePtr);
    }
}