Ticket #12: 00-12-transporteditor-mythui.patch

File 00-12-transporteditor-mythui.patch, 26.6 KB (added by Matthew Wire <devel@…>, 3 years ago)

Convert transport list editor to mythui

  • mythtv/libs/libmythtv/transporteditor.cpp

     
    3939#include "mythcontext.h" 
    4040#include "mythdb.h" 
    4141 
     42// MythUI 
     43#include "mythuitext.h" 
     44#include "mythuibutton.h" 
     45#include "mythuibuttonlist.h" 
     46#include "mythdialogbox.h" 
     47 
    4248#define LOC QString("DTVMux: ") 
    4349#define LOC_ERR QString("DTVMux, Error: ") 
    4450 
     
    7985    return mod.toUpper(); 
    8086} 
    8187 
    82 void TransportList::fillSelections(void) 
    83 { 
    84     //VERBOSE(VB_IMPORTANT, "TransportList::fillSelections() "<<sourceid); 
    85  
    86     clearSelections(); 
    87     addSelection("(" + tr("New Transport") + ")", "0"); 
    88  
    89     setHelpText(QObject::tr( 
    90                     "This section lists each transport that MythTV " 
    91                     "currently knows about. The display fields are " 
    92                     "video source, modulation, frequency, and when " 
    93                     "relevant symbol rate, network id, and transport id.")); 
    94  
    95     if (!sourceid) 
    96         return; 
    97  
    98     MSqlQuery query(MSqlQuery::InitCon()); 
    99     query.prepare( 
    100         "SELECT mplexid, modulation, frequency, " 
    101         "       symbolrate, networkid, transportid, constellation " 
    102         "FROM dtv_multiplex, videosource " 
    103         "WHERE dtv_multiplex.sourceid = :SOURCEID AND " 
    104         "      dtv_multiplex.sourceid = videosource.sourceid " 
    105         "ORDER by networkid, transportid, frequency, mplexid"); 
    106     query.bindValue(":SOURCEID", sourceid); 
    107  
    108     if (!query.exec() || !query.isActive()) 
    109     { 
    110         MythDB::DBError("TransportList::fillSelections", query); 
    111         return; 
    112     } 
    113  
    114     while (query.next()) 
    115     { 
    116         QString rawmod = (CardUtil::OFDM == cardtype) ? 
    117             query.value(6).toString() : query.value(1).toString(); 
    118  
    119         QString mod = pp_modulation(rawmod); 
    120         while (mod.length() < 7) 
    121             mod += " "; 
    122  
    123         QString rate  = query.value(3).toString(); 
    124         rate = (rate == "0") ? "" : QString("rate %1").arg(rate); 
    125  
    126         QString netid = query.value(4).toUInt() ? 
    127             QString("netid %1").arg(query.value(4).toUInt(), 5) : ""; 
    128  
    129         QString tid = query.value(5).toUInt() ? 
    130             QString("tid %1").arg(query.value(5).toUInt(), 5) : ""; 
    131  
    132         QString hz = (CardUtil::QPSK == cardtype) ? "kHz" : "Hz"; 
    133  
    134         QString type = ""; 
    135         if (CardUtil::OFDM == cardtype) 
    136             type = "(DVB-T)"; 
    137         if (CardUtil::QPSK == cardtype) 
    138             type = "(DVB-S)"; 
    139         if (CardUtil::QAM == cardtype) 
    140             type = "(DVB-C)"; 
    141  
    142         QString txt = QString("%1 %2 %3 %4 %5 %6 %7") 
    143             .arg(mod).arg(query.value(2).toString()) 
    144             .arg(hz).arg(rate).arg(netid).arg(tid).arg(type); 
    145  
    146         addSelection(txt, query.value(0).toString()); 
    147     } 
    148 } 
    149  
    15088static CardUtil::CARD_TYPES get_cardtype(uint sourceid) 
    151 { 
     89{    
    15290    vector<uint> cardids; 
     91    QString msg; 
    15392 
    15493    // Work out what card we have.. (doesn't always work well) 
    15594    MSqlQuery query(MSqlQuery::InitCon()); 
     
    175114 
    176115    if (cardids.empty()) 
    177116    { 
    178         MythPopupBox::showOkPopup( 
    179             gContext->GetMainWindow(),  
    180             QObject::tr("Transport Editor"),  
    181             QObject::tr( 
    182                 "Sorry, the Transport Editor can only be used to " 
    183                 "edit transports which are connected to a card input.")); 
     117        msg = QObject::tr( 
     118              "Sorry, the Transport Editor can only be used to " 
     119              "edit transports which are connected to a card input." 
     120              "\nThe cards must be local to this machine."); 
     121        ShowOkPopup(msg, gContext->GetMainWindow()); 
    184122 
    185123        return CardUtil::ERROR_PROBE; 
    186124    } 
     
    200138            (CardUtil::ERROR_UNKNOWN == nType) || 
    201139            (CardUtil::ERROR_PROBE   == nType)) 
    202140        { 
    203             MythPopupBox::showOkPopup( 
    204                 gContext->GetMainWindow(),  
    205                 QObject::tr("Transport Editor"),  
    206                 QObject::tr( 
    207                     "Failed to probe a capture card connected to this " 
    208                     "transport's video source. Please make sure the " 
    209                     "backend is not running.")); 
     141            msg = QObject::tr( 
     142                  "Failed to probe a capture card connected to this " 
     143                  "transport's video source. Please make sure the " 
     144                  "backend is not running."); 
     145            ShowOkPopup(msg, gContext->GetMainWindow()); 
    210146 
    211147            return CardUtil::ERROR_PROBE; 
    212148        } 
     
    231167        if (typeA == typeB) 
    232168            continue; 
    233169 
    234         MythPopupBox::showOkPopup( 
    235             gContext->GetMainWindow(),  
    236             QObject::tr("Transport Editor"),  
    237             QObject::tr( 
    238                 "The Video Sources to which this Transport is connected " 
    239                 "are incompatible, please create seperate video sources " 
    240                 "for these cards. ")); 
    241  
     170        msg = QObject::tr( 
     171              "The Video Sources to which this Transport is connected " 
     172              "are incompatible, please create seperate video sources " 
     173              "for these cards. "); 
     174        ShowOkPopup(msg, gContext->GetMainWindow()); 
     175         
    242176        return CardUtil::ERROR_PROBE; 
    243177    } 
    244178 
    245179    return cardtypes[0]; 
    246180} 
    247181 
    248 void TransportList::SetSourceID(uint _sourceid) 
     182///////////////////////////////////////////////////////// 
     183 
     184TransportListEditor::TransportListEditor(MythScreenStack *parent, int sourceid) 
     185              : MythScreenType(parent, "transporteditor") 
    249186{ 
    250     //VERBOSE(VB_IMPORTANT, "TransportList::SetSourceID("<<_sourceid<<")"); 
     187    if (sourceid > 0) 
     188        m_sourceid = sourceid; 
     189    else 
     190        m_sourceid = 1; 
     191     
     192    m_deleteAllTransports = false; 
     193} 
    251194 
    252     if (!_sourceid) 
     195bool TransportListEditor::Create() 
     196{ 
     197    bool foundtheme = false; 
     198 
     199    // Load the theme for this screen 
     200    foundtheme = LoadWindowFromXML("config-ui.xml", "transportoverview", this); 
     201 
     202    if (!foundtheme) 
     203        return false; 
     204 
     205    m_sourceList = dynamic_cast<MythUIButtonList *>(GetChild("source")); 
     206    m_transportList = dynamic_cast<MythUIButtonList *>(GetChild("transports")); 
     207 
     208    if (!m_sourceList || !m_transportList) 
    253209    { 
    254         sourceid = 0; 
     210        return false; 
    255211    } 
    256     else 
     212 
     213    // Source List 
     214    MSqlQuery query(MSqlQuery::InitCon()); 
     215    query.prepare("SELECT name, sourceid FROM videosource"); 
     216    if (query.exec()) 
    257217    { 
    258         cardtype = get_cardtype(_sourceid); 
    259         sourceid = ((CardUtil::ERROR_OPEN    == cardtype) || 
    260                     (CardUtil::ERROR_UNKNOWN == cardtype) || 
    261                     (CardUtil::ERROR_PROBE   == cardtype)) ? 0 : _sourceid; 
     218        MythUIButtonListItem *item; 
     219        while(query.next()) 
     220        { 
     221            item = new MythUIButtonListItem(m_sourceList, query.value(0).toString(), 
     222                                     query.value(1).toInt()); 
     223            if (query.value(1).toInt() == m_sourceid) 
     224                m_sourceList->SetItemCurrent(item); 
     225        } 
    262226    } 
     227         
     228    connect(m_sourceList, SIGNAL(itemSelected(MythUIButtonListItem *)), 
     229            SLOT(setSourceID(MythUIButtonListItem *))); 
    263230 
    264     fillSelections(); 
     231    // Other signals 
     232    connect(m_transportList, SIGNAL(itemClicked(MythUIButtonListItem *)), 
     233            SLOT(edit())); 
     234 
     235    MythUIText *infoLabel = dynamic_cast<MythUIText *>(GetChild("infolabel")); 
     236    infoLabel->SetText(QObject::tr( 
     237                    "This section lists each transport that MythTV " 
     238                    "currently knows about. The display fields are " 
     239                    "transport id, network id, frequency, modulation, symbol rate " 
     240                    "and constellation.")); 
     241     
     242    fillList(); 
     243 
     244    BuildFocusList(); 
     245 
     246    return true; 
    265247} 
    266248 
    267 TransportListEditor::TransportListEditor(uint sourceid) : 
    268     m_videosource(new VideoSourceSelector(sourceid, QString::null, false)),  
    269     m_list(new TransportList()) 
     249bool TransportListEditor::keyPressEvent(QKeyEvent *event) 
    270250{ 
    271     setLabel(tr("Multiplex Editor")); 
     251    if (GetFocusWidget()->keyPressEvent(event)) 
     252        return true; 
    272253 
    273     m_list->SetSourceID(m_videosource->GetSourceID()); 
     254    bool handled = false; 
     255    QStringList actions; 
     256    gContext->GetMainWindow()->TranslateKeyPress("Global", event, actions); 
    274257 
    275     addChild(m_videosource); 
    276     addChild(m_list); 
     258    for (int i = 0; i < actions.size() && !handled; i++) 
     259    { 
     260        QString action = actions[i]; 
     261        handled = true; 
    277262 
    278     connect(m_videosource, SIGNAL(valueChanged(const QString&)),  
    279             m_list,        SLOT(  SetSourceID( const QString&))); 
    280      
    281     connect(m_list, SIGNAL(accepted(int)),            this, SLOT(Edit())); 
    282     connect(m_list, SIGNAL(menuButtonPressed(int)),   this, SLOT(Menu())); 
    283     connect(m_list, SIGNAL(editButtonPressed(int)),   this, SLOT(Edit())); 
    284     connect(m_list, SIGNAL(deleteButtonPressed(int)), this, SLOT(Delete())); 
     263        if (action == "MENU") 
     264        { 
     265            menu(); 
     266        } 
     267        else if (action == "DELETE") 
     268        { 
     269            uint mplexid = getMplexID(); 
     270            if (mplexid > 0) 
     271            { 
     272                deleteTransportMenu();             
     273            } 
     274            else  
     275                handled = true; 
     276        } 
     277        else 
     278            handled = false; 
     279    } 
     280 
     281    if (!handled && MythScreenType::keyPressEvent(event)) 
     282        handled = true; 
     283 
     284    return handled; 
    285285} 
    286286 
    287 DialogCode TransportListEditor::exec(void) 
     287void TransportListEditor::customEvent(QEvent *event) 
    288288{ 
    289     while (ConfigurationDialog::exec() == kDialogCodeAccepted); 
     289    if (event->type() == kMythDialogBoxCompletionEventType) 
     290    { 
     291        DialogCompletionEvent *dce = 
     292                                dynamic_cast<DialogCompletionEvent*>(event); 
    290293 
    291     return kDialogCodeRejected; 
     294        QString resultid= dce->GetId(); 
     295        int buttonnum  = dce->GetResult(); 
     296 
     297        if (resultid == "transportopts") 
     298        { 
     299            switch (buttonnum) 
     300            { 
     301                case 0 : // Edit Transport 
     302                    edit(); 
     303                    break; 
     304                case 1 : // Delete Transport 
     305                    m_deleteAllTransports = false; 
     306                    deleteTransportMenu(); 
     307                    break; 
     308                case 2 : // Delete All Transports for source 
     309                    m_deleteAllTransports = true; 
     310                    deleteTransportMenu(); 
     311                    break; 
     312            } 
     313        } 
     314        else if (resultid == "deletetransportmenu") 
     315        { 
     316            switch (buttonnum) 
     317            { 
     318                case 0 : // Confirm transport(s) delete 
     319                    deleteTransport(); 
     320                    break; 
     321                case 1 : // Cancel transport(s) delete 
     322                    break; 
     323            } 
     324        }  
     325    } 
    292326} 
    293327 
    294 void TransportListEditor::Edit(void) 
     328void TransportListEditor::setSourceID(MythUIButtonListItem *item) 
    295329{ 
    296     uint sourceid = m_videosource->getValue().toUInt(); 
    297     CardUtil::CARD_TYPES cardtype = get_cardtype(sourceid); 
     330    if (!item) 
     331        return; 
    298332 
    299     if ((CardUtil::ERROR_OPEN    != cardtype) && 
    300         (CardUtil::ERROR_UNKNOWN != cardtype) && 
    301         (CardUtil::ERROR_PROBE   != cardtype)) 
     333    int sourceid = item->GetData().toInt(); 
     334 
     335    if (!sourceid) 
    302336    { 
    303         uint mplexid = m_list->getValue().toUInt(); 
    304         TransportWizard wiz(mplexid, sourceid, cardtype); 
    305         wiz.exec(); 
    306         m_list->fillSelections(); 
     337        sourceid = 0; 
    307338    } 
     339 
     340    if (m_sourceid != sourceid) 
     341    { 
     342        m_sourceid = sourceid; 
     343        fillList(); 
     344    } 
    308345} 
    309346 
    310 void TransportListEditor::Delete(void) 
     347void TransportListEditor::fillList(void) 
    311348{ 
    312     uint mplexid = m_list->getValue().toInt(); 
     349    QString currentValue = m_transportList->GetValue(); 
     350    uint    currentIndex = qMax(m_transportList->GetCurrentPos(), 0); 
     351    m_transportList->Reset(); 
     352    MythUIButtonListItem *item = new MythUIButtonListItem(m_transportList, ""); 
     353    // FIXME: There must be a better way of adding this? 
     354    item->SetText(" ( ", "transportid"); 
     355    item->SetText(tr("Add"), "networkid"); 
     356    item->SetText(tr("New Transport"), "frequency"); 
     357    item->SetText(" ) ", "modulation"); 
    313358 
    314     DialogCode val = MythPopupBox::Show2ButtonPopup( 
    315         gContext->GetMainWindow(), "",  
    316         tr("Are you sure you would like to delete this transport?"),  
    317         tr("Yes, delete the transport"),  
    318         tr("No, don't"), kDialogCodeButton1); 
    319  
    320     if (kDialogCodeButton0 != val) 
     359    if (!m_sourceid) 
    321360        return; 
    322361 
     362    QString querystr = "SELECT mplexid, modulation, frequency, symbolrate," 
     363                       "networkid, transportid, constellation, visible " 
     364                       "FROM dtv_multiplex, videosource " 
     365                       "WHERE dtv_multiplex.sourceid = :SOURCEID AND " 
     366                       "dtv_multiplex.sourceid = videosource.sourceid " 
     367                       "ORDER by networkid, transportid, frequency, mplexid"; 
     368     
     369    CardUtil::CARD_TYPES cardtype = get_cardtype(m_sourceid); 
     370 
    323371    MSqlQuery query(MSqlQuery::InitCon()); 
    324     query.prepare("DELETE FROM dtv_multiplex WHERE mplexid = :MPLEXID"); 
     372    query.prepare(querystr); 
     373    query.bindValue(":SOURCEID", m_sourceid); 
     374 
     375    uint selidx = 0, idx = 1; 
     376    if (query.exec() && query.size() > 0) 
     377    { 
     378        for (; query.next() ; idx++) 
     379        { 
     380            QString mplexid = query.value(0).toString(); 
     381 
     382            QString rawmod = (CardUtil::OFDM == cardtype) ? 
     383                query.value(6).toString() : query.value(1).toString(); 
     384 
     385            QString modulation = pp_modulation(rawmod); 
     386            while (modulation.length() < 7) 
     387                modulation += " "; 
     388 
     389            QString frequency = query.value(2).toString(); 
     390 
     391            QString symbolrate = query.value(3).toString(); 
     392            symbolrate = ( symbolrate == "0" ) ? "" : symbolrate + " S/s"; 
     393 
     394            QString networkid = query.value(4).toString(); 
     395 
     396            QString transportid = query.value(5).toString(); 
     397 
     398            QString hz = (CardUtil::QPSK == cardtype) ? "kHz" : "Hz"; 
     399 
     400            QString constellation = ""; 
     401            if (CardUtil::OFDM == cardtype) 
     402                constellation = "(DVB-T)"; 
     403            if (CardUtil::QPSK == cardtype) 
     404                constellation = "(DVB-S)"; 
     405            if (CardUtil::QAM == cardtype) 
     406                constellation = "(DVB-C)"; 
     407 
     408            QString txt = QString("%1 %2 %3 symbolrate %4 networkid %5 transportid %6 %7") 
     409                .arg(modulation).arg(frequency).arg(hz) 
     410                .arg(symbolrate).arg(networkid).arg(transportid).arg(constellation); 
     411 
     412            bool visible =  query.value(7).toBool(); 
     413 
     414            QString state = "normal"; 
     415            if (!visible) 
     416                state = "disabled"; 
     417 
     418            bool sel = (mplexid == currentValue); 
     419            selidx = (sel) ? idx : selidx; 
     420            item = new MythUIButtonListItem(m_transportList, "", 
     421                                                     qVariantFromValue(mplexid)); 
     422            item->SetText(transportid, "transportid"); 
     423            item->SetText(frequency + " " + hz, "frequency"); 
     424            item->SetText(modulation, "modulation"); 
     425            item->SetText(symbolrate, "symbolrate"); 
     426            item->SetText(networkid, "networkid"); 
     427            item->SetText(constellation, "constellation"); 
     428            item->DisplayState(state, "status"); 
     429        } 
     430    } 
     431 
     432    // Make sure we select the current item, or the following one after 
     433    // deletion, with wrap around to "(New Transport)" after deleting last item. 
     434    m_transportList->SetItemCurrent((!selidx && currentIndex < idx) ? currentIndex : selidx); 
     435} 
     436 
     437uint TransportListEditor::getMplexID(void) 
     438{ 
     439    MythUIButtonListItem *item = m_transportList->GetItemCurrent(); 
     440    if (!item) 
     441        return 0; 
     442 
     443    return item->GetData().toUInt(); 
     444} 
     445 
     446QString TransportListEditor::getTransportID(uint mplexid) 
     447{ 
     448    MSqlQuery query(MSqlQuery::InitCon()); 
     449    query.prepare("SELECT transportid FROM dtv_multiplex " 
     450            "WHERE mplexid = :MPLEXID"); 
    325451    query.bindValue(":MPLEXID", mplexid); 
     452    if (!query.exec() || !query.next()) 
     453    { 
     454        MythDB::DBError("TransportListEditor()", query); 
     455        return ""; 
     456    } 
     457    return query.value(0).toString(); 
     458} 
    326459 
     460void TransportListEditor::edit(void) 
     461{ 
     462    MythUIButtonListItem *item = m_transportList->GetItemCurrent(); 
     463    if (!item) 
     464        return; 
     465 
     466    CardUtil::CARD_TYPES cardtype = get_cardtype(m_sourceid); 
     467 
     468    if ((CardUtil::ERROR_OPEN    != cardtype) && 
     469        (CardUtil::ERROR_UNKNOWN != cardtype) && 
     470        (CardUtil::ERROR_PROBE   != cardtype))  
     471    { 
     472        TransportWizard wiz(getMplexID(), m_sourceid, cardtype); 
     473        wiz.exec(); 
     474        fillList(); 
     475    } 
     476} 
     477 
     478void TransportListEditor::deleteTransport(void) 
     479{ 
     480    MSqlQuery query(MSqlQuery::InitCon()); 
     481     
     482    if ( m_deleteAllTransports ) 
     483    { 
     484        query.prepare("DELETE FROM dtv_multiplex WHERE sourceid = :SOURCEID"); 
     485        query.bindValue(":SOURCEID", m_sourceid); 
     486    } 
     487    else 
     488    { 
     489        query.prepare("DELETE FROM dtv_multiplex WHERE mplexid = :MPLEXID"); 
     490        query.bindValue(":MPLEXID", getMplexID()); 
     491    } 
     492     
    327493    if (!query.exec() || !query.isActive()) 
    328494        MythDB::DBError("TransportEditor -- delete multiplex", query); 
     495     
     496    m_deleteAllTransports = false; 
    329497 
    330     query.prepare("DELETE FROM channel WHERE mplexid = :MPLEXID"); 
    331     query.bindValue(":MPLEXID", mplexid); 
     498    fillList(); 
     499} 
    332500 
    333     if (!query.exec() || !query.isActive()) 
    334         MythDB::DBError("TransportEditor -- delete channels", query); 
     501void TransportListEditor::deleteTransportMenu(void) 
     502{ 
     503    QString msg; 
     504     
     505    if ( m_deleteAllTransports ) 
     506    { 
     507        msg = tr("Are you sure you would like to delete the transports on %1?") 
     508                       .arg(m_sourceList->GetValue()); 
     509    } 
     510    else 
     511    { 
     512        msg = tr("Are you sure you would like to delete transport %1?") 
     513                       .arg(getTransportID(getMplexID())); 
     514    } 
    335515 
    336     m_list->fillSelections(); 
     516    MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); 
     517    MythDialogBox *delTransportMenu = new MythDialogBox(msg, popupStack, "deletetransportmenu"); 
     518    if (delTransportMenu->Create()) 
     519    { 
     520        delTransportMenu->SetReturnEvent(this, "deletetransportmenu"); 
     521  
     522        delTransportMenu->AddButton(tr("Yes, delete the transport(s)")); 
     523        delTransportMenu->AddButton(tr("No, don't")); 
     524  
     525        popupStack->AddScreen(delTransportMenu); 
     526    } 
     527    else 
     528        delete delTransportMenu; 
    337529} 
    338530 
    339 void TransportListEditor::Menu(void) 
     531void TransportListEditor::menu(void) 
    340532{ 
    341     uint mplexid = m_list->getValue().toInt(); 
     533    uint mplexid = getMplexID(); 
    342534 
    343535    if (!mplexid) 
    344536    { 
    345        Edit(); 
    346        return; 
     537       edit(); 
    347538    } 
     539    else 
     540    { 
     541        QString label = tr("Transport Options"); 
    348542 
    349     DialogCode val = MythPopupBox::Show2ButtonPopup( 
    350         gContext->GetMainWindow(),  
    351         "",  
    352         tr("Transport Menu"),  
    353         tr("Edit.."),  
    354         tr("Delete.."), kDialogCodeButton0); 
     543        MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); 
    355544 
    356     if (kDialogCodeButton0 == val) 
    357         emit Edit(); 
    358     else if (kDialogCodeButton1 == val) 
    359         emit Delete(); 
    360     else 
    361         m_list->setFocus(); 
     545        MythDialogBox *menu = new MythDialogBox(label, popupStack, "transportoptmenu"); 
     546 
     547        if (menu->Create()) 
     548        { 
     549            menu->SetReturnEvent(this, "transportopts"); 
     550 
     551            QString tsID = getTransportID(mplexid); 
     552            menu->AddButton(tr("Edit transport %1").arg(tsID)); 
     553            menu->AddButton(tr("Delete transport %1").arg(tsID)); 
     554            menu->AddButton(tr("Delete ALL transports on %1").arg(m_sourceList->GetValue())); 
     555 
     556            popupStack->AddScreen(menu); 
     557        } 
     558        else 
     559        { 
     560            delete menu; 
     561            return; 
     562        } 
     563    } 
    362564} 
    363565 
    364566class MuxDBStorage : public SimpleDBStorage 
  • mythtv/libs/libmythtv/transporteditor.h

     
    3232#ifndef _TRANSPORT_EDITOR_H_ 
    3333#define _TRANSPORT_EDITOR_H_ 
    3434 
     35#include "mythscreentype.h" 
     36 
    3537#include <qobject.h> 
    3638#include "settings.h" 
    3739 
     
    4143/* 
    4244 *  Objects added for Transport Editing section 
    4345 */ 
    44  
    45 class TransportList : public ListBoxSetting, public TransientStorage 
     46class MPUBLIC TransportListEditor : public MythScreenType 
    4647{ 
    4748    Q_OBJECT 
    48  
    4949  public: 
    50     TransportList() : ListBoxSetting(this), sourceid(0), cardtype(0) { } 
     50    TransportListEditor(MythScreenStack *parent, int sourceId); 
    5151 
    52     virtual void Load(void) { fillSelections(); } 
    53     virtual void fillSelections(void); 
     52    bool Create(void); 
     53    bool keyPressEvent(QKeyEvent *); 
     54    void customEvent(QEvent *event); 
    5455 
    55     void SetSourceID(uint _sourceid); 
     56  protected slots: 
     57    void menu(void); 
     58    void edit(void); 
     59    void deleteTransport(void); 
     60    void deleteTransportMenu(void); 
     61    void fillList(void); 
     62    void setSourceID(MythUIButtonListItem *item); 
     63    uint getMplexID(void); 
     64    QString getTransportID(uint mplexid); 
    5665 
    57   public slots: 
    58     void SetSourceID(const QString &_sourceid) 
    59         { SetSourceID(_sourceid.toUInt()); } 
    60  
    6166  private: 
    62     ~TransportList() { } 
     67    int m_sourceid; 
     68    bool m_deleteAllTransports; 
    6369 
    64   private: 
    65     uint sourceid; 
    66     uint cardtype; 
     70    MythUIButtonList *m_transportList; 
     71    MythUIButtonList *m_sourceList; 
    6772}; 
    6873 
    69 // Page for selecting a transport to be created/edited 
    70 class MPUBLIC TransportListEditor : public QObject, public ConfigurationDialog 
    71 { 
    72     Q_OBJECT 
    73  
    74   public: 
    75     TransportListEditor(uint initial_sourceid); 
    76  
    77     virtual DialogCode exec(void); 
    78  
    79   public slots: 
    80     void Menu(void); 
    81     void Delete(void); 
    82     void Edit(void); 
    83  
    84   private: 
    85     ~TransportListEditor() { } 
    86  
    87   private: 
    88     VideoSourceSelector *m_videosource; 
    89     TransportList       *m_list; 
    90 }; 
    91  
    9274#endif // _TRANSPORT_EDITOR_H_ 
  • mythtv/programs/mythtv-setup/channeleditor.cpp

     
    158158    // Sort List 
    159159    new MythUIButtonListItem(sortList, tr("Channel Name")); 
    160160    new MythUIButtonListItem(sortList, tr("Channel Number")); 
    161     connect(m_sourceList, SIGNAL(itemSelected(MythUIButtonListItem *)), 
    162             SLOT(setSourceID(MythUIButtonListItem *))); 
     161    connect(sortList, SIGNAL(itemSelected(MythUIButtonListItem *)), 
     162            SLOT(setSortMode(MythUIButtonListItem *))); 
    163163    sortList->SetValue(m_currentSortMode); 
    164164 
    165165 
     
    178178    } 
    179179    new MythUIButtonListItem(m_sourceList,tr("(Unassigned)"), 
    180180                             qVariantFromValue((int)FILTER_UNASSIGNED)); 
    181     connect(sortList, SIGNAL(itemSelected(MythUIButtonListItem *)), 
    182             SLOT(setSortMode(MythUIButtonListItem *))); 
     181    connect(m_sourceList, SIGNAL(itemSelected(MythUIButtonListItem *)), 
     182            SLOT(setSourceID(MythUIButtonListItem *))); 
    183183 
    184184    // Hide/Show channels without channum checkbox 
    185185    hideCheck->SetCheckState(m_currentHideMode); 
     
    556556 
    557557void ChannelEditor::transportEditor(void) 
    558558{ 
    559     TransportListEditor *editor = new TransportListEditor(m_sourceFilter); 
    560     editor->exec(); 
    561     editor->deleteLater(); 
     559    MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); 
    562560 
     561    TransportListEditor *transportedit = new TransportListEditor(mainStack, m_sourceFilter); 
     562 
     563    if (transportedit->Create()) 
     564        mainStack->AddScreen(transportedit); 
     565    else 
     566        delete transportedit; 
     567 
    563568    fillList(); 
    564569} 
    565570 
  • mythtv/themes/default/config-ui.xml

     
    178168        </button> 
    179169 
    180170    </window> 
     171     
     172    <window name="transportoverview"> 
     173 
     174        <textarea name="pagetitle"> 
     175            <area>20,5,570,40</area> 
     176            <font>baselarge</font> 
     177            <value>Transport Editor</value> 
     178        </textarea> 
     179 
     180        <imagetype name="filler"> 
     181            <filename>cr-background.png</filename> 
     182            <position>0,39</position> 
     183        </imagetype> 
     184 
     185        <imagetype name="transportid_column"> 
     186            <area>51,50,80,260</area> 
     187            <gradient start="#333333" end="#333333" alpha="180" /> 
     188        </imagetype> 
     189         
     190        <imagetype name="frequency_column"> 
     191            <area>207,50,160,260</area> 
     192            <gradient start="#333333" end="#333333" alpha="180" /> 
     193        </imagetype> 
     194 
     195        <imagetype name="symbolrate_column"> 
     196            <area>467,50,160,260</area> 
     197            <gradient start="#333333" end="#333333" alpha="180" /> 
     198        </imagetype> 
     199 
     200        <buttonlist name="transports" from="basebuttonlist2"> 
     201            <position>19,50</position> 
     202            <statetype name="buttonitem"> 
     203                <state name="active"> 
     204                    <textarea name="transportid" from="buttontext"> 
     205                        <area>36,1,80,24</area> 
     206                    </textarea> 
     207                    <textarea name="networkid" from="buttontext"> 
     208                        <area>116,1,80,24</area> 
     209                    </textarea> 
     210                    <textarea name="frequency" from="buttontext"> 
     211                        <area>192,1,160,24</area> 
     212                    </textarea> 
     213                    <textarea name="modulation" from="buttontext"> 
     214                        <area>352,1,100,24</area> 
     215                    </textarea> 
     216                    <textarea name="symbolrate" from="buttontext"> 
     217                        <area>452,1,160,24</area> 
     218                    </textarea> 
     219                    <textarea name="constellation" from="buttontext"> 
     220                        <area>616,1,161,24</area> 
     221                    </textarea> 
     222                </state> 
     223                <state name="selected" from="active" /> 
     224                <state name="inactive" from="active" /> 
     225            </statetype> 
     226        </buttonlist> 
     227 
     228        <textarea name="sourcelabel" from="basetextarea"> 
     229            <area>30,375,170,30</area> 
     230            <value>Video Source:</value> 
     231            <font>basemedium</font> 
     232        </textarea> 
     233 
     234        <buttonlist name="source" from="basewideselector"> 
     235            <position>210,370</position> 
     236        </buttonlist> 
     237 
     238        <textarea name="infolabel" from="basetextarea"> 
     239            <area>30,435,750,150</area> 
     240            <font>basemedium</font> 
     241            <multiline>true</multiline> 
     242        </textarea> 
     243 
     244    </window> 
     245 
    181246</mythuitheme> 
     247 No newline at end of file