Ticket #4132: 4132-dbg-v8.patch
| File 4132-dbg-v8.patch, 168.6 KB (added by , 18 years ago) |
|---|
-
mythplugins/mythmusic/mythmusic/playbackbox.cpp
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)) … … 2365 2365 dupsCheck->setBackgroundOrigin(ParentOrigin); 2366 2366 popup->addWidget(dupsCheck); 2367 2367 2368 intres = popup->ExecPopup();2368 DialogCode res = popup->ExecPopup(); 2369 2369 switch (res) 2370 2370 { 2371 case 0:2371 case kDialogCodeButton0: 2372 2372 insertOption = PL_REPLACE; 2373 2373 break; 2374 case 1:2374 case kDialogCodeButton1: 2375 2375 insertOption = PL_INSERTAFTERCURRENT; 2376 2376 break; 2377 case 2:2377 case kDialogCodeButton2: 2378 2378 insertOption = PL_INSERTATEND; 2379 2379 break; 2380 case kDialogCodeRejected: 2381 default: 2382 popup->deleteLater(); 2383 return false; 2380 2384 } 2381 2385 2382 2386 bRemoveDups = dupsCheck->isChecked(); … … 2406 2410 2407 2411 popup->deleteLater(); 2408 2412 2409 return (res >= 0);2413 return true; 2410 2414 } 2411 2415 2412 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/cdrip.cpp
733 733 dlg->AddButton("No To All"); 734 734 dlg->AddButton("Yes"); 735 735 dlg->AddButton("Yes To All"); 736 intres = dlg->exec();736 DialogCode res = dlg->exec(); 737 737 dlg->deleteLater(); 738 738 dlg = NULL; 739 739 740 if ( res == 1)740 if (kDialogCodeButton0 == res) 741 741 { 742 742 delete ripTrack; 743 743 delete metadata; 744 744 } 745 else if ( res == 2)745 else if (kDialogCodeButton1 == res) 746 746 { 747 747 noToAll = true; 748 748 delete ripTrack; 749 749 delete metadata; 750 750 } 751 else if ( res == 3)751 else if (kDialogCodeButton2 == res) 752 752 { 753 753 deleteTrack(m_artistName, m_albumName, title); 754 754 m_tracks->push_back(ripTrack); 755 755 } 756 else if ( res == 4)756 else if (kDialogCodeButton3 == res) 757 757 { 758 758 yesToAll = true; 759 759 deleteTrack(m_artistName, m_albumName, title); 760 760 m_tracks->push_back(ripTrack); 761 761 } 762 else // treat cancel as no 763 { 764 delete ripTrack; 765 delete metadata; 766 } 762 767 } 763 768 } 764 769 } … … 1171 1176 1172 1177 RipStatus statusDialog(m_CDdevice, m_tracks, m_qualitySelector->getCurrentInt(), 1173 1178 gContext->GetMainWindow(), "edit metadata"); 1174 int res= statusDialog.exec();1175 if ( res == Accepted)1179 DialogCode rescode = statusDialog.exec(); 1180 if (kDialogCodeAccepted == rescode) 1176 1181 { 1177 1182 bool EjectCD = gContext->GetNumSetting("EjectCDAfterRipping", 1); 1178 1183 if (EjectCD) … … 1379 1384 searchDialog->setCaption(caption); 1380 1385 searchDialog->setSearchText(value); 1381 1386 searchDialog->setItems(m_searchList); 1382 if (searchDialog->ExecPopupAtXY(-1, 8) == 0) 1387 DialogCode rescode = searchDialog->ExecPopupAtXY(-1, 8); 1388 if (kDialogCodeRejected != rescode) 1383 1389 { 1384 1390 value = searchDialog->getResult(); 1385 1391 res = true; … … 1399 1405 "edit_metadata", "music-", "edit metadata"); 1400 1406 editDialog.setSaveMetadataOnly(); 1401 1407 1402 if ( editDialog.exec())1408 if (kDialogCodeRejected != editDialog.exec()) 1403 1409 { 1404 1410 updateTrackList(); 1405 1411 } -
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(); … … 1514 1510 1515 1511 orderByDialog->setFieldList(orderByCombo->currentText()); 1516 1512 1517 if ( orderByDialog->ExecPopup() == 0)1513 if (kDialogCodeAccepted == orderByDialog->ExecPopup()) 1518 1514 orderByCombo->setCurrentText(orderByDialog->getFieldList()); 1519 1515 1520 1516 delete orderByDialog; … … 1874 1870 if (action == "ESCAPE") 1875 1871 { 1876 1872 handled = true; 1877 done(-1);1873 reject(); 1878 1874 } 1879 1875 else if (action == "LEFT") 1880 1876 { … … 2176 2172 connect(moveDownButton, SIGNAL(clicked()), this, SLOT(moveDownPressed())); 2177 2173 connect(ascendingButton, SIGNAL(clicked()), this, SLOT(ascendingPressed())); 2178 2174 connect(descendingButton, SIGNAL(clicked()), this, SLOT(descendingPressed())); 2179 connect(okButton, SIGNAL(clicked()), this, SLOT( okPressed()));2175 connect(okButton, SIGNAL(clicked()), this, SLOT(accept())); 2180 2176 2181 2177 connect(listbox, SIGNAL(selectionChanged(QListBoxItem*)), this, 2182 2178 SLOT(listBoxSelectionChanged(QListBoxItem*))); … … 2243 2239 if (action == "ESCAPE") 2244 2240 { 2245 2241 handled = true; 2246 done(-1);2242 reject(); 2247 2243 } 2248 2244 else if (action == "LEFT") 2249 2245 { … … 2298 2294 else if (action == "7") 2299 2295 { 2300 2296 handled = true; 2301 okPressed();2297 accept(); 2302 2298 } 2303 2299 } 2304 2300 } … … 2367 2363 listbox->setSelected(listbox->selectedItem()->next(), true); 2368 2364 } 2369 2365 2370 void SmartPLOrderByDialog::okPressed(void)2371 {2372 done(0);2373 }2374 2375 2366 void SmartPLOrderByDialog::orderByChanged(void) 2376 2367 { 2377 2368 bool found = false; … … 2551 2542 2552 2543 addLayout(vbox, 0); 2553 2544 2554 connect(okButton, SIGNAL(clicked()), this, SLOT( okPressed()));2555 connect(cancelButton, SIGNAL(clicked()), this, SLOT( cancelPressed()));2545 connect(okButton, SIGNAL(clicked()), this, SLOT(accept())); 2546 connect(cancelButton, SIGNAL(clicked()), this, SLOT(reject())); 2556 2547 2557 2548 connect(fixedRadio, SIGNAL(toggled(bool)), this, SLOT(fixedCheckToggled(bool))); 2558 2549 connect(nowRadio, SIGNAL(toggled(bool)), this, SLOT(nowCheckToggled(bool))); … … 2661 2652 if (action == "ESCAPE") 2662 2653 { 2663 2654 handled = true; 2664 done(-1);2655 reject(); 2665 2656 } 2666 2657 else if (action == "LEFT") 2667 2658 { … … 2689 2680 MythPopupBox::keyPressEvent(e); 2690 2681 } 2691 2682 2692 void SmartPLDateDialog::okPressed(void)2693 {2694 done(0);2695 }2696 2697 void SmartPLDateDialog::cancelPressed(void)2698 {2699 done(-1);2700 }2701 2702 2683 void SmartPLDateDialog::fixedCheckToggled(bool on) 2703 2684 { 2704 2685 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; … … 600 601 void EditMetadataDialog::closeDialog() 601 602 { 602 603 cancelPopup(); 603 done(1);604 accept(); 604 605 } 605 606 606 607 void EditMetadataDialog::showSaveMenu() … … 654 655 cancelPopup(); 655 656 656 657 *m_sourceMetadata = m_metadata; 657 done(1);658 accept(); 658 659 } 659 660 660 661 void EditMetadataDialog::saveToDatabase() … … 663 664 664 665 m_metadata->dumpToDatabase(); 665 666 *m_sourceMetadata = m_metadata; 666 done(1);667 accept(); 667 668 } 668 669 669 670 void EditMetadataDialog::saveToFile() … … 685 686 decoder->commitMetadata(m_metadata); 686 687 delete decoder; 687 688 } 688 done(1);689 accept(); 689 690 } 690 691 691 692 void EditMetadataDialog::saveAll() … … 727 728 menu->addButton(albumArt->getTypeName(IT_CD)); 728 729 menu->addButton(albumArt->getTypeName(IT_INLAY)); 729 730 730 int res = menu->ExecPopup(); 731 DialogCode ret = menu->ExecPopup(); 732 int res = MythDialog::CalcItemIndex(ret); 731 733 732 734 if ((IT_UNKNOWN <= res) && (res < IT_LAST)) 733 735 { -
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/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(); … … 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( … … 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/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 { … … 602 602 password, 603 603 gContext->GetMainWindow()); 604 604 pwd->exec(); 605 delete pwd;605 pwd->deleteLater(); 606 606 if (ok) 607 607 { 608 608 // 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/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();319 DialogCode res = dialog->exec(); 326 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", ""); -
mythplugins/mytharchive/mytharchive/exportnativewizard.cpp
679 679 FileSelector selector(FSTYPE_FILE, "/", "*.*", gContext->GetMainWindow(), 680 680 "file_selector", "mytharchive-", "file selector"); 681 681 qApp->unlock(); 682 bool res = selector.exec();682 bool res = (kDialogCodeRejected != selector.exec()); 683 683 684 684 if (res) 685 685 { -
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 { -
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
1402 1402 1403 1403 EditMetadataDialog editDialog(curItem, gContext->GetMainWindow(), 1404 1404 "edit_metadata", "mythburn-", "edit metadata"); 1405 if ( editDialog.exec())1405 if (kDialogCodeRejected != editDialog.exec()) 1406 1406 { 1407 1407 // update widgets to reflect any changes 1408 1408 titleChanged(item); … … 1476 1476 FileSelector selector(FSTYPE_FILE, "/", "*.*", gContext->GetMainWindow(), 1477 1477 "file_selector", "mytharchive-", "file selector"); 1478 1478 qApp->unlock(); 1479 bool res = selector.exec();1479 bool res = (kDialogCodeRejected != selector.exec()); 1480 1480 1481 1481 if (res) 1482 1482 { -
mythplugins/mythbrowser/mythbrowser/tabview.cpp
327 327 url->setText(((WebPage*)mytab->currentPage())->browser->baseURL().htmlURL()); 328 328 popup->addWidget(url); 329 329 330 popup->addButton(tr("OK") );331 popup->addButton(tr("Cancel") );330 popup->addButton(tr("OK"), popup, SLOT(accept())); 331 popup->addButton(tr("Cancel"), popup, SLOT(reject())); 332 332 333 333 qApp->removeEventFilter(this); 334 intres = popup->ExecPopup();334 DialogCode res = popup->ExecPopup(); 335 335 qApp->installEventFilter(this); 336 336 337 if ( res == 0)337 if (kDialogCodeAccepted == res) 338 338 { 339 339 QString sGroup = group->text(); 340 340 QString sDesc = desc->text(); … … 396 396 popup->addWidget(editor); 397 397 editor->setFocus(); 398 398 399 popup->addButton(tr("OK") );400 popup->addButton(tr("Cancel") );399 popup->addButton(tr("OK"), popup, SLOT(accept())); 400 popup->addButton(tr("Cancel"), popup, SLOT(reject())); 401 401 402 402 qApp->removeEventFilter(this); 403 intres = popup->ExecPopup();403 DialogCode res = popup->ExecPopup(); 404 404 qApp->installEventFilter(this); 405 405 406 if ( res == 0)406 if (kDialogCodeAccepted == res) 407 407 { 408 408 QString sURL = editor->text(); 409 409 if (!sURL.startsWith("http://") && !sURL.startsWith("https://") && -
mythplugins/mythgallery/mythgallery/iconview.cpp
1337 1337 importDlg->AddButton(tr("Yes")); 1338 1338 int code = importDlg->exec(); 1339 1339 importDlg->deleteLater(); 1340 if ( 2!= code)1340 if (kDialogCodeButton1 != code) 1341 1341 return; 1342 1342 1343 1343 // Makes import directory samba/windows friendly (no colon) -
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
298 298 return false; 299 299 } 300 300 301 voidSourceManager::connectScreen(uint id, WeatherScreen *screen)301 bool SourceManager::connectScreen(uint id, WeatherScreen *screen) 302 302 { 303 if (!screen) 304 { 305 VERBOSE(VB_IMPORTANT, LOC_ERR + 306 "Can not connect nonexistent screen "<<screen); 307 308 return false; 309 } 310 303 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 } 304 319 ws->connectScreen(screen); 320 return true; 305 321 } 306 322 307 voidSourceManager::disconnectScreen(WeatherScreen *screen)323 bool SourceManager::disconnectScreen(WeatherScreen *screen) 308 324 { 325 if (!screen) 326 { 327 VERBOSE(VB_IMPORTANT, LOC_ERR + 328 "Can not disconnect nonexistent screen "<<screen); 329 330 return false; 331 } 332 309 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 } 310 341 ws->disconnectScreen(screen); 342 return true; 311 343 } -
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/videodlg.h
25 25 const QString &lwinName, const QString &lname, 26 26 VideoList *video_list); 27 27 28 virtual ~VideoDialog();29 30 28 virtual void playVideo(Metadata *someItem); 31 29 32 30 GenericTree *getVideoTreeRoot(void); … … 48 46 virtual void slotWatchVideo(); 49 47 50 48 protected: 49 virtual ~VideoDialog(); // use deleteLater() instead for thread safety 51 50 virtual void updateBackground(void); 52 51 virtual void parseContainer(QDomElement&) = 0; 53 52 virtual void loadWindow(QDomElement &element); -
mythplugins/mythvideo/mythvideo/videomanager.h
28 28 public: 29 29 VideoManager(MythMainWindow *lparent, const QString &lname, 30 30 VideoList *video_list); 31 ~VideoManager();32 31 int videoExitType() { return 0; } 33 32 34 33 public slots: … … 55 54 void exitWin(); 56 55 57 56 protected: 57 ~VideoManager(); // use deleteLater() instead for thread safety 58 58 void paintEvent(QPaintEvent *e); 59 59 void keyPressEvent(QKeyEvent *e); 60 60 void doWaitBackground(QPainter &p, const QString &titleText); -
mythplugins/mythvideo/mythvideo/main.cpp
71 71 }; 72 72 73 73 template <typename T> 74 class q_screen_inst 75 { 76 public: 77 q_screen_inst(T *inst, const QString &loc_name) : m_inst(inst), 78 m_location_name(loc_name) 79 { 80 } 81 82 int run() 83 { 84 gContext->addCurrentLocation(m_location_name); 85 qApp->unlock(); 86 m_inst->exec(); 87 qApp->lock(); 88 gContext->removeCurrentLocation(); 89 return m_inst->videoExitType(); 90 } 91 92 ~q_screen_inst() 93 { 94 m_inst->deleteLater(); 95 m_inst = NULL; 96 } 97 98 private: 99 T *m_inst; 100 const QString &m_location_name; 101 }; 102 103 template <typename T> 74 104 int exec_screen(T *inst, const QString &loc_name) 75 105 { 76 106 screen_inst<T> si(inst, loc_name); 77 107 return si.run(); 78 108 } 79 109 110 template <typename T> 111 int q_exec_screen(T *inst, const QString &loc_name) 112 { 113 q_screen_inst<T> si(inst, loc_name); 114 return si.run(); 115 } 116 80 117 class screens 81 118 { 82 119 private: … … 87 124 VideoScanner scanner; 88 125 scanner.doScan(GetVideoDirs()); 89 126 90 return exec_screen(new VideoManager(gContext->GetMainWindow(),91 "video manager",92 video_list),93 "videomanager");127 return q_exec_screen( 128 new VideoManager(gContext->GetMainWindow(), 129 "video manager", video_list), 130 "videomanager"); 94 131 } 95 132 return 0; 96 133 } … … 112 149 113 150 static int runVideoGallery(VideoList *video_list) 114 151 { 115 return exec_screen(new VideoGallery(gContext->GetMainWindow(),116 "video gallery", video_list),117 "videogallery");152 return q_exec_screen(new VideoGallery(gContext->GetMainWindow(), 153 "video gallery", video_list), 154 "videogallery"); 118 155 } 119 156 120 157 public: -
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; … … 521 521 MythPopupBox::Small,true); 522 522 plotLabel->setAlignment(Qt::AlignJustify | Qt::WordBreak); 523 523 524 QButton * okButton = plotbox->addButton(tr("Ok")); 524 QButton *okButton = plotbox->addButton( 525 QObject::tr("OK"), plotbox, SLOT(accept())); 525 526 okButton->setFocus(); 526 527 527 528 plotbox->ExecPopup(); -
mythplugins/mythvideo/mythvideo/videogallery.h
33 33 void handleVideoSelect(); 34 34 35 35 protected: 36 ~VideoGallery() {} // use deleteLater instead for thread safety 36 37 virtual void parseContainer(QDomElement &element); 37 38 virtual void fetchVideos(); 38 39 void doMenu(bool info = false); -
mythplugins/mythvideo/mythvideo/videodlg.cpp
157 157 MythPopupBox::Small,true); 158 158 plotLabel->setAlignment(Qt::AlignJustify | Qt::WordBreak); 159 159 160 QButton * okButton = plotbox->addButton(tr("Ok")); 160 QButton *okButton = plotbox->addButton( 161 tr("OK"), plotbox, SLOT(accept())); 161 162 okButton->setFocus(); 162 163 163 164 plotbox->ExecPopup(); -
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 415 new_extension_popup->deleteLater(); 416 416 new_extension_popup = NULL; … … 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
112 112 buttonText += QObject::tr("Yes"); 113 113 buttonText += QObject::tr("Yes to all"); 114 114 115 int result = MythPopupBox::showButtonPopup(gContext->GetMainWindow(), 116 QObject::tr("File Missing"), 117 QString(QObject::tr("%1 appears to be missing.\nRemove it " 118 "from the database?")).arg(filename), 119 buttonText, 1); 115 DialogCode result = MythPopupBox::ShowButtonPopup( 116 gContext->GetMainWindow(), 117 QObject::tr("File Missing"), 118 QObject::tr("%1 appears to be missing.\n" 119 "Remove it from the database?").arg(filename), 120 buttonText, kDialogCodeButton0); 121 120 122 switch (result) 121 123 { 122 case 1: 124 case kDialogCodeRejected: 125 case kDialogCodeButton0: 126 default: 127 break; 128 case kDialogCodeButton1: 123 129 m_KeepAll = true; 124 130 break; 125 case 2:131 case kDialogCodeButton2: 126 132 m_dbmetadata->purgeByID(id); 127 133 break; 128 case 3:134 case kDialogCodeButton3: 129 135 m_RemoveAll = true; 130 136 m_dbmetadata->purgeByID(id); 131 137 break; -
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
156 156 public: 157 157 MythMultiPasswordDialog(const QString &message, const QStringList &pwlist, 158 158 MythMainWindow *lparent, const char *lname = 0); 159 ~MythMultiPasswordDialog();160 159 161 160 private slots: 162 161 void checkPassword(const QString &password); 163 162 164 163 protected: 164 ~MythMultiPasswordDialog(); // use deleteLater for thread safety 165 165 void keyPressEvent(QKeyEvent *e); 166 166 167 167 private: … … 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();367 delete pwd;366 bool ok = (kDialogCodeRejected != pwd->exec()); 367 pwd->deleteLater(); 368 368 369 369 if (ok) 370 370 { -
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; … … 533 539 buttonText += QObject::tr("No"); 534 540 buttonText += QObject::tr("Yes"); 535 541 536 int result = MythPopupBox::showButtonPopup(gContext->GetMainWindow(), 537 QObject::tr("Are you sure?"), 538 QString(QObject::tr("This will clear all Game Meta Data\n" 539 "from the database. Are you sure you\n" 540 "want to do this?" )), 541 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 542 550 switch (result) 543 551 { 544 case 0: 552 case kDialogCodeRejected: 553 case kDialogCodeButton0: 554 default: 545 555 // Do Nothing 546 556 break; 547 case 1:557 case kDialogCodeButton1: 548 558 MSqlQuery query(MSqlQuery::InitCon()); 549 559 QString thequery = "DELETE FROM gamemetadata;"; 550 560 query.exec(thequery); -
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 } -
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")); -
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 { … … 649 649 busy->deleteLater(); 650 650 } 651 651 break; 652 case kDialogCodeRejected: 653 default: 654 break; 652 655 } 653 656 654 657 popup->deleteLater(); -
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); … … 1070 1070 1071 1071 popup->deleteLater(); 1072 1072 1073 return ( res == 0);1073 return (kDialogCodeAccepted == res); 1074 1074 } 1075 1075 1076 1076 void MythNews::showMenu() -
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(); 603 DialogCode code = storediag->exec(); 604 int ret = MythDialog::CalcItemIndex(code); 604 605 storediag->deleteLater(); 605 606 storediag = NULL; 606 607 -
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
3149 3149 !gContext->GetNumSetting("PVR350InternalAudioOnly"))) 3150 3150 { 3151 3151 QString errMsg = ReinitAudio(); 3152 int ret = 1;3152 DialogCode ret = kDialogCodeButton0; 3153 3153 if ((errMsg != QString::null) && !using_null_videoout && 3154 3154 gContext->GetNumSetting("AudioNag", 1)) 3155 3155 { … … 3173 3173 qApp->unlock(); 3174 3174 } 3175 3175 3176 if ( ret == 2)3176 if (kDialogCodeButton1 == ret) 3177 3177 gContext->SaveSetting("AudioNag", 0); 3178 if ( ret == 3)3178 if (kDialogCodeButton2 == ret) 3179 3179 gContext->SetSetting("AudioNag", 0); 3180 else if ( ret == 4)3180 else if ((kDialogCodeButton3 == ret) || (kDialogCodeRejected == ret)) 3181 3181 return; 3182 3182 } 3183 3183 -
mythtv/libs/libmythtv/previouslist.cpp
336 336 337 337 int view = chooseListBox->currentItem(); 338 338 339 choosePopup-> done(0);339 choosePopup->AcceptItem(view); 340 340 341 341 if (view == curView) 342 342 return; … … 712 712 "delete any recordings."); 713 713 714 714 DialogBox *dlg = new DialogBox(gContext->GetMainWindow(), message); 715 int button = 1, ok = -1, cleardup = -1, setdup = -1, rm_episode = -1,715 int button = 0, ok = -1, cleardup = -1, setdup = -1, rm_episode = -1, 716 716 rm_title = -1; 717 717 // int rm_generics = -1; 718 718 … … 739 739 // "for duplicate matching")); 740 740 // rm_generics = button++; 741 741 742 int ret = dlg->exec(); 742 DialogCode code = dlg->exec(); 743 int ret = MythDialog::CalcItemIndex(code); 743 744 dlg->deleteLater(); 744 745 dlg = NULL; 745 746 -
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/proglist.cpp
397 397 refillAll = true; 398 398 } 399 399 400 void ProgLister::setViewFromList( void)400 void ProgLister::setViewFromList(int item) 401 401 { 402 int view = item; 403 402 404 if (!choosePopup || (!chooseListBox && !chooseEditButton)) 403 405 return; 404 406 405 int view = chooseListBox->currentItem();406 407 407 if (type == plTitleSearch || type == plKeywordSearch || 408 408 type == plPeopleSearch) 409 409 { … … 426 426 } 427 427 } 428 428 429 choosePopup-> done(0);429 choosePopup->AcceptItem(item); 430 430 431 431 if (view == curView) 432 432 return; … … 517 517 518 518 updateKeywordInDB(text); 519 519 520 choosePopup-> done(0);520 choosePopup->accept(); 521 521 522 522 fillViewList(text); 523 523 … … 549 549 550 550 updateKeywordInDB(text); 551 551 552 powerPopup-> done(0);552 powerPopup->accept(); 553 553 554 554 fillViewList(text); 555 555 … … 676 676 viewList[curView] = searchTime.toString(fullDateFormat); 677 677 viewTextList[curView] = viewList[curView]; 678 678 679 choosePopup-> done(0);679 choosePopup->accept(); 680 680 681 681 curItem = -1; 682 682 refillAll = true; … … 716 716 chooseListBox->setCurrentItem(curView); 717 717 choosePopup->addWidget(chooseListBox); 718 718 719 connect(chooseListBox, SIGNAL(accepted(int)), this, SLOT(setViewFromList())); 719 connect(chooseListBox, SIGNAL(accepted(int)), 720 this, SLOT(setViewFromList(int))); 720 721 721 722 chooseListBox->setFocus(); 722 723 choosePopup->ExecPopup(); … … 771 772 chooseRecordButton->setEnabled(chooseLineEdit->text() 772 773 .stripWhiteSpace().length() > 0); 773 774 774 connect(chooseListBox, SIGNAL(accepted(int)), this, SLOT(setViewFromList())); 775 connect(chooseListBox, SIGNAL(accepted(int)), 776 this, SLOT(setViewFromList(int))); 775 777 connect(chooseListBox, SIGNAL(menuButtonPressed(int)), chooseLineEdit, SLOT(setFocus())); 776 778 connect(chooseListBox, SIGNAL(selectionChanged()), this, SLOT(chooseListBoxChanged())); 777 779 connect(chooseLineEdit, SIGNAL(textChanged()), this, SLOT(chooseEditChanged())); … … 837 839 chooseDeleteButton->setEnabled(curView >= 0); 838 840 chooseRecordButton->setEnabled(curView >= 0); 839 841 840 connect(chooseListBox, SIGNAL(accepted(int)), this,841 SLOT(setViewFromList()));842 connect(chooseListBox, SIGNAL(accepted(int)), 843 this, SLOT(setViewFromList(int))); 842 844 connect(chooseListBox, SIGNAL(menuButtonPressed(int)),chooseEditButton, 843 845 SLOT(setFocus())); 844 846 connect(chooseListBox, SIGNAL(selectionChanged()), this, … … 1034 1036 powerDescEdit->setText(field[2]); 1035 1037 1036 1038 powerTitleEdit->setFocus(); 1037 choosePopup-> done(0);1039 choosePopup->accept(); 1038 1040 powerPopup->ExecPopup(); 1039 1041 1040 1042 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/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/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/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
2011 2011 addChild(listbox); 2012 2012 } 2013 2013 2014 intCaptureCardEditor::exec(void)2014 DialogCode CaptureCardEditor::exec(void) 2015 2015 { 2016 while (ConfigurationDialog::exec() == QDialog::Accepted)2016 while (ConfigurationDialog::exec() == kDialogCodeAccepted) 2017 2017 edit(); 2018 2018 2019 return QDialog::Rejected;2019 return kDialogCodeRejected; 2020 2020 } 2021 2021 2022 2022 void CaptureCardEditor::load(void) … … 2048 2048 } 2049 2049 else 2050 2050 { 2051 int val = MythPopupBox::show2ButtonPopup(2051 DialogCode val = MythPopupBox::Show2ButtonPopup( 2052 2052 gContext->GetMainWindow(), 2053 2053 "", 2054 2054 tr("Capture Card Menu"), 2055 2055 tr("Edit.."), 2056 2056 tr("Delete.."), 2057 1);2057 kDialogCodeButton0); 2058 2058 2059 if ( val == 0)2059 if (kDialogCodeButton0 == val) 2060 2060 edit(); 2061 else if ( val == 1)2061 else if (kDialogCodeButton1 == val) 2062 2062 del(); 2063 2063 } 2064 2064 } … … 2068 2068 const int cardid = listbox->getValue().toInt(); 2069 2069 if (-1 == cardid) 2070 2070 { 2071 int val = MythPopupBox::show2ButtonPopup(2071 DialogCode val = MythPopupBox::Show2ButtonPopup( 2072 2072 gContext->GetMainWindow(), "", 2073 2073 tr("Are you sure you want to delete " 2074 2074 "ALL capture cards on %1?").arg(gContext->GetHostName()), 2075 2075 tr("Yes, delete capture cards"), 2076 tr("No, don't"), 2);2076 tr("No, don't"), kDialogCodeButton1); 2077 2077 2078 if ( 0 == val)2078 if (kDialogCodeButton0 == val) 2079 2079 { 2080 2080 MSqlQuery cards(MSqlQuery::InitCon()); 2081 2081 … … 2104 2104 } 2105 2105 else if (-2 == cardid) 2106 2106 { 2107 int val = MythPopupBox::show2ButtonPopup(2107 DialogCode val = MythPopupBox::Show2ButtonPopup( 2108 2108 gContext->GetMainWindow(), "", 2109 2109 tr("Are you sure you want to delete " 2110 2110 "ALL capture cards?"), 2111 2111 tr("Yes, delete capture cards"), 2112 tr("No, don't"), 2);2112 tr("No, don't"), kDialogCodeButton1); 2113 2113 2114 if ( 0 == val)2114 if (kDialogCodeButton0 == val) 2115 2115 { 2116 2116 MSqlQuery query(MSqlQuery::InitCon()); 2117 2117 query.exec("TRUNCATE TABLE capturecard;"); … … 2130 2130 2131 2131 void CaptureCardEditor::del(void) 2132 2132 { 2133 int val = MythPopupBox::show2ButtonPopup(2133 DialogCode val = MythPopupBox::Show2ButtonPopup( 2134 2134 gContext->GetMainWindow(), "", 2135 2135 tr("Are you sure you want to delete this capture card?"), 2136 2136 tr("Yes, delete capture card"), 2137 tr("No, don't"), 2);2137 tr("No, don't"), kDialogCodeButton1); 2138 2138 2139 if ( val == 0)2139 if (kDialogCodeButton0 == val) 2140 2140 { 2141 2141 CardUtil::DeleteCard(listbox->getValue().toUInt()); 2142 2142 load(); … … 2159 2159 return dialog; 2160 2160 } 2161 2161 2162 int VideoSourceEditor::exec() { 2163 while (ConfigurationDialog::exec() == QDialog::Accepted) 2162 DialogCode VideoSourceEditor::exec(void) 2163 { 2164 while (ConfigurationDialog::exec() == kDialogCodeAccepted) 2164 2165 edit(); 2165 2166 2166 return QDialog::Rejected;2167 return kDialogCodeRejected; 2167 2168 } 2168 2169 2169 2170 void VideoSourceEditor::load(void) … … 2183 2184 } 2184 2185 else 2185 2186 { 2186 int val = MythPopupBox::show2ButtonPopup(2187 DialogCode val = MythPopupBox::Show2ButtonPopup( 2187 2188 gContext->GetMainWindow(), 2188 2189 "", 2189 2190 tr("Video Source Menu"), 2190 2191 tr("Edit.."), 2191 2192 tr("Delete.."), 2192 1);2193 kDialogCodeButton0); 2193 2194 2194 if ( val == 0)2195 if (kDialogCodeButton0 == val) 2195 2196 edit(); 2196 else if ( val == 1)2197 else if (kDialogCodeButton1 == val) 2197 2198 del(); 2198 2199 } 2199 2200 } … … 2203 2204 const int sourceid = listbox->getValue().toInt(); 2204 2205 if (-1 == sourceid) 2205 2206 { 2206 int val = MythPopupBox::show2ButtonPopup(2207 DialogCode val = MythPopupBox::Show2ButtonPopup( 2207 2208 gContext->GetMainWindow(), "", 2208 2209 tr("Are you sure you want to delete " 2209 2210 "ALL video sources?"), 2210 2211 tr("Yes, delete video sources"), 2211 tr("No, don't"), 2);2212 tr("No, don't"), kDialogCodeButton1); 2212 2213 2213 if ( 0 == val)2214 if (kDialogCodeButton0 == val) 2214 2215 { 2215 2216 MSqlQuery query(MSqlQuery::InitCon()); 2216 2217 query.exec("TRUNCATE TABLE channel;"); … … 2235 2236 2236 2237 void VideoSourceEditor::del() 2237 2238 { 2238 int val = MythPopupBox::show2ButtonPopup(2239 DialogCode val = MythPopupBox::Show2ButtonPopup( 2239 2240 gContext->GetMainWindow(), "", 2240 2241 tr("Are you sure you want to delete " 2241 2242 "this video source?"), 2242 2243 tr("Yes, delete video source"), 2243 2244 tr("No, don't"), 2244 2);2245 kDialogCodeButton1); 2245 2246 2246 if ( val == 0)2247 if (kDialogCodeButton0 == val) 2247 2248 { 2248 2249 MSqlQuery query(MSqlQuery::InitCon()); 2249 2250 … … 2287 2288 addChild(listbox); 2288 2289 } 2289 2290 2290 intCardInputEditor::exec(void)2291 DialogCode CardInputEditor::exec(void) 2291 2292 { 2292 while (ConfigurationDialog::exec() == QDialog::Accepted)2293 while (ConfigurationDialog::exec() == kDialogCodeAccepted) 2293 2294 cardinputs[listbox->getValue().toInt()]->exec(); 2294 2295 2295 return QDialog::Rejected;2296 return kDialogCodeRejected; 2296 2297 } 2297 2298 2298 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
4168 4168 message += RecStatusDesc(); 4169 4169 4170 4170 DialogBox *dlg = new DialogBox(gContext->GetMainWindow(), message); 4171 int button = 1, ok = -1, react = -1, stop = -1, addov = -1, forget = -1,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 4174 dlg->AddButton(QObject::tr("OK")); … … 4248 4248 } 4249 4249 } 4250 4250 4251 int ret = dlg->exec(); 4251 DialogCode code = dlg->exec(); 4252 int ret = MythDialog::CalcItemIndex(code); 4252 4253 dlg->deleteLater(); 4253 4254 dlg = NULL; 4254 4255 … … 4338 4339 } 4339 4340 4340 4341 DialogBox *dlg = new DialogBox(gContext->GetMainWindow(), message); 4341 int button = 1, ok = -1, react = -1, addov = -1, clearov = -1,4342 int button = 0, ok = -1, react = -1, addov = -1, clearov = -1, 4342 4343 ednorm = -1, edcust = -1, forget = -1, addov1 = -1, forget1 = -1; 4343 4344 4344 4345 dlg->AddButton(QObject::tr("OK")); … … 4424 4425 } 4425 4426 } 4426 4427 4427 int ret = dlg->exec(); 4428 DialogCode code = dlg->exec(); 4429 int ret = MythDialog::CalcItemIndex(code); 4428 4430 dlg->deleteLater(); 4429 4431 dlg = NULL; 4430 4432 -
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
2411 2411 MythPasswordDialog *pwd = new MythPasswordDialog(text, &ok, password, 2412 2412 gContext->GetMainWindow()); 2413 2413 pwd->exec(); 2414 delete pwd;2414 pwd->deleteLater(); 2415 2415 2416 2416 if (ok) 2417 2417 { -
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"; … … 115 117 show(); 116 118 } 117 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 118 132 void MythDialog::done(int r) 119 133 { 120 134 hide(); 121 setResult( r);135 setResult((DialogCode) r); 122 136 close(); 123 137 } 124 138 125 139 void MythDialog::AcceptItem(int i) 126 140 { 127 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)); 128 150 } 129 151 152 int MythDialog::CalcItemIndex(DialogCode code) 153 { 154 return (int)code - (int)kDialogCodeListStart; 155 } 156 130 157 void MythDialog::accept() 131 158 { 132 159 done(Accepted); … … 137 164 done(Rejected); 138 165 } 139 166 140 int MythDialog::exec()167 DialogCode MythDialog::exec(void) 141 168 { 142 169 if (in_loop) 143 170 { 144 171 qWarning("MythDialog::exec: Recursive call detected."); 145 return -1;172 return kDialogCodeRejected; 146 173 } 147 174 148 setResult( Rejected);175 setResult(kDialogCodeRejected); 149 176 150 177 Show(); 151 178 152 179 in_loop = TRUE; 153 180 qApp->enter_loop(); 154 181 155 intres = result();182 DialogCode res = result(); 156 183 157 184 return res; 158 185 } … … 213 240 } 214 241 } 215 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 216 257 MythPopupBox::MythPopupBox(MythMainWindow *parent, const char *name) 217 258 : MythDialog(parent, name, false) 218 259 { … … 465 506 MythDialog::keyPressEvent(e); 466 507 } 467 508 509 void MythPopupBox::AcceptItem(int i) 510 { 511 MythDialog::AcceptItem(i); 512 emit popupDone(rescode); 513 } 514 468 515 void MythPopupBox::accept(void) 469 516 { 470 517 MythDialog::done(MythDialog::Accepted); … … 477 524 emit popupDone(MythDialog::Rejected); 478 525 } 479 526 480 intMythPopupBox::ExecPopup(QObject *target, const char *slot)527 DialogCode MythPopupBox::ExecPopup(QObject *target, const char *slot) 481 528 { 482 529 if (!target) 483 ShowPopup(this, SLOT(d efaultExitHandler(int)));530 ShowPopup(this, SLOT(done(int))); 484 531 else 485 532 ShowPopup(target, slot); 486 533 487 534 return exec(); 488 535 } 489 536 490 intMythPopupBox::ExecPopupAtXY(int destx, int desty,491 QObject *target, const char *slot)537 DialogCode MythPopupBox::ExecPopupAtXY(int destx, int desty, 538 QObject *target, const char *slot) 492 539 { 493 540 if (!target) 494 ShowPopupAtXY(destx, desty, this, SLOT(d efaultExitHandler(int)));541 ShowPopupAtXY(destx, desty, this, SLOT(done(int))); 495 542 else 496 543 ShowPopupAtXY(destx, desty, target, slot); 497 544 … … 526 573 } 527 574 if (foundbutton) 528 575 { 529 done(i);576 AcceptItem(i); 530 577 return; 531 578 } 532 579 … … 553 600 } 554 601 if (foundbutton) 555 602 { 556 done(i);603 AcceptItem(i); 557 604 return; 558 605 } 559 606 560 607 VERBOSE(VB_IMPORTANT, "MythPopupBox::defaultButtonPressedHandler(void)" 561 608 "\n\t\t\tWe should never get here!"); 562 done( Rejected);609 done(kDialogCodeRejected); 563 610 } 564 611 565 void MythPopupBox::defaultExitHandler(int r) 566 { 567 done(r); 568 } 569 570 static int show_ok_popup( 612 bool MythPopupBox::showOkPopup( 571 613 MythMainWindow *parent, 572 614 const QString &title, 573 615 const QString &message, 574 QString button_msg = QString::null)616 QString button_msg) 575 617 { 576 618 if (button_msg.isEmpty()) 577 619 button_msg = QObject::tr("OK"); … … 581 623 popup->addLabel(message, MythPopupBox::Medium, true); 582 624 QButton *okButton = popup->addButton(button_msg, popup, SLOT(accept())); 583 625 okButton->setFocus(); 584 int ret = popup->ExecPopup();626 bool ret = (kDialogCodeAccepted == popup->ExecPopup()); 585 627 586 628 popup->hide(); 587 629 popup->deleteLater(); … … 589 631 return ret; 590 632 } 591 633 592 void MythPopupBox::showOkPopup(MythMainWindow *parent, QString title,593 QString message)594 {595 show_ok_popup(parent, title, message);596 }597 598 void MythPopupBox::showExitPopup(MythMainWindow *parent, QString title,599 QString message)600 {601 show_ok_popup(parent, title, message, tr("Exit"));602 }603 604 634 bool MythPopupBox::showOkCancelPopup(MythMainWindow *parent, QString title, 605 635 QString message, bool focusOk) 606 636 { … … 691 721 } 692 722 693 723 694 int MythPopupBox::show2ButtonPopup(MythMainWindow *parent, QString title, 695 QString message, QString button1msg, 696 QString button2msg, int defvalue) 724 DialogCode MythPopupBox::ShowButtonPopup( 725 MythMainWindow *parent, 726 const QString &title, 727 const QString &message, 728 const QStringList &buttonmsgs, 729 DialogCode default_button) 697 730 { 698 731 MythPopupBox *popup = new MythPopupBox(parent, title); 699 732 700 733 popup->addLabel(message, Medium, true); 701 734 popup->addLabel(""); 702 735 703 QButton *but1 = popup->addButton(button1msg); 704 QButton *but2 = popup->addButton(button2msg); 705 706 if (defvalue == 1) 707 but1->setFocus(); 708 else 709 but2->setFocus(); 710 711 int ret = popup->ExecPopup(); 712 713 popup->hide(); 714 popup->deleteLater(); 715 716 return ret; 717 } 718 719 int MythPopupBox::showButtonPopup(MythMainWindow *parent, QString title, 720 QString message, QStringList buttonmsgs, 721 int defvalue) 722 { 723 MythPopupBox *popup = new MythPopupBox(parent, title); 724 725 popup->addLabel(message, Medium, true); 726 popup->addLabel(""); 727 736 const uint def = CalcItemIndex(default_button); 728 737 for (unsigned int i = 0; i < buttonmsgs.size(); i++ ) 729 738 { 730 739 QButton *but = popup->addButton(buttonmsgs[i]); 731 if (def value == (int)i)740 if (def == i) 732 741 but->setFocus(); 733 742 } 734 743 735 intret = popup->ExecPopup();744 DialogCode ret = popup->ExecPopup(); 736 745 737 746 popup->hide(); 738 747 popup->deleteLater(); … … 948 957 .arg(window_name).arg(theme_filename); 949 958 MythPopupBox::showOkPopup(gContext->GetMainWindow(), 950 959 tr("Missing UI Element"), msg); 951 done(-1);960 reject(); 952 961 return; 953 962 } 954 963 } … … 1054 1063 1055 1064 MythThemedDialog::~MythThemedDialog() 1056 1065 { 1066 VERBOSE(VB_IMPORTANT, "MythThemedDialog dtor "<<this); 1057 1067 if (theme) 1068 { 1058 1069 delete theme; 1070 theme = NULL; 1071 } 1059 1072 } 1060 1073 1074 void MythThemedDialog::deleteLater(void) 1075 { 1076 VERBOSE(VB_IMPORTANT, "MythThemedDialog::deleteLater(void) "<<this); 1077 if (theme) 1078 { 1079 delete theme; 1080 theme = NULL; 1081 } 1082 MythDialog::deleteLater(); 1083 } 1084 1061 1085 void MythThemedDialog::loadWindow(QDomElement &element) 1062 1086 { 1063 1087 // … … 1962 1986 if (the_text == target_text) 1963 1987 { 1964 1988 *success_flag = true; 1965 done(0);1989 accept(); 1966 1990 } 1967 1991 else 1968 1992 { … … 1993 2017 listbox = new MythListBox(this); 1994 2018 listbox->setScrollBar(false); 1995 2019 listbox->setBottomScrollBar(false); 1996 connect(listbox, SIGNAL(accepted(int)), this, SLOT( itemSelected(int)));2020 connect(listbox, SIGNAL(accepted(int)), this, SLOT(AcceptItem(int))); 1997 2021 addWidget(listbox); 1998 1999 ok_button = addButton(tr("OK"), this, SLOT(okPressed()));2000 cancel_button = addButton(tr("Cancel"), this, SLOT( cancelPressed()));2022 2023 ok_button = addButton(tr("OK"), this, SLOT(accept())); 2024 cancel_button = addButton(tr("Cancel"), this, SLOT(reject())); 2001 2025 } 2002 2026 2003 2027 void MythSearchDialog::keyPressEvent(QKeyEvent *e) … … 2012 2036 if (action == "ESCAPE") 2013 2037 { 2014 2038 handled = true; 2015 done(-1);2039 reject(); 2016 2040 } 2017 2041 if (action == "LEFT") 2018 2042 { … … 2027 2051 if (action == "SELECT") 2028 2052 { 2029 2053 handled = true; 2030 done(0);2054 accept(); 2031 2055 } 2032 2056 } 2033 2057 } … … 2035 2059 MythPopupBox::keyPressEvent(e); 2036 2060 } 2037 2061 2038 void MythSearchDialog::itemSelected(int index)2039 {2040 (void)index;2041 done(0);2042 }2043 2044 2062 void MythSearchDialog::setCaption(QString text) 2045 2063 { 2046 2064 caption->setText(text); … … 2069 2087 searchTextChanged(); 2070 2088 } 2071 2089 2072 void MythSearchDialog::okPressed(void)2090 MythSearchDialog::~MythSearchDialog() 2073 2091 { 2074 done(0);2092 Teardown(); 2075 2093 } 2076 2094 2077 void MythSearchDialog:: cancelPressed(void)2095 void MythSearchDialog::deleteLater(void) 2078 2096 { 2079 done(-1);2097 Teardown(); 2080 2098 } 2081 2099 2082 MythSearchDialog::~MythSearchDialog()2100 void MythSearchDialog::Teardown(void) 2083 2101 { 2084 if (listbox) 2085 { 2086 delete listbox; 2087 listbox = NULL; 2088 } 2089 2090 if (editor) 2091 { 2092 delete editor; 2093 editor = NULL; 2094 } 2102 listbox = NULL; // deleted by Qt 2103 editor = NULL; // deleted by Qt 2095 2104 } 2096 2105 2097 2106 /* … … 2141 2150 "element. \n\nReturning to the previous menu.")); 2142 2151 MythPopupBox::showOkPopup(gContext->GetMainWindow(), 2143 2152 tr("Missing UI Element"), msg); 2144 done(-1);2153 reject(); 2145 2154 return; 2146 2155 } 2147 2156 … … 2176 2185 "\n\nReturning to the previous menu.")); 2177 2186 MythPopupBox::showOkPopup(gContext->GetMainWindow(), 2178 2187 tr("Missing UI Element"), msg); 2179 done(-1);2188 reject(); 2180 2189 return; 2181 2190 } 2182 2191 … … 2383 2392 if (type > -1) 2384 2393 { 2385 2394 *selected_file = image_files[type]; 2386 done(0);2395 accept(); 2387 2396 } 2388 2397 } 2389 2398 … … 2409 2418 VERBOSE(VB_IMPORTANT, 2410 2419 "MythScrollDialog: Programmer error, trying to create " 2411 2420 "a dialog without a parent."); 2412 done( -1);2421 done(kDialogCodeRejected); 2413 2422 return; 2414 2423 } 2415 2424 2416 2425 m_parent = parent; 2417 2426 m_scrollMode = mode; 2418 2427 2419 m_resCode = 0;2428 m_resCode = kDialogCodeRejected; 2420 2429 m_inLoop = false; 2421 2430 2422 2431 gContext->GetScreenSettings(m_xbase, m_screenWidth, m_wmult, … … 2511 2520 m_screenHeight*areaHTimes); 2512 2521 } 2513 2522 2514 int MythScrollDialog::result() const2523 DialogCode MythScrollDialog::result(void) const 2515 2524 { 2516 2525 return m_resCode; 2517 2526 } … … 2535 2544 } 2536 2545 } 2537 2546 2538 int MythScrollDialog::exec()2547 DialogCode MythScrollDialog::exec(void) 2539 2548 { 2540 2549 if (m_inLoop) 2541 2550 { 2542 2551 std::cerr << "MythScrollDialog::exec: Recursive call detected." 2543 2552 << std::endl; 2544 return -1;2553 return kDialogCodeRejected; 2545 2554 } 2546 2555 2547 setResult( Rejected);2556 setResult(kDialogCodeRejected); 2548 2557 2549 2558 show(); 2550 2559 2551 2560 m_inLoop = true; 2552 2561 qApp->enter_loop(); 2553 2562 2554 intres = result();2563 DialogCode res = result(); 2555 2564 2556 2565 return res; 2557 2566 } … … 2559 2568 void MythScrollDialog::done(int r) 2560 2569 { 2561 2570 hide(); 2562 setResult( r);2571 setResult((DialogCode)r); 2563 2572 close(); 2564 2573 } 2565 2574 2566 2575 void MythScrollDialog::accept() 2567 2576 { 2568 done( Accepted);2577 done(kDialogCodeAccepted); 2569 2578 } 2570 2579 2571 2580 void MythScrollDialog::reject() 2572 2581 { 2573 done( Rejected);2582 done(kDialogCodeRejected); 2574 2583 } 2575 2584 2576 void MythScrollDialog::setResult( intr)2585 void MythScrollDialog::setResult(DialogCode r) 2577 2586 { 2578 2587 m_resCode = r; 2579 2588 } -
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 else 400 460 handled = false; 401 461 } 402 else if (action == "SELECT" && e->text().is Null() )462 else if (action == "SELECT" && e->text().isEmpty() ) 403 463 e->ignore(); 404 464 else 405 465 handled = false; … … 412 472 QLineEdit::keyPressEvent(e); 413 473 } 414 474 415 void MythLineEdit::setText(const QString & text)475 void MythLineEdit::setText(const QString &text) 416 476 { 417 477 // Don't mess with the cursor position; it causes 418 478 // counter-intuitive behaviour due to interactions with the 419 479 // communication with the settings stuff 420 480 421 481 int pos = cursorPosition(); 422 QLineEdit::setText( text);482 QLineEdit::setText(QDeepCopy<QString>(text)); 423 483 setCursorPosition(pos); 424 484 } 425 485 486 QString MythLineEdit::text(void) 487 { 488 return QDeepCopy<QString>(QLineEdit::text()); 489 } 490 426 491 void MythLineEdit::focusInEvent(QFocusEvent *e) 427 492 { 428 493 emit changeHelpText(helptext); … … 534 599 connect(cycle_timer, SIGNAL(timeout()), this, SLOT(endCycle())); 535 600 536 601 popup = NULL; 602 useVirtualKeyboard = gContext->GetNumSetting("UseVirtualKeyboard", 1); 537 603 popupPosition = VK_POSBELOWEDIT; 538 604 } 539 605 … … 731 797 // of MythLineEdit, and I'm sure he had 732 798 // a reason ... 733 799 getCursorPosition(¶, &pos); 734 QTextEdit::setText( text);800 QTextEdit::setText(QDeepCopy<QString>(text)); 735 801 setCursorPosition(para, pos); 736 802 } 737 803 804 QString MythRemoteLineEdit::text(void) 805 { 806 return QDeepCopy<QString>(QTextEdit::text()); 807 } 808 738 809 void MythRemoteLineEdit::keyPressEvent(QKeyEvent *e) 739 810 { 740 811 bool handled = false; … … 766 837 } 767 838 else if ((action == "SELECT") && 768 839 (!active_cycle) && 769 ((e->text().is Null()) ||840 ((e->text().isEmpty()) || 770 841 (e->key() == Qt::Key_Enter) || 771 842 (e->key() == Qt::Key_Return))) 772 843 { 773 if (gContext->GetNumSetting("UseVirtualKeyboard", 1) == 1) 774 { 775 popup = new VirtualKeyboard(gContext->GetMainWindow(), this); 776 gContext->GetMainWindow()->detach(popup); 777 popup->exec(); 778 delete popup; 779 popup = NULL; 780 } 781 844 if (useVirtualKeyboard) 845 popupVirtualKeyboard(); 782 846 } 783 847 else 784 848 handled = false; … … 976 1040 QTextEdit::focusOutEvent(e); 977 1041 } 978 1042 979 980 1043 MythRemoteLineEdit::~MythRemoteLineEdit() 981 1044 { 1045 Teardown(); 1046 } 1047 1048 void MythRemoteLineEdit::deleteLater(void) 1049 { 1050 Teardown(); 1051 QTextEdit::deleteLater(); 1052 } 1053 1054 void MythRemoteLineEdit::Teardown(void) 1055 { 982 1056 if (cycle_timer) 983 1057 { 984 delete cycle_timer; 1058 cycle_timer->disconnect(); 1059 cycle_timer->deleteLater(); 1060 cycle_timer = NULL; 985 1061 } 986 1062 987 if (popup) 988 delete popup; 1063 qt_delete(popup); 989 1064 } 990 1065 1066 void MythRemoteLineEdit::popupVirtualKeyboard(void) 1067 { 1068 qt_delete(popup); 1069 1070 popup = new VirtualKeyboard(gContext->GetMainWindow(), this); 1071 gContext->GetMainWindow()->detach(popup); 1072 popup->exec(); 1073 1074 qt_delete(popup); 1075 } 1076 991 1077 void MythRemoteLineEdit::insert(QString text) 992 1078 { 993 1079 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
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 -
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.20071115- 1"212 #define MYTH_BINARY_VERSION "0.21.20071115-2" 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 static QString showPasswordPopup(MythMainWindow *parent, 156 196 QString title, QString message); 157 197 198 public slots: 199 virtual void AcceptItem(int); 158 200 virtual void accept(void); 159 201 virtual void reject(void); 160 202 … … 168 210 169 211 protected slots: 170 212 void defaultButtonPressedHandler(void); 171 void defaultExitHandler(int);172 213 173 214 private: 174 215 QVBoxLayout *vbox; … … 290 331 MythThemedDialog(MythMainWindow *parent, const char *name = 0, 291 332 bool setsize = true); 292 333 293 ~MythThemedDialog();294 295 334 virtual bool loadThemedWindow(QString window_name, QString theme_filename); 296 335 virtual void loadWindow(QDomElement &); 297 336 virtual void parseContainer(QDomElement &); … … 329 368 int getContext(){return context;} 330 369 331 370 public slots: 332 371 virtual void deleteLater(void); 333 372 virtual void updateBackground(); 334 373 virtual void initForeground(); 335 374 virtual void updateForeground(); … … 342 381 virtual void activateCurrent(); 343 382 344 383 protected: 384 ~MythThemedDialog(); // use deleteLater() instead for thread safety 345 385 346 386 void paintEvent(QPaintEvent* e); 347 387 UIType *widget_with_current_focus; … … 383 423 MythMainWindow *parent, 384 424 const char *name = 0, 385 425 bool setsize = true); 386 ~MythPasswordDialog();387 388 426 public slots: 389 427 390 428 void checkPassword(const QString &); 391 429 392 protected:393 430 protected: 431 ~MythPasswordDialog(); // use deleteLater() instead for thread safety 394 432 void keyPressEvent(QKeyEvent *e); 395 433 396 434 private: … … 407 445 public: 408 446 409 447 MythSearchDialog(MythMainWindow *parent, const char *name = 0); 410 ~MythSearchDialog();411 448 412 449 public: 413 450 void setCaption(QString text); 414 451 void setSearchText(QString text); 415 452 void setItems(QStringList items); 416 453 QString getResult(void); 417 418 protected slots: 419 void okPressed(void); 420 void cancelPressed(void); 454 455 public slots: 456 virtual void deleteLater(void); 457 458 protected slots: 421 459 void searchTextChanged(void); 422 void itemSelected(int index);423 460 424 protected: 461 protected: 462 void Teardown(void); 463 ~MythSearchDialog(); // use deleteLater() instead for thread safety 425 464 void keyPressEvent(QKeyEvent *e); 426 465 427 466 private: … … 453 492 QString theme_filename = "", 454 493 const char *name = 0, 455 494 bool setsize=true); 456 ~MythImageFileDialog();457 458 495 public slots: 459 496 460 497 void handleTreeListSelection(int, IntVector*); … … 463 500 void buildFileList(QString directory); 464 501 465 502 protected: 466 503 ~MythImageFileDialog(); // use deleteLater() instead for thread safety 467 504 void keyPressEvent(QKeyEvent *e); 468 505 469 506 private: … … 486 523 487 524 public: 488 525 489 enum DialogCode {490 Rejected,491 Accepted492 };493 494 526 enum ScrollMode { 495 527 HScroll=0, 496 528 VScroll … … 498 530 499 531 MythScrollDialog(MythMainWindow *parent, ScrollMode mode=HScroll, 500 532 const char *name = 0); 501 ~MythScrollDialog();502 533 503 534 void setArea(int w, int h); 504 535 void setAreaMultiplied(int areaWTimes, int areaHTimes); 505 536 506 int result() const;537 DialogCode result(void) const; 507 538 508 539 public slots: 509 540 510 int exec();541 DialogCode exec(void); 511 542 virtual void done(int); 512 543 virtual void show(); 513 544 virtual void hide(); … … 519 550 virtual void reject(); 520 551 521 552 protected: 522 553 ~MythScrollDialog(); // use deleteLater() instead for thread safety 523 554 void keyPressEvent(QKeyEvent *e); 524 555 virtual void paintEvent(QRegion& region, int x, int y, int w, int h); 525 556 526 void setResult( intr);557 void setResult(DialogCode r); 527 558 void viewportPaintEvent(QPaintEvent *pe); 528 559 529 560 MythMainWindow *m_parent; … … 537 568 QFont m_defaultMediumFont; 538 569 QFont m_defaultSmallFont; 539 570 540 intm_resCode;571 DialogCode m_resCode; 541 572 bool m_inLoop; 542 573 543 574 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
20 20 21 21 bool getCheckBoxState(void) { if (checkbox) return checkbox->isChecked(); 22 22 return false; } 23 23 24 protected slots: 24 25 void buttonPressed(int which); 25 26 -
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
486 486 } 487 487 } 488 488 489 intPlaybackBox::exec(void)489 DialogCode PlaybackBox::exec(void) 490 490 { 491 491 if (recGroup != "") 492 492 return MythDialog::exec(); … … 497 497 return MythDialog::exec(); 498 498 } 499 499 500 return 0;500 return kDialogCodeRejected; 501 501 } 502 502 503 503 /* blocks until playing has stopped */ … … 4633 4633 4634 4634 iconhelp->addLayout(grid); 4635 4635 4636 QButton *button = iconhelp->addButton(tr("Ok")); 4636 QButton *button = iconhelp->addButton( 4637 QObject::tr("OK"), iconhelp, SLOT(accept())); 4637 4638 button->setFocus(); 4638 4639 4639 4640 iconhelp->ExecPopup(); … … 4763 4764 recGroupPopup->addWidget(exitbutton); 4764 4765 connect(exitbutton, SIGNAL(clicked()), recGroupPopup, SLOT(reject())); 4765 4766 4766 intresult = recGroupPopup->ExecPopup();4767 DialogCode result = recGroupPopup->ExecPopup(); 4767 4768 4768 4769 if (result != MythDialog::Rejected) 4769 4770 { … … 4929 4930 connect(recGroupListBox, SIGNAL(currentChanged(QListBoxItem *)), this, 4930 4931 SLOT(recGroupChooserListBoxChanged())); 4931 4932 4932 intresult = recGroupPopup->ExecPopup();4933 DialogCode result = recGroupPopup->ExecPopup(); 4933 4934 4934 4935 if (result != MythDialog::Rejected) 4935 4936 setGroupFilter(); … … 4989 4990 recGroupPassword, 4990 4991 gContext->GetMainWindow()); 4991 4992 pwd->exec(); 4992 delete pwd;4993 pwd->deleteLater(); 4993 4994 if (!ok) 4994 4995 { 4995 4996 recGroupPassword = savedPW; … … 5131 5132 SLOT(recGroupChangerListBoxChanged())); 5132 5133 connect(recGroupOkButton, SIGNAL(clicked()), recGroupPopup, SLOT(accept())); 5133 5134 5134 intresult = recGroupPopup->ExecPopup();5135 DialogCode result = recGroupPopup->ExecPopup(); 5135 5136 5136 5137 if (result != MythDialog::Rejected) 5137 5138 setRecGroup(); … … 5182 5183 connect(recGroupListBox, SIGNAL(accepted(int)), 5183 5184 recGroupPopup, SLOT(AcceptItem(int))); 5184 5185 5185 intresult = recGroupPopup->ExecPopup();5186 DialogCode result = recGroupPopup->ExecPopup(); 5186 5187 5187 5188 if (result != MythDialog::Rejected) 5188 5189 setPlayGroup(); … … 5219 5220 5220 5221 connect(recGroupOkButton, SIGNAL(clicked()), recGroupPopup, SLOT(accept())); 5221 5222 5222 intresult = recGroupPopup->ExecPopup();5223 DialogCode result = recGroupPopup->ExecPopup(); 5223 5224 5224 5225 if (result == MythDialog::Accepted) 5225 5226 setRecTitle(); -
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"); … … 458 458 DialogBox *dlg = new DialogBox(gContext->GetMainWindow(), title); 459 459 460 460 dlg->AddButton(QObject::tr("No")); 461 int result;461 DialogCode result = kDialogCodeRejected; 462 462 463 enum {464 kDialogCodeButton0 = 1,465 kDialogCodeButton1 = 2,466 kDialogCodeButton2 = 3,467 kDialogCodeButton3 = 4,468 };469 470 463 int ret = NO_EXIT; 471 464 switch (exitMenuStyle) 472 465 { … … 719 712 long long pos = (long long)(atoi((*++it).ascii()) & 0xffffffffLL); 720 713 if (pos > 0) 721 714 { 722 QString msg = Q String("DVD contains a bookmark");723 QString b utton1msg = QString("Play from bookmark");724 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"); 725 718 726 int ret = MythPopupBox::show2ButtonPopup(gContext->GetMainWindow(), 727 "", msg, 728 button1msg, 729 button2msg, 730 1); 731 if (ret == 1) 719 DialogCode ret = MythPopupBox::Show2ButtonPopup( 720 gContext->GetMainWindow(), 721 "", msg, 722 btn0msg, 723 btn1msg, 724 kDialogCodeButton0); 725 if (kDialogCodeButton1 == ret) 732 726 pginfo->setIgnoreBookmark(true); 733 else if ( ret == -1)727 else if (kDialogCodeRejected == ret) 734 728 { 735 729 delete tmprbuf; 736 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/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 352 dia->deleteLater(); 354 353 } -
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
