/*************************************************************************
	Handler to map close button clicks to FrameWindow 'CloseCliked' events
*************************************************************************/
bool FrameWindow::closeClickHandler(const EventArgs& e)
{
    WindowEventArgs args(this);
	onCloseClicked(args);

	return true;
}
Beispiel #2
0
void DictFrame::keyReleaseEvent(QKeyEvent *ke)
{
    QWidget * wnd = 0;
    QPushButton * btn = 0;
    int key = ke->key();
    if (key == Qt::Key_Escape || key == ui::Device_Menu_Key)
    {
        ke->accept();
        onCloseClicked();
        return;
    }

    if (internalState() == LOOKUP)
    {
        emit keyReleaseSignal(ke->key());
        return;
    }

    ke->accept();
    switch (ke->key())
    {
    case Qt::Key_Up:
    case Qt::Key_Left:
    case Qt::Key_Right:
    case Qt::Key_Down:
        wnd = ui::moveFocus(this, key);
        if (wnd)
        {
            wnd->setFocus();
        }
        break;
    default:
        break;
    }
}
Beispiel #3
0
Bluetooth::Bluetooth(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::Bluetooth)
{
    ui->setupUi(this);

    system("echo 1 > /dev/swzb");

    currentAddr = NULL;
    sensorType = 0;
    myCom = new Communiate(this);

    pollTimer = new QTimer(this);

    ui->scanBtn->setEnabled(false);
    ui->connectBtn->setEnabled(false);
    ui->groupBox->setEnabled(false);
    ui->groupBox_2->setEnabled(false);
    ui->groupBox_3->setEnabled(false);

    connect(pollTimer, SIGNAL(timeout()), this, SLOT(onPollTimerTimeout()));

    connect(myCom, SIGNAL(recvRspInfo(unsigned char*)), this, SLOT(onRecvRspInfo(unsigned char *)));
    connect(ui->switchBtn, SIGNAL(clicked()), this, SLOT(onSwitchClicked()));
    connect(ui->scanBtn, SIGNAL(clicked()), this, SLOT(onSanClicked()));
    connect(ui->addrList, SIGNAL(currentRowChanged(int)), this, SLOT(onAddrChanged(int)));
    connect(ui->connectBtn, SIGNAL(clicked()), this, SLOT(onConnectClicked()));
    connect(ui->openBtn, SIGNAL(clicked()), this, SLOT(onOpenClicked()));
    connect(ui->closeBtn, SIGNAL(clicked()), this, SLOT(onCloseClicked()));
}
Beispiel #4
0
void PasswordDialog::keyReleaseEvent(QKeyEvent *ke)
{
    int key = ke->key();
    if (key == Qt::Key_Escape || key == ui::Device_Menu_Key)
    {
        onCloseClicked();
        return;
    }
}
Beispiel #5
0
void DictWidget::keyReleaseEvent(QKeyEvent *ke)
{
    QWidget * wnd = 0;
    QPushButton * btn = 0;
    int key = ke->key();
    if (key == Qt::Key_Escape || key == ui::Device_Menu_Key)
    {
        ke->accept();
        onCloseClicked();
        return;
    }

    if (internalState() == LOOKUP)
    {
        emit keyReleaseSignal(ke->key());
        return;
    }

    switch (ke->key())
    {
    case Qt::Key_Left:
    case Qt::Key_Right:
        if (internalState() != RETRIEVING_WORD)
        {
            wnd = content_widget_.focusWidget();
            btn = qobject_cast<QPushButton*>(wnd);
            const int button_id = button_group_.id(btn);
            if (-1 == button_id)
            {
                int checked_id = button_group_.checkedId();
                handleLeftRightKey(checked_id, key);
            }
            else
            {
                wnd = ui::moveFocus(this, key);
                if (wnd)
                {
                    wnd->setFocus();
                    QPushButton *tmpButton = qobject_cast<QPushButton*>(wnd);
                    const int focus_id = button_group_.id(tmpButton);
                    changeDescription(focus_id);
                }
            }
            ke->accept();
        } else
        {
            emit keyReleaseSignal(ke->key());
        }
        return;
    case Qt::Key_Up:
    case Qt::Key_Down:
        if (internalState() != RETRIEVING_WORD)
        {
            wnd = ui::moveFocus(this, key);
            if (wnd)
            {
                wnd->setFocus();
            }
            ke->accept();
        }
        else
        {
            emit keyReleaseSignal(ke->key());
        }
        return;
    case Qt::Key_Enter:
    case Qt::Key_Return:
        if (internalState() == RETRIEVING_WORD)
        {
            emit keyReleaseSignal(ke->key());
        }
        return ;
    default:
        break;
    }
    ke->ignore();
    emit keyReleaseSignal(ke->key());
}
Beispiel #6
0
void WifiDialog::createLayout()
{
    // big_box_.setSizeConstraint(QLayout::SetMinimumSize);
    big_box_.setSpacing(SPACING);
    big_box_.setContentsMargins(SPACING, SPACING, SPACING, SPACING);

    // title hbox.
    big_box_.addLayout(&title_hbox_);
    title_hbox_.setContentsMargins(0, 0, 0, 0);
    title_hbox_.addWidget(&title_icon_label_, 0, Qt::AlignVCenter);
    title_hbox_.addSpacing(SPACING * 2);
    title_hbox_.addWidget(&title_text_label_, 0, Qt::AlignVCenter);
    title_hbox_.addStretch(0);
    title_hbox_.addWidget(&close_button_);
    title_icon_label_.setPixmap(QPixmap(":/images/network_connection.png"));
    title_text_label_.setAlignment(Qt::AlignVCenter);
    title_icon_label_.setFixedHeight(WIDGET_HEIGHT);
    title_text_label_.useTitleBarStyle();
    title_text_label_.setFixedHeight(WIDGET_HEIGHT);

    close_button_.setStyleSheet(BUTTON_STYLE);
    QPixmap close_pixmap(":/images/close.png");
    close_button_.setIconSize(close_pixmap.size());
    close_button_.setIcon(QIcon(close_pixmap));
    close_button_.setFocusPolicy(Qt::NoFocus);
    QObject::connect(&close_button_, SIGNAL(clicked()), this, SLOT(onCloseClicked()));

    // content layout.
    big_box_.addLayout(&content_layout_);
    content_layout_.setContentsMargins(MARGINS, MARGINS, MARGINS, MARGINS);

    // Status.
    state_widget_layout_.setContentsMargins(MARGINS, 0, MARGINS, 0);
    state_widget_layout_.addWidget(&state_widget_);
    content_layout_.addSpacing(10);
    content_layout_.addLayout(&state_widget_layout_);
    QObject::connect(&state_widget_, SIGNAL(refreshClicked()), this, SLOT(onRefreshClicked()));
    QObject::connect(&state_widget_, SIGNAL(customizedClicked()), this, SLOT(onCustomizedClicked()));
    QObject::connect(&prev_button_, SIGNAL(clicked()), &ap_view_, SLOT(goPrev()), Qt::QueuedConnection);
    QObject::connect(&next_button_, SIGNAL(clicked()), &ap_view_, SLOT(goNext()), Qt::QueuedConnection);

    // ap layout.
    ap_layout_.setContentsMargins(MARGINS, MARGINS, MARGINS, MARGINS);
    ap_layout_.setSpacing(5);
    content_layout_.addLayout(&ap_layout_);
    ap_layout_.addWidget(&ap_view_);

    QObject::connect(&ap_view_, SIGNAL(positionChanged(const int, const int)), this, SLOT(onPositionChanged(const int, const int)));
    QObject::connect(&ap_view_, SIGNAL(itemActivated(CatalogView*, ContentView*, int)), this, SLOT(onItemActivated(CatalogView*, ContentView*, int)));

    ap_view_.setPreferItemSize(QSize(-1, AP_ITEM_HEIGHT));
    ap_view_.setNeighbor(&state_widget_.dashBoard(), CatalogView::UP);
    content_layout_.addSpacing(50);

    // Buttons.
    content_layout_.addLayout(&buttons_layout_);
    buttons_layout_.setContentsMargins(MARGINS, 0, MARGINS, 0);
    prev_button_.setFocusPolicy(Qt::NoFocus);
    next_button_.setFocusPolicy(Qt::NoFocus);
    buttons_layout_.addWidget(&prev_button_);
    buttons_layout_.addStretch(0);
    buttons_layout_.addWidget(&next_button_);
    showPaginationButtons(true, true);

    // Hardware address.
    hardware_address_.setFixedHeight(WIDGET_HEIGHT);
    hardware_address_.setContentsMargins(MARGINS, 0, MARGINS, 0);
    content_layout_.addWidget(&hardware_address_);
}