Ticket #4132: 4132-dbg-v7.patch

File 4132-dbg-v7.patch, 216.2 KB (added by danielk, 18 years ago)

Updated patch, this fixes some problems with popping up the virtual keyboard for editing text fields and with improper QObject deletion causing segfaults

  • mythplugins/mythmusic/mythmusic/playbackbox.cpp

     
    251251    if (progress)
    252252    {
    253253        progress->Close();
    254         delete progress;
     254        progress->deleteLater();
    255255        progress = NULL;
    256256    }
    257257
     
    645645        return;
    646646
    647647    playlist_popup->hide();
    648     delete playlist_popup;
     648    playlist_popup->deleteLater();
    649649    playlist_popup = NULL;
    650650}
    651651
     
    680680    SmartPlaylistDialog dialog(gContext->GetMainWindow(), "smartplaylistdialog");
    681681    dialog.setSmartPlaylist(curSmartPlaylistCategory, curSmartPlaylistName);
    682682
    683     int res = dialog.ExecPopup();
     683    DialogCode res = dialog.ExecPopup();
    684684
    685     if (res > 0)
     685    if (kDialogCodeRejected != res)
    686686    {
    687687        dialog.getSmartPlaylist(curSmartPlaylistCategory, curSmartPlaylistName);
    688688        updatePlaylistFromSmartPlaylist();
     
    698698
    699699    SearchDialog dialog(gContext->GetMainWindow(), "searchdialog");
    700700
    701     int res = dialog.ExecPopupAtXY(-1, 20);
     701    DialogCode res = dialog.ExecPopupAtXY(-1, 20);
    702702
    703     if (res != -1)
     703    if (kDialogCodeRejected != res)
    704704    {
    705705          QString whereClause;
    706706          dialog.getWhereClause(whereClause);
     
    999999
    10001000    EditMetadataDialog editDialog(editMeta, gContext->GetMainWindow(),
    10011001                      "edit_metadata", "music-", "edit metadata");
    1002     if (editDialog.exec())
     1002    if (kDialogCodeRejected != editDialog.exec())
    10031003    {
    10041004        // update the metadata copy stored in all_music
    10051005        if (all_music->updateMetadata(editMeta->ID(), editMeta))
     
    10201020           }
    10211021        }
    10221022
    1023         MythBusyDialog busy(QObject::tr("Rebuilding music tree"));
    1024         busy.start();
     1023        MythBusyDialog *busy = new MythBusyDialog(
     1024            QObject::tr("Rebuilding music tree"));
     1025        busy->start();
    10251026
    10261027        // Get a reference to the current track
    10271028        QValueList <int> branches_to_current_node;
     
    10651066
    10661067        music_tree_list->refresh();
    10671068
    1068         busy.Close();
     1069        busy->Close();
     1070        busy->deleteLater();
    10691071    }
    10701072}
    10711073
     
    10861088            if (progress)
    10871089            {
    10881090                progress->Close();
    1089                 delete progress;
     1091                progress->deleteLater();
    10901092                progress = NULL;
    10911093                progress_type = kProgressNone;
    10921094            }
     
    11471149                if (progress)
    11481150                {
    11491151                    progress->Close();
    1150                     delete progress;
     1152                    progress->deleteLater();
    11511153                }
    11521154                progress = NULL;
    11531155                progress_type = kProgressNone;
     
    23632365    dupsCheck->setBackgroundOrigin(ParentOrigin);
    23642366    popup->addWidget(dupsCheck);
    23652367
    2366     int res = popup->ExecPopup();
     2368    DialogCode res = popup->ExecPopup();
    23672369    switch (res)
    23682370    {
    2369         case 0:
     2371        case kDialogCodeButton0:
    23702372            insertOption = PL_REPLACE;
    23712373            break;
    2372         case 1:
     2374        case kDialogCodeButton1:
    23732375            insertOption = PL_INSERTAFTERCURRENT;
    23742376            break;
    2375         case 2:
     2377        case kDialogCodeButton2:
    23762378            insertOption = PL_INSERTATEND;
    23772379            break;
     2380        case kDialogCodeRejected:
     2381        default:
     2382            popup->deleteLater();
     2383            return false;
    23782384    }
    23792385
    23802386    bRemoveDups = dupsCheck->isChecked();
     
    24022408    else
    24032409        playOption = PL_CURRENT;
    24042410
    2405     delete popup;
     2411    popup->deleteLater();
    24062412
    2407     return (res >= 0);
     2413    return true;
    24082414}
    24092415
    24102416QString PlaybackBoxMusic::getTimeString(int exTime, int maxTime)
  • mythplugins/mythmusic/mythmusic/search.cpp

     
    4646    addWidget(listbox);
    4747
    4848    // 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()));
    5151
    5252    // Initially, fill list with all music
    5353    runQuery("");
     
    223223{
    224224    unsigned int id = ((SearchListBoxItem*)listbox->item(i))->getId();
    225225    whereClause = QString("WHERE song_id='%1';").arg(id);
    226     done(0);
     226    accept();
    227227}
    228228
    229229
     
    236236{
    237237}
    238238
    239 void SearchDialog::okPressed(void)
    240 {
    241     done(0);
    242 }
    243 
    244 void SearchDialog::cancelPressed(void)
    245 {
    246     done(-1);
    247 }
    248 
    249239void SearchListBoxItem::paint(QPainter *p)
    250240{
    251241    int itemHeight = height(listBox());
  • mythplugins/mythmusic/mythmusic/globalsettings.cpp

     
    673673{
    674674    VisualizationsEditor *dialog = new VisualizationsEditor(visModesEdit->getValue(),
    675675            gContext->GetMainWindow(), "viseditor");
    676     if (dialog->exec() == 1)
     676    if (kDialogCodeAccepted == dialog->exec())
    677677        visModesEdit->setValue(dialog->getSelectedModes());
    678678
    679679    delete dialog;
  • mythplugins/mythmusic/mythmusic/directoryfinder.cpp

     
    171171         || !m_cancelButton || !m_homeButton)
    172172    {
    173173        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()));
    175175    }
    176176
    177177    // load pixmaps
  • mythplugins/mythmusic/mythmusic/playlist.cpp

     
    17901790    }
    17911791
    17921792    progress->Close();
    1793     delete progress;
     1793    progress->deleteLater();
    17941794
    17951795    progress = new MythProgressDialog(QObject::tr("Burning CD"), 100);
    17961796    progress->setProgress(2);
     
    18681868    }
    18691869
    18701870    progress->Close();
    1871     delete progress;
     1871    progress->deleteLater();
    18721872
    18731873    QFile::remove(tmprecordlist);
    18741874    QFile::remove(tmprecordisofs);
  • mythplugins/mythmusic/mythmusic/cdrip.cpp

     
    720720                    }
    721721                    else
    722722                    {
    723                         DialogBox dialog(gContext->GetMainWindow(),
    724                                          tr("Artist: %1\n"
    725                                          "Album: %2\n"
    726                                          "Track: %3\n\n"
    727                                          "This track is already in the database. \n"
    728                                          "Do you want to remove the existing track?")
    729                                          .arg(m_artistName).arg(m_albumName).arg(title));
    730                         dialog.AddButton("No");
    731                         dialog.AddButton("No To All");
    732                         dialog.AddButton("Yes");
    733                         dialog.AddButton("Yes To All");
    734                         int res = dialog.exec();
     723                        DialogBox *dlg = new DialogBox(
     724                            gContext->GetMainWindow(),
     725                            tr("Artist: %1\n"
     726                               "Album: %2\n"
     727                               "Track: %3\n\n"
     728                               "This track is already in the database. \n"
     729                               "Do you want to remove the existing track?")
     730                            .arg(m_artistName).arg(m_albumName).arg(title));
    735731
    736                         if (res == 1)
     732                        dlg->AddButton("No");
     733                        dlg->AddButton("No To All");
     734                        dlg->AddButton("Yes");
     735                        dlg->AddButton("Yes To All");
     736                        DialogCode res = dlg->exec();
     737                        dlg->deleteLater();
     738                        dlg = NULL;
     739
     740                        if (kDialogCodeButton0 == res)
    737741                        {
    738742                            delete ripTrack;
    739743                            delete metadata;
    740744                        }
    741                         else if (res == 2)
     745                        else if (kDialogCodeButton1 == res)
    742746                        {
    743747                            noToAll = true;
    744748                            delete ripTrack;
    745749                            delete metadata;
    746750                        }
    747                         else if (res == 3)
     751                        else if (kDialogCodeButton2 == res)
    748752                        {
    749753                            deleteTrack(m_artistName, m_albumName, title);
    750754                            m_tracks->push_back(ripTrack);
    751755                        }
    752                         else if (res == 4)
     756                        else if (kDialogCodeButton3 == res)
    753757                        {
    754758                            yesToAll = true;
    755759                            deleteTrack(m_artistName, m_albumName, title);
    756760                            m_tracks->push_back(ripTrack);
    757761                        }
     762                        else // treat cancel as no
     763                        {
     764                            delete ripTrack;
     765                            delete metadata;
     766                        }
    758767                    }
    759768                }
    760769            }
     
    779788    buildFocusList();
    780789    updateTrackList();
    781790
    782     delete busy;
     791    busy->deleteLater();
    783792}
    784793
    785794void Ripper::scanCD(void)
     
    11671176
    11681177    RipStatus statusDialog(m_CDdevice, m_tracks, m_qualitySelector->getCurrentInt(),
    11691178                           gContext->GetMainWindow(), "edit metadata");
    1170     int res = statusDialog.exec();
    1171     if (res == Accepted)
     1179    DialogCode rescode = statusDialog.exec();
     1180    if (kDialogCodeAccepted == rescode)
    11721181    {
    11731182        bool EjectCD = gContext->GetNumSetting("EjectCDAfterRipping", 1);
    11741183        if (EjectCD)
     
    11961205    }
    11971206
    11981207    delete ejector;
    1199     delete busy;
     1208    busy->deleteLater();
    12001209}
    12011210
    12021211void Ripper::ejectCD()
     
    13751384    searchDialog->setCaption(caption);
    13761385    searchDialog->setSearchText(value);
    13771386    searchDialog->setItems(m_searchList);
    1378     if (searchDialog->ExecPopupAtXY(-1, 8) == 0)
     1387    DialogCode rescode = searchDialog->ExecPopupAtXY(-1, 8);
     1388    if (kDialogCodeRejected != rescode)
    13791389    {
    13801390        value = searchDialog->getResult();
    13811391        res = true;
    13821392    }
    13831393
    1384     delete searchDialog;
     1394    searchDialog->deleteLater();
     1395    searchDialog = NULL;
    13851396    setActiveWindow();
    13861397
    13871398    return res;
     
    13951406                                  "edit_metadata", "music-", "edit metadata");
    13961407    editDialog.setSaveMetadataOnly();
    13971408
    1398     if (editDialog.exec())
     1409    if (kDialogCodeRejected != editDialog.exec())
    13991410    {
    14001411        updateTrackList();
    14011412    }
  • mythplugins/mythmusic/mythmusic/smartplaylist.cpp

     
    624624   
    625625    SmartPLDateDialog *dateDialog = new SmartPLDateDialog(gContext->GetMainWindow(), "");
    626626    dateDialog->setDate(combo->currentText());
    627     if (dateDialog->ExecPopup() == 0)
     627    if (kDialogCodeAccepted == dateDialog->ExecPopup())
    628628    {
    629629        combo->insertItem(dateDialog->getDate());
    630630        combo->setCurrentText(dateDialog->getDate());
    631631        res = true;
    632632    }
    633    
    634     delete dateDialog;
     633
     634    dateDialog->hide();
     635    dateDialog->deleteLater();
    635636}
    636637         
    637638bool SmartPLCriteriaRow::showList(QString caption, QString &value)
     
    642643    searchDialog->setCaption(caption);
    643644    searchDialog->setSearchText(value);
    644645    searchDialog->setItems(searchList);
    645     if (searchDialog->ExecPopup() == 0)
     646    if (kDialogCodeAccepted == searchDialog->ExecPopup())
    646647    {
    647648        value = searchDialog->getResult();
    648649        res = true;
    649650    }
    650651
    651     delete searchDialog;
     652    searchDialog->deleteLater();
    652653
    653654    return res;
    654655}
     
    10891090    connect(titleEdit, SIGNAL(textChanged(void)), this, SLOT(titleChanged(void)));
    10901091    connect(categoryButton, SIGNAL(clicked()), this, SLOT(categoryClicked()));
    10911092    connect(saveButton, SIGNAL(clicked()), this, SLOT(saveClicked()));
    1092     connect(cancelButton, SIGNAL(clicked()), this, SLOT(cancelClicked()));
     1093    connect(cancelButton, SIGNAL(clicked()), this, SLOT(reject()));
    10931094    connect(showResultsButton, SIGNAL(clicked()), this, SLOT(showResultsClicked()));
    10941095    connect(orderByButton, SIGNAL(clicked()), this, SLOT(orderByClicked()));
    10951096   
     
    12111212        row->saveToDatabase(ID);
    12121213    }
    12131214   
    1214     done(0);       
     1215    reject();       
    12151216}
    12161217
    12171218void SmartPlaylistEditor::newSmartPlaylist(QString category)
     
    13081309    }
    13091310}
    13101311
    1311 void SmartPlaylistEditor::cancelClicked(void)
    1312 {
    1313     done(-1);
    1314 }
    1315 
    13161312void SmartPlaylistEditor::categoryClicked(void)
    13171313{
    13181314   showCategoryPopup();
     
    13701366        return;
    13711367
    13721368    category_popup->hide();
    1373     delete category_popup;
     1369    category_popup->deleteLater();
    13741370    category_popup = NULL;
    13751371    categoryButton->setFocus();
    13761372}
     
    15151511   
    15161512    orderByDialog->setFieldList(orderByCombo->currentText());
    15171513   
    1518     if (orderByDialog->ExecPopup() == 0)
     1514    if (kDialogCodeAccepted == orderByDialog->ExecPopup())
    15191515        orderByCombo->setCurrentText(orderByDialog->getFieldList());
    15201516   
    15211517    delete orderByDialog;
     
    18751871            if (action == "ESCAPE")
    18761872            {
    18771873                handled = true;
    1878                 done(-1);       
     1874                reject();
    18791875            }
    18801876            else if (action == "LEFT")
    18811877            {
     
    21772173    connect(moveDownButton, SIGNAL(clicked()), this, SLOT(moveDownPressed()));
    21782174    connect(ascendingButton, SIGNAL(clicked()), this, SLOT(ascendingPressed()));
    21792175    connect(descendingButton, SIGNAL(clicked()), this, SLOT(descendingPressed()));
    2180     connect(okButton, SIGNAL(clicked()), this, SLOT(okPressed()));
     2176    connect(okButton, SIGNAL(clicked()), this, SLOT(accept()));
    21812177   
    21822178    connect(listbox, SIGNAL(selectionChanged(QListBoxItem*)), this,
    21832179            SLOT(listBoxSelectionChanged(QListBoxItem*)));
     
    22442240            if (action == "ESCAPE")
    22452241            {
    22462242                handled = true;
    2247                 done(-1);       
     2243                reject();
    22482244            }
    22492245            else if (action == "LEFT")
    22502246            {
     
    22992295            else if (action == "7")
    23002296            {
    23012297                handled = true;
    2302                 okPressed();
     2298                accept();
    23032299            }
    23042300        }
    23052301    }
     
    23682364    listbox->setSelected(listbox->selectedItem()->next(), true);
    23692365}
    23702366
    2371 void SmartPLOrderByDialog::okPressed(void)
    2372 {
    2373     done(0);
    2374 }
    2375 
    23762367void SmartPLOrderByDialog::orderByChanged(void)
    23772368{
    23782369    bool found = false;
     
    25522543
    25532544    addLayout(vbox, 0);
    25542545   
    2555     connect(okButton, SIGNAL(clicked()), this, SLOT(okPressed()));
    2556     connect(cancelButton, SIGNAL(clicked()), this, SLOT(cancelPressed()));
     2546    connect(okButton, SIGNAL(clicked()), this, SLOT(accept()));
     2547    connect(cancelButton, SIGNAL(clicked()), this, SLOT(reject()));
    25572548
    25582549    connect(fixedRadio, SIGNAL(toggled(bool)), this, SLOT(fixedCheckToggled(bool)));
    25592550    connect(nowRadio, SIGNAL(toggled(bool)), this, SLOT(nowCheckToggled(bool)));
     
    26622653            if (action == "ESCAPE")
    26632654            {
    26642655                handled = true;
    2665                 done(-1);       
     2656                reject();
    26662657            }
    26672658            else if (action == "LEFT")
    26682659            {
     
    26902681        MythPopupBox::keyPressEvent(e);
    26912682}
    26922683
    2693 void SmartPLDateDialog::okPressed(void)
    2694 {
    2695     done(0);
    2696 }
    2697 
    2698 void SmartPLDateDialog::cancelPressed(void)
    2699 {
    2700     done(-1);
    2701 }
    2702 
    27032684void SmartPLDateDialog::fixedCheckToggled(bool on)
    27042685{
    27052686    daySpinEdit->setEnabled(on);
  • mythplugins/mythmusic/mythmusic/editmetadata.cpp

     
    521521    searchDialog->setCaption(caption);
    522522    searchDialog->setSearchText(value);
    523523    searchDialog->setItems(searchList);
    524     if (searchDialog->ExecPopupAtXY(-1, 8) == 0)
     524    DialogCode rescode = searchDialog->ExecPopupAtXY(-1, 8);
     525    if (kDialogCodeRejected != rescode)
    525526    {
    526527        value = searchDialog->getResult();
    527528        res = true;
    528529    }
    529530
    530     delete searchDialog;
     531    searchDialog->deleteLater();
    531532    setActiveWindow();
    532533
    533534    return res;
     
    600601void EditMetadataDialog::closeDialog()
    601602{
    602603    cancelPopup();
    603     done(1); 
     604    accept();
    604605}
    605606
    606607void EditMetadataDialog::showSaveMenu()
     
    646647
    647648  popup->hide();
    648649
    649   delete popup;
     650  popup->deleteLater();
    650651  popup = NULL;
    651652  setActiveWindow();
    652653}
     
    656657    cancelPopup();
    657658
    658659    *m_sourceMetadata = m_metadata;
    659     done(1);
     660    accept();
    660661}
    661662
    662663void EditMetadataDialog::saveToDatabase()
     
    665666
    666667    m_metadata->dumpToDatabase();
    667668    *m_sourceMetadata = m_metadata;
    668     done(1);
     669    accept();
    669670}
    670671
    671672void EditMetadataDialog::saveToFile()
     
    687688        decoder->commitMetadata(m_metadata);
    688689        delete decoder;
    689690    }
    690     done(1);
     691    accept();
    691692}
    692693
    693694void EditMetadataDialog::saveAll()
     
    729730    menu->addButton(albumArt->getTypeName(IT_CD));
    730731    menu->addButton(albumArt->getTypeName(IT_INLAY));
    731732
    732     int res = menu->ExecPopup();
     733    DialogCode ret = menu->ExecPopup();
     734    int res = MythDialog::CalcItemIndex(ret);
    733735
    734     if ( res != -1)
     736    if ((IT_UNKNOWN <= res) && (res < IT_LAST))
    735737    {
    736738        // get selected image in grid
    737739        ImageGridItem *item = coverart_grid->getCurrentItem();
     
    752754        }
    753755    }
    754756
    755     delete menu;
     757    menu->deleteLater();
    756758}
    757759
    758760void EditMetadataDialog::setSaveMetadataOnly()
  • mythplugins/mythmusic/mythmusic/databasebox.cpp

     
    5656    tree = getUIListTreeType("musictree");
    5757    if (!tree)
    5858    {
    59         DialogBox diag(gContext->GetMainWindow(), tr("The theme you are using "
    60                        "does not contain a 'musictree' element.  "
    61                        "Please contact the theme creator and ask if they could "
    62                        "please update it.<br><br>The next screen will be empty."
    63                        "  Escape out of it to return to the menu."));
    64         diag.AddButton(tr("OK"));
    65         diag.exec();
     59        DialogBox *dlg = new DialogBox(
     60            gContext->GetMainWindow(),
     61            tr("The theme you are using "
     62               "does not contain a 'musictree' element.  "
     63               "Please contact the theme creator and ask if they could "
     64               "please update it.<br><br>The next screen will be empty."
     65               "  Escape out of it to return to the menu."));
     66        dlg->AddButton(tr("OK"));
     67        dlg->exec();
     68        dlg->deleteLater();
    6669
    6770        return;
    6871    }
     
    7881
    7982    if (m_lines.count() < 3)
    8083    {
    81         DialogBox diag(gContext->GetMainWindow(), tr("The theme you are using "
    82                        "does not contain any info lines in the music element.  "
    83                        "Please contact the theme creator and ask if they could "
    84                        "please update it."));
    85         diag.AddButton(tr("OK"));
    86         diag.exec();
     84        DialogBox *dlg = new DialogBox(
     85            gContext->GetMainWindow(),
     86            tr("The theme you are using "
     87               "does not contain any info lines in the music element.  "
     88               "Please contact the theme creator and ask if they could "
     89               "please update it."));
     90        dlg->AddButton(tr("OK"));
     91        dlg->exec();
     92        dlg->deleteLater();
    8793    }
    8894
    8995    connect(tree, SIGNAL(itemEntered(UIListTreeType *, UIListGenericTree *)),
     
    387393        return;
    388394
    389395    error_popup->hide();
    390     delete error_popup;
     396    error_popup->deleteLater();
    391397    error_popup = NULL;
    392398}
    393399
     
    430436    system(command);
    431437
    432438    record_progress->Close();
    433     delete record_progress;
     439    record_progress->deleteLater();
    434440}
    435441
    436442void DatabaseBox::deletePlaylist()
     
    820826        return;
    821827
    822828    playlist_popup->hide();
    823     delete playlist_popup;
     829    playlist_popup->deleteLater();
    824830    playlist_popup = NULL;
    825831}
    826832
     
    928934        return;
    929935
    930936    active_popup->hide();
    931     delete active_popup;
     937    active_popup->deleteLater();
    932938    active_popup = NULL;
    933939}
    934940
  • mythplugins/mythmusic/mythmusic/smartplaylist.h

     
    112112    void updateMatches(void);
    113113    void categoryClicked(void);
    114114    void saveClicked(void);
    115     void cancelClicked(void);
    116115    void showResultsClicked(void);
    117116   
    118117    // category popup
     
    232231    void descendingPressed(void);
    233232    void orderByChanged(void);
    234233    void listBoxSelectionChanged(QListBoxItem *item);
    235     void okPressed(void);
    236234   
    237235 protected:
    238236    void keyPressEvent(QKeyEvent *e);
     
    271269    void addDaysCheckToggled(bool on);
    272270    void valueChanged(void);
    273271   
    274     void okPressed(void);
    275     void cancelPressed(void);
    276        
    277272 protected:
    278273    void keyPressEvent(QKeyEvent *e);
    279274
  • mythplugins/mythmusic/mythmusic/importmusic.h

     
    150150    void copyPressed(void);
    151151    void prevPressed(void);
    152152    void nextPressed(void);
    153     void exitPressed(void);
    154153    void selectorChanged(int item);
    155154
    156155  private:
  • mythplugins/mythmusic/mythmusic/main.cpp

     
    206206
    207207void RebuildMusicTree(MusicData *mdata)
    208208{
    209     MythBusyDialog busy(QObject::tr("Rebuilding music tree"));
    210     busy.start();
     209    MythBusyDialog *busy = new MythBusyDialog(
     210        QObject::tr("Rebuilding music tree"));
     211
     212    busy->start();
    211213    mdata->all_music->startLoading();
    212214    while (!mdata->all_music->doneLoading())
    213215    {
     
    215217        usleep(50000);
    216218    }
    217219    mdata->all_playlists->postLoad();
    218     busy.Close();
     220    busy->Close();
     221    busy->deleteLater();
    219222}
    220223
    221224static void postMusic(MusicData *mdata);
  • mythplugins/mythmusic/mythmusic/search.h

     
    3333
    3434    void searchTextChanged(const QString &searchText);
    3535    void itemSelected(int i);
    36     void okPressed(void);
    37     void cancelPressed(void);
    3836
    3937  private:
    4038
  • mythplugins/mythmusic/mythmusic/importmusic.cpp

     
    359359{
    360360    DirectoryFinder finder(m_location_edit->getText(),
    361361                           gContext->GetMainWindow(), "directory finder");
    362     bool res = finder.exec();
     362    DialogCode res = finder.exec();
    363363
    364     if (res)
     364    if (kDialogCodeRejected != res)
    365365    {
    366366        m_location_edit->setText(finder.getSelected());
    367367        editLostFocus();
     
    607607    fillWidgets();
    608608
    609609    busy->close();
    610     delete busy;
     610    busy->deleteLater();
    611611}
    612612
    613613void ImportMusicDialog::doScan()
     
    674674                                  "edit_metadata", "music-", "edit metadata");
    675675    editDialog.setSaveMetadataOnly();
    676676
    677     if (editDialog.exec())
     677    if (kDialogCodeRejected != editDialog.exec())
    678678    {
    679679        m_tracks->at(m_currentTrack)->metadataHasChanged = true;
    680680        m_tracks->at(m_currentTrack)->isNewTune = Ripper::isNewTune(
     
    736736        return;
    737737
    738738    m_popupMenu->hide();
    739     delete m_popupMenu;
     739    m_popupMenu->deleteLater();
    740740    m_popupMenu = NULL;
    741741}
    742742
     
    10101010    if (m_exit_button)
    10111011    {
    10121012        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()));
    10141014    }
    10151015
    10161016    m_prev_button = getUIPushButtonType("prev_button");
     
    10451045    updateStatus();
    10461046}
    10471047
    1048 void ImportCoverArtDialog::exitPressed()
    1049 {
    1050     done(0);
    1051 }
    1052 
    10531048void ImportCoverArtDialog::copyPressed()
    10541049{
    10551050    if (m_filelist.size() > 0)
  • mythplugins/mythmusic/mythmusic/filescanner.cpp

     
    369369    clean_progress->setProgress(++counter);
    370370
    371371    clean_progress->Close();
    372     delete clean_progress;
     372    clean_progress->deleteLater();
    373373}
    374374
    375375/*!
     
    506506    busy->start();
    507507    BuildFileList(m_startdir, music_files, 0);
    508508    busy->Close();
    509     delete busy;
     509    busy->deleteLater();
    510510
    511511    ScanMusic(music_files);
    512512    ScanArtwork(music_files);
     
    540540        file_checking->setProgress(++counter);
    541541    }
    542542    file_checking->Close();
    543     delete file_checking;
     543    file_checking->deleteLater();
    544544
    545545    // Cleanup orphaned entries from the database
    546546    cleanDB();
     
    602602    }
    603603
    604604    file_checking->Close();
    605     delete file_checking;
     605    file_checking->deleteLater();
    606606}
    607607
    608608/*!
     
    659659    }
    660660
    661661    file_checking->Close();
    662     delete file_checking;
     662    file_checking->deleteLater();
    663663}
  • mythplugins/mytharchive/mytharchive/thumbfinder.cpp

     
    899899        return;
    900900
    901901    m_popupMenu->hide();
    902     delete m_popupMenu;
     902    m_popupMenu->deleteLater();
    903903    m_popupMenu = NULL;
    904904}
    905905
  • mythplugins/mytharchive/mytharchive/videoselector.cpp

     
    5555
    5656        if (action == "ESCAPE")
    5757        {
    58             done(0);
     58            reject();
    5959        }
    6060        else if (action == "DOWN")
    6161        {
     
    165165        return;
    166166
    167167    popupMenu->hide();
    168     delete popupMenu;
     168    popupMenu->deleteLater();
    169169    popupMenu = NULL;
    170170}
    171171
     
    603603                password,
    604604                gContext->GetMainWindow());
    605605        pwd->exec();
    606         delete pwd;
     606        pwd->deleteLater();
    607607        if (ok)
    608608        {
    609609            //  All is good
  • mythplugins/mytharchive/mytharchive/logviewer.h

     
    2121    void setFilenames(const QString &progressLog, const QString &fullLog);
    2222
    2323  protected slots:
    24     void exitClicked(void);
    2524    void cancelClicked(void);
    2625    void updateClicked(void);
    2726    void updateTimerTimeout(void);
  • mythplugins/mytharchive/mytharchive/archiveutil.cpp

     
    260260    DialogBox *dialog = new DialogBox(gContext->GetMainWindow(), msg);
    261261    dialog->AddButton(QObject::tr("OK"));
    262262    dialog->exec();
    263     delete dialog;
     263    dialog->deleteLater();
    264264}
    265265
    266266/* vim: set expandtab tabstop=4 shiftwidth=4: */
  • mythplugins/mytharchive/mytharchive/fileselector.cpp

     
    206206         || !m_cancelButton || !m_homeButton)
    207207    {
    208208        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()));
    210210    }
    211211
    212212    // load pixmaps
  • mythplugins/mytharchive/mytharchive/main.cpp

     
    103103void runCreateDVD(void)
    104104{
    105105#ifdef CREATE_DVD
    106     int res;
    107 
    108106    QString commandline;
    109107    QString tempDir = getTempDirectory(true);
    110108
     
    132130    burnWiz = new MythburnWizard(gContext->GetMainWindow(),
    133131                             "mythburn_wizard", "mythburn-");
    134132    qApp->unlock();
    135     res = burnWiz->exec();
     133    DialogCode res = burnWiz->exec();
    136134    qApp->lock();
    137135    qApp->processEvents();
    138136    delete burnWiz;
    139137
    140     if (res == 0)
     138    if (kDialogCodeRejected == res)
    141139        return;
    142140
    143141    // now show the log viewer
     
    152150void runCreateArchive(void)
    153151{
    154152#ifdef CREATE_NATIVE
    155     int res;
    156 
    157153    QString commandline;
    158154    QString tempDir = getTempDirectory(true);
    159155
     
    181177    nativeWiz = new ExportNativeWizard(gContext->GetMainWindow(),
    182178                                 "exportnative_wizard", "mythnative-");
    183179    qApp->unlock();
    184     res = nativeWiz->exec();
     180    DialogCode res = nativeWiz->exec();
    185181    qApp->lock();
    186182    qApp->processEvents();
    187183    delete nativeWiz;
    188184
    189     if (res == 0)
     185    if (kDialogCodeRejected == res)
    190186        return;
    191187
    192188    // now show the log viewer
     
    231227    ImportNativeWizard wiz("/", filter, gContext->GetMainWindow(),
    232228                          "import_native_wizard", "mythnative-", "import native wizard");
    233229    qApp->unlock();
    234     int res = wiz.exec();
     230    DialogCode res = wiz.exec();
    235231    qApp->lock();
    236232
    237     if (res == 0)
     233    if (kDialogCodeRejected == res)
    238234        return;
    239235
    240236    // now show the log viewer
     
    311307        return;
    312308    }
    313309
    314     int res;
    315 
    316310    // ask the user what type of disk to burn to
    317311    DialogBox *dialog = new DialogBox(gContext->GetMainWindow(),
    318312            QObject::tr("\nPlace a blank DVD in the drive and select an option below."));
     
    322316    dialog->AddButton(QObject::tr("Burn DVD Rewritable (Force Erase)"));
    323317    dialog->AddButton(QObject::tr("Cancel"));
    324318
    325     res = dialog->exec();
    326     delete dialog;
     319    DialogCode res = dialog->exec();
     320    dialog->deleteLater();
    327321
    328     // cancel pressed?
    329     if (res == 4)
     322    // cancel pressed or escape hit?
     323    if ((kDialogCodeButton3 == res) || (kDialogCodeRejected == res))
    330324        return;
    331325
     326    int fmt = MythDialog::CalcItemIndex(res);
     327    if ((fmt < 0) || (fmt > 2))
     328        return;
     329
    332330    QString tempDir = getTempDirectory(true);
    333331
    334332    if (tempDir == "")
     
    346344    if (QFile::exists(logDir + "/mythburncancel.lck"))
    347345        QFile::remove(logDir + "/mythburncancel.lck");
    348346
    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";
    351349    QString sNativeFormat = (gContext->GetSetting("MythArchiveLastRunType").startsWith("Native") ? "1" : "0");
    352350
    353351    commandline = "mytharchivehelper -b " + sArchiveFormat + " " + sEraseDVDRW  + " " + sNativeFormat;
  • mythplugins/mytharchive/mytharchive/editmetadata.h

     
    3232    void closeDialog();
    3333    void showSaveMenu();
    3434    void savePressed();
    35     void cancelPressed();
    3635    void editLostFocus();
    3736
    3837  private:
  • mythplugins/mytharchive/mytharchive/importnativewizard.cpp

     
    259259         || !m_prevButton || !m_cancelButton || !m_homeButton)
    260260    {
    261261        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()));
    263263    }
    264264
    265265    // load pixmaps
     
    718718    searchDialog->setCaption(caption);
    719719    searchDialog->setSearchText(value);
    720720    searchDialog->setItems(m_searchList);
    721     if (searchDialog->ExecPopupAtXY(-1, 8) == 0)
     721    DialogCode rescode = searchDialog->ExecPopupAtXY(-1, 8);
     722    if (kDialogCodeRejected != rescode)
    722723    {
    723724        value = searchDialog->getResult();
    724725        res = true;
    725726    }
    726727
    727     delete searchDialog;
     728    searchDialog->deleteLater();
    728729    setActiveWindow();
    729730
    730731    return res;
  • mythplugins/mytharchive/mytharchive/logviewer.cpp

     
    100100
    101101    hbox->addWidget(m_exitButton);
    102102
    103     connect(m_exitButton, SIGNAL(clicked()), this, SLOT(exitClicked()));
     103    connect(m_exitButton, SIGNAL(clicked()), this, SLOT(reject()));
    104104    connect(m_cancelButton, SIGNAL(clicked()), this, SLOT(cancelClicked()));
    105105    connect(m_updateButton, SIGNAL(clicked()), this, SLOT(updateClicked()));
    106106    connect(m_autoupdateCheck, SIGNAL(toggled(bool)), this, SLOT(toggleAutoUpdate(bool)));
     
    150150    m_updateTimer->changeInterval(value * 1000);
    151151}
    152152
    153 void LogViewer::exitClicked(void)
    154 {
    155     done(-1);
    156 }
    157 
    158153void LogViewer::cancelClicked(void)
    159154{
    160155    QString tempDir = gContext->GetSetting("MythArchiveTempDir", "");
     
    368363        return;
    369364
    370365    m_popupMenu->hide();
    371     delete m_popupMenu;
     366    m_popupMenu->deleteLater();
    372367    m_popupMenu = NULL;
    373368}
  • mythplugins/mytharchive/mytharchive/exportnativewizard.cpp

     
    529529        return;
    530530
    531531    popupMenu->hide();
    532     delete popupMenu;
     532    popupMenu->deleteLater();
    533533    popupMenu = NULL;
    534534}
    535535
     
    680680    FileSelector selector(FSTYPE_FILE, "/", "*.*", gContext->GetMainWindow(),
    681681                          "file_selector", "mytharchive-", "file selector");
    682682    qApp->unlock();
    683     bool res = selector.exec();
     683    bool res = (kDialogCodeRejected != selector.exec());
    684684
    685685    if (res)
    686686    {
  • mythplugins/mytharchive/mytharchive/recordingselector.cpp

     
    5656
    5757        if (action == "ESCAPE")
    5858        {
    59             done(0);
     59            done(kDialogCodeRejected);
    6060        }
    6161        else if (action == "DOWN")
    6262        {
     
    150150        return;
    151151
    152152    popupMenu->hide();
    153     delete popupMenu;
     153    popupMenu->deleteLater();
    154154    popupMenu = NULL;
    155155}
    156156
  • mythplugins/mytharchive/mytharchive/editmetadata.cpp

     
    146146    if (cancel_button)
    147147    {
    148148        cancel_button->setText(tr("Cancel"));
    149         connect(cancel_button, SIGNAL(pushed()), this, SLOT(cancelPressed()));
     149        connect(cancel_button, SIGNAL(pushed()), this, SLOT(reject()));
    150150    }
    151151
    152152    buildFocusList();
     
    182182{
    183183    *sourceMetadata = workMetadata;
    184184    sourceMetadata->editedDetails = true;
    185     done(1);
     185    done(kDialogCodeAccepted);
    186186}
    187187
    188 void EditMetadataDialog::cancelPressed()
    189 {
    190     done(Rejected);
    191 }
    192 
    193188EditMetadataDialog::~EditMetadataDialog()
    194189{
    195190}
  • mythplugins/mytharchive/mytharchive/mythburnwizard.cpp

     
    13531353        return;
    13541354
    13551355    popupMenu->hide();
    1356     delete popupMenu;
     1356    popupMenu->deleteLater();
    13571357    popupMenu = NULL;
    13581358}
    13591359
     
    14031403
    14041404    EditMetadataDialog editDialog(curItem, gContext->GetMainWindow(),
    14051405                                  "edit_metadata", "mythburn-", "edit metadata");
    1406     if (editDialog.exec())
     1406    if (kDialogCodeRejected != editDialog.exec())
    14071407    {
    14081408        // update widgets to reflect any changes
    14091409        titleChanged(item);
     
    14771477    FileSelector selector(FSTYPE_FILE, "/", "*.*", gContext->GetMainWindow(),
    14781478                          "file_selector", "mytharchive-", "file selector");
    14791479    qApp->unlock();
    1480     bool res = selector.exec();
     1480    bool res = (kDialogCodeRejected != selector.exec());
    14811481
    14821482    if (res)
    14831483    {
  • mythplugins/mythbrowser/mythbrowser/tabview.cpp

     
    3838#include "mythtv/mythdbcon.h"
    3939#include "mythtv/mythwidgets.h"
    4040#include "mythtv/virtualkeyboard.h"
     41#include "mythtv/mythdialogs.h"
    4142
    42 
    4343using namespace std;
    4444
    4545TabView::TabView(MythMainWindow *parent, const char *name, QStringList urls,
     
    173173    if (menuIsOpen)
    174174    {
    175175        menu->hide();
    176         delete menu;
     176        menu->deleteLater();
    177177        menu = NULL;
    178178        menuIsOpen = false;
    179179        hadFocus->setFocus();
     
    322322    url->setText(((WebPage*)mytab->currentPage())->browser->baseURL().htmlURL());
    323323    popup->addWidget(url);
    324324
    325     popup->addButton(tr("OK"));
    326     popup->addButton(tr("Cancel"));
     325    popup->addButton(tr("OK"),     popup, SLOT(accept()));
     326    popup->addButton(tr("Cancel"), popup, SLOT(reject()));
    327327
    328328    qApp->removeEventFilter(this);
    329     int res = popup->ExecPopup();
     329    DialogCode res = popup->ExecPopup();
    330330    qApp->installEventFilter(this);
    331331
    332     if (res == 0)
     332    if (kDialogCodeAccepted == res)
    333333    {
    334334        QString sGroup = group->text();
    335335        QString sDesc = desc->text();
     
    338338        finishAddBookmark(sGroup, sDesc, sUrl);
    339339    }
    340340
    341     delete popup;
     341    popup->deleteLater();
    342342
    343343    hadFocus->setFocus();
    344344}
     
    391391    popup->addWidget(editor);
    392392    editor->setFocus();
    393393
    394     popup->addButton(tr("OK"));
    395     popup->addButton(tr("Cancel"));
     394    popup->addButton(tr("OK"),     popup, SLOT(accept()));
     395    popup->addButton(tr("Cancel"), popup, SLOT(reject()));
    396396
    397397    qApp->removeEventFilter(this);
    398     int res = popup->ExecPopup();
     398    DialogCode res = popup->ExecPopup();
    399399    qApp->installEventFilter(this);
    400400
    401     if (res == 0)
     401    if (kDialogCodeAccepted == res)
    402402    {
    403403        QString sURL = editor->text();
    404404        if (!sURL.startsWith("http://") && !sURL.startsWith("https://") &&
     
    408408        newPage(sURL);
    409409    }
    410410
    411     delete popup;
     411    popup->deleteLater();
    412412
    413413    hadFocus->setFocus();
    414414}
  • mythplugins/mythweather/mythweather/sourceManager.h

     
    2828    bool findScripts();
    2929    bool findScriptsDB();
    3030    void setupSources();
    31     void connectScreen(uint id, WeatherScreen *screen);
    32     void disconnectScreen(WeatherScreen *screen);
     31    bool connectScreen(uint id, WeatherScreen *screen);
     32    bool disconnectScreen(WeatherScreen *screen);
    3333    ScriptInfo *getSourceByName(const QString &name);
    3434
    3535  private slots:
  • mythplugins/mythweather/mythweather/weatherSetup.cpp

     
    518518    }
    519519}
    520520
     521inline QString format_msg(
     522    const QStringList &notDefined, 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
    521572void ScreenSetup::saveData()
    522573{
    523574    // check if all active screens have sources/locations defined
     
    547598
    548599    if (notDefined.size())
    549600    {
    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);
    552604        MythPopupBox::showOkPopup(gContext->GetMainWindow(),
    553605                                  "Undefined Sources", msg);
    554606        return;
     
    627679    accept();
    628680}
    629681
    630 void ScreenSetup::doListSelect(UIListBtnType *list, UIListBtnTypeItem *selected)
     682typedef QMap<DialogCode, QString> CommandMap;
     683
     684static DialogCode add_button(QStringList   &buttons,
     685                             CommandMap    &commands,
     686                             const QString &button_text,
     687                             const QString &command)
    631688{
     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
     696void ScreenSetup::doListSelect(UIListBtnType *list,
     697                               UIListBtnTypeItem *selected)
     698{
    632699    QString txt = selected->text();
    633700    if (list == m_active_list)
    634701    {
    635702        ScreenListInfo *si = (ScreenListInfo *) selected->getData();
    636703        QStringList buttons;
     704        CommandMap commands;
     705
    637706        if (!si->multiLoc)
    638             buttons << tr("Change Location");
     707            add_button(buttons, commands, tr("Change Location"), "change_loc");
    639708
    640709        if (si->hasUnits)
    641             buttons << tr("Change Units");
     710            add_button(buttons, commands, tr("Change Units"), "change_units");
    642711
    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")
    650727        {
    651728            doLocationDialog(si, true);
    652729        }
    653         else if (result == tr("Change Units"))
     730        else if (cmd == "change_units")
    654731        {
    655732            showUnitsPopup(selected->text(),
    656733                           (ScreenListInfo *) selected->getData());
    657734            updateHelpText();
    658735        }
    659         else if (result == tr("Move Up"))
     736        else if (cmd == "move_up")
    660737        {
    661738            list->MoveItemUpDown(selected, true);
    662739        }
    663         else if (result == tr("Move Down"))
     740        else if (cmd == "move_down")
    664741        {
    665742            list->MoveItemUpDown(selected, false);
    666743        }
    667         else if (result == tr("Remove"))
     744        else if (cmd == "remove")
    668745        {
    669746            deleteScreen(list);
    670747        }
     
    798875    units_t *units = &si->units;
    799876    QStringList unitsBtns;
    800877    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
    805883    switch (ret)
    806884    {
    807         case 0:
     885        case kDialogCodeButton0:
    808886            *units = ENG_UNITS;
    809887            break;
    810         case 1:
     888        case kDialogCodeButton1:
    811889            *units = SI_UNITS;
    812890            break;
    813891        default:
  • mythplugins/mythweather/mythweather/sourceManager.cpp

     
    7373    QDir dir(path);
    7474    dir.setFilter(QDir::Executable | QDir::Files);
    7575    // this kinda goes against idea of keeping ui separate, but oh well
    76     MythProgressDialog bsydlg(tr("Searching for scripts"), dir.count());
     76    MythProgressDialog *busyd = new MythProgressDialog(
     77        tr("Searching for scripts"), dir.count());
    7778    int progress = 0;
    7879
    7980    if (!dir.exists())
     
    100101                VERBOSE(VB_GENERAL, "found script " + file->absFilePath());
    101102            }
    102103        }
    103         bsydlg.setProgress(++progress);
     104        busyd->setProgress(++progress);
    104105    }
    105106    // run through and see if any scripts have been deleted
    106107    MSqlQuery db(MSqlQuery::InitCon());
     
    129130            VERBOSE(VB_IMPORTANT,  db.lastError().text());
    130131        }
    131132    }
    132     bsydlg.Close();
     133    busyd->Close();
     134    busyd->deleteLater();
    133135
    134136    return m_scripts.count() > 0;
    135137}
     
    296298        return false;
    297299}
    298300
    299 void SourceManager::connectScreen(uint id, WeatherScreen *screen)
     301bool SourceManager::connectScreen(uint id, WeatherScreen *screen)
    300302{
     303    if (!screen)
     304    {
     305        VERBOSE(VB_IMPORTANT, LOC_ERR +
     306                "Can not connect nonexistent screen "<<screen);
     307
     308        return false;
     309    }
     310
    301311    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    }
    302319    ws->connectScreen(screen);
     320    return true;
    303321}
    304322
    305 void SourceManager::disconnectScreen(WeatherScreen *screen)
     323bool SourceManager::disconnectScreen(WeatherScreen *screen)
    306324{
     325    if (!screen)
     326    {
     327        VERBOSE(VB_IMPORTANT, LOC_ERR +
     328                "Can not disconnect nonexistent screen "<<screen);
     329
     330        return false;
     331    }
     332
    307333    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    }
    308341    ws->disconnectScreen(screen);
     342    return true;
    309343}
  • mythplugins/mythgallery/mythgallery/iconview.cpp

     
    155155        }
    156156        else
    157157        {
    158             DialogBox dialog(gContext->GetMainWindow(),
     158            DialogBox *dlg = new DialogBox(gContext->GetMainWindow(),
    159159                             tr("Failed to mount device: ") +
    160160                             m_currDevice->getDevicePath() + "\n\n" +
    161161                             tr("Showing the default MythGallery directory."));
    162             dialog.AddButton(tr("OK"));
    163             dialog.exec();
     162            dlg->AddButton(tr("OK"));
     163            dlg->exec();
     164            dlg->deleteLater();
    164165            mon->Unlock(m_currDevice);
    165166        }
    166167    }
     
    13291330    QFileInfo path;
    13301331    QDir importdir;
    13311332
    1332     DialogBox importDiag(gContext->GetMainWindow(), tr("Import pictures?"));
    1333     importDiag.AddButton(tr("No"));
    1334     importDiag.AddButton(tr("Yes"));
    1335     if (importDiag.exec() != 2)
     1333    DialogBox *importDlg = new DialogBox(
     1334        gContext->GetMainWindow(), tr("Import pictures?"));
     1335
     1336    importDlg->AddButton(tr("No"));
     1337    importDlg->AddButton(tr("Yes"));
     1338    DialogCode code = importDlg->exec();
     1339    importDlg->deleteLater();
     1340    if (kDialogCodeButton1 != code)
    13361341        return;
    13371342
    13381343    // Makes import directory samba/windows friendly (no colon)
     
    13711376        // (QT < 3.1) rely on automatic fail if dir not empty
    13721377        if (importdir.rmdir(importdir.absPath()))
    13731378        {
    1374             DialogBox nopicsDiag(gContext->GetMainWindow(),
    1375                                  tr("Nothing found to import"));
    1376             nopicsDiag.AddButton(tr("OK"));
    1377             nopicsDiag.exec();
     1379            DialogBox *nopicsDlg = new DialogBox(
     1380                gContext->GetMainWindow(), tr("Nothing found to import"));
     1381
     1382            nopicsDlg->AddButton(tr("OK"));
     1383            nopicsDlg->exec();
     1384            nopicsDlg->deleteLater();
     1385
    13781386            return;
    13791387        }
    13801388
     
    15541562                msg = tr("Failed to rename directory");
    15551563            else
    15561564                msg = tr("Failed to rename file");
    1557             DialogBox dialog(gContext->GetMainWindow(), msg);
    1558             dialog.AddButton(tr("OK"));
    1559             dialog.exec();
    15601565
     1566            DialogBox *dlg = new DialogBox(gContext->GetMainWindow(), msg);
     1567            dlg->AddButton(tr("OK"));
     1568            dlg->exec();
     1569            dlg->deleteLater();
     1570
    15611571            return;
    15621572        }
    15631573
     
    16391649    }
    16401650
    16411651    progress->Close();
    1642     delete progress;
     1652    progress->deleteLater();
    16431653
    16441654    LoadDirectory(m_currDir, true);
    16451655}
  • mythplugins/mythgallery/mythgallery/main.cpp

     
    2525        icv.exec();
    2626    else
    2727    {
    28         DialogBox diag(gContext->GetMainWindow(), icv.GetError());
    29         diag.AddButton(QObject::tr("Ok"));
    30         diag.exec();
     28        DialogBox *dlg = new DialogBox(
     29            gContext->GetMainWindow(), icv.GetError());
     30
     31        dlg->AddButton(QObject::tr("Ok"));
     32        dlg->exec();
     33        dlg->deleteLater();
    3134    }
    3235}
    3336
  • mythplugins/mythmovies/mythmovies/moviesui.cpp

     
    346346    updateDataTrees();
    347347    drawDisplayTree();
    348348    menuPopup->hide();
    349     delete menuPopup;
     349    menuPopup->deleteLater();
    350350    menuPopup = NULL;
    351351}
    352352
     
    355355    if (!menuPopup)
    356356        return;
    357357    menuPopup->hide();
    358     delete menuPopup;
     358    menuPopup->deleteLater();
    359359    menuPopup = NULL;
    360360}
    361361
     
    383383        return;
    384384
    385385    aboutPopup->hide();
    386     delete aboutPopup;
     386    aboutPopup->deleteLater();
    387387    aboutPopup = NULL;
    388388}
    389389
  • mythplugins/mythflix/mythflix/mythflix.cpp

     
    643643    popup->hide();
    644644    expectingPopup = false;
    645645
    646     delete popup;
     646    popup->deleteLater();
    647647    popup = NULL;
    648648
    649649    setActiveWindow();
  • mythplugins/mythflix/mythflix/mythflixqueue.cpp

     
    569569    popup->hide();
    570570    expectingPopup = false;
    571571
    572     delete popup;
     572    popup->deleteLater();
    573573    popup = NULL;
    574574
    575575    setActiveWindow();
  • mythplugins/mythcontrols/mythcontrols/keygrabber.h

     
    4646    ///        modifier keys. (note: result not thread-safe)
    4747    QString GetCapturedKey(void) const { return m_capturedKey; }
    4848
    49   public slots:
    50     void Accept(void) { done(1); }
    51     void Cancel(void) { done(0); }
    52 
    5349  protected:
    5450    void keyPressEvent(QKeyEvent *e);
    5551    void keyReleaseEvent(QKeyEvent *e);
     
    8278                        const QString  &context);
    8379
    8480    /// \brief Execute the error popup
    85     int GetOption(void) { return ExecPopup(this, SLOT(Finish())); }
     81    DialogCode GetOption(void) { return ExecPopup(this, SLOT(Finish())); }
    8682
    8783  protected slots:
    88     void Finish(void) { done(0); }
     84    void Finish(void) { reject(); }
    8985};
    9086
    9187
     
    9793    Q_OBJECT
    9894
    9995  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;
    10199
    102100    /// \brief Create a new action window. Does not pop-up menu.
    103101    OptionsMenu(MythMainWindow *window);
    104102
    105103    /// \brief Execute the option popup.
    106     int GetOption(void) { return ExecPopup(this,SLOT(Cancel())); }
     104    DialogCode GetOption(void) { return ExecPopup(this,SLOT(Cancel())); }
    107105
    108106  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);     }
    112110};
    113111
    114112
     
    120118    Q_OBJECT
    121119
    122120  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;
    124124
    125125    /// \brief Create a new action window. Does not pop-up menu.
    126126    ActionMenu(MythMainWindow *window);
    127127
    128128    /// \brief Execute the option popup.
    129     int GetOption(void) { return ExecPopup(this, SLOT(Cancel())); }
     129    DialogCode GetOption(void) { return ExecPopup(this, SLOT(Cancel())); }
    130130
    131131  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); }
    135135};
    136136
    137137
     
    143143    Q_OBJECT
    144144
    145145  public:
    146     enum actions { kSave, kExit, };
     146    static const DialogCode kSave       = kDialogCodeAccepted;
     147    static const DialogCode kExit       = kDialogCodeRejected;
    147148
    148149    /// \brief Create a new action window. Does not pop-up menu.
    149150    UnsavedMenu(MythMainWindow *window);
    150151
    151152    /// \brief Execute the option popup.
    152     int GetOption(void) { return ExecPopup(this, SLOT(Cancel())); }
     153    DialogCode GetOption(void) { return ExecPopup(this, SLOT(Cancel())); }
    153154
    154155  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); }
    157158};
    158159
    159160/** \class ConfirmMenu
     
    164165    Q_OBJECT
    165166
    166167  public:
    167     enum actions { kConfirm, kCancel, };
     168    static const DialogCode kConfirm    = kDialogCodeAccepted;
     169    static const DialogCode kCancel     = kDialogCodeRejected;
    168170
    169171    /// \brief Create a new action window. Does not pop-up menu.
    170172    ConfirmMenu(MythMainWindow *window, const QString &msg);
    171173
    172174    /// \brief Execute the option popup.
    173     int GetOption(void) { return ExecPopup(this,SLOT(Cancel())); }
     175    DialogCode GetOption(void) { return ExecPopup(this,SLOT(Cancel())); }
    174176
    175177  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);  }
    178180};
    179181
    180182#endif // KEYGRABBER_H_
  • mythplugins/mythcontrols/mythcontrols/mythcontrols.cpp

     
    233233    QStringList contents;
    234234    QString leftcaption, rightcaption;
    235235
    236     switch(popup.GetOption())
     236    switch (popup.GetOption())
    237237    {
    238238        case ViewMenu::kContextAction:
    239239            leftcaption = tr(CAPTION_CONTEXT);
     
    290290
    291291            OptionsMenu popup(gContext->GetMainWindow());
    292292
    293             switch(popup.GetOption())
     293            switch (popup.GetOption())
    294294            {
    295295                case OptionsMenu::kSave:
    296296                    Save();
     
    321321                if (!key.isEmpty())
    322322                {
    323323                    ActionMenu popup(gContext->GetMainWindow());
    324                     int result = popup.GetOption();
     324                    DialogCode result = popup.GetOption();
    325325                    if (result == ActionMenu::kSet)
    326326                        AddKeyToAction();
    327327                    else if (result == ActionMenu::kRemove)
     
    698698           "Do you want to bind it anyway?")
    699699        .arg(conflict->GetAction()).arg(conflict->GetContext());
    700700
    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);
    707704
    708     return true;
     705    return (kDialogCodeButton0 == res);
    709706}
    710707
    711708/** \fn MythControls::AddKeyToAction(void)
     
    720717{
    721718    /* grab a key from the user */
    722719    KeyGrabPopupBox getkey(gContext->GetMainWindow());
    723     if (0 == getkey.ExecPopup(&getkey, SLOT(Cancel())))
     720    if (kDialogCodeRejected == getkey.ExecPopup(&getkey, SLOT(Cancel())))
    724721        return; // user hit Cancel button
    725722
    726723    QString     key     = getkey.GetCapturedKey();
  • mythplugins/mythcontrols/mythcontrols/mythcontrols.h

     
    4343    ViewMenu(MythMainWindow *window);
    4444
    4545    /// \brief Execute the option popup.
    46     int GetOption(void) { return ExecPopup(this, SLOT(Cancel())); }
     46    DialogCode GetOption(void) { return ExecPopup(this, SLOT(Cancel())); }
    4747
    4848    /// \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;
    5053
    5154  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);        }
    5659};
    5760
    5861/** \class MythControls
  • mythplugins/mythcontrols/mythcontrols/keygrabber.cpp

     
    3636{
    3737    addLabel(tr("Press A Key"), Large, false);
    3838    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()));
    4141
    4242    grabKeyboard();
    4343}
     
    127127    addLabel(tr("Options"), Large, false);
    128128    addButton(QObject::tr("Save"),   this, SLOT(Save()));
    129129    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();
    131131}
    132132   
    133133//////////////////////////////////////////////////////////////////////
     
    138138    addLabel(tr("Modify Action"), Large, false);
    139139    addButton(tr("Set Binding"),     this, SLOT(Set()));
    140140    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();
    142142}
    143143
    144144//////////////////////////////////////////////////////////////////////
     
    149149    addLabel(tr("Unsaved Changes"), Large, false);
    150150    addLabel(tr("Exiting...") + "\n\n" + tr("Save Changes?"));
    151151    addButton(QObject::tr("Yes"), this, SLOT(Save()))->setFocus();
    152     addButton(QObject::tr("No"),  this, SLOT(Cancel()));
     152    addButton(QObject::tr("No"),  this, SLOT(reject()));
    153153}
    154154
    155155//////////////////////////////////////////////////////////////////////
     
    160160    addLabel(tr("Confirm"), Large, false);
    161161    addLabel(msg);
    162162    addButton(tr("Confirm"),         this, SLOT(Confirm()))->setFocus();
    163     addButton(QObject::tr("Cancel"), this, SLOT(Cancel()));
     163    addButton(QObject::tr("Cancel"), this, SLOT(reject()));
    164164}
  • mythplugins/mythvideo/mythvideo/main.cpp

     
    249249            no_player_dialog->AddButton(QObject::tr("OK, I'll go run Setup"));
    250250            no_player_dialog->exec();
    251251
    252             delete no_player_dialog;
     252            no_player_dialog->deleteLater();
    253253            gContext->removeCurrentLocation();
    254254            return;
    255255        }
  • mythplugins/mythvideo/mythvideo/videotree.cpp

     
    296296            {
    297297                if (m_imp->m_use_arrow_accel)
    298298                {
    299                     done(1);
     299                    accept();
    300300                }
    301301                else
    302302                    handled = false;
     
    499499    if (popup)
    500500    {
    501501        popup->hide();
    502         delete popup;
     502        popup->deleteLater();
    503503
    504504        popup = NULL;
    505505
     
    522522                                              MythPopupBox::Small,true);
    523523        plotLabel->setAlignment(Qt::AlignJustify | Qt::WordBreak);
    524524
    525         QButton * okButton = plotbox->addButton(tr("Ok"));
     525        QButton *okButton = plotbox->addButton(
     526            tr("OK"), plotbox, SLOT(accept()));
    526527        okButton->setFocus();
    527528
    528529        plotbox->ExecPopup();
    529         delete plotbox;
     530        plotbox->deleteLater();
    530531        //allowPaint = true;
    531532    }
    532533    else
  • mythplugins/mythvideo/mythvideo/videodlg.cpp

     
    9797    if (popup)
    9898    {
    9999        popup->hide();
    100         delete popup;
     100        popup->deleteLater();
    101101
    102102        popup = NULL;
    103103
     
    159159                                              MythPopupBox::Small,true);
    160160        plotLabel->setAlignment(Qt::AlignJustify | Qt::WordBreak);
    161161
    162         QButton * okButton = plotbox->addButton(tr("Ok"));
     162        QButton *okButton = plotbox->addButton(
     163            tr("OK"), plotbox, SLOT(accept()));
    163164        okButton->setFocus();
    164165
    165166        plotbox->ExecPopup();
    166         delete plotbox;
     167        plotbox->deleteLater();
    167168        allowPaint = true;
    168169    }
    169170    else
  • mythplugins/mythvideo/mythvideo/videomanager.cpp

     
    15531553    if (curitem && m_state == SHOWING_MAINWINDOW)
    15541554    {
    15551555        bool okcancel;
    1556         MythPopupBox *ConfirmationDialog =
     1556        MythPopupBox *confirmationDialog =
    15571557                new MythPopupBox(gContext->GetMainWindow());
    1558         okcancel = ConfirmationDialog->showOkCancelPopup(
     1558        okcancel = confirmationDialog->showOkCancelPopup(
    15591559                gContext->GetMainWindow(), "", tr("Delete this file?"), false);
    15601560
    15611561        if (okcancel)
     
    15631563            if (m_video_list->Delete(curitem->ID()))
    15641564                RefreshMovieList(false);
    15651565            else
    1566                 ConfirmationDialog->showOkPopup(gContext->GetMainWindow(), "",
     1566                confirmationDialog->showOkPopup(gContext->GetMainWindow(), "",
    15671567                                                tr("delete failed"));
    15681568        }
    15691569
    1570         delete ConfirmationDialog;
     1570        confirmationDialog->deleteLater();
    15711571    }
    15721572}
    15731573
     
    15861586    if (popup)
    15871587    {
    15881588        popup->hide();
    1589         delete popup;
     1589        popup->deleteLater();
    15901590
    15911591        popup = NULL;
    15921592
  • mythplugins/mythvideo/mythvideo/titledialog.cpp

     
    440440            os << job_string << "\n" ;
    441441        }
    442442    }
    443     done(0);
     443    reject();
    444444}
    445445
    446446void TitleDialog::takeFocusAwayFromEditor(bool up_or_down)
     
    534534
    535535TitleDialog::~TitleDialog()
    536536{
    537     if(name_editor)
     537    if (name_editor)
    538538    {
    539         delete name_editor;
     539        name_editor->deleteLater();
     540        name_editor = NULL;
    540541    }
    541542}
    542543
  • mythplugins/mythvideo/mythvideo/fileassoc.cpp

     
    330330void FileAssocDialog::saveAndExit()
    331331{
    332332    saveFileAssociations();
    333     done(0);
     333    reject();
    334334}
    335335
    336336void FileAssocDialog::toggleDefault(bool yes_or_no)
     
    410410void FileAssocDialog::removeExtensionPopup()
    411411{
    412412    new_extension_popup->close();
    413     delete new_extension_editor;
     413    new_extension_editor->deleteLater();
    414414    new_extension_editor = NULL;
    415     delete new_extension_popup;
     415    new_extension_popup->deleteLater();
    416416    new_extension_popup = NULL;
    417417
    418418    //
     
    503503    file_associations.clear();
    504504    if (command_editor)
    505505    {
    506         delete command_editor;
     506        command_editor->deleteLater();
     507        command_editor = NULL;
    507508    }
    508509}
  • mythplugins/mythvideo/mythvideo/videoscan.cpp

     
    7373
    7474void VideoScannerImp::doScan(const QStringList &dirs)
    7575{
    76     MythProgressDialog progressDlg(QObject::tr("Searching for video files"),
    77                                    dirs.size());
     76    MythProgressDialog *progressDlg =
     77        new MythProgressDialog(QObject::tr("Searching for video files"),
     78                               dirs.size());
    7879
    7980    QStringList imageExtensions = QImage::inputFormatList();
    8081    int counter = 0;
     
    8586         ++iter)
    8687    {
    8788        buildFileList(*iter, imageExtensions, fs_files);
    88         progressDlg.setProgress(++counter);
     89        progressDlg->setProgress(++counter);
    8990    }
    9091
    91     progressDlg.close();
     92    progressDlg->close();
    9293
    9394    PurgeList db_remove;
    9495    verifyFiles(fs_files, db_remove);
     
    110111    buttonText += QObject::tr("Yes");
    111112    buttonText += QObject::tr("Yes to all");
    112113
    113     int result = MythPopupBox::showButtonPopup(gContext->GetMainWindow(),
    114             QObject::tr("File Missing"),
    115             QString(QObject::tr("%1 appears to be missing.\nRemove it "
    116                                 "from the database?")).arg(filename),
    117             buttonText, 1);
     114    DialogCode result = MythPopupBox::ShowButtonPopup(
     115        gContext->GetMainWindow(),
     116        QObject::tr("File Missing"),
     117        QObject::tr("%1 appears to be missing.\n"
     118                    "Remove it from the database?").arg(filename),
     119        buttonText, kDialogCodeButton0);
     120
    118121    switch (result)
    119122    {
    120         case 1:
     123        case kDialogCodeRejected:
     124        case kDialogCodeButton0:
     125        default:
     126            break;
     127        case kDialogCodeButton1:
    121128            m_KeepAll = true;
    122129            break;
    123         case 2:
     130        case kDialogCodeButton2:
    124131            m_dbmetadata->purgeByID(id);
    125132            break;
    126         case 3:
     133        case kDialogCodeButton3:
    127134            m_RemoveAll = true;
    128135            m_dbmetadata->purgeByID(id);
    129136            break;
     
    134141                               const PurgeList &remove)
    135142{
    136143    int counter = 0;
    137     MythProgressDialog progressDlg(QObject::tr("Updating video database"),
    138                                   add.size() + remove.size());
     144    MythProgressDialog *progressDlg = new MythProgressDialog(
     145        QObject::tr("Updating video database"), add.size() + remove.size());
    139146
    140147    for (FileCheckList::const_iterator p = add.begin(); p != add.end(); ++p)
    141148    {
     
    152159            newFile.dumpToDatabase();
    153160        }
    154161
    155         progressDlg.setProgress(++counter);
     162        progressDlg->setProgress(++counter);
    156163    }
    157164
    158165    for (PurgeList::const_iterator p = remove.begin(); p != remove.end(); ++p)
    159166    {
    160167        promptForRemoval(p->first, p->second);
    161168
    162         progressDlg.setProgress(++counter);
     169        progressDlg->setProgress(++counter);
    163170    }
    164171
    165     progressDlg.Close();
     172    progressDlg->Close();
     173    progressDlg->deleteLater();
    166174}
    167175
    168176void VideoScannerImp::verifyFiles(FileCheckList &files, PurgeList &remove)
     
    170178    int counter = 0;
    171179    FileCheckList::iterator iter;
    172180
    173     MythProgressDialog progressDlg(QObject::tr("Verifying video files"),
    174                                   m_dbmetadata->getList().size());
     181    MythProgressDialog *progressDlg = new MythProgressDialog(
     182        QObject::tr("Verifying video files"), m_dbmetadata->getList().size());
    175183
    176184    // For every file we know about, check to see if it still exists.
    177185    for (MetadataListManager::metadata_list::const_iterator p =
     
    195203            }
    196204        }
    197205
    198         progressDlg.setProgress(++counter);
     206        progressDlg->setProgress(++counter);
    199207    }
    200208
    201     progressDlg.Close();
     209    progressDlg->Close();
     210    progressDlg->deleteLater();
    202211}
    203212
    204213namespace
  • mythplugins/mythvideo/mythvideo/videofilter.cpp

     
    671671void VideoFilterDialog::saveAndExit()
    672672{
    673673    m_fsp->setSettings(m_settings);
    674     done(0);
     674    reject();
    675675}
    676676
    677677void VideoFilterDialog::setYear(int new_year)
  • mythplugins/mythvideo/mythvideo/editmetadata.cpp

     
    367367    //  All done
    368368    //
    369369
    370     done(0);
     370    reject();
    371371}
    372372
    373373void EditMetadataDialog::setTitle(QString new_title)
     
    437437        checkedSetText(coverart_text, new_coverart_file);
    438438    }
    439439
    440     delete nca;
     440    nca->deleteLater();
    441441}
    442442
    443443void EditMetadataDialog::wireUpTheme()
     
    532532{
    533533    if (title_editor)
    534534    {
    535         delete title_editor;
     535        title_editor->deleteLater();
     536        title_editor = NULL;
    536537    }
     538
    537539    if (player_editor)
    538540    {
    539         delete player_editor;
     541        player_editor->deleteLater();
     542        player_editor = NULL;
    540543    }
     544
    541545    if (working_metadata)
    542546    {
    543547        delete working_metadata;
     548        working_metadata = NULL;
    544549    }
    545550}
  • mythplugins/mythvideo/mythvideo/parentalcontrols.cpp

     
    228228         ++p)
    229229    {
    230230        if (password == *p)
    231             done(1);
     231            accept();
    232232    }
    233233}
    234234
     
    363363            new MythMultiPasswordDialog(QObject::tr("Parental Pin:"),
    364364                                        valid_passwords,
    365365                                        gContext->GetMainWindow());
    366     bool ok = pwd->exec();
     366    bool ok = (kDialogCodeRejected != pwd->exec());
    367367    delete pwd;
    368368
    369369    if (ok)
  • mythplugins/mythgame/mythgame/gamesettings.h

     
    121121    virtual MythDialog *dialogWidget(MythMainWindow *parent,
    122122                                     const char     *widgetName=0);
    123123
    124     virtual int exec();
     124    virtual DialogCode exec(void);
    125125    virtual void load();
    126126    virtual void save() { };
    127127
  • mythplugins/mythgame/mythgame/gamehandler.cpp

     
    206206    buttonText += QObject::tr("Yes to all");
    207207
    208208
    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
    214216    switch (result)
    215217    {
    216         case 1:
     218        case kDialogCodeButton0:
     219        case kDialogCodeRejected:
     220        default:
     221            break;
     222        case kDialogCodeButton1:
    217223            m_KeepAll = true;
    218224            break;
    219         case 2:
     225        case kDialogCodeButton2:
    220226            purgeGameDB(filename , RomPath);
    221227            break;
    222         case 3:
     228        case kDialogCodeButton3:
    223229            m_RemoveAll = true;
    224230            purgeGameDB(filename , RomPath);
    225231            break;
     
    354360    int counter = 0;
    355361    MSqlQuery query(MSqlQuery::InitCon());
    356362
    357     MythProgressDialog progressDlg(QString("Updating %1(%2) Rom database")
     363    MythProgressDialog *progressDlg =
     364        new MythProgressDialog(QObject::tr("Updating %1(%2) ROM database")
    358365                                   .arg(handler->SystemName())
    359366                                   .arg(handler->GameType()),
    360367                                   m_GameMap.size());
     
    428435            promptForRemoval( iter.data().Rom() , iter.data().RomPath() );
    429436        }
    430437
    431         progressDlg.setProgress(++counter);
     438        progressDlg->setProgress(++counter);
    432439    }
    433440
    434     progressDlg.Close();
     441    progressDlg->Close();
     442    progressDlg->deleteLater();
    435443}
    436444
    437445void GameHandler::VerifyGameDB(GameHandler *handler)
     
    442450    MSqlQuery query(MSqlQuery::InitCon());
    443451    query.exec("SELECT romname,rompath,gamename FROM gamemetadata WHERE system = '" + handler->SystemName() + "';");
    444452
    445     MythProgressDialog progressDlg(QObject::tr("Verifying " + handler->SystemName() + " files"),
    446                                    query.numRowsAffected());
     453    MythProgressDialog *progressDlg = new MythProgressDialog(
     454        QObject::tr("Verifying %1 files").arg(handler->SystemName()),
     455        query.numRowsAffected());
    447456
    448457    // For every file we know about, check to see if it still exists.
    449458    if (query.isActive() && query.size() > 0)
     
    468477                                         GameName,RomPath);
    469478                }
    470479            }
    471             progressDlg.setProgress(++counter);
     480            progressDlg->setProgress(++counter);
    472481        }
    473482    }
    474     progressDlg.Close();
     483    progressDlg->Close();
     484    progressDlg->deleteLater();
    475485}
    476486
    477487// Recurse through the directory and gather a count on how many files there are to process.
     
    529539    buttonText += QObject::tr("No");
    530540    buttonText += QObject::tr("Yes");
    531541
    532     int result = MythPopupBox::showButtonPopup(gContext->GetMainWindow(),
    533                                QObject::tr("Are you sure?"),
    534                                QString(QObject::tr("This will clear all Game Meta Data\n"
    535                                                    "from the database. Are you sure you\n"
    536                                                    "want to do this?" )),
    537                                                     buttonText, 0 );
     542    DialogCode result = MythPopupBox::ShowButtonPopup(
     543        gContext->GetMainWindow(),
     544        QObject::tr("Are you sure?"),
     545        QString(QObject::tr("This will clear all Game Meta Data\n"
     546                            "from the database. Are you sure you\n"
     547                            "want to do this?" )),
     548        buttonText, kDialogCodeButton0);
     549
    538550    switch (result)
    539551    {
    540         case 0:
     552        case kDialogCodeRejected:
     553        case kDialogCodeButton0:
     554        default:
    541555            // Do Nothing
    542556            break;
    543         case 1:
     557        case kDialogCodeButton1:
    544558            MSqlQuery query(MSqlQuery::InitCon());
    545559            QString thequery = "DELETE FROM gamemetadata;";
    546560            query.exec(thequery);
     
    621635    else
    622636        maxcount = 100;
    623637
    624     MythProgressDialog pdial(QObject::tr("Scanning for " + handler->SystemName() + " game(s)..."), maxcount);
    625     pdial.setProgress(0);
     638    MythProgressDialog *pdial = new MythProgressDialog(
     639        QObject::tr("Scanning for %1 game(s)...").arg(handler->SystemName()),
     640        maxcount);
     641    pdial->setProgress(0);
    626642
    627643    if (handler->GameType() == "PC")
    628644    {
     
    633649                                                       handler->SystemCmdLine().left(handler->SystemCmdLine().findRev(QRegExp("/"))));
    634650
    635651
    636         pdial.setProgress(maxcount);
     652        pdial->setProgress(maxcount);
    637653        cout << "PC Game " << handler->SystemName() << endl;
    638654    }
    639655    else
    640656    {   
    641657        int filecount = 0;
    642         buildFileList(handler->SystemRomPath(),handler,&pdial, &filecount);
     658        buildFileList(handler->SystemRomPath(), handler, pdial, &filecount);
    643659    }
    644660
    645661    VerifyGameDB(handler);
     
    658674        handler->setRebuild(false);
    659675
    660676
    661     pdial.Close();
     677    pdial->Close();
     678    pdial->deleteLater();
    662679}
    663680
    664681void GameHandler::processAllGames(void)
  • mythplugins/mythgame/mythgame/rominfo.cpp

     
    2020    QString rom_ver = Version();
    2121
    2222    GameEditDialog romeditdlg(Romname().latin1());
    23     int res = romeditdlg.exec();
    2423
    25     if (res) {
     24    DialogCode res = romeditdlg.exec();
     25
     26    if (kDialogCodeRejected == res)
     27        return;
     28
     29    {
    2630        MSqlQuery query(MSqlQuery::InitCon());
    2731        QString thequery = QString("SELECT gamename,genre,year,country,publisher,favorite FROM gamemetadata "
    2832                                       " WHERE gametype = '%1' AND romname = '%2'; ")
  • mythplugins/mythgame/mythgame/gametree.cpp

     
    360360                GameHandler::Launchgame(item->getRomInfo(),NULL);
    361361            else if (item->getRomInfo()->RomCount() > 1)
    362362            {
    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");
    365366
    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);
    367371
    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())
    371377                        GameHandler::Launchgame(item->getRomInfo(),systemname);
    372378                }
    373379            }
     
    423429        return;
    424430
    425431    info_popup->hide();
    426     delete info_popup;
     432    info_popup->deleteLater();
    427433    info_popup = NULL;
    428434}
    429435
     
    438444        return;
    439445
    440446    info_popup->hide();
    441     delete info_popup;
     447    info_popup->deleteLater();
    442448    info_popup = NULL;
    443449}
    444450
  • mythplugins/mythgame/mythgame/gamesettings.cpp

     
    251251    addChild(listbox);
    252252}
    253253
    254 int MythGamePlayerEditor::exec() {
    255     while (ConfigurationDialog::exec() == QDialog::Accepted)
     254DialogCode MythGamePlayerEditor::exec(void)
     255{
     256    while (ConfigurationDialog::exec() == kDialogCodeAccepted)
    256257        edit();
    257258
    258     return QDialog::Rejected;
     259    return kDialogCodeRejected;
    259260}
    260261
    261262void MythGamePlayerEditor::load(void)
     
    284285    }
    285286    else
    286287    {   
    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)
    293294            edit();
    294         else if (val == 1)
     295        else if (kDialogCodeButton1 == val)
    295296            del();
    296297    }
    297298}
     
    309310
    310311void MythGamePlayerEditor::del(void)
    311312{
    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);
    317319
    318     if (val == 0)
     320    if (kDialogCodeButton0 == val)
    319321    {
    320322        MSqlQuery query(MSqlQuery::InitCon());
    321323        query.prepare("DELETE FROM gameplayers "
  • mythplugins/mythphone/mythphone/phoneui.cpp

     
    617617{
    618618    if ((!loopbackMode) && (rtpAudio == 0) && (rtpVideo == 0))
    619619    {
    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);
    621625        QString loopIp;
    622626        switch (loop)
    623627        {
    624         default:
    625         case -1:
    626             return;
    627         case 0:
    628             loopIp = sipStack->getLocalIpAddress();
    629             break;
    630         case 1:
    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;
    633637        }
    634638        phoneUIStatusBar->DisplayCallState(QString(tr("Audio and Video Looped to ") + loopIp));
    635639        int lvPort = atoi((const char *)gContext->GetSetting("VideoLocalPort"));
     
    10881092        menuPopup->addButton(tr("Delete all Voicemails"), this, SLOT(vmailEntryDeleteAll()));
    10891093        break;
    10901094    default:
    1091         delete menuPopup;
     1095        menuPopup->deleteLater();
    10921096        menuPopup = NULL;
    10931097        return;
    10941098        break;
     
    11491153                                                  "\n\n" + QObject::tr("A directory entry already exists with this URL."));
    11501154                NoDeviceDialog->AddButton(QObject::tr("OK"));
    11511155                NoDeviceDialog->exec();
    1152                 delete NoDeviceDialog;
     1156                NoDeviceDialog->deleteLater();
    11531157                closeMenuPopup();
    11541158            }
    11551159            else
     
    12721276        return;
    12731277
    12741278    menuPopup->hide();
    1275     delete menuPopup;
     1279    menuPopup->deleteLater();
    12761280    menuPopup = NULL;
    12771281}
    12781282
     
    13181322        return;
    13191323
    13201324    urlPopup->hide();
    1321     delete urlPopup;
     1325    urlPopup->deleteLater();
    13221326    urlPopup = NULL;
    13231327}
    13241328
     
    14171421        return;
    14181422
    14191423    imPopup->hide();
    1420     delete imPopup;
     1424    imPopup->deleteLater();
    14211425    imPopup = NULL;
    14221426}
    14231427
     
    15531557        return;
    15541558
    15551559    addEntryPopup->hide();
    1556     delete addEntryPopup;
     1560    addEntryPopup->deleteLater();
    15571561    addEntryPopup = NULL;
    15581562}
    15591563
     
    16451649        return;
    16461650
    16471651    addDirectoryPopup->hide();
    1648     delete addDirectoryPopup;
     1652    addDirectoryPopup->deleteLater();
    16491653    addDirectoryPopup = NULL;
    16501654}
    16511655
     
    17491753        return;
    17501754
    17511755    incallPopup->hide();
    1752     delete incallPopup;
     1756    incallPopup->deleteLater();
    17531757    incallPopup = NULL;
    17541758}
    17551759
     
    19151919        return;
    19161920
    19171921    statsPopup->hide();
    1918     delete statsPopup;
     1922    statsPopup->deleteLater();
    19191923    statsPopup = NULL;
    19201924    audioPkInOutLabel = audioPlayoutLabel = audioPkRtcpLabel = 0;
    19211925    videoResLabel = videoPkOutLabel = videoPkInLabel = videoPkRtcpLabel = videoFramesInOutDiscLabel = videoAvgFpsLabel = 0;
  • mythplugins/mythzoneminder/mythzoneminder/zmevents.cpp

     
    611611
    612612    popup->addButton(tr("Delete All"));
    613613
    614     int res = popup->ExecPopup();
     614    DialogCode res = popup->ExecPopup();
    615615    switch (res)
    616616    {
    617         case 0:
     617        case kDialogCodeButton0:
    618618            // refresh event list;
    619619                getEventList();
    620620            break;
    621         case 1:
     621        case kDialogCodeButton1:
    622622            if (getContext() == 1)
    623623            {
    624624                // switch to grid view;
     
    630630                setView(false);
    631631            }
    632632            break;
    633         case 2:
     633        case kDialogCodeButton2:
    634634            //delete all events
    635635            if (class ZMClient *zm = ZMClient::get())
    636636            {
     
    645645                zm->deleteEventList(m_eventList);
    646646
    647647                getEventList();
    648                 busy->close();
    649                 delete busy;
     648                busy->Close();
     649                busy->deleteLater();
    650650            }
    651651            break;
     652        case kDialogCodeRejected:
     653        default:
     654            break;
    652655    }
    653656
    654     delete popup;
     657    popup->deleteLater();
    655658}
  • mythplugins/mythzoneminder/mythzoneminder/zmliveplayer.cpp

     
    7474    {
    7575        MythPopupBox::showOkPopup(gContext->GetMainWindow(), "No monitors",
    7676                                  tr("Cannot find any monitors. Bailing out!"));
    77         done(0);
     77        reject();
    7878        return;
    7979    }
    8080
  • mythplugins/mythnews/mythnews/mythnews.cpp

     
    10381038
    10391039    popup->addLayout(vbox, 0);
    10401040
    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()));
    10431043
    10441044    QString siteName = "";
    10451045    if (edit)
     
    10581058        }
    10591059    }
    10601060
    1061     int res = popup->ExecPopup();
     1061    DialogCode res = popup->ExecPopup();
    10621062
    1063     if (res == 0)
     1063    if (kDialogCodeAccepted == res)
    10641064    {
    10651065        if (edit && siteName != "")
    10661066            removeFromDB(siteName);
     
    10681068        loadSites();
    10691069    }
    10701070
    1071     delete popup;
     1071    popup->deleteLater();
    10721072
    1073     return (res == 0);
     1073    return (kDialogCodeAccepted == res);
    10741074}
    10751075
    10761076void MythNews::showMenu()
     
    10911091    if (menu)
    10921092    {
    10931093        menu->hide();
    1094         delete menu;
     1094        menu->deleteLater();
    10951095        menu=NULL;
    10961096    }
    10971097}
  • mythtv/libs/libmythtv/channeleditor.cpp

     
    326326         tr("Are you sure you would like to delete the channels on %1?")
    327327         .arg(currentLabel));
    328328
    329     int val = MythPopupBox::show2ButtonPopup(
    330         gContext->GetMainWindow(), "",
    331         chan_msg,
     329    DialogCode val = MythPopupBox::Show2ButtonPopup(
     330        gContext->GetMainWindow(), "", chan_msg,
    332331        tr("Yes, delete the channels"),
    333         tr("No, don't"), 2);
     332        tr("No, don't"), kDialogCodeButton1);
    334333
    335     if (val != 0)
     334    if (kDialogCodeButton0 != val)
    336335        return;
    337336
    338337    MSqlQuery query(MSqlQuery::InitCon());
     
    389388    return dialog;
    390389}
    391390
    392 int ChannelEditor::exec()
     391DialogCode ChannelEditor::exec(void)
    393392{
    394     while (ConfigurationDialog::exec() == QDialog::Accepted)  {}
    395     return QDialog::Rejected;
     393    while (ConfigurationDialog::exec() == kDialogCodeAccepted)  {}
     394    return kDialogCodeRejected;
    396395}
    397396
    398397void ChannelEditor::edit()
     
    414413{
    415414    id = list->getValue().toInt();
    416415
    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?"),
    420419        tr("Yes, delete the channel"),
    421         tr("No, don't"), 2);
     420        tr("No, don't"), kDialogCodeButton1);
    422421
    423     if (val == 0)
     422    if (kDialogCodeButton0 == val)
    424423    {
    425424        MSqlQuery query(MSqlQuery::InitCon());
    426425        query.prepare("DELETE FROM channel WHERE chanid = :CHID ;");
     
    439438       edit();
    440439    else
    441440    {
    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);
    447445
    448         if (val == 0)
     446        if (kDialogCodeButton0 == val)
    449447            emit edit();
    450         else if (val == 1)
     448        else if (kDialogCodeButton1 == val)
    451449            emit del();
    452450        else
    453451            list->setFocus();
  • mythtv/libs/libmythtv/customedit.cpp

     
    570570    msg += m_description->text();
    571571
    572572    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;
    574574
    575575    QString action = QObject::tr("Store");
    576576    if (nameExists)
     
    600600    storediag->AddButton(QObject::tr("Cancel"));
    601601    cancelbtn = button++;
    602602
    603     int ret = storediag->exec();
    604     delete storediag;
     603    DialogCode code = storediag->exec();
     604    storediag->deleteLater();
     605    storediag = NULL;
     606    int ret = MythDialog::CalcItemIndex(code);
    605607
    606608    if (ret == sebtn || ret == exbtn)
    607609    {
     
    709711        }
    710712    }
    711713
    712     if (msg > "")
     714    if (!msg.isEmpty())
    713715    {
    714716        DialogBox *errdiag = new DialogBox(gContext->GetMainWindow(), msg);
    715717        errdiag->AddButton(QObject::tr("OK"));
    716718        errdiag->exec();
    717719
    718         delete errdiag;
     720        errdiag->deleteLater();
    719721        ret = false;
    720722    }
    721723    return ret;
  • mythtv/libs/libmythtv/progdetails.h

     
    2121
    2222  protected slots:
    2323    virtual void keyPressEvent(QKeyEvent *e);
    24     void done(void);
    2524
    2625  private:
    2726    void wireUpTheme(void);
  • mythtv/libs/libmythtv/NuppelVideoPlayer.cpp

     
    679679        if (!using_null_videoout)
    680680        {
    681681            qApp->lock();
    682             DialogBox dialog(gContext->GetMainWindow(),
    683                              QObject::tr("Failed to Reinit Video."));
    684             dialog.AddButton(QObject::tr("Return to menu."));
    685             dialog.exec();
     682            DialogBox *dlg = new DialogBox(
     683                gContext->GetMainWindow(),
     684                QObject::tr("Failed to Reinit Video."));
     685
     686            dlg->AddButton(QObject::tr("Return to menu."));
     687            dlg->exec();
     688            dlg->deleteLater();
    686689            qApp->unlock();
    687690        }
    688691        errored = true;
     
    31463149         !gContext->GetNumSetting("PVR350InternalAudioOnly")))
    31473150    {
    31483151        QString errMsg = ReinitAudio();
    3149         int ret = 1;
     3152        DialogCode ret = kDialogCodeButton0;
    31503153        if ((errMsg != QString::null) && !using_null_videoout &&
    31513154            gContext->GetNumSetting("AudioNag", 1))
    31523155        {
    3153             DialogBox dialog(gContext->GetMainWindow(), errMsg);
     3156            DialogBox *dlg = new DialogBox(gContext->GetMainWindow(), errMsg);
    31543157
    31553158            QString noaudio  = QObject::tr("Continue WITHOUT AUDIO!");
    31563159            QString dontask  = noaudio + " " +
     
    31593162                QObject::tr("And, don't ask again in this session.");
    31603163            QString quit     = QObject::tr("Return to menu.");
    31613164
    3162             dialog.AddButton(noaudio);
    3163             dialog.AddButton(dontask);
    3164             dialog.AddButton(neverask);
    3165             dialog.AddButton(quit);
     3165            dlg->AddButton(noaudio);
     3166            dlg->AddButton(dontask);
     3167            dlg->AddButton(neverask);
     3168            dlg->AddButton(quit);
    31663169
    31673170            qApp->lock();
    3168             ret = dialog.exec();
     3171            ret = dlg->exec();
     3172            dlg->deleteLater();
    31693173            qApp->unlock();
    31703174        }
    31713175           
    3172         if (ret == 2)
     3176        if (kDialogCodeButton1 == ret)
    31733177            gContext->SaveSetting("AudioNag", 0);
    3174         if (ret == 3)
     3178        if (kDialogCodeButton2 == ret)
    31753179            gContext->SetSetting("AudioNag", 0);
    3176         else if (ret == 4)
     3180        else if ((kDialogCodeButton3 == ret) || (kDialogCodeRejected == ret))
    31773181            return;
    31783182    }
    31793183
     
    31973201                QObject::tr("Unable to initialize video."));
    31983202            dialog->AddButton(QObject::tr("Return to menu."));
    31993203            dialog->exec();
    3200             delete dialog;
     3204            dialog->deleteLater();
    32013205            qApp->unlock();
    32023206        }
    32033207
     
    35803584                          QObject::tr("Error was encountered while displaying video."));
    35813585        dialog->AddButton(QObject::tr("Return to Menu"));
    35823586        dialog->exec();
    3583         delete dialog;
     3587        dialog->deleteLater();
    35843588
    35853589        qApp->unlock();
    35863590    }
  • mythtv/libs/libmythtv/previouslist.cpp

     
    5858
    5959    if (!theme->LoadTheme(xmldata, "programlist"))
    6060    {
    61         DialogBox diag(gContext->GetMainWindow(), "The theme you are using "
    62                        "does not contain a 'programlist' element.  Please "
    63                        "contact the theme creator and ask if they could "
    64                        "please update it.<br><br>The next screen will be empty."
    65                        "  Escape out of it to return to the menu.");
    66         diag.AddButton("OK");
    67         diag.exec();
     61        DialogBox *dlg = new DialogBox(
     62            gContext->GetMainWindow(),
     63            QObject::tr(
     64                "The theme you are using does not contain a 'programlist'"
     65                "element.  Please contact the theme creator and ask if they "
     66                "could please update it.<br><br>The next screen will be "
     67                "empty. Escape out of it to return to the menu."));
     68        dlg->AddButton("OK");
     69        dlg->exec();
     70        dlg->deleteLater();
    6871
    6972        return;
    7073    }
     
    330333
    331334    int view = chooseListBox->currentItem();
    332335
    333     choosePopup->done(0);
     336    choosePopup->AcceptItem(view);
    334337
    335338    if (view == curView)
    336339        return;
     
    705708    message += "\n\n\n" + tr("NOTE: removing items from this list will not "
    706709                             "delete any recordings.");
    707710   
    708     DialogBox diag(gContext->GetMainWindow(), message);
    709     int button = 1, ok = -1, cleardup = -1, setdup = -1, rm_episode = -1,
     711    DialogBox *dlg = new DialogBox(gContext->GetMainWindow(), message);
     712    int button = 0, ok = -1, cleardup = -1, setdup = -1, rm_episode = -1,
    710713        rm_title = -1;
    711714    // int rm_generics = -1;
    712715
    713     diag.AddButton(tr("OK"));
     716    dlg->AddButton(tr("OK"));
    714717    ok = button++;
    715718
    716719    if (pi->duplicate)
    717720    {
    718         diag.AddButton(tr("Allow this episode to re-record"));
     721        dlg->AddButton(tr("Allow this episode to re-record"));
    719722        cleardup = button++;
    720723    }
    721724    else
    722725    {
    723         diag.AddButton(tr("Never record this episode"));
     726        dlg->AddButton(tr("Never record this episode"));
    724727        setdup = button++;
    725728    }
    726     diag.AddButton(tr("Remove this episode from the list"));
     729    dlg->AddButton(tr("Remove this episode from the list"));
    727730    rm_episode = button++;
    728731
    729     diag.AddButton(tr("Remove all episodes for this title"));
     732    dlg->AddButton(tr("Remove all episodes for this title"));
    730733    rm_title = button++;
    731734
    732     // diag.AddButton(tr("Remove all that cannot be used for duplicate matching"));
     735    // dlg->AddButton(tr("Remove all that cannot be used for duplicate matching"));
    733736    // rm_generics = button++;
    734737
    735     int ret = diag.exec();
     738    DialogCode code = dlg->exec();
     739    dlg->deleteLater();
     740    dlg = NULL;
     741    int ret = MythDialog::CalcItemIndex(code);
    736742
    737743    if (ret == rm_episode)
    738744    {
  • mythtv/libs/libmythtv/proglist.h

     
    4040    void cursorUp(bool page = false);
    4141    void prevView(void);
    4242    void nextView(void);
    43     void setViewFromList(void);
     43    void setViewFromList(int);
    4444    void chooseEditChanged(void);
    4545    void chooseListBoxChanged(void);
    4646    void setViewFromEdit(void);
  • mythtv/libs/libmythtv/playgroup.cpp

     
    262262    QString message = tr("Delete playback group:") +
    263263        QString("\n'%1'?").arg(name);
    264264
    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);
    269270
    270     if (value == 0)
     271    if (kDialogCodeButton0 == value)
    271272    {
    272273        MSqlQuery query(MSqlQuery::InitCon());
    273274        query.prepare("DELETE FROM playgroup WHERE name = :NAME;");
     
    302303    listbox->setValue(lastValue);
    303304}
    304305
    305 int PlayGroupEditor::exec(void)
     306DialogCode PlayGroupEditor::exec(void)
    306307{
    307     while (ConfigurationDialog::exec() == QDialog::Accepted)
     308    while (ConfigurationDialog::exec() == kDialogCodeAccepted)
    308309        open(listbox->getValue());
    309310
    310     return QDialog::Rejected;
     311    return kDialogCodeRejected;
    311312}
    312313
    313314MythDialog* PlayGroupEditor::dialogWidget(MythMainWindow* parent,
  • mythtv/libs/libmythtv/videosource.h

     
    542542
    543543    virtual MythDialog* dialogWidget(MythMainWindow* parent,
    544544                                     const char* widgetName=0);
    545     virtual int exec();
     545    virtual DialogCode exec(void);
    546546    virtual void load();
    547547    virtual void save() { };
    548548
     
    568568    bool cardTypesInclude(const int& SourceID,
    569569                          const QString& thecardtype);
    570570
    571     virtual int exec();
     571    virtual DialogCode exec(void);
    572572    virtual void load();
    573573    virtual void save() { };
    574574
     
    588588  public:
    589589    CardInputEditor();
    590590
    591     virtual int exec();
     591    virtual DialogCode exec(void);
    592592    virtual void load();
    593593    virtual void save() { };
    594594
  • mythtv/libs/libmythtv/viewschdiff.cpp

     
    4545    theme->SetHMult(hmult);
    4646    if (!theme->LoadTheme(xmldata, "schdiff"))
    4747    {
    48         DialogBox diag(gContext->GetMainWindow(), tr("The theme you are using "
    49                        "does not contain a 'schdiff' element. Please contact "
    50                        "the theme creator and ask if they could please update "
    51                        "it.<br><br>The next screen will be empty. "
    52                        "Escape out of it to return to the menu."));
    53         diag.AddButton(tr("OK"));
    54         diag.exec();
     48        DialogBox *dlg = new DialogBox(
     49            gContext->GetMainWindow(),
     50            tr("The theme you are using does not contain a 'schdiff' element. "
     51               "Please contact the theme creator and ask if they could please "
     52               "update it.<br><br>The next screen will be empty. Escape out "
     53               "of it to return to the menu."));
    5554
     55        dlg->AddButton(tr("OK"));
     56        dlg->exec();
     57        dlg->deleteLater();
     58
    5659        return;
    5760    }
    5861
     
    308311            pa = recListAfter.next();
    309312        }
    310313    }
    311     DialogBox diag(gContext->GetMainWindow(), message);
    312     diag.AddButton(QObject::tr("OK"));
    313     diag.exec();
     314
     315    DialogBox *dlg = new DialogBox(gContext->GetMainWindow(), message);
     316    dlg->AddButton(QObject::tr("OK"));
     317    dlg->exec();
     318    dlg->deleteLater();
     319
    314320    return;
    315321}
    316322
  • mythtv/libs/libmythtv/proglist.cpp

     
    7171
    7272    if (!theme->LoadTheme(xmldata, "programlist"))
    7373    {
    74         DialogBox diag(gContext->GetMainWindow(), "The theme you are using "
    75                        "does not contain a 'programlist' element.  Please "
    76                        "contact the theme creator and ask if they could "
    77                        "please update it.<br><br>The next screen will be empty."
    78                        "  Escape out of it to return to the menu.");
    79         diag.AddButton("OK");
    80         diag.exec();
     74        DialogBox *dlg = new DialogBox(
     75            gContext->GetMainWindow(), "The theme you are using "
     76            "does not contain a 'programlist' element.  Please "
     77            "contact the theme creator and ask if they could "
     78            "please update it.<br><br>The next screen will be empty."
     79            "  Escape out of it to return to the menu.");
    8180
     81        dlg->AddButton("OK");
     82        dlg->exec();
     83        dlg->deleteLater();
     84
    8285        return;
    8386    }
    8487
     
    391394    refillAll = true;
    392395}
    393396
    394 void ProgLister::setViewFromList(void)
     397void ProgLister::setViewFromList(int item)
    395398{
     399    int view = item;
     400
    396401    if (!choosePopup || (!chooseListBox && !chooseEditButton))
    397402        return;
    398403
    399     int view = chooseListBox->currentItem();
    400 
    401404    if (type == plTitleSearch || type == plKeywordSearch ||
    402405        type == plPeopleSearch)
    403406    {
     
    420423        }
    421424    }
    422425
    423     choosePopup->done(0);
     426    choosePopup->AcceptItem(item);
    424427
    425428    if (view == curView)
    426429        return;
     
    511514
    512515    updateKeywordInDB(text);
    513516 
    514     choosePopup->done(0);
     517    choosePopup->accept();
    515518
    516519    fillViewList(text);
    517520
     
    543546
    544547    updateKeywordInDB(text);
    545548
    546     powerPopup->done(0);
     549    powerPopup->accept();
    547550
    548551    fillViewList(text);
    549552
     
    670673    viewList[curView] = searchTime.toString(fullDateFormat);
    671674    viewTextList[curView] = viewList[curView];
    672675
    673     choosePopup->done(0);
     676    choosePopup->accept();
    674677
    675678    curItem = -1;
    676679    refillAll = true;
     
    710713            chooseListBox->setCurrentItem(curView);
    711714        choosePopup->addWidget(chooseListBox);
    712715
    713         connect(chooseListBox, SIGNAL(accepted(int)), this, SLOT(setViewFromList()));
     716        connect(chooseListBox, SIGNAL(accepted(int)),
     717                this,          SLOT(setViewFromList(int)));
    714718
    715719        chooseListBox->setFocus();
    716720        choosePopup->ExecPopup();
     
    765769        chooseRecordButton->setEnabled(chooseLineEdit->text()
    766770                                       .stripWhiteSpace().length() > 0);
    767771
    768         connect(chooseListBox, SIGNAL(accepted(int)), this, SLOT(setViewFromList()));
     772        connect(chooseListBox, SIGNAL(accepted(int)),
     773                this,          SLOT(setViewFromList(int)));
    769774        connect(chooseListBox, SIGNAL(menuButtonPressed(int)), chooseLineEdit, SLOT(setFocus()));
    770775        connect(chooseListBox, SIGNAL(selectionChanged()), this, SLOT(chooseListBoxChanged()));
    771776        connect(chooseLineEdit, SIGNAL(textChanged()), this, SLOT(chooseEditChanged()));
     
    831836        chooseDeleteButton->setEnabled(curView >= 0);
    832837        chooseRecordButton->setEnabled(curView >= 0);
    833838
    834         connect(chooseListBox, SIGNAL(accepted(int)), this,
    835                                SLOT(setViewFromList()));
     839        connect(chooseListBox, SIGNAL(accepted(int)),
     840                this,          SLOT(setViewFromList(int)));
    836841        connect(chooseListBox, SIGNAL(menuButtonPressed(int)),chooseEditButton,
    837842                               SLOT(setFocus()));
    838843        connect(chooseListBox, SIGNAL(selectionChanged()), this,
     
    10281033    powerDescEdit->setText(field[2]);
    10291034
    10301035    powerTitleEdit->setFocus();
    1031     choosePopup->done(0);
     1036    choosePopup->accept();
    10321037    powerPopup->ExecPopup();
    10331038
    10341039    powerTitleEdit    = NULL; // deleted by popup delete
  • mythtv/libs/libmythtv/playgroup.h

     
    2929
    3030  public:
    3131    PlayGroupEditor(void);
    32     virtual int exec(void);
     32    virtual DialogCode exec(void);
    3333    virtual void load(void);
    3434    virtual void save(void) { };
    3535    virtual void save(QString) { };
  • mythtv/libs/libmythtv/scanwizardhelpers.h

     
    6565  public:
    6666    ScanProgressPopup(bool lock, bool strength, bool snr);
    6767
    68     virtual int exec(void);
     68    virtual DialogCode exec(void);
    6969
    7070    void SetStatusSignalToNoise(int value);
    7171    void SetStatusSignalStrength(int value);
  • mythtv/libs/libmythtv/progdetails.cpp

     
    9494            QString action = actions[i];
    9595            handled = true;
    9696            if (action == "ESCAPE" || action == "SELECT")
    97                 done();
     97                reject();
    9898            else if (action == "UP")
    9999            {
    100100                if (getCurrentFocusWidget() == m_richText)
     
    144144    if (m_okButton)
    145145    {
    146146        m_okButton->setText(tr("OK"));
    147         connect(m_okButton, SIGNAL(pushed()), this, SLOT(done()));
     147        connect(m_okButton, SIGNAL(pushed()), this, SLOT(accept()));
    148148    }
    149149
    150150    m_richText = getUIRichTextType("richtext");
    151151
    152152    buildFocusList();
    153153}
    154 
    155 void ProgDetails::done()
    156 {
    157     MythDialog::done(0);
    158 }
  • mythtv/libs/libmythtv/scanwizardscanner.cpp

     
    634634
    635635void ScanWizardScanner::RunPopup(void)
    636636{
    637     int ret = popupProgress->exec();
     637    DialogCode ret = popupProgress->exec();
    638638
    639639    popupLock.lock();
    640640    popupProgress->deleteLater();
  • mythtv/libs/libmythtv/profilegroup.h

     
    119119        listbox(new ListBoxSetting(this)), dialog(NULL), redraw(true)
    120120        { addChild(listbox); }
    121121
    122     virtual int exec();
     122    virtual DialogCode exec(void);
    123123    virtual void load();
    124124    virtual void save() {};
    125125
  • mythtv/libs/libmythtv/channeleditor.h

     
    1212    Q_OBJECT
    1313public:
    1414    ChannelEditor();
    15     virtual int exec();
     15    virtual DialogCode exec(void);
    1616
    1717    MythDialog* dialogWidget(MythMainWindow *parent, const char* name);
    1818
  • mythtv/libs/libmythtv/scheduledrecording.h

     
    111111    virtual void modifyPowerSearchByID(int rid, QString textname,
    112112                                       QString from, QString forwhat);
    113113
    114     virtual int exec(bool saveOnExec = true, bool doLoad = false);
     114    virtual DialogCode exec(bool saveOnExec = true, bool doLoad = false);
    115115       
    116116    void remove();
    117117    int getRecordID(void) const { return id->intValue(); };
     
    275275    ScheduledRecordingEditor() : listbox(new ListBoxSetting(this))
    276276        { addChild(listbox); }
    277277
    278     virtual int exec();
     278    virtual DialogCode exec(void);
    279279    virtual void load();
    280280    virtual void save() { };
    281281
  • mythtv/libs/libmythtv/recordingprofile.h

     
    8585    virtual void loadByID(int id);
    8686    virtual bool loadByType(QString name, QString cardtype);
    8787    virtual bool loadByGroup(QString name, QString group);
    88     virtual int exec();
     88    virtual DialogCode exec(void);
    8989
    9090    // sets
    9191    void setCodecTypes();
     
    135135  public:
    136136    RecordingProfileEditor(int id, QString profName);
    137137
    138     virtual int exec();
     138    virtual DialogCode exec(void);
    139139    virtual void load();
    140140    virtual void save() { };
    141141    virtual void save(QString /*destination*/) { }
  • mythtv/libs/libmythtv/tv_play.cpp

     
    145145                        recTitles.append(buttonTitle);
    146146                        it++;
    147147                    }
    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()))
    155157                    {
    156                         p = reclist->at(ret - 1);
     158                        p = reclist->at(idx);
    157159                        curProgram = new ProgramInfo(*p);
    158160                    }
    159161                    else
     
    77667768                                                recGroupPassword,
    77677769                                                gContext->GetMainWindow());
    77687770        pwd->exec();
    7769         delete pwd;
     7771        pwd->deleteLater();
     7772        pwd = NULL;
     7773
    77707774        qApp->unlock();
    77717775        if (!ok)
    77727776        {
  • mythtv/libs/libmythtv/storagegroup.cpp

     
    418418    QString message =
    419419        tr("Remove '%1'\nDirectory From Storage Group?").arg(name);
    420420
    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);
    425426
    426     if (value == 0)
     427    if (kDialogCodeButton0 == value)
    427428    {
    428429        MSqlQuery query(MSqlQuery::InitCon());
    429430        query.prepare("DELETE FROM storagegroup "
     
    476477    listbox->setValue(lastValue);
    477478}
    478479
    479 int StorageGroupEditor::exec() {
    480     while (ConfigurationDialog::exec() == QDialog::Accepted)
     480DialogCode StorageGroupEditor::exec(void)
     481{
     482    while (ConfigurationDialog::exec() == kDialogCodeAccepted)
    481483        open(listbox->getValue());
    482484
    483     return QDialog::Rejected;
     485    return kDialogCodeRejected;
    484486}
    485487
    486488MythDialog* StorageGroupEditor::dialogWidget(MythMainWindow* parent,
     
    557559
    558560    QString message = tr("Delete '%1' Storage Group?").arg(dispGroup);
    559561
    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);
    564567
    565     if (value == 0)
     568    if (kDialogCodeButton0 == value)
    566569    {
    567570        MSqlQuery query(MSqlQuery::InitCon());
    568571        query.prepare("DELETE FROM storagegroup "
     
    673676    listbox->setValue(lastValue);
    674677}
    675678
    676 int StorageGroupListEditor::exec() {
    677     while (ConfigurationDialog::exec() == QDialog::Accepted)
     679DialogCode StorageGroupListEditor::exec(void)
     680{
     681    while (ConfigurationDialog::exec() == kDialogCodeAccepted)
    678682        open(listbox->getValue());
    679683
    680     return QDialog::Rejected;
     684    return kDialogCodeRejected;
    681685}
    682686
    683687MythDialog* StorageGroupListEditor::dialogWidget(MythMainWindow* parent,
  • mythtv/libs/libmythtv/videosource.cpp

     
    323323        .arg(ddp.GetListingsProviderName());
    324324       
    325325    VERBOSE(VB_GENERAL, waitMsg);
    326     MythProgressDialog pdlg(waitMsg, 2);
     326    MythProgressDialog *pdlg = new MythProgressDialog(waitMsg, 2);
    327327
    328328    clearSelections();
    329329
    330     pdlg.setProgress(1);
     330    pdlg->setProgress(1);
    331331
    332332    if (!ddp.GrabLineupsOnly())
    333333    {
     
    341341    for (it = lineups.begin(); it != lineups.end(); ++it)
    342342        addSelection((*it).displayname, (*it).lineupid);
    343343
    344     pdlg.setProgress(2);
    345     pdlg.Close();
     344    pdlg->setProgress(2);
     345    pdlg->Close();
     346    pdlg->deleteLater();
    346347#else // USING_BACKEND
    347348    VERBOSE(VB_IMPORTANT, "You must compile the backend "
    348349            "to set up a DataDirect line-up");
     
    419420                                "might want to check the output as it\n"
    420421                                "runs by switching to the terminal from "
    421422                                "which you started\nthis program."));
    422     MythProgressDialog pdlg( waitMsg, 2 );
     423    MythProgressDialog *pdlg = new MythProgressDialog(waitMsg, 2);
    423424    VERBOSE(VB_GENERAL, QString("Please wait while MythTV retrieves the "
    424425                                "list of available channels"));
    425     pdlg.show();
     426    pdlg->show();
    426427
    427428    QString command;
    428429    QString filename = QString("%1/%2.xmltv")
     
    431432    command = QString("%1 --config-file '%2' --configure")
    432433        .arg(grabber).arg(filename);
    433434
    434     pdlg.setProgress(1);
     435    pdlg->setProgress(1);
    435436
    436437    int ret = system(command);
    437438    if (ret != 0)
     
    461462            gContext->GetMainWindow(), QObject::tr("Warning."), err_msg);
    462463    }
    463464
    464     pdlg.setProgress( 2 );   
    465     pdlg.Close();
     465    pdlg->setProgress( 2 );   
     466    pdlg->Close();
     467    pdlg->deleteLater();
    466468}
    467469
    468470EITOnly_config::EITOnly_config(const VideoSource& _parent) :
     
    569571        }
    570572
    571573        find_grabbers_dialog->Close();
    572         delete find_grabbers_dialog;
     574        find_grabbers_dialog->deleteLater();
    573575    }
    574576    else {
    575577        VERBOSE(VB_IMPORTANT, "Failed to run tv_find_grabbers");
     
    20092011    addChild(listbox);
    20102012}
    20112013
    2012 int CaptureCardEditor::exec(void)
     2014DialogCode CaptureCardEditor::exec(void)
    20132015{
    2014     while (ConfigurationDialog::exec() == QDialog::Accepted)
     2016    while (ConfigurationDialog::exec() == kDialogCodeAccepted)
    20152017        edit();
    20162018
    2017     return QDialog::Rejected;
     2019    return kDialogCodeRejected;
    20182020}
    20192021
    20202022void CaptureCardEditor::load(void)
     
    20462048    }
    20472049    else
    20482050    {
    2049         int val = MythPopupBox::show2ButtonPopup(
     2051        DialogCode val = MythPopupBox::Show2ButtonPopup(
    20502052            gContext->GetMainWindow(),
    20512053            "",
    20522054            tr("Capture Card Menu"),
    20532055            tr("Edit.."),
    20542056            tr("Delete.."),
    2055             1);
     2057            kDialogCodeButton0);
    20562058
    2057         if (val == 0)
     2059        if (kDialogCodeButton0 == val)
    20582060            edit();
    2059         else if (val == 1)
     2061        else if (kDialogCodeButton1 == val)
    20602062            del();
    20612063    }
    20622064}
     
    20662068    const int cardid = listbox->getValue().toInt();
    20672069    if (-1 == cardid)
    20682070    {
    2069         int val = MythPopupBox::show2ButtonPopup(
     2071        DialogCode val = MythPopupBox::Show2ButtonPopup(
    20702072            gContext->GetMainWindow(), "",
    20712073            tr("Are you sure you want to delete "
    20722074               "ALL capture cards on %1?").arg(gContext->GetHostName()),
    20732075            tr("Yes, delete capture cards"),
    2074             tr("No, don't"), 2);
     2076            tr("No, don't"), kDialogCodeButton1);
    20752077
    2076         if (0 == val)
     2078        if (kDialogCodeButton0 == val)
    20772079        {
    20782080            MSqlQuery cards(MSqlQuery::InitCon());
    20792081
     
    21022104    }
    21032105    else if (-2 == cardid)
    21042106    {
    2105         int val = MythPopupBox::show2ButtonPopup(
     2107        DialogCode val = MythPopupBox::Show2ButtonPopup(
    21062108            gContext->GetMainWindow(), "",
    21072109            tr("Are you sure you want to delete "
    21082110               "ALL capture cards?"),
    21092111            tr("Yes, delete capture cards"),
    2110             tr("No, don't"), 2);
     2112            tr("No, don't"), kDialogCodeButton1);
    21112113
    2112         if (0 == val)
     2114        if (kDialogCodeButton0 == val)
    21132115        {
    21142116            MSqlQuery query(MSqlQuery::InitCon());
    21152117            query.exec("TRUNCATE TABLE capturecard;");
     
    21282130
    21292131void CaptureCardEditor::del(void)
    21302132{
    2131     int val = MythPopupBox::show2ButtonPopup(
     2133    DialogCode val = MythPopupBox::Show2ButtonPopup(
    21322134        gContext->GetMainWindow(), "",
    21332135        tr("Are you sure you want to delete this capture card?"),
    21342136        tr("Yes, delete capture card"),
    2135         tr("No, don't"), 2);
     2137        tr("No, don't"), kDialogCodeButton1);
    21362138
    2137     if (val == 0)
     2139    if (kDialogCodeButton0 == val)
    21382140    {
    21392141        CardUtil::DeleteCard(listbox->getValue().toUInt());
    21402142        load();
     
    21572159    return dialog;
    21582160}
    21592161
    2160 int VideoSourceEditor::exec() {
    2161     while (ConfigurationDialog::exec() == QDialog::Accepted)
     2162DialogCode VideoSourceEditor::exec(void)
     2163{
     2164    while (ConfigurationDialog::exec() == kDialogCodeAccepted)
    21622165        edit();
    21632166
    2164     return QDialog::Rejected;
     2167    return kDialogCodeRejected;
    21652168}
    21662169
    21672170void VideoSourceEditor::load(void)
     
    21812184    }
    21822185    else
    21832186    {
    2184         int val = MythPopupBox::show2ButtonPopup(
     2187        DialogCode val = MythPopupBox::Show2ButtonPopup(
    21852188            gContext->GetMainWindow(),
    21862189            "",
    21872190            tr("Video Source Menu"),
    21882191            tr("Edit.."),
    21892192            tr("Delete.."),
    2190             1);
     2193            kDialogCodeButton0);
    21912194
    2192         if (val == 0)
     2195        if (kDialogCodeButton0 == val)
    21932196            edit();
    2194         else if (val == 1)
     2197        else if (kDialogCodeButton1 == val)
    21952198            del();
    21962199    }
    21972200}
     
    22012204    const int sourceid = listbox->getValue().toInt();
    22022205    if (-1 == sourceid)
    22032206    {
    2204         int val = MythPopupBox::show2ButtonPopup(
     2207        DialogCode val = MythPopupBox::Show2ButtonPopup(
    22052208            gContext->GetMainWindow(), "",
    22062209            tr("Are you sure you want to delete "
    22072210               "ALL video sources?"),
    22082211            tr("Yes, delete video sources"),
    2209             tr("No, don't"), 2);
     2212            tr("No, don't"), kDialogCodeButton1);
    22102213
    2211         if (0 == val)
     2214        if (kDialogCodeButton0 == val)
    22122215        {
    22132216            MSqlQuery query(MSqlQuery::InitCon());
    22142217            query.exec("TRUNCATE TABLE channel;");
     
    22332236
    22342237void VideoSourceEditor::del()
    22352238{
    2236     int val = MythPopupBox::show2ButtonPopup(
     2239    DialogCode val = MythPopupBox::Show2ButtonPopup(
    22372240        gContext->GetMainWindow(), "",
    22382241        tr("Are you sure you want to delete "
    22392242           "this video source?"),
    22402243        tr("Yes, delete video source"),
    22412244        tr("No, don't"),
    2242         2);
     2245        kDialogCodeButton1);
    22432246
    2244     if (val == 0)
     2247    if (kDialogCodeButton0 == val)
    22452248    {
    22462249        MSqlQuery query(MSqlQuery::InitCon());
    22472250
     
    22852288    addChild(listbox);
    22862289}
    22872290
    2288 int CardInputEditor::exec(void)
     2291DialogCode CardInputEditor::exec(void)
    22892292{
    2290     while (ConfigurationDialog::exec() == QDialog::Accepted)
     2293    while (ConfigurationDialog::exec() == kDialogCodeAccepted)
    22912294        cardinputs[listbox->getValue().toInt()]->exec();
    22922295
    2293     return QDialog::Rejected;
     2296    return kDialogCodeRejected;
    22942297}
    22952298
    22962299void CardInputEditor::load()
  • mythtv/libs/libmythtv/diseqcsettings.cpp

     
    461461        addChild(new RotorPosMap(rotor));
    462462    }
    463463
    464     virtual int exec(void)
     464    virtual DialogCode exec(void)
    465465    {
    466         while (ConfigurationDialog::exec() == QDialog::Accepted);
    467         return QDialog::Rejected;
     466        while (ConfigurationDialog::exec() == kDialogCodeAccepted);
     467        return kDialogCodeRejected;
    468468    }
    469469};
    470470
     
    944944
    945945    popup->addWidget(list);
    946946    connect(list,  SIGNAL(accepted(int)),
    947             popup, SLOT(  done(    int)));
     947            popup, SLOT(  AcceptItem(int)));
    948948    list->setFocus();
    949949
    950     int res = popup->ExecPopup();
     950    DialogCode res = popup->ExecPopup();
    951951    type = (DiSEqCDevDevice::dvbdev_t)list->currentItem();
    952952
    953953    popup->hide();
    954954    popup->deleteLater();
    955955
    956     return res >= 0;
     956    return kDialogCodeRejected != res;
    957957}
    958958
    959959void DeviceTree::CreateRootNodeDialog(void)
     
    10841084    addChild(new DeviceTree(tree));
    10851085}
    10861086
    1087 int DTVDeviceTreeWizard::exec(void)
     1087DialogCode DTVDeviceTreeWizard::exec(void)
    10881088{
    1089     while (ConfigurationDialog::exec() == QDialog::Accepted);
    1090     return QDialog::Rejected;
     1089    while (ConfigurationDialog::exec() == kDialogCodeAccepted);
     1090    return kDialogCodeRejected;
    10911091}
    10921092
    10931093//////////////////////////////////////// SwitchSetting
  • mythtv/libs/libmythtv/profilegroup.cpp

     
    244244    listbox->addSelection(QObject::tr("(Create new profile group)"), "0");
    245245}
    246246
    247 int ProfileGroupEditor::exec()
     247DialogCode ProfileGroupEditor::exec(void)
    248248{
    249     int ret = QDialog::Accepted;
     249    DialogCode ret = kDialogCodeAccepted;
    250250    redraw = true;
    251251
    252252    while ((QDialog::Accepted == ret) || redraw)
     
    278278            open(listbox->getValue().toInt());
    279279    }
    280280
    281     return QDialog::Rejected;
     281    return kDialogCodeRejected;
    282282}
    283283
    284284void ProfileGroupEditor::callDelete(void)
     
    296296        QString message = QObject::tr("Delete profile group:") +
    297297                          QString("\n'%1'?").arg(ProfileGroup::getName(id));
    298298
    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);
    303304
    304         if (value == 0)
     305        if (kDialogCodeButton0 == value)
    305306        {
    306307            querystr = QString("DELETE codecparams FROM codecparams, "
    307308                            "recordingprofiles WHERE "
  • mythtv/libs/libmythtv/transporteditor.h

     
    7474  public:
    7575    TransportListEditor(uint initial_sourceid);
    7676
    77     virtual int exec(void);
     77    virtual DialogCode exec(void);
    7878
    7979  public slots:
    8080    void Menu(void);
  • mythtv/libs/libmythtv/programinfo.cpp

     
    41674167    message += "\n\n";
    41684168    message += RecStatusDesc();
    41694169
    4170     DialogBox diag(gContext->GetMainWindow(), message);
    4171     int button = 1, ok = -1, react = -1, stop = -1, addov = -1, forget = -1,
     4170    DialogBox *dlg = new DialogBox(gContext->GetMainWindow(), message);
     4171    int button = 0, ok = -1, react = -1, stop = -1, addov = -1, forget = -1,
    41724172        clearov = -1, edend = -1, ednorm = -1, edcust = -1;
    41734173
    4174     diag.AddButton(QObject::tr("OK"));
     4174    dlg->AddButton(QObject::tr("OK"));
    41754175    ok = button++;
    41764176
    41774177    if (recstartts < now && recendts > now)
    41784178    {
    41794179        if (recstatus != rsRecording)
    41804180        {
    4181             diag.AddButton(QObject::tr("Reactivate"));
     4181            dlg->AddButton(QObject::tr("Reactivate"));
    41824182            react = button++;
    41834183        }
    41844184        else
    41854185        {
    4186             diag.AddButton(QObject::tr("Stop recording"));
     4186            dlg->AddButton(QObject::tr("Stop recording"));
    41874187            stop = button++;
    41884188        }
    41894189    }
     
    41934193        {
    41944194            if (recstartts > now)
    41954195            {
    4196                 diag.AddButton(QObject::tr("Don't record"));
     4196                dlg->AddButton(QObject::tr("Don't record"));
    41974197                addov = button++;
    41984198            }
    41994199            if (recstatus != rsRecording && rectype != kFindOneRecord &&
     
    42064206                 ((dupmethod & kDupCheckDesc) && description != "") ||
    42074207                 ((dupmethod & kDupCheckSubThenDesc) && (subtitle != "" || description != "")) ))
    42084208            {
    4209                 diag.AddButton(QObject::tr("Never record"));
     4209                dlg->AddButton(QObject::tr("Never record"));
    42104210                forget = button++;
    42114211            }
    42124212        }
     
    42154215        {
    42164216            if (recstatus == rsRecording)
    42174217            {
    4218                 diag.AddButton(QObject::tr("Change Ending Time"));
     4218                dlg->AddButton(QObject::tr("Change Ending Time"));
    42194219                edend = button++;
    42204220            }
    42214221            else
    42224222            {
    4223                 diag.AddButton(QObject::tr("Edit Options"));
     4223                dlg->AddButton(QObject::tr("Edit Options"));
    42244224                ednorm = button++;
    42254225
    42264226                if (rectype != kSingleRecord && rectype != kFindOneRecord)
    42274227                {
    4228                     diag.AddButton(QObject::tr("Add Override"));
     4228                    dlg->AddButton(QObject::tr("Add Override"));
    42294229                    edcust = button++;
    42304230                }
    42314231            }
     
    42354235        {
    42364236            if (recstatus == rsRecording)
    42374237            {
    4238                 diag.AddButton(QObject::tr("Change Ending Time"));
     4238                dlg->AddButton(QObject::tr("Change Ending Time"));
    42394239                edend = button++;
    42404240            }
    42414241            else
    42424242            {
    4243                 diag.AddButton(QObject::tr("Edit Override"));
     4243                dlg->AddButton(QObject::tr("Edit Override"));
    42444244                ednorm = button++;
    4245                 diag.AddButton(QObject::tr("Clear Override"));
     4245                dlg->AddButton(QObject::tr("Clear Override"));
    42464246                clearov = button++;
    42474247            }
    42484248        }
    42494249    }
    42504250
    4251     int ret = diag.exec();
     4251    DialogCode code = dlg->exec();
     4252    dlg->deleteLater();
     4253    dlg = NULL;
     4254    int ret = MythDialog::CalcItemIndex(code);
    42524255
    42534256    if (ret == react)
    42544257        ReactivateRecording();
     
    43354338        delete confList;
    43364339    }
    43374340
    4338     DialogBox diag(gContext->GetMainWindow(), message);
    4339     int button = 1, ok = -1, react = -1, addov = -1, clearov = -1,
     4341    DialogBox *dlg = new DialogBox(gContext->GetMainWindow(), message);
     4342    int button = 0, ok = -1, react = -1, addov = -1, clearov = -1,
    43404343        ednorm = -1, edcust = -1, forget = -1, addov1 = -1, forget1 = -1;
    43414344
    4342     diag.AddButton(QObject::tr("OK"));
     4345    dlg->AddButton(QObject::tr("OK"));
    43434346    ok = button++;
    43444347
    43454348    QDateTime now = QDateTime::currentDateTime();
     
    43474350    if (recstartts < now && recendts > now &&
    43484351        recstatus != rsDontRecord && recstatus != rsNotListed)
    43494352    {
    4350         diag.AddButton(QObject::tr("Reactivate"));
     4353        dlg->AddButton(QObject::tr("Reactivate"));
    43514354        react = button++;
    43524355    }
    43534356
     
    43654368             recstatus == rsInactive ||
    43664369             recstatus == rsLaterShowing))
    43674370        {
    4368             diag.AddButton(QObject::tr("Record anyway"));
     4371            dlg->AddButton(QObject::tr("Record anyway"));
    43694372            addov = button++;
    43704373            if (recstatus == rsPreviousRecording || recstatus == rsNeverRecord)
    43714374            {
    4372                 diag.AddButton(QObject::tr("Forget Previous"));
     4375                dlg->AddButton(QObject::tr("Forget Previous"));
    43734376                forget = button++;
    43744377            }
    43754378        }
     
    43844387            {
    43854388                if (recstartts > now)
    43864389                {
    4387                     diag.AddButton(QObject::tr("Don't record"));
     4390                    dlg->AddButton(QObject::tr("Don't record"));
    43884391                    addov1 = button++;
    43894392                }
    43904393                if (rectype != kFindOneRecord &&
     
    43964399                     ((dupmethod & kDupCheckSub) && subtitle != "") ||
    43974400                     ((dupmethod & kDupCheckDesc) && description != "")))
    43984401                {
    4399                     diag.AddButton(QObject::tr("Never record"));
     4402                    dlg->AddButton(QObject::tr("Never record"));
    44004403                    forget1 = button++;
    44014404                }
    44024405            }
    44034406
    4404             diag.AddButton(QObject::tr("Edit Options"));
     4407            dlg->AddButton(QObject::tr("Edit Options"));
    44054408            ednorm = button++;
    44064409
    44074410            if (rectype != kSingleRecord && rectype != kFindOneRecord &&
    44084411                recstatus != rsNotListed)
    44094412            {
    4410                 diag.AddButton(QObject::tr("Add Override"));
     4413                dlg->AddButton(QObject::tr("Add Override"));
    44114414                edcust = button++;
    44124415            }
    44134416        }
    44144417
    44154418        if (rectype == kOverrideRecord || rectype == kDontRecord)
    44164419        {
    4417             diag.AddButton(QObject::tr("Edit Override"));
     4420            dlg->AddButton(QObject::tr("Edit Override"));
    44184421            ednorm = button++;
    44194422
    4420             diag.AddButton(QObject::tr("Clear Override"));
     4423            dlg->AddButton(QObject::tr("Clear Override"));
    44214424            clearov = button++;
    44224425        }
    44234426    }
    44244427
    4425     int ret = diag.exec();
     4428    DialogCode code = dlg->exec();
     4429    dlg->deleteLater();
     4430    dlg = NULL;
     4431    int ret = MythDialog::CalcItemIndex(code);
    44264432
    44274433    if (ret == react)
    44284434        ReactivateRecording();
  • mythtv/libs/libmythtv/scheduledrecording.cpp

     
    721721}
    722722
    723723
    724 int ScheduledRecordingEditor::exec(void)
     724DialogCode ScheduledRecordingEditor::exec(void)
    725725{
    726     while (ConfigurationDialog::exec() == QDialog::Accepted)
     726    while (ConfigurationDialog::exec() == kDialogCodeAccepted)
    727727        open(listbox->getValue().toInt());
    728728
    729     return QDialog::Rejected;
     729    return kDialogCodeRejected;
    730730}
    731731
    732732void ScheduledRecordingEditor::open(int id) {
     
    743743
    744744///////////////////////////////////////////////////////////////////////////////
    745745
    746 int ScheduledRecording::exec(bool saveOnExec, bool doLoad)
     746DialogCode ScheduledRecording::exec(bool saveOnExec, bool doLoad)
    747747{
    748748    if (!dialog)
    749749        dialog = new ScheduledRecordingDialog(this);
  • mythtv/libs/libmythtv/recordingprofile.cpp

     
    13191319        audioSettings->selectCodecs(groupType());
    13201320}
    13211321
    1322 int RecordingProfile::exec(void)
     1322DialogCode RecordingProfile::exec(void)
    13231323{
    13241324    MythDialog *dialog = dialogWidget(
    13251325        gContext->GetMainWindow(), "Recording Profile");
     
    13331333    if (tr_filters)
    13341334        FiltersChanged(tr_filters->getValue());
    13351335   
    1336     int ret = dialog->exec();
     1336    DialogCode ret = dialog->exec();
    13371337
    13381338    dialog->deleteLater();
    13391339
     
    14141414    RecordingProfile::fillSelections(listbox, group);
    14151415}
    14161416
    1417 int RecordingProfileEditor::exec(void)
     1417DialogCode RecordingProfileEditor::exec(void)
    14181418{
    1419     while (ConfigurationDialog::exec() == QDialog::Accepted)
     1419    while (ConfigurationDialog::exec() == kDialogCodeAccepted)
    14201420        open(listbox->getValue().toInt());
    14211421
    1422     return QDialog::Rejected;
     1422    return kDialogCodeRejected;
    14231423}
    14241424
    14251425void RecordingProfile::fillSelections(SelectSetting *setting, int group,
  • mythtv/libs/libmythtv/transporteditor.cpp

     
    288288    connect(m_list, SIGNAL(deleteButtonPressed(int)), this, SLOT(Delete()));
    289289}
    290290
    291 int TransportListEditor::exec(void)
     291DialogCode TransportListEditor::exec(void)
    292292{
    293     while (ConfigurationDialog::exec() == QDialog::Accepted);
     293    while (ConfigurationDialog::exec() == kDialogCodeAccepted);
    294294
    295     return QDialog::Rejected;
     295    return kDialogCodeRejected;
    296296}
    297297
    298298void TransportListEditor::Edit(void)
     
    315315{
    316316    uint mplexid = m_list->getValue().toInt();
    317317
    318     int val = MythPopupBox::show2ButtonPopup(
     318    DialogCode val = MythPopupBox::Show2ButtonPopup(
    319319        gContext->GetMainWindow(), "",
    320320        tr("Are you sure you would like to delete this transport?"),
    321321        tr("Yes, delete the transport"),
    322         tr("No, don't"), 2);
     322        tr("No, don't"), kDialogCodeButton1);
    323323
    324     if (val == 1)
     324    if (kDialogCodeButton0 != val)
    325325        return;
    326326
    327327    MSqlQuery query(MSqlQuery::InitCon());
     
    350350       return;
    351351    }
    352352
    353     int val = MythPopupBox::show2ButtonPopup(
     353    DialogCode val = MythPopupBox::Show2ButtonPopup(
    354354        gContext->GetMainWindow(),
    355355        "",
    356356        tr("Transport Menu"),
    357357        tr("Edit.."),
    358         tr("Delete.."), 1);
     358        tr("Delete.."), kDialogCodeButton0);
    359359
    360     if (val == 0)
     360    if (kDialogCodeButton0 == val)
    361361        emit Edit();
    362     else if (val == 1)
     362    else if (kDialogCodeButton1 == val)
    363363        emit Delete();
    364364    else
    365365        m_list->setFocus();
  • mythtv/libs/libmythtv/storagegroup.h

     
    3636    Q_OBJECT
    3737  public:
    3838    StorageGroupEditor(QString group);
    39     virtual int exec(void);
     39    virtual DialogCode exec(void);
    4040    virtual void load(void);
    4141    virtual void save(void) { };
    4242    virtual void save(QString) { };
     
    5959    Q_OBJECT
    6060  public:
    6161    StorageGroupListEditor(void);
    62     virtual int exec(void);
     62    virtual DialogCode exec(void);
    6363    virtual void load(void);
    6464    virtual void save(void) { };
    6565    virtual void save(QString) { };
  • mythtv/libs/libmythtv/scanwizardhelpers.cpp

     
    165165    setLabel(msg);
    166166}
    167167
    168 int ScanProgressPopup::exec(void)
     168DialogCode ScanProgressPopup::exec(void)
    169169{
    170170    if (!dialog)
    171171    {
     
    173173            dialogWidget(gContext->GetMainWindow(),
    174174                         "ConfigurationPopupDialog");
    175175    }
    176     dialog->setResult(0);
     176    dialog->setResult(kDialogCodeRejected);
    177177
    178178    done = false;
    179179    dialog->ShowPopup(this, SLOT(PopupDone(int)));
  • mythtv/libs/libmythtv/diseqcsettings.h

     
    130130  public:
    131131    DTVDeviceTreeWizard(DiSEqCDevTree &tree);
    132132
    133     virtual int exec(void);
     133    virtual DialogCode exec(void);
    134134};
    135135
    136136class DTVDeviceConfigGroup : public VerticalConfigurationGroup
  • mythtv/libs/libmythui/myththemedmenu.cpp

     
    24052405        MythPasswordDialog *pwd = new MythPasswordDialog(text, &ok, password,
    24062406                                                     gContext->GetMainWindow());
    24072407        pwd->exec();
    2408         delete pwd;
     2408        pwd->deleteLater();
    24092409
    24102410        if (ok)
    24112411        {
  • mythtv/libs/libmyth/settings.cpp

     
    14881488    return dialog;
    14891489}
    14901490
    1491 int ConfigurationDialog::exec(bool saveOnAccept, bool doLoad)
     1491DialogCode ConfigurationDialog::exec(bool saveOnAccept, bool doLoad)
    14921492{
    14931493    if (doLoad)
    14941494        load();
     
    14981498
    14991499    dialog->Show();
    15001500
    1501     int ret = dialog->exec();
     1501    DialogCode ret = dialog->exec();
    15021502
    15031503    if ((QDialog::Accepted == ret) && saveOnAccept)
    15041504        save();
     
    20862086        label->setText(str);
    20872087}
    20882088
    2089 int ConfigurationPopupDialog::exec(bool saveOnAccept)
     2089DialogCode ConfigurationPopupDialog::exec(bool saveOnAccept)
    20902090{
    20912091    storage->load();
    20922092
     
    20942094        dialogWidget(gContext->GetMainWindow(), "ConfigurationPopupDialog");
    20952095    dialog->ShowPopup(this);
    20962096
    2097     int ret = dialog->exec();
     2097    DialogCode ret = dialog->exec();
    20982098
    20992099    if ((QDialog::Accepted == ret) && saveOnAccept)
    21002100        storage->save();
  • mythtv/libs/libmyth/mythdialogs.cpp

     
    3939#include "screensaver.h"
    4040#include "mythdbcon.h"
    4141
     42/** \class MythDialog
     43 *  \brief Base dialog for most dialogs in MythTV using the old UI
     44 */
     45
    4246MythDialog::MythDialog(MythMainWindow *parent, const char *name, bool setsize)
    43           : QFrame(parent, name)
     47    : QFrame(parent, name), rescode(kDialogCodeAccepted)
    4448{
    45     rescode = 0;
    46 
    4749    if (!parent)
    4850    {
    4951        cerr << "Trying to create a dialog without a parent.\n";
     
    7981
    8082void MythDialog::deleteLater(void)
    8183{
     84    hide();
    8285    TeardownAll();
    8386    QFrame::deleteLater();
    8487}
     
    114117    show();
    115118}
    116119
     120void 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
    117132void MythDialog::done(int r)
    118133{
    119134    hide();
    120     setResult(r);
     135    setResult((DialogCode) r);
    121136    close();
    122137}
    123138
    124139void MythDialog::AcceptItem(int i)
    125140{
    126     done(ListStart + i);
     141    if (i < 0)
     142    {
     143        VERBOSE(VB_IMPORTANT, "Programmer Error: MythDialog::AcceptItem("
     144                <<i<<") called with negative index");
     145        reject();
     146        return;
     147    }
     148
     149    done((DialogCode)((int)kDialogCodeListStart + (int)i));
    127150}
    128151
     152int MythDialog::CalcItemIndex(DialogCode code)
     153{
     154    return (int)code - (int)kDialogCodeListStart;
     155}
     156
    129157void MythDialog::accept()
    130158{
    131159    done(Accepted);
     
    136164    done(Rejected);
    137165}
    138166
    139 int MythDialog::exec()
     167DialogCode MythDialog::exec(void)
    140168{
    141169    if (in_loop)
    142170    {
    143171        qWarning("MythDialog::exec: Recursive call detected.");
    144         return -1;
     172        return kDialogCodeRejected;
    145173    }
    146174
    147     setResult(Rejected);
     175    setResult(kDialogCodeRejected);
    148176
    149177    Show();
    150178
    151179    in_loop = TRUE;
    152180    qApp->enter_loop();
    153181
    154     int res = result();
     182    DialogCode res = result();
    155183
    156184    return res;
    157185}
     
    212240    }
    213241}
    214242
     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
    215257MythPopupBox::MythPopupBox(MythMainWindow *parent, const char *name)
    216258            : MythDialog(parent, name, false)
    217259{
     
    464506        MythDialog::keyPressEvent(e);
    465507}
    466508
     509void MythPopupBox::AcceptItem(int i)
     510{
     511    MythDialog::AcceptItem(i);
     512    emit popupDone(rescode);
     513}
     514
    467515void MythPopupBox::accept(void)
    468516{
    469517    MythDialog::done(MythDialog::Accepted);
     
    476524    emit popupDone(MythDialog::Rejected);
    477525}
    478526
    479 int MythPopupBox::ExecPopup(QObject *target, const char *slot)
     527DialogCode MythPopupBox::ExecPopup(QObject *target, const char *slot)
    480528{
    481529    if (!target)
    482         ShowPopup(this, SLOT(defaultExitHandler(int)));
     530        ShowPopup(this, SLOT(done(int)));
    483531    else
    484532        ShowPopup(target, slot);
    485533
    486534    return exec();
    487535}
    488536
    489 int MythPopupBox::ExecPopupAtXY(int destx, int desty,
    490                             QObject *target, const char *slot)
     537DialogCode MythPopupBox::ExecPopupAtXY(int destx, int desty,
     538                                       QObject *target, const char *slot)
    491539{
    492540    if (!target)
    493         ShowPopupAtXY(destx, desty, this, SLOT(defaultExitHandler(int)));
     541        ShowPopupAtXY(destx, desty, this, SLOT(done(int)));
    494542    else
    495543        ShowPopupAtXY(destx, desty, target, slot);
    496544
     
    525573    }
    526574    if (foundbutton)
    527575    {
    528         done(i);
     576        AcceptItem(i);
    529577        return;
    530578    }
    531579
     
    552600    }
    553601    if (foundbutton)
    554602    {
    555         done(i);
     603        AcceptItem(i);
    556604        return;
    557605    }
    558606
    559607    VERBOSE(VB_IMPORTANT, "MythPopupBox::defaultButtonPressedHandler(void)"
    560608            "\n\t\t\tWe should never get here!");
    561     done(Rejected);
     609    done(kDialogCodeRejected);
    562610}
    563611
    564 void MythPopupBox::defaultExitHandler(int r)
    565 {
    566     done(r);
    567 }
    568 
    569 static int show_ok_popup(
     612bool MythPopupBox::showOkPopup(
    570613    MythMainWindow *parent,
    571614    const QString  &title,
    572615    const QString  &message,
    573     QString         button_msg = QString::null)
     616    QString         button_msg)
    574617{
    575618    if (button_msg.isEmpty())
    576619        button_msg = QObject::tr("OK");
     
    580623    popup->addLabel(message, MythPopupBox::Medium, true);
    581624    QButton *okButton = popup->addButton(button_msg, popup, SLOT(accept()));
    582625    okButton->setFocus();
    583     int ret = popup->ExecPopup();
     626    bool ret = (kDialogCodeAccepted == popup->ExecPopup());
    584627
    585628    popup->hide();
    586629    popup->deleteLater();
     
    588631    return ret;
    589632}
    590633
    591 void MythPopupBox::showOkPopup(MythMainWindow *parent, QString title,
    592                                QString message)
    593 {
    594     show_ok_popup(parent, title, message);
    595 }
    596 
    597 void MythPopupBox::showExitPopup(MythMainWindow *parent, QString title,
    598                                  QString message)
    599 {
    600     show_ok_popup(parent, title, message, tr("Exit"));
    601 }
    602 
    603634bool MythPopupBox::showOkCancelPopup(MythMainWindow *parent, QString title,
    604635                                     QString message, bool focusOk)
    605636{
     
    651682    return ok;
    652683}
    653684
    654 
    655 int MythPopupBox::show2ButtonPopup(MythMainWindow *parent, QString title,
    656                                    QString message, QString button1msg,
    657                                    QString button2msg, int defvalue)
     685DialogCode MythPopupBox::ShowButtonPopup(
     686    MythMainWindow    *parent,
     687    const QString     &title,
     688    const QString     &message,
     689    const QStringList &buttonmsgs,
     690    DialogCode         default_button)
    658691{
    659692    MythPopupBox *popup = new MythPopupBox(parent, title);
    660693
    661694    popup->addLabel(message, Medium, true);
    662695    popup->addLabel("");
    663696
    664     QButton *but1 = popup->addButton(button1msg);
    665     QButton *but2 = popup->addButton(button2msg);
    666 
    667     if (defvalue == 1)
    668         but1->setFocus();
    669     else
    670         but2->setFocus();
    671 
    672     int ret = popup->ExecPopup();
    673 
    674     popup->hide();
    675     popup->deleteLater();
    676 
    677     return ret;
    678 }
    679 
    680 int MythPopupBox::showButtonPopup(MythMainWindow *parent, QString title,
    681                                   QString message, QStringList buttonmsgs,
    682                                   int defvalue)
    683 {
    684     MythPopupBox *popup = new MythPopupBox(parent, title);
    685 
    686     popup->addLabel(message, Medium, true);
    687     popup->addLabel("");
    688 
     697    const uint def = CalcItemIndex(default_button);
    689698    for (unsigned int i = 0; i < buttonmsgs.size(); i++ )
    690699    {
    691700        QButton *but = popup->addButton(buttonmsgs[i]);
    692         if (defvalue == (int)i)
     701        if (def == i)
    693702            but->setFocus();
    694703    }
    695704
    696     int ret = popup->ExecPopup();
     705    DialogCode ret = popup->ExecPopup();
    697706
    698707    popup->hide();
    699708    popup->deleteLater();
     
    757766    qApp->processEvents();
    758767}
    759768
     769MythProgressDialog::~MythProgressDialog()
     770{
     771    Teardown();
     772}
     773
     774void MythProgressDialog::deleteLater(void)
     775{
     776    hide();
     777    Teardown();
     778    MythDialog::deleteLater();
     779}
     780
     781void MythProgressDialog::Teardown(void)
     782{
     783    if (textItems)
     784    {
     785        delete textItems;
     786        textItems = NULL;
     787    }
     788}
     789
    760790void MythProgressDialog::Close(void)
    761791{
    762792    accept();
    763793
    764     if (textItems)
     794    LCD *lcddev = LCD::Get();
     795    if (lcddev)
    765796    {
    766         LCD * lcddev = LCD::Get();
    767797        lcddev->switchToNothing();
    768798        lcddev->switchToTime();
    769         delete textItems;
    770799    }
    771800}
    772801
     
    817846
    818847MythBusyDialog::~MythBusyDialog()
    819848{
     849    Teardown();
     850}
     851
     852void MythBusyDialog::deleteLater(void)
     853{
     854    Teardown();
     855    MythProgressDialog::deleteLater();
     856}
     857
     858void MythBusyDialog::Teardown(void)
     859{
    820860    if (timer)
    821861    {
    822862        timer->disconnect();
    823863        timer->deleteLater();
    824864        timer = NULL;
    825865    }
    826 
    827     if (LCD *lcddev = LCD::Get())
    828         lcddev->switchToTime();
    829866}
    830867
    831868void MythBusyDialog::start(int interval)
     
    881918            .arg(window_name).arg(theme_filename);
    882919        MythPopupBox::showOkPopup(gContext->GetMainWindow(),
    883920                                  tr("Missing UI Element"), msg);
    884         done(-1);
     921        reject();
    885922        return;
    886923    }
    887924}
     
    18951932    if (the_text == target_text)
    18961933    {
    18971934        *success_flag = true;
    1898         done(0);
     1935        accept();
    18991936    }
    19001937    else
    19011938    {
     
    19261963    listbox = new MythListBox(this);
    19271964    listbox->setScrollBar(false);
    19281965    listbox->setBottomScrollBar(false);
    1929     connect(listbox, SIGNAL(accepted(int)), this, SLOT(itemSelected(int)));
     1966    connect(listbox, SIGNAL(accepted(int)), this, SLOT(AcceptItem(int)));
    19301967    addWidget(listbox);
    1931    
    1932     ok_button = addButton(tr("OK"), this, SLOT(okPressed()));
    1933     cancel_button = addButton(tr("Cancel"), this, SLOT(cancelPressed()));
     1968
     1969    ok_button     = addButton(tr("OK"),     this, SLOT(accept()));
     1970    cancel_button = addButton(tr("Cancel"), this, SLOT(reject()));
    19341971}
    19351972
    19361973void MythSearchDialog::keyPressEvent(QKeyEvent *e)
     
    19451982            if (action == "ESCAPE")
    19461983            {
    19471984                handled = true;
    1948                 done(-1);       
     1985                reject();
    19491986            }
    19501987            if (action == "LEFT")
    19511988            {
     
    19601997            if (action == "SELECT")
    19611998            {
    19621999                handled = true;
    1963                 done(0);
     2000                accept();
    19642001            }
    19652002        }
    19662003    }
     
    19682005        MythPopupBox::keyPressEvent(e);
    19692006}
    19702007
    1971 void MythSearchDialog::itemSelected(int index)
    1972 {
    1973     (void)index;
    1974     done(0);
    1975 }
    1976 
    19772008void MythSearchDialog::setCaption(QString text)
    19782009{
    19792010    caption->setText(text);
     
    20022033   searchTextChanged();
    20032034}
    20042035
    2005 void MythSearchDialog::okPressed(void)
     2036MythSearchDialog::~MythSearchDialog()
    20062037{
    2007     done(0); 
     2038    Teardown();
    20082039}
    20092040
    2010 void MythSearchDialog::cancelPressed(void)
     2041void MythSearchDialog::deleteLater(void)
    20112042{
    2012     done(-1);
     2043    Teardown();
    20132044}
    20142045
    2015 MythSearchDialog::~MythSearchDialog()
     2046void MythSearchDialog::Teardown(void)
    20162047{
    2017     if (listbox)
    2018     {
    2019         delete listbox;
    2020         listbox = NULL;
    2021     }   
    2022    
    2023     if (editor)
    2024     {
    2025         delete editor;
    2026         editor = NULL;
    2027     }   
     2048    listbox = NULL; // deleted by Qt
     2049    editor  = NULL; // deleted by Qt
    20282050}
    20292051
    20302052/*
     
    20742096                       "element. \n\nReturning to the previous menu."));
    20752097        MythPopupBox::showOkPopup(gContext->GetMainWindow(),
    20762098                                  tr("Missing UI Element"), msg);
    2077         done(-1);
     2099        reject();
    20782100        return;
    20792101    }
    20802102
     
    21092131                       "\n\nReturning to the previous menu."));
    21102132        MythPopupBox::showOkPopup(gContext->GetMainWindow(),
    21112133                                  tr("Missing UI Element"), msg);
    2112         done(-1);
     2134        reject();
    21132135        return;
    21142136    }   
    21152137   
     
    23162338    if (type > -1)
    23172339    {
    23182340        *selected_file = image_files[type];
    2319         done(0);
     2341        accept();
    23202342    }   
    23212343}
    23222344
     
    23422364        VERBOSE(VB_IMPORTANT,
    23432365                "MythScrollDialog: Programmer error, trying to create "
    23442366                "a dialog without a parent.");
    2345         done(-1);
     2367        done(kDialogCodeRejected);
    23462368        return;
    23472369    }
    23482370
    23492371    m_parent     = parent;
    23502372    m_scrollMode = mode;
    23512373       
    2352     m_resCode    = 0;
     2374    m_resCode    = kDialogCodeRejected;
    23532375    m_inLoop     = false;
    23542376   
    23552377    gContext->GetScreenSettings(m_xbase, m_screenWidth, m_wmult,
     
    24442466                   m_screenHeight*areaHTimes);
    24452467}
    24462468
    2447 int MythScrollDialog::result() const
     2469DialogCode MythScrollDialog::result(void) const
    24482470{
    24492471    return m_resCode;   
    24502472}
     
    24682490    }
    24692491}
    24702492
    2471 int MythScrollDialog::exec()
     2493DialogCode MythScrollDialog::exec(void)
    24722494{
    24732495    if (m_inLoop)
    24742496    {
    24752497        std::cerr << "MythScrollDialog::exec: Recursive call detected."
    24762498                  << std::endl;
    2477         return -1;
     2499        return kDialogCodeRejected;
    24782500    }
    24792501
    2480     setResult(Rejected);
     2502    setResult(kDialogCodeRejected);
    24812503
    24822504    show();
    24832505
    24842506    m_inLoop = true;
    24852507    qApp->enter_loop();
    24862508
    2487     int res = result();
     2509    DialogCode res = result();
    24882510
    24892511    return res;
    24902512}
     
    24922514void MythScrollDialog::done(int r)
    24932515{
    24942516    hide();
    2495     setResult(r);
     2517    setResult((DialogCode)r);
    24962518    close();
    24972519}
    24982520
    24992521void MythScrollDialog::accept()
    25002522{
    2501     done(Accepted);
     2523    done(kDialogCodeAccepted);
    25022524}
    25032525
    25042526void MythScrollDialog::reject()
    25052527{
    2506     done(Rejected);
     2528    done(kDialogCodeRejected);
    25072529}
    25082530
    2509 void MythScrollDialog::setResult(int r)
     2531void MythScrollDialog::setResult(DialogCode r)
    25102532{
    25112533    m_resCode = r;   
    25122534}
  • mythtv/libs/libmyth/mythwidgets.cpp

     
    1616#include "virtualkeyboard.h"
    1717#include "libmythui/mythmainwindow.h"
    1818
     19typedef VirtualKeyboard* QWidgetP;
     20static 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
     31MythComboBox::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
    1940MythComboBox::~MythComboBox()
    2041{
    21     if (popup)
    22         delete popup;
     42    Teardown();
    2343}
    2444
    25 void MythComboBox::Init()
     45void MythComboBox::deleteLater(void)
    2646{
    27     popup = NULL;
    28     popupPosition = VK_POSBELOWEDIT;
     47    Teardown();
     48    QComboBox::deleteLater();
    2949}
    3050
     51void MythComboBox::Teardown(void)
     52{
     53    qt_delete(popup);
     54}
     55
     56void 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
    3168void MythComboBox::keyPressEvent(QKeyEvent *e)
    3269{
    3370    bool handled = false;
     
    73110            else if (action == "SELECT" && AcceptOnSelect)
    74111                emit accepted(currentItem());
    75112            else if (action == "SELECT" &&
    76                     (e->text().isNull() ||
     113                    (e->text().isEmpty() ||
    77114                    (e->key() == Qt::Key_Enter) ||
    78115                    (e->key() == Qt::Key_Return) ||
    79116                    (e->key() == Qt::Key_Space)))
    80117            {
    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();
    89120                else
    90121                   handled = true;
    91122            }
     
    354385    QSlider::focusOutEvent(e);
    355386}
    356387
     388MythLineEdit::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
     398MythLineEdit::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
    357409MythLineEdit::~MythLineEdit()
    358410{
    359     if (popup)
    360         delete popup;
     411    Teardown();
    361412}
    362413
    363 void MythLineEdit::Init()
     414void MythLineEdit::deleteLater(void)
    364415{
    365     popup = NULL;
    366     popupPosition = VK_POSBELOWEDIT;
     416    Teardown();
     417    QLineEdit::deleteLater();
    367418}
    368419
     420void MythLineEdit::Teardown(void)
     421{
     422    qt_delete(popup);
     423}
     424
     425void 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
    369436void MythLineEdit::keyPressEvent(QKeyEvent *e)
    370437{
    371438    bool handled = false;
     
    383450            else if (action == "DOWN")
    384451                focusNextPrevChild(true);
    385452            else if (action == "SELECT" &&
    386                     (e->text().isNull() ||
     453                    (e->text().isEmpty() ||
    387454                    (e->key() == Qt::Key_Enter) ||
    388455                    (e->key() == Qt::Key_Return)))
    389456            {
    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();
    399459            }
    400             else if (action == "SELECT" && e->text().isNull() )
     460            else if (action == "SELECT" && e->text().isEmpty() )
    401461                e->ignore();
    402462            else
    403463                handled = false;
     
    409469            QLineEdit::keyPressEvent(e);
    410470}
    411471
    412 void MythLineEdit::setText(const QString& text)
     472void MythLineEdit::setText(const QString &text)
    413473{
    414474    // Don't mess with the cursor position; it causes
    415475    // counter-intuitive behaviour due to interactions with the
    416476    // communication with the settings stuff
    417477
    418478    int pos = cursorPosition();
    419     QLineEdit::setText(text);
     479    QLineEdit::setText(QDeepCopy<QString>(text));
    420480    setCursorPosition(pos);
    421481}
    422482
     483QString MythLineEdit::text(void)
     484{
     485    return QDeepCopy<QString>(QLineEdit::text());
     486}
     487
    423488void MythLineEdit::focusInEvent(QFocusEvent *e)
    424489{
    425490    emit changeHelpText(helptext);
     
    531596    connect(cycle_timer, SIGNAL(timeout()), this, SLOT(endCycle()));
    532597   
    533598    popup = NULL;
     599    useVirtualKeyboard = gContext->GetNumSetting("UseVirtualKeyboard", 1);
    534600    popupPosition = VK_POSBELOWEDIT;
    535601}
    536602
     
    728794    //  of MythLineEdit, and I'm sure he had
    729795    //  a reason ...
    730796    getCursorPosition(&para, &pos);
    731     QTextEdit::setText(text);
     797    QTextEdit::setText(QDeepCopy<QString>(text));
    732798    setCursorPosition(para, pos);
    733799}
    734800
     801QString MythRemoteLineEdit::text(void)
     802{
     803    return QDeepCopy<QString>(QTextEdit::text());
     804}
     805
    735806void MythRemoteLineEdit::keyPressEvent(QKeyEvent *e)
    736807{
    737808    bool handled = false;
     
    763834            }
    764835            else if ((action == "SELECT") &&
    765836                     (!active_cycle) &&
    766                      ((e->text().isNull()) ||
     837                     ((e->text().isEmpty()) ||
    767838                      (e->key() == Qt::Key_Enter) ||
    768839                      (e->key() == Qt::Key_Return)))
    769840            {
    770                 if (gContext->GetNumSetting("UseVirtualKeyboard", 1) == 1)
    771                 {
    772                     popup = new VirtualKeyboard(gContext->GetMainWindow(), this);
    773                     gContext->GetMainWindow()->detach(popup);
    774                     popup->exec();
    775                     delete popup;
    776                     popup = NULL;
    777                 }
    778  
     841                if (useVirtualKeyboard)
     842                    popupVirtualKeyboard();
    779843            }
    780844            else
    781845                handled = false;
     
    9731037    QTextEdit::focusOutEvent(e);
    9741038}
    9751039
    976 
    9771040MythRemoteLineEdit::~MythRemoteLineEdit()
    9781041{
     1042    Teardown();
     1043}
     1044
     1045void MythRemoteLineEdit::deleteLater(void)
     1046{
     1047    Teardown();
     1048    QTextEdit::deleteLater();
     1049}
     1050
     1051void MythRemoteLineEdit::Teardown(void)
     1052{
    9791053    if (cycle_timer)
    9801054    {
    981         delete cycle_timer;
     1055        cycle_timer->disconnect();
     1056        cycle_timer->deleteLater();
     1057        cycle_timer = NULL;
    9821058    }
    9831059
    984     if (popup)
    985         delete popup;
     1060    qt_delete(popup);
    9861061}
    9871062
     1063void MythRemoteLineEdit::popupVirtualKeyboard(void)
     1064{
     1065    qt_delete(popup);
     1066
     1067    popup = new VirtualKeyboard(gContext->GetMainWindow(), this);
     1068    gContext->GetMainWindow()->detach(popup);
     1069    popup->exec();
     1070
     1071    qt_delete(popup);
     1072}
     1073
    9881074void MythRemoteLineEdit::insert(QString text)
    9891075{
    9901076    QTextEdit::insert(text);
  • mythtv/libs/libmyth/dialogbox.cpp

     
    5959void DialogBox::buttonPressed(int which)
    6060{
    6161    if (buttongroup->find(which) != checkbox)
    62         done(which + 1);
     62        AcceptItem(which);
    6363}
  • mythtv/libs/libmyth/uilistbtntype.cpp

     
    15031503    searchEdit->setFocus();
    15041504
    15051505    popup->addButton(tr("Search"));
    1506     popup->addButton(tr("Cancel"));
     1506    popup->addButton(tr("Cancel"), popup, SLOT(reject()));
    15071507
    1508     int res = popup->ExecPopup();
     1508    DialogCode res = popup->ExecPopup();
    15091509
    1510     if (res == 0)
     1510    if (kDialogCodeButton0 == res)
    15111511    {
    15121512        m_incSearch = searchEdit->text();
    15131513        m_bIncSearchContains = (modeCombo->currentItem() == 1);
     
    15171517    popup->hide();
    15181518    popup->deleteLater();
    15191519
    1520     return (res == 0);
     1520    return (kDialogCodeButton0 == res);
    15211521}
    15221522
    15231523bool UIListBtnType::incSearchNext(void)
  • mythtv/libs/libmyth/uitypes.cpp

     
    28502850{
    28512851    if (edit)
    28522852    {
    2853         delete edit;
     2853        edit->hide();
     2854        edit->deleteLater();
    28542855        edit = NULL;
    28552856    }   
    28562857}
     
    43344335    popup->addButton(tr("Search"));
    43354336    popup->addButton(tr("Cancel"));
    43364337
    4337     int res = popup->ExecPopup();
     4338    DialogCode res = popup->ExecPopup();
    43384339
    4339     if (res == 0)
     4340    if (kDialogCodeButton0 == res)
    43404341    {
    43414342        incSearch = searchEdit->text();
    43424343        bIncSearchContains = (modeCombo->currentItem() == 1);
     
    43464347    popup->hide();
    43474348    popup->deleteLater();
    43484349
    4349     return (res == 0);
     4350    return (kDialogCodeButton0 == res);
    43504351}
    43514352
    43524353bool UIManagedTreeListType::incSearchNext(void)
     
    59475948    if (!m_parentDialog)
    59485949        return;
    59495950
    5950     m_parentDialog->done(0);
     5951    m_parentDialog->done(kDialogCodeAccepted);
    59515952}
    59525953
    59535954void UIKeyboardType::updateButtons()
  • mythtv/libs/libmyth/mythcontext.cpp

     
    17671767    if (caching)
    17681768    {
    17691769        caching->Close();
    1770         delete caching;
     1770        caching->deleteLater();       
    17711771    }
    17721772}
    17731773
     
    30603060        }
    30613061
    30623062        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        }
    30653068        else
    30663069        {
    30673070            QStringList buttonNames;
    3068             int         selected;
    30693071
    30703072            buttonNames += QObject::tr("Exit");
    30713073            buttonNames += QObject::tr("Upgrade");
    30723074            if (expertMode)
    30733075                buttonNames += QObject::tr("Use current schema");
    30743076
    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
    30783081            // The annoying extra confirmation:
    3079             if (selected == 1)
     3082            if (kDialogCodeButton1 == selected)
    30803083            {
    30813084                message = tr("This cannot be un-done, so having a"
    30823085                             " database backup would be a good idea.");
    30833086                if (connections)
    30843087                    message += "\n\n" + warnOtherCl;
    30853088
    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);
    30903092            }
    30913093
    30923094            switch (selected)
    30933095            {
    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;
    30983105            }
    30993106        }
    31003107
     
    31623169
    31633170    if (GetMainWindow() && !d->disablelibrarypopup)
    31643171    {   
    3165         DialogBox dbox(gContext->GetMainWindow(), err);
    3166         dbox.AddButton("OK");
    3167         dbox.exec();
     3172        DialogBox *dlg = new DialogBox(gContext->GetMainWindow(), err);
     3173        dlg->AddButton("OK");
     3174        dlg->exec();
     3175        dlg->deleteLater();
    31683176    }
    31693177
    31703178    return false;
  • mythtv/libs/libmyth/mythcontext.h

     
    209209
    210210/// Update this whenever the plug-in API changes.
    211211/// Including changes in the libmythtv class methods used by plug-ins.
    212 #define MYTH_BINARY_VERSION "0.21.20071107-2"
     212#define MYTH_BINARY_VERSION "0.21.20071110-1"
    213213
    214214/** \brief Increment this whenever the MythTV network protocol changes.
    215215 *
  • mythtv/libs/libmyth/settings.h

     
    11531153    virtual MythDialog *dialogWidget(
    11541154        MythMainWindow *parent, const char* widgetName);
    11551155
    1156     int exec(bool saveOnAccept = true);
     1156    virtual DialogCode exec(bool saveOnAccept = true);
    11571157
    11581158    virtual void setLabel(QString str);
    11591159
     
    12061206                                     const char     *widgetName);
    12071207
    12081208    // Show a dialogWidget, and save if accepted
    1209     virtual int exec(bool saveOnExec = true, bool doLoad = true);
     1209    virtual DialogCode exec(bool saveOnExec = true, bool doLoad = true);
    12101210
    12111211    virtual void load(void) { cfgGrp->load(); }
    12121212    virtual void save(void) { cfgGrp->save(); }
  • mythtv/libs/libmyth/mythmediamonitor.cpp

     
    144144        return drives.front();
    145145    }
    146146
    147     MythPopupBox *popup = new MythPopupBox(
    148         gContext->GetMainWindow(), "select drive");
    149 
    150     popup->addLabel(label);
     147    QStringList buttonmsgs;
    151148    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);
    153153
    154     popup->addButton(tr("Cancel"))->setFocus();
     154    DialogCode ret = MythPopupBox::ShowButtonPopup(
     155        gContext->GetMainWindow(), "select drive", label,
     156        buttonmsgs, cancelbtn);
    155157
    156     int ret = popup->ExecPopup();
    157     popup->hide();
    158     popup->deleteLater();
    159 
    160158    // If the user cancelled, return a special value
    161     if (ret < 0)
     159    if ((kDialogCodeRejected == ret) || (cancelbtn == ret))
    162160        return (MythMediaDevice *)-1;
    163161
    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];
    166165
    167166    return NULL;
    168167}
  • mythtv/libs/libmyth/mythdialogs.h

     
    5050
    5151#include "libmythui/mythmainwindow.h"
    5252
     53typedef 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
     70inline bool operator==(const DialogCode &a, const QDialog::DialogCode &b)
     71{ return ((int)a) == ((int)b); }
     72inline bool operator==(const QDialog::DialogCode &a, const DialogCode &b)
     73{ return ((int)a) == ((int)b); }
     74inline bool operator!=(const DialogCode &a, const QDialog::DialogCode &b)
     75{ return ((int)a) == ((int)b); }
     76inline bool operator!=(const QDialog::DialogCode &a, const DialogCode &b)
     77{ return ((int)a) == ((int)b); }
     78
    5379class MPUBLIC MythDialog : public QFrame
    5480{
    5581    Q_OBJECT
     
    5783    MythDialog(MythMainWindow *parent, const char *name = 0,
    5884               bool setsize = true);
    5985
    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;
    6690
    67     int result(void) const { return rescode; }
     91    DialogCode result(void) const { return rescode; }
    6892
    6993    virtual void Show(void);
    7094
     
    7498   
    7599    virtual bool onMediaEvent(MythMediaDevice * mediadevice);
    76100   
    77     void setResult(int r) { rescode = r; }
     101    void setResult(DialogCode r);
    78102
    79103    virtual void deleteLater(void);
    80104
     105    static int CalcItemIndex(DialogCode code);
     106
    81107 signals:
    82108    void menuButtonPressed();
    83109
    84110  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
    89113    virtual void AcceptItem(int);
    90114    virtual void accept();
    91115    virtual void reject();
     
    102126 
    103127    MythMainWindow *m_parent;
    104128
    105     int rescode;
     129    DialogCode rescode;
    106130
    107131    bool in_loop;
    108132
     
    133157    void ShowPopupAtXY(int destx, int desty,
    134158                       QObject *target = NULL, const char *slot = NULL);
    135159
    136     int ExecPopup(QObject *target = NULL, const char *slot = NULL);
    137     int ExecPopupAtXY(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);
    139163
    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
    144169    static bool showOkCancelPopup(MythMainWindow *parent, QString title,
    145170                                  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);
    152171
     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
    153193    static bool showGetTextPopup(MythMainWindow *parent, QString title,
    154194                                 QString message, QString& text);
    155195
     196  public slots:
     197    virtual void AcceptItem(int);
    156198    virtual void accept(void);
    157199    virtual void reject(void);
    158200
     
    160202    virtual void popupDone(int);
    161203
    162204  protected:
     205    ~MythPopupBox() {} // use deleteLater() instead for thread safety
    163206    bool focusNextPrevChild(bool next);
    164207    void keyPressEvent(QKeyEvent *e);
    165208
    166209  protected slots:
    167210    void defaultButtonPressedHandler(void);
    168     void defaultExitHandler(int);
    169211
    170212  private:
    171213    QVBoxLayout *vbox;
     
    214256
    215257    void keyPressEvent(QKeyEvent *);
    216258
     259    virtual void deleteLater(void);
     260
    217261  protected:
     262    void Teardown(void);
     263    ~MythProgressDialog(); // use deleteLater() instead for thread safety
    218264    QProgressBar *progress;
    219265
    220266  private:
     
    243289    */
    244290    MythBusyDialog(const QString &title);
    245291
    246     ~MythBusyDialog();
    247 
    248292    /** \brief Setup a timer to 'move' the spinner
    249293
    250294        This will create a \p QTimer object that will update the
     
    260304    */
    261305    void Close();
    262306
     307  public slots:
     308    virtual void deleteLater(void);
     309
    263310  protected slots:
    264311    void setProgress();
    265312    void timeout();
    266313
     314  protected:
     315    void Teardown(void);
     316    ~MythBusyDialog();
     317
    267318  private:
    268319    QTimer *timer;
    269320};
     
    278329    MythThemedDialog(MythMainWindow *parent, const char *name = 0,
    279330                     bool setsize = true);
    280331
    281    ~MythThemedDialog();
    282 
    283332    virtual bool loadThemedWindow(QString window_name, QString theme_filename);
    284333    virtual void loadWindow(QDomElement &);
    285334    virtual void parseContainer(QDomElement &);
     
    328377    virtual void activateCurrent();
    329378
    330379  protected:
     380    ~MythThemedDialog(); // use deleteLater() instead for thread safety
    331381
    332382    void paintEvent(QPaintEvent* e);
    333383    UIType *widget_with_current_focus;
     
    369419                        MythMainWindow *parent,
    370420                        const char *name = 0,
    371421                        bool setsize = true);
    372     ~MythPasswordDialog();
    373 
    374422  public slots:
    375423 
    376424    void checkPassword(const QString &);
    377425
    378  protected:
    379  
     426  protected:
     427    ~MythPasswordDialog(); // use deleteLater() instead for thread safety
    380428    void keyPressEvent(QKeyEvent *e);
    381429
    382430  private:
     
    393441  public:
    394442
    395443    MythSearchDialog(MythMainWindow *parent, const char *name = 0);
    396     ~MythSearchDialog();
    397444
    398445  public:
    399446    void setCaption(QString text);
    400447    void setSearchText(QString text);
    401448    void setItems(QStringList items);
    402449    QString getResult(void);
    403    
    404  protected slots:
    405     void okPressed(void);
    406     void cancelPressed(void);   
     450
     451  public slots:
     452    virtual void deleteLater(void);
     453
     454  protected slots:
    407455    void searchTextChanged(void);
    408     void itemSelected(int index);
    409456     
    410  protected:
     457  protected:
     458    void Teardown(void);
     459    ~MythSearchDialog(); // use deleteLater() instead for thread safety
    411460    void keyPressEvent(QKeyEvent *e);
    412461
    413462  private:
     
    439488                        QString theme_filename = "",
    440489                        const char *name = 0,
    441490                        bool setsize=true);
    442     ~MythImageFileDialog();
    443 
    444491  public slots:
    445492 
    446493    void handleTreeListSelection(int, IntVector*);
     
    449496    void buildFileList(QString directory);
    450497
    451498  protected:
    452  
     499    ~MythImageFileDialog(); // use deleteLater() instead for thread safety
    453500    void keyPressEvent(QKeyEvent *e);
    454501
    455502  private:
     
    472519   
    473520  public:
    474521
    475     enum DialogCode {
    476         Rejected,
    477         Accepted
    478     };
    479 
    480522    enum ScrollMode {
    481523        HScroll=0,
    482524        VScroll
     
    484526
    485527    MythScrollDialog(MythMainWindow *parent, ScrollMode mode=HScroll,
    486528                     const char *name = 0);
    487     ~MythScrollDialog();
    488529
    489530    void setArea(int w, int h);
    490531    void setAreaMultiplied(int areaWTimes, int areaHTimes);
    491532
    492     int  result() const;
     533    DialogCode result(void) const;
    493534
    494535  public slots:
    495536
    496     int  exec();
     537    DialogCode exec(void);
    497538    virtual void done(int);
    498539    virtual void show();
    499540    virtual void hide();
     
    505546    virtual void reject();
    506547
    507548  protected:
    508 
     549    ~MythScrollDialog(); // use deleteLater() instead for thread safety
    509550    void         keyPressEvent(QKeyEvent *e);
    510551    virtual void paintEvent(QRegion& region, int x, int y, int w, int h);
    511552
    512     void setResult(int r);
     553    void setResult(DialogCode r);
    513554    void viewportPaintEvent(QPaintEvent *pe);
    514555
    515556    MythMainWindow *m_parent;
     
    523564    QFont           m_defaultMediumFont;
    524565    QFont           m_defaultSmallFont;
    525566
    526     int             m_resCode;
     567    DialogCode      m_resCode;
    527568    bool            m_inLoop;
    528569   
    529570    QPixmap        *m_bgPixmap;
  • mythtv/libs/libmyth/virtualkeyboard.cpp

     
    5151        if (!loadThemedWindow("keyboard", "keyboard/en_us_"))
    5252        {
    5353            VERBOSE(VB_IMPORTANT, "VirtualKeyboard: cannot find layout for US English");
    54             done(-1);
     54            reject();
    5555            return;
    5656        }
    5757    }
     
    6363    {
    6464        cerr << "VirtualKeyboard: cannot find the 'keyboard_container'"
    6565                " in your theme" << endl;
    66         done(-1);
     66        reject();
    6767        return;
    6868    }
    6969
     
    162162    if (!m_keyboard)
    163163    {
    164164        cerr << "VirtualKeyboard: cannot find the UIKeyboardType in your theme" << endl;
    165         done(-1);
     165        reject();
    166166        return;
    167167    }
    168168
     
    212212            QString action = actions[i];
    213213            handled = true;
    214214            if (action == "ESCAPE")
    215                 done(0);
     215                accept();
    216216            else
    217217                handled = false;
    218218        }
  • mythtv/libs/libmyth/dialogbox.h

     
    2323  protected slots:
    2424    void buttonPressed(int which);
    2525
     26  protected:
     27    ~DialogBox() {} // use deleteLater() for thread safety
     28
    2629  private:
    2730    QVBoxLayout *box;
    2831    QButtonGroup *buttongroup;
  • mythtv/libs/libmyth/mythwidgets.h

     
    4141{
    4242    Q_OBJECT
    4343  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);
    4745
    48     virtual ~MythComboBox();
    49 
    5046    void setHelpText(QString help) { helptext = help; }
    5147    void setAcceptOnSelect(bool Accept) { AcceptOnSelect = Accept; }
    5248    void setStep(int _step = 1) { step = _step; }
     
    6157    void gotFocus();
    6258
    6359  public slots:
     60    virtual void deleteLater(void);
    6461    void insertItem(const QString& item) {
    6562        QComboBox::insertItem(item);
    6663    };
    6764
    6865  protected:
     66    void Teardown(void);
     67    virtual ~MythComboBox(); // use deleteLater for thread safety
    6968    virtual void keyPressEvent (QKeyEvent *e);
    7069    virtual void focusInEvent(QFocusEvent *e);
    7170    virtual void focusOutEvent(QFocusEvent *e);
    7271    void Init(void);
     72    virtual void popupVirtualKeyboard(void);
    7373
    7474  private:
    7575    VirtualKeyboard *popup;
    7676    QString helptext;
    7777    bool AcceptOnSelect;
     78    bool useVirtualKeyboard;
    7879    bool allowVirtualKeyboard;
    7980    PopupPosition popupPosition;
    8081    int step;
     
    133134{
    134135    Q_OBJECT
    135136  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);
    139139
    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 
    147140    void setHelpText(QString help) { helptext = help; };
    148141    void setRW(bool readwrite = true) { rw = readwrite; };
    149142    void setRO() { rw = false; };
     
    152145    void setPopupPosition(PopupPosition pos) { popupPosition = pos; }
    153146    PopupPosition getPopupPosition(void) { return popupPosition; }
    154147
    155  public slots:
    156      virtual void setText(const QString& text);
     148    virtual QString text();
    157149
     150  public slots:
     151    virtual void deleteLater(void);
     152    virtual void setText(const QString &text);
     153
    158154  signals:
    159155    void changeHelpText(QString);
    160156
    161157  protected:
     158    void Teardown(void);
     159    virtual ~MythLineEdit(); // use deleteLater for thread safety
     160
    162161    virtual void keyPressEvent(QKeyEvent *e);
    163162    virtual void focusInEvent(QFocusEvent *e);
    164163    virtual void focusOutEvent(QFocusEvent *e);
    165164    virtual void hideEvent(QHideEvent *e);
    166165    virtual void mouseDoubleClickEvent(QMouseEvent *e);
    167     void Init(void);
     166    virtual void popupVirtualKeyboard(void);
    168167
    169168  private:
    170169    VirtualKeyboard *popup;
    171170    QString helptext;
    172171    bool rw;
     172    bool useVirtualKeyboard;
    173173    bool allowVirtualKeyboard;
    174174    PopupPosition popupPosition;
    175175};
     
    187187    MythRemoteLineEdit( const QString & contents, QWidget * parent, const char * name = 0 );   
    188188    MythRemoteLineEdit( QFont *a_font, QWidget * parent, const char * name = 0 );   
    189189    MythRemoteLineEdit( int lines, QWidget * parent, const char * name = 0 );
    190    ~MythRemoteLineEdit();
     190
    191191    void setHelpText(QString help) { helptext = help; }
    192192    void setCycleTime(float desired_interval); // in seconds
    193193    void setCharacterColors(QColor unselected, QColor selected, QColor special);
     
    197197    void setPopupPosition(PopupPosition pos) { popupPosition = pos; };
    198198    PopupPosition getPopupPosition(void) { return popupPosition; };
    199199
     200    virtual QString text();
     201
    200202  signals:
    201203
    202204    void    shiftState(bool);
     
    208210    void    textChanged(QString);
    209211
    210212  public slots:
    211    
     213    virtual void deleteLater(void);
    212214    virtual void setText(const QString& text);
    213215   
    214216  protected:
    215    
     217    void Teardown(void);
     218    virtual ~MythRemoteLineEdit(); // use deleteLater for thread safety
    216219    virtual void focusInEvent(QFocusEvent *e);
    217220    virtual void focusOutEvent(QFocusEvent *e);
    218221    virtual void keyPressEvent(QKeyEvent *e);
     222    virtual void popupVirtualKeyboard(void);
    219223
    220224  private slots:
    221225
     
    255259    int m_lines;
    256260
    257261    VirtualKeyboard *popup;
    258     PopupPosition popupPosition;
     262    bool             useVirtualKeyboard;
     263    PopupPosition    popupPosition;
    259264};
    260265
    261266class MPUBLIC MythTable : public QTable
  • mythtv/programs/mythfrontend/playbackbox.cpp

     
    485485    }
    486486}
    487487
    488 int PlaybackBox::exec(void)
     488DialogCode PlaybackBox::exec(void)
    489489{
    490490    if (recGroup != "")
    491491        return MythDialog::exec();
     
    496496        return MythDialog::exec();
    497497    }
    498498
    499     return 0;
     499    return kDialogCodeRejected;
    500500}
    501501
    502502/* blocks until playing has stopped */
     
    45574557
    45584558    iconhelp->addLayout(grid);
    45594559
    4560     QButton *button = iconhelp->addButton(tr("Ok"));
     4560    QButton *button = iconhelp->addButton(
     4561        QObject::tr("OK"), iconhelp, SLOT(accept()));
    45614562    button->setFocus();
    45624563
    45634564    iconhelp->ExecPopup();
     
    46874688    recGroupPopup->addWidget(exitbutton);
    46884689    connect(exitbutton, SIGNAL(clicked()), recGroupPopup, SLOT(reject()));
    46894690
    4690     int result = recGroupPopup->ExecPopup();
     4691    DialogCode result = recGroupPopup->ExecPopup();
    46914692
    46924693    if (result != MythDialog::Rejected)
    46934694    {
     
    48534854    connect(recGroupListBox, SIGNAL(currentChanged(QListBoxItem *)), this,
    48544855            SLOT(recGroupChooserListBoxChanged()));
    48554856
    4856     int result = recGroupPopup->ExecPopup();
     4857    DialogCode result = recGroupPopup->ExecPopup();
    48574858
    48584859    if (result != MythDialog::Rejected)
    48594860        setGroupFilter();
     
    49134914                                                     recGroupPassword,
    49144915                                                     gContext->GetMainWindow());
    49154916        pwd->exec();
    4916         delete pwd;
     4917        pwd->deleteLater();
    49174918        if (!ok)
    49184919        {
    49194920            recGroupPassword = savedPW;
     
    50555056            SLOT(recGroupChangerListBoxChanged()));
    50565057    connect(recGroupOkButton, SIGNAL(clicked()), recGroupPopup, SLOT(accept()));
    50575058
    5058     int result = recGroupPopup->ExecPopup();
     5059    DialogCode result = recGroupPopup->ExecPopup();
    50595060
    50605061    if (result != MythDialog::Rejected)
    50615062        setRecGroup();
     
    51065107    connect(recGroupListBox, SIGNAL(accepted(int)),
    51075108            recGroupPopup,   SLOT(AcceptItem(int)));
    51085109
    5109     int result = recGroupPopup->ExecPopup();
     5110    DialogCode result = recGroupPopup->ExecPopup();
    51105111
    51115112    if (result != MythDialog::Rejected)
    51125113        setPlayGroup();
     
    51435144
    51445145    connect(recGroupOkButton, SIGNAL(clicked()), recGroupPopup, SLOT(accept()));
    51455146
    5146     int result = recGroupPopup->ExecPopup();
     5147    DialogCode result = recGroupPopup->ExecPopup();
    51475148
    51485149    if (result == MythDialog::Accepted)
    51495150        setRecTitle();
  • mythtv/programs/mythfrontend/channelrecpriority.cpp

     
    4545    theme->SetHMult(hmult);
    4646    if (!theme->LoadTheme(xmldata, "recprioritychannels"))
    4747    {
    48         DialogBox diag(gContext->GetMainWindow(), tr("The theme you are using "
    49                        "does not contain a 'recprioritychannels' element.  "
    50                        "Please contact the theme creator and ask if they could "
    51                        "please update it.<br><br>The next screen will be empty."
    52                        "  Escape out of it to return to the menu."));
    53         diag.AddButton(tr("OK"));
    54         diag.exec();
     48        DialogBox *dlg = new DialogBox(
     49            gContext->GetMainWindow(),
     50            tr("The theme you are using "
     51               "does not contain a 'recprioritychannels' element.  "
     52               "Please contact the theme creator and ask if they could "
     53               "please update it.<br><br>The next screen will be empty."
     54               "  Escape out of it to return to the menu."));
    5555
     56        dlg->AddButton(tr("OK"));
     57        dlg->exec();
     58        dlg->deleteLater();
     59
    5660        return;
    5761    }
    5862
  • mythtv/programs/mythfrontend/custompriority.cpp

     
    475475        errdiag->AddButton(QObject::tr("OK"));
    476476        errdiag->exec();
    477477
    478         delete errdiag;
     478        errdiag->deleteLater();
    479479    }
    480480    return ret;
    481481}
  • mythtv/programs/mythfrontend/main.cpp

     
    359359    else if (sel == "settings appearance")
    360360    {
    361361        AppearanceSettings *settings = new AppearanceSettings();
    362         int res = settings->exec();
     362        DialogCode res = settings->exec();
    363363        delete settings;
    364364
    365         if (res)
     365        if (kDialogCodeRejected != res)
    366366        {
    367367            qApp->processEvents();
    368368            GetMythMainWindow()->JumpTo("Reload Theme");
     
    455455
    456456    QString title = QObject::tr("Do you really want to exit MythTV?");
    457457
    458     DialogBox diag(gContext->GetMainWindow(), title);
     458    DialogBox *dlg = new DialogBox(gContext->GetMainWindow(), title);
    459459
    460     diag.AddButton(QObject::tr("No"));
    461     int result;
     460    dlg->AddButton(QObject::tr("No"));
     461    DialogCode result = kDialogCodeRejected;
    462462
     463    int ret = NO_EXIT;
    463464    switch (exitMenuStyle)
    464465    {
    465466        case 0:
    466             diag.AddButton(QObject::tr("Yes, Exit now"));
     467            dlg->AddButton(QObject::tr("Yes, Exit now"));
    467468            if (frontendOnly)
    468                 diag.AddButton(QObject::tr("Yes, Exit and Shutdown"));
    469             result = diag.exec();
     469                dlg->AddButton(QObject::tr("Yes, Exit and Shutdown"));
     470            result = dlg->exec();
    470471            switch (result)
    471472            {
    472                 case 1: return NO_EXIT;
    473                 case 2: return QUIT;
    474                 case 3: return HALT;
    475                 default: return NO_EXIT;
     473                case kDialogCodeButton0: ret = NO_EXIT; break;
     474                case kDialogCodeButton1: ret = QUIT;    break;
     475                case kDialogCodeButton2: ret = HALT;    break;
     476                default:                 ret = NO_EXIT; break;
    476477            }
     478            break;
    477479        case 1:
    478             diag.AddButton(QObject::tr("Yes, Exit now"));
    479             result = diag.exec();
     480            dlg->AddButton(QObject::tr("Yes, Exit now"));
     481            result = dlg->exec();
    480482            switch (result)
    481483            {
    482                 case 1: return NO_EXIT;
    483                 case 2: return QUIT;
    484                 default: return NO_EXIT;
     484                case kDialogCodeButton0: ret = NO_EXIT; break;
     485                case kDialogCodeButton1: ret = QUIT;    break;
     486                default:                 ret = NO_EXIT; break;
    485487            }
     488            break;
    486489        case 2:
    487             diag.AddButton(QObject::tr("Yes, Exit now"));
    488             diag.AddButton(QObject::tr("Yes, Exit and Shutdown"));
    489             result = diag.exec();
     490            dlg->AddButton(QObject::tr("Yes, Exit now"));
     491            dlg->AddButton(QObject::tr("Yes, Exit and Shutdown"));
     492            result = dlg->exec();
    490493            switch (result)
    491494            {
    492                 case 1: return NO_EXIT;
    493                 case 2: return QUIT;
    494                 case 3: return HALT;
    495                 default: return NO_EXIT;
     495                case kDialogCodeButton0: ret = NO_EXIT; break;
     496                case kDialogCodeButton1: ret = QUIT;    break;
     497                case kDialogCodeButton2: ret = HALT;    break;
     498                default:                 ret = NO_EXIT; break;
    496499            }
     500            break;
    497501        case 3:
    498             diag.AddButton(QObject::tr("Yes, Exit now"));
    499             diag.AddButton(QObject::tr("Yes, Exit and Reboot"));
    500             diag.AddButton(QObject::tr("Yes, Exit and Shutdown"));
    501             result = diag.exec();
     502            dlg->AddButton(QObject::tr("Yes, Exit now"));
     503            dlg->AddButton(QObject::tr("Yes, Exit and Reboot"));
     504            dlg->AddButton(QObject::tr("Yes, Exit and Shutdown"));
     505            result = dlg->exec();
    502506            switch (result)
    503507            {
    504                 case 1: return NO_EXIT;
    505                 case 2: return QUIT;
    506                 case 3: return REBOOT;
    507                 case 4: return HALT;
    508                 default: return NO_EXIT;
     508                case kDialogCodeButton0: ret = NO_EXIT; break;
     509                case kDialogCodeButton1: ret = QUIT;    break;
     510                case kDialogCodeButton2: ret = REBOOT;  break;
     511                case kDialogCodeButton3: ret = HALT;    break;
     512                default:                 ret = NO_EXIT; break;
    509513            }
     514            break;
    510515        case 4:
    511             diag.AddButton(QObject::tr("Yes, Exit and Shutdown"));
    512             result = diag.exec();
     516            dlg->AddButton(QObject::tr("Yes, Exit and Shutdown"));
     517            result = dlg->exec();
    513518            switch (result)
    514519            {
    515                 case 1: return NO_EXIT;
    516                 case 2: return HALT;
    517                 default: return NO_EXIT;
     520                case kDialogCodeButton0: ret = NO_EXIT; break;
     521                case kDialogCodeButton1: ret = HALT;    break;
     522                default:                 ret = NO_EXIT; break;
    518523            }
     524            break;
    519525        case 5:
    520             diag.AddButton(QObject::tr("Yes, Exit and Reboot"));
    521             result = diag.exec();
     526            dlg->AddButton(QObject::tr("Yes, Exit and Reboot"));
     527            result = dlg->exec();
    522528            switch (result)
    523529            {
    524                 case 1: return NO_EXIT;
    525                 case 2: return REBOOT;
    526                 default: return NO_EXIT;
     530                case kDialogCodeButton0: ret = NO_EXIT; break;
     531                case kDialogCodeButton1: ret = REBOOT;  break;
     532                default:                 ret = NO_EXIT; break;
    527533            }
     534            break;
    528535        case 6:
    529             diag.AddButton(QObject::tr("Yes, Exit and Reboot"));
    530             diag.AddButton(QObject::tr("Yes, Exit and Shutdown"));
    531             result = diag.exec();
     536            dlg->AddButton(QObject::tr("Yes, Exit and Reboot"));
     537            dlg->AddButton(QObject::tr("Yes, Exit and Shutdown"));
     538            result = dlg->exec();
    532539            switch (result)
    533540            {
    534                 case 1: return NO_EXIT;
    535                 case 2: return REBOOT;
    536                 case 3: return HALT;
    537                 default: return NO_EXIT;
     541                case kDialogCodeButton0: ret = NO_EXIT; break;
     542                case kDialogCodeButton1: ret = REBOOT;  break;
     543                case kDialogCodeButton2: ret = HALT;    break;
     544                default:                 ret = NO_EXIT; break;
    538545            }
     546            break;
    539547    }
    540548
    541     return NO_EXIT;
     549    dlg->deleteLater();
     550    dlg = NULL;
     551
     552    return ret;
    542553}
    543554
    544555void haltnow()
     
    701712                    long long pos = (long long)(atoi((*++it).ascii()) & 0xffffffffLL);
    702713                    if (pos > 0)
    703714                    {
    704                         QString msg = QString("DVD contains a bookmark");
    705                         QString button1msg = QString("Play from bookmark");
    706                         QString button2msg = 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");
    707718       
    708                         int ret = MythPopupBox::show2ButtonPopup(gContext->GetMainWindow(),
    709                                                             "", msg,
    710                                                             button1msg,
    711                                                             button2msg,
    712                                                             1);
    713                         if (ret == 1)
     719                        DialogCode ret = MythPopupBox::Show2ButtonPopup(
     720                            gContext->GetMainWindow(),
     721                            "", msg,
     722                            btn0msg,
     723                            btn1msg,
     724                            kDialogCodeButton0);
     725                        if (kDialogCodeButton1 == ret)
    714726                            pginfo->setIgnoreBookmark(true);
    715                         else if (ret == -1)
     727                        else if (kDialogCodeRejected == ret)
    716728                        {
    717729                            delete tmprbuf;
    718730                            delete pginfo;
  • mythtv/programs/mythfrontend/statusbox.cpp

     
    361361            if ((inContent) &&
    362362                (currentItem == QObject::tr("Log Entries")))
    363363            {
    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)
    370372                {
    371373                    MSqlQuery query(MSqlQuery::InitCon());
    372374                    query.prepare("UPDATE mythlog SET acknowledged = 1 "
     
    552554    {
    553555        if (currentItem == QObject::tr("Log Entries"))
    554556        {
    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);
    556562
    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)
    562564            {
    563565                MSqlQuery query(MSqlQuery::InitCon());
    564566                query.prepare("UPDATE mythlog SET acknowledged = 1 "
     
    572574        {
    573575            QStringList msgs;
    574576            int jobStatus;
    575             int retval;
    576577
    577578            jobStatus = JobQueue::GetJobStatus(
    578579                                contentData[contentPos].toInt());
    579580
    580581            if (jobStatus == JOB_QUEUED)
    581582            {
    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)
    589588                {
    590589                    JobQueue::DeleteJob(contentData[contentPos].toInt());
    591590                    doJobQueueStatus();
     
    598597                msgs << QObject::tr("Pause");
    599598                msgs << QObject::tr("Stop");
    600599                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)
    606606                {
    607607                    JobQueue::PauseJob(contentData[contentPos].toInt());
    608608                    doJobQueueStatus();
    609609                }
    610                 else if (retval == 1)
     610                else if (kDialogCodeButton1 == retval)
    611611                {
    612612                    JobQueue::StopJob(contentData[contentPos].toInt());
    613613                    doJobQueueStatus();
     
    618618                msgs << QObject::tr("Resume");
    619619                msgs << QObject::tr("Stop");
    620620                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)
    626628                {
    627629                    JobQueue::ResumeJob(contentData[contentPos].toInt());
    628630                    doJobQueueStatus();
    629631                }
    630                 else if (retval == 1)
     632                else if (kDialogCodeButton1 == retval)
    631633                {
    632634                    JobQueue::StopJob(contentData[contentPos].toInt());
    633635                    doJobQueueStatus();
     
    635637            }
    636638            else if (jobStatus & JOB_DONE)
    637639            {
    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)
    644647                {
    645648                    JobQueue::ChangeJobStatus(contentData[contentPos].toInt(),
    646649                                              JOB_QUEUED);
     
    657660            if (rec)
    658661            {
    659662                QStringList msgs;
    660                 int retval;
    661663
    662664                msgs << QObject::tr("Delete Now");
    663665                msgs << QObject::tr("Disable AutoExpire");
    664666                msgs << QObject::tr("No Change");
    665667               
    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);
    670673
    671                 if (retval == 0 && REC_CAN_BE_DELETED(rec))
     674                if ((kDialogCodeButton0 == retval) && REC_CAN_BE_DELETED(rec))
    672675                {
    673676                    RemoteDeleteRecording(rec, false, false);
    674677                }
    675                 else if (retval == 1)
     678                else if (kDialogCodeButton1 == retval)
    676679                {
    677680                    rec->SetAutoExpire(0);
    678681                    if ((rec)->recgroup == "LiveTV")
  • mythtv/programs/mythfrontend/programrecpriority.cpp

     
    103103    theme->SetHMult(hmult);
    104104    if (!theme->LoadTheme(xmldata, "recpriorityprograms"))
    105105    {
    106         DialogBox diag(gContext->GetMainWindow(), tr("The theme you are using "
    107                        "does not contain a 'recpriorityprograms' element.  "
    108                        "Please contact the theme creator and ask if they could "
    109                        "please update it.<br><br>The next screen will be empty."
    110                        "  Escape out of it to return to the menu."));
    111         diag.AddButton(tr("OK"));
    112         diag.exec();
     106        DialogBox *dlg = new DialogBox(
     107            gContext->GetMainWindow(),
     108            tr("The theme you are using does not contain a "
     109               "'recpriorityprograms' element.  Please contact the theme "
     110               "creator and ask if they could please update it.<br><br>The "
     111               "next screen will be empty.  Escape out of it to return to "
     112               "the menu."));
    113113
     114        dlg->AddButton(tr("OK"));
     115        dlg->exec();
     116        dlg->deleteLater();
     117
    114118        return;
    115119    }
    116120
  • mythtv/programs/mythfrontend/playbackbox.h

     
    106106    static ProgramInfo *RunPlaybackBox(void *player);
    107107
    108108  public slots:
    109     int exec();
     109    DialogCode exec();
    110110
    111111  protected slots:
    112112    void timeout(void);
  • mythtv/programs/mythtv-setup/main.cpp

     
    310310
    311311    if (backendIsRunning)
    312312    {
    313         int val = MythPopupBox::show2ButtonPopup(
     313        DialogCode val = MythPopupBox::Show2ButtonPopup(
    314314            gContext->GetMainWindow(), QObject::tr("WARNING"),
    315315            warn,
    316316            QObject::tr("Continue"),
    317             QObject::tr("Exit"), 1);
    318         if (1 == val)
    319             return 0;
     317            QObject::tr("Exit"), kDialogCodeButton0);
    320318
    321         backendIsRunning = true;
     319        if (kDialogCodeButton1 == val)
     320            return 0;
    322321    }
    323322
    324323    REG_KEY("qt", "DELETE", "Delete", "D");
     
    348347            dia->AddButton(QObject::tr("Yes please"));
    349348            dia->AddButton(QObject::tr("No, I know what I am doing"));
    350349
    351             if (dia->exec() == 2)
     350            if (kDialogCodeButton1 == dia->exec())
    352351                haveProblems = false;
    353             delete dia;
     352            dia->deleteLater();
    354353        }
    355354
    356355        delete problems;
     
    368367                                        "with channel information."));
    369368        dia->AddButton(QObject::tr("OK"));
    370369        dia->exec();
    371         delete dia;
     370        dia->deleteLater();
    372371    }
    373372
    374373    if (backendIsRunning)
  • mythtv/programs/mythwelcome/welcomedialog.h

     
    2323    void keyPressEvent(QKeyEvent *e);
    2424    void customEvent(QCustomEvent *e);
    2525    void wireUpTheme();
    26     int exec(void);
     26    DialogCode exec(void);
    2727   
    2828  protected slots:
    2929    void startFrontendClick(void);
  • mythtv/programs/mythwelcome/welcomedialog.cpp

     
    8484    QTimer::singleShot(500, this, SLOT(startFrontend()));
    8585}
    8686
    87 int WelcomeDialog::exec()
     87DialogCode WelcomeDialog::exec(void)
    8888{
    8989    // mythshutdown --startup returns 0 for automatic startup
    9090    //                                1 for manual startup
     
    203203        else if (action == "INFO")
    204204        {
    205205            MythWelcomeSettings settings;
    206             if (settings.exec() == 1)
     206            if (kDialogCodeAccepted == settings.exec())
    207207            {
    208208                RemoteSendMessage("CLEAR_SETTINGS_CACHE");
    209209                updateStatus();
     
    213213        else if (action == "SHOWSETTINGS")
    214214        {
    215215            MythShutdownSettings settings;
    216             if (settings.exec() == 1)
     216            if (kDialogCodeAccepted == settings.exec())
    217217                RemoteSendMessage("CLEAR_SETTINGS_CACHE");
    218218        }
    219219        else if (action == "0")
     
    296296
    297297void WelcomeDialog::closeDialog()
    298298{
    299     done(1);
     299    done(kDialogCodeAccepted);
    300300}
    301301
    302302WelcomeDialog::~WelcomeDialog()
     
    703703                         SLOT(shutdownNow()));
    704704    popup->addButton(tr("Exit"), this,
    705705                         SLOT(closeDialog()));
    706     popup->addButton(tr("Cancel"), this, SLOT(cancelPopup()));
     706    popup->addButton(tr("Cancel"), popup, SLOT(reject()));
    707707
    708708    popup->ShowPopup(this, SLOT(donePopup(int)));
    709709