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); }
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); }
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); }