Ejemplo n.º 1
0
void EchoServer::setuid()
{
    setAttribute(Qt::WA_DeleteOnClose);
    connect(ui->pbStart, SIGNAL(clicked()),SLOT(onClickStart()));
    connect(ui->sldPort, SIGNAL(valueChanged(int)), ui->lcdPort, SLOT(display(int)));

    ui->sldPort->setMinimum(EchoServer::PORT_MIN);
    ui->sldPort->setMaximum(EchoServer::PORT_MAX);
    ui->sldPort->setValue(EchoServer::PORT_DEFAULT);
}
Ejemplo n.º 2
0
// -----------------------------------------------------------------
// Name : onCatchButtonEvent
//  Called by Input Engine.
//  Must return true if event is consumed ; false to let the event be catched by other modules
//  Transfer the message to top frame under mouse
// -----------------------------------------------------------------
bool InterfaceManager::onCatchButtonEvent(ButtonAction * pEvent)
{
    if (pEvent->eButton == ButtonStart && pEvent->eEvent == Event_Down) {
        return onClickStart();
    }
    if (pEvent->eEvent == Event_Down)
    {
        // Reset clicked objects
        if (pEvent->eButton == Button1) {
            m_pClickedObjects[0] = NULL;
        } else if (pEvent->eButton == Button2) {
            m_pClickedObjects[1] = NULL;
        }

        int xoffset, yoffset;
        guiComponent * pObj1 = getObjectAt(pEvent->xPos - pEvent->xOffset, pEvent->yPos - pEvent->yOffset, &xoffset, &yoffset);
        pEvent->xOffset += xoffset;
        pEvent->yOffset += yoffset;
        if (pObj1 == NULL) {
            return false; // not concerned
        }
        if (!pObj1->isEnabled()) {
            return true;  // event is for us, but do nothing
        }

        if ((pObj1->getType() & GOTYPE_FRAME) && pEvent->eButton == Button1) {
            bringFrameAbove((guiFrame*)pObj1);
        }

        // Send event
        guiObject * pObj = pObj1->onButtonEvent(pEvent);
        // Store object for dragging (only for main buttons)
        if (pEvent->eButton == Button1) {
            m_pClickedObjects[0] = pObj;
        } else if (pEvent->eButton == Button2) {
            m_pClickedObjects[1] = pObj;
        }
        // else, don't care about dragging, so just forget pObj.
        return true;
    }
    else
    {
        guiObject ** pObj = (pEvent->eButton == Button1) ? &(m_pClickedObjects[0]) : ((pEvent->eButton == Button2) ? &(m_pClickedObjects[1]) : NULL);
        if (pObj != NULL && *pObj != NULL)
        {
            *pObj = (*pObj)->onButtonEvent(pEvent);
            if (*pObj != NULL && ((*pObj)->getType() & GOTYPE_FRAME) && pEvent->eEvent == Event_Drag) {
                ((guiFrame*) (*pObj))->checkPositionIfDragged();
            }
        }
        return true;
    }
}