Exemplo n.º 1
0
ChannelEditor::ChannelEditor() : ConfigurationDialog()
{
    setLabel(tr("Channels"));

    addChild(list = new ChannelListSetting());

    SortMode           *sort   = new SortMode();
    source                     = new SourceSetting();
    TransButtonSetting *del    = new TransButtonSetting();
    NoChanNumHide      *hide   = new NoChanNumHide();

    del->setLabel(tr("Delete Channels"));
    del->setHelpText(
        tr("Delete all channels on currently selected source[s]."));

    HorizontalConfigurationGroup *src =
        new HorizontalConfigurationGroup(false, false, true, true);
    src->addChild(source);
    src->addChild(del);

    sort->setValue(sort->getValueIndex(list->getSortMode()));
    source->setValue(max(source->getValueIndex(list->getSourceID()), 0));
    hide->setValue(list->getHideMode());

    addChild(sort);
    addChild(src);
    addChild(hide);

    buttonScan = new TransButtonSetting();
    buttonScan->setLabel(QObject::tr("Channel Scanner"));
    buttonScan->setHelpText(QObject::tr("Starts the channel scanner."));
    buttonScan->setEnabled(SourceUtil::IsAnySourceScanable());
    
    buttonImportIcon = new TransButtonSetting();
    buttonImportIcon->setLabel(QObject::tr("Icon Download"));
    buttonImportIcon->setHelpText(QObject::tr("Starts the icon downloader"));
    buttonImportIcon->setEnabled(SourceUtil::IsAnySourceScanable());

    buttonTransportEditor = new TransButtonSetting();
    buttonTransportEditor->setLabel(QObject::tr("Transport Editor"));
    buttonTransportEditor->setHelpText(
        QObject::tr("Allows you to edit the transports directly") + " " +
        QObject::tr("This is rarely required unless you are using "
                    "a satellite dish and must enter an initial "
                    "frequency to for the channel scanner to try."));

    HorizontalConfigurationGroup *h = 
        new HorizontalConfigurationGroup(false, false);
    h->addChild(buttonScan);
    h->addChild(buttonImportIcon);
    h->addChild(buttonTransportEditor);
    addChild(h);

    connect(source, SIGNAL(valueChanged(const QString&)),
            list, SLOT(setSourceID(const QString&)));
    connect(sort, SIGNAL(valueChanged(const QString&)),
            list, SLOT(setSortMode(const QString&)));
    connect(hide, SIGNAL(valueChanged(bool)),
            list, SLOT(setHideMode(bool)));
    connect(list, SIGNAL(accepted(int)),
            this, SLOT(edit(int)));
    connect(list, SIGNAL(menuButtonPressed(int)),
            this, SLOT(menu(int)));
    connect(buttonScan, SIGNAL(pressed()),
            this, SLOT(scan()));
    connect(buttonImportIcon,  SIGNAL(pressed()),
            this, SLOT(channelIconImport()));
    connect(buttonTransportEditor, SIGNAL(pressed()),
            this, SLOT(transportEditor()));
    connect(del,  SIGNAL(pressed()),
            this, SLOT(deleteChannels()));
}
Exemplo n.º 2
0
bool ChannelEditor::Create()
{
    bool foundtheme = false;

    // Load the theme for this screen
    foundtheme = LoadWindowFromXML("config-ui.xml", "channeloverview", this);

    if (!foundtheme)
        return false;

    MythUIButtonList *sortList = dynamic_cast<MythUIButtonList *>(GetChild("sorting"));
    m_sourceList = dynamic_cast<MythUIButtonList *>(GetChild("source"));
    m_channelList = dynamic_cast<MythUIButtonList *>(GetChild("channels"));
    m_preview = dynamic_cast<MythUIImage *>(GetChild("preview"));
    m_channame = dynamic_cast<MythUIText *>(GetChild("name"));
    m_channum = dynamic_cast<MythUIText *>(GetChild("channum"));
    m_callsign = dynamic_cast<MythUIText *>(GetChild("callsign"));
    m_chanid = dynamic_cast<MythUIText *>(GetChild("chanid"));
    m_sourcename = dynamic_cast<MythUIText *>(GetChild("sourcename"));
    m_compoundname = dynamic_cast<MythUIText *>(GetChild("compoundname"));

    MythUIButton *deleteButton = dynamic_cast<MythUIButton *>(GetChild("delete"));
    MythUIButton *scanButton = dynamic_cast<MythUIButton *>(GetChild("scan"));
    MythUIButton *importIconButton = dynamic_cast<MythUIButton *>(GetChild("importicons"));
    MythUIButton *transportEditorButton = dynamic_cast<MythUIButton *>(GetChild("edittransport"));

    MythUICheckBox *hideCheck = dynamic_cast<MythUICheckBox *>(GetChild("nochannum"));

    if (!sortList || !m_sourceList || !m_channelList || !deleteButton ||
        !scanButton || !importIconButton || !transportEditorButton ||
        !hideCheck)
    {

        return false;
    }

    // Delete button help text
    deleteButton->SetHelpText(tr("Delete all channels on currently selected source(s)."));

    // Sort List
    new MythUIButtonListItem(sortList, tr("Channel Name"));
    new MythUIButtonListItem(sortList, tr("Channel Number"));
    connect(m_sourceList, SIGNAL(itemSelected(MythUIButtonListItem *)),
            SLOT(setSourceID(MythUIButtonListItem *)));
    sortList->SetValue(m_currentSortMode);


    // Source List
    new MythUIButtonListItem(m_sourceList,tr("All"),
                             qVariantFromValue((int)FILTER_ALL));
    MSqlQuery query(MSqlQuery::InitCon());
    query.prepare("SELECT name, sourceid FROM videosource");
    if (query.exec())
    {
        while(query.next())
        {
            new MythUIButtonListItem(m_sourceList, query.value(0).toString(),
                                     query.value(1).toInt());
        }
    }
    new MythUIButtonListItem(m_sourceList,tr("(Unassigned)"),
                             qVariantFromValue((int)FILTER_UNASSIGNED));
    connect(sortList, SIGNAL(itemSelected(MythUIButtonListItem *)),
            SLOT(setSortMode(MythUIButtonListItem *)));

    // Hide/Show channels without channum checkbox
    hideCheck->SetCheckState(m_currentHideMode);
    connect(hideCheck, SIGNAL(toggled(bool)),
            SLOT(setHideMode(bool)));

    // Scan Button
    scanButton->SetHelpText(tr("Starts the channel scanner."));
    scanButton->SetEnabled(SourceUtil::IsAnySourceScanable());

    // Import Icons Button
    importIconButton->SetHelpText(tr("Starts the icon downloader"));
    importIconButton->SetEnabled(true);
    connect(importIconButton,  SIGNAL(Clicked()), SLOT(channelIconImport()));

    // Transport Editor Button
    transportEditorButton->SetHelpText(
        tr("Allows you to edit the transports directly. "
            "This is rarely required unless you are using "
            "a satellite dish and must enter an initial "
            "frequency to for the channel scanner to try."));
    connect(transportEditorButton, SIGNAL(Clicked()), SLOT(transportEditor()));

    // Other signals
    connect(m_channelList, SIGNAL(itemClicked(MythUIButtonListItem *)),
            SLOT(edit(MythUIButtonListItem *)));
    connect(m_channelList, SIGNAL(itemSelected(MythUIButtonListItem *)),
            SLOT(itemChanged(MythUIButtonListItem *)));
    connect(scanButton, SIGNAL(Clicked()), SLOT(scan()));
    connect(deleteButton,  SIGNAL(Clicked()), SLOT(deleteChannels()));

    fillList();

    BuildFocusList();

    return true;
}