Ticket #4132: 4132-dbg-v8.patch

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

Updated patch, no fixes this just applies to the latest svn

  • mythplugins/mythmusic/mythmusic/playbackbox.cpp

     
    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))
     
    23652365    dupsCheck->setBackgroundOrigin(ParentOrigin);
    23662366    popup->addWidget(dupsCheck);
    23672367
    2368     int res = popup->ExecPopup();
     2368    DialogCode res = popup->ExecPopup();
    23692369    switch (res)
    23702370    {
    2371         case 0:
     2371        case kDialogCodeButton0:
    23722372            insertOption = PL_REPLACE;
    23732373            break;
    2374         case 1:
     2374        case kDialogCodeButton1:
    23752375            insertOption = PL_INSERTAFTERCURRENT;
    23762376            break;
    2377         case 2:
     2377        case kDialogCodeButton2:
    23782378            insertOption = PL_INSERTATEND;
    23792379            break;
     2380        case kDialogCodeRejected:
     2381        default:
     2382            popup->deleteLater();
     2383            return false;
    23802384    }
    23812385
    23822386    bRemoveDups = dupsCheck->isChecked();
     
    24062410
    24072411    popup->deleteLater();
    24082412
    2409     return (res >= 0);
     2413    return true;
    24102414}
    24112415
    24122416QString 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/cdrip.cpp

     
    733733                        dlg->AddButton("No To All");
    734734                        dlg->AddButton("Yes");
    735735                        dlg->AddButton("Yes To All");
    736                         int res = dlg->exec();
     736                        DialogCode res = dlg->exec();
    737737                        dlg->deleteLater();
    738738                        dlg = NULL;
    739739
    740                         if (res == 1)
     740                        if (kDialogCodeButton0 == res)
    741741                        {
    742742                            delete ripTrack;
    743743                            delete metadata;
    744744                        }
    745                         else if (res == 2)
     745                        else if (kDialogCodeButton1 == res)
    746746                        {
    747747                            noToAll = true;
    748748                            delete ripTrack;
    749749                            delete metadata;
    750750                        }
    751                         else if (res == 3)
     751                        else if (kDialogCodeButton2 == res)
    752752                        {
    753753                            deleteTrack(m_artistName, m_albumName, title);
    754754                            m_tracks->push_back(ripTrack);
    755755                        }
    756                         else if (res == 4)
     756                        else if (kDialogCodeButton3 == res)
    757757                        {
    758758                            yesToAll = true;
    759759                            deleteTrack(m_artistName, m_albumName, title);
    760760                            m_tracks->push_back(ripTrack);
    761761                        }
     762                        else // treat cancel as no
     763                        {
     764                            delete ripTrack;
     765                            delete metadata;
     766                        }
    762767                    }
    763768                }
    764769            }
     
    11711176
    11721177    RipStatus statusDialog(m_CDdevice, m_tracks, m_qualitySelector->getCurrentInt(),
    11731178                           gContext->GetMainWindow(), "edit metadata");
    1174     int res = statusDialog.exec();
    1175     if (res == Accepted)
     1179    DialogCode rescode = statusDialog.exec();
     1180    if (kDialogCodeAccepted == rescode)
    11761181    {
    11771182        bool EjectCD = gContext->GetNumSetting("EjectCDAfterRipping", 1);
    11781183        if (EjectCD)
     
    13791384    searchDialog->setCaption(caption);
    13801385    searchDialog->setSearchText(value);
    13811386    searchDialog->setItems(m_searchList);
    1382     if (searchDialog->ExecPopupAtXY(-1, 8) == 0)
     1387    DialogCode rescode = searchDialog->ExecPopupAtXY(-1, 8);
     1388    if (kDialogCodeRejected != rescode)
    13831389    {
    13841390        value = searchDialog->getResult();
    13851391        res = true;
     
    13991405                                  "edit_metadata", "music-", "edit metadata");
    14001406    editDialog.setSaveMetadataOnly();
    14011407
    1402     if (editDialog.exec())
     1408    if (kDialogCodeRejected != editDialog.exec())
    14031409    {
    14041410        updateTrackList();
    14051411    }
  • 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();
     
    15141510   
    15151511    orderByDialog->setFieldList(orderByCombo->currentText());
    15161512   
    1517     if (orderByDialog->ExecPopup() == 0)
     1513    if (kDialogCodeAccepted == orderByDialog->ExecPopup())
    15181514        orderByCombo->setCurrentText(orderByDialog->getFieldList());
    15191515   
    15201516    delete orderByDialog;
     
    18741870            if (action == "ESCAPE")
    18751871            {
    18761872                handled = true;
    1877                 done(-1);       
     1873                reject();
    18781874            }
    18791875            else if (action == "LEFT")
    18801876            {
     
    21762172    connect(moveDownButton, SIGNAL(clicked()), this, SLOT(moveDownPressed()));
    21772173    connect(ascendingButton, SIGNAL(clicked()), this, SLOT(ascendingPressed()));
    21782174    connect(descendingButton, SIGNAL(clicked()), this, SLOT(descendingPressed()));
    2179     connect(okButton, SIGNAL(clicked()), this, SLOT(okPressed()));
     2175    connect(okButton, SIGNAL(clicked()), this, SLOT(accept()));
    21802176   
    21812177    connect(listbox, SIGNAL(selectionChanged(QListBoxItem*)), this,
    21822178            SLOT(listBoxSelectionChanged(QListBoxItem*)));
     
    22432239            if (action == "ESCAPE")
    22442240            {
    22452241                handled = true;
    2246                 done(-1);       
     2242                reject();
    22472243            }
    22482244            else if (action == "LEFT")
    22492245            {
     
    22982294            else if (action == "7")
    22992295            {
    23002296                handled = true;
    2301                 okPressed();
     2297                accept();
    23022298            }
    23032299        }
    23042300    }
     
    23672363    listbox->setSelected(listbox->selectedItem()->next(), true);
    23682364}
    23692365
    2370 void SmartPLOrderByDialog::okPressed(void)
    2371 {
    2372     done(0);
    2373 }
    2374 
    23752366void SmartPLOrderByDialog::orderByChanged(void)
    23762367{
    23772368    bool found = false;
     
    25512542
    25522543    addLayout(vbox, 0);
    25532544   
    2554     connect(okButton, SIGNAL(clicked()), this, SLOT(okPressed()));
    2555     connect(cancelButton, SIGNAL(clicked()), this, SLOT(cancelPressed()));
     2545    connect(okButton, SIGNAL(clicked()), this, SLOT(accept()));
     2546    connect(cancelButton, SIGNAL(clicked()), this, SLOT(reject()));
    25562547
    25572548    connect(fixedRadio, SIGNAL(toggled(bool)), this, SLOT(fixedCheckToggled(bool)));
    25582549    connect(nowRadio, SIGNAL(toggled(bool)), this, SLOT(nowCheckToggled(bool)));
     
    26612652            if (action == "ESCAPE")
    26622653            {
    26632654                handled = true;
    2664                 done(-1);       
     2655                reject();
    26652656            }
    26662657            else if (action == "LEFT")
    26672658            {
     
    26892680        MythPopupBox::keyPressEvent(e);
    26902681}
    26912682
    2692 void SmartPLDateDialog::okPressed(void)
    2693 {
    2694     done(0);
    2695 }
    2696 
    2697 void SmartPLDateDialog::cancelPressed(void)
    2698 {
    2699     done(-1);
    2700 }
    2701 
    27022683void SmartPLDateDialog::fixedCheckToggled(bool on)
    27032684{
    27042685    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;
     
    600601void EditMetadataDialog::closeDialog()
    601602{
    602603    cancelPopup();
    603     done(1); 
     604    accept();
    604605}
    605606
    606607void EditMetadataDialog::showSaveMenu()
     
    654655    cancelPopup();
    655656
    656657    *m_sourceMetadata = m_metadata;
    657     done(1);
     658    accept();
    658659}
    659660
    660661void EditMetadataDialog::saveToDatabase()
     
    663664
    664665    m_metadata->dumpToDatabase();
    665666    *m_sourceMetadata = m_metadata;
    666     done(1);
     667    accept();
    667668}
    668669
    669670void EditMetadataDialog::saveToFile()
     
    685686        decoder->commitMetadata(m_metadata);
    686687        delete decoder;
    687688    }
    688     done(1);
     689    accept();
    689690}
    690691
    691692void EditMetadataDialog::saveAll()
     
    727728    menu->addButton(albumArt->getTypeName(IT_CD));
    728729    menu->addButton(albumArt->getTypeName(IT_INLAY));
    729730
    730     int res = menu->ExecPopup();
     731    DialogCode ret = menu->ExecPopup();
     732    int res = MythDialog::CalcItemIndex(ret);
    731733
    732734    if ((IT_UNKNOWN <= res) && (res < IT_LAST))
    733735    {
  • 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/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();
     
    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(
     
    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/mytharchive/mytharchive/videoselector.cpp

     
    5555
    5656        if (action == "ESCAPE")
    5757        {
    58             done(0);
     58            reject();
    5959        }
    6060        else if (action == "DOWN")
    6161        {
     
    602602                password,
    603603                gContext->GetMainWindow());
    604604        pwd->exec();
    605         delete pwd;
     605        pwd->deleteLater();
    606606        if (ok)
    607607        {
    608608            //  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/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();
     319    DialogCode res = dialog->exec();
    326320    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", "");
  • mythplugins/mytharchive/mytharchive/exportnativewizard.cpp

     
    679679    FileSelector selector(FSTYPE_FILE, "/", "*.*", gContext->GetMainWindow(),
    680680                          "file_selector", "mytharchive-", "file selector");
    681681    qApp->unlock();
    682     bool res = selector.exec();
     682    bool res = (kDialogCodeRejected != selector.exec());
    683683
    684684    if (res)
    685685    {
  • mythplugins/mytharchive/mytharchive/recordingselector.cpp

     
    5656
    5757        if (action == "ESCAPE")
    5858        {
    59             done(0);
     59            done(kDialogCodeRejected);
    6060        }
    6161        else if (action == "DOWN")
    6262        {
  • 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

     
    14021402
    14031403    EditMetadataDialog editDialog(curItem, gContext->GetMainWindow(),
    14041404                                  "edit_metadata", "mythburn-", "edit metadata");
    1405     if (editDialog.exec())
     1405    if (kDialogCodeRejected != editDialog.exec())
    14061406    {
    14071407        // update widgets to reflect any changes
    14081408        titleChanged(item);
     
    14761476    FileSelector selector(FSTYPE_FILE, "/", "*.*", gContext->GetMainWindow(),
    14771477                          "file_selector", "mytharchive-", "file selector");
    14781478    qApp->unlock();
    1479     bool res = selector.exec();
     1479    bool res = (kDialogCodeRejected != selector.exec());
    14801480
    14811481    if (res)
    14821482    {
  • mythplugins/mythbrowser/mythbrowser/tabview.cpp

     
    327327    url->setText(((WebPage*)mytab->currentPage())->browser->baseURL().htmlURL());
    328328    popup->addWidget(url);
    329329
    330     popup->addButton(tr("OK"));
    331     popup->addButton(tr("Cancel"));
     330    popup->addButton(tr("OK"),     popup, SLOT(accept()));
     331    popup->addButton(tr("Cancel"), popup, SLOT(reject()));
    332332
    333333    qApp->removeEventFilter(this);
    334     int res = popup->ExecPopup();
     334    DialogCode res = popup->ExecPopup();
    335335    qApp->installEventFilter(this);
    336336
    337     if (res == 0)
     337    if (kDialogCodeAccepted == res)
    338338    {
    339339        QString sGroup = group->text();
    340340        QString sDesc = desc->text();
     
    396396    popup->addWidget(editor);
    397397    editor->setFocus();
    398398
    399     popup->addButton(tr("OK"));
    400     popup->addButton(tr("Cancel"));
     399    popup->addButton(tr("OK"),     popup, SLOT(accept()));
     400    popup->addButton(tr("Cancel"), popup, SLOT(reject()));
    401401
    402402    qApp->removeEventFilter(this);
    403     int res = popup->ExecPopup();
     403    DialogCode res = popup->ExecPopup();
    404404    qApp->installEventFilter(this);
    405405
    406     if (res == 0)
     406    if (kDialogCodeAccepted == res)
    407407    {
    408408        QString sURL = editor->text();
    409409        if (!sURL.startsWith("http://") && !sURL.startsWith("https://") &&
  • mythplugins/mythgallery/mythgallery/iconview.cpp

     
    13371337    importDlg->AddButton(tr("Yes"));
    13381338    int code = importDlg->exec();
    13391339    importDlg->deleteLater();
    1340     if (2 != code)
     1340    if (kDialogCodeButton1 != code)
    13411341        return;
    13421342
    13431343    // Makes import directory samba/windows friendly (no colon)
  • 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

     
    298298        return false;
    299299}
    300300
    301 void SourceManager::connectScreen(uint id, WeatherScreen *screen)
     301bool SourceManager::connectScreen(uint id, WeatherScreen *screen)
    302302{
     303    if (!screen)
     304    {
     305        VERBOSE(VB_IMPORTANT, LOC_ERR +
     306                "Can not connect nonexistent screen "<<screen);
     307
     308        return false;
     309    }
     310
    303311    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    }
    304319    ws->connectScreen(screen);
     320    return true;
    305321}
    306322
    307 void SourceManager::disconnectScreen(WeatherScreen *screen)
     323bool SourceManager::disconnectScreen(WeatherScreen *screen)
    308324{
     325    if (!screen)
     326    {
     327        VERBOSE(VB_IMPORTANT, LOC_ERR +
     328                "Can not disconnect nonexistent screen "<<screen);
     329
     330        return false;
     331    }
     332
    309333    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    }
    310341    ws->disconnectScreen(screen);
     342    return true;
    311343}
  • 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/videodlg.h

     
    2525                const QString &lwinName, const QString &lname,
    2626                VideoList *video_list);
    2727
    28     virtual ~VideoDialog();
    29 
    3028    virtual void playVideo(Metadata *someItem);
    3129
    3230    GenericTree *getVideoTreeRoot(void);
     
    4846    virtual void slotWatchVideo();
    4947
    5048  protected:
     49    virtual ~VideoDialog(); // use deleteLater() instead for thread safety
    5150    virtual void updateBackground(void);
    5251    virtual void parseContainer(QDomElement&) = 0;
    5352    virtual void loadWindow(QDomElement &element);
  • mythplugins/mythvideo/mythvideo/videomanager.h

     
    2828  public:
    2929    VideoManager(MythMainWindow *lparent, const QString &lname,
    3030                 VideoList *video_list);
    31     ~VideoManager();
    3231    int videoExitType() { return 0; }
    3332
    3433  public slots:
     
    5554    void exitWin();
    5655
    5756  protected:
     57    ~VideoManager(); // use deleteLater() instead for thread safety
    5858    void paintEvent(QPaintEvent *e);
    5959    void keyPressEvent(QKeyEvent *e);
    6060    void doWaitBackground(QPainter &p, const QString &titleText);
  • mythplugins/mythvideo/mythvideo/main.cpp

     
    7171    };
    7272
    7373    template <typename T>
     74    class q_screen_inst
     75    {
     76      public:
     77        q_screen_inst(T *inst, const QString &loc_name) : m_inst(inst),
     78            m_location_name(loc_name)
     79        {
     80        }
     81
     82        int run()
     83        {
     84            gContext->addCurrentLocation(m_location_name);
     85            qApp->unlock();
     86            m_inst->exec();
     87            qApp->lock();
     88            gContext->removeCurrentLocation();
     89            return m_inst->videoExitType();
     90        }
     91
     92        ~q_screen_inst()
     93        {
     94            m_inst->deleteLater();
     95            m_inst = NULL;
     96        }
     97
     98      private:
     99        T *m_inst;
     100        const QString &m_location_name;
     101    };
     102
     103    template <typename T>
    74104    int exec_screen(T *inst, const QString &loc_name)
    75105    {
    76106        screen_inst<T> si(inst, loc_name);
    77107        return si.run();
    78108    }
    79109
     110    template <typename T>
     111    int q_exec_screen(T *inst, const QString &loc_name)
     112    {
     113        q_screen_inst<T> si(inst, loc_name);
     114        return si.run();
     115    }
     116
    80117    class screens
    81118    {
    82119      private:
     
    87124                VideoScanner scanner;
    88125                scanner.doScan(GetVideoDirs());
    89126
    90                 return exec_screen(new VideoManager(gContext->GetMainWindow(),
    91                                                     "video manager",
    92                                                    video_list),
    93                                    "videomanager");
     127                return q_exec_screen(
     128                    new VideoManager(gContext->GetMainWindow(),
     129                                     "video manager", video_list),
     130                    "videomanager");
    94131            }
    95132            return 0;
    96133        }
     
    112149
    113150        static int runVideoGallery(VideoList *video_list)
    114151        {
    115             return exec_screen(new VideoGallery(gContext->GetMainWindow(),
    116                                                 "video gallery", video_list),
    117                                "videogallery");
     152            return q_exec_screen(new VideoGallery(gContext->GetMainWindow(),
     153                                                  "video gallery", video_list),
     154                                 "videogallery");
    118155        }
    119156
    120157      public:
  • 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;
     
    521521                                              MythPopupBox::Small,true);
    522522        plotLabel->setAlignment(Qt::AlignJustify | Qt::WordBreak);
    523523
    524         QButton * okButton = plotbox->addButton(tr("Ok"));
     524        QButton *okButton = plotbox->addButton(
     525            QObject::tr("OK"), plotbox, SLOT(accept()));
    525526        okButton->setFocus();
    526527
    527528        plotbox->ExecPopup();
  • mythplugins/mythvideo/mythvideo/videogallery.h

     
    3333    void handleVideoSelect();
    3434
    3535  protected:
     36    ~VideoGallery() {} // use deleteLater instead for thread safety
    3637    virtual void parseContainer(QDomElement &element);
    3738    virtual void fetchVideos();
    3839    void doMenu(bool info = false);
  • mythplugins/mythvideo/mythvideo/videodlg.cpp

     
    157157                                              MythPopupBox::Small,true);
    158158        plotLabel->setAlignment(Qt::AlignJustify | Qt::WordBreak);
    159159
    160         QButton * okButton = plotbox->addButton(tr("Ok"));
     160        QButton *okButton = plotbox->addButton(
     161            tr("OK"), plotbox, SLOT(accept()));
    161162        okButton->setFocus();
    162163
    163164        plotbox->ExecPopup();
  • 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;
    415415    new_extension_popup->deleteLater();
    416416    new_extension_popup = NULL;
     
    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

     
    112112    buttonText += QObject::tr("Yes");
    113113    buttonText += QObject::tr("Yes to all");
    114114
    115     int result = MythPopupBox::showButtonPopup(gContext->GetMainWindow(),
    116             QObject::tr("File Missing"),
    117             QString(QObject::tr("%1 appears to be missing.\nRemove it "
    118                                 "from the database?")).arg(filename),
    119             buttonText, 1);
     115    DialogCode result = MythPopupBox::ShowButtonPopup(
     116        gContext->GetMainWindow(),
     117        QObject::tr("File Missing"),
     118        QObject::tr("%1 appears to be missing.\n"
     119                    "Remove it from the database?").arg(filename),
     120        buttonText, kDialogCodeButton0);
     121
    120122    switch (result)
    121123    {
    122         case 1:
     124        case kDialogCodeRejected:
     125        case kDialogCodeButton0:
     126        default:
     127            break;
     128        case kDialogCodeButton1:
    123129            m_KeepAll = true;
    124130            break;
    125         case 2:
     131        case kDialogCodeButton2:
    126132            m_dbmetadata->purgeByID(id);
    127133            break;
    128         case 3:
     134        case kDialogCodeButton3:
    129135            m_RemoveAll = true;
    130136            m_dbmetadata->purgeByID(id);
    131137            break;
  • 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

     
    156156  public:
    157157    MythMultiPasswordDialog(const QString &message, const QStringList &pwlist,
    158158                            MythMainWindow *lparent, const char *lname = 0);
    159     ~MythMultiPasswordDialog();
    160159
    161160  private slots:
    162161    void checkPassword(const QString &password);
    163162
    164163  protected:
     164    ~MythMultiPasswordDialog(); // use deleteLater for thread safety
    165165    void keyPressEvent(QKeyEvent *e);
    166166
    167167  private:
     
    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();
    367     delete pwd;
     366    bool ok = (kDialogCodeRejected != pwd->exec());
     367    pwd->deleteLater();
    368368
    369369    if (ok)
    370370    {
  • 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;
     
    533539    buttonText += QObject::tr("No");
    534540    buttonText += QObject::tr("Yes");
    535541
    536     int result = MythPopupBox::showButtonPopup(gContext->GetMainWindow(),
    537                                QObject::tr("Are you sure?"),
    538                                QString(QObject::tr("This will clear all Game Meta Data\n"
    539                                                    "from the database. Are you sure you\n"
    540                                                    "want to do this?" )),
    541                                                     buttonText, 0 );
     542    DialogCode result = MythPopupBox::ShowButtonPopup(
     543        gContext->GetMainWindow(),
     544        QObject::tr("Are you sure?"),
     545        QString(QObject::tr("This will clear all Game Meta Data\n"
     546                            "from the database. Are you sure you\n"
     547                            "want to do this?" )),
     548        buttonText, kDialogCodeButton0);
     549
    542550    switch (result)
    543551    {
    544         case 0:
     552        case kDialogCodeRejected:
     553        case kDialogCodeButton0:
     554        default:
    545555            // Do Nothing
    546556            break;
    547         case 1:
     557        case kDialogCodeButton1:
    548558            MSqlQuery query(MSqlQuery::InitCon());
    549559            QString thequery = "DELETE FROM gamemetadata;";
    550560            query.exec(thequery);
  • 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            }
  • 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"));
  • 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            {
     
    649649                busy->deleteLater();
    650650            }
    651651            break;
     652        case kDialogCodeRejected:
     653        default:
     654            break;
    652655    }
    653656
    654657    popup->deleteLater();
  • 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);
     
    10701070
    10711071    popup->deleteLater();
    10721072
    1073     return (res == 0);
     1073    return (kDialogCodeAccepted == res);
    10741074}
    10751075
    10761076void MythNews::showMenu()
  • 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();
     603    DialogCode code = storediag->exec();
     604    int ret = MythDialog::CalcItemIndex(code);
    604605    storediag->deleteLater();
    605606    storediag = NULL;
    606607
  • 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

     
    31493149         !gContext->GetNumSetting("PVR350InternalAudioOnly")))
    31503150    {
    31513151        QString errMsg = ReinitAudio();
    3152         int ret = 1;
     3152        DialogCode ret = kDialogCodeButton0;
    31533153        if ((errMsg != QString::null) && !using_null_videoout &&
    31543154            gContext->GetNumSetting("AudioNag", 1))
    31553155        {
     
    31733173            qApp->unlock();
    31743174        }
    31753175           
    3176         if (ret == 2)
     3176        if (kDialogCodeButton1 == ret)
    31773177            gContext->SaveSetting("AudioNag", 0);
    3178         if (ret == 3)
     3178        if (kDialogCodeButton2 == ret)
    31793179            gContext->SetSetting("AudioNag", 0);
    3180         else if (ret == 4)
     3180        else if ((kDialogCodeButton3 == ret) || (kDialogCodeRejected == ret))
    31813181            return;
    31823182    }
    31833183
  • mythtv/libs/libmythtv/previouslist.cpp

     
    336336
    337337    int view = chooseListBox->currentItem();
    338338
    339     choosePopup->done(0);
     339    choosePopup->AcceptItem(view);
    340340
    341341    if (view == curView)
    342342        return;
     
    712712                             "delete any recordings.");
    713713   
    714714    DialogBox *dlg = new DialogBox(gContext->GetMainWindow(), message);
    715     int button = 1, ok = -1, cleardup = -1, setdup = -1, rm_episode = -1,
     715    int button = 0, ok = -1, cleardup = -1, setdup = -1, rm_episode = -1,
    716716        rm_title = -1;
    717717    // int rm_generics = -1;
    718718
     
    739739    //                   "for duplicate matching"));
    740740    // rm_generics = button++;
    741741
    742     int ret = dlg->exec();
     742    DialogCode code = dlg->exec();
     743    int ret = MythDialog::CalcItemIndex(code);
    743744    dlg->deleteLater();
    744745    dlg = NULL;
    745746
  • 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/proglist.cpp

     
    397397    refillAll = true;
    398398}
    399399
    400 void ProgLister::setViewFromList(void)
     400void ProgLister::setViewFromList(int item)
    401401{
     402    int view = item;
     403
    402404    if (!choosePopup || (!chooseListBox && !chooseEditButton))
    403405        return;
    404406
    405     int view = chooseListBox->currentItem();
    406 
    407407    if (type == plTitleSearch || type == plKeywordSearch ||
    408408        type == plPeopleSearch)
    409409    {
     
    426426        }
    427427    }
    428428
    429     choosePopup->done(0);
     429    choosePopup->AcceptItem(item);
    430430
    431431    if (view == curView)
    432432        return;
     
    517517
    518518    updateKeywordInDB(text);
    519519 
    520     choosePopup->done(0);
     520    choosePopup->accept();
    521521
    522522    fillViewList(text);
    523523
     
    549549
    550550    updateKeywordInDB(text);
    551551
    552     powerPopup->done(0);
     552    powerPopup->accept();
    553553
    554554    fillViewList(text);
    555555
     
    676676    viewList[curView] = searchTime.toString(fullDateFormat);
    677677    viewTextList[curView] = viewList[curView];
    678678
    679     choosePopup->done(0);
     679    choosePopup->accept();
    680680
    681681    curItem = -1;
    682682    refillAll = true;
     
    716716            chooseListBox->setCurrentItem(curView);
    717717        choosePopup->addWidget(chooseListBox);
    718718
    719         connect(chooseListBox, SIGNAL(accepted(int)), this, SLOT(setViewFromList()));
     719        connect(chooseListBox, SIGNAL(accepted(int)),
     720                this,          SLOT(setViewFromList(int)));
    720721
    721722        chooseListBox->setFocus();
    722723        choosePopup->ExecPopup();
     
    771772        chooseRecordButton->setEnabled(chooseLineEdit->text()
    772773                                       .stripWhiteSpace().length() > 0);
    773774
    774         connect(chooseListBox, SIGNAL(accepted(int)), this, SLOT(setViewFromList()));
     775        connect(chooseListBox, SIGNAL(accepted(int)),
     776                this,          SLOT(setViewFromList(int)));
    775777        connect(chooseListBox, SIGNAL(menuButtonPressed(int)), chooseLineEdit, SLOT(setFocus()));
    776778        connect(chooseListBox, SIGNAL(selectionChanged()), this, SLOT(chooseListBoxChanged()));
    777779        connect(chooseLineEdit, SIGNAL(textChanged()), this, SLOT(chooseEditChanged()));
     
    837839        chooseDeleteButton->setEnabled(curView >= 0);
    838840        chooseRecordButton->setEnabled(curView >= 0);
    839841
    840         connect(chooseListBox, SIGNAL(accepted(int)), this,
    841                                SLOT(setViewFromList()));
     842        connect(chooseListBox, SIGNAL(accepted(int)),
     843                this,          SLOT(setViewFromList(int)));
    842844        connect(chooseListBox, SIGNAL(menuButtonPressed(int)),chooseEditButton,
    843845                               SLOT(setFocus()));
    844846        connect(chooseListBox, SIGNAL(selectionChanged()), this,
     
    10341036    powerDescEdit->setText(field[2]);
    10351037
    10361038    powerTitleEdit->setFocus();
    1037     choosePopup->done(0);
     1039    choosePopup->accept();
    10381040    powerPopup->ExecPopup();
    10391041
    10401042    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/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/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/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

     
    20112011    addChild(listbox);
    20122012}
    20132013
    2014 int CaptureCardEditor::exec(void)
     2014DialogCode CaptureCardEditor::exec(void)
    20152015{
    2016     while (ConfigurationDialog::exec() == QDialog::Accepted)
     2016    while (ConfigurationDialog::exec() == kDialogCodeAccepted)
    20172017        edit();
    20182018
    2019     return QDialog::Rejected;
     2019    return kDialogCodeRejected;
    20202020}
    20212021
    20222022void CaptureCardEditor::load(void)
     
    20482048    }
    20492049    else
    20502050    {
    2051         int val = MythPopupBox::show2ButtonPopup(
     2051        DialogCode val = MythPopupBox::Show2ButtonPopup(
    20522052            gContext->GetMainWindow(),
    20532053            "",
    20542054            tr("Capture Card Menu"),
    20552055            tr("Edit.."),
    20562056            tr("Delete.."),
    2057             1);
     2057            kDialogCodeButton0);
    20582058
    2059         if (val == 0)
     2059        if (kDialogCodeButton0 == val)
    20602060            edit();
    2061         else if (val == 1)
     2061        else if (kDialogCodeButton1 == val)
    20622062            del();
    20632063    }
    20642064}
     
    20682068    const int cardid = listbox->getValue().toInt();
    20692069    if (-1 == cardid)
    20702070    {
    2071         int val = MythPopupBox::show2ButtonPopup(
     2071        DialogCode val = MythPopupBox::Show2ButtonPopup(
    20722072            gContext->GetMainWindow(), "",
    20732073            tr("Are you sure you want to delete "
    20742074               "ALL capture cards on %1?").arg(gContext->GetHostName()),
    20752075            tr("Yes, delete capture cards"),
    2076             tr("No, don't"), 2);
     2076            tr("No, don't"), kDialogCodeButton1);
    20772077
    2078         if (0 == val)
     2078        if (kDialogCodeButton0 == val)
    20792079        {
    20802080            MSqlQuery cards(MSqlQuery::InitCon());
    20812081
     
    21042104    }
    21052105    else if (-2 == cardid)
    21062106    {
    2107         int val = MythPopupBox::show2ButtonPopup(
     2107        DialogCode val = MythPopupBox::Show2ButtonPopup(
    21082108            gContext->GetMainWindow(), "",
    21092109            tr("Are you sure you want to delete "
    21102110               "ALL capture cards?"),
    21112111            tr("Yes, delete capture cards"),
    2112             tr("No, don't"), 2);
     2112            tr("No, don't"), kDialogCodeButton1);
    21132113
    2114         if (0 == val)
     2114        if (kDialogCodeButton0 == val)
    21152115        {
    21162116            MSqlQuery query(MSqlQuery::InitCon());
    21172117            query.exec("TRUNCATE TABLE capturecard;");
     
    21302130
    21312131void CaptureCardEditor::del(void)
    21322132{
    2133     int val = MythPopupBox::show2ButtonPopup(
     2133    DialogCode val = MythPopupBox::Show2ButtonPopup(
    21342134        gContext->GetMainWindow(), "",
    21352135        tr("Are you sure you want to delete this capture card?"),
    21362136        tr("Yes, delete capture card"),
    2137         tr("No, don't"), 2);
     2137        tr("No, don't"), kDialogCodeButton1);
    21382138
    2139     if (val == 0)
     2139    if (kDialogCodeButton0 == val)
    21402140    {
    21412141        CardUtil::DeleteCard(listbox->getValue().toUInt());
    21422142        load();
     
    21592159    return dialog;
    21602160}
    21612161
    2162 int VideoSourceEditor::exec() {
    2163     while (ConfigurationDialog::exec() == QDialog::Accepted)
     2162DialogCode VideoSourceEditor::exec(void)
     2163{
     2164    while (ConfigurationDialog::exec() == kDialogCodeAccepted)
    21642165        edit();
    21652166
    2166     return QDialog::Rejected;
     2167    return kDialogCodeRejected;
    21672168}
    21682169
    21692170void VideoSourceEditor::load(void)
     
    21832184    }
    21842185    else
    21852186    {
    2186         int val = MythPopupBox::show2ButtonPopup(
     2187        DialogCode val = MythPopupBox::Show2ButtonPopup(
    21872188            gContext->GetMainWindow(),
    21882189            "",
    21892190            tr("Video Source Menu"),
    21902191            tr("Edit.."),
    21912192            tr("Delete.."),
    2192             1);
     2193            kDialogCodeButton0);
    21932194
    2194         if (val == 0)
     2195        if (kDialogCodeButton0 == val)
    21952196            edit();
    2196         else if (val == 1)
     2197        else if (kDialogCodeButton1 == val)
    21972198            del();
    21982199    }
    21992200}
     
    22032204    const int sourceid = listbox->getValue().toInt();
    22042205    if (-1 == sourceid)
    22052206    {
    2206         int val = MythPopupBox::show2ButtonPopup(
     2207        DialogCode val = MythPopupBox::Show2ButtonPopup(
    22072208            gContext->GetMainWindow(), "",
    22082209            tr("Are you sure you want to delete "
    22092210               "ALL video sources?"),
    22102211            tr("Yes, delete video sources"),
    2211             tr("No, don't"), 2);
     2212            tr("No, don't"), kDialogCodeButton1);
    22122213
    2213         if (0 == val)
     2214        if (kDialogCodeButton0 == val)
    22142215        {
    22152216            MSqlQuery query(MSqlQuery::InitCon());
    22162217            query.exec("TRUNCATE TABLE channel;");
     
    22352236
    22362237void VideoSourceEditor::del()
    22372238{
    2238     int val = MythPopupBox::show2ButtonPopup(
     2239    DialogCode val = MythPopupBox::Show2ButtonPopup(
    22392240        gContext->GetMainWindow(), "",
    22402241        tr("Are you sure you want to delete "
    22412242           "this video source?"),
    22422243        tr("Yes, delete video source"),
    22432244        tr("No, don't"),
    2244         2);
     2245        kDialogCodeButton1);
    22452246
    2246     if (val == 0)
     2247    if (kDialogCodeButton0 == val)
    22472248    {
    22482249        MSqlQuery query(MSqlQuery::InitCon());
    22492250
     
    22872288    addChild(listbox);
    22882289}
    22892290
    2290 int CardInputEditor::exec(void)
     2291DialogCode CardInputEditor::exec(void)
    22912292{
    2292     while (ConfigurationDialog::exec() == QDialog::Accepted)
     2293    while (ConfigurationDialog::exec() == kDialogCodeAccepted)
    22932294        cardinputs[listbox->getValue().toInt()]->exec();
    22942295
    2295     return QDialog::Rejected;
     2296    return kDialogCodeRejected;
    22962297}
    22972298
    22982299void 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

     
    41684168    message += RecStatusDesc();
    41694169
    41704170    DialogBox *dlg = new DialogBox(gContext->GetMainWindow(), message);
    4171     int button = 1, ok = -1, react = -1, stop = -1, addov = -1, forget = -1,
     4171    int button = 0, ok = -1, react = -1, stop = -1, addov = -1, forget = -1,
    41724172        clearov = -1, edend = -1, ednorm = -1, edcust = -1;
    41734173
    41744174    dlg->AddButton(QObject::tr("OK"));
     
    42484248        }
    42494249    }
    42504250
    4251     int ret = dlg->exec();
     4251    DialogCode code = dlg->exec();
     4252    int ret = MythDialog::CalcItemIndex(code);
    42524253    dlg->deleteLater();
    42534254    dlg = NULL;
    42544255
     
    43384339    }
    43394340
    43404341    DialogBox *dlg = new DialogBox(gContext->GetMainWindow(), message);
    4341     int button = 1, ok = -1, react = -1, addov = -1, clearov = -1,
     4342    int button = 0, ok = -1, react = -1, addov = -1, clearov = -1,
    43424343        ednorm = -1, edcust = -1, forget = -1, addov1 = -1, forget1 = -1;
    43434344
    43444345    dlg->AddButton(QObject::tr("OK"));
     
    44244425        }
    44254426    }
    44264427
    4427     int ret = dlg->exec();
     4428    DialogCode code = dlg->exec();
     4429    int ret = MythDialog::CalcItemIndex(code);
    44284430    dlg->deleteLater();
    44294431    dlg = NULL;
    44304432
  • 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

     
    24112411        MythPasswordDialog *pwd = new MythPasswordDialog(text, &ok, password,
    24122412                                                     gContext->GetMainWindow());
    24132413        pwd->exec();
    2414         delete pwd;
     2414        pwd->deleteLater();
    24152415
    24162416        if (ok)
    24172417        {
  • 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";
     
    115117    show();
    116118}
    117119
     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
    118132void MythDialog::done(int r)
    119133{
    120134    hide();
    121     setResult(r);
     135    setResult((DialogCode) r);
    122136    close();
    123137}
    124138
    125139void MythDialog::AcceptItem(int i)
    126140{
    127     done(ListStart + i);
     141    if (i < 0)
     142    {
     143        VERBOSE(VB_IMPORTANT, "Programmer Error: MythDialog::AcceptItem("
     144                <<i<<") called with negative index");
     145        reject();
     146        return;
     147    }
     148
     149    done((DialogCode)((int)kDialogCodeListStart + (int)i));
    128150}
    129151
     152int MythDialog::CalcItemIndex(DialogCode code)
     153{
     154    return (int)code - (int)kDialogCodeListStart;
     155}
     156
    130157void MythDialog::accept()
    131158{
    132159    done(Accepted);
     
    137164    done(Rejected);
    138165}
    139166
    140 int MythDialog::exec()
     167DialogCode MythDialog::exec(void)
    141168{
    142169    if (in_loop)
    143170    {
    144171        qWarning("MythDialog::exec: Recursive call detected.");
    145         return -1;
     172        return kDialogCodeRejected;
    146173    }
    147174
    148     setResult(Rejected);
     175    setResult(kDialogCodeRejected);
    149176
    150177    Show();
    151178
    152179    in_loop = TRUE;
    153180    qApp->enter_loop();
    154181
    155     int res = result();
     182    DialogCode res = result();
    156183
    157184    return res;
    158185}
     
    213240    }
    214241}
    215242
     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
    216257MythPopupBox::MythPopupBox(MythMainWindow *parent, const char *name)
    217258            : MythDialog(parent, name, false)
    218259{
     
    465506        MythDialog::keyPressEvent(e);
    466507}
    467508
     509void MythPopupBox::AcceptItem(int i)
     510{
     511    MythDialog::AcceptItem(i);
     512    emit popupDone(rescode);
     513}
     514
    468515void MythPopupBox::accept(void)
    469516{
    470517    MythDialog::done(MythDialog::Accepted);
     
    477524    emit popupDone(MythDialog::Rejected);
    478525}
    479526
    480 int MythPopupBox::ExecPopup(QObject *target, const char *slot)
     527DialogCode MythPopupBox::ExecPopup(QObject *target, const char *slot)
    481528{
    482529    if (!target)
    483         ShowPopup(this, SLOT(defaultExitHandler(int)));
     530        ShowPopup(this, SLOT(done(int)));
    484531    else
    485532        ShowPopup(target, slot);
    486533
    487534    return exec();
    488535}
    489536
    490 int MythPopupBox::ExecPopupAtXY(int destx, int desty,
    491                             QObject *target, const char *slot)
     537DialogCode MythPopupBox::ExecPopupAtXY(int destx, int desty,
     538                                       QObject *target, const char *slot)
    492539{
    493540    if (!target)
    494         ShowPopupAtXY(destx, desty, this, SLOT(defaultExitHandler(int)));
     541        ShowPopupAtXY(destx, desty, this, SLOT(done(int)));
    495542    else
    496543        ShowPopupAtXY(destx, desty, target, slot);
    497544
     
    526573    }
    527574    if (foundbutton)
    528575    {
    529         done(i);
     576        AcceptItem(i);
    530577        return;
    531578    }
    532579
     
    553600    }
    554601    if (foundbutton)
    555602    {
    556         done(i);
     603        AcceptItem(i);
    557604        return;
    558605    }
    559606
    560607    VERBOSE(VB_IMPORTANT, "MythPopupBox::defaultButtonPressedHandler(void)"
    561608            "\n\t\t\tWe should never get here!");
    562     done(Rejected);
     609    done(kDialogCodeRejected);
    563610}
    564611
    565 void MythPopupBox::defaultExitHandler(int r)
    566 {
    567     done(r);
    568 }
    569 
    570 static int show_ok_popup(
     612bool MythPopupBox::showOkPopup(
    571613    MythMainWindow *parent,
    572614    const QString  &title,
    573615    const QString  &message,
    574     QString         button_msg = QString::null)
     616    QString         button_msg)
    575617{
    576618    if (button_msg.isEmpty())
    577619        button_msg = QObject::tr("OK");
     
    581623    popup->addLabel(message, MythPopupBox::Medium, true);
    582624    QButton *okButton = popup->addButton(button_msg, popup, SLOT(accept()));
    583625    okButton->setFocus();
    584     int ret = popup->ExecPopup();
     626    bool ret = (kDialogCodeAccepted == popup->ExecPopup());
    585627
    586628    popup->hide();
    587629    popup->deleteLater();
     
    589631    return ret;
    590632}
    591633
    592 void MythPopupBox::showOkPopup(MythMainWindow *parent, QString title,
    593                                QString message)
    594 {
    595     show_ok_popup(parent, title, message);
    596 }
    597 
    598 void MythPopupBox::showExitPopup(MythMainWindow *parent, QString title,
    599                                  QString message)
    600 {
    601     show_ok_popup(parent, title, message, tr("Exit"));
    602 }
    603 
    604634bool MythPopupBox::showOkCancelPopup(MythMainWindow *parent, QString title,
    605635                                     QString message, bool focusOk)
    606636{
     
    691721}
    692722
    693723
    694 int MythPopupBox::show2ButtonPopup(MythMainWindow *parent, QString title,
    695                                    QString message, QString button1msg,
    696                                    QString button2msg, int defvalue)
     724DialogCode MythPopupBox::ShowButtonPopup(
     725    MythMainWindow    *parent,
     726    const QString     &title,
     727    const QString     &message,
     728    const QStringList &buttonmsgs,
     729    DialogCode         default_button)
    697730{
    698731    MythPopupBox *popup = new MythPopupBox(parent, title);
    699732
    700733    popup->addLabel(message, Medium, true);
    701734    popup->addLabel("");
    702735
    703     QButton *but1 = popup->addButton(button1msg);
    704     QButton *but2 = popup->addButton(button2msg);
    705 
    706     if (defvalue == 1)
    707         but1->setFocus();
    708     else
    709         but2->setFocus();
    710 
    711     int ret = popup->ExecPopup();
    712 
    713     popup->hide();
    714     popup->deleteLater();
    715 
    716     return ret;
    717 }
    718 
    719 int MythPopupBox::showButtonPopup(MythMainWindow *parent, QString title,
    720                                   QString message, QStringList buttonmsgs,
    721                                   int defvalue)
    722 {
    723     MythPopupBox *popup = new MythPopupBox(parent, title);
    724 
    725     popup->addLabel(message, Medium, true);
    726     popup->addLabel("");
    727 
     736    const uint def = CalcItemIndex(default_button);
    728737    for (unsigned int i = 0; i < buttonmsgs.size(); i++ )
    729738    {
    730739        QButton *but = popup->addButton(buttonmsgs[i]);
    731         if (defvalue == (int)i)
     740        if (def == i)
    732741            but->setFocus();
    733742    }
    734743
    735     int ret = popup->ExecPopup();
     744    DialogCode ret = popup->ExecPopup();
    736745
    737746    popup->hide();
    738747    popup->deleteLater();
     
    948957            .arg(window_name).arg(theme_filename);
    949958        MythPopupBox::showOkPopup(gContext->GetMainWindow(),
    950959                                  tr("Missing UI Element"), msg);
    951         done(-1);
     960        reject();
    952961        return;
    953962    }
    954963}
     
    10541063
    10551064MythThemedDialog::~MythThemedDialog()
    10561065{
     1066    VERBOSE(VB_IMPORTANT, "MythThemedDialog dtor "<<this);
    10571067    if (theme)
     1068    {
    10581069        delete theme;
     1070        theme = NULL;
     1071    }
    10591072}
    10601073
     1074void MythThemedDialog::deleteLater(void)
     1075{
     1076    VERBOSE(VB_IMPORTANT, "MythThemedDialog::deleteLater(void) "<<this);
     1077    if (theme)
     1078    {
     1079        delete theme;
     1080        theme = NULL;
     1081    }
     1082    MythDialog::deleteLater();
     1083}
     1084
    10611085void MythThemedDialog::loadWindow(QDomElement &element)
    10621086{
    10631087    //
     
    19621986    if (the_text == target_text)
    19631987    {
    19641988        *success_flag = true;
    1965         done(0);
     1989        accept();
    19661990    }
    19671991    else
    19681992    {
     
    19932017    listbox = new MythListBox(this);
    19942018    listbox->setScrollBar(false);
    19952019    listbox->setBottomScrollBar(false);
    1996     connect(listbox, SIGNAL(accepted(int)), this, SLOT(itemSelected(int)));
     2020    connect(listbox, SIGNAL(accepted(int)), this, SLOT(AcceptItem(int)));
    19972021    addWidget(listbox);
    1998    
    1999     ok_button = addButton(tr("OK"), this, SLOT(okPressed()));
    2000     cancel_button = addButton(tr("Cancel"), this, SLOT(cancelPressed()));
     2022
     2023    ok_button     = addButton(tr("OK"),     this, SLOT(accept()));
     2024    cancel_button = addButton(tr("Cancel"), this, SLOT(reject()));
    20012025}
    20022026
    20032027void MythSearchDialog::keyPressEvent(QKeyEvent *e)
     
    20122036            if (action == "ESCAPE")
    20132037            {
    20142038                handled = true;
    2015                 done(-1);       
     2039                reject();
    20162040            }
    20172041            if (action == "LEFT")
    20182042            {
     
    20272051            if (action == "SELECT")
    20282052            {
    20292053                handled = true;
    2030                 done(0);
     2054                accept();
    20312055            }
    20322056        }
    20332057    }
     
    20352059        MythPopupBox::keyPressEvent(e);
    20362060}
    20372061
    2038 void MythSearchDialog::itemSelected(int index)
    2039 {
    2040     (void)index;
    2041     done(0);
    2042 }
    2043 
    20442062void MythSearchDialog::setCaption(QString text)
    20452063{
    20462064    caption->setText(text);
     
    20692087   searchTextChanged();
    20702088}
    20712089
    2072 void MythSearchDialog::okPressed(void)
     2090MythSearchDialog::~MythSearchDialog()
    20732091{
    2074     done(0); 
     2092    Teardown();
    20752093}
    20762094
    2077 void MythSearchDialog::cancelPressed(void)
     2095void MythSearchDialog::deleteLater(void)
    20782096{
    2079     done(-1);
     2097    Teardown();
    20802098}
    20812099
    2082 MythSearchDialog::~MythSearchDialog()
     2100void MythSearchDialog::Teardown(void)
    20832101{
    2084     if (listbox)
    2085     {
    2086         delete listbox;
    2087         listbox = NULL;
    2088     }   
    2089    
    2090     if (editor)
    2091     {
    2092         delete editor;
    2093         editor = NULL;
    2094     }   
     2102    listbox = NULL; // deleted by Qt
     2103    editor  = NULL; // deleted by Qt
    20952104}
    20962105
    20972106/*
     
    21412150                       "element. \n\nReturning to the previous menu."));
    21422151        MythPopupBox::showOkPopup(gContext->GetMainWindow(),
    21432152                                  tr("Missing UI Element"), msg);
    2144         done(-1);
     2153        reject();
    21452154        return;
    21462155    }
    21472156
     
    21762185                       "\n\nReturning to the previous menu."));
    21772186        MythPopupBox::showOkPopup(gContext->GetMainWindow(),
    21782187                                  tr("Missing UI Element"), msg);
    2179         done(-1);
     2188        reject();
    21802189        return;
    21812190    }   
    21822191   
     
    23832392    if (type > -1)
    23842393    {
    23852394        *selected_file = image_files[type];
    2386         done(0);
     2395        accept();
    23872396    }   
    23882397}
    23892398
     
    24092418        VERBOSE(VB_IMPORTANT,
    24102419                "MythScrollDialog: Programmer error, trying to create "
    24112420                "a dialog without a parent.");
    2412         done(-1);
     2421        done(kDialogCodeRejected);
    24132422        return;
    24142423    }
    24152424
    24162425    m_parent     = parent;
    24172426    m_scrollMode = mode;
    24182427       
    2419     m_resCode    = 0;
     2428    m_resCode    = kDialogCodeRejected;
    24202429    m_inLoop     = false;
    24212430   
    24222431    gContext->GetScreenSettings(m_xbase, m_screenWidth, m_wmult,
     
    25112520                   m_screenHeight*areaHTimes);
    25122521}
    25132522
    2514 int MythScrollDialog::result() const
     2523DialogCode MythScrollDialog::result(void) const
    25152524{
    25162525    return m_resCode;   
    25172526}
     
    25352544    }
    25362545}
    25372546
    2538 int MythScrollDialog::exec()
     2547DialogCode MythScrollDialog::exec(void)
    25392548{
    25402549    if (m_inLoop)
    25412550    {
    25422551        std::cerr << "MythScrollDialog::exec: Recursive call detected."
    25432552                  << std::endl;
    2544         return -1;
     2553        return kDialogCodeRejected;
    25452554    }
    25462555
    2547     setResult(Rejected);
     2556    setResult(kDialogCodeRejected);
    25482557
    25492558    show();
    25502559
    25512560    m_inLoop = true;
    25522561    qApp->enter_loop();
    25532562
    2554     int res = result();
     2563    DialogCode res = result();
    25552564
    25562565    return res;
    25572566}
     
    25592568void MythScrollDialog::done(int r)
    25602569{
    25612570    hide();
    2562     setResult(r);
     2571    setResult((DialogCode)r);
    25632572    close();
    25642573}
    25652574
    25662575void MythScrollDialog::accept()
    25672576{
    2568     done(Accepted);
     2577    done(kDialogCodeAccepted);
    25692578}
    25702579
    25712580void MythScrollDialog::reject()
    25722581{
    2573     done(Rejected);
     2582    done(kDialogCodeRejected);
    25742583}
    25752584
    2576 void MythScrollDialog::setResult(int r)
     2585void MythScrollDialog::setResult(DialogCode r)
    25772586{
    25782587    m_resCode = r;   
    25792588}
  • 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                else
    400460                    handled = false;
    401461            }
    402             else if (action == "SELECT" && e->text().isNull() )
     462            else if (action == "SELECT" && e->text().isEmpty() )
    403463                e->ignore();
    404464            else
    405465                handled = false;
     
    412472            QLineEdit::keyPressEvent(e);
    413473}
    414474
    415 void MythLineEdit::setText(const QString& text)
     475void MythLineEdit::setText(const QString &text)
    416476{
    417477    // Don't mess with the cursor position; it causes
    418478    // counter-intuitive behaviour due to interactions with the
    419479    // communication with the settings stuff
    420480
    421481    int pos = cursorPosition();
    422     QLineEdit::setText(text);
     482    QLineEdit::setText(QDeepCopy<QString>(text));
    423483    setCursorPosition(pos);
    424484}
    425485
     486QString MythLineEdit::text(void)
     487{
     488    return QDeepCopy<QString>(QLineEdit::text());
     489}
     490
    426491void MythLineEdit::focusInEvent(QFocusEvent *e)
    427492{
    428493    emit changeHelpText(helptext);
     
    534599    connect(cycle_timer, SIGNAL(timeout()), this, SLOT(endCycle()));
    535600   
    536601    popup = NULL;
     602    useVirtualKeyboard = gContext->GetNumSetting("UseVirtualKeyboard", 1);
    537603    popupPosition = VK_POSBELOWEDIT;
    538604}
    539605
     
    731797    //  of MythLineEdit, and I'm sure he had
    732798    //  a reason ...
    733799    getCursorPosition(&para, &pos);
    734     QTextEdit::setText(text);
     800    QTextEdit::setText(QDeepCopy<QString>(text));
    735801    setCursorPosition(para, pos);
    736802}
    737803
     804QString MythRemoteLineEdit::text(void)
     805{
     806    return QDeepCopy<QString>(QTextEdit::text());
     807}
     808
    738809void MythRemoteLineEdit::keyPressEvent(QKeyEvent *e)
    739810{
    740811    bool handled = false;
     
    766837            }
    767838            else if ((action == "SELECT") &&
    768839                     (!active_cycle) &&
    769                      ((e->text().isNull()) ||
     840                     ((e->text().isEmpty()) ||
    770841                      (e->key() == Qt::Key_Enter) ||
    771842                      (e->key() == Qt::Key_Return)))
    772843            {
    773                 if (gContext->GetNumSetting("UseVirtualKeyboard", 1) == 1)
    774                 {
    775                     popup = new VirtualKeyboard(gContext->GetMainWindow(), this);
    776                     gContext->GetMainWindow()->detach(popup);
    777                     popup->exec();
    778                     delete popup;
    779                     popup = NULL;
    780                 }
    781  
     844                if (useVirtualKeyboard)
     845                    popupVirtualKeyboard();
    782846            }
    783847            else
    784848                handled = false;
     
    9761040    QTextEdit::focusOutEvent(e);
    9771041}
    9781042
    979 
    9801043MythRemoteLineEdit::~MythRemoteLineEdit()
    9811044{
     1045    Teardown();
     1046}
     1047
     1048void MythRemoteLineEdit::deleteLater(void)
     1049{
     1050    Teardown();
     1051    QTextEdit::deleteLater();
     1052}
     1053
     1054void MythRemoteLineEdit::Teardown(void)
     1055{
    9821056    if (cycle_timer)
    9831057    {
    984         delete cycle_timer;
     1058        cycle_timer->disconnect();
     1059        cycle_timer->deleteLater();
     1060        cycle_timer = NULL;
    9851061    }
    9861062
    987     if (popup)
    988         delete popup;
     1063    qt_delete(popup);
    9891064}
    9901065
     1066void MythRemoteLineEdit::popupVirtualKeyboard(void)
     1067{
     1068    qt_delete(popup);
     1069
     1070    popup = new VirtualKeyboard(gContext->GetMainWindow(), this);
     1071    gContext->GetMainWindow()->detach(popup);
     1072    popup->exec();
     1073
     1074    qt_delete(popup);
     1075}
     1076
    9911077void MythRemoteLineEdit::insert(QString text)
    9921078{
    9931079    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

     
    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
  • 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.20071115-1"
     212#define MYTH_BINARY_VERSION "0.21.20071115-2"
    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    static QString showPasswordPopup(MythMainWindow *parent,
    156196                                     QString title, QString message);
    157197
     198  public slots:
     199    virtual void AcceptItem(int);
    158200    virtual void accept(void);
    159201    virtual void reject(void);
    160202
     
    168210
    169211  protected slots:
    170212    void defaultButtonPressedHandler(void);
    171     void defaultExitHandler(int);
    172213
    173214  private:
    174215    QVBoxLayout *vbox;
     
    290331    MythThemedDialog(MythMainWindow *parent, const char *name = 0,
    291332                     bool setsize = true);
    292333
    293    ~MythThemedDialog();
    294 
    295334    virtual bool loadThemedWindow(QString window_name, QString theme_filename);
    296335    virtual void loadWindow(QDomElement &);
    297336    virtual void parseContainer(QDomElement &);
     
    329368    int  getContext(){return context;}
    330369
    331370  public slots:
    332 
     371    virtual void deleteLater(void);
    333372    virtual void updateBackground();
    334373    virtual void initForeground();
    335374    virtual void updateForeground();
     
    342381    virtual void activateCurrent();
    343382
    344383  protected:
     384    ~MythThemedDialog(); // use deleteLater() instead for thread safety
    345385
    346386    void paintEvent(QPaintEvent* e);
    347387    UIType *widget_with_current_focus;
     
    383423                        MythMainWindow *parent,
    384424                        const char *name = 0,
    385425                        bool setsize = true);
    386     ~MythPasswordDialog();
    387 
    388426  public slots:
    389427 
    390428    void checkPassword(const QString &);
    391429
    392  protected:
    393  
     430  protected:
     431    ~MythPasswordDialog(); // use deleteLater() instead for thread safety
    394432    void keyPressEvent(QKeyEvent *e);
    395433
    396434  private:
     
    407445  public:
    408446
    409447    MythSearchDialog(MythMainWindow *parent, const char *name = 0);
    410     ~MythSearchDialog();
    411448
    412449  public:
    413450    void setCaption(QString text);
    414451    void setSearchText(QString text);
    415452    void setItems(QStringList items);
    416453    QString getResult(void);
    417    
    418  protected slots:
    419     void okPressed(void);
    420     void cancelPressed(void);   
     454
     455  public slots:
     456    virtual void deleteLater(void);
     457
     458  protected slots:
    421459    void searchTextChanged(void);
    422     void itemSelected(int index);
    423460     
    424  protected:
     461  protected:
     462    void Teardown(void);
     463    ~MythSearchDialog(); // use deleteLater() instead for thread safety
    425464    void keyPressEvent(QKeyEvent *e);
    426465
    427466  private:
     
    453492                        QString theme_filename = "",
    454493                        const char *name = 0,
    455494                        bool setsize=true);
    456     ~MythImageFileDialog();
    457 
    458495  public slots:
    459496 
    460497    void handleTreeListSelection(int, IntVector*);
     
    463500    void buildFileList(QString directory);
    464501
    465502  protected:
    466  
     503    ~MythImageFileDialog(); // use deleteLater() instead for thread safety
    467504    void keyPressEvent(QKeyEvent *e);
    468505
    469506  private:
     
    486523   
    487524  public:
    488525
    489     enum DialogCode {
    490         Rejected,
    491         Accepted
    492     };
    493 
    494526    enum ScrollMode {
    495527        HScroll=0,
    496528        VScroll
     
    498530
    499531    MythScrollDialog(MythMainWindow *parent, ScrollMode mode=HScroll,
    500532                     const char *name = 0);
    501     ~MythScrollDialog();
    502533
    503534    void setArea(int w, int h);
    504535    void setAreaMultiplied(int areaWTimes, int areaHTimes);
    505536
    506     int  result() const;
     537    DialogCode result(void) const;
    507538
    508539  public slots:
    509540
    510     int  exec();
     541    DialogCode exec(void);
    511542    virtual void done(int);
    512543    virtual void show();
    513544    virtual void hide();
     
    519550    virtual void reject();
    520551
    521552  protected:
    522 
     553    ~MythScrollDialog(); // use deleteLater() instead for thread safety
    523554    void         keyPressEvent(QKeyEvent *e);
    524555    virtual void paintEvent(QRegion& region, int x, int y, int w, int h);
    525556
    526     void setResult(int r);
     557    void setResult(DialogCode r);
    527558    void viewportPaintEvent(QPaintEvent *pe);
    528559
    529560    MythMainWindow *m_parent;
     
    537568    QFont           m_defaultMediumFont;
    538569    QFont           m_defaultSmallFont;
    539570
    540     int             m_resCode;
     571    DialogCode      m_resCode;
    541572    bool            m_inLoop;
    542573   
    543574    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

     
    2020
    2121    bool getCheckBoxState(void) {  if (checkbox) return checkbox->isChecked();
    2222                                   return false; }
     23
    2324  protected slots:
    2425    void buttonPressed(int which);
    2526
  • 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

     
    486486    }
    487487}
    488488
    489 int PlaybackBox::exec(void)
     489DialogCode PlaybackBox::exec(void)
    490490{
    491491    if (recGroup != "")
    492492        return MythDialog::exec();
     
    497497        return MythDialog::exec();
    498498    }
    499499
    500     return 0;
     500    return kDialogCodeRejected;
    501501}
    502502
    503503/* blocks until playing has stopped */
     
    46334633
    46344634    iconhelp->addLayout(grid);
    46354635
    4636     QButton *button = iconhelp->addButton(tr("Ok"));
     4636    QButton *button = iconhelp->addButton(
     4637        QObject::tr("OK"), iconhelp, SLOT(accept()));
    46374638    button->setFocus();
    46384639
    46394640    iconhelp->ExecPopup();
     
    47634764    recGroupPopup->addWidget(exitbutton);
    47644765    connect(exitbutton, SIGNAL(clicked()), recGroupPopup, SLOT(reject()));
    47654766
    4766     int result = recGroupPopup->ExecPopup();
     4767    DialogCode result = recGroupPopup->ExecPopup();
    47674768
    47684769    if (result != MythDialog::Rejected)
    47694770    {
     
    49294930    connect(recGroupListBox, SIGNAL(currentChanged(QListBoxItem *)), this,
    49304931            SLOT(recGroupChooserListBoxChanged()));
    49314932
    4932     int result = recGroupPopup->ExecPopup();
     4933    DialogCode result = recGroupPopup->ExecPopup();
    49334934
    49344935    if (result != MythDialog::Rejected)
    49354936        setGroupFilter();
     
    49894990                                                     recGroupPassword,
    49904991                                                     gContext->GetMainWindow());
    49914992        pwd->exec();
    4992         delete pwd;
     4993        pwd->deleteLater();
    49934994        if (!ok)
    49944995        {
    49954996            recGroupPassword = savedPW;
     
    51315132            SLOT(recGroupChangerListBoxChanged()));
    51325133    connect(recGroupOkButton, SIGNAL(clicked()), recGroupPopup, SLOT(accept()));
    51335134
    5134     int result = recGroupPopup->ExecPopup();
     5135    DialogCode result = recGroupPopup->ExecPopup();
    51355136
    51365137    if (result != MythDialog::Rejected)
    51375138        setRecGroup();
     
    51825183    connect(recGroupListBox, SIGNAL(accepted(int)),
    51835184            recGroupPopup,   SLOT(AcceptItem(int)));
    51845185
    5185     int result = recGroupPopup->ExecPopup();
     5186    DialogCode result = recGroupPopup->ExecPopup();
    51865187
    51875188    if (result != MythDialog::Rejected)
    51885189        setPlayGroup();
     
    52195220
    52205221    connect(recGroupOkButton, SIGNAL(clicked()), recGroupPopup, SLOT(accept()));
    52215222
    5222     int result = recGroupPopup->ExecPopup();
     5223    DialogCode result = recGroupPopup->ExecPopup();
    52235224
    52245225    if (result == MythDialog::Accepted)
    52255226        setRecTitle();
  • 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");
     
    458458    DialogBox *dlg = new DialogBox(gContext->GetMainWindow(), title);
    459459
    460460    dlg->AddButton(QObject::tr("No"));
    461     int result;
     461    DialogCode result = kDialogCodeRejected;
    462462
    463     enum {
    464         kDialogCodeButton0 = 1,
    465         kDialogCodeButton1 = 2,
    466         kDialogCodeButton2 = 3,
    467         kDialogCodeButton3 = 4,
    468     };
    469 
    470463    int ret = NO_EXIT;
    471464    switch (exitMenuStyle)
    472465    {
     
    719712                    long long pos = (long long)(atoi((*++it).ascii()) & 0xffffffffLL);
    720713                    if (pos > 0)
    721714                    {
    722                         QString msg = QString("DVD contains a bookmark");
    723                         QString button1msg = QString("Play from bookmark");
    724                         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");
    725718       
    726                         int ret = MythPopupBox::show2ButtonPopup(gContext->GetMainWindow(),
    727                                                             "", msg,
    728                                                             button1msg,
    729                                                             button2msg,
    730                                                             1);
    731                         if (ret == 1)
     719                        DialogCode ret = MythPopupBox::Show2ButtonPopup(
     720                            gContext->GetMainWindow(),
     721                            "", msg,
     722                            btn0msg,
     723                            btn1msg,
     724                            kDialogCodeButton0);
     725                        if (kDialogCodeButton1 == ret)
    732726                            pginfo->setIgnoreBookmark(true);
    733                         else if (ret == -1)
     727                        else if (kDialogCodeRejected == ret)
    734728                        {
    735729                            delete tmprbuf;
    736730                            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/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;
    353352            dia->deleteLater();
    354353        }
  • 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