bool UIListBtnType::incSearchStart(void) { MythPopupBox *popup = new MythPopupBox(GetMythMainWindow(), "incserach_popup"); QLabel *caption = popup->addLabel(tr("Search"), MythPopupBox::Large); caption->setAlignment(Qt::AlignCenter); MythComboBox *modeCombo = new MythComboBox(false, popup, "mode_combo" ); modeCombo->insertItem(tr("Starts with text")); modeCombo->insertItem(tr("Contains text")); popup->addWidget(modeCombo); MythLineEdit *searchEdit = new MythLineEdit(false, popup, "mode_combo"); searchEdit->setText(m_incSearch); popup->addWidget(searchEdit); searchEdit->setFocus(); popup->addButton(tr("Search")); popup->addButton(tr("Cancel"), popup, SLOT(reject())); DialogCode res = popup->ExecPopup(); if (kDialogCodeButton0 == res) { m_incSearch = searchEdit->text(); m_bIncSearchContains = (modeCombo->currentIndex() == 1); incSearchNext(); } popup->hide(); popup->deleteLater(); return (kDialogCodeButton0 == res); }
SGPopupResult StorageGroupPopup::showPopup(MythMainWindow *parent, QString title, QString message, QString& text) { MythPopupBox *popup = new MythPopupBox(parent, title.toLatin1().constData()); popup->addLabel(message); MythLineEdit *textEdit = new MythLineEdit(popup, "chooseEdit"); textEdit->setText(text); popup->addWidget(textEdit); popup->addButton(QCoreApplication::translate("(Common)", "OK"), popup, SLOT(accept())); popup->addButton(QCoreApplication::translate("(Common)", "Cancel"), popup, SLOT(reject())); textEdit->setFocus(); bool ok = (MythDialog::Accepted == popup->ExecPopup()); if (ok) { text = textEdit->text(); text.detach(); } popup->hide(); popup->deleteLater(); return (ok) ? SGPopup_OK : SGPopup_CANCEL; }
bool DeviceTree::RunTypeDialog(DiSEqCDevDevice::dvbdev_t &type) { MythPopupBox *popup = new MythPopupBox(GetMythMainWindow(), ""); popup->addLabel(tr("Select Type of Device")); MythListBox *list = new MythListBox(popup); list->insertItem(tr("Switch")); list->insertItem(tr("Rotor")); list->insertItem(tr("Unicable")); list->insertItem(tr("LNB")); list->setCurrentRow(0, QItemSelectionModel::Select); popup->addWidget(list); connect(list, SIGNAL(accepted(int)), popup, SLOT( AcceptItem(int))); list->setFocus(); DialogCode res = popup->ExecPopup(); type = (DiSEqCDevDevice::dvbdev_t)(list->currentRow()); popup->hide(); popup->deleteLater(); return kDialogCodeRejected != res; }
void EditMetadataDialog::showMenu() { if (coverart_grid->getItemCount() == 0) return; MythPopupBox *menu = new MythPopupBox(GetMythMainWindow(), "menu"); QLabel *caption = menu->addLabel(tr("Change Image Type"), MythPopupBox::Medium); caption->setAlignment(Qt::AlignCenter); menu->addButton(albumArt->getTypeName(IT_UNKNOWN)); menu->addButton(albumArt->getTypeName(IT_FRONTCOVER)); menu->addButton(albumArt->getTypeName(IT_BACKCOVER)); menu->addButton(albumArt->getTypeName(IT_CD)); menu->addButton(albumArt->getTypeName(IT_INLAY)); DialogCode ret = menu->ExecPopup(); int res = MythDialog::CalcItemIndex(ret); if ((IT_UNKNOWN <= res) && (res < IT_LAST)) { // get selected image in grid ImageGridItem *item = coverart_grid->getCurrentItem(); if (item) { item->text = albumArt->getTypeName((ImageType) res); AlbumArtImage *image = (AlbumArtImage*) item->data; if (image) { image->imageType = (ImageType) res; // save the image type to the DB albumArt->saveImageType(image->id, image->imageType); gridItemChanged(item); } } } menu->deleteLater(); }