Changeset 15776b172 in mythtv


Ignore:
Timestamp:
Nov 22, 2016, 9:18:55 PM (8 years ago)
Author:
Jonatan Lindblad <jlindblad@…>
Branches:
devel/2020-player, devel/ffmpeg-resync, fixes/29, fixes/30, fixes/31, github-templates, master
Children:
ec642bba15
Parents:
1925478899
git-author:
Jonatan Lindblad <jlindblad@…> (11/22/16 21:18:55)
git-committer:
Jonatan Lindblad <jlindblad@…> (02/13/17 21:23:50)
Message:

Settings: Allow individual video sources to be deleted through the menu

Refs #10092

Location:
mythtv
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • mythtv/libs/libmythtv/videosource.cpp

    r1925478899 r15776b172  
    692692}
    693693
     694VideoSourceDialog::VideoSourceDialog(MythScreenStack *parent) :
     695    StandardSettingDialog(parent, "videosourceeditor", new VideoSourceEditor())
     696{
     697}
     698
     699void VideoSourceDialog::ShowDeleteSourceDialog(void)
     700{
     701    MythUIButtonListItem *item = m_buttonList->GetItemCurrent();
     702    if (!item)
     703        return;
     704
     705    VideoSource *videosource = item->GetData().value<VideoSource*>();
     706    if (!videosource)
     707        return;
     708
     709    QString message = tr("Do you want to delete the '%1' video source?")
     710        .arg(videosource->getSourceName());
     711    ShowOkPopup(message, this,
     712                [videosource, this](bool result)
     713                {
     714                    if (result)
     715                        DeleteSource(videosource);
     716                },
     717                true);
     718}
     719
     720void VideoSourceDialog::ShowMenu()
     721{
     722    MythUIButtonListItem *item = m_buttonList->GetItemCurrent();
     723    if (!item)
     724        return;
     725
     726    VideoSource *videosource = item->GetData().value<VideoSource*>();
     727    if (!videosource)
     728        return;
     729
     730    MythMenu *menu = new MythMenu(tr("Video Source Menu"), this, "mainmenu");
     731    menu->AddItem(tr("Delete"), SLOT(ShowDeleteSourceDialog()));
     732
     733    MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack");
     734
     735    MythDialogBox *menuPopup = new MythDialogBox(menu, popupStack,
     736                                                 "menudialog");
     737    menuPopup->SetReturnEvent(this, "mainmenu");
     738
     739    if (menuPopup->Create())
     740        popupStack->AddScreen(menuPopup);
     741    else
     742        delete menuPopup;
     743}
     744
    694745bool VideoSourceEditor::cardTypesInclude(const int &sourceID,
    695746                                         const QString &thecardtype)
     
    38353886}
    38363887
    3837 /* TODO
    3838 void VideoSourceEditor::del()
    3839 {
    3840     DialogCode val = MythPopupBox::Show2ButtonPopup(
    3841         GetMythMainWindow(), "",
    3842         tr("Are you sure you want to delete "
    3843            "this video source?"),
    3844         tr("Yes, delete video source"),
    3845         tr("No, don't"),
    3846         kDialogCodeButton1);
    3847 
    3848     if (kDialogCodeButton0 == val)
    3849     {
    3850         SourceUtil::DeleteSource(listbox->getValue().toUInt());
    3851         Load();
    3852     }
    3853 }
    3854 */
     3888void VideoSourceDialog::DeleteSource(VideoSource *videosource)
     3889{
     3890    SourceUtil::DeleteSource(videosource->getSourceID());
     3891    GetGroupSettings()->removeChild(videosource);
     3892}
    38553893
    38563894void VideoSourceEditor::NewSource(void)
  • mythtv/libs/libmythtv/videosource.h

    r1925478899 r15776b172  
    224224
    225225class VideoSource : public GroupSetting {
    226 public:
     226    Q_OBJECT
     227
     228  public:
    227229    VideoSource();
    228230
     
    779781};
    780782
     783class MTV_PUBLIC VideoSourceDialog : public StandardSettingDialog
     784{
     785    Q_OBJECT
     786
     787    public:
     788      VideoSourceDialog(MythScreenStack *parent);
     789      void ShowMenu(void);
     790
     791    private slots:
     792      void ShowDeleteSourceDialog(void);
     793
     794    private:
     795      void DeleteSource(VideoSource *videosource);
     796};
     797
    781798class MTV_PUBLIC VideoSourceEditor : public GroupSetting
    782799{
  • mythtv/programs/mythtv-setup/main.cpp

    r1925478899 r15776b172  
    101101    {
    102102        MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack();
    103         StandardSettingDialog *ssd =
    104             new StandardSettingDialog(mainStack, "videosourceeditor",
    105                                       new VideoSourceEditor());
     103        StandardSettingDialog *ssd = new VideoSourceDialog(mainStack);
    106104
    107105        if (ssd->Create())
Note: See TracChangeset for help on using the changeset viewer.