Ticket #4132: 4132-dbg-v7.patch
| File 4132-dbg-v7.patch, 216.2 KB (added by , 18 years ago) |
|---|
-
mythplugins/mythmusic/mythmusic/playbackbox.cpp
251 251 if (progress) 252 252 { 253 253 progress->Close(); 254 delete progress;254 progress->deleteLater(); 255 255 progress = NULL; 256 256 } 257 257 … … 645 645 return; 646 646 647 647 playlist_popup->hide(); 648 delete playlist_popup;648 playlist_popup->deleteLater(); 649 649 playlist_popup = NULL; 650 650 } 651 651 … … 680 680 SmartPlaylistDialog dialog(gContext->GetMainWindow(), "smartplaylistdialog"); 681 681 dialog.setSmartPlaylist(curSmartPlaylistCategory, curSmartPlaylistName); 682 682 683 intres = dialog.ExecPopup();683 DialogCode res = dialog.ExecPopup(); 684 684 685 if ( res > 0)685 if (kDialogCodeRejected != res) 686 686 { 687 687 dialog.getSmartPlaylist(curSmartPlaylistCategory, curSmartPlaylistName); 688 688 updatePlaylistFromSmartPlaylist(); … … 698 698 699 699 SearchDialog dialog(gContext->GetMainWindow(), "searchdialog"); 700 700 701 intres = dialog.ExecPopupAtXY(-1, 20);701 DialogCode res = dialog.ExecPopupAtXY(-1, 20); 702 702 703 if ( res != -1)703 if (kDialogCodeRejected != res) 704 704 { 705 705 QString whereClause; 706 706 dialog.getWhereClause(whereClause); … … 999 999 1000 1000 EditMetadataDialog editDialog(editMeta, gContext->GetMainWindow(), 1001 1001 "edit_metadata", "music-", "edit metadata"); 1002 if ( editDialog.exec())1002 if (kDialogCodeRejected != editDialog.exec()) 1003 1003 { 1004 1004 // update the metadata copy stored in all_music 1005 1005 if (all_music->updateMetadata(editMeta->ID(), editMeta)) … … 1020 1020 } 1021 1021 } 1022 1022 1023 MythBusyDialog busy(QObject::tr("Rebuilding music tree")); 1024 busy.start(); 1023 MythBusyDialog *busy = new MythBusyDialog( 1024 QObject::tr("Rebuilding music tree")); 1025 busy->start(); 1025 1026 1026 1027 // Get a reference to the current track 1027 1028 QValueList <int> branches_to_current_node; … … 1065 1066 1066 1067 music_tree_list->refresh(); 1067 1068 1068 busy.Close(); 1069 busy->Close(); 1070 busy->deleteLater(); 1069 1071 } 1070 1072 } 1071 1073 … … 1086 1088 if (progress) 1087 1089 { 1088 1090 progress->Close(); 1089 delete progress;1091 progress->deleteLater(); 1090 1092 progress = NULL; 1091 1093 progress_type = kProgressNone; 1092 1094 } … … 1147 1149 if (progress) 1148 1150 { 1149 1151 progress->Close(); 1150 delete progress;1152 progress->deleteLater(); 1151 1153 } 1152 1154 progress = NULL; 1153 1155 progress_type = kProgressNone; … … 2363 2365 dupsCheck->setBackgroundOrigin(ParentOrigin); 2364 2366 popup->addWidget(dupsCheck); 2365 2367 2366 intres = popup->ExecPopup();2368 DialogCode res = popup->ExecPopup(); 2367 2369 switch (res) 2368 2370 { 2369 case 0:2371 case kDialogCodeButton0: 2370 2372 insertOption = PL_REPLACE; 2371 2373 break; 2372 case 1:2374 case kDialogCodeButton1: 2373 2375 insertOption = PL_INSERTAFTERCURRENT; 2374 2376 break; 2375 case 2:2377 case kDialogCodeButton2: 2376 2378 insertOption = PL_INSERTATEND; 2377 2379 break; 2380 case kDialogCodeRejected: 2381 default: 2382 popup->deleteLater(); 2383 return false; 2378 2384 } 2379 2385 2380 2386 bRemoveDups = dupsCheck->isChecked(); … … 2402 2408 else 2403 2409 playOption = PL_CURRENT; 2404 2410 2405 delete popup;2411 popup->deleteLater(); 2406 2412 2407 return (res >= 0);2413 return true; 2408 2414 } 2409 2415 2410 2416 QString PlaybackBoxMusic::getTimeString(int exTime, int maxTime) -
mythplugins/mythmusic/mythmusic/search.cpp
46 46 addWidget(listbox); 47 47 48 48 // buttons 49 okButton = addButton(tr("OK"), this, SLOT( okPressed()));50 cancelButton = addButton(tr("Cancel"), this, SLOT( cancelPressed()));49 okButton = addButton(tr("OK"), this, SLOT(accept())); 50 cancelButton = addButton(tr("Cancel"), this, SLOT(reject())); 51 51 52 52 // Initially, fill list with all music 53 53 runQuery(""); … … 223 223 { 224 224 unsigned int id = ((SearchListBoxItem*)listbox->item(i))->getId(); 225 225 whereClause = QString("WHERE song_id='%1';").arg(id); 226 done(0);226 accept(); 227 227 } 228 228 229 229 … … 236 236 { 237 237 } 238 238 239 void SearchDialog::okPressed(void)240 {241 done(0);242 }243 244 void SearchDialog::cancelPressed(void)245 {246 done(-1);247 }248 249 239 void SearchListBoxItem::paint(QPainter *p) 250 240 { 251 241 int itemHeight = height(listBox()); -
mythplugins/mythmusic/mythmusic/globalsettings.cpp
673 673 { 674 674 VisualizationsEditor *dialog = new VisualizationsEditor(visModesEdit->getValue(), 675 675 gContext->GetMainWindow(), "viseditor"); 676 if ( dialog->exec() == 1)676 if (kDialogCodeAccepted == dialog->exec()) 677 677 visModesEdit->setValue(dialog->getSelectedModes()); 678 678 679 679 delete dialog; -
mythplugins/mythmusic/mythmusic/directoryfinder.cpp
171 171 || !m_cancelButton || !m_homeButton) 172 172 { 173 173 cout << "DirectoryFinder: Your theme is missing some UI elements! Bailing out." << endl; 174 QTimer::singleShot(100, this, SLOT( done(int)));174 QTimer::singleShot(100, this, SLOT(reject())); 175 175 } 176 176 177 177 // load pixmaps -
mythplugins/mythmusic/mythmusic/playlist.cpp
1790 1790 } 1791 1791 1792 1792 progress->Close(); 1793 delete progress;1793 progress->deleteLater(); 1794 1794 1795 1795 progress = new MythProgressDialog(QObject::tr("Burning CD"), 100); 1796 1796 progress->setProgress(2); … … 1868 1868 } 1869 1869 1870 1870 progress->Close(); 1871 delete progress;1871 progress->deleteLater(); 1872 1872 1873 1873 QFile::remove(tmprecordlist); 1874 1874 QFile::remove(tmprecordisofs); -
mythplugins/mythmusic/mythmusic/cdrip.cpp
720 720 } 721 721 else 722 722 { 723 DialogBox dialog(gContext->GetMainWindow(), 724 tr("Artist: %1\n" 725 "Album: %2\n" 726 "Track: %3\n\n" 727 "This track is already in the database. \n" 728 "Do you want to remove the existing track?") 729 .arg(m_artistName).arg(m_albumName).arg(title)); 730 dialog.AddButton("No"); 731 dialog.AddButton("No To All"); 732 dialog.AddButton("Yes"); 733 dialog.AddButton("Yes To All"); 734 int res = dialog.exec(); 723 DialogBox *dlg = new DialogBox( 724 gContext->GetMainWindow(), 725 tr("Artist: %1\n" 726 "Album: %2\n" 727 "Track: %3\n\n" 728 "This track is already in the database. \n" 729 "Do you want to remove the existing track?") 730 .arg(m_artistName).arg(m_albumName).arg(title)); 735 731 736 if (res == 1) 732 dlg->AddButton("No"); 733 dlg->AddButton("No To All"); 734 dlg->AddButton("Yes"); 735 dlg->AddButton("Yes To All"); 736 DialogCode res = dlg->exec(); 737 dlg->deleteLater(); 738 dlg = NULL; 739 740 if (kDialogCodeButton0 == res) 737 741 { 738 742 delete ripTrack; 739 743 delete metadata; 740 744 } 741 else if ( res == 2)745 else if (kDialogCodeButton1 == res) 742 746 { 743 747 noToAll = true; 744 748 delete ripTrack; 745 749 delete metadata; 746 750 } 747 else if ( res == 3)751 else if (kDialogCodeButton2 == res) 748 752 { 749 753 deleteTrack(m_artistName, m_albumName, title); 750 754 m_tracks->push_back(ripTrack); 751 755 } 752 else if ( res == 4)756 else if (kDialogCodeButton3 == res) 753 757 { 754 758 yesToAll = true; 755 759 deleteTrack(m_artistName, m_albumName, title); 756 760 m_tracks->push_back(ripTrack); 757 761 } 762 else // treat cancel as no 763 { 764 delete ripTrack; 765 delete metadata; 766 } 758 767 } 759 768 } 760 769 } … … 779 788 buildFocusList(); 780 789 updateTrackList(); 781 790 782 delete busy;791 busy->deleteLater(); 783 792 } 784 793 785 794 void Ripper::scanCD(void) … … 1167 1176 1168 1177 RipStatus statusDialog(m_CDdevice, m_tracks, m_qualitySelector->getCurrentInt(), 1169 1178 gContext->GetMainWindow(), "edit metadata"); 1170 int res= statusDialog.exec();1171 if ( res == Accepted)1179 DialogCode rescode = statusDialog.exec(); 1180 if (kDialogCodeAccepted == rescode) 1172 1181 { 1173 1182 bool EjectCD = gContext->GetNumSetting("EjectCDAfterRipping", 1); 1174 1183 if (EjectCD) … … 1196 1205 } 1197 1206 1198 1207 delete ejector; 1199 delete busy;1208 busy->deleteLater(); 1200 1209 } 1201 1210 1202 1211 void Ripper::ejectCD() … … 1375 1384 searchDialog->setCaption(caption); 1376 1385 searchDialog->setSearchText(value); 1377 1386 searchDialog->setItems(m_searchList); 1378 if (searchDialog->ExecPopupAtXY(-1, 8) == 0) 1387 DialogCode rescode = searchDialog->ExecPopupAtXY(-1, 8); 1388 if (kDialogCodeRejected != rescode) 1379 1389 { 1380 1390 value = searchDialog->getResult(); 1381 1391 res = true; 1382 1392 } 1383 1393 1384 delete searchDialog; 1394 searchDialog->deleteLater(); 1395 searchDialog = NULL; 1385 1396 setActiveWindow(); 1386 1397 1387 1398 return res; … … 1395 1406 "edit_metadata", "music-", "edit metadata"); 1396 1407 editDialog.setSaveMetadataOnly(); 1397 1408 1398 if ( editDialog.exec())1409 if (kDialogCodeRejected != editDialog.exec()) 1399 1410 { 1400 1411 updateTrackList(); 1401 1412 } -
mythplugins/mythmusic/mythmusic/smartplaylist.cpp
624 624 625 625 SmartPLDateDialog *dateDialog = new SmartPLDateDialog(gContext->GetMainWindow(), ""); 626 626 dateDialog->setDate(combo->currentText()); 627 if ( dateDialog->ExecPopup() == 0)627 if (kDialogCodeAccepted == dateDialog->ExecPopup()) 628 628 { 629 629 combo->insertItem(dateDialog->getDate()); 630 630 combo->setCurrentText(dateDialog->getDate()); 631 631 res = true; 632 632 } 633 634 delete dateDialog; 633 634 dateDialog->hide(); 635 dateDialog->deleteLater(); 635 636 } 636 637 637 638 bool SmartPLCriteriaRow::showList(QString caption, QString &value) … … 642 643 searchDialog->setCaption(caption); 643 644 searchDialog->setSearchText(value); 644 645 searchDialog->setItems(searchList); 645 if ( searchDialog->ExecPopup() == 0)646 if (kDialogCodeAccepted == searchDialog->ExecPopup()) 646 647 { 647 648 value = searchDialog->getResult(); 648 649 res = true; 649 650 } 650 651 651 delete searchDialog;652 searchDialog->deleteLater(); 652 653 653 654 return res; 654 655 } … … 1089 1090 connect(titleEdit, SIGNAL(textChanged(void)), this, SLOT(titleChanged(void))); 1090 1091 connect(categoryButton, SIGNAL(clicked()), this, SLOT(categoryClicked())); 1091 1092 connect(saveButton, SIGNAL(clicked()), this, SLOT(saveClicked())); 1092 connect(cancelButton, SIGNAL(clicked()), this, SLOT( cancelClicked()));1093 connect(cancelButton, SIGNAL(clicked()), this, SLOT(reject())); 1093 1094 connect(showResultsButton, SIGNAL(clicked()), this, SLOT(showResultsClicked())); 1094 1095 connect(orderByButton, SIGNAL(clicked()), this, SLOT(orderByClicked())); 1095 1096 … … 1211 1212 row->saveToDatabase(ID); 1212 1213 } 1213 1214 1214 done(0);1215 reject(); 1215 1216 } 1216 1217 1217 1218 void SmartPlaylistEditor::newSmartPlaylist(QString category) … … 1308 1309 } 1309 1310 } 1310 1311 1311 void SmartPlaylistEditor::cancelClicked(void)1312 {1313 done(-1);1314 }1315 1316 1312 void SmartPlaylistEditor::categoryClicked(void) 1317 1313 { 1318 1314 showCategoryPopup(); … … 1370 1366 return; 1371 1367 1372 1368 category_popup->hide(); 1373 delete category_popup;1369 category_popup->deleteLater(); 1374 1370 category_popup = NULL; 1375 1371 categoryButton->setFocus(); 1376 1372 } … … 1515 1511 1516 1512 orderByDialog->setFieldList(orderByCombo->currentText()); 1517 1513 1518 if ( orderByDialog->ExecPopup() == 0)1514 if (kDialogCodeAccepted == orderByDialog->ExecPopup()) 1519 1515 orderByCombo->setCurrentText(orderByDialog->getFieldList()); 1520 1516 1521 1517 delete orderByDialog; … … 1875 1871 if (action == "ESCAPE") 1876 1872 { 1877 1873 handled = true; 1878 done(-1);1874 reject(); 1879 1875 } 1880 1876 else if (action == "LEFT") 1881 1877 { … … 2177 2173 connect(moveDownButton, SIGNAL(clicked()), this, SLOT(moveDownPressed())); 2178 2174 connect(ascendingButton, SIGNAL(clicked()), this, SLOT(ascendingPressed())); 2179 2175 connect(descendingButton, SIGNAL(clicked()), this, SLOT(descendingPressed())); 2180 connect(okButton, SIGNAL(clicked()), this, SLOT( okPressed()));2176 connect(okButton, SIGNAL(clicked()), this, SLOT(accept())); 2181 2177 2182 2178 connect(listbox, SIGNAL(selectionChanged(QListBoxItem*)), this, 2183 2179 SLOT(listBoxSelectionChanged(QListBoxItem*))); … … 2244 2240 if (action == "ESCAPE") 2245 2241 { 2246 2242 handled = true; 2247 done(-1);2243 reject(); 2248 2244 } 2249 2245 else if (action == "LEFT") 2250 2246 { … … 2299 2295 else if (action == "7") 2300 2296 { 2301 2297 handled = true; 2302 okPressed();2298 accept(); 2303 2299 } 2304 2300 } 2305 2301 } … … 2368 2364 listbox->setSelected(listbox->selectedItem()->next(), true); 2369 2365 } 2370 2366 2371 void SmartPLOrderByDialog::okPressed(void)2372 {2373 done(0);2374 }2375 2376 2367 void SmartPLOrderByDialog::orderByChanged(void) 2377 2368 { 2378 2369 bool found = false; … … 2552 2543 2553 2544 addLayout(vbox, 0); 2554 2545 2555 connect(okButton, SIGNAL(clicked()), this, SLOT( okPressed()));2556 connect(cancelButton, SIGNAL(clicked()), this, SLOT( cancelPressed()));2546 connect(okButton, SIGNAL(clicked()), this, SLOT(accept())); 2547 connect(cancelButton, SIGNAL(clicked()), this, SLOT(reject())); 2557 2548 2558 2549 connect(fixedRadio, SIGNAL(toggled(bool)), this, SLOT(fixedCheckToggled(bool))); 2559 2550 connect(nowRadio, SIGNAL(toggled(bool)), this, SLOT(nowCheckToggled(bool))); … … 2662 2653 if (action == "ESCAPE") 2663 2654 { 2664 2655 handled = true; 2665 done(-1);2656 reject(); 2666 2657 } 2667 2658 else if (action == "LEFT") 2668 2659 { … … 2690 2681 MythPopupBox::keyPressEvent(e); 2691 2682 } 2692 2683 2693 void SmartPLDateDialog::okPressed(void)2694 {2695 done(0);2696 }2697 2698 void SmartPLDateDialog::cancelPressed(void)2699 {2700 done(-1);2701 }2702 2703 2684 void SmartPLDateDialog::fixedCheckToggled(bool on) 2704 2685 { 2705 2686 daySpinEdit->setEnabled(on); -
mythplugins/mythmusic/mythmusic/editmetadata.cpp
521 521 searchDialog->setCaption(caption); 522 522 searchDialog->setSearchText(value); 523 523 searchDialog->setItems(searchList); 524 if (searchDialog->ExecPopupAtXY(-1, 8) == 0) 524 DialogCode rescode = searchDialog->ExecPopupAtXY(-1, 8); 525 if (kDialogCodeRejected != rescode) 525 526 { 526 527 value = searchDialog->getResult(); 527 528 res = true; 528 529 } 529 530 530 delete searchDialog;531 searchDialog->deleteLater(); 531 532 setActiveWindow(); 532 533 533 534 return res; … … 600 601 void EditMetadataDialog::closeDialog() 601 602 { 602 603 cancelPopup(); 603 done(1);604 accept(); 604 605 } 605 606 606 607 void EditMetadataDialog::showSaveMenu() … … 646 647 647 648 popup->hide(); 648 649 649 delete popup;650 popup->deleteLater(); 650 651 popup = NULL; 651 652 setActiveWindow(); 652 653 } … … 656 657 cancelPopup(); 657 658 658 659 *m_sourceMetadata = m_metadata; 659 done(1);660 accept(); 660 661 } 661 662 662 663 void EditMetadataDialog::saveToDatabase() … … 665 666 666 667 m_metadata->dumpToDatabase(); 667 668 *m_sourceMetadata = m_metadata; 668 done(1);669 accept(); 669 670 } 670 671 671 672 void EditMetadataDialog::saveToFile() … … 687 688 decoder->commitMetadata(m_metadata); 688 689 delete decoder; 689 690 } 690 done(1);691 accept(); 691 692 } 692 693 693 694 void EditMetadataDialog::saveAll() … … 729 730 menu->addButton(albumArt->getTypeName(IT_CD)); 730 731 menu->addButton(albumArt->getTypeName(IT_INLAY)); 731 732 732 int res = menu->ExecPopup(); 733 DialogCode ret = menu->ExecPopup(); 734 int res = MythDialog::CalcItemIndex(ret); 733 735 734 if ( res != -1)736 if ((IT_UNKNOWN <= res) && (res < IT_LAST)) 735 737 { 736 738 // get selected image in grid 737 739 ImageGridItem *item = coverart_grid->getCurrentItem(); … … 752 754 } 753 755 } 754 756 755 delete menu;757 menu->deleteLater(); 756 758 } 757 759 758 760 void EditMetadataDialog::setSaveMetadataOnly() -
mythplugins/mythmusic/mythmusic/databasebox.cpp
56 56 tree = getUIListTreeType("musictree"); 57 57 if (!tree) 58 58 { 59 DialogBox diag(gContext->GetMainWindow(), tr("The theme you are using " 60 "does not contain a 'musictree' element. " 61 "Please contact the theme creator and ask if they could " 62 "please update it.<br><br>The next screen will be empty." 63 " Escape out of it to return to the menu.")); 64 diag.AddButton(tr("OK")); 65 diag.exec(); 59 DialogBox *dlg = new DialogBox( 60 gContext->GetMainWindow(), 61 tr("The theme you are using " 62 "does not contain a 'musictree' element. " 63 "Please contact the theme creator and ask if they could " 64 "please update it.<br><br>The next screen will be empty." 65 " Escape out of it to return to the menu.")); 66 dlg->AddButton(tr("OK")); 67 dlg->exec(); 68 dlg->deleteLater(); 66 69 67 70 return; 68 71 } … … 78 81 79 82 if (m_lines.count() < 3) 80 83 { 81 DialogBox diag(gContext->GetMainWindow(), tr("The theme you are using " 82 "does not contain any info lines in the music element. " 83 "Please contact the theme creator and ask if they could " 84 "please update it.")); 85 diag.AddButton(tr("OK")); 86 diag.exec(); 84 DialogBox *dlg = new DialogBox( 85 gContext->GetMainWindow(), 86 tr("The theme you are using " 87 "does not contain any info lines in the music element. " 88 "Please contact the theme creator and ask if they could " 89 "please update it.")); 90 dlg->AddButton(tr("OK")); 91 dlg->exec(); 92 dlg->deleteLater(); 87 93 } 88 94 89 95 connect(tree, SIGNAL(itemEntered(UIListTreeType *, UIListGenericTree *)), … … 387 393 return; 388 394 389 395 error_popup->hide(); 390 delete error_popup;396 error_popup->deleteLater(); 391 397 error_popup = NULL; 392 398 } 393 399 … … 430 436 system(command); 431 437 432 438 record_progress->Close(); 433 delete record_progress;439 record_progress->deleteLater(); 434 440 } 435 441 436 442 void DatabaseBox::deletePlaylist() … … 820 826 return; 821 827 822 828 playlist_popup->hide(); 823 delete playlist_popup;829 playlist_popup->deleteLater(); 824 830 playlist_popup = NULL; 825 831 } 826 832 … … 928 934 return; 929 935 930 936 active_popup->hide(); 931 delete active_popup;937 active_popup->deleteLater(); 932 938 active_popup = NULL; 933 939 } 934 940 -
mythplugins/mythmusic/mythmusic/smartplaylist.h
112 112 void updateMatches(void); 113 113 void categoryClicked(void); 114 114 void saveClicked(void); 115 void cancelClicked(void);116 115 void showResultsClicked(void); 117 116 118 117 // category popup … … 232 231 void descendingPressed(void); 233 232 void orderByChanged(void); 234 233 void listBoxSelectionChanged(QListBoxItem *item); 235 void okPressed(void);236 234 237 235 protected: 238 236 void keyPressEvent(QKeyEvent *e); … … 271 269 void addDaysCheckToggled(bool on); 272 270 void valueChanged(void); 273 271 274 void okPressed(void);275 void cancelPressed(void);276 277 272 protected: 278 273 void keyPressEvent(QKeyEvent *e); 279 274 -
mythplugins/mythmusic/mythmusic/importmusic.h
150 150 void copyPressed(void); 151 151 void prevPressed(void); 152 152 void nextPressed(void); 153 void exitPressed(void);154 153 void selectorChanged(int item); 155 154 156 155 private: -
mythplugins/mythmusic/mythmusic/main.cpp
206 206 207 207 void RebuildMusicTree(MusicData *mdata) 208 208 { 209 MythBusyDialog busy(QObject::tr("Rebuilding music tree")); 210 busy.start(); 209 MythBusyDialog *busy = new MythBusyDialog( 210 QObject::tr("Rebuilding music tree")); 211 212 busy->start(); 211 213 mdata->all_music->startLoading(); 212 214 while (!mdata->all_music->doneLoading()) 213 215 { … … 215 217 usleep(50000); 216 218 } 217 219 mdata->all_playlists->postLoad(); 218 busy.Close(); 220 busy->Close(); 221 busy->deleteLater(); 219 222 } 220 223 221 224 static void postMusic(MusicData *mdata); -
mythplugins/mythmusic/mythmusic/search.h
33 33 34 34 void searchTextChanged(const QString &searchText); 35 35 void itemSelected(int i); 36 void okPressed(void);37 void cancelPressed(void);38 36 39 37 private: 40 38 -
mythplugins/mythmusic/mythmusic/importmusic.cpp
359 359 { 360 360 DirectoryFinder finder(m_location_edit->getText(), 361 361 gContext->GetMainWindow(), "directory finder"); 362 boolres = finder.exec();362 DialogCode res = finder.exec(); 363 363 364 if ( res)364 if (kDialogCodeRejected != res) 365 365 { 366 366 m_location_edit->setText(finder.getSelected()); 367 367 editLostFocus(); … … 607 607 fillWidgets(); 608 608 609 609 busy->close(); 610 delete busy;610 busy->deleteLater(); 611 611 } 612 612 613 613 void ImportMusicDialog::doScan() … … 674 674 "edit_metadata", "music-", "edit metadata"); 675 675 editDialog.setSaveMetadataOnly(); 676 676 677 if ( editDialog.exec())677 if (kDialogCodeRejected != editDialog.exec()) 678 678 { 679 679 m_tracks->at(m_currentTrack)->metadataHasChanged = true; 680 680 m_tracks->at(m_currentTrack)->isNewTune = Ripper::isNewTune( … … 736 736 return; 737 737 738 738 m_popupMenu->hide(); 739 delete m_popupMenu;739 m_popupMenu->deleteLater(); 740 740 m_popupMenu = NULL; 741 741 } 742 742 … … 1010 1010 if (m_exit_button) 1011 1011 { 1012 1012 m_exit_button->setText(tr("Exit")); 1013 connect(m_exit_button, SIGNAL(pushed()), this, SLOT( exitPressed()));1013 connect(m_exit_button, SIGNAL(pushed()), this, SLOT(reject())); 1014 1014 } 1015 1015 1016 1016 m_prev_button = getUIPushButtonType("prev_button"); … … 1045 1045 updateStatus(); 1046 1046 } 1047 1047 1048 void ImportCoverArtDialog::exitPressed()1049 {1050 done(0);1051 }1052 1053 1048 void ImportCoverArtDialog::copyPressed() 1054 1049 { 1055 1050 if (m_filelist.size() > 0) -
mythplugins/mythmusic/mythmusic/filescanner.cpp
369 369 clean_progress->setProgress(++counter); 370 370 371 371 clean_progress->Close(); 372 delete clean_progress;372 clean_progress->deleteLater(); 373 373 } 374 374 375 375 /*! … … 506 506 busy->start(); 507 507 BuildFileList(m_startdir, music_files, 0); 508 508 busy->Close(); 509 delete busy;509 busy->deleteLater(); 510 510 511 511 ScanMusic(music_files); 512 512 ScanArtwork(music_files); … … 540 540 file_checking->setProgress(++counter); 541 541 } 542 542 file_checking->Close(); 543 delete file_checking;543 file_checking->deleteLater(); 544 544 545 545 // Cleanup orphaned entries from the database 546 546 cleanDB(); … … 602 602 } 603 603 604 604 file_checking->Close(); 605 delete file_checking;605 file_checking->deleteLater(); 606 606 } 607 607 608 608 /*! … … 659 659 } 660 660 661 661 file_checking->Close(); 662 delete file_checking;662 file_checking->deleteLater(); 663 663 } -
mythplugins/mytharchive/mytharchive/thumbfinder.cpp
899 899 return; 900 900 901 901 m_popupMenu->hide(); 902 delete m_popupMenu;902 m_popupMenu->deleteLater(); 903 903 m_popupMenu = NULL; 904 904 } 905 905 -
mythplugins/mytharchive/mytharchive/videoselector.cpp
55 55 56 56 if (action == "ESCAPE") 57 57 { 58 done(0);58 reject(); 59 59 } 60 60 else if (action == "DOWN") 61 61 { … … 165 165 return; 166 166 167 167 popupMenu->hide(); 168 delete popupMenu;168 popupMenu->deleteLater(); 169 169 popupMenu = NULL; 170 170 } 171 171 … … 603 603 password, 604 604 gContext->GetMainWindow()); 605 605 pwd->exec(); 606 delete pwd;606 pwd->deleteLater(); 607 607 if (ok) 608 608 { 609 609 // All is good -
mythplugins/mytharchive/mytharchive/logviewer.h
21 21 void setFilenames(const QString &progressLog, const QString &fullLog); 22 22 23 23 protected slots: 24 void exitClicked(void);25 24 void cancelClicked(void); 26 25 void updateClicked(void); 27 26 void updateTimerTimeout(void); -
mythplugins/mytharchive/mytharchive/archiveutil.cpp
260 260 DialogBox *dialog = new DialogBox(gContext->GetMainWindow(), msg); 261 261 dialog->AddButton(QObject::tr("OK")); 262 262 dialog->exec(); 263 d elete dialog;263 dialog->deleteLater(); 264 264 } 265 265 266 266 /* vim: set expandtab tabstop=4 shiftwidth=4: */ -
mythplugins/mytharchive/mytharchive/fileselector.cpp
206 206 || !m_cancelButton || !m_homeButton) 207 207 { 208 208 cout << "FileSelector: Your theme is missing some UI elements! Bailing out." << endl; 209 QTimer::singleShot(100, this, SLOT( done(int)));209 QTimer::singleShot(100, this, SLOT(reject())); 210 210 } 211 211 212 212 // load pixmaps -
mythplugins/mytharchive/mytharchive/main.cpp
103 103 void runCreateDVD(void) 104 104 { 105 105 #ifdef CREATE_DVD 106 int res;107 108 106 QString commandline; 109 107 QString tempDir = getTempDirectory(true); 110 108 … … 132 130 burnWiz = new MythburnWizard(gContext->GetMainWindow(), 133 131 "mythburn_wizard", "mythburn-"); 134 132 qApp->unlock(); 135 res = burnWiz->exec();133 DialogCode res = burnWiz->exec(); 136 134 qApp->lock(); 137 135 qApp->processEvents(); 138 136 delete burnWiz; 139 137 140 if ( res == 0)138 if (kDialogCodeRejected == res) 141 139 return; 142 140 143 141 // now show the log viewer … … 152 150 void runCreateArchive(void) 153 151 { 154 152 #ifdef CREATE_NATIVE 155 int res;156 157 153 QString commandline; 158 154 QString tempDir = getTempDirectory(true); 159 155 … … 181 177 nativeWiz = new ExportNativeWizard(gContext->GetMainWindow(), 182 178 "exportnative_wizard", "mythnative-"); 183 179 qApp->unlock(); 184 res = nativeWiz->exec();180 DialogCode res = nativeWiz->exec(); 185 181 qApp->lock(); 186 182 qApp->processEvents(); 187 183 delete nativeWiz; 188 184 189 if ( res == 0)185 if (kDialogCodeRejected == res) 190 186 return; 191 187 192 188 // now show the log viewer … … 231 227 ImportNativeWizard wiz("/", filter, gContext->GetMainWindow(), 232 228 "import_native_wizard", "mythnative-", "import native wizard"); 233 229 qApp->unlock(); 234 intres = wiz.exec();230 DialogCode res = wiz.exec(); 235 231 qApp->lock(); 236 232 237 if ( res == 0)233 if (kDialogCodeRejected == res) 238 234 return; 239 235 240 236 // now show the log viewer … … 311 307 return; 312 308 } 313 309 314 int res;315 316 310 // ask the user what type of disk to burn to 317 311 DialogBox *dialog = new DialogBox(gContext->GetMainWindow(), 318 312 QObject::tr("\nPlace a blank DVD in the drive and select an option below.")); … … 322 316 dialog->AddButton(QObject::tr("Burn DVD Rewritable (Force Erase)")); 323 317 dialog->AddButton(QObject::tr("Cancel")); 324 318 325 res = dialog->exec();326 d elete dialog;319 DialogCode res = dialog->exec(); 320 dialog->deleteLater(); 327 321 328 // cancel pressed ?329 if ( res == 4)322 // cancel pressed or escape hit? 323 if ((kDialogCodeButton3 == res) || (kDialogCodeRejected == res)) 330 324 return; 331 325 326 int fmt = MythDialog::CalcItemIndex(res); 327 if ((fmt < 0) || (fmt > 2)) 328 return; 329 332 330 QString tempDir = getTempDirectory(true); 333 331 334 332 if (tempDir == "") … … 346 344 if (QFile::exists(logDir + "/mythburncancel.lck")) 347 345 QFile::remove(logDir + "/mythburncancel.lck"); 348 346 349 QString sArchiveFormat = QString::number( res - 1);350 QString sEraseDVDRW = ( res == 3 ? "1" : "0");347 QString sArchiveFormat = QString::number(fmt); 348 QString sEraseDVDRW = (kDialogCodeButton2 == res) ? "1" : "0"; 351 349 QString sNativeFormat = (gContext->GetSetting("MythArchiveLastRunType").startsWith("Native") ? "1" : "0"); 352 350 353 351 commandline = "mytharchivehelper -b " + sArchiveFormat + " " + sEraseDVDRW + " " + sNativeFormat; -
mythplugins/mytharchive/mytharchive/editmetadata.h
32 32 void closeDialog(); 33 33 void showSaveMenu(); 34 34 void savePressed(); 35 void cancelPressed();36 35 void editLostFocus(); 37 36 38 37 private: -
mythplugins/mytharchive/mytharchive/importnativewizard.cpp
259 259 || !m_prevButton || !m_cancelButton || !m_homeButton) 260 260 { 261 261 cout << "ImportNativeWizard: Your theme is missing some UI elements! Bailing out." << endl; 262 QTimer::singleShot(100, this, SLOT( done(int)));262 QTimer::singleShot(100, this, SLOT(reject())); 263 263 } 264 264 265 265 // load pixmaps … … 718 718 searchDialog->setCaption(caption); 719 719 searchDialog->setSearchText(value); 720 720 searchDialog->setItems(m_searchList); 721 if (searchDialog->ExecPopupAtXY(-1, 8) == 0) 721 DialogCode rescode = searchDialog->ExecPopupAtXY(-1, 8); 722 if (kDialogCodeRejected != rescode) 722 723 { 723 724 value = searchDialog->getResult(); 724 725 res = true; 725 726 } 726 727 727 delete searchDialog;728 searchDialog->deleteLater(); 728 729 setActiveWindow(); 729 730 730 731 return res; -
mythplugins/mytharchive/mytharchive/logviewer.cpp
100 100 101 101 hbox->addWidget(m_exitButton); 102 102 103 connect(m_exitButton, SIGNAL(clicked()), this, SLOT( exitClicked()));103 connect(m_exitButton, SIGNAL(clicked()), this, SLOT(reject())); 104 104 connect(m_cancelButton, SIGNAL(clicked()), this, SLOT(cancelClicked())); 105 105 connect(m_updateButton, SIGNAL(clicked()), this, SLOT(updateClicked())); 106 106 connect(m_autoupdateCheck, SIGNAL(toggled(bool)), this, SLOT(toggleAutoUpdate(bool))); … … 150 150 m_updateTimer->changeInterval(value * 1000); 151 151 } 152 152 153 void LogViewer::exitClicked(void)154 {155 done(-1);156 }157 158 153 void LogViewer::cancelClicked(void) 159 154 { 160 155 QString tempDir = gContext->GetSetting("MythArchiveTempDir", ""); … … 368 363 return; 369 364 370 365 m_popupMenu->hide(); 371 delete m_popupMenu;366 m_popupMenu->deleteLater(); 372 367 m_popupMenu = NULL; 373 368 } -
mythplugins/mytharchive/mytharchive/exportnativewizard.cpp
529 529 return; 530 530 531 531 popupMenu->hide(); 532 delete popupMenu;532 popupMenu->deleteLater(); 533 533 popupMenu = NULL; 534 534 } 535 535 … … 680 680 FileSelector selector(FSTYPE_FILE, "/", "*.*", gContext->GetMainWindow(), 681 681 "file_selector", "mytharchive-", "file selector"); 682 682 qApp->unlock(); 683 bool res = selector.exec();683 bool res = (kDialogCodeRejected != selector.exec()); 684 684 685 685 if (res) 686 686 { -
mythplugins/mytharchive/mytharchive/recordingselector.cpp
56 56 57 57 if (action == "ESCAPE") 58 58 { 59 done( 0);59 done(kDialogCodeRejected); 60 60 } 61 61 else if (action == "DOWN") 62 62 { … … 150 150 return; 151 151 152 152 popupMenu->hide(); 153 delete popupMenu;153 popupMenu->deleteLater(); 154 154 popupMenu = NULL; 155 155 } 156 156 -
mythplugins/mytharchive/mytharchive/editmetadata.cpp
146 146 if (cancel_button) 147 147 { 148 148 cancel_button->setText(tr("Cancel")); 149 connect(cancel_button, SIGNAL(pushed()), this, SLOT( cancelPressed()));149 connect(cancel_button, SIGNAL(pushed()), this, SLOT(reject())); 150 150 } 151 151 152 152 buildFocusList(); … … 182 182 { 183 183 *sourceMetadata = workMetadata; 184 184 sourceMetadata->editedDetails = true; 185 done( 1);185 done(kDialogCodeAccepted); 186 186 } 187 187 188 void EditMetadataDialog::cancelPressed()189 {190 done(Rejected);191 }192 193 188 EditMetadataDialog::~EditMetadataDialog() 194 189 { 195 190 } -
mythplugins/mytharchive/mytharchive/mythburnwizard.cpp
1353 1353 return; 1354 1354 1355 1355 popupMenu->hide(); 1356 delete popupMenu;1356 popupMenu->deleteLater(); 1357 1357 popupMenu = NULL; 1358 1358 } 1359 1359 … … 1403 1403 1404 1404 EditMetadataDialog editDialog(curItem, gContext->GetMainWindow(), 1405 1405 "edit_metadata", "mythburn-", "edit metadata"); 1406 if ( editDialog.exec())1406 if (kDialogCodeRejected != editDialog.exec()) 1407 1407 { 1408 1408 // update widgets to reflect any changes 1409 1409 titleChanged(item); … … 1477 1477 FileSelector selector(FSTYPE_FILE, "/", "*.*", gContext->GetMainWindow(), 1478 1478 "file_selector", "mytharchive-", "file selector"); 1479 1479 qApp->unlock(); 1480 bool res = selector.exec();1480 bool res = (kDialogCodeRejected != selector.exec()); 1481 1481 1482 1482 if (res) 1483 1483 { -
mythplugins/mythbrowser/mythbrowser/tabview.cpp
38 38 #include "mythtv/mythdbcon.h" 39 39 #include "mythtv/mythwidgets.h" 40 40 #include "mythtv/virtualkeyboard.h" 41 #include "mythtv/mythdialogs.h" 41 42 42 43 43 using namespace std; 44 44 45 45 TabView::TabView(MythMainWindow *parent, const char *name, QStringList urls, … … 173 173 if (menuIsOpen) 174 174 { 175 175 menu->hide(); 176 delete menu;176 menu->deleteLater(); 177 177 menu = NULL; 178 178 menuIsOpen = false; 179 179 hadFocus->setFocus(); … … 322 322 url->setText(((WebPage*)mytab->currentPage())->browser->baseURL().htmlURL()); 323 323 popup->addWidget(url); 324 324 325 popup->addButton(tr("OK") );326 popup->addButton(tr("Cancel") );325 popup->addButton(tr("OK"), popup, SLOT(accept())); 326 popup->addButton(tr("Cancel"), popup, SLOT(reject())); 327 327 328 328 qApp->removeEventFilter(this); 329 intres = popup->ExecPopup();329 DialogCode res = popup->ExecPopup(); 330 330 qApp->installEventFilter(this); 331 331 332 if ( res == 0)332 if (kDialogCodeAccepted == res) 333 333 { 334 334 QString sGroup = group->text(); 335 335 QString sDesc = desc->text(); … … 338 338 finishAddBookmark(sGroup, sDesc, sUrl); 339 339 } 340 340 341 delete popup;341 popup->deleteLater(); 342 342 343 343 hadFocus->setFocus(); 344 344 } … … 391 391 popup->addWidget(editor); 392 392 editor->setFocus(); 393 393 394 popup->addButton(tr("OK") );395 popup->addButton(tr("Cancel") );394 popup->addButton(tr("OK"), popup, SLOT(accept())); 395 popup->addButton(tr("Cancel"), popup, SLOT(reject())); 396 396 397 397 qApp->removeEventFilter(this); 398 intres = popup->ExecPopup();398 DialogCode res = popup->ExecPopup(); 399 399 qApp->installEventFilter(this); 400 400 401 if ( res == 0)401 if (kDialogCodeAccepted == res) 402 402 { 403 403 QString sURL = editor->text(); 404 404 if (!sURL.startsWith("http://") && !sURL.startsWith("https://") && … … 408 408 newPage(sURL); 409 409 } 410 410 411 delete popup;411 popup->deleteLater(); 412 412 413 413 hadFocus->setFocus(); 414 414 } -
mythplugins/mythweather/mythweather/sourceManager.h
28 28 bool findScripts(); 29 29 bool findScriptsDB(); 30 30 void setupSources(); 31 voidconnectScreen(uint id, WeatherScreen *screen);32 voiddisconnectScreen(WeatherScreen *screen);31 bool connectScreen(uint id, WeatherScreen *screen); 32 bool disconnectScreen(WeatherScreen *screen); 33 33 ScriptInfo *getSourceByName(const QString &name); 34 34 35 35 private slots: -
mythplugins/mythweather/mythweather/weatherSetup.cpp
518 518 } 519 519 } 520 520 521 inline QString format_msg( 522 const QStringList ¬Defined, uint rows, uint columns) 523 { 524 const QString etc = QObject::tr("etc..."); 525 uint elen = etc.length(); 526 QStringList lines; 527 lines += ""; 528 QStringList::iterator oit = lines.begin(); 529 QStringList::const_iterator iit = notDefined.begin(); 530 while (iit != notDefined.end()) 531 { 532 QStringList::const_iterator nit = iit; 533 nit++; 534 535 uint olen = (*oit).length(); 536 uint ilen = (*iit).length(); 537 538 if (lines.size() >= rows) 539 { 540 if (((olen + 2 + ilen + 2 + elen) < columns) || 541 (((olen + 2 + ilen) < columns) && (nit == notDefined.end()))) 542 { 543 *oit += ", " + *iit; 544 } 545 else 546 { 547 *oit += ", " + etc; 548 nit = notDefined.end(); 549 } 550 } 551 else 552 { 553 if ((olen + 2 + ilen) < columns) 554 { 555 *oit += ", " + *iit; 556 } 557 else 558 { 559 *oit += ","; 560 lines += ""; 561 oit++; 562 *oit += *iit; 563 } 564 } 565 566 iit = nit; 567 } 568 569 return lines.join("\n").mid(2); 570 } 571 521 572 void ScreenSetup::saveData() 522 573 { 523 574 // check if all active screens have sources/locations defined … … 547 598 548 599 if (notDefined.size()) 549 600 { 550 QString msg = tr("Cannot proceed, the following data items do not have sources defined:\n"); 551 msg += notDefined.join("\n"); 601 QString msg = tr("Can not proceed, the following data " 602 "items do not have sources defined:\n"); 603 msg += format_msg(notDefined, 1, 400); 552 604 MythPopupBox::showOkPopup(gContext->GetMainWindow(), 553 605 "Undefined Sources", msg); 554 606 return; … … 627 679 accept(); 628 680 } 629 681 630 void ScreenSetup::doListSelect(UIListBtnType *list, UIListBtnTypeItem *selected) 682 typedef QMap<DialogCode, QString> CommandMap; 683 684 static DialogCode add_button(QStringList &buttons, 685 CommandMap &commands, 686 const QString &button_text, 687 const QString &command) 631 688 { 689 int idx = buttons.size(); 690 buttons += button_text; 691 commands[(DialogCode)((int)kDialogCodeButton0 + idx)] = command; 692 693 return (DialogCode)((int)kDialogCodeButton0 + idx); 694 } 695 696 void ScreenSetup::doListSelect(UIListBtnType *list, 697 UIListBtnTypeItem *selected) 698 { 632 699 QString txt = selected->text(); 633 700 if (list == m_active_list) 634 701 { 635 702 ScreenListInfo *si = (ScreenListInfo *) selected->getData(); 636 703 QStringList buttons; 704 CommandMap commands; 705 637 706 if (!si->multiLoc) 638 buttons << tr("Change Location");707 add_button(buttons, commands, tr("Change Location"), "change_loc"); 639 708 640 709 if (si->hasUnits) 641 buttons << tr("Change Units");710 add_button(buttons, commands, tr("Change Units"), "change_units"); 642 711 643 buttons << tr("Move Up") << tr("Move Down") << tr("Remove") << 644 tr("Cancel"); 645 QString result = buttons[MythPopupBox::showButtonPopup( 646 gContext->GetMainWindow(), "Manipulate Screen", 647 tr("Action to take on screen ") + selected->text(), 648 buttons, buttons.count() - 1)]; 649 if (result == tr ("Change Location")) 712 add_button(buttons, commands, tr("Move Up"), "move_up"); 713 add_button(buttons, commands, tr("Move Down"), "move_down"); 714 add_button(buttons, commands, tr("Remove"), "remove"); 715 716 DialogCode cancelbtn = 717 add_button(buttons, commands, tr("Cancel"), "cancel"); 718 commands[kDialogCodeRejected] = "cancel"; 719 720 DialogCode res = MythPopupBox::ShowButtonPopup( 721 gContext->GetMainWindow(), "Manipulate Screen", 722 tr("Action to take on screen ") + selected->text(), 723 buttons, cancelbtn); 724 725 QString cmd = commands[res]; 726 if (cmd == "change_loc") 650 727 { 651 728 doLocationDialog(si, true); 652 729 } 653 else if ( result == tr("Change Units"))730 else if (cmd == "change_units") 654 731 { 655 732 showUnitsPopup(selected->text(), 656 733 (ScreenListInfo *) selected->getData()); 657 734 updateHelpText(); 658 735 } 659 else if ( result == tr("Move Up"))736 else if (cmd == "move_up") 660 737 { 661 738 list->MoveItemUpDown(selected, true); 662 739 } 663 else if ( result == tr("Move Down"))740 else if (cmd == "move_down") 664 741 { 665 742 list->MoveItemUpDown(selected, false); 666 743 } 667 else if ( result == tr("Remove"))744 else if (cmd == "remove") 668 745 { 669 746 deleteScreen(list); 670 747 } … … 798 875 units_t *units = &si->units; 799 876 QStringList unitsBtns; 800 877 unitsBtns << tr("English Units") << tr("SI Units"); 801 int ret = MythPopupBox::showButtonPopup( 802 gContext->GetMainWindow(), "Change Units", 803 tr("Select units for screen ") + name, unitsBtns, 804 *units == ENG_UNITS ? 0 : 1); 878 DialogCode ret = MythPopupBox::ShowButtonPopup( 879 gContext->GetMainWindow(), "Change Units", 880 tr("Select units for screen ") + name, unitsBtns, 881 *units == ENG_UNITS ? kDialogCodeButton0 : kDialogCodeButton1); 882 805 883 switch (ret) 806 884 { 807 case 0:885 case kDialogCodeButton0: 808 886 *units = ENG_UNITS; 809 887 break; 810 case 1:888 case kDialogCodeButton1: 811 889 *units = SI_UNITS; 812 890 break; 813 891 default: -
mythplugins/mythweather/mythweather/sourceManager.cpp
73 73 QDir dir(path); 74 74 dir.setFilter(QDir::Executable | QDir::Files); 75 75 // this kinda goes against idea of keeping ui separate, but oh well 76 MythProgressDialog bsydlg(tr("Searching for scripts"), dir.count()); 76 MythProgressDialog *busyd = new MythProgressDialog( 77 tr("Searching for scripts"), dir.count()); 77 78 int progress = 0; 78 79 79 80 if (!dir.exists()) … … 100 101 VERBOSE(VB_GENERAL, "found script " + file->absFilePath()); 101 102 } 102 103 } 103 b sydlg.setProgress(++progress);104 busyd->setProgress(++progress); 104 105 } 105 106 // run through and see if any scripts have been deleted 106 107 MSqlQuery db(MSqlQuery::InitCon()); … … 129 130 VERBOSE(VB_IMPORTANT, db.lastError().text()); 130 131 } 131 132 } 132 bsydlg.Close(); 133 busyd->Close(); 134 busyd->deleteLater(); 133 135 134 136 return m_scripts.count() > 0; 135 137 } … … 296 298 return false; 297 299 } 298 300 299 voidSourceManager::connectScreen(uint id, WeatherScreen *screen)301 bool SourceManager::connectScreen(uint id, WeatherScreen *screen) 300 302 { 303 if (!screen) 304 { 305 VERBOSE(VB_IMPORTANT, LOC_ERR + 306 "Can not connect nonexistent screen "<<screen); 307 308 return false; 309 } 310 301 311 WeatherSource *ws = m_sourcemap[id]; 312 if (!ws) 313 { 314 VERBOSE(VB_IMPORTANT, LOC_ERR + 315 "Can not connect nonexistent source "<<id); 316 317 return false; 318 } 302 319 ws->connectScreen(screen); 320 return true; 303 321 } 304 322 305 voidSourceManager::disconnectScreen(WeatherScreen *screen)323 bool SourceManager::disconnectScreen(WeatherScreen *screen) 306 324 { 325 if (!screen) 326 { 327 VERBOSE(VB_IMPORTANT, LOC_ERR + 328 "Can not disconnect nonexistent screen "<<screen); 329 330 return false; 331 } 332 307 333 WeatherSource *ws = m_sourcemap[screen->getId()]; 334 if (!ws) 335 { 336 VERBOSE(VB_IMPORTANT, LOC_ERR + 337 "Can not disconnect nonexistent source "<<screen->getId()); 338 339 return false; 340 } 308 341 ws->disconnectScreen(screen); 342 return true; 309 343 } -
mythplugins/mythgallery/mythgallery/iconview.cpp
155 155 } 156 156 else 157 157 { 158 DialogBox dialog(gContext->GetMainWindow(),158 DialogBox *dlg = new DialogBox(gContext->GetMainWindow(), 159 159 tr("Failed to mount device: ") + 160 160 m_currDevice->getDevicePath() + "\n\n" + 161 161 tr("Showing the default MythGallery directory.")); 162 dialog.AddButton(tr("OK")); 163 dialog.exec(); 162 dlg->AddButton(tr("OK")); 163 dlg->exec(); 164 dlg->deleteLater(); 164 165 mon->Unlock(m_currDevice); 165 166 } 166 167 } … … 1329 1330 QFileInfo path; 1330 1331 QDir importdir; 1331 1332 1332 DialogBox importDiag(gContext->GetMainWindow(), tr("Import pictures?")); 1333 importDiag.AddButton(tr("No")); 1334 importDiag.AddButton(tr("Yes")); 1335 if (importDiag.exec() != 2) 1333 DialogBox *importDlg = new DialogBox( 1334 gContext->GetMainWindow(), tr("Import pictures?")); 1335 1336 importDlg->AddButton(tr("No")); 1337 importDlg->AddButton(tr("Yes")); 1338 DialogCode code = importDlg->exec(); 1339 importDlg->deleteLater(); 1340 if (kDialogCodeButton1 != code) 1336 1341 return; 1337 1342 1338 1343 // Makes import directory samba/windows friendly (no colon) … … 1371 1376 // (QT < 3.1) rely on automatic fail if dir not empty 1372 1377 if (importdir.rmdir(importdir.absPath())) 1373 1378 { 1374 DialogBox nopicsDiag(gContext->GetMainWindow(), 1375 tr("Nothing found to import")); 1376 nopicsDiag.AddButton(tr("OK")); 1377 nopicsDiag.exec(); 1379 DialogBox *nopicsDlg = new DialogBox( 1380 gContext->GetMainWindow(), tr("Nothing found to import")); 1381 1382 nopicsDlg->AddButton(tr("OK")); 1383 nopicsDlg->exec(); 1384 nopicsDlg->deleteLater(); 1385 1378 1386 return; 1379 1387 } 1380 1388 … … 1554 1562 msg = tr("Failed to rename directory"); 1555 1563 else 1556 1564 msg = tr("Failed to rename file"); 1557 DialogBox dialog(gContext->GetMainWindow(), msg);1558 dialog.AddButton(tr("OK"));1559 dialog.exec();1560 1565 1566 DialogBox *dlg = new DialogBox(gContext->GetMainWindow(), msg); 1567 dlg->AddButton(tr("OK")); 1568 dlg->exec(); 1569 dlg->deleteLater(); 1570 1561 1571 return; 1562 1572 } 1563 1573 … … 1639 1649 } 1640 1650 1641 1651 progress->Close(); 1642 delete progress;1652 progress->deleteLater(); 1643 1653 1644 1654 LoadDirectory(m_currDir, true); 1645 1655 } -
mythplugins/mythgallery/mythgallery/main.cpp
25 25 icv.exec(); 26 26 else 27 27 { 28 DialogBox diag(gContext->GetMainWindow(), icv.GetError()); 29 diag.AddButton(QObject::tr("Ok")); 30 diag.exec(); 28 DialogBox *dlg = new DialogBox( 29 gContext->GetMainWindow(), icv.GetError()); 30 31 dlg->AddButton(QObject::tr("Ok")); 32 dlg->exec(); 33 dlg->deleteLater(); 31 34 } 32 35 } 33 36 -
mythplugins/mythmovies/mythmovies/moviesui.cpp
346 346 updateDataTrees(); 347 347 drawDisplayTree(); 348 348 menuPopup->hide(); 349 delete menuPopup;349 menuPopup->deleteLater(); 350 350 menuPopup = NULL; 351 351 } 352 352 … … 355 355 if (!menuPopup) 356 356 return; 357 357 menuPopup->hide(); 358 delete menuPopup;358 menuPopup->deleteLater(); 359 359 menuPopup = NULL; 360 360 } 361 361 … … 383 383 return; 384 384 385 385 aboutPopup->hide(); 386 delete aboutPopup;386 aboutPopup->deleteLater(); 387 387 aboutPopup = NULL; 388 388 } 389 389 -
mythplugins/mythflix/mythflix/mythflix.cpp
643 643 popup->hide(); 644 644 expectingPopup = false; 645 645 646 delete popup;646 popup->deleteLater(); 647 647 popup = NULL; 648 648 649 649 setActiveWindow(); -
mythplugins/mythflix/mythflix/mythflixqueue.cpp
569 569 popup->hide(); 570 570 expectingPopup = false; 571 571 572 delete popup;572 popup->deleteLater(); 573 573 popup = NULL; 574 574 575 575 setActiveWindow(); -
mythplugins/mythcontrols/mythcontrols/keygrabber.h
46 46 /// modifier keys. (note: result not thread-safe) 47 47 QString GetCapturedKey(void) const { return m_capturedKey; } 48 48 49 public slots:50 void Accept(void) { done(1); }51 void Cancel(void) { done(0); }52 53 49 protected: 54 50 void keyPressEvent(QKeyEvent *e); 55 51 void keyReleaseEvent(QKeyEvent *e); … … 82 78 const QString &context); 83 79 84 80 /// \brief Execute the error popup 85 intGetOption(void) { return ExecPopup(this, SLOT(Finish())); }81 DialogCode GetOption(void) { return ExecPopup(this, SLOT(Finish())); } 86 82 87 83 protected slots: 88 void Finish(void) { done(0); }84 void Finish(void) { reject(); } 89 85 }; 90 86 91 87 … … 97 93 Q_OBJECT 98 94 99 95 public: 100 enum actions { kSave, kChangeView, kCancel, }; 96 static const DialogCode kSave = kDialogCodeButton0; 97 static const DialogCode kChangeView = kDialogCodeButton1; 98 static const DialogCode kCancel = kDialogCodeRejected; 101 99 102 100 /// \brief Create a new action window. Does not pop-up menu. 103 101 OptionsMenu(MythMainWindow *window); 104 102 105 103 /// \brief Execute the option popup. 106 intGetOption(void) { return ExecPopup(this,SLOT(Cancel())); }104 DialogCode GetOption(void) { return ExecPopup(this,SLOT(Cancel())); } 107 105 108 106 public slots: 109 void Save(void) { done( OptionsMenu::kSave); }110 void ChangeView(void) { done( OptionsMenu::kChangeView); }111 void Cancel(void) { done( OptionsMenu::kCancel); }107 void Save(void) { done(kSave); } 108 void ChangeView(void) { done(kChangeView); } 109 void Cancel(void) { done(kCancel); } 112 110 }; 113 111 114 112 … … 120 118 Q_OBJECT 121 119 122 120 public: 123 enum actions { kSet, kRemove, kCancel, }; 121 static const DialogCode kSet = kDialogCodeButton0; 122 static const DialogCode kRemove = kDialogCodeButton1; 123 static const DialogCode kCancel = kDialogCodeRejected; 124 124 125 125 /// \brief Create a new action window. Does not pop-up menu. 126 126 ActionMenu(MythMainWindow *window); 127 127 128 128 /// \brief Execute the option popup. 129 intGetOption(void) { return ExecPopup(this, SLOT(Cancel())); }129 DialogCode GetOption(void) { return ExecPopup(this, SLOT(Cancel())); } 130 130 131 131 public slots: 132 void Set(void) { done( ActionMenu::kSet); }133 void Remove(void) { done( ActionMenu::kRemove); }134 void Cancel(void) { done( ActionMenu::kCancel); }132 void Set(void) { done(kSet); } 133 void Remove(void) { done(kRemove); } 134 void Cancel(void) { done(kCancel); } 135 135 }; 136 136 137 137 … … 143 143 Q_OBJECT 144 144 145 145 public: 146 enum actions { kSave, kExit, }; 146 static const DialogCode kSave = kDialogCodeAccepted; 147 static const DialogCode kExit = kDialogCodeRejected; 147 148 148 149 /// \brief Create a new action window. Does not pop-up menu. 149 150 UnsavedMenu(MythMainWindow *window); 150 151 151 152 /// \brief Execute the option popup. 152 intGetOption(void) { return ExecPopup(this, SLOT(Cancel())); }153 DialogCode GetOption(void) { return ExecPopup(this, SLOT(Cancel())); } 153 154 154 155 public slots: 155 void Save(void) { done( UnsavedMenu::kSave); }156 void Cancel(void) { done( UnsavedMenu::kExit); }156 void Save(void) { done(kSave); } 157 void Cancel(void) { done(kExit); } 157 158 }; 158 159 159 160 /** \class ConfirmMenu … … 164 165 Q_OBJECT 165 166 166 167 public: 167 enum actions { kConfirm, kCancel, }; 168 static const DialogCode kConfirm = kDialogCodeAccepted; 169 static const DialogCode kCancel = kDialogCodeRejected; 168 170 169 171 /// \brief Create a new action window. Does not pop-up menu. 170 172 ConfirmMenu(MythMainWindow *window, const QString &msg); 171 173 172 174 /// \brief Execute the option popup. 173 intGetOption(void) { return ExecPopup(this,SLOT(Cancel())); }175 DialogCode GetOption(void) { return ExecPopup(this,SLOT(Cancel())); } 174 176 175 177 public slots: 176 void Confirm(void) { done( ConfirmMenu::kConfirm); }177 void Cancel(void) { done( ConfirmMenu::kCancel); }178 void Confirm(void) { done(kConfirm); } 179 void Cancel(void) { done(kCancel); } 178 180 }; 179 181 180 182 #endif // KEYGRABBER_H_ -
mythplugins/mythcontrols/mythcontrols/mythcontrols.cpp
233 233 QStringList contents; 234 234 QString leftcaption, rightcaption; 235 235 236 switch (popup.GetOption())236 switch (popup.GetOption()) 237 237 { 238 238 case ViewMenu::kContextAction: 239 239 leftcaption = tr(CAPTION_CONTEXT); … … 290 290 291 291 OptionsMenu popup(gContext->GetMainWindow()); 292 292 293 switch (popup.GetOption())293 switch (popup.GetOption()) 294 294 { 295 295 case OptionsMenu::kSave: 296 296 Save(); … … 321 321 if (!key.isEmpty()) 322 322 { 323 323 ActionMenu popup(gContext->GetMainWindow()); 324 intresult = popup.GetOption();324 DialogCode result = popup.GetOption(); 325 325 if (result == ActionMenu::kSet) 326 326 AddKeyToAction(); 327 327 else if (result == ActionMenu::kRemove) … … 698 698 "Do you want to bind it anyway?") 699 699 .arg(conflict->GetAction()).arg(conflict->GetContext()); 700 700 701 if (MythPopupBox::show2ButtonPopup( 702 gContext->GetMainWindow(), tr("Conflict Warning"), 703 msg, tr("Bind Key"), QObject::tr("Cancel"), 0)) 704 { 705 return false; 706 } 701 DialogCode res = MythPopupBox::Show2ButtonPopup( 702 gContext->GetMainWindow(), tr("Conflict Warning"), 703 msg, tr("Bind Key"), QObject::tr("Cancel"), kDialogCodeButton1); 707 704 708 return true;705 return (kDialogCodeButton0 == res); 709 706 } 710 707 711 708 /** \fn MythControls::AddKeyToAction(void) … … 720 717 { 721 718 /* grab a key from the user */ 722 719 KeyGrabPopupBox getkey(gContext->GetMainWindow()); 723 if ( 0== getkey.ExecPopup(&getkey, SLOT(Cancel())))720 if (kDialogCodeRejected == getkey.ExecPopup(&getkey, SLOT(Cancel()))) 724 721 return; // user hit Cancel button 725 722 726 723 QString key = getkey.GetCapturedKey(); -
mythplugins/mythcontrols/mythcontrols/mythcontrols.h
43 43 ViewMenu(MythMainWindow *window); 44 44 45 45 /// \brief Execute the option popup. 46 intGetOption(void) { return ExecPopup(this, SLOT(Cancel())); }46 DialogCode GetOption(void) { return ExecPopup(this, SLOT(Cancel())); } 47 47 48 48 /// \brief The available views 49 enum actions { kContextAction, kContextKey, kKeyContext, kCancel, }; 49 static const DialogCode kContextAction = kDialogCodeButton0; 50 static const DialogCode kContextKey = kDialogCodeButton1; 51 static const DialogCode kKeyContext = kDialogCodeButton2; 52 static const DialogCode kCancel = kDialogCodeRejected; 50 53 51 54 public slots: 52 void ActionsByContext(void) { done( ViewMenu::kContextAction); }53 void KeysByContext(void) { done( ViewMenu::kContextKey); }54 void ContextsByKey(void) { done( ViewMenu::kKeyContext); }55 void Cancel(void) { done( ViewMenu::kCancel); }55 void ActionsByContext(void) { done(kContextAction); } 56 void KeysByContext(void) { done(kContextKey); } 57 void ContextsByKey(void) { done(kKeyContext); } 58 void Cancel(void) { done(kCancel); } 56 59 }; 57 60 58 61 /** \class MythControls -
mythplugins/mythcontrols/mythcontrols/keygrabber.cpp
36 36 { 37 37 addLabel(tr("Press A Key"), Large, false); 38 38 m_label = addLabel(tr("Waiting for key press"), Small, false); 39 m_ok = addButton(QObject::tr("OK"), this, SLOT( Accept()));40 m_cancel = addButton(QObject::tr("Cancel"), this, SLOT( Cancel()));39 m_ok = addButton(QObject::tr("OK"), this, SLOT(accept())); 40 m_cancel = addButton(QObject::tr("Cancel"), this, SLOT(reject())); 41 41 42 42 grabKeyboard(); 43 43 } … … 127 127 addLabel(tr("Options"), Large, false); 128 128 addButton(QObject::tr("Save"), this, SLOT(Save())); 129 129 addButton(QObject::tr("Change View"), this, SLOT(ChangeView())); 130 addButton(QObject::tr("Cancel"), this, SLOT( Cancel()))->setFocus();130 addButton(QObject::tr("Cancel"), this, SLOT(reject()))->setFocus(); 131 131 } 132 132 133 133 ////////////////////////////////////////////////////////////////////// … … 138 138 addLabel(tr("Modify Action"), Large, false); 139 139 addButton(tr("Set Binding"), this, SLOT(Set())); 140 140 addButton(tr("Remove Binding"), this, SLOT(Remove())); 141 addButton(QObject::tr("Cancel"), this, SLOT( Cancel()))->setFocus();141 addButton(QObject::tr("Cancel"), this, SLOT(reject()))->setFocus(); 142 142 } 143 143 144 144 ////////////////////////////////////////////////////////////////////// … … 149 149 addLabel(tr("Unsaved Changes"), Large, false); 150 150 addLabel(tr("Exiting...") + "\n\n" + tr("Save Changes?")); 151 151 addButton(QObject::tr("Yes"), this, SLOT(Save()))->setFocus(); 152 addButton(QObject::tr("No"), this, SLOT( Cancel()));152 addButton(QObject::tr("No"), this, SLOT(reject())); 153 153 } 154 154 155 155 ////////////////////////////////////////////////////////////////////// … … 160 160 addLabel(tr("Confirm"), Large, false); 161 161 addLabel(msg); 162 162 addButton(tr("Confirm"), this, SLOT(Confirm()))->setFocus(); 163 addButton(QObject::tr("Cancel"), this, SLOT( Cancel()));163 addButton(QObject::tr("Cancel"), this, SLOT(reject())); 164 164 } -
mythplugins/mythvideo/mythvideo/main.cpp
249 249 no_player_dialog->AddButton(QObject::tr("OK, I'll go run Setup")); 250 250 no_player_dialog->exec(); 251 251 252 delete no_player_dialog;252 no_player_dialog->deleteLater(); 253 253 gContext->removeCurrentLocation(); 254 254 return; 255 255 } -
mythplugins/mythvideo/mythvideo/videotree.cpp
296 296 { 297 297 if (m_imp->m_use_arrow_accel) 298 298 { 299 done(1);299 accept(); 300 300 } 301 301 else 302 302 handled = false; … … 499 499 if (popup) 500 500 { 501 501 popup->hide(); 502 delete popup;502 popup->deleteLater(); 503 503 504 504 popup = NULL; 505 505 … … 522 522 MythPopupBox::Small,true); 523 523 plotLabel->setAlignment(Qt::AlignJustify | Qt::WordBreak); 524 524 525 QButton * okButton = plotbox->addButton(tr("Ok")); 525 QButton *okButton = plotbox->addButton( 526 tr("OK"), plotbox, SLOT(accept())); 526 527 okButton->setFocus(); 527 528 528 529 plotbox->ExecPopup(); 529 delete plotbox;530 plotbox->deleteLater(); 530 531 //allowPaint = true; 531 532 } 532 533 else -
mythplugins/mythvideo/mythvideo/videodlg.cpp
97 97 if (popup) 98 98 { 99 99 popup->hide(); 100 delete popup;100 popup->deleteLater(); 101 101 102 102 popup = NULL; 103 103 … … 159 159 MythPopupBox::Small,true); 160 160 plotLabel->setAlignment(Qt::AlignJustify | Qt::WordBreak); 161 161 162 QButton * okButton = plotbox->addButton(tr("Ok")); 162 QButton *okButton = plotbox->addButton( 163 tr("OK"), plotbox, SLOT(accept())); 163 164 okButton->setFocus(); 164 165 165 166 plotbox->ExecPopup(); 166 delete plotbox;167 plotbox->deleteLater(); 167 168 allowPaint = true; 168 169 } 169 170 else -
mythplugins/mythvideo/mythvideo/videomanager.cpp
1553 1553 if (curitem && m_state == SHOWING_MAINWINDOW) 1554 1554 { 1555 1555 bool okcancel; 1556 MythPopupBox * ConfirmationDialog =1556 MythPopupBox *confirmationDialog = 1557 1557 new MythPopupBox(gContext->GetMainWindow()); 1558 okcancel = ConfirmationDialog->showOkCancelPopup(1558 okcancel = confirmationDialog->showOkCancelPopup( 1559 1559 gContext->GetMainWindow(), "", tr("Delete this file?"), false); 1560 1560 1561 1561 if (okcancel) … … 1563 1563 if (m_video_list->Delete(curitem->ID())) 1564 1564 RefreshMovieList(false); 1565 1565 else 1566 ConfirmationDialog->showOkPopup(gContext->GetMainWindow(), "",1566 confirmationDialog->showOkPopup(gContext->GetMainWindow(), "", 1567 1567 tr("delete failed")); 1568 1568 } 1569 1569 1570 delete ConfirmationDialog;1570 confirmationDialog->deleteLater(); 1571 1571 } 1572 1572 } 1573 1573 … … 1586 1586 if (popup) 1587 1587 { 1588 1588 popup->hide(); 1589 delete popup;1589 popup->deleteLater(); 1590 1590 1591 1591 popup = NULL; 1592 1592 -
mythplugins/mythvideo/mythvideo/titledialog.cpp
440 440 os << job_string << "\n" ; 441 441 } 442 442 } 443 done(0);443 reject(); 444 444 } 445 445 446 446 void TitleDialog::takeFocusAwayFromEditor(bool up_or_down) … … 534 534 535 535 TitleDialog::~TitleDialog() 536 536 { 537 if (name_editor)537 if (name_editor) 538 538 { 539 delete name_editor; 539 name_editor->deleteLater(); 540 name_editor = NULL; 540 541 } 541 542 } 542 543 -
mythplugins/mythvideo/mythvideo/fileassoc.cpp
330 330 void FileAssocDialog::saveAndExit() 331 331 { 332 332 saveFileAssociations(); 333 done(0);333 reject(); 334 334 } 335 335 336 336 void FileAssocDialog::toggleDefault(bool yes_or_no) … … 410 410 void FileAssocDialog::removeExtensionPopup() 411 411 { 412 412 new_extension_popup->close(); 413 delete new_extension_editor;413 new_extension_editor->deleteLater(); 414 414 new_extension_editor = NULL; 415 delete new_extension_popup;415 new_extension_popup->deleteLater(); 416 416 new_extension_popup = NULL; 417 417 418 418 // … … 503 503 file_associations.clear(); 504 504 if (command_editor) 505 505 { 506 delete command_editor; 506 command_editor->deleteLater(); 507 command_editor = NULL; 507 508 } 508 509 } -
mythplugins/mythvideo/mythvideo/videoscan.cpp
73 73 74 74 void VideoScannerImp::doScan(const QStringList &dirs) 75 75 { 76 MythProgressDialog progressDlg(QObject::tr("Searching for video files"), 77 dirs.size()); 76 MythProgressDialog *progressDlg = 77 new MythProgressDialog(QObject::tr("Searching for video files"), 78 dirs.size()); 78 79 79 80 QStringList imageExtensions = QImage::inputFormatList(); 80 81 int counter = 0; … … 85 86 ++iter) 86 87 { 87 88 buildFileList(*iter, imageExtensions, fs_files); 88 progressDlg .setProgress(++counter);89 progressDlg->setProgress(++counter); 89 90 } 90 91 91 progressDlg .close();92 progressDlg->close(); 92 93 93 94 PurgeList db_remove; 94 95 verifyFiles(fs_files, db_remove); … … 110 111 buttonText += QObject::tr("Yes"); 111 112 buttonText += QObject::tr("Yes to all"); 112 113 113 int result = MythPopupBox::showButtonPopup(gContext->GetMainWindow(), 114 QObject::tr("File Missing"), 115 QString(QObject::tr("%1 appears to be missing.\nRemove it " 116 "from the database?")).arg(filename), 117 buttonText, 1); 114 DialogCode result = MythPopupBox::ShowButtonPopup( 115 gContext->GetMainWindow(), 116 QObject::tr("File Missing"), 117 QObject::tr("%1 appears to be missing.\n" 118 "Remove it from the database?").arg(filename), 119 buttonText, kDialogCodeButton0); 120 118 121 switch (result) 119 122 { 120 case 1: 123 case kDialogCodeRejected: 124 case kDialogCodeButton0: 125 default: 126 break; 127 case kDialogCodeButton1: 121 128 m_KeepAll = true; 122 129 break; 123 case 2:130 case kDialogCodeButton2: 124 131 m_dbmetadata->purgeByID(id); 125 132 break; 126 case 3:133 case kDialogCodeButton3: 127 134 m_RemoveAll = true; 128 135 m_dbmetadata->purgeByID(id); 129 136 break; … … 134 141 const PurgeList &remove) 135 142 { 136 143 int counter = 0; 137 MythProgressDialog progressDlg(QObject::tr("Updating video database"),138 add.size() + remove.size());144 MythProgressDialog *progressDlg = new MythProgressDialog( 145 QObject::tr("Updating video database"), add.size() + remove.size()); 139 146 140 147 for (FileCheckList::const_iterator p = add.begin(); p != add.end(); ++p) 141 148 { … … 152 159 newFile.dumpToDatabase(); 153 160 } 154 161 155 progressDlg .setProgress(++counter);162 progressDlg->setProgress(++counter); 156 163 } 157 164 158 165 for (PurgeList::const_iterator p = remove.begin(); p != remove.end(); ++p) 159 166 { 160 167 promptForRemoval(p->first, p->second); 161 168 162 progressDlg .setProgress(++counter);169 progressDlg->setProgress(++counter); 163 170 } 164 171 165 progressDlg.Close(); 172 progressDlg->Close(); 173 progressDlg->deleteLater(); 166 174 } 167 175 168 176 void VideoScannerImp::verifyFiles(FileCheckList &files, PurgeList &remove) … … 170 178 int counter = 0; 171 179 FileCheckList::iterator iter; 172 180 173 MythProgressDialog progressDlg(QObject::tr("Verifying video files"),174 m_dbmetadata->getList().size());181 MythProgressDialog *progressDlg = new MythProgressDialog( 182 QObject::tr("Verifying video files"), m_dbmetadata->getList().size()); 175 183 176 184 // For every file we know about, check to see if it still exists. 177 185 for (MetadataListManager::metadata_list::const_iterator p = … … 195 203 } 196 204 } 197 205 198 progressDlg .setProgress(++counter);206 progressDlg->setProgress(++counter); 199 207 } 200 208 201 progressDlg.Close(); 209 progressDlg->Close(); 210 progressDlg->deleteLater(); 202 211 } 203 212 204 213 namespace -
mythplugins/mythvideo/mythvideo/videofilter.cpp
671 671 void VideoFilterDialog::saveAndExit() 672 672 { 673 673 m_fsp->setSettings(m_settings); 674 done(0);674 reject(); 675 675 } 676 676 677 677 void VideoFilterDialog::setYear(int new_year) -
mythplugins/mythvideo/mythvideo/editmetadata.cpp
367 367 // All done 368 368 // 369 369 370 done(0);370 reject(); 371 371 } 372 372 373 373 void EditMetadataDialog::setTitle(QString new_title) … … 437 437 checkedSetText(coverart_text, new_coverart_file); 438 438 } 439 439 440 delete nca;440 nca->deleteLater(); 441 441 } 442 442 443 443 void EditMetadataDialog::wireUpTheme() … … 532 532 { 533 533 if (title_editor) 534 534 { 535 delete title_editor; 535 title_editor->deleteLater(); 536 title_editor = NULL; 536 537 } 538 537 539 if (player_editor) 538 540 { 539 delete player_editor; 541 player_editor->deleteLater(); 542 player_editor = NULL; 540 543 } 544 541 545 if (working_metadata) 542 546 { 543 547 delete working_metadata; 548 working_metadata = NULL; 544 549 } 545 550 } -
mythplugins/mythvideo/mythvideo/parentalcontrols.cpp
228 228 ++p) 229 229 { 230 230 if (password == *p) 231 done(1);231 accept(); 232 232 } 233 233 } 234 234 … … 363 363 new MythMultiPasswordDialog(QObject::tr("Parental Pin:"), 364 364 valid_passwords, 365 365 gContext->GetMainWindow()); 366 bool ok = pwd->exec();366 bool ok = (kDialogCodeRejected != pwd->exec()); 367 367 delete pwd; 368 368 369 369 if (ok) -
mythplugins/mythgame/mythgame/gamesettings.h
121 121 virtual MythDialog *dialogWidget(MythMainWindow *parent, 122 122 const char *widgetName=0); 123 123 124 virtual int exec();124 virtual DialogCode exec(void); 125 125 virtual void load(); 126 126 virtual void save() { }; 127 127 -
mythplugins/mythgame/mythgame/gamehandler.cpp
206 206 buttonText += QObject::tr("Yes to all"); 207 207 208 208 209 int result = MythPopupBox::showButtonPopup(gContext->GetMainWindow(), 210 QObject::tr("File Missing"), 211 QString(QObject::tr("%1 appears to be missing.\nRemove it" 212 " from the database?")).arg(filename), 213 buttonText, 0 ); 209 DialogCode result = MythPopupBox::ShowButtonPopup( 210 gContext->GetMainWindow(), 211 QObject::tr("File Missing"), 212 QString(QObject::tr("%1 appears to be missing.\nRemove it" 213 " from the database?")).arg(filename), 214 buttonText, kDialogCodeButton0); 215 214 216 switch (result) 215 217 { 216 case 1: 218 case kDialogCodeButton0: 219 case kDialogCodeRejected: 220 default: 221 break; 222 case kDialogCodeButton1: 217 223 m_KeepAll = true; 218 224 break; 219 case 2:225 case kDialogCodeButton2: 220 226 purgeGameDB(filename , RomPath); 221 227 break; 222 case 3:228 case kDialogCodeButton3: 223 229 m_RemoveAll = true; 224 230 purgeGameDB(filename , RomPath); 225 231 break; … … 354 360 int counter = 0; 355 361 MSqlQuery query(MSqlQuery::InitCon()); 356 362 357 MythProgressDialog progressDlg(QString("Updating %1(%2) Rom database") 363 MythProgressDialog *progressDlg = 364 new MythProgressDialog(QObject::tr("Updating %1(%2) ROM database") 358 365 .arg(handler->SystemName()) 359 366 .arg(handler->GameType()), 360 367 m_GameMap.size()); … … 428 435 promptForRemoval( iter.data().Rom() , iter.data().RomPath() ); 429 436 } 430 437 431 progressDlg .setProgress(++counter);438 progressDlg->setProgress(++counter); 432 439 } 433 440 434 progressDlg.Close(); 441 progressDlg->Close(); 442 progressDlg->deleteLater(); 435 443 } 436 444 437 445 void GameHandler::VerifyGameDB(GameHandler *handler) … … 442 450 MSqlQuery query(MSqlQuery::InitCon()); 443 451 query.exec("SELECT romname,rompath,gamename FROM gamemetadata WHERE system = '" + handler->SystemName() + "';"); 444 452 445 MythProgressDialog progressDlg(QObject::tr("Verifying " + handler->SystemName() + " files"), 446 query.numRowsAffected()); 453 MythProgressDialog *progressDlg = new MythProgressDialog( 454 QObject::tr("Verifying %1 files").arg(handler->SystemName()), 455 query.numRowsAffected()); 447 456 448 457 // For every file we know about, check to see if it still exists. 449 458 if (query.isActive() && query.size() > 0) … … 468 477 GameName,RomPath); 469 478 } 470 479 } 471 progressDlg .setProgress(++counter);480 progressDlg->setProgress(++counter); 472 481 } 473 482 } 474 progressDlg.Close(); 483 progressDlg->Close(); 484 progressDlg->deleteLater(); 475 485 } 476 486 477 487 // Recurse through the directory and gather a count on how many files there are to process. … … 529 539 buttonText += QObject::tr("No"); 530 540 buttonText += QObject::tr("Yes"); 531 541 532 int result = MythPopupBox::showButtonPopup(gContext->GetMainWindow(), 533 QObject::tr("Are you sure?"), 534 QString(QObject::tr("This will clear all Game Meta Data\n" 535 "from the database. Are you sure you\n" 536 "want to do this?" )), 537 buttonText, 0 ); 542 DialogCode result = MythPopupBox::ShowButtonPopup( 543 gContext->GetMainWindow(), 544 QObject::tr("Are you sure?"), 545 QString(QObject::tr("This will clear all Game Meta Data\n" 546 "from the database. Are you sure you\n" 547 "want to do this?" )), 548 buttonText, kDialogCodeButton0); 549 538 550 switch (result) 539 551 { 540 case 0: 552 case kDialogCodeRejected: 553 case kDialogCodeButton0: 554 default: 541 555 // Do Nothing 542 556 break; 543 case 1:557 case kDialogCodeButton1: 544 558 MSqlQuery query(MSqlQuery::InitCon()); 545 559 QString thequery = "DELETE FROM gamemetadata;"; 546 560 query.exec(thequery); … … 621 635 else 622 636 maxcount = 100; 623 637 624 MythProgressDialog pdial(QObject::tr("Scanning for " + handler->SystemName() + " game(s)..."), maxcount); 625 pdial.setProgress(0); 638 MythProgressDialog *pdial = new MythProgressDialog( 639 QObject::tr("Scanning for %1 game(s)...").arg(handler->SystemName()), 640 maxcount); 641 pdial->setProgress(0); 626 642 627 643 if (handler->GameType() == "PC") 628 644 { … … 633 649 handler->SystemCmdLine().left(handler->SystemCmdLine().findRev(QRegExp("/")))); 634 650 635 651 636 pdial .setProgress(maxcount);652 pdial->setProgress(maxcount); 637 653 cout << "PC Game " << handler->SystemName() << endl; 638 654 } 639 655 else 640 656 { 641 657 int filecount = 0; 642 buildFileList(handler->SystemRomPath(), handler,&pdial, &filecount);658 buildFileList(handler->SystemRomPath(), handler, pdial, &filecount); 643 659 } 644 660 645 661 VerifyGameDB(handler); … … 658 674 handler->setRebuild(false); 659 675 660 676 661 pdial.Close(); 677 pdial->Close(); 678 pdial->deleteLater(); 662 679 } 663 680 664 681 void GameHandler::processAllGames(void) -
mythplugins/mythgame/mythgame/rominfo.cpp
20 20 QString rom_ver = Version(); 21 21 22 22 GameEditDialog romeditdlg(Romname().latin1()); 23 int res = romeditdlg.exec();24 23 25 if (res) { 24 DialogCode res = romeditdlg.exec(); 25 26 if (kDialogCodeRejected == res) 27 return; 28 29 { 26 30 MSqlQuery query(MSqlQuery::InitCon()); 27 31 QString thequery = QString("SELECT gamename,genre,year,country,publisher,favorite FROM gamemetadata " 28 32 " WHERE gametype = '%1' AND romname = '%2'; ") -
mythplugins/mythgame/mythgame/gametree.cpp
360 360 GameHandler::Launchgame(item->getRomInfo(),NULL); 361 361 else if (item->getRomInfo()->RomCount() > 1) 362 362 { 363 QStringList players = QStringList::split(",", item->getRomInfo()->AllSystems()); 364 players += "Cancel"; 363 QString all_systems = item->getRomInfo()->AllSystems(); 364 QStringList players = QStringList::split(",", all_systems); 365 players += QObject::tr("Cancel"); 365 366 366 int val = MythPopupBox::showButtonPopup(gContext->GetMainWindow(), "", tr("Players Available. \n\n Please pick one."), players,0); 367 DialogCode val = MythPopupBox::ShowButtonPopup( 368 gContext->GetMainWindow(), 369 "", tr("Players Available. \n\n Please pick one."), 370 players, kDialogCodeButton0); 367 371 368 if (val != -1) { 369 QString systemname = getElement(players,val); 370 if ((systemname) && (systemname != "Cancel")) 372 int idx = MythDialog::CalcItemIndex(val); 373 if ((0 <= idx) && (idx < ((int)players.size() - 1))) 374 { 375 QString systemname = getElement(players, idx); 376 if (!systemname.isEmpty()) 371 377 GameHandler::Launchgame(item->getRomInfo(),systemname); 372 378 } 373 379 } … … 423 429 return; 424 430 425 431 info_popup->hide(); 426 delete info_popup;432 info_popup->deleteLater(); 427 433 info_popup = NULL; 428 434 } 429 435 … … 438 444 return; 439 445 440 446 info_popup->hide(); 441 delete info_popup;447 info_popup->deleteLater(); 442 448 info_popup = NULL; 443 449 } 444 450 -
mythplugins/mythgame/mythgame/gamesettings.cpp
251 251 addChild(listbox); 252 252 } 253 253 254 int MythGamePlayerEditor::exec() { 255 while (ConfigurationDialog::exec() == QDialog::Accepted) 254 DialogCode MythGamePlayerEditor::exec(void) 255 { 256 while (ConfigurationDialog::exec() == kDialogCodeAccepted) 256 257 edit(); 257 258 258 return QDialog::Rejected;259 return kDialogCodeRejected; 259 260 } 260 261 261 262 void MythGamePlayerEditor::load(void) … … 284 285 } 285 286 else 286 287 { 287 int val = MythPopupBox::show2ButtonPopup(gContext->GetMainWindow(),288 "",289 tr("Game Player Menu"),290 tr("Edit.."), tr("Delete.."),1);291 292 if ( val == 0)288 DialogCode val = MythPopupBox::Show2ButtonPopup( 289 gContext->GetMainWindow(), 290 "", tr("Game Player Menu"), 291 tr("Edit.."), tr("Delete.."), kDialogCodeButton1); 292 293 if (kDialogCodeButton0 == val) 293 294 edit(); 294 else if ( val == 1)295 else if (kDialogCodeButton1 == val) 295 296 del(); 296 297 } 297 298 } … … 309 310 310 311 void MythGamePlayerEditor::del(void) 311 312 { 312 int val = MythPopupBox::show2ButtonPopup(gContext->GetMainWindow(), "", 313 tr("Are you sure you want to delete " 314 "this item?"), 315 tr("Yes, delete It"), 316 tr("No, don't"), 2); 313 DialogCode val = MythPopupBox::Show2ButtonPopup( 314 gContext->GetMainWindow(), "", 315 tr("Are you sure you want to delete " 316 "this item?"), 317 tr("Yes, delete It"), 318 tr("No, don't"), kDialogCodeButton1); 317 319 318 if ( val == 0)320 if (kDialogCodeButton0 == val) 319 321 { 320 322 MSqlQuery query(MSqlQuery::InitCon()); 321 323 query.prepare("DELETE FROM gameplayers " -
mythplugins/mythphone/mythphone/phoneui.cpp
617 617 { 618 618 if ((!loopbackMode) && (rtpAudio == 0) && (rtpVideo == 0)) 619 619 { 620 int loop = MythPopupBox::show2ButtonPopup(gContext->GetMainWindow(), "AskLoopback", "Loopback Audio and video at ...", "Socket on this machine", "NAT Device", 1); 620 DialogCode loop = MythPopupBox::Show2ButtonPopup( 621 gContext->GetMainWindow(), 622 "AskLoopback", tr("Loopback Audio and video at ..."), 623 tr("Socket on this machine"), tr("NAT Device"), 624 kDialogCodeButton0); 621 625 QString loopIp; 622 626 switch (loop) 623 627 { 624 default:625 case -1:626 return;627 case0:628 loopIp = sipStack->getLocalIpAddress();629 break;630 case1:631 loopIp = sipStack->getNatIpAddress();632 break;628 default: 629 case kDialogCodeRejected: 630 return; 631 case kDialogCodeButton0: 632 loopIp = sipStack->getLocalIpAddress(); 633 break; 634 case kDialogCodeButton1: 635 loopIp = sipStack->getNatIpAddress(); 636 break; 633 637 } 634 638 phoneUIStatusBar->DisplayCallState(QString(tr("Audio and Video Looped to ") + loopIp)); 635 639 int lvPort = atoi((const char *)gContext->GetSetting("VideoLocalPort")); … … 1088 1092 menuPopup->addButton(tr("Delete all Voicemails"), this, SLOT(vmailEntryDeleteAll())); 1089 1093 break; 1090 1094 default: 1091 delete menuPopup;1095 menuPopup->deleteLater(); 1092 1096 menuPopup = NULL; 1093 1097 return; 1094 1098 break; … … 1149 1153 "\n\n" + QObject::tr("A directory entry already exists with this URL.")); 1150 1154 NoDeviceDialog->AddButton(QObject::tr("OK")); 1151 1155 NoDeviceDialog->exec(); 1152 delete NoDeviceDialog;1156 NoDeviceDialog->deleteLater(); 1153 1157 closeMenuPopup(); 1154 1158 } 1155 1159 else … … 1272 1276 return; 1273 1277 1274 1278 menuPopup->hide(); 1275 delete menuPopup;1279 menuPopup->deleteLater(); 1276 1280 menuPopup = NULL; 1277 1281 } 1278 1282 … … 1318 1322 return; 1319 1323 1320 1324 urlPopup->hide(); 1321 delete urlPopup;1325 urlPopup->deleteLater(); 1322 1326 urlPopup = NULL; 1323 1327 } 1324 1328 … … 1417 1421 return; 1418 1422 1419 1423 imPopup->hide(); 1420 delete imPopup;1424 imPopup->deleteLater(); 1421 1425 imPopup = NULL; 1422 1426 } 1423 1427 … … 1553 1557 return; 1554 1558 1555 1559 addEntryPopup->hide(); 1556 delete addEntryPopup;1560 addEntryPopup->deleteLater(); 1557 1561 addEntryPopup = NULL; 1558 1562 } 1559 1563 … … 1645 1649 return; 1646 1650 1647 1651 addDirectoryPopup->hide(); 1648 delete addDirectoryPopup;1652 addDirectoryPopup->deleteLater(); 1649 1653 addDirectoryPopup = NULL; 1650 1654 } 1651 1655 … … 1749 1753 return; 1750 1754 1751 1755 incallPopup->hide(); 1752 delete incallPopup;1756 incallPopup->deleteLater(); 1753 1757 incallPopup = NULL; 1754 1758 } 1755 1759 … … 1915 1919 return; 1916 1920 1917 1921 statsPopup->hide(); 1918 delete statsPopup;1922 statsPopup->deleteLater(); 1919 1923 statsPopup = NULL; 1920 1924 audioPkInOutLabel = audioPlayoutLabel = audioPkRtcpLabel = 0; 1921 1925 videoResLabel = videoPkOutLabel = videoPkInLabel = videoPkRtcpLabel = videoFramesInOutDiscLabel = videoAvgFpsLabel = 0; -
mythplugins/mythzoneminder/mythzoneminder/zmevents.cpp
611 611 612 612 popup->addButton(tr("Delete All")); 613 613 614 intres = popup->ExecPopup();614 DialogCode res = popup->ExecPopup(); 615 615 switch (res) 616 616 { 617 case 0:617 case kDialogCodeButton0: 618 618 // refresh event list; 619 619 getEventList(); 620 620 break; 621 case 1:621 case kDialogCodeButton1: 622 622 if (getContext() == 1) 623 623 { 624 624 // switch to grid view; … … 630 630 setView(false); 631 631 } 632 632 break; 633 case 2:633 case kDialogCodeButton2: 634 634 //delete all events 635 635 if (class ZMClient *zm = ZMClient::get()) 636 636 { … … 645 645 zm->deleteEventList(m_eventList); 646 646 647 647 getEventList(); 648 busy-> close();649 delete busy;648 busy->Close(); 649 busy->deleteLater(); 650 650 } 651 651 break; 652 case kDialogCodeRejected: 653 default: 654 break; 652 655 } 653 656 654 delete popup;657 popup->deleteLater(); 655 658 } -
mythplugins/mythzoneminder/mythzoneminder/zmliveplayer.cpp
74 74 { 75 75 MythPopupBox::showOkPopup(gContext->GetMainWindow(), "No monitors", 76 76 tr("Cannot find any monitors. Bailing out!")); 77 done(0);77 reject(); 78 78 return; 79 79 } 80 80 -
mythplugins/mythnews/mythnews/mythnews.cpp
1038 1038 1039 1039 popup->addLayout(vbox, 0); 1040 1040 1041 popup->addButton(tr("OK") );1042 popup->addButton(tr("Cancel") );1041 popup->addButton(tr("OK"), popup, SLOT(accept())); 1042 popup->addButton(tr("Cancel"), popup, SLOT(reject())); 1043 1043 1044 1044 QString siteName = ""; 1045 1045 if (edit) … … 1058 1058 } 1059 1059 } 1060 1060 1061 intres = popup->ExecPopup();1061 DialogCode res = popup->ExecPopup(); 1062 1062 1063 if ( res == 0)1063 if (kDialogCodeAccepted == res) 1064 1064 { 1065 1065 if (edit && siteName != "") 1066 1066 removeFromDB(siteName); … … 1068 1068 loadSites(); 1069 1069 } 1070 1070 1071 delete popup;1071 popup->deleteLater(); 1072 1072 1073 return ( res == 0);1073 return (kDialogCodeAccepted == res); 1074 1074 } 1075 1075 1076 1076 void MythNews::showMenu() … … 1091 1091 if (menu) 1092 1092 { 1093 1093 menu->hide(); 1094 delete menu;1094 menu->deleteLater(); 1095 1095 menu=NULL; 1096 1096 } 1097 1097 } -
mythtv/libs/libmythtv/channeleditor.cpp
326 326 tr("Are you sure you would like to delete the channels on %1?") 327 327 .arg(currentLabel)); 328 328 329 int val = MythPopupBox::show2ButtonPopup( 330 gContext->GetMainWindow(), "", 331 chan_msg, 329 DialogCode val = MythPopupBox::Show2ButtonPopup( 330 gContext->GetMainWindow(), "", chan_msg, 332 331 tr("Yes, delete the channels"), 333 tr("No, don't"), 2);332 tr("No, don't"), kDialogCodeButton1); 334 333 335 if ( val != 0)334 if (kDialogCodeButton0 != val) 336 335 return; 337 336 338 337 MSqlQuery query(MSqlQuery::InitCon()); … … 389 388 return dialog; 390 389 } 391 390 392 int ChannelEditor::exec()391 DialogCode ChannelEditor::exec(void) 393 392 { 394 while (ConfigurationDialog::exec() == QDialog::Accepted) {}395 return QDialog::Rejected;393 while (ConfigurationDialog::exec() == kDialogCodeAccepted) {} 394 return kDialogCodeRejected; 396 395 } 397 396 398 397 void ChannelEditor::edit() … … 414 413 { 415 414 id = list->getValue().toInt(); 416 415 417 int val = MythPopupBox::show2ButtonPopup(418 gContext->GetMainWindow(), "",419 tr("Are you sure you would like to delete this channel?"),416 DialogCode val = MythPopupBox::Show2ButtonPopup( 417 gContext->GetMainWindow(), 418 "", tr("Are you sure you would like to delete this channel?"), 420 419 tr("Yes, delete the channel"), 421 tr("No, don't"), 2);420 tr("No, don't"), kDialogCodeButton1); 422 421 423 if ( val == 0)422 if (kDialogCodeButton0 == val) 424 423 { 425 424 MSqlQuery query(MSqlQuery::InitCon()); 426 425 query.prepare("DELETE FROM channel WHERE chanid = :CHID ;"); … … 439 438 edit(); 440 439 else 441 440 { 442 int val = MythPopupBox::show2ButtonPopup(gContext->GetMainWindow(), 443 "", 444 tr("Channel Menu"), 445 tr("Edit.."), 446 tr("Delete.."), 1); 441 DialogCode val = MythPopupBox::Show2ButtonPopup( 442 gContext->GetMainWindow(), 443 "", tr("Channel Menu"), 444 tr("Edit.."), tr("Delete.."), kDialogCodeButton0); 447 445 448 if ( val == 0)446 if (kDialogCodeButton0 == val) 449 447 emit edit(); 450 else if ( val == 1)448 else if (kDialogCodeButton1 == val) 451 449 emit del(); 452 450 else 453 451 list->setFocus(); -
mythtv/libs/libmythtv/customedit.cpp
570 570 msg += m_description->text(); 571 571 572 572 DialogBox *storediag = new DialogBox(gContext->GetMainWindow(), msg); 573 int button = 1, sebtn = -1, exbtn = -1, deletebtn = -1, cancelbtn = -1;573 int button = 0, sebtn = -1, exbtn = -1, deletebtn = -1, cancelbtn = -1; 574 574 575 575 QString action = QObject::tr("Store"); 576 576 if (nameExists) … … 600 600 storediag->AddButton(QObject::tr("Cancel")); 601 601 cancelbtn = button++; 602 602 603 int ret = storediag->exec(); 604 delete storediag; 603 DialogCode code = storediag->exec(); 604 storediag->deleteLater(); 605 storediag = NULL; 606 int ret = MythDialog::CalcItemIndex(code); 605 607 606 608 if (ret == sebtn || ret == exbtn) 607 609 { … … 709 711 } 710 712 } 711 713 712 if ( msg > "")714 if (!msg.isEmpty()) 713 715 { 714 716 DialogBox *errdiag = new DialogBox(gContext->GetMainWindow(), msg); 715 717 errdiag->AddButton(QObject::tr("OK")); 716 718 errdiag->exec(); 717 719 718 delete errdiag;720 errdiag->deleteLater(); 719 721 ret = false; 720 722 } 721 723 return ret; -
mythtv/libs/libmythtv/progdetails.h
21 21 22 22 protected slots: 23 23 virtual void keyPressEvent(QKeyEvent *e); 24 void done(void);25 24 26 25 private: 27 26 void wireUpTheme(void); -
mythtv/libs/libmythtv/NuppelVideoPlayer.cpp
679 679 if (!using_null_videoout) 680 680 { 681 681 qApp->lock(); 682 DialogBox dialog(gContext->GetMainWindow(), 683 QObject::tr("Failed to Reinit Video.")); 684 dialog.AddButton(QObject::tr("Return to menu.")); 685 dialog.exec(); 682 DialogBox *dlg = new DialogBox( 683 gContext->GetMainWindow(), 684 QObject::tr("Failed to Reinit Video.")); 685 686 dlg->AddButton(QObject::tr("Return to menu.")); 687 dlg->exec(); 688 dlg->deleteLater(); 686 689 qApp->unlock(); 687 690 } 688 691 errored = true; … … 3146 3149 !gContext->GetNumSetting("PVR350InternalAudioOnly"))) 3147 3150 { 3148 3151 QString errMsg = ReinitAudio(); 3149 int ret = 1;3152 DialogCode ret = kDialogCodeButton0; 3150 3153 if ((errMsg != QString::null) && !using_null_videoout && 3151 3154 gContext->GetNumSetting("AudioNag", 1)) 3152 3155 { 3153 DialogBox dialog(gContext->GetMainWindow(), errMsg);3156 DialogBox *dlg = new DialogBox(gContext->GetMainWindow(), errMsg); 3154 3157 3155 3158 QString noaudio = QObject::tr("Continue WITHOUT AUDIO!"); 3156 3159 QString dontask = noaudio + " " + … … 3159 3162 QObject::tr("And, don't ask again in this session."); 3160 3163 QString quit = QObject::tr("Return to menu."); 3161 3164 3162 d ialog.AddButton(noaudio);3163 d ialog.AddButton(dontask);3164 d ialog.AddButton(neverask);3165 d ialog.AddButton(quit);3165 dlg->AddButton(noaudio); 3166 dlg->AddButton(dontask); 3167 dlg->AddButton(neverask); 3168 dlg->AddButton(quit); 3166 3169 3167 3170 qApp->lock(); 3168 ret = dialog.exec(); 3171 ret = dlg->exec(); 3172 dlg->deleteLater(); 3169 3173 qApp->unlock(); 3170 3174 } 3171 3175 3172 if ( ret == 2)3176 if (kDialogCodeButton1 == ret) 3173 3177 gContext->SaveSetting("AudioNag", 0); 3174 if ( ret == 3)3178 if (kDialogCodeButton2 == ret) 3175 3179 gContext->SetSetting("AudioNag", 0); 3176 else if ( ret == 4)3180 else if ((kDialogCodeButton3 == ret) || (kDialogCodeRejected == ret)) 3177 3181 return; 3178 3182 } 3179 3183 … … 3197 3201 QObject::tr("Unable to initialize video.")); 3198 3202 dialog->AddButton(QObject::tr("Return to menu.")); 3199 3203 dialog->exec(); 3200 d elete dialog;3204 dialog->deleteLater(); 3201 3205 qApp->unlock(); 3202 3206 } 3203 3207 … … 3580 3584 QObject::tr("Error was encountered while displaying video.")); 3581 3585 dialog->AddButton(QObject::tr("Return to Menu")); 3582 3586 dialog->exec(); 3583 d elete dialog;3587 dialog->deleteLater(); 3584 3588 3585 3589 qApp->unlock(); 3586 3590 } -
mythtv/libs/libmythtv/previouslist.cpp
58 58 59 59 if (!theme->LoadTheme(xmldata, "programlist")) 60 60 { 61 DialogBox diag(gContext->GetMainWindow(), "The theme you are using " 62 "does not contain a 'programlist' element. Please " 63 "contact the theme creator and ask if they could " 64 "please update it.<br><br>The next screen will be empty." 65 " Escape out of it to return to the menu."); 66 diag.AddButton("OK"); 67 diag.exec(); 61 DialogBox *dlg = new DialogBox( 62 gContext->GetMainWindow(), 63 QObject::tr( 64 "The theme you are using does not contain a 'programlist'" 65 "element. Please contact the theme creator and ask if they " 66 "could please update it.<br><br>The next screen will be " 67 "empty. Escape out of it to return to the menu.")); 68 dlg->AddButton("OK"); 69 dlg->exec(); 70 dlg->deleteLater(); 68 71 69 72 return; 70 73 } … … 330 333 331 334 int view = chooseListBox->currentItem(); 332 335 333 choosePopup-> done(0);336 choosePopup->AcceptItem(view); 334 337 335 338 if (view == curView) 336 339 return; … … 705 708 message += "\n\n\n" + tr("NOTE: removing items from this list will not " 706 709 "delete any recordings."); 707 710 708 DialogBox diag(gContext->GetMainWindow(), message);709 int button = 1, ok = -1, cleardup = -1, setdup = -1, rm_episode = -1,711 DialogBox *dlg = new DialogBox(gContext->GetMainWindow(), message); 712 int button = 0, ok = -1, cleardup = -1, setdup = -1, rm_episode = -1, 710 713 rm_title = -1; 711 714 // int rm_generics = -1; 712 715 713 d iag.AddButton(tr("OK"));716 dlg->AddButton(tr("OK")); 714 717 ok = button++; 715 718 716 719 if (pi->duplicate) 717 720 { 718 d iag.AddButton(tr("Allow this episode to re-record"));721 dlg->AddButton(tr("Allow this episode to re-record")); 719 722 cleardup = button++; 720 723 } 721 724 else 722 725 { 723 d iag.AddButton(tr("Never record this episode"));726 dlg->AddButton(tr("Never record this episode")); 724 727 setdup = button++; 725 728 } 726 d iag.AddButton(tr("Remove this episode from the list"));729 dlg->AddButton(tr("Remove this episode from the list")); 727 730 rm_episode = button++; 728 731 729 d iag.AddButton(tr("Remove all episodes for this title"));732 dlg->AddButton(tr("Remove all episodes for this title")); 730 733 rm_title = button++; 731 734 732 // d iag.AddButton(tr("Remove all that cannot be used for duplicate matching"));735 // dlg->AddButton(tr("Remove all that cannot be used for duplicate matching")); 733 736 // rm_generics = button++; 734 737 735 int ret = diag.exec(); 738 DialogCode code = dlg->exec(); 739 dlg->deleteLater(); 740 dlg = NULL; 741 int ret = MythDialog::CalcItemIndex(code); 736 742 737 743 if (ret == rm_episode) 738 744 { -
mythtv/libs/libmythtv/proglist.h
40 40 void cursorUp(bool page = false); 41 41 void prevView(void); 42 42 void nextView(void); 43 void setViewFromList( void);43 void setViewFromList(int); 44 44 void chooseEditChanged(void); 45 45 void chooseListBoxChanged(void); 46 46 void setViewFromEdit(void); -
mythtv/libs/libmythtv/playgroup.cpp
262 262 QString message = tr("Delete playback group:") + 263 263 QString("\n'%1'?").arg(name); 264 264 265 int value = MythPopupBox::show2ButtonPopup(gContext->GetMainWindow(), 266 "", message, 267 tr("Yes, delete group"), 268 tr("No, Don't delete group"), 2); 265 DialogCode value = MythPopupBox::Show2ButtonPopup( 266 gContext->GetMainWindow(), 267 "", message, 268 tr("Yes, delete group"), 269 tr("No, Don't delete group"), kDialogCodeButton1); 269 270 270 if ( value == 0)271 if (kDialogCodeButton0 == value) 271 272 { 272 273 MSqlQuery query(MSqlQuery::InitCon()); 273 274 query.prepare("DELETE FROM playgroup WHERE name = :NAME;"); … … 302 303 listbox->setValue(lastValue); 303 304 } 304 305 305 intPlayGroupEditor::exec(void)306 DialogCode PlayGroupEditor::exec(void) 306 307 { 307 while (ConfigurationDialog::exec() == QDialog::Accepted)308 while (ConfigurationDialog::exec() == kDialogCodeAccepted) 308 309 open(listbox->getValue()); 309 310 310 return QDialog::Rejected;311 return kDialogCodeRejected; 311 312 } 312 313 313 314 MythDialog* PlayGroupEditor::dialogWidget(MythMainWindow* parent, -
mythtv/libs/libmythtv/videosource.h
542 542 543 543 virtual MythDialog* dialogWidget(MythMainWindow* parent, 544 544 const char* widgetName=0); 545 virtual int exec();545 virtual DialogCode exec(void); 546 546 virtual void load(); 547 547 virtual void save() { }; 548 548 … … 568 568 bool cardTypesInclude(const int& SourceID, 569 569 const QString& thecardtype); 570 570 571 virtual int exec();571 virtual DialogCode exec(void); 572 572 virtual void load(); 573 573 virtual void save() { }; 574 574 … … 588 588 public: 589 589 CardInputEditor(); 590 590 591 virtual int exec();591 virtual DialogCode exec(void); 592 592 virtual void load(); 593 593 virtual void save() { }; 594 594 -
mythtv/libs/libmythtv/viewschdiff.cpp
45 45 theme->SetHMult(hmult); 46 46 if (!theme->LoadTheme(xmldata, "schdiff")) 47 47 { 48 DialogBox diag(gContext->GetMainWindow(), tr("The theme you are using " 49 "does not contain a 'schdiff' element. Please contact " 50 "the theme creator and ask if they could please update " 51 "it.<br><br>The next screen will be empty. " 52 "Escape out of it to return to the menu.")); 53 diag.AddButton(tr("OK")); 54 diag.exec(); 48 DialogBox *dlg = new DialogBox( 49 gContext->GetMainWindow(), 50 tr("The theme you are using does not contain a 'schdiff' element. " 51 "Please contact the theme creator and ask if they could please " 52 "update it.<br><br>The next screen will be empty. Escape out " 53 "of it to return to the menu.")); 55 54 55 dlg->AddButton(tr("OK")); 56 dlg->exec(); 57 dlg->deleteLater(); 58 56 59 return; 57 60 } 58 61 … … 308 311 pa = recListAfter.next(); 309 312 } 310 313 } 311 DialogBox diag(gContext->GetMainWindow(), message); 312 diag.AddButton(QObject::tr("OK")); 313 diag.exec(); 314 315 DialogBox *dlg = new DialogBox(gContext->GetMainWindow(), message); 316 dlg->AddButton(QObject::tr("OK")); 317 dlg->exec(); 318 dlg->deleteLater(); 319 314 320 return; 315 321 } 316 322 -
mythtv/libs/libmythtv/proglist.cpp
71 71 72 72 if (!theme->LoadTheme(xmldata, "programlist")) 73 73 { 74 DialogBox diag(gContext->GetMainWindow(), "The theme you are using " 75 "does not contain a 'programlist' element. Please " 76 "contact the theme creator and ask if they could " 77 "please update it.<br><br>The next screen will be empty." 78 " Escape out of it to return to the menu."); 79 diag.AddButton("OK"); 80 diag.exec(); 74 DialogBox *dlg = new DialogBox( 75 gContext->GetMainWindow(), "The theme you are using " 76 "does not contain a 'programlist' element. Please " 77 "contact the theme creator and ask if they could " 78 "please update it.<br><br>The next screen will be empty." 79 " Escape out of it to return to the menu."); 81 80 81 dlg->AddButton("OK"); 82 dlg->exec(); 83 dlg->deleteLater(); 84 82 85 return; 83 86 } 84 87 … … 391 394 refillAll = true; 392 395 } 393 396 394 void ProgLister::setViewFromList( void)397 void ProgLister::setViewFromList(int item) 395 398 { 399 int view = item; 400 396 401 if (!choosePopup || (!chooseListBox && !chooseEditButton)) 397 402 return; 398 403 399 int view = chooseListBox->currentItem();400 401 404 if (type == plTitleSearch || type == plKeywordSearch || 402 405 type == plPeopleSearch) 403 406 { … … 420 423 } 421 424 } 422 425 423 choosePopup-> done(0);426 choosePopup->AcceptItem(item); 424 427 425 428 if (view == curView) 426 429 return; … … 511 514 512 515 updateKeywordInDB(text); 513 516 514 choosePopup-> done(0);517 choosePopup->accept(); 515 518 516 519 fillViewList(text); 517 520 … … 543 546 544 547 updateKeywordInDB(text); 545 548 546 powerPopup-> done(0);549 powerPopup->accept(); 547 550 548 551 fillViewList(text); 549 552 … … 670 673 viewList[curView] = searchTime.toString(fullDateFormat); 671 674 viewTextList[curView] = viewList[curView]; 672 675 673 choosePopup-> done(0);676 choosePopup->accept(); 674 677 675 678 curItem = -1; 676 679 refillAll = true; … … 710 713 chooseListBox->setCurrentItem(curView); 711 714 choosePopup->addWidget(chooseListBox); 712 715 713 connect(chooseListBox, SIGNAL(accepted(int)), this, SLOT(setViewFromList())); 716 connect(chooseListBox, SIGNAL(accepted(int)), 717 this, SLOT(setViewFromList(int))); 714 718 715 719 chooseListBox->setFocus(); 716 720 choosePopup->ExecPopup(); … … 765 769 chooseRecordButton->setEnabled(chooseLineEdit->text() 766 770 .stripWhiteSpace().length() > 0); 767 771 768 connect(chooseListBox, SIGNAL(accepted(int)), this, SLOT(setViewFromList())); 772 connect(chooseListBox, SIGNAL(accepted(int)), 773 this, SLOT(setViewFromList(int))); 769 774 connect(chooseListBox, SIGNAL(menuButtonPressed(int)), chooseLineEdit, SLOT(setFocus())); 770 775 connect(chooseListBox, SIGNAL(selectionChanged()), this, SLOT(chooseListBoxChanged())); 771 776 connect(chooseLineEdit, SIGNAL(textChanged()), this, SLOT(chooseEditChanged())); … … 831 836 chooseDeleteButton->setEnabled(curView >= 0); 832 837 chooseRecordButton->setEnabled(curView >= 0); 833 838 834 connect(chooseListBox, SIGNAL(accepted(int)), this,835 SLOT(setViewFromList()));839 connect(chooseListBox, SIGNAL(accepted(int)), 840 this, SLOT(setViewFromList(int))); 836 841 connect(chooseListBox, SIGNAL(menuButtonPressed(int)),chooseEditButton, 837 842 SLOT(setFocus())); 838 843 connect(chooseListBox, SIGNAL(selectionChanged()), this, … … 1028 1033 powerDescEdit->setText(field[2]); 1029 1034 1030 1035 powerTitleEdit->setFocus(); 1031 choosePopup-> done(0);1036 choosePopup->accept(); 1032 1037 powerPopup->ExecPopup(); 1033 1038 1034 1039 powerTitleEdit = NULL; // deleted by popup delete -
mythtv/libs/libmythtv/playgroup.h
29 29 30 30 public: 31 31 PlayGroupEditor(void); 32 virtual intexec(void);32 virtual DialogCode exec(void); 33 33 virtual void load(void); 34 34 virtual void save(void) { }; 35 35 virtual void save(QString) { }; -
mythtv/libs/libmythtv/scanwizardhelpers.h
65 65 public: 66 66 ScanProgressPopup(bool lock, bool strength, bool snr); 67 67 68 virtual intexec(void);68 virtual DialogCode exec(void); 69 69 70 70 void SetStatusSignalToNoise(int value); 71 71 void SetStatusSignalStrength(int value); -
mythtv/libs/libmythtv/progdetails.cpp
94 94 QString action = actions[i]; 95 95 handled = true; 96 96 if (action == "ESCAPE" || action == "SELECT") 97 done();97 reject(); 98 98 else if (action == "UP") 99 99 { 100 100 if (getCurrentFocusWidget() == m_richText) … … 144 144 if (m_okButton) 145 145 { 146 146 m_okButton->setText(tr("OK")); 147 connect(m_okButton, SIGNAL(pushed()), this, SLOT( done()));147 connect(m_okButton, SIGNAL(pushed()), this, SLOT(accept())); 148 148 } 149 149 150 150 m_richText = getUIRichTextType("richtext"); 151 151 152 152 buildFocusList(); 153 153 } 154 155 void ProgDetails::done()156 {157 MythDialog::done(0);158 } -
mythtv/libs/libmythtv/scanwizardscanner.cpp
634 634 635 635 void ScanWizardScanner::RunPopup(void) 636 636 { 637 intret = popupProgress->exec();637 DialogCode ret = popupProgress->exec(); 638 638 639 639 popupLock.lock(); 640 640 popupProgress->deleteLater(); -
mythtv/libs/libmythtv/profilegroup.h
119 119 listbox(new ListBoxSetting(this)), dialog(NULL), redraw(true) 120 120 { addChild(listbox); } 121 121 122 virtual int exec();122 virtual DialogCode exec(void); 123 123 virtual void load(); 124 124 virtual void save() {}; 125 125 -
mythtv/libs/libmythtv/channeleditor.h
12 12 Q_OBJECT 13 13 public: 14 14 ChannelEditor(); 15 virtual int exec();15 virtual DialogCode exec(void); 16 16 17 17 MythDialog* dialogWidget(MythMainWindow *parent, const char* name); 18 18 -
mythtv/libs/libmythtv/scheduledrecording.h
111 111 virtual void modifyPowerSearchByID(int rid, QString textname, 112 112 QString from, QString forwhat); 113 113 114 virtual intexec(bool saveOnExec = true, bool doLoad = false);114 virtual DialogCode exec(bool saveOnExec = true, bool doLoad = false); 115 115 116 116 void remove(); 117 117 int getRecordID(void) const { return id->intValue(); }; … … 275 275 ScheduledRecordingEditor() : listbox(new ListBoxSetting(this)) 276 276 { addChild(listbox); } 277 277 278 virtual int exec();278 virtual DialogCode exec(void); 279 279 virtual void load(); 280 280 virtual void save() { }; 281 281 -
mythtv/libs/libmythtv/recordingprofile.h
85 85 virtual void loadByID(int id); 86 86 virtual bool loadByType(QString name, QString cardtype); 87 87 virtual bool loadByGroup(QString name, QString group); 88 virtual int exec();88 virtual DialogCode exec(void); 89 89 90 90 // sets 91 91 void setCodecTypes(); … … 135 135 public: 136 136 RecordingProfileEditor(int id, QString profName); 137 137 138 virtual int exec();138 virtual DialogCode exec(void); 139 139 virtual void load(); 140 140 virtual void save() { }; 141 141 virtual void save(QString /*destination*/) { } -
mythtv/libs/libmythtv/tv_play.cpp
145 145 recTitles.append(buttonTitle); 146 146 it++; 147 147 } 148 int ret = MythPopupBox::showButtonPopup( 149 gContext->GetMainWindow(), 150 "", 151 tr("All Tuners are Busy.\n" 152 "Select a Current Recording"), 153 recTitles, 1); 154 if ((0 < ret) && (ret <= (int)reclist->size())) 148 DialogCode ret = MythPopupBox::ShowButtonPopup( 149 gContext->GetMainWindow(), 150 "", 151 tr("All Tuners are Busy.\n" 152 "Select a Current Recording"), 153 recTitles, kDialogCodeButton1); 154 155 int idx = MythDialog::CalcItemIndex(ret) - 1; 156 if ((0 <= idx) && (idx < (int)reclist->size())) 155 157 { 156 p = reclist->at( ret - 1);158 p = reclist->at(idx); 157 159 curProgram = new ProgramInfo(*p); 158 160 } 159 161 else … … 7766 7768 recGroupPassword, 7767 7769 gContext->GetMainWindow()); 7768 7770 pwd->exec(); 7769 delete pwd; 7771 pwd->deleteLater(); 7772 pwd = NULL; 7773 7770 7774 qApp->unlock(); 7771 7775 if (!ok) 7772 7776 { -
mythtv/libs/libmythtv/storagegroup.cpp
418 418 QString message = 419 419 tr("Remove '%1'\nDirectory From Storage Group?").arg(name); 420 420 421 int value = 422 MythPopupBox::show2ButtonPopup(gContext->GetMainWindow(), "", message, 423 tr("Yes, remove directory"), 424 tr("No, Don't remove directory"), 2); 421 DialogCode value = MythPopupBox::Show2ButtonPopup( 422 gContext->GetMainWindow(), "", message, 423 tr("Yes, remove directory"), 424 tr("No, Don't remove directory"), 425 kDialogCodeButton1); 425 426 426 if ( value == 0)427 if (kDialogCodeButton0 == value) 427 428 { 428 429 MSqlQuery query(MSqlQuery::InitCon()); 429 430 query.prepare("DELETE FROM storagegroup " … … 476 477 listbox->setValue(lastValue); 477 478 } 478 479 479 int StorageGroupEditor::exec() { 480 while (ConfigurationDialog::exec() == QDialog::Accepted) 480 DialogCode StorageGroupEditor::exec(void) 481 { 482 while (ConfigurationDialog::exec() == kDialogCodeAccepted) 481 483 open(listbox->getValue()); 482 484 483 return QDialog::Rejected;485 return kDialogCodeRejected; 484 486 } 485 487 486 488 MythDialog* StorageGroupEditor::dialogWidget(MythMainWindow* parent, … … 557 559 558 560 QString message = tr("Delete '%1' Storage Group?").arg(dispGroup); 559 561 560 int value = MythPopupBox::show2ButtonPopup(gContext->GetMainWindow(), 561 "", message, 562 tr("Yes, delete group"), 563 tr("No, Don't delete group"), 2); 562 DialogCode value = MythPopupBox::Show2ButtonPopup( 563 gContext->GetMainWindow(), 564 "", message, 565 tr("Yes, delete group"), 566 tr("No, Don't delete group"), kDialogCodeButton1); 564 567 565 if ( value == 0)568 if (kDialogCodeButton0 == value) 566 569 { 567 570 MSqlQuery query(MSqlQuery::InitCon()); 568 571 query.prepare("DELETE FROM storagegroup " … … 673 676 listbox->setValue(lastValue); 674 677 } 675 678 676 int StorageGroupListEditor::exec() { 677 while (ConfigurationDialog::exec() == QDialog::Accepted) 679 DialogCode StorageGroupListEditor::exec(void) 680 { 681 while (ConfigurationDialog::exec() == kDialogCodeAccepted) 678 682 open(listbox->getValue()); 679 683 680 return QDialog::Rejected;684 return kDialogCodeRejected; 681 685 } 682 686 683 687 MythDialog* StorageGroupListEditor::dialogWidget(MythMainWindow* parent, -
mythtv/libs/libmythtv/videosource.cpp
323 323 .arg(ddp.GetListingsProviderName()); 324 324 325 325 VERBOSE(VB_GENERAL, waitMsg); 326 MythProgressDialog pdlg(waitMsg, 2);326 MythProgressDialog *pdlg = new MythProgressDialog(waitMsg, 2); 327 327 328 328 clearSelections(); 329 329 330 pdlg .setProgress(1);330 pdlg->setProgress(1); 331 331 332 332 if (!ddp.GrabLineupsOnly()) 333 333 { … … 341 341 for (it = lineups.begin(); it != lineups.end(); ++it) 342 342 addSelection((*it).displayname, (*it).lineupid); 343 343 344 pdlg.setProgress(2); 345 pdlg.Close(); 344 pdlg->setProgress(2); 345 pdlg->Close(); 346 pdlg->deleteLater(); 346 347 #else // USING_BACKEND 347 348 VERBOSE(VB_IMPORTANT, "You must compile the backend " 348 349 "to set up a DataDirect line-up"); … … 419 420 "might want to check the output as it\n" 420 421 "runs by switching to the terminal from " 421 422 "which you started\nthis program.")); 422 MythProgressDialog pdlg( waitMsg, 2);423 MythProgressDialog *pdlg = new MythProgressDialog(waitMsg, 2); 423 424 VERBOSE(VB_GENERAL, QString("Please wait while MythTV retrieves the " 424 425 "list of available channels")); 425 pdlg .show();426 pdlg->show(); 426 427 427 428 QString command; 428 429 QString filename = QString("%1/%2.xmltv") … … 431 432 command = QString("%1 --config-file '%2' --configure") 432 433 .arg(grabber).arg(filename); 433 434 434 pdlg .setProgress(1);435 pdlg->setProgress(1); 435 436 436 437 int ret = system(command); 437 438 if (ret != 0) … … 461 462 gContext->GetMainWindow(), QObject::tr("Warning."), err_msg); 462 463 } 463 464 464 pdlg.setProgress( 2 ); 465 pdlg.Close(); 465 pdlg->setProgress( 2 ); 466 pdlg->Close(); 467 pdlg->deleteLater(); 466 468 } 467 469 468 470 EITOnly_config::EITOnly_config(const VideoSource& _parent) : … … 569 571 } 570 572 571 573 find_grabbers_dialog->Close(); 572 delete find_grabbers_dialog;574 find_grabbers_dialog->deleteLater(); 573 575 } 574 576 else { 575 577 VERBOSE(VB_IMPORTANT, "Failed to run tv_find_grabbers"); … … 2009 2011 addChild(listbox); 2010 2012 } 2011 2013 2012 intCaptureCardEditor::exec(void)2014 DialogCode CaptureCardEditor::exec(void) 2013 2015 { 2014 while (ConfigurationDialog::exec() == QDialog::Accepted)2016 while (ConfigurationDialog::exec() == kDialogCodeAccepted) 2015 2017 edit(); 2016 2018 2017 return QDialog::Rejected;2019 return kDialogCodeRejected; 2018 2020 } 2019 2021 2020 2022 void CaptureCardEditor::load(void) … … 2046 2048 } 2047 2049 else 2048 2050 { 2049 int val = MythPopupBox::show2ButtonPopup(2051 DialogCode val = MythPopupBox::Show2ButtonPopup( 2050 2052 gContext->GetMainWindow(), 2051 2053 "", 2052 2054 tr("Capture Card Menu"), 2053 2055 tr("Edit.."), 2054 2056 tr("Delete.."), 2055 1);2057 kDialogCodeButton0); 2056 2058 2057 if ( val == 0)2059 if (kDialogCodeButton0 == val) 2058 2060 edit(); 2059 else if ( val == 1)2061 else if (kDialogCodeButton1 == val) 2060 2062 del(); 2061 2063 } 2062 2064 } … … 2066 2068 const int cardid = listbox->getValue().toInt(); 2067 2069 if (-1 == cardid) 2068 2070 { 2069 int val = MythPopupBox::show2ButtonPopup(2071 DialogCode val = MythPopupBox::Show2ButtonPopup( 2070 2072 gContext->GetMainWindow(), "", 2071 2073 tr("Are you sure you want to delete " 2072 2074 "ALL capture cards on %1?").arg(gContext->GetHostName()), 2073 2075 tr("Yes, delete capture cards"), 2074 tr("No, don't"), 2);2076 tr("No, don't"), kDialogCodeButton1); 2075 2077 2076 if ( 0 == val)2078 if (kDialogCodeButton0 == val) 2077 2079 { 2078 2080 MSqlQuery cards(MSqlQuery::InitCon()); 2079 2081 … … 2102 2104 } 2103 2105 else if (-2 == cardid) 2104 2106 { 2105 int val = MythPopupBox::show2ButtonPopup(2107 DialogCode val = MythPopupBox::Show2ButtonPopup( 2106 2108 gContext->GetMainWindow(), "", 2107 2109 tr("Are you sure you want to delete " 2108 2110 "ALL capture cards?"), 2109 2111 tr("Yes, delete capture cards"), 2110 tr("No, don't"), 2);2112 tr("No, don't"), kDialogCodeButton1); 2111 2113 2112 if ( 0 == val)2114 if (kDialogCodeButton0 == val) 2113 2115 { 2114 2116 MSqlQuery query(MSqlQuery::InitCon()); 2115 2117 query.exec("TRUNCATE TABLE capturecard;"); … … 2128 2130 2129 2131 void CaptureCardEditor::del(void) 2130 2132 { 2131 int val = MythPopupBox::show2ButtonPopup(2133 DialogCode val = MythPopupBox::Show2ButtonPopup( 2132 2134 gContext->GetMainWindow(), "", 2133 2135 tr("Are you sure you want to delete this capture card?"), 2134 2136 tr("Yes, delete capture card"), 2135 tr("No, don't"), 2);2137 tr("No, don't"), kDialogCodeButton1); 2136 2138 2137 if ( val == 0)2139 if (kDialogCodeButton0 == val) 2138 2140 { 2139 2141 CardUtil::DeleteCard(listbox->getValue().toUInt()); 2140 2142 load(); … … 2157 2159 return dialog; 2158 2160 } 2159 2161 2160 int VideoSourceEditor::exec() { 2161 while (ConfigurationDialog::exec() == QDialog::Accepted) 2162 DialogCode VideoSourceEditor::exec(void) 2163 { 2164 while (ConfigurationDialog::exec() == kDialogCodeAccepted) 2162 2165 edit(); 2163 2166 2164 return QDialog::Rejected;2167 return kDialogCodeRejected; 2165 2168 } 2166 2169 2167 2170 void VideoSourceEditor::load(void) … … 2181 2184 } 2182 2185 else 2183 2186 { 2184 int val = MythPopupBox::show2ButtonPopup(2187 DialogCode val = MythPopupBox::Show2ButtonPopup( 2185 2188 gContext->GetMainWindow(), 2186 2189 "", 2187 2190 tr("Video Source Menu"), 2188 2191 tr("Edit.."), 2189 2192 tr("Delete.."), 2190 1);2193 kDialogCodeButton0); 2191 2194 2192 if ( val == 0)2195 if (kDialogCodeButton0 == val) 2193 2196 edit(); 2194 else if ( val == 1)2197 else if (kDialogCodeButton1 == val) 2195 2198 del(); 2196 2199 } 2197 2200 } … … 2201 2204 const int sourceid = listbox->getValue().toInt(); 2202 2205 if (-1 == sourceid) 2203 2206 { 2204 int val = MythPopupBox::show2ButtonPopup(2207 DialogCode val = MythPopupBox::Show2ButtonPopup( 2205 2208 gContext->GetMainWindow(), "", 2206 2209 tr("Are you sure you want to delete " 2207 2210 "ALL video sources?"), 2208 2211 tr("Yes, delete video sources"), 2209 tr("No, don't"), 2);2212 tr("No, don't"), kDialogCodeButton1); 2210 2213 2211 if ( 0 == val)2214 if (kDialogCodeButton0 == val) 2212 2215 { 2213 2216 MSqlQuery query(MSqlQuery::InitCon()); 2214 2217 query.exec("TRUNCATE TABLE channel;"); … … 2233 2236 2234 2237 void VideoSourceEditor::del() 2235 2238 { 2236 int val = MythPopupBox::show2ButtonPopup(2239 DialogCode val = MythPopupBox::Show2ButtonPopup( 2237 2240 gContext->GetMainWindow(), "", 2238 2241 tr("Are you sure you want to delete " 2239 2242 "this video source?"), 2240 2243 tr("Yes, delete video source"), 2241 2244 tr("No, don't"), 2242 2);2245 kDialogCodeButton1); 2243 2246 2244 if ( val == 0)2247 if (kDialogCodeButton0 == val) 2245 2248 { 2246 2249 MSqlQuery query(MSqlQuery::InitCon()); 2247 2250 … … 2285 2288 addChild(listbox); 2286 2289 } 2287 2290 2288 intCardInputEditor::exec(void)2291 DialogCode CardInputEditor::exec(void) 2289 2292 { 2290 while (ConfigurationDialog::exec() == QDialog::Accepted)2293 while (ConfigurationDialog::exec() == kDialogCodeAccepted) 2291 2294 cardinputs[listbox->getValue().toInt()]->exec(); 2292 2295 2293 return QDialog::Rejected;2296 return kDialogCodeRejected; 2294 2297 } 2295 2298 2296 2299 void CardInputEditor::load() -
mythtv/libs/libmythtv/diseqcsettings.cpp
461 461 addChild(new RotorPosMap(rotor)); 462 462 } 463 463 464 virtual intexec(void)464 virtual DialogCode exec(void) 465 465 { 466 while (ConfigurationDialog::exec() == QDialog::Accepted);467 return QDialog::Rejected;466 while (ConfigurationDialog::exec() == kDialogCodeAccepted); 467 return kDialogCodeRejected; 468 468 } 469 469 }; 470 470 … … 944 944 945 945 popup->addWidget(list); 946 946 connect(list, SIGNAL(accepted(int)), 947 popup, SLOT( done(int)));947 popup, SLOT( AcceptItem(int))); 948 948 list->setFocus(); 949 949 950 intres = popup->ExecPopup();950 DialogCode res = popup->ExecPopup(); 951 951 type = (DiSEqCDevDevice::dvbdev_t)list->currentItem(); 952 952 953 953 popup->hide(); 954 954 popup->deleteLater(); 955 955 956 return res >= 0;956 return kDialogCodeRejected != res; 957 957 } 958 958 959 959 void DeviceTree::CreateRootNodeDialog(void) … … 1084 1084 addChild(new DeviceTree(tree)); 1085 1085 } 1086 1086 1087 intDTVDeviceTreeWizard::exec(void)1087 DialogCode DTVDeviceTreeWizard::exec(void) 1088 1088 { 1089 while (ConfigurationDialog::exec() == QDialog::Accepted);1090 return QDialog::Rejected;1089 while (ConfigurationDialog::exec() == kDialogCodeAccepted); 1090 return kDialogCodeRejected; 1091 1091 } 1092 1092 1093 1093 //////////////////////////////////////// SwitchSetting -
mythtv/libs/libmythtv/profilegroup.cpp
244 244 listbox->addSelection(QObject::tr("(Create new profile group)"), "0"); 245 245 } 246 246 247 int ProfileGroupEditor::exec() 247 DialogCode ProfileGroupEditor::exec(void) 248 248 { 249 int ret = QDialog::Accepted;249 DialogCode ret = kDialogCodeAccepted; 250 250 redraw = true; 251 251 252 252 while ((QDialog::Accepted == ret) || redraw) … … 278 278 open(listbox->getValue().toInt()); 279 279 } 280 280 281 return QDialog::Rejected;281 return kDialogCodeRejected; 282 282 } 283 283 284 284 void ProfileGroupEditor::callDelete(void) … … 296 296 QString message = QObject::tr("Delete profile group:") + 297 297 QString("\n'%1'?").arg(ProfileGroup::getName(id)); 298 298 299 int value = MythPopupBox::show2ButtonPopup(gContext->GetMainWindow(), 300 "", message, 301 QObject::tr("Yes, delete group"), 302 QObject::tr("No, Don't delete group"), 2); 299 DialogCode value = MythPopupBox::Show2ButtonPopup( 300 gContext->GetMainWindow(), 301 "", message, 302 QObject::tr("Yes, delete group"), 303 QObject::tr("No, Don't delete group"), kDialogCodeButton1); 303 304 304 if ( value == 0)305 if (kDialogCodeButton0 == value) 305 306 { 306 307 querystr = QString("DELETE codecparams FROM codecparams, " 307 308 "recordingprofiles WHERE " -
mythtv/libs/libmythtv/transporteditor.h
74 74 public: 75 75 TransportListEditor(uint initial_sourceid); 76 76 77 virtual intexec(void);77 virtual DialogCode exec(void); 78 78 79 79 public slots: 80 80 void Menu(void); -
mythtv/libs/libmythtv/programinfo.cpp
4167 4167 message += "\n\n"; 4168 4168 message += RecStatusDesc(); 4169 4169 4170 DialogBox diag(gContext->GetMainWindow(), message);4171 int button = 1, ok = -1, react = -1, stop = -1, addov = -1, forget = -1,4170 DialogBox *dlg = new DialogBox(gContext->GetMainWindow(), message); 4171 int button = 0, ok = -1, react = -1, stop = -1, addov = -1, forget = -1, 4172 4172 clearov = -1, edend = -1, ednorm = -1, edcust = -1; 4173 4173 4174 d iag.AddButton(QObject::tr("OK"));4174 dlg->AddButton(QObject::tr("OK")); 4175 4175 ok = button++; 4176 4176 4177 4177 if (recstartts < now && recendts > now) 4178 4178 { 4179 4179 if (recstatus != rsRecording) 4180 4180 { 4181 d iag.AddButton(QObject::tr("Reactivate"));4181 dlg->AddButton(QObject::tr("Reactivate")); 4182 4182 react = button++; 4183 4183 } 4184 4184 else 4185 4185 { 4186 d iag.AddButton(QObject::tr("Stop recording"));4186 dlg->AddButton(QObject::tr("Stop recording")); 4187 4187 stop = button++; 4188 4188 } 4189 4189 } … … 4193 4193 { 4194 4194 if (recstartts > now) 4195 4195 { 4196 d iag.AddButton(QObject::tr("Don't record"));4196 dlg->AddButton(QObject::tr("Don't record")); 4197 4197 addov = button++; 4198 4198 } 4199 4199 if (recstatus != rsRecording && rectype != kFindOneRecord && … … 4206 4206 ((dupmethod & kDupCheckDesc) && description != "") || 4207 4207 ((dupmethod & kDupCheckSubThenDesc) && (subtitle != "" || description != "")) )) 4208 4208 { 4209 d iag.AddButton(QObject::tr("Never record"));4209 dlg->AddButton(QObject::tr("Never record")); 4210 4210 forget = button++; 4211 4211 } 4212 4212 } … … 4215 4215 { 4216 4216 if (recstatus == rsRecording) 4217 4217 { 4218 d iag.AddButton(QObject::tr("Change Ending Time"));4218 dlg->AddButton(QObject::tr("Change Ending Time")); 4219 4219 edend = button++; 4220 4220 } 4221 4221 else 4222 4222 { 4223 d iag.AddButton(QObject::tr("Edit Options"));4223 dlg->AddButton(QObject::tr("Edit Options")); 4224 4224 ednorm = button++; 4225 4225 4226 4226 if (rectype != kSingleRecord && rectype != kFindOneRecord) 4227 4227 { 4228 d iag.AddButton(QObject::tr("Add Override"));4228 dlg->AddButton(QObject::tr("Add Override")); 4229 4229 edcust = button++; 4230 4230 } 4231 4231 } … … 4235 4235 { 4236 4236 if (recstatus == rsRecording) 4237 4237 { 4238 d iag.AddButton(QObject::tr("Change Ending Time"));4238 dlg->AddButton(QObject::tr("Change Ending Time")); 4239 4239 edend = button++; 4240 4240 } 4241 4241 else 4242 4242 { 4243 d iag.AddButton(QObject::tr("Edit Override"));4243 dlg->AddButton(QObject::tr("Edit Override")); 4244 4244 ednorm = button++; 4245 d iag.AddButton(QObject::tr("Clear Override"));4245 dlg->AddButton(QObject::tr("Clear Override")); 4246 4246 clearov = button++; 4247 4247 } 4248 4248 } 4249 4249 } 4250 4250 4251 int ret = diag.exec(); 4251 DialogCode code = dlg->exec(); 4252 dlg->deleteLater(); 4253 dlg = NULL; 4254 int ret = MythDialog::CalcItemIndex(code); 4252 4255 4253 4256 if (ret == react) 4254 4257 ReactivateRecording(); … … 4335 4338 delete confList; 4336 4339 } 4337 4340 4338 DialogBox diag(gContext->GetMainWindow(), message);4339 int button = 1, ok = -1, react = -1, addov = -1, clearov = -1,4341 DialogBox *dlg = new DialogBox(gContext->GetMainWindow(), message); 4342 int button = 0, ok = -1, react = -1, addov = -1, clearov = -1, 4340 4343 ednorm = -1, edcust = -1, forget = -1, addov1 = -1, forget1 = -1; 4341 4344 4342 d iag.AddButton(QObject::tr("OK"));4345 dlg->AddButton(QObject::tr("OK")); 4343 4346 ok = button++; 4344 4347 4345 4348 QDateTime now = QDateTime::currentDateTime(); … … 4347 4350 if (recstartts < now && recendts > now && 4348 4351 recstatus != rsDontRecord && recstatus != rsNotListed) 4349 4352 { 4350 d iag.AddButton(QObject::tr("Reactivate"));4353 dlg->AddButton(QObject::tr("Reactivate")); 4351 4354 react = button++; 4352 4355 } 4353 4356 … … 4365 4368 recstatus == rsInactive || 4366 4369 recstatus == rsLaterShowing)) 4367 4370 { 4368 d iag.AddButton(QObject::tr("Record anyway"));4371 dlg->AddButton(QObject::tr("Record anyway")); 4369 4372 addov = button++; 4370 4373 if (recstatus == rsPreviousRecording || recstatus == rsNeverRecord) 4371 4374 { 4372 d iag.AddButton(QObject::tr("Forget Previous"));4375 dlg->AddButton(QObject::tr("Forget Previous")); 4373 4376 forget = button++; 4374 4377 } 4375 4378 } … … 4384 4387 { 4385 4388 if (recstartts > now) 4386 4389 { 4387 d iag.AddButton(QObject::tr("Don't record"));4390 dlg->AddButton(QObject::tr("Don't record")); 4388 4391 addov1 = button++; 4389 4392 } 4390 4393 if (rectype != kFindOneRecord && … … 4396 4399 ((dupmethod & kDupCheckSub) && subtitle != "") || 4397 4400 ((dupmethod & kDupCheckDesc) && description != ""))) 4398 4401 { 4399 d iag.AddButton(QObject::tr("Never record"));4402 dlg->AddButton(QObject::tr("Never record")); 4400 4403 forget1 = button++; 4401 4404 } 4402 4405 } 4403 4406 4404 d iag.AddButton(QObject::tr("Edit Options"));4407 dlg->AddButton(QObject::tr("Edit Options")); 4405 4408 ednorm = button++; 4406 4409 4407 4410 if (rectype != kSingleRecord && rectype != kFindOneRecord && 4408 4411 recstatus != rsNotListed) 4409 4412 { 4410 d iag.AddButton(QObject::tr("Add Override"));4413 dlg->AddButton(QObject::tr("Add Override")); 4411 4414 edcust = button++; 4412 4415 } 4413 4416 } 4414 4417 4415 4418 if (rectype == kOverrideRecord || rectype == kDontRecord) 4416 4419 { 4417 d iag.AddButton(QObject::tr("Edit Override"));4420 dlg->AddButton(QObject::tr("Edit Override")); 4418 4421 ednorm = button++; 4419 4422 4420 d iag.AddButton(QObject::tr("Clear Override"));4423 dlg->AddButton(QObject::tr("Clear Override")); 4421 4424 clearov = button++; 4422 4425 } 4423 4426 } 4424 4427 4425 int ret = diag.exec(); 4428 DialogCode code = dlg->exec(); 4429 dlg->deleteLater(); 4430 dlg = NULL; 4431 int ret = MythDialog::CalcItemIndex(code); 4426 4432 4427 4433 if (ret == react) 4428 4434 ReactivateRecording(); -
mythtv/libs/libmythtv/scheduledrecording.cpp
721 721 } 722 722 723 723 724 int ScheduledRecordingEditor::exec(void) 724 DialogCode ScheduledRecordingEditor::exec(void) 725 725 { 726 while (ConfigurationDialog::exec() == QDialog::Accepted)726 while (ConfigurationDialog::exec() == kDialogCodeAccepted) 727 727 open(listbox->getValue().toInt()); 728 728 729 return QDialog::Rejected;729 return kDialogCodeRejected; 730 730 } 731 731 732 732 void ScheduledRecordingEditor::open(int id) { … … 743 743 744 744 /////////////////////////////////////////////////////////////////////////////// 745 745 746 intScheduledRecording::exec(bool saveOnExec, bool doLoad)746 DialogCode ScheduledRecording::exec(bool saveOnExec, bool doLoad) 747 747 { 748 748 if (!dialog) 749 749 dialog = new ScheduledRecordingDialog(this); -
mythtv/libs/libmythtv/recordingprofile.cpp
1319 1319 audioSettings->selectCodecs(groupType()); 1320 1320 } 1321 1321 1322 intRecordingProfile::exec(void)1322 DialogCode RecordingProfile::exec(void) 1323 1323 { 1324 1324 MythDialog *dialog = dialogWidget( 1325 1325 gContext->GetMainWindow(), "Recording Profile"); … … 1333 1333 if (tr_filters) 1334 1334 FiltersChanged(tr_filters->getValue()); 1335 1335 1336 intret = dialog->exec();1336 DialogCode ret = dialog->exec(); 1337 1337 1338 1338 dialog->deleteLater(); 1339 1339 … … 1414 1414 RecordingProfile::fillSelections(listbox, group); 1415 1415 } 1416 1416 1417 intRecordingProfileEditor::exec(void)1417 DialogCode RecordingProfileEditor::exec(void) 1418 1418 { 1419 while (ConfigurationDialog::exec() == QDialog::Accepted)1419 while (ConfigurationDialog::exec() == kDialogCodeAccepted) 1420 1420 open(listbox->getValue().toInt()); 1421 1421 1422 return QDialog::Rejected;1422 return kDialogCodeRejected; 1423 1423 } 1424 1424 1425 1425 void RecordingProfile::fillSelections(SelectSetting *setting, int group, -
mythtv/libs/libmythtv/transporteditor.cpp
288 288 connect(m_list, SIGNAL(deleteButtonPressed(int)), this, SLOT(Delete())); 289 289 } 290 290 291 intTransportListEditor::exec(void)291 DialogCode TransportListEditor::exec(void) 292 292 { 293 while (ConfigurationDialog::exec() == QDialog::Accepted);293 while (ConfigurationDialog::exec() == kDialogCodeAccepted); 294 294 295 return QDialog::Rejected;295 return kDialogCodeRejected; 296 296 } 297 297 298 298 void TransportListEditor::Edit(void) … … 315 315 { 316 316 uint mplexid = m_list->getValue().toInt(); 317 317 318 int val = MythPopupBox::show2ButtonPopup(318 DialogCode val = MythPopupBox::Show2ButtonPopup( 319 319 gContext->GetMainWindow(), "", 320 320 tr("Are you sure you would like to delete this transport?"), 321 321 tr("Yes, delete the transport"), 322 tr("No, don't"), 2);322 tr("No, don't"), kDialogCodeButton1); 323 323 324 if ( val == 1)324 if (kDialogCodeButton0 != val) 325 325 return; 326 326 327 327 MSqlQuery query(MSqlQuery::InitCon()); … … 350 350 return; 351 351 } 352 352 353 int val = MythPopupBox::show2ButtonPopup(353 DialogCode val = MythPopupBox::Show2ButtonPopup( 354 354 gContext->GetMainWindow(), 355 355 "", 356 356 tr("Transport Menu"), 357 357 tr("Edit.."), 358 tr("Delete.."), 1);358 tr("Delete.."), kDialogCodeButton0); 359 359 360 if ( val == 0)360 if (kDialogCodeButton0 == val) 361 361 emit Edit(); 362 else if ( val == 1)362 else if (kDialogCodeButton1 == val) 363 363 emit Delete(); 364 364 else 365 365 m_list->setFocus(); -
mythtv/libs/libmythtv/storagegroup.h
36 36 Q_OBJECT 37 37 public: 38 38 StorageGroupEditor(QString group); 39 virtual intexec(void);39 virtual DialogCode exec(void); 40 40 virtual void load(void); 41 41 virtual void save(void) { }; 42 42 virtual void save(QString) { }; … … 59 59 Q_OBJECT 60 60 public: 61 61 StorageGroupListEditor(void); 62 virtual intexec(void);62 virtual DialogCode exec(void); 63 63 virtual void load(void); 64 64 virtual void save(void) { }; 65 65 virtual void save(QString) { }; -
mythtv/libs/libmythtv/scanwizardhelpers.cpp
165 165 setLabel(msg); 166 166 } 167 167 168 intScanProgressPopup::exec(void)168 DialogCode ScanProgressPopup::exec(void) 169 169 { 170 170 if (!dialog) 171 171 { … … 173 173 dialogWidget(gContext->GetMainWindow(), 174 174 "ConfigurationPopupDialog"); 175 175 } 176 dialog->setResult( 0);176 dialog->setResult(kDialogCodeRejected); 177 177 178 178 done = false; 179 179 dialog->ShowPopup(this, SLOT(PopupDone(int))); -
mythtv/libs/libmythtv/diseqcsettings.h
130 130 public: 131 131 DTVDeviceTreeWizard(DiSEqCDevTree &tree); 132 132 133 virtual intexec(void);133 virtual DialogCode exec(void); 134 134 }; 135 135 136 136 class DTVDeviceConfigGroup : public VerticalConfigurationGroup -
mythtv/libs/libmythui/myththemedmenu.cpp
2405 2405 MythPasswordDialog *pwd = new MythPasswordDialog(text, &ok, password, 2406 2406 gContext->GetMainWindow()); 2407 2407 pwd->exec(); 2408 delete pwd;2408 pwd->deleteLater(); 2409 2409 2410 2410 if (ok) 2411 2411 { -
mythtv/libs/libmyth/settings.cpp
1488 1488 return dialog; 1489 1489 } 1490 1490 1491 intConfigurationDialog::exec(bool saveOnAccept, bool doLoad)1491 DialogCode ConfigurationDialog::exec(bool saveOnAccept, bool doLoad) 1492 1492 { 1493 1493 if (doLoad) 1494 1494 load(); … … 1498 1498 1499 1499 dialog->Show(); 1500 1500 1501 intret = dialog->exec();1501 DialogCode ret = dialog->exec(); 1502 1502 1503 1503 if ((QDialog::Accepted == ret) && saveOnAccept) 1504 1504 save(); … … 2086 2086 label->setText(str); 2087 2087 } 2088 2088 2089 intConfigurationPopupDialog::exec(bool saveOnAccept)2089 DialogCode ConfigurationPopupDialog::exec(bool saveOnAccept) 2090 2090 { 2091 2091 storage->load(); 2092 2092 … … 2094 2094 dialogWidget(gContext->GetMainWindow(), "ConfigurationPopupDialog"); 2095 2095 dialog->ShowPopup(this); 2096 2096 2097 intret = dialog->exec();2097 DialogCode ret = dialog->exec(); 2098 2098 2099 2099 if ((QDialog::Accepted == ret) && saveOnAccept) 2100 2100 storage->save(); -
mythtv/libs/libmyth/mythdialogs.cpp
39 39 #include "screensaver.h" 40 40 #include "mythdbcon.h" 41 41 42 /** \class MythDialog 43 * \brief Base dialog for most dialogs in MythTV using the old UI 44 */ 45 42 46 MythDialog::MythDialog(MythMainWindow *parent, const char *name, bool setsize) 43 : QFrame(parent, name)47 : QFrame(parent, name), rescode(kDialogCodeAccepted) 44 48 { 45 rescode = 0;46 47 49 if (!parent) 48 50 { 49 51 cerr << "Trying to create a dialog without a parent.\n"; … … 79 81 80 82 void MythDialog::deleteLater(void) 81 83 { 84 hide(); 82 85 TeardownAll(); 83 86 QFrame::deleteLater(); 84 87 } … … 114 117 show(); 115 118 } 116 119 120 void MythDialog::setResult(DialogCode r) 121 { 122 if ((r < kDialogCodeRejected) || 123 ((kDialogCodeAccepted < r) && (r < kDialogCodeListStart))) 124 { 125 VERBOSE(VB_IMPORTANT, "Programmer Error: MythDialog::setResult(" 126 <<r<<") called with invalid DialogCode"); 127 } 128 129 rescode = r; 130 } 131 117 132 void MythDialog::done(int r) 118 133 { 119 134 hide(); 120 setResult( r);135 setResult((DialogCode) r); 121 136 close(); 122 137 } 123 138 124 139 void MythDialog::AcceptItem(int i) 125 140 { 126 done(ListStart + i); 141 if (i < 0) 142 { 143 VERBOSE(VB_IMPORTANT, "Programmer Error: MythDialog::AcceptItem(" 144 <<i<<") called with negative index"); 145 reject(); 146 return; 147 } 148 149 done((DialogCode)((int)kDialogCodeListStart + (int)i)); 127 150 } 128 151 152 int MythDialog::CalcItemIndex(DialogCode code) 153 { 154 return (int)code - (int)kDialogCodeListStart; 155 } 156 129 157 void MythDialog::accept() 130 158 { 131 159 done(Accepted); … … 136 164 done(Rejected); 137 165 } 138 166 139 int MythDialog::exec()167 DialogCode MythDialog::exec(void) 140 168 { 141 169 if (in_loop) 142 170 { 143 171 qWarning("MythDialog::exec: Recursive call detected."); 144 return -1;172 return kDialogCodeRejected; 145 173 } 146 174 147 setResult( Rejected);175 setResult(kDialogCodeRejected); 148 176 149 177 Show(); 150 178 151 179 in_loop = TRUE; 152 180 qApp->enter_loop(); 153 181 154 intres = result();182 DialogCode res = result(); 155 183 156 184 return res; 157 185 } … … 212 240 } 213 241 } 214 242 243 /** \class MythPopupBox 244 * \brief Child of MythDialog used for most popup menus in MythTV 245 * 246 * Most users of this class just call one of the static functions 247 * These create a dialog and block until it returns with a DialogCode. 248 * 249 * When creating an instance yourself and using ExecPopup() or 250 * ShowPopup() you can optionally pass it a target and slot for 251 * the popupDone(int) signal. It will be sent with the DialogCode 252 * that the exec function returns, except it is cast to an int. 253 * This is most useful for ShowPopup() which doesn't block or 254 * return the result() when the popup is finished. 255 */ 256 215 257 MythPopupBox::MythPopupBox(MythMainWindow *parent, const char *name) 216 258 : MythDialog(parent, name, false) 217 259 { … … 464 506 MythDialog::keyPressEvent(e); 465 507 } 466 508 509 void MythPopupBox::AcceptItem(int i) 510 { 511 MythDialog::AcceptItem(i); 512 emit popupDone(rescode); 513 } 514 467 515 void MythPopupBox::accept(void) 468 516 { 469 517 MythDialog::done(MythDialog::Accepted); … … 476 524 emit popupDone(MythDialog::Rejected); 477 525 } 478 526 479 intMythPopupBox::ExecPopup(QObject *target, const char *slot)527 DialogCode MythPopupBox::ExecPopup(QObject *target, const char *slot) 480 528 { 481 529 if (!target) 482 ShowPopup(this, SLOT(d efaultExitHandler(int)));530 ShowPopup(this, SLOT(done(int))); 483 531 else 484 532 ShowPopup(target, slot); 485 533 486 534 return exec(); 487 535 } 488 536 489 intMythPopupBox::ExecPopupAtXY(int destx, int desty,490 QObject *target, const char *slot)537 DialogCode MythPopupBox::ExecPopupAtXY(int destx, int desty, 538 QObject *target, const char *slot) 491 539 { 492 540 if (!target) 493 ShowPopupAtXY(destx, desty, this, SLOT(d efaultExitHandler(int)));541 ShowPopupAtXY(destx, desty, this, SLOT(done(int))); 494 542 else 495 543 ShowPopupAtXY(destx, desty, target, slot); 496 544 … … 525 573 } 526 574 if (foundbutton) 527 575 { 528 done(i);576 AcceptItem(i); 529 577 return; 530 578 } 531 579 … … 552 600 } 553 601 if (foundbutton) 554 602 { 555 done(i);603 AcceptItem(i); 556 604 return; 557 605 } 558 606 559 607 VERBOSE(VB_IMPORTANT, "MythPopupBox::defaultButtonPressedHandler(void)" 560 608 "\n\t\t\tWe should never get here!"); 561 done( Rejected);609 done(kDialogCodeRejected); 562 610 } 563 611 564 void MythPopupBox::defaultExitHandler(int r) 565 { 566 done(r); 567 } 568 569 static int show_ok_popup( 612 bool MythPopupBox::showOkPopup( 570 613 MythMainWindow *parent, 571 614 const QString &title, 572 615 const QString &message, 573 QString button_msg = QString::null)616 QString button_msg) 574 617 { 575 618 if (button_msg.isEmpty()) 576 619 button_msg = QObject::tr("OK"); … … 580 623 popup->addLabel(message, MythPopupBox::Medium, true); 581 624 QButton *okButton = popup->addButton(button_msg, popup, SLOT(accept())); 582 625 okButton->setFocus(); 583 int ret = popup->ExecPopup();626 bool ret = (kDialogCodeAccepted == popup->ExecPopup()); 584 627 585 628 popup->hide(); 586 629 popup->deleteLater(); … … 588 631 return ret; 589 632 } 590 633 591 void MythPopupBox::showOkPopup(MythMainWindow *parent, QString title,592 QString message)593 {594 show_ok_popup(parent, title, message);595 }596 597 void MythPopupBox::showExitPopup(MythMainWindow *parent, QString title,598 QString message)599 {600 show_ok_popup(parent, title, message, tr("Exit"));601 }602 603 634 bool MythPopupBox::showOkCancelPopup(MythMainWindow *parent, QString title, 604 635 QString message, bool focusOk) 605 636 { … … 651 682 return ok; 652 683 } 653 684 654 655 int MythPopupBox::show2ButtonPopup(MythMainWindow *parent, QString title, 656 QString message, QString button1msg, 657 QString button2msg, int defvalue) 685 DialogCode MythPopupBox::ShowButtonPopup( 686 MythMainWindow *parent, 687 const QString &title, 688 const QString &message, 689 const QStringList &buttonmsgs, 690 DialogCode default_button) 658 691 { 659 692 MythPopupBox *popup = new MythPopupBox(parent, title); 660 693 661 694 popup->addLabel(message, Medium, true); 662 695 popup->addLabel(""); 663 696 664 QButton *but1 = popup->addButton(button1msg); 665 QButton *but2 = popup->addButton(button2msg); 666 667 if (defvalue == 1) 668 but1->setFocus(); 669 else 670 but2->setFocus(); 671 672 int ret = popup->ExecPopup(); 673 674 popup->hide(); 675 popup->deleteLater(); 676 677 return ret; 678 } 679 680 int MythPopupBox::showButtonPopup(MythMainWindow *parent, QString title, 681 QString message, QStringList buttonmsgs, 682 int defvalue) 683 { 684 MythPopupBox *popup = new MythPopupBox(parent, title); 685 686 popup->addLabel(message, Medium, true); 687 popup->addLabel(""); 688 697 const uint def = CalcItemIndex(default_button); 689 698 for (unsigned int i = 0; i < buttonmsgs.size(); i++ ) 690 699 { 691 700 QButton *but = popup->addButton(buttonmsgs[i]); 692 if (def value == (int)i)701 if (def == i) 693 702 but->setFocus(); 694 703 } 695 704 696 intret = popup->ExecPopup();705 DialogCode ret = popup->ExecPopup(); 697 706 698 707 popup->hide(); 699 708 popup->deleteLater(); … … 757 766 qApp->processEvents(); 758 767 } 759 768 769 MythProgressDialog::~MythProgressDialog() 770 { 771 Teardown(); 772 } 773 774 void MythProgressDialog::deleteLater(void) 775 { 776 hide(); 777 Teardown(); 778 MythDialog::deleteLater(); 779 } 780 781 void MythProgressDialog::Teardown(void) 782 { 783 if (textItems) 784 { 785 delete textItems; 786 textItems = NULL; 787 } 788 } 789 760 790 void MythProgressDialog::Close(void) 761 791 { 762 792 accept(); 763 793 764 if (textItems) 794 LCD *lcddev = LCD::Get(); 795 if (lcddev) 765 796 { 766 LCD * lcddev = LCD::Get();767 797 lcddev->switchToNothing(); 768 798 lcddev->switchToTime(); 769 delete textItems;770 799 } 771 800 } 772 801 … … 817 846 818 847 MythBusyDialog::~MythBusyDialog() 819 848 { 849 Teardown(); 850 } 851 852 void MythBusyDialog::deleteLater(void) 853 { 854 Teardown(); 855 MythProgressDialog::deleteLater(); 856 } 857 858 void MythBusyDialog::Teardown(void) 859 { 820 860 if (timer) 821 861 { 822 862 timer->disconnect(); 823 863 timer->deleteLater(); 824 864 timer = NULL; 825 865 } 826 827 if (LCD *lcddev = LCD::Get())828 lcddev->switchToTime();829 866 } 830 867 831 868 void MythBusyDialog::start(int interval) … … 881 918 .arg(window_name).arg(theme_filename); 882 919 MythPopupBox::showOkPopup(gContext->GetMainWindow(), 883 920 tr("Missing UI Element"), msg); 884 done(-1);921 reject(); 885 922 return; 886 923 } 887 924 } … … 1895 1932 if (the_text == target_text) 1896 1933 { 1897 1934 *success_flag = true; 1898 done(0);1935 accept(); 1899 1936 } 1900 1937 else 1901 1938 { … … 1926 1963 listbox = new MythListBox(this); 1927 1964 listbox->setScrollBar(false); 1928 1965 listbox->setBottomScrollBar(false); 1929 connect(listbox, SIGNAL(accepted(int)), this, SLOT( itemSelected(int)));1966 connect(listbox, SIGNAL(accepted(int)), this, SLOT(AcceptItem(int))); 1930 1967 addWidget(listbox); 1931 1932 ok_button = addButton(tr("OK"), this, SLOT(okPressed()));1933 cancel_button = addButton(tr("Cancel"), this, SLOT( cancelPressed()));1968 1969 ok_button = addButton(tr("OK"), this, SLOT(accept())); 1970 cancel_button = addButton(tr("Cancel"), this, SLOT(reject())); 1934 1971 } 1935 1972 1936 1973 void MythSearchDialog::keyPressEvent(QKeyEvent *e) … … 1945 1982 if (action == "ESCAPE") 1946 1983 { 1947 1984 handled = true; 1948 done(-1);1985 reject(); 1949 1986 } 1950 1987 if (action == "LEFT") 1951 1988 { … … 1960 1997 if (action == "SELECT") 1961 1998 { 1962 1999 handled = true; 1963 done(0);2000 accept(); 1964 2001 } 1965 2002 } 1966 2003 } … … 1968 2005 MythPopupBox::keyPressEvent(e); 1969 2006 } 1970 2007 1971 void MythSearchDialog::itemSelected(int index)1972 {1973 (void)index;1974 done(0);1975 }1976 1977 2008 void MythSearchDialog::setCaption(QString text) 1978 2009 { 1979 2010 caption->setText(text); … … 2002 2033 searchTextChanged(); 2003 2034 } 2004 2035 2005 void MythSearchDialog::okPressed(void)2036 MythSearchDialog::~MythSearchDialog() 2006 2037 { 2007 done(0);2038 Teardown(); 2008 2039 } 2009 2040 2010 void MythSearchDialog:: cancelPressed(void)2041 void MythSearchDialog::deleteLater(void) 2011 2042 { 2012 done(-1);2043 Teardown(); 2013 2044 } 2014 2045 2015 MythSearchDialog::~MythSearchDialog()2046 void MythSearchDialog::Teardown(void) 2016 2047 { 2017 if (listbox) 2018 { 2019 delete listbox; 2020 listbox = NULL; 2021 } 2022 2023 if (editor) 2024 { 2025 delete editor; 2026 editor = NULL; 2027 } 2048 listbox = NULL; // deleted by Qt 2049 editor = NULL; // deleted by Qt 2028 2050 } 2029 2051 2030 2052 /* … … 2074 2096 "element. \n\nReturning to the previous menu.")); 2075 2097 MythPopupBox::showOkPopup(gContext->GetMainWindow(), 2076 2098 tr("Missing UI Element"), msg); 2077 done(-1);2099 reject(); 2078 2100 return; 2079 2101 } 2080 2102 … … 2109 2131 "\n\nReturning to the previous menu.")); 2110 2132 MythPopupBox::showOkPopup(gContext->GetMainWindow(), 2111 2133 tr("Missing UI Element"), msg); 2112 done(-1);2134 reject(); 2113 2135 return; 2114 2136 } 2115 2137 … … 2316 2338 if (type > -1) 2317 2339 { 2318 2340 *selected_file = image_files[type]; 2319 done(0);2341 accept(); 2320 2342 } 2321 2343 } 2322 2344 … … 2342 2364 VERBOSE(VB_IMPORTANT, 2343 2365 "MythScrollDialog: Programmer error, trying to create " 2344 2366 "a dialog without a parent."); 2345 done( -1);2367 done(kDialogCodeRejected); 2346 2368 return; 2347 2369 } 2348 2370 2349 2371 m_parent = parent; 2350 2372 m_scrollMode = mode; 2351 2373 2352 m_resCode = 0;2374 m_resCode = kDialogCodeRejected; 2353 2375 m_inLoop = false; 2354 2376 2355 2377 gContext->GetScreenSettings(m_xbase, m_screenWidth, m_wmult, … … 2444 2466 m_screenHeight*areaHTimes); 2445 2467 } 2446 2468 2447 int MythScrollDialog::result() const2469 DialogCode MythScrollDialog::result(void) const 2448 2470 { 2449 2471 return m_resCode; 2450 2472 } … … 2468 2490 } 2469 2491 } 2470 2492 2471 int MythScrollDialog::exec()2493 DialogCode MythScrollDialog::exec(void) 2472 2494 { 2473 2495 if (m_inLoop) 2474 2496 { 2475 2497 std::cerr << "MythScrollDialog::exec: Recursive call detected." 2476 2498 << std::endl; 2477 return -1;2499 return kDialogCodeRejected; 2478 2500 } 2479 2501 2480 setResult( Rejected);2502 setResult(kDialogCodeRejected); 2481 2503 2482 2504 show(); 2483 2505 2484 2506 m_inLoop = true; 2485 2507 qApp->enter_loop(); 2486 2508 2487 intres = result();2509 DialogCode res = result(); 2488 2510 2489 2511 return res; 2490 2512 } … … 2492 2514 void MythScrollDialog::done(int r) 2493 2515 { 2494 2516 hide(); 2495 setResult( r);2517 setResult((DialogCode)r); 2496 2518 close(); 2497 2519 } 2498 2520 2499 2521 void MythScrollDialog::accept() 2500 2522 { 2501 done( Accepted);2523 done(kDialogCodeAccepted); 2502 2524 } 2503 2525 2504 2526 void MythScrollDialog::reject() 2505 2527 { 2506 done( Rejected);2528 done(kDialogCodeRejected); 2507 2529 } 2508 2530 2509 void MythScrollDialog::setResult( intr)2531 void MythScrollDialog::setResult(DialogCode r) 2510 2532 { 2511 2533 m_resCode = r; 2512 2534 } -
mythtv/libs/libmyth/mythwidgets.cpp
16 16 #include "virtualkeyboard.h" 17 17 #include "libmythui/mythmainwindow.h" 18 18 19 typedef VirtualKeyboard* QWidgetP; 20 static void qt_delete(QWidgetP &widget) 21 { 22 if (widget) 23 { 24 widget->disconnect(); 25 widget->hide(); 26 widget->deleteLater(); 27 widget = NULL; 28 } 29 } 30 31 MythComboBox::MythComboBox(bool rw, QWidget *parent, const char *name) : 32 QComboBox(rw, parent, name), 33 popup(NULL), helptext(QString::null), AcceptOnSelect(false), 34 useVirtualKeyboard(true), allowVirtualKeyboard(rw), 35 popupPosition(VK_POSBELOWEDIT), step(1) 36 { 37 useVirtualKeyboard = gContext->GetNumSetting("UseVirtualKeyboard", 1); 38 } 39 19 40 MythComboBox::~MythComboBox() 20 41 { 21 if (popup) 22 delete popup; 42 Teardown(); 23 43 } 24 44 25 void MythComboBox:: Init()45 void MythComboBox::deleteLater(void) 26 46 { 27 popup = NULL;28 popupPosition = VK_POSBELOWEDIT;47 Teardown(); 48 QComboBox::deleteLater(); 29 49 } 30 50 51 void MythComboBox::Teardown(void) 52 { 53 qt_delete(popup); 54 } 55 56 void MythComboBox::popupVirtualKeyboard(void) 57 { 58 qt_delete(popup); 59 60 popup = new VirtualKeyboard(gContext->GetMainWindow(), this); 61 gContext->GetMainWindow()->detach(popup); 62 popup->exec(); 63 64 qt_delete(popup); 65 } 66 67 31 68 void MythComboBox::keyPressEvent(QKeyEvent *e) 32 69 { 33 70 bool handled = false; … … 73 110 else if (action == "SELECT" && AcceptOnSelect) 74 111 emit accepted(currentItem()); 75 112 else if (action == "SELECT" && 76 (e->text().is Null() ||113 (e->text().isEmpty() || 77 114 (e->key() == Qt::Key_Enter) || 78 115 (e->key() == Qt::Key_Return) || 79 116 (e->key() == Qt::Key_Space))) 80 117 { 81 if ((allowVirtualKeyboard) && (gContext->GetNumSetting("UseVirtualKeyboard", 1) == 1)) 82 { 83 popup = new VirtualKeyboard(gContext->GetMainWindow(), this); 84 gContext->GetMainWindow()->detach(popup); 85 popup->exec(); 86 delete popup; 87 popup = NULL; 88 } 118 if (useVirtualKeyboard && allowVirtualKeyboard) 119 popupVirtualKeyboard(); 89 120 else 90 121 handled = true; 91 122 } … … 354 385 QSlider::focusOutEvent(e); 355 386 } 356 387 388 MythLineEdit::MythLineEdit(QWidget *parent, const char* widgetName) : 389 QLineEdit(parent, widgetName), 390 popup(NULL), helptext(QString::null), rw(true), 391 useVirtualKeyboard(true), 392 allowVirtualKeyboard(true), 393 popupPosition(VK_POSBELOWEDIT) 394 { 395 useVirtualKeyboard = gContext->GetNumSetting("UseVirtualKeyboard", 1); 396 } 397 398 MythLineEdit::MythLineEdit( 399 const QString &contents, QWidget *parent, const char* widgetName) : 400 QLineEdit(contents, parent, widgetName), 401 popup(NULL), helptext(QString::null), rw(true), 402 useVirtualKeyboard(true), 403 allowVirtualKeyboard(true), 404 popupPosition(VK_POSBELOWEDIT) 405 { 406 useVirtualKeyboard = gContext->GetNumSetting("UseVirtualKeyboard", 1); 407 } 408 357 409 MythLineEdit::~MythLineEdit() 358 410 { 359 if (popup) 360 delete popup; 411 Teardown(); 361 412 } 362 413 363 void MythLineEdit:: Init()414 void MythLineEdit::deleteLater(void) 364 415 { 365 popup = NULL;366 popupPosition = VK_POSBELOWEDIT;416 Teardown(); 417 QLineEdit::deleteLater(); 367 418 } 368 419 420 void MythLineEdit::Teardown(void) 421 { 422 qt_delete(popup); 423 } 424 425 void MythLineEdit::popupVirtualKeyboard(void) 426 { 427 qt_delete(popup); 428 429 popup = new VirtualKeyboard(gContext->GetMainWindow(), this); 430 gContext->GetMainWindow()->detach(popup); 431 popup->exec(); 432 433 qt_delete(popup); 434 } 435 369 436 void MythLineEdit::keyPressEvent(QKeyEvent *e) 370 437 { 371 438 bool handled = false; … … 383 450 else if (action == "DOWN") 384 451 focusNextPrevChild(true); 385 452 else if (action == "SELECT" && 386 (e->text().is Null() ||453 (e->text().isEmpty() || 387 454 (e->key() == Qt::Key_Enter) || 388 455 (e->key() == Qt::Key_Return))) 389 456 { 390 if ((allowVirtualKeyboard) && rw && 391 (gContext->GetNumSetting("UseVirtualKeyboard", 1) == 1)) 392 { 393 popup = new VirtualKeyboard(gContext->GetMainWindow(), this); 394 gContext->GetMainWindow()->detach(popup); 395 popup->exec(); 396 delete popup; 397 popup = NULL; 398 } 457 if (useVirtualKeyboard && allowVirtualKeyboard && rw) 458 popupVirtualKeyboard(); 399 459 } 400 else if (action == "SELECT" && e->text().is Null() )460 else if (action == "SELECT" && e->text().isEmpty() ) 401 461 e->ignore(); 402 462 else 403 463 handled = false; … … 409 469 QLineEdit::keyPressEvent(e); 410 470 } 411 471 412 void MythLineEdit::setText(const QString & text)472 void MythLineEdit::setText(const QString &text) 413 473 { 414 474 // Don't mess with the cursor position; it causes 415 475 // counter-intuitive behaviour due to interactions with the 416 476 // communication with the settings stuff 417 477 418 478 int pos = cursorPosition(); 419 QLineEdit::setText( text);479 QLineEdit::setText(QDeepCopy<QString>(text)); 420 480 setCursorPosition(pos); 421 481 } 422 482 483 QString MythLineEdit::text(void) 484 { 485 return QDeepCopy<QString>(QLineEdit::text()); 486 } 487 423 488 void MythLineEdit::focusInEvent(QFocusEvent *e) 424 489 { 425 490 emit changeHelpText(helptext); … … 531 596 connect(cycle_timer, SIGNAL(timeout()), this, SLOT(endCycle())); 532 597 533 598 popup = NULL; 599 useVirtualKeyboard = gContext->GetNumSetting("UseVirtualKeyboard", 1); 534 600 popupPosition = VK_POSBELOWEDIT; 535 601 } 536 602 … … 728 794 // of MythLineEdit, and I'm sure he had 729 795 // a reason ... 730 796 getCursorPosition(¶, &pos); 731 QTextEdit::setText( text);797 QTextEdit::setText(QDeepCopy<QString>(text)); 732 798 setCursorPosition(para, pos); 733 799 } 734 800 801 QString MythRemoteLineEdit::text(void) 802 { 803 return QDeepCopy<QString>(QTextEdit::text()); 804 } 805 735 806 void MythRemoteLineEdit::keyPressEvent(QKeyEvent *e) 736 807 { 737 808 bool handled = false; … … 763 834 } 764 835 else if ((action == "SELECT") && 765 836 (!active_cycle) && 766 ((e->text().is Null()) ||837 ((e->text().isEmpty()) || 767 838 (e->key() == Qt::Key_Enter) || 768 839 (e->key() == Qt::Key_Return))) 769 840 { 770 if (gContext->GetNumSetting("UseVirtualKeyboard", 1) == 1) 771 { 772 popup = new VirtualKeyboard(gContext->GetMainWindow(), this); 773 gContext->GetMainWindow()->detach(popup); 774 popup->exec(); 775 delete popup; 776 popup = NULL; 777 } 778 841 if (useVirtualKeyboard) 842 popupVirtualKeyboard(); 779 843 } 780 844 else 781 845 handled = false; … … 973 1037 QTextEdit::focusOutEvent(e); 974 1038 } 975 1039 976 977 1040 MythRemoteLineEdit::~MythRemoteLineEdit() 978 1041 { 1042 Teardown(); 1043 } 1044 1045 void MythRemoteLineEdit::deleteLater(void) 1046 { 1047 Teardown(); 1048 QTextEdit::deleteLater(); 1049 } 1050 1051 void MythRemoteLineEdit::Teardown(void) 1052 { 979 1053 if (cycle_timer) 980 1054 { 981 delete cycle_timer; 1055 cycle_timer->disconnect(); 1056 cycle_timer->deleteLater(); 1057 cycle_timer = NULL; 982 1058 } 983 1059 984 if (popup) 985 delete popup; 1060 qt_delete(popup); 986 1061 } 987 1062 1063 void MythRemoteLineEdit::popupVirtualKeyboard(void) 1064 { 1065 qt_delete(popup); 1066 1067 popup = new VirtualKeyboard(gContext->GetMainWindow(), this); 1068 gContext->GetMainWindow()->detach(popup); 1069 popup->exec(); 1070 1071 qt_delete(popup); 1072 } 1073 988 1074 void MythRemoteLineEdit::insert(QString text) 989 1075 { 990 1076 QTextEdit::insert(text); -
mythtv/libs/libmyth/dialogbox.cpp
59 59 void DialogBox::buttonPressed(int which) 60 60 { 61 61 if (buttongroup->find(which) != checkbox) 62 done(which + 1);62 AcceptItem(which); 63 63 } -
mythtv/libs/libmyth/uilistbtntype.cpp
1503 1503 searchEdit->setFocus(); 1504 1504 1505 1505 popup->addButton(tr("Search")); 1506 popup->addButton(tr("Cancel") );1506 popup->addButton(tr("Cancel"), popup, SLOT(reject())); 1507 1507 1508 intres = popup->ExecPopup();1508 DialogCode res = popup->ExecPopup(); 1509 1509 1510 if ( res == 0)1510 if (kDialogCodeButton0 == res) 1511 1511 { 1512 1512 m_incSearch = searchEdit->text(); 1513 1513 m_bIncSearchContains = (modeCombo->currentItem() == 1); … … 1517 1517 popup->hide(); 1518 1518 popup->deleteLater(); 1519 1519 1520 return ( res == 0);1520 return (kDialogCodeButton0 == res); 1521 1521 } 1522 1522 1523 1523 bool UIListBtnType::incSearchNext(void) -
mythtv/libs/libmyth/uitypes.cpp
2850 2850 { 2851 2851 if (edit) 2852 2852 { 2853 delete edit; 2853 edit->hide(); 2854 edit->deleteLater(); 2854 2855 edit = NULL; 2855 2856 } 2856 2857 } … … 4334 4335 popup->addButton(tr("Search")); 4335 4336 popup->addButton(tr("Cancel")); 4336 4337 4337 intres = popup->ExecPopup();4338 DialogCode res = popup->ExecPopup(); 4338 4339 4339 if ( res == 0)4340 if (kDialogCodeButton0 == res) 4340 4341 { 4341 4342 incSearch = searchEdit->text(); 4342 4343 bIncSearchContains = (modeCombo->currentItem() == 1); … … 4346 4347 popup->hide(); 4347 4348 popup->deleteLater(); 4348 4349 4349 return ( res == 0);4350 return (kDialogCodeButton0 == res); 4350 4351 } 4351 4352 4352 4353 bool UIManagedTreeListType::incSearchNext(void) … … 5947 5948 if (!m_parentDialog) 5948 5949 return; 5949 5950 5950 m_parentDialog->done( 0);5951 m_parentDialog->done(kDialogCodeAccepted); 5951 5952 } 5952 5953 5953 5954 void UIKeyboardType::updateButtons() -
mythtv/libs/libmyth/mythcontext.cpp
1767 1767 if (caching) 1768 1768 { 1769 1769 caching->Close(); 1770 delete caching;1770 caching->deleteLater(); 1771 1771 } 1772 1772 } 1773 1773 … … 3060 3060 } 3061 3061 3062 3062 if (returnValue == MYTH_SCHEMA_ERROR) 3063 MythPopupBox::showExitPopup(d->mainWindow, 3064 "Database Upgrade Error", message); 3063 { 3064 MythPopupBox::showOkPopup( 3065 d->mainWindow, "Database Upgrade Error", 3066 message, QObject::tr("Exit")); 3067 } 3065 3068 else 3066 3069 { 3067 3070 QStringList buttonNames; 3068 int selected;3069 3071 3070 3072 buttonNames += QObject::tr("Exit"); 3071 3073 buttonNames += QObject::tr("Upgrade"); 3072 3074 if (expertMode) 3073 3075 buttonNames += QObject::tr("Use current schema"); 3074 3076 3075 selected = MythPopupBox::showButtonPopup(d->mainWindow, 3076 "Database Upgrade", 3077 message, buttonNames, -1); 3077 DialogCode selected = MythPopupBox::ShowButtonPopup( 3078 d->mainWindow, "Database Upgrade", message, 3079 buttonNames, kDialogCodeButton0); 3080 3078 3081 // The annoying extra confirmation: 3079 if ( selected == 1)3082 if (kDialogCodeButton1 == selected) 3080 3083 { 3081 3084 message = tr("This cannot be un-done, so having a" 3082 3085 " database backup would be a good idea."); 3083 3086 if (connections) 3084 3087 message += "\n\n" + warnOtherCl; 3085 3088 3086 selected = MythPopupBox::showButtonPopup(d->mainWindow, 3087 "Database Upgrade", 3088 message, 3089 buttonNames, -1); 3089 selected = MythPopupBox::ShowButtonPopup( 3090 d->mainWindow, "Database Upgrade", message, 3091 buttonNames, kDialogCodeButton0); 3090 3092 } 3091 3093 3092 3094 switch (selected) 3093 3095 { 3094 case 0: returnValue = MYTH_SCHEMA_EXIT; break; 3095 case 1: returnValue = MYTH_SCHEMA_UPGRADE; break; 3096 case 2: returnValue = MYTH_SCHEMA_USE_EXISTING; break; 3097 default: returnValue = MYTH_SCHEMA_ERROR; 3096 case kDialogCodeRejected: 3097 case kDialogCodeButton0: 3098 returnValue = MYTH_SCHEMA_EXIT; break; 3099 case kDialogCodeButton1: 3100 returnValue = MYTH_SCHEMA_UPGRADE; break; 3101 case kDialogCodeButton2: 3102 returnValue = MYTH_SCHEMA_USE_EXISTING; break; 3103 default: 3104 returnValue = MYTH_SCHEMA_ERROR; 3098 3105 } 3099 3106 } 3100 3107 … … 3162 3169 3163 3170 if (GetMainWindow() && !d->disablelibrarypopup) 3164 3171 { 3165 DialogBox dbox(gContext->GetMainWindow(), err); 3166 dbox.AddButton("OK"); 3167 dbox.exec(); 3172 DialogBox *dlg = new DialogBox(gContext->GetMainWindow(), err); 3173 dlg->AddButton("OK"); 3174 dlg->exec(); 3175 dlg->deleteLater(); 3168 3176 } 3169 3177 3170 3178 return false; -
mythtv/libs/libmyth/mythcontext.h
209 209 210 210 /// Update this whenever the plug-in API changes. 211 211 /// Including changes in the libmythtv class methods used by plug-ins. 212 #define MYTH_BINARY_VERSION "0.21.200711 07-2"212 #define MYTH_BINARY_VERSION "0.21.20071110-1" 213 213 214 214 /** \brief Increment this whenever the MythTV network protocol changes. 215 215 * -
mythtv/libs/libmyth/settings.h
1153 1153 virtual MythDialog *dialogWidget( 1154 1154 MythMainWindow *parent, const char* widgetName); 1155 1155 1156 intexec(bool saveOnAccept = true);1156 virtual DialogCode exec(bool saveOnAccept = true); 1157 1157 1158 1158 virtual void setLabel(QString str); 1159 1159 … … 1206 1206 const char *widgetName); 1207 1207 1208 1208 // Show a dialogWidget, and save if accepted 1209 virtual intexec(bool saveOnExec = true, bool doLoad = true);1209 virtual DialogCode exec(bool saveOnExec = true, bool doLoad = true); 1210 1210 1211 1211 virtual void load(void) { cfgGrp->load(); } 1212 1212 virtual void save(void) { cfgGrp->save(); } -
mythtv/libs/libmyth/mythmediamonitor.cpp
144 144 return drives.front(); 145 145 } 146 146 147 MythPopupBox *popup = new MythPopupBox( 148 gContext->GetMainWindow(), "select drive"); 149 150 popup->addLabel(label); 147 QStringList buttonmsgs; 151 148 for (it = drives.begin(); it != drives.end(); ++it) 152 popup->addButton(DevName(*it)); 149 buttonmsgs += DevName(*it); 150 buttonmsgs += tr("Cancel"); 151 const DialogCode cancelbtn = (DialogCode) 152 (((int)kDialogCodeButton0) + buttonmsgs.size() - 1); 153 153 154 popup->addButton(tr("Cancel"))->setFocus(); 154 DialogCode ret = MythPopupBox::ShowButtonPopup( 155 gContext->GetMainWindow(), "select drive", label, 156 buttonmsgs, cancelbtn); 155 157 156 int ret = popup->ExecPopup();157 popup->hide();158 popup->deleteLater();159 160 158 // If the user cancelled, return a special value 161 if ( ret < 0)159 if ((kDialogCodeRejected == ret) || (cancelbtn == ret)) 162 160 return (MythMediaDevice *)-1; 163 161 164 if ((uint)ret < drives.count()) 165 return drives[ret]; 162 uint idx = MythDialog::CalcItemIndex(ret); 163 if (idx < drives.count()) 164 return drives[idx]; 166 165 167 166 return NULL; 168 167 } -
mythtv/libs/libmyth/mythdialogs.h
50 50 51 51 #include "libmythui/mythmainwindow.h" 52 52 53 typedef enum DialogCode 54 { 55 kDialogCodeRejected = QDialog::Rejected, 56 kDialogCodeAccepted = QDialog::Accepted, 57 kDialogCodeListStart = 0x10, 58 kDialogCodeButton0 = 0x10, 59 kDialogCodeButton1 = 0x11, 60 kDialogCodeButton2 = 0x12, 61 kDialogCodeButton3 = 0x13, 62 kDialogCodeButton4 = 0x14, 63 kDialogCodeButton5 = 0x15, 64 kDialogCodeButton6 = 0x16, 65 kDialogCodeButton7 = 0x17, 66 kDialogCodeButton8 = 0x18, 67 kDialogCodeButton9 = 0x19, 68 } DialogCode; 69 70 inline bool operator==(const DialogCode &a, const QDialog::DialogCode &b) 71 { return ((int)a) == ((int)b); } 72 inline bool operator==(const QDialog::DialogCode &a, const DialogCode &b) 73 { return ((int)a) == ((int)b); } 74 inline bool operator!=(const DialogCode &a, const QDialog::DialogCode &b) 75 { return ((int)a) == ((int)b); } 76 inline bool operator!=(const QDialog::DialogCode &a, const DialogCode &b) 77 { return ((int)a) == ((int)b); } 78 53 79 class MPUBLIC MythDialog : public QFrame 54 80 { 55 81 Q_OBJECT … … 57 83 MythDialog(MythMainWindow *parent, const char *name = 0, 58 84 bool setsize = true); 59 85 60 enum DialogCode 61 { 62 Rejected = 0, 63 Accepted = 1, 64 ListStart = 0x10, 65 }; 86 // these are for backward compatibility.. 87 static const DialogCode Rejected = kDialogCodeRejected; 88 static const DialogCode Accepted = kDialogCodeAccepted; 89 static const DialogCode ListStart = kDialogCodeListStart; 66 90 67 intresult(void) const { return rescode; }91 DialogCode result(void) const { return rescode; } 68 92 69 93 virtual void Show(void); 70 94 … … 74 98 75 99 virtual bool onMediaEvent(MythMediaDevice * mediadevice); 76 100 77 void setResult( int r) { rescode = r; }101 void setResult(DialogCode r); 78 102 79 103 virtual void deleteLater(void); 80 104 105 static int CalcItemIndex(DialogCode code); 106 81 107 signals: 82 108 void menuButtonPressed(); 83 109 84 110 public slots: 85 int exec(); 86 virtual void done( int ); 87 88 protected slots: 111 DialogCode exec(void); 112 virtual void done(int); // Must be given a valid DialogCode 89 113 virtual void AcceptItem(int); 90 114 virtual void accept(); 91 115 virtual void reject(); … … 102 126 103 127 MythMainWindow *m_parent; 104 128 105 intrescode;129 DialogCode rescode; 106 130 107 131 bool in_loop; 108 132 … … 133 157 void ShowPopupAtXY(int destx, int desty, 134 158 QObject *target = NULL, const char *slot = NULL); 135 159 136 intExecPopup(QObject *target = NULL, const char *slot = NULL);137 intExecPopupAtXY(int destx, int desty,138 QObject *target = NULL, const char *slot = NULL);160 DialogCode ExecPopup(QObject *target = NULL, const char *slot = NULL); 161 DialogCode ExecPopupAtXY(int destx, int desty, 162 QObject *target = NULL, const char *slot = NULL); 139 163 140 static void showOkPopup(MythMainWindow *parent, QString title, 141 QString message); 142 static void showExitPopup(MythMainWindow *parent, QString title, 143 QString message); 164 static bool showOkPopup(MythMainWindow *parent, 165 const QString &title, 166 const QString &message, 167 QString button_msg = QString::null); 168 144 169 static bool showOkCancelPopup(MythMainWindow *parent, QString title, 145 170 QString message, bool focusOk); 146 static int show2ButtonPopup(MythMainWindow *parent, QString title,147 QString message, QString button1msg,148 QString button2msg, int defvalue);149 static int showButtonPopup(MythMainWindow *parent, QString title,150 QString message, QStringList buttonmsgs,151 int defvalue);152 171 172 static DialogCode Show2ButtonPopup( 173 MythMainWindow *parent, 174 const QString &title, const QString &message, 175 const QString &button1msg, const QString &button2msg, 176 DialogCode default_button) 177 { 178 QStringList buttonmsgs; 179 buttonmsgs += (button1msg.isEmpty()) ? 180 QString("Button 1") : button1msg; 181 buttonmsgs += (button2msg.isEmpty()) ? 182 QString("Button 2") : button2msg; 183 return ShowButtonPopup( 184 parent, title, message, buttonmsgs, default_button); 185 } 186 187 static DialogCode ShowButtonPopup( 188 MythMainWindow *parent, 189 const QString &title, const QString &message, 190 const QStringList &buttonmsgs, 191 DialogCode default_button); 192 153 193 static bool showGetTextPopup(MythMainWindow *parent, QString title, 154 194 QString message, QString& text); 155 195 196 public slots: 197 virtual void AcceptItem(int); 156 198 virtual void accept(void); 157 199 virtual void reject(void); 158 200 … … 160 202 virtual void popupDone(int); 161 203 162 204 protected: 205 ~MythPopupBox() {} // use deleteLater() instead for thread safety 163 206 bool focusNextPrevChild(bool next); 164 207 void keyPressEvent(QKeyEvent *e); 165 208 166 209 protected slots: 167 210 void defaultButtonPressedHandler(void); 168 void defaultExitHandler(int);169 211 170 212 private: 171 213 QVBoxLayout *vbox; … … 214 256 215 257 void keyPressEvent(QKeyEvent *); 216 258 259 virtual void deleteLater(void); 260 217 261 protected: 262 void Teardown(void); 263 ~MythProgressDialog(); // use deleteLater() instead for thread safety 218 264 QProgressBar *progress; 219 265 220 266 private: … … 243 289 */ 244 290 MythBusyDialog(const QString &title); 245 291 246 ~MythBusyDialog();247 248 292 /** \brief Setup a timer to 'move' the spinner 249 293 250 294 This will create a \p QTimer object that will update the … … 260 304 */ 261 305 void Close(); 262 306 307 public slots: 308 virtual void deleteLater(void); 309 263 310 protected slots: 264 311 void setProgress(); 265 312 void timeout(); 266 313 314 protected: 315 void Teardown(void); 316 ~MythBusyDialog(); 317 267 318 private: 268 319 QTimer *timer; 269 320 }; … … 278 329 MythThemedDialog(MythMainWindow *parent, const char *name = 0, 279 330 bool setsize = true); 280 331 281 ~MythThemedDialog();282 283 332 virtual bool loadThemedWindow(QString window_name, QString theme_filename); 284 333 virtual void loadWindow(QDomElement &); 285 334 virtual void parseContainer(QDomElement &); … … 328 377 virtual void activateCurrent(); 329 378 330 379 protected: 380 ~MythThemedDialog(); // use deleteLater() instead for thread safety 331 381 332 382 void paintEvent(QPaintEvent* e); 333 383 UIType *widget_with_current_focus; … … 369 419 MythMainWindow *parent, 370 420 const char *name = 0, 371 421 bool setsize = true); 372 ~MythPasswordDialog();373 374 422 public slots: 375 423 376 424 void checkPassword(const QString &); 377 425 378 protected:379 426 protected: 427 ~MythPasswordDialog(); // use deleteLater() instead for thread safety 380 428 void keyPressEvent(QKeyEvent *e); 381 429 382 430 private: … … 393 441 public: 394 442 395 443 MythSearchDialog(MythMainWindow *parent, const char *name = 0); 396 ~MythSearchDialog();397 444 398 445 public: 399 446 void setCaption(QString text); 400 447 void setSearchText(QString text); 401 448 void setItems(QStringList items); 402 449 QString getResult(void); 403 404 protected slots: 405 void okPressed(void); 406 void cancelPressed(void); 450 451 public slots: 452 virtual void deleteLater(void); 453 454 protected slots: 407 455 void searchTextChanged(void); 408 void itemSelected(int index);409 456 410 protected: 457 protected: 458 void Teardown(void); 459 ~MythSearchDialog(); // use deleteLater() instead for thread safety 411 460 void keyPressEvent(QKeyEvent *e); 412 461 413 462 private: … … 439 488 QString theme_filename = "", 440 489 const char *name = 0, 441 490 bool setsize=true); 442 ~MythImageFileDialog();443 444 491 public slots: 445 492 446 493 void handleTreeListSelection(int, IntVector*); … … 449 496 void buildFileList(QString directory); 450 497 451 498 protected: 452 499 ~MythImageFileDialog(); // use deleteLater() instead for thread safety 453 500 void keyPressEvent(QKeyEvent *e); 454 501 455 502 private: … … 472 519 473 520 public: 474 521 475 enum DialogCode {476 Rejected,477 Accepted478 };479 480 522 enum ScrollMode { 481 523 HScroll=0, 482 524 VScroll … … 484 526 485 527 MythScrollDialog(MythMainWindow *parent, ScrollMode mode=HScroll, 486 528 const char *name = 0); 487 ~MythScrollDialog();488 529 489 530 void setArea(int w, int h); 490 531 void setAreaMultiplied(int areaWTimes, int areaHTimes); 491 532 492 int result() const;533 DialogCode result(void) const; 493 534 494 535 public slots: 495 536 496 int exec();537 DialogCode exec(void); 497 538 virtual void done(int); 498 539 virtual void show(); 499 540 virtual void hide(); … … 505 546 virtual void reject(); 506 547 507 548 protected: 508 549 ~MythScrollDialog(); // use deleteLater() instead for thread safety 509 550 void keyPressEvent(QKeyEvent *e); 510 551 virtual void paintEvent(QRegion& region, int x, int y, int w, int h); 511 552 512 void setResult( intr);553 void setResult(DialogCode r); 513 554 void viewportPaintEvent(QPaintEvent *pe); 514 555 515 556 MythMainWindow *m_parent; … … 523 564 QFont m_defaultMediumFont; 524 565 QFont m_defaultSmallFont; 525 566 526 intm_resCode;567 DialogCode m_resCode; 527 568 bool m_inLoop; 528 569 529 570 QPixmap *m_bgPixmap; -
mythtv/libs/libmyth/virtualkeyboard.cpp
51 51 if (!loadThemedWindow("keyboard", "keyboard/en_us_")) 52 52 { 53 53 VERBOSE(VB_IMPORTANT, "VirtualKeyboard: cannot find layout for US English"); 54 done(-1);54 reject(); 55 55 return; 56 56 } 57 57 } … … 63 63 { 64 64 cerr << "VirtualKeyboard: cannot find the 'keyboard_container'" 65 65 " in your theme" << endl; 66 done(-1);66 reject(); 67 67 return; 68 68 } 69 69 … … 162 162 if (!m_keyboard) 163 163 { 164 164 cerr << "VirtualKeyboard: cannot find the UIKeyboardType in your theme" << endl; 165 done(-1);165 reject(); 166 166 return; 167 167 } 168 168 … … 212 212 QString action = actions[i]; 213 213 handled = true; 214 214 if (action == "ESCAPE") 215 done(0);215 accept(); 216 216 else 217 217 handled = false; 218 218 } -
mythtv/libs/libmyth/dialogbox.h
23 23 protected slots: 24 24 void buttonPressed(int which); 25 25 26 protected: 27 ~DialogBox() {} // use deleteLater() for thread safety 28 26 29 private: 27 30 QVBoxLayout *box; 28 31 QButtonGroup *buttongroup; -
mythtv/libs/libmyth/mythwidgets.h
41 41 { 42 42 Q_OBJECT 43 43 public: 44 MythComboBox(bool rw, QWidget* parent=0, const char* name=0): 45 QComboBox(rw, parent, name) { AcceptOnSelect = false; step = 1; 46 allowVirtualKeyboard = rw; Init(); }; 44 MythComboBox(bool rw, QWidget* parent=0, const char* name=0); 47 45 48 virtual ~MythComboBox();49 50 46 void setHelpText(QString help) { helptext = help; } 51 47 void setAcceptOnSelect(bool Accept) { AcceptOnSelect = Accept; } 52 48 void setStep(int _step = 1) { step = _step; } … … 61 57 void gotFocus(); 62 58 63 59 public slots: 60 virtual void deleteLater(void); 64 61 void insertItem(const QString& item) { 65 62 QComboBox::insertItem(item); 66 63 }; 67 64 68 65 protected: 66 void Teardown(void); 67 virtual ~MythComboBox(); // use deleteLater for thread safety 69 68 virtual void keyPressEvent (QKeyEvent *e); 70 69 virtual void focusInEvent(QFocusEvent *e); 71 70 virtual void focusOutEvent(QFocusEvent *e); 72 71 void Init(void); 72 virtual void popupVirtualKeyboard(void); 73 73 74 74 private: 75 75 VirtualKeyboard *popup; 76 76 QString helptext; 77 77 bool AcceptOnSelect; 78 bool useVirtualKeyboard; 78 79 bool allowVirtualKeyboard; 79 80 PopupPosition popupPosition; 80 81 int step; … … 133 134 { 134 135 Q_OBJECT 135 136 public: 136 MythLineEdit(QWidget *parent=NULL, const char* widgetName=0) : 137 QLineEdit(parent, widgetName) 138 { rw = true; allowVirtualKeyboard = true; Init(); }; 137 MythLineEdit(QWidget *parent=NULL, const char* widgetName=0); 138 MythLineEdit(const QString &text, QWidget *p=NULL, const char *name=0); 139 139 140 MythLineEdit(const QString& contents, QWidget *parent=NULL,141 const char* widgetName=0) :142 QLineEdit(contents, parent, widgetName)143 { rw = true; allowVirtualKeyboard = true; Init(); };144 145 virtual ~MythLineEdit();146 147 140 void setHelpText(QString help) { helptext = help; }; 148 141 void setRW(bool readwrite = true) { rw = readwrite; }; 149 142 void setRO() { rw = false; }; … … 152 145 void setPopupPosition(PopupPosition pos) { popupPosition = pos; } 153 146 PopupPosition getPopupPosition(void) { return popupPosition; } 154 147 155 public slots: 156 virtual void setText(const QString& text); 148 virtual QString text(); 157 149 150 public slots: 151 virtual void deleteLater(void); 152 virtual void setText(const QString &text); 153 158 154 signals: 159 155 void changeHelpText(QString); 160 156 161 157 protected: 158 void Teardown(void); 159 virtual ~MythLineEdit(); // use deleteLater for thread safety 160 162 161 virtual void keyPressEvent(QKeyEvent *e); 163 162 virtual void focusInEvent(QFocusEvent *e); 164 163 virtual void focusOutEvent(QFocusEvent *e); 165 164 virtual void hideEvent(QHideEvent *e); 166 165 virtual void mouseDoubleClickEvent(QMouseEvent *e); 167 v oid Init(void);166 virtual void popupVirtualKeyboard(void); 168 167 169 168 private: 170 169 VirtualKeyboard *popup; 171 170 QString helptext; 172 171 bool rw; 172 bool useVirtualKeyboard; 173 173 bool allowVirtualKeyboard; 174 174 PopupPosition popupPosition; 175 175 }; … … 187 187 MythRemoteLineEdit( const QString & contents, QWidget * parent, const char * name = 0 ); 188 188 MythRemoteLineEdit( QFont *a_font, QWidget * parent, const char * name = 0 ); 189 189 MythRemoteLineEdit( int lines, QWidget * parent, const char * name = 0 ); 190 ~MythRemoteLineEdit(); 190 191 191 void setHelpText(QString help) { helptext = help; } 192 192 void setCycleTime(float desired_interval); // in seconds 193 193 void setCharacterColors(QColor unselected, QColor selected, QColor special); … … 197 197 void setPopupPosition(PopupPosition pos) { popupPosition = pos; }; 198 198 PopupPosition getPopupPosition(void) { return popupPosition; }; 199 199 200 virtual QString text(); 201 200 202 signals: 201 203 202 204 void shiftState(bool); … … 208 210 void textChanged(QString); 209 211 210 212 public slots: 211 213 virtual void deleteLater(void); 212 214 virtual void setText(const QString& text); 213 215 214 216 protected: 215 217 void Teardown(void); 218 virtual ~MythRemoteLineEdit(); // use deleteLater for thread safety 216 219 virtual void focusInEvent(QFocusEvent *e); 217 220 virtual void focusOutEvent(QFocusEvent *e); 218 221 virtual void keyPressEvent(QKeyEvent *e); 222 virtual void popupVirtualKeyboard(void); 219 223 220 224 private slots: 221 225 … … 255 259 int m_lines; 256 260 257 261 VirtualKeyboard *popup; 258 PopupPosition popupPosition; 262 bool useVirtualKeyboard; 263 PopupPosition popupPosition; 259 264 }; 260 265 261 266 class MPUBLIC MythTable : public QTable -
mythtv/programs/mythfrontend/playbackbox.cpp
485 485 } 486 486 } 487 487 488 intPlaybackBox::exec(void)488 DialogCode PlaybackBox::exec(void) 489 489 { 490 490 if (recGroup != "") 491 491 return MythDialog::exec(); … … 496 496 return MythDialog::exec(); 497 497 } 498 498 499 return 0;499 return kDialogCodeRejected; 500 500 } 501 501 502 502 /* blocks until playing has stopped */ … … 4557 4557 4558 4558 iconhelp->addLayout(grid); 4559 4559 4560 QButton *button = iconhelp->addButton(tr("Ok")); 4560 QButton *button = iconhelp->addButton( 4561 QObject::tr("OK"), iconhelp, SLOT(accept())); 4561 4562 button->setFocus(); 4562 4563 4563 4564 iconhelp->ExecPopup(); … … 4687 4688 recGroupPopup->addWidget(exitbutton); 4688 4689 connect(exitbutton, SIGNAL(clicked()), recGroupPopup, SLOT(reject())); 4689 4690 4690 intresult = recGroupPopup->ExecPopup();4691 DialogCode result = recGroupPopup->ExecPopup(); 4691 4692 4692 4693 if (result != MythDialog::Rejected) 4693 4694 { … … 4853 4854 connect(recGroupListBox, SIGNAL(currentChanged(QListBoxItem *)), this, 4854 4855 SLOT(recGroupChooserListBoxChanged())); 4855 4856 4856 intresult = recGroupPopup->ExecPopup();4857 DialogCode result = recGroupPopup->ExecPopup(); 4857 4858 4858 4859 if (result != MythDialog::Rejected) 4859 4860 setGroupFilter(); … … 4913 4914 recGroupPassword, 4914 4915 gContext->GetMainWindow()); 4915 4916 pwd->exec(); 4916 delete pwd;4917 pwd->deleteLater(); 4917 4918 if (!ok) 4918 4919 { 4919 4920 recGroupPassword = savedPW; … … 5055 5056 SLOT(recGroupChangerListBoxChanged())); 5056 5057 connect(recGroupOkButton, SIGNAL(clicked()), recGroupPopup, SLOT(accept())); 5057 5058 5058 intresult = recGroupPopup->ExecPopup();5059 DialogCode result = recGroupPopup->ExecPopup(); 5059 5060 5060 5061 if (result != MythDialog::Rejected) 5061 5062 setRecGroup(); … … 5106 5107 connect(recGroupListBox, SIGNAL(accepted(int)), 5107 5108 recGroupPopup, SLOT(AcceptItem(int))); 5108 5109 5109 intresult = recGroupPopup->ExecPopup();5110 DialogCode result = recGroupPopup->ExecPopup(); 5110 5111 5111 5112 if (result != MythDialog::Rejected) 5112 5113 setPlayGroup(); … … 5143 5144 5144 5145 connect(recGroupOkButton, SIGNAL(clicked()), recGroupPopup, SLOT(accept())); 5145 5146 5146 intresult = recGroupPopup->ExecPopup();5147 DialogCode result = recGroupPopup->ExecPopup(); 5147 5148 5148 5149 if (result == MythDialog::Accepted) 5149 5150 setRecTitle(); -
mythtv/programs/mythfrontend/channelrecpriority.cpp
45 45 theme->SetHMult(hmult); 46 46 if (!theme->LoadTheme(xmldata, "recprioritychannels")) 47 47 { 48 DialogBox diag(gContext->GetMainWindow(), tr("The theme you are using "49 "does not contain a 'recprioritychannels' element. "50 "Please contact the theme creator and ask if they could"51 "please update it.<br><br>The next screen will be empty."52 " Escape out of it to return to the menu."));53 diag.AddButton(tr("OK"));54 diag.exec();48 DialogBox *dlg = new DialogBox( 49 gContext->GetMainWindow(), 50 tr("The theme you are using " 51 "does not contain a 'recprioritychannels' element. " 52 "Please contact the theme creator and ask if they could " 53 "please update it.<br><br>The next screen will be empty." 54 " Escape out of it to return to the menu.")); 55 55 56 dlg->AddButton(tr("OK")); 57 dlg->exec(); 58 dlg->deleteLater(); 59 56 60 return; 57 61 } 58 62 -
mythtv/programs/mythfrontend/custompriority.cpp
475 475 errdiag->AddButton(QObject::tr("OK")); 476 476 errdiag->exec(); 477 477 478 delete errdiag;478 errdiag->deleteLater(); 479 479 } 480 480 return ret; 481 481 } -
mythtv/programs/mythfrontend/main.cpp
359 359 else if (sel == "settings appearance") 360 360 { 361 361 AppearanceSettings *settings = new AppearanceSettings(); 362 intres = settings->exec();362 DialogCode res = settings->exec(); 363 363 delete settings; 364 364 365 if ( res)365 if (kDialogCodeRejected != res) 366 366 { 367 367 qApp->processEvents(); 368 368 GetMythMainWindow()->JumpTo("Reload Theme"); … … 455 455 456 456 QString title = QObject::tr("Do you really want to exit MythTV?"); 457 457 458 DialogBox diag(gContext->GetMainWindow(), title);458 DialogBox *dlg = new DialogBox(gContext->GetMainWindow(), title); 459 459 460 d iag.AddButton(QObject::tr("No"));461 int result;460 dlg->AddButton(QObject::tr("No")); 461 DialogCode result = kDialogCodeRejected; 462 462 463 int ret = NO_EXIT; 463 464 switch (exitMenuStyle) 464 465 { 465 466 case 0: 466 d iag.AddButton(QObject::tr("Yes, Exit now"));467 dlg->AddButton(QObject::tr("Yes, Exit now")); 467 468 if (frontendOnly) 468 d iag.AddButton(QObject::tr("Yes, Exit and Shutdown"));469 result = d iag.exec();469 dlg->AddButton(QObject::tr("Yes, Exit and Shutdown")); 470 result = dlg->exec(); 470 471 switch (result) 471 472 { 472 case 1: return NO_EXIT;473 case 2: return QUIT;474 case 3: return HALT;475 default: return NO_EXIT;473 case kDialogCodeButton0: ret = NO_EXIT; break; 474 case kDialogCodeButton1: ret = QUIT; break; 475 case kDialogCodeButton2: ret = HALT; break; 476 default: ret = NO_EXIT; break; 476 477 } 478 break; 477 479 case 1: 478 d iag.AddButton(QObject::tr("Yes, Exit now"));479 result = d iag.exec();480 dlg->AddButton(QObject::tr("Yes, Exit now")); 481 result = dlg->exec(); 480 482 switch (result) 481 483 { 482 case 1: return NO_EXIT;483 case 2: return QUIT;484 default: return NO_EXIT;484 case kDialogCodeButton0: ret = NO_EXIT; break; 485 case kDialogCodeButton1: ret = QUIT; break; 486 default: ret = NO_EXIT; break; 485 487 } 488 break; 486 489 case 2: 487 d iag.AddButton(QObject::tr("Yes, Exit now"));488 d iag.AddButton(QObject::tr("Yes, Exit and Shutdown"));489 result = d iag.exec();490 dlg->AddButton(QObject::tr("Yes, Exit now")); 491 dlg->AddButton(QObject::tr("Yes, Exit and Shutdown")); 492 result = dlg->exec(); 490 493 switch (result) 491 494 { 492 case 1: return NO_EXIT;493 case 2: return QUIT;494 case 3: return HALT;495 default: return NO_EXIT;495 case kDialogCodeButton0: ret = NO_EXIT; break; 496 case kDialogCodeButton1: ret = QUIT; break; 497 case kDialogCodeButton2: ret = HALT; break; 498 default: ret = NO_EXIT; break; 496 499 } 500 break; 497 501 case 3: 498 d iag.AddButton(QObject::tr("Yes, Exit now"));499 d iag.AddButton(QObject::tr("Yes, Exit and Reboot"));500 d iag.AddButton(QObject::tr("Yes, Exit and Shutdown"));501 result = d iag.exec();502 dlg->AddButton(QObject::tr("Yes, Exit now")); 503 dlg->AddButton(QObject::tr("Yes, Exit and Reboot")); 504 dlg->AddButton(QObject::tr("Yes, Exit and Shutdown")); 505 result = dlg->exec(); 502 506 switch (result) 503 507 { 504 case 1: return NO_EXIT;505 case 2: return QUIT;506 case 3: return REBOOT;507 case 4: return HALT;508 default: return NO_EXIT;508 case kDialogCodeButton0: ret = NO_EXIT; break; 509 case kDialogCodeButton1: ret = QUIT; break; 510 case kDialogCodeButton2: ret = REBOOT; break; 511 case kDialogCodeButton3: ret = HALT; break; 512 default: ret = NO_EXIT; break; 509 513 } 514 break; 510 515 case 4: 511 d iag.AddButton(QObject::tr("Yes, Exit and Shutdown"));512 result = d iag.exec();516 dlg->AddButton(QObject::tr("Yes, Exit and Shutdown")); 517 result = dlg->exec(); 513 518 switch (result) 514 519 { 515 case 1: return NO_EXIT;516 case 2: return HALT;517 default: return NO_EXIT;520 case kDialogCodeButton0: ret = NO_EXIT; break; 521 case kDialogCodeButton1: ret = HALT; break; 522 default: ret = NO_EXIT; break; 518 523 } 524 break; 519 525 case 5: 520 d iag.AddButton(QObject::tr("Yes, Exit and Reboot"));521 result = d iag.exec();526 dlg->AddButton(QObject::tr("Yes, Exit and Reboot")); 527 result = dlg->exec(); 522 528 switch (result) 523 529 { 524 case 1: return NO_EXIT;525 case 2: return REBOOT;526 default: return NO_EXIT;530 case kDialogCodeButton0: ret = NO_EXIT; break; 531 case kDialogCodeButton1: ret = REBOOT; break; 532 default: ret = NO_EXIT; break; 527 533 } 534 break; 528 535 case 6: 529 d iag.AddButton(QObject::tr("Yes, Exit and Reboot"));530 d iag.AddButton(QObject::tr("Yes, Exit and Shutdown"));531 result = d iag.exec();536 dlg->AddButton(QObject::tr("Yes, Exit and Reboot")); 537 dlg->AddButton(QObject::tr("Yes, Exit and Shutdown")); 538 result = dlg->exec(); 532 539 switch (result) 533 540 { 534 case 1: return NO_EXIT;535 case 2: return REBOOT;536 case 3: return HALT;537 default: return NO_EXIT;541 case kDialogCodeButton0: ret = NO_EXIT; break; 542 case kDialogCodeButton1: ret = REBOOT; break; 543 case kDialogCodeButton2: ret = HALT; break; 544 default: ret = NO_EXIT; break; 538 545 } 546 break; 539 547 } 540 548 541 return NO_EXIT; 549 dlg->deleteLater(); 550 dlg = NULL; 551 552 return ret; 542 553 } 543 554 544 555 void haltnow() … … 701 712 long long pos = (long long)(atoi((*++it).ascii()) & 0xffffffffLL); 702 713 if (pos > 0) 703 714 { 704 QString msg = Q String("DVD contains a bookmark");705 QString b utton1msg = QString("Play from bookmark");706 QString b utton2msg = QString("Play from beginning");715 QString msg = QObject::tr("DVD contains a bookmark"); 716 QString btn0msg = QObject::tr("Play from bookmark"); 717 QString btn1msg = QObject::tr("Play from beginning"); 707 718 708 int ret = MythPopupBox::show2ButtonPopup(gContext->GetMainWindow(), 709 "", msg, 710 button1msg, 711 button2msg, 712 1); 713 if (ret == 1) 719 DialogCode ret = MythPopupBox::Show2ButtonPopup( 720 gContext->GetMainWindow(), 721 "", msg, 722 btn0msg, 723 btn1msg, 724 kDialogCodeButton0); 725 if (kDialogCodeButton1 == ret) 714 726 pginfo->setIgnoreBookmark(true); 715 else if ( ret == -1)727 else if (kDialogCodeRejected == ret) 716 728 { 717 729 delete tmprbuf; 718 730 delete pginfo; -
mythtv/programs/mythfrontend/statusbox.cpp
361 361 if ((inContent) && 362 362 (currentItem == QObject::tr("Log Entries"))) 363 363 { 364 int retval = MythPopupBox::show2ButtonPopup(my_parent, 365 QString("AckLogEntry"), 366 QObject::tr("Acknowledge all log entries at " 367 "this priority level or lower?"), 368 QObject::tr("Yes"), QObject::tr("No"), 0); 369 if (retval == 0) 364 DialogCode retval = MythPopupBox::Show2ButtonPopup( 365 my_parent, QString("AckLogEntry"), 366 QObject::tr("Acknowledge all log entries at " 367 "this priority level or lower?"), 368 QObject::tr("Yes"), QObject::tr("No"), 369 kDialogCodeButton0); 370 371 if (kDialogCodeButton0 == retval) 370 372 { 371 373 MSqlQuery query(MSqlQuery::InitCon()); 372 374 query.prepare("UPDATE mythlog SET acknowledged = 1 " … … 552 554 { 553 555 if (currentItem == QObject::tr("Log Entries")) 554 556 { 555 int retval; 557 DialogCode retval = MythPopupBox::Show2ButtonPopup( 558 my_parent, 559 QString("AckLogEntry"), 560 QObject::tr("Acknowledge this log entry?"), 561 QObject::tr("Yes"), QObject::tr("No"), kDialogCodeButton0); 556 562 557 retval = MythPopupBox::show2ButtonPopup(my_parent, 558 QString("AckLogEntry"), 559 QObject::tr("Acknowledge this log entry?"), 560 QObject::tr("Yes"), QObject::tr("No"), 0); 561 if (retval == 0) 563 if (kDialogCodeButton0 == retval) 562 564 { 563 565 MSqlQuery query(MSqlQuery::InitCon()); 564 566 query.prepare("UPDATE mythlog SET acknowledged = 1 " … … 572 574 { 573 575 QStringList msgs; 574 576 int jobStatus; 575 int retval;576 577 577 578 jobStatus = JobQueue::GetJobStatus( 578 579 contentData[contentPos].toInt()); 579 580 580 581 if (jobStatus == JOB_QUEUED) 581 582 { 582 retval = MythPopupBox::show2ButtonPopup(my_parent, 583 QString("JobQueuePopup"), 584 QObject::tr("Delete Job?"), 585 QObject::tr("Yes"), 586 QObject::tr("No"), 2); 587 cout << "Popup result = " << retval << endl; 588 if (retval == 0) 583 DialogCode retval = MythPopupBox::Show2ButtonPopup( 584 my_parent, 585 QString("JobQueuePopup"), QObject::tr("Delete Job?"), 586 QObject::tr("Yes"), QObject::tr("No"), kDialogCodeButton1); 587 if (kDialogCodeButton0 == retval) 589 588 { 590 589 JobQueue::DeleteJob(contentData[contentPos].toInt()); 591 590 doJobQueueStatus(); … … 598 597 msgs << QObject::tr("Pause"); 599 598 msgs << QObject::tr("Stop"); 600 599 msgs << QObject::tr("No Change"); 601 retval = MythPopupBox::showButtonPopup(my_parent, 602 QString("JobQueuePopup"), 603 QObject::tr("Job Queue Actions:"), 604 msgs, 2); 605 if (retval == 0) 600 DialogCode retval = MythPopupBox::ShowButtonPopup( 601 my_parent, 602 QString("JobQueuePopup"), 603 QObject::tr("Job Queue Actions:"), 604 msgs, kDialogCodeButton2); 605 if (kDialogCodeButton0 == retval) 606 606 { 607 607 JobQueue::PauseJob(contentData[contentPos].toInt()); 608 608 doJobQueueStatus(); 609 609 } 610 else if ( retval == 1)610 else if (kDialogCodeButton1 == retval) 611 611 { 612 612 JobQueue::StopJob(contentData[contentPos].toInt()); 613 613 doJobQueueStatus(); … … 618 618 msgs << QObject::tr("Resume"); 619 619 msgs << QObject::tr("Stop"); 620 620 msgs << QObject::tr("No Change"); 621 retval = MythPopupBox::showButtonPopup(my_parent, 622 QString("JobQueuePopup"), 623 QObject::tr("Job Queue Actions:"), 624 msgs, 2); 625 if (retval == 0) 621 DialogCode retval = MythPopupBox::ShowButtonPopup( 622 my_parent, 623 QString("JobQueuePopup"), 624 QObject::tr("Job Queue Actions:"), 625 msgs, kDialogCodeButton2); 626 627 if (kDialogCodeButton0 == retval) 626 628 { 627 629 JobQueue::ResumeJob(contentData[contentPos].toInt()); 628 630 doJobQueueStatus(); 629 631 } 630 else if ( retval == 1)632 else if (kDialogCodeButton1 == retval) 631 633 { 632 634 JobQueue::StopJob(contentData[contentPos].toInt()); 633 635 doJobQueueStatus(); … … 635 637 } 636 638 else if (jobStatus & JOB_DONE) 637 639 { 638 retval = MythPopupBox::show2ButtonPopup(my_parent, 639 QString("JobQueuePopup"), 640 QObject::tr("Requeue Job?"), 641 QObject::tr("Yes"), 642 QObject::tr("No"), 1); 643 if (retval == 0) 640 DialogCode retval = MythPopupBox::Show2ButtonPopup( 641 my_parent, 642 QString("JobQueuePopup"), 643 QObject::tr("Requeue Job?"), 644 QObject::tr("Yes"), QObject::tr("No"), kDialogCodeButton0); 645 646 if (kDialogCodeButton0 == retval) 644 647 { 645 648 JobQueue::ChangeJobStatus(contentData[contentPos].toInt(), 646 649 JOB_QUEUED); … … 657 660 if (rec) 658 661 { 659 662 QStringList msgs; 660 int retval;661 663 662 664 msgs << QObject::tr("Delete Now"); 663 665 msgs << QObject::tr("Disable AutoExpire"); 664 666 msgs << QObject::tr("No Change"); 665 667 666 retval = MythPopupBox::showButtonPopup(my_parent, 667 QString("AutoExpirePopup"), 668 QObject::tr("AutoExpire Actions:"), 669 msgs, 2); 668 DialogCode retval = MythPopupBox::ShowButtonPopup( 669 my_parent, 670 QString("AutoExpirePopup"), 671 QObject::tr("AutoExpire Actions:"), 672 msgs, kDialogCodeButton2); 670 673 671 if ( retval == 0&& REC_CAN_BE_DELETED(rec))674 if ((kDialogCodeButton0 == retval) && REC_CAN_BE_DELETED(rec)) 672 675 { 673 676 RemoteDeleteRecording(rec, false, false); 674 677 } 675 else if ( retval == 1)678 else if (kDialogCodeButton1 == retval) 676 679 { 677 680 rec->SetAutoExpire(0); 678 681 if ((rec)->recgroup == "LiveTV") -
mythtv/programs/mythfrontend/programrecpriority.cpp
103 103 theme->SetHMult(hmult); 104 104 if (!theme->LoadTheme(xmldata, "recpriorityprograms")) 105 105 { 106 DialogBox diag(gContext->GetMainWindow(), tr("The theme you are using "107 "does not contain a 'recpriorityprograms' element. "108 "Please contact the theme creator and ask if they could"109 "please update it.<br><br>The next screen will be empty."110 " Escape out of it to return to the menu."));111 diag.AddButton(tr("OK"));112 diag.exec();106 DialogBox *dlg = new DialogBox( 107 gContext->GetMainWindow(), 108 tr("The theme you are using does not contain a " 109 "'recpriorityprograms' element. Please contact the theme " 110 "creator and ask if they could please update it.<br><br>The " 111 "next screen will be empty. Escape out of it to return to " 112 "the menu.")); 113 113 114 dlg->AddButton(tr("OK")); 115 dlg->exec(); 116 dlg->deleteLater(); 117 114 118 return; 115 119 } 116 120 -
mythtv/programs/mythfrontend/playbackbox.h
106 106 static ProgramInfo *RunPlaybackBox(void *player); 107 107 108 108 public slots: 109 intexec();109 DialogCode exec(); 110 110 111 111 protected slots: 112 112 void timeout(void); -
mythtv/programs/mythtv-setup/main.cpp
310 310 311 311 if (backendIsRunning) 312 312 { 313 int val = MythPopupBox::show2ButtonPopup(313 DialogCode val = MythPopupBox::Show2ButtonPopup( 314 314 gContext->GetMainWindow(), QObject::tr("WARNING"), 315 315 warn, 316 316 QObject::tr("Continue"), 317 QObject::tr("Exit"), 1); 318 if (1 == val) 319 return 0; 317 QObject::tr("Exit"), kDialogCodeButton0); 320 318 321 backendIsRunning = true; 319 if (kDialogCodeButton1 == val) 320 return 0; 322 321 } 323 322 324 323 REG_KEY("qt", "DELETE", "Delete", "D"); … … 348 347 dia->AddButton(QObject::tr("Yes please")); 349 348 dia->AddButton(QObject::tr("No, I know what I am doing")); 350 349 351 if ( dia->exec() == 2)350 if (kDialogCodeButton1 == dia->exec()) 352 351 haveProblems = false; 353 d elete dia;352 dia->deleteLater(); 354 353 } 355 354 356 355 delete problems; … … 368 367 "with channel information.")); 369 368 dia->AddButton(QObject::tr("OK")); 370 369 dia->exec(); 371 d elete dia;370 dia->deleteLater(); 372 371 } 373 372 374 373 if (backendIsRunning) -
mythtv/programs/mythwelcome/welcomedialog.h
23 23 void keyPressEvent(QKeyEvent *e); 24 24 void customEvent(QCustomEvent *e); 25 25 void wireUpTheme(); 26 intexec(void);26 DialogCode exec(void); 27 27 28 28 protected slots: 29 29 void startFrontendClick(void); -
mythtv/programs/mythwelcome/welcomedialog.cpp
84 84 QTimer::singleShot(500, this, SLOT(startFrontend())); 85 85 } 86 86 87 int WelcomeDialog::exec()87 DialogCode WelcomeDialog::exec(void) 88 88 { 89 89 // mythshutdown --startup returns 0 for automatic startup 90 90 // 1 for manual startup … … 203 203 else if (action == "INFO") 204 204 { 205 205 MythWelcomeSettings settings; 206 if ( settings.exec() == 1)206 if (kDialogCodeAccepted == settings.exec()) 207 207 { 208 208 RemoteSendMessage("CLEAR_SETTINGS_CACHE"); 209 209 updateStatus(); … … 213 213 else if (action == "SHOWSETTINGS") 214 214 { 215 215 MythShutdownSettings settings; 216 if ( settings.exec() == 1)216 if (kDialogCodeAccepted == settings.exec()) 217 217 RemoteSendMessage("CLEAR_SETTINGS_CACHE"); 218 218 } 219 219 else if (action == "0") … … 296 296 297 297 void WelcomeDialog::closeDialog() 298 298 { 299 done( 1);299 done(kDialogCodeAccepted); 300 300 } 301 301 302 302 WelcomeDialog::~WelcomeDialog() … … 703 703 SLOT(shutdownNow())); 704 704 popup->addButton(tr("Exit"), this, 705 705 SLOT(closeDialog())); 706 popup->addButton(tr("Cancel"), this, SLOT(cancelPopup()));706 popup->addButton(tr("Cancel"), popup, SLOT(reject())); 707 707 708 708 popup->ShowPopup(this, SLOT(donePopup(int))); 709 709
