void OnyxSearchDialog::createSubMenu()
{
    const int height = defaultItemHeight();
    sub_menu_.setPreferItemSize(QSize(height, height));

    ODataPtr dd( new OData);
    dd->insert(TAG_TITLE, tr("Search"));
    dd->insert(TAG_MENU_TYPE, OnyxKeyboard::KEYBOARD_MENU_OK);
    sub_menu_datas_.push_back(dd);

    ODataPtr d( new OData);
    d->insert(TAG_TITLE, tr("Clear"));
    d->insert(TAG_MENU_TYPE, OnyxKeyboard::KEYBOARD_MENU_CLEAR);
    sub_menu_datas_.push_back(d);

    sub_menu_.setSpacing(2);
    sub_menu_.setFixedGrid(1, 2);
    sub_menu_.setMargin(OnyxKeyboard::CATALOG_MARGIN);
    sub_menu_.setFixedHeight(defaultItemHeight()+2*SPACING);
    sub_menu_.setFixedWidth(defaultItemHeight()*6);
    sub_menu_.setData(sub_menu_datas_);
    sub_menu_.setNeighbor(&line_edit_, CatalogView::RECYCLE_LEFT);
    sub_menu_.setNeighbor(keyboard_.top(), CatalogView::DOWN);
    sub_menu_.setNeighbor(keyboard_.menu(), CatalogView::RECYCLE_DOWN);
}
void OnyxSearchDialog::adjustSizeAndPosition()
{
    // Change size at first.
    int x = 0, y = 0;
    QWidget *parent = safeParentWidget(parentWidget());
    QRect parent_rect = parent->rect();
    if (mode() == MODE_FULL)
    {
        setFixedSize(parent_rect.width(), minimumHeight());
    }
    else if (mode() == MODE_NEXT_PREV)
    {
        setFixedSize(parent_rect.width(), defaultItemHeight() * 2 + 2 *SPACING);
    }
    else if (mode() == MODE_SEARCHING)
    {
        setFixedSize(parent_rect.width(), defaultItemHeight() * 2 + 2 *SPACING);
    }
    y = parent->height() - height();
    if (sys::isIRTouch())
    {
        y -= ui::statusBarHeight();
    }
    move(x, y);
}
Exemple #3
0
void OnyxDictFrame::createTtsButtonView()
{
    const int height = defaultItemHeight();
    tts_button_view_.setPreferItemSize(QSize(height, height));

    OData *dd = new OData;
    QPixmap tts_pixmap(":/images/tts_icon.png");
    dd->insert(TAG_COVER, tts_pixmap);
    dd->insert(TAG_MENU_TYPE, MENU_TTS);
    tts_button_datas_.push_back(dd);

    tts_button_view_.setFixedGrid(1, 1);
    tts_button_view_.setMargin(OnyxKeyboard::CATALOG_MARGIN);
    tts_button_view_.setFixedHeight(defaultItemHeight()+5*SPACING);
    tts_button_view_.setFixedWidth(defaultItemHeight()+7*SPACING);
    tts_button_view_.setData(tts_button_datas_);
    tts_button_view_.setNeighbor(&sub_menu_, CatalogView::UP);
    tts_button_view_.setNeighbor(keyboard_.top(), CatalogView::DOWN);
    tts_button_view_.setNeighbor(&dictionary_menu_, CatalogView::LEFT);
    tts_button_view_.setNeighbor(&dictionary_menu_, CatalogView::RECYCLE_LEFT);

    if((qgetenv("DISABLE_TTS").toInt() == 1))
    {
        tts_button_view_.hide();
    }

}
void OnyxSearchDialog::createNavigateMenu()
{
    const int height = defaultItemHeight();
    next_prev_.setPreferItemSize(QSize(height, height));

    ODataPtr dd( new OData);
    dd->insert(TAG_TITLE, tr("Previous"));
    dd->insert(TAG_MENU_TYPE, SEARCH_NAV_PREVIOUS);
    next_prev_datas_.push_back(dd);

    ODataPtr b( new OData);
    b->insert(TAG_TITLE, tr("Next"));
    b->insert(TAG_MENU_TYPE, SEARCH_NAV_NEXT);
    next_prev_datas_.push_back(b);

    next_prev_.setSpacing(2);
    next_prev_.setFixedGrid(1, 2);
    next_prev_.setMargin(OnyxKeyboard::CATALOG_MARGIN);
    next_prev_.setFixedHeight(defaultItemHeight()+2*SPACING);

    int half_width = safeParentWidget(parentWidget())->width()/2;
    int min = defaultItemHeight()*8;
    if (half_width < min)
    {
        next_prev_.setFixedWidth(min);
    }
    else
    {
        next_prev_.setFixedWidth(half_width);
    }

    next_prev_.setData(next_prev_datas_);
    next_prev_.setSearchPolicy(CatalogView::NeighborFirst
            | CatalogView::AutoHorRecycle);
}
Exemple #5
0
void PasswordDialog::createLayout()
{
    title_icon_label_.setPixmap(QPixmap(":/images/dictionary_search.png"));
    content_widget_.setFixedHeight(defaultItemHeight() + 4 * SPACING);

    // hbox to layout line edit and buttons.
    hbox_.setContentsMargins(SPACING, 0, SPACING, 0);
    hbox_.setSpacing(SPACING * 4);

    // Line edit.
    text_edit_.setFixedHeight(defaultItemHeight());
    hbox_.addWidget(&text_edit_, 400);
    hbox_.addWidget(&ok_button_, 100);
    hbox_.addWidget(&clear_button_, 100);

    // Buttons.
    ok_button_.useDefaultHeight();
    show_plain_text_.setFixedHeight(defaultItemHeight());
    show_plain_text_.selectOnClicked(false);
    clear_button_.useDefaultHeight();

    show_plain_text_.setFocusPolicy(Qt::NoFocus);
    ok_button_.setFocusPolicy(Qt::NoFocus);
    show_plain_text_.selectOnClicked(false);
    clear_button_.setFocusPolicy(Qt::NoFocus);

    vbox_.addWidget(&show_plain_text_);

    // keyboard.
    keyboard_.attachReceiver(this);
    vbox_.addWidget(&keyboard_);

    // Setup connections.
    connect(&show_plain_text_, SIGNAL(clicked()), this, SLOT(onShowPlainTextClicked()), Qt::QueuedConnection);
    connect(&ok_button_, SIGNAL(clicked()), this, SLOT(onOKClicked()));
    connect(&clear_button_, SIGNAL(clicked()), &text_edit_, SLOT(clear()));
    connect(&timer_, SIGNAL(timeout()), this, SLOT(onTimeout()));
    connect(&text_edit_, SIGNAL(textChanged(const QString&)), this, SLOT(onTextChanged(const QString&)));

    // Install event filter
    show_plain_text_.installEventFilter(this);
    ok_button_.installEventFilter(this);
    clear_button_.installEventFilter(this);
    text_edit_.installEventFilter(this);
    keyboard_.installEventFilter(this);

    onShowPlainTextClicked();
}
Exemple #6
0
void OnyxPlayerView::createSongListView(int view_width)
{
    const int height = defaultItemHeight()+4*SPACING;
    song_list_view_.setPreferItemSize(QSize(-1, height));

    QStandardItemModel * item_model = model_->standardItemModel();
    int rows = item_model->rowCount();
    song_list_data_.clear();
    for (int i=0; i<rows; i++)
    {
        QStandardItem *item = item_model->item(i);
        OData *dd = new OData;
        dd->insert(TAG_TITLE, item->text());
        dd->insert(TAG_FONT_SIZE, 22);
        int alignment = Qt::AlignLeft | Qt::AlignVCenter;
        dd->insert(TAG_ALIGN, alignment);
        dd->insert(TAG_ROW, i);
        song_list_data_.push_back(dd);
    }

    song_list_view_.setSpacing(2);

    int total_height = safeParentWidget(parentWidget())->height();
    setSongListViewFixedGrid(total_height);

    song_list_view_.setFixedWidth(view_width);
    song_list_view_.setData(song_list_data_);
    song_list_view_.setNeighbor(&menu_view_, CatalogView::DOWN);
    song_list_view_.setNeighbor(&menu_view_, CatalogView::RECYCLE_DOWN);
}
void OnyxSearchDialog::createLineEdit()
{
    line_edit_.setSubItemType(LineEditView::type());
    line_edit_.setPreferItemSize(QSize(rect().width(), defaultItemHeight()));

    ODataPtr dd( new OData);
    dd->insert(TAG_TITLE, "");
    line_edit_datas_.push_back(dd);

    line_edit_.setFixedGrid(1, 1);
    line_edit_.setFixedHeight(defaultItemHeight()+2*SPACING);
    line_edit_.setMargin(OnyxKeyboard::CATALOG_MARGIN);
    line_edit_.setData(line_edit_datas_);
    line_edit_.setNeighbor(keyboard_.top(), CatalogView::DOWN);
    line_edit_.setNeighbor(keyboard_.menu(), CatalogView::RECYCLE_DOWN);
    line_edit_.setNeighbor(&sub_menu_, CatalogView::RIGHT);
    line_edit_.setNeighbor(&sub_menu_, CatalogView::RECYCLE_RIGHT);
}
Exemple #8
0
void OnyxDictFrame::createSubMenu()
{
    const int height = defaultItemHeight();
    sub_menu_.setPreferItemSize(QSize(height, height));

    OData *dd = new OData;
    dd->insert(TAG_TITLE, tr("Clear"));
    dd->insert(TAG_MENU_TYPE, OnyxKeyboard::KEYBOARD_MENU_CLEAR);
    sub_menu_datas_.push_back(dd);

    sub_menu_.setFixedGrid(1, 1);
    sub_menu_.setMargin(OnyxKeyboard::CATALOG_MARGIN);
    sub_menu_.setFixedHeight(defaultItemHeight()+2*SPACING);
    sub_menu_.setFixedWidth(defaultItemHeight()*3);
    sub_menu_.setData(sub_menu_datas_);
    sub_menu_.setNeighbor(&line_edit_, CatalogView::RECYCLE_LEFT);
    sub_menu_.setNeighbor(&dictionary_menu_, CatalogView::DOWN);
    sub_menu_.setNeighbor(keyboard_.menu(), CatalogView::RECYCLE_DOWN);
}
Exemple #9
0
void OnyxDictFrame::createDictionaryMenu()
{
    const int height = defaultItemHeight();
    dictionary_menu_.setPreferItemSize(QSize(height, height));

    OData *dd = new OData;
    dd->insert(TAG_COVER, QPixmap(":/images/dictionary_list.png"));
    dd->insert(TAG_MENU_TYPE, MENU_DICTIONARIES);
    dd->insert(TAG_FONT_SIZE, DICT_MENU_FONT_SIZE);
    dictionary_menu_datas_.push_back(dd);

    dd = new OData;
    dd->insert(TAG_COVER, QPixmap(":/images/similar_words.png"));
    dd->insert(TAG_MENU_TYPE, MENU_SIMILAR_WORDS);
    dd->insert(TAG_FONT_SIZE, DICT_MENU_FONT_SIZE);
    dictionary_menu_datas_.push_back(dd);

    dd = new OData;
    dd->insert(TAG_COVER, QPixmap(":/images/explanation.png"));
    dd->insert(TAG_MENU_TYPE, MENU_EXPLANATION);
    dd->insert(TAG_FONT_SIZE, DICT_MENU_FONT_SIZE);
    dictionary_menu_datas_.push_back(dd);

    dd = new OData;
    dd->insert(TAG_COVER, QPixmap(":/images/lookup.png"));
    dd->insert(TAG_MENU_TYPE, MENU_LOOKUP);
    dd->insert(TAG_FONT_SIZE, DICT_MENU_FONT_SIZE);
    dictionary_menu_datas_.push_back(dd);

    dictionary_menu_.setFixedGrid(1, 4);
    dictionary_menu_.setMargin(OnyxKeyboard::CATALOG_MARGIN);
    dictionary_menu_.setFixedHeight(defaultItemHeight()+5*SPACING);
    dictionary_menu_.setData(dictionary_menu_datas_);
    dictionary_menu_.setNeighbor(&line_edit_, CatalogView::UP);
    dictionary_menu_.setNeighbor(&sub_menu_, CatalogView::UP);
    dictionary_menu_.setNeighbor(keyboard_.top(), CatalogView::DOWN);
    dictionary_menu_.setNeighbor(&tts_button_view_, CatalogView::RIGHT);
    dictionary_menu_.setNeighbor(&tts_button_view_, CatalogView::RECYCLE_RIGHT);
}
Exemple #10
0
LayoutUnit LayoutListBox::itemHeight() const {
  HTMLSelectElement* select = selectElement();
  if (!select)
    return LayoutUnit();

  const auto& items = select->listItems();
  if (items.isEmpty())
    return defaultItemHeight();

  LayoutUnit maxHeight;
  for (Element* element : items) {
    if (isHTMLOptGroupElement(element))
      element = &toHTMLOptGroupElement(element)->optGroupLabelElement();
    LayoutObject* layoutObject = element->layoutObject();
    LayoutUnit itemHeight;
    if (layoutObject && layoutObject->isBox())
      itemHeight = toLayoutBox(layoutObject)->size().height();
    else
      itemHeight = defaultItemHeight();
    maxHeight = std::max(maxHeight, itemHeight);
  }
  return maxHeight;
}
Exemple #11
0
void OnyxPlayerView::createLayout()
{
    vbox_.removeWidget(&title_widget_);
    content_widget_.setBackgroundRole(QPalette::Button);

    normal_mode_pixmap_ = QPixmap(":/player_icons/normal.png");
    single_repeat_mode_pixmap_ = QPixmap(":/player_icons/repeat.png");
    shuffle_mode_pixmap_ = QPixmap(":/player_icons/shuffle.png");
    play_pixmap_ = QPixmap(":/player_icons/play.png");
    pause_pixmap_ = QPixmap(":/player_icons/pause.png");

    title_title_label_.setPixmap(QPixmap(":/player_icons/title.png"));
    title_title_label_.setAlignment(Qt::AlignLeft|Qt::AlignVCenter);
    title_title_label_.setFixedHeight(defaultItemHeight());
    title_title_label_.setFixedWidth(AUDIO_INFO_SPACING);

    artist_title_label_.setPixmap(QPixmap(":/player_icons/artist.png"));
    artist_title_label_.setAlignment(Qt::AlignLeft|Qt::AlignVCenter);
    artist_title_label_.setFixedHeight(defaultItemHeight());
    artist_title_label_.setFixedWidth(AUDIO_INFO_SPACING);

    album_title_label_.setPixmap(QPixmap(":/player_icons/album.png"));
    album_title_label_.setAlignment(Qt::AlignLeft|Qt::AlignVCenter);
    album_title_label_.setFixedHeight(defaultItemHeight());
    album_title_label_.setFixedWidth(AUDIO_INFO_SPACING);

    current_time_label_.setText("00:00");
    current_time_label_.setAlignment(Qt::AlignLeft | Qt::AlignVCenter);
    current_time_label_.setFixedHeight(defaultItemHeight());

    total_time_label_.setText("00:00");
    total_time_label_.setAlignment(Qt::AlignRight | Qt::AlignVCenter);
    total_time_label_.setFixedHeight(defaultItemHeight());

    progress_bar_.setStyleSheet(PROGRESS_BAR_STYLE);
    progress_bar_.setTextVisible(false);

    createMenuView();

    big_layout_.setContentsMargins(2, 2, 0, 2);
    big_layout_.setSpacing(0);
    big_layout_.addWidget(&player_title_bar_, 0, Qt::AlignTop);
    big_layout_.addWidget(&song_list_view_, 1, Qt::AlignTop);

    // add title info
    title_layout_.addWidget(&title_title_label_);
    title_layout_.addWidget(&title_label_);
    big_layout_.addLayout(&title_layout_);

    // add artist info
    artist_layout_.addWidget(&artist_title_label_);
    artist_layout_.addWidget(&artist_label_);
    big_layout_.addLayout(&artist_layout_);

    // add album info
    album_layout_.addWidget(&album_title_label_);
    album_layout_.addWidget(&album_label_);
    big_layout_.addLayout(&album_layout_);

    time_layout_.addSpacing(SPACING*2);
    time_layout_.addWidget(&current_time_label_, 0, Qt::AlignLeft);
    time_layout_.addWidget(&total_time_label_, 0, Qt::AlignRight);
    time_layout_.addSpacing(SPACING*2);
    big_layout_.addLayout(&time_layout_);

    big_layout_.addWidget(&progress_bar_, 0, Qt::AlignBottom);

    big_layout_.addWidget(&menu_view_, 0, Qt::AlignBottom);
    big_layout_.addWidget(&status_bar_, 0, Qt::AlignBottom);
}