Skip to content

Commit ad8dc38

Browse files
author
Paul Harrison
committed
MythVideo: Update the menus to use MythMenu.
1 parent d66b794 commit ad8dc38

File tree

2 files changed

+110
-144
lines changed

2 files changed

+110
-144
lines changed

mythtv/programs/mythfrontend/videodlg.cpp

Lines changed: 103 additions & 138 deletions
Original file line numberDiff line numberDiff line change
@@ -2326,12 +2326,7 @@ void VideoDialog::VideoMenu()
23262326
else
23272327
label = tr("Video Options");
23282328

2329-
m_menuPopup = new MythDialogBox(label, m_popupStack, "videomenupopup");
2330-
2331-
if (m_menuPopup->Create())
2332-
m_popupStack->AddScreen(m_menuPopup);
2333-
2334-
m_menuPopup->SetReturnEvent(this, "actions");
2329+
MythMenu *menu = new MythMenu(label, this, "actions");
23352330

23362331
MythUIButtonListItem *item = GetItemCurrent();
23372332
MythGenericTree *node = GetNodePtrFromButton(item);
@@ -2340,67 +2335,70 @@ void VideoDialog::VideoMenu()
23402335
if (!metadata->GetTrailer().isEmpty() ||
23412336
gCoreContext->GetNumSetting("mythvideo.TrailersRandomEnabled", 0) ||
23422337
m_d->m_altPlayerEnabled)
2343-
m_menuPopup->AddButton(tr("Play..."), SLOT(PlayMenu()), true);
2338+
menu->AddItem(tr("Play..."), NULL, CreatePlayMenu());
23442339
else
2345-
m_menuPopup->AddButton(tr("Play"), SLOT(playVideo()));
2340+
menu->AddItem(tr("Play"), SLOT(playVideo()));
23462341
if (metadata->GetWatched())
2347-
m_menuPopup->AddButton(tr("Mark as Unwatched"), SLOT(ToggleWatched()));
2342+
menu->AddItem(tr("Mark as Unwatched"), SLOT(ToggleWatched()));
23482343
else
2349-
m_menuPopup->AddButton(tr("Mark as Watched"), SLOT(ToggleWatched()));
2350-
m_menuPopup->AddButton(tr("Video Info"), SLOT(InfoMenu()), true);
2351-
m_menuPopup->AddButton(tr("Change Video Details"), SLOT(ManageMenu()), true);
2344+
menu->AddItem(tr("Mark as Watched"), SLOT(ToggleWatched()));
2345+
menu->AddItem(tr("Video Info"), NULL, CreateInfoMenu());
2346+
menu->AddItem(tr("Change Video Details"), NULL, CreateManageMenu());
23522347

23532348
if (m_d->m_type == DLG_MANAGER)
23542349
{
2355-
m_menuPopup->AddButton(tr("Delete"), SLOT(RemoveVideo()));
2350+
menu->AddItem(tr("Delete"), SLOT(RemoveVideo()));
23562351
}
23572352
}
23582353
if (node && !(node->getInt() >= 0) && node->getInt() != kUpFolder)
2359-
m_menuPopup->AddButton(tr("Play Folder"), SLOT(playFolder()));
2354+
menu->AddItem(tr("Play Folder"), SLOT(playFolder()));
2355+
2356+
2357+
m_menuPopup = new MythDialogBox(menu, m_popupStack, "videomenupopup");
2358+
2359+
if (m_menuPopup->Create())
2360+
m_popupStack->AddScreen(m_menuPopup);
2361+
else
2362+
delete m_menuPopup;
23602363
}
23612364

2362-
/** \fn VideoDialog::PlayMenu()
2363-
* \brief Pop up a MythUI "Play Menu" for MythVideo. Appears if multiple play
2365+
/** \fn VideoDialog::CreatePlayMenu()
2366+
* \brief Create a "Play Menu" for MythVideo. Appears if multiple play
23642367
* options exist.
2365-
* \return void.
2368+
* \return MythMenu*.
23662369
*/
2367-
void VideoDialog::PlayMenu()
2370+
MythMenu* VideoDialog::CreatePlayMenu()
23682371
{
23692372
VideoMetadata *metadata = GetMetadata(GetItemCurrent());
23702373
QString label;
23712374

23722375
if (metadata)
23732376
label = tr("Playback Options\n%1").arg(metadata->GetTitle());
23742377
else
2375-
return;
2376-
2377-
m_menuPopup = new MythDialogBox(label, m_popupStack, "play");
2378+
return NULL;
23782379

2379-
if (m_menuPopup->Create())
2380-
m_popupStack->AddScreen(m_menuPopup);
2380+
MythMenu *menu = new MythMenu(label, this, "actions");
23812381

2382-
m_menuPopup->SetReturnEvent(this, "actions");
2383-
2384-
m_menuPopup->AddButton(tr("Play"), SLOT(playVideo()));
2382+
menu->AddItem(tr("Play"), SLOT(playVideo()));
23852383

23862384
if (m_d->m_altPlayerEnabled)
23872385
{
2388-
m_menuPopup->AddButton(tr("Play in Alternate Player"), SLOT(playVideoAlt()));
2386+
menu->AddItem(tr("Play in Alternate Player"), SLOT(playVideoAlt()));
23892387
}
23902388

23912389
if (gCoreContext->GetNumSetting("mythvideo.TrailersRandomEnabled", 0))
23922390
{
2393-
m_menuPopup->AddButton(tr("Play With Trailers"),
2394-
SLOT(playVideoWithTrailers()));
2391+
menu->AddItem(tr("Play With Trailers"), SLOT(playVideoWithTrailers()));
23952392
}
23962393

23972394
QString trailerFile = metadata->GetTrailer();
23982395
if (QFile::exists(trailerFile) ||
23992396
(!metadata->GetHost().isEmpty() && !trailerFile.isEmpty()))
24002397
{
2401-
m_menuPopup->AddButton(tr("Play Trailer"),
2402-
SLOT(playTrailer()));
2398+
menu->AddItem(tr("Play Trailer"), SLOT(playTrailer()));
24032399
}
2400+
2401+
return menu;
24042402
}
24052403

24062404
/** \fn VideoDialog::DisplayMenu()
@@ -2411,87 +2409,73 @@ void VideoDialog::DisplayMenu()
24112409
{
24122410
QString label = tr("Video Display Menu");
24132411

2414-
m_menuPopup = new MythDialogBox(label, m_popupStack, "videomenupopup");
2415-
2416-
if (m_menuPopup->Create())
2417-
m_popupStack->AddScreen(m_menuPopup);
2412+
MythMenu *menu = new MythMenu(label, this, "display");
24182413

2419-
m_menuPopup->SetReturnEvent(this, "display");
2414+
menu->AddItem(tr("Scan For Changes"), SLOT(doVideoScan()));
2415+
menu->AddItem(tr("Retrieve All Details"), SLOT(VideoAutoSearch()));
2416+
menu->AddItem(tr("Filter Display"), SLOT(ChangeFilter()));
2417+
menu->AddItem(tr("Browse By..."), NULL, CreateMetadataBrowseMenu());
2418+
menu->AddItem(tr("Change View"), NULL, CreateViewMenu());
2419+
menu->AddItem(tr("Settings"), NULL, CreateSettingsMenu());
24202420

2421-
m_menuPopup->AddButton(tr("Scan For Changes"), SLOT(doVideoScan()));
2422-
m_menuPopup->AddButton(tr("Retrieve All Details"), SLOT(VideoAutoSearch()));
2423-
m_menuPopup->AddButton(tr("Filter Display"), SLOT(ChangeFilter()));
2421+
m_menuPopup = new MythDialogBox(menu, m_popupStack, "videomenupopup");
24242422

2425-
m_menuPopup->AddButton(tr("Browse By..."), SLOT(MetadataBrowseMenu()), true);
2426-
2427-
m_menuPopup->AddButton(tr("Change View"), SLOT(ViewMenu()), true);
2428-
2429-
m_menuPopup->AddButton(tr("Settings"), SLOT(SettingsMenu()), true);
2423+
if (m_menuPopup->Create())
2424+
m_popupStack->AddScreen(m_menuPopup);
2425+
else
2426+
delete m_menuPopup;
24302427
}
24312428

2432-
/** \fn VideoDialog::ViewMenu()
2433-
* \brief Pop up a MythUI Menu for MythVideo Views.
2434-
* \return void.
2429+
/** \fn VideoDialog::CreateViewMenu()
2430+
* \brief Create a MythMenu for MythVideo Views.
2431+
* \return MythMenu.
24352432
*/
2436-
void VideoDialog::ViewMenu()
2433+
MythMenu* VideoDialog::CreateViewMenu()
24372434
{
24382435
QString label = tr("Change View");
24392436

2440-
m_menuPopup = new MythDialogBox(label, m_popupStack, "videomenupopup");
2441-
2442-
if (m_menuPopup->Create())
2443-
m_popupStack->AddScreen(m_menuPopup);
2444-
2445-
m_menuPopup->SetReturnEvent(this, "view");
2437+
MythMenu *menu = new MythMenu(label, this, "view");
24462438

24472439
if (!(m_d->m_type & DLG_BROWSER))
2448-
m_menuPopup->AddButton(tr("Switch to Browse View"),
2449-
SLOT(SwitchBrowse()));
2440+
menu->AddItem(tr("Switch to Browse View"), SLOT(SwitchBrowse()));
24502441

24512442
if (!(m_d->m_type & DLG_GALLERY))
2452-
m_menuPopup->AddButton(tr("Switch to Gallery View"),
2453-
SLOT(SwitchGallery()));
2443+
menu->AddItem(tr("Switch to Gallery View"), SLOT(SwitchGallery()));
24542444

24552445
if (!(m_d->m_type & DLG_TREE))
2456-
m_menuPopup->AddButton(tr("Switch to List View"), SLOT(SwitchTree()));
2446+
menu->AddItem(tr("Switch to List View"), SLOT(SwitchTree()));
24572447

24582448
if (!(m_d->m_type & DLG_MANAGER))
2459-
m_menuPopup->AddButton(tr("Switch to Manage View"),
2460-
SLOT(SwitchManager()));
2449+
menu->AddItem(tr("Switch to Manage View"), SLOT(SwitchManager()));
24612450

24622451
if (m_d->m_isFileBrowser)
2463-
m_menuPopup->AddButton(tr("Disable File Browse Mode"),
2464-
SLOT(ToggleBrowseMode()));
2452+
menu->AddItem(tr("Disable File Browse Mode"), SLOT(ToggleBrowseMode()));
24652453
else
2466-
m_menuPopup->AddButton(tr("Enable File Browse Mode"),
2467-
SLOT(ToggleBrowseMode()));
2454+
menu->AddItem(tr("Enable File Browse Mode"), SLOT(ToggleBrowseMode()));
24682455

24692456
if (m_d->m_isFlatList)
2470-
m_menuPopup->AddButton(tr("Disable Flat View"),
2471-
SLOT(ToggleFlatView()));
2457+
menu->AddItem(tr("Disable Flat View"), SLOT(ToggleFlatView()));
24722458
else
2473-
m_menuPopup->AddButton(tr("Enable Flat View"),
2474-
SLOT(ToggleFlatView()));
2459+
menu->AddItem(tr("Enable Flat View"), SLOT(ToggleFlatView()));
2460+
2461+
return menu;
24752462
}
24762463

2477-
/** \fn VideoDialog::SettingsMenu()
2478-
* \brief Pop up a MythUI Menu for MythVideo Settings.
2464+
/** \fn VideoDialog::CreateSettingsMenu()
2465+
* \brief Create a MythMenu for MythVideo Settings.
24792466
* \return void.
24802467
*/
2481-
void VideoDialog::SettingsMenu()
2468+
MythMenu* VideoDialog::CreateSettingsMenu()
24822469
{
24832470
QString label = tr("Video Settings");
24842471

2485-
m_menuPopup = new MythDialogBox(label, m_popupStack, "videosettingspopup");
2472+
MythMenu *menu = new MythMenu(label, this, "settings");
24862473

2487-
if (m_menuPopup->Create())
2488-
m_popupStack->AddScreen(m_menuPopup);
2474+
menu->AddItem(tr("Player Settings"), SLOT(ShowPlayerSettings()));
2475+
menu->AddItem(tr("Metadata Settings"), SLOT(ShowMetadataSettings()));
2476+
menu->AddItem(tr("File Type Settings"), SLOT(ShowExtensionSettings()));
24892477

2490-
m_menuPopup->SetReturnEvent(this, "view");
2491-
2492-
m_menuPopup->AddButton(tr("Player Settings"), SLOT(ShowPlayerSettings()));
2493-
m_menuPopup->AddButton(tr("Metadata Settings"), SLOT(ShowMetadataSettings()));
2494-
m_menuPopup->AddButton(tr("File Type Settings"), SLOT(ShowExtensionSettings()));
2478+
return menu;
24952479
}
24962480

24972481
/** \fn VideoDialog::ShowPlayerSettings()
@@ -2536,116 +2520,97 @@ void VideoDialog::ShowExtensionSettings()
25362520
delete fa;
25372521
}
25382522

2539-
/** \fn VideoDialog::MetadataBrowseMenu()
2540-
* \brief Pop up a MythUI Menu for MythVideo Metadata Browse modes.
2523+
/** \fn VideoDialog::CreateMetadataBrowseMenu()
2524+
* \brief Create a MythMenu for MythVideo Metadata Browse modes.
25412525
* \return void.
25422526
*/
2543-
void VideoDialog::MetadataBrowseMenu()
2527+
MythMenu* VideoDialog::CreateMetadataBrowseMenu()
25442528
{
25452529
QString label = tr("Browse By");
25462530

2547-
m_menuPopup = new MythDialogBox(label, m_popupStack, "videomenupopup");
2548-
2549-
if (m_menuPopup->Create())
2550-
m_popupStack->AddScreen(m_menuPopup);
2551-
2552-
m_menuPopup->SetReturnEvent(this, "metadata");
2531+
MythMenu *menu = new MythMenu(label, this, "metadata");
25532532

25542533
if (m_d->m_groupType != BRS_CAST)
2555-
m_menuPopup->AddButton(tr("Cast"),
2556-
SLOT(SwitchVideoCastGroup()));
2534+
menu->AddItem(tr("Cast"), SLOT(SwitchVideoCastGroup()));
25572535

25582536
if (m_d->m_groupType != BRS_CATEGORY)
2559-
m_menuPopup->AddButton(tr("Category"),
2560-
SLOT(SwitchVideoCategoryGroup()));
2537+
menu->AddItem(tr("Category"), SLOT(SwitchVideoCategoryGroup()));
25612538

25622539
if (m_d->m_groupType != BRS_INSERTDATE)
2563-
m_menuPopup->AddButton(tr("Date Added"),
2564-
SLOT(SwitchVideoInsertDateGroup()));
2540+
menu->AddItem(tr("Date Added"), SLOT(SwitchVideoInsertDateGroup()));
25652541

25662542
if (m_d->m_groupType != BRS_DIRECTOR)
2567-
m_menuPopup->AddButton(tr("Director"),
2568-
SLOT(SwitchVideoDirectorGroup()));
2543+
menu->AddItem(tr("Director"), SLOT(SwitchVideoDirectorGroup()));
25692544

25702545
if (m_d->m_groupType != BRS_STUDIO)
2571-
m_menuPopup->AddButton(tr("Studio"),
2572-
SLOT(SwitchVideoStudioGroup()));
2546+
menu->AddItem(tr("Studio"), SLOT(SwitchVideoStudioGroup()));
25732547

25742548
if (m_d->m_groupType != BRS_FOLDER)
2575-
m_menuPopup->AddButton(tr("Folder"),
2576-
SLOT(SwitchVideoFolderGroup()));
2549+
menu->AddItem(tr("Folder"), SLOT(SwitchVideoFolderGroup()));
25772550

25782551
if (m_d->m_groupType != BRS_GENRE)
2579-
m_menuPopup->AddButton(tr("Genre"),
2580-
SLOT(SwitchVideoGenreGroup()));
2552+
menu->AddItem(tr("Genre"), SLOT(SwitchVideoGenreGroup()));
25812553

25822554
if (m_d->m_groupType != BRS_TVMOVIE)
2583-
m_menuPopup->AddButton(tr("TV/Movies"),
2584-
SLOT(SwitchVideoTVMovieGroup()));
2555+
menu->AddItem(tr("TV/Movies"),SLOT(SwitchVideoTVMovieGroup()));
25852556

25862557
if (m_d->m_groupType != BRS_USERRATING)
2587-
m_menuPopup->AddButton(tr("User Rating"),
2588-
SLOT(SwitchVideoUserRatingGroup()));
2558+
menu->AddItem(tr("User Rating"), SLOT(SwitchVideoUserRatingGroup()));
25892559

25902560
if (m_d->m_groupType != BRS_YEAR)
2591-
m_menuPopup->AddButton(tr("Year"),
2592-
SLOT(SwitchVideoYearGroup()));
2561+
menu->AddItem(tr("Year"), SLOT(SwitchVideoYearGroup()));
2562+
2563+
return menu;
25932564
}
25942565

2595-
/** \fn VideoDialog::InfoMenu()
2596-
* \brief Pop up a MythUI Menu for Info pertaining to the selected item.
2597-
* \return void.
2566+
/** \fn VideoDialog::CreateInfoMenu()
2567+
* \brief Create a MythMenu for Info pertaining to the selected item.
2568+
* \return MythMenu*.
25982569
*/
2599-
void VideoDialog::InfoMenu()
2570+
MythMenu *VideoDialog::CreateInfoMenu()
26002571
{
26012572
QString label = tr("Video Info");
26022573

2603-
m_menuPopup = new MythDialogBox(label, m_popupStack, "videomenupopup");
2604-
2605-
if (m_menuPopup->Create())
2606-
m_popupStack->AddScreen(m_menuPopup);
2607-
2608-
m_menuPopup->SetReturnEvent(this, "info");
2574+
MythMenu *menu = new MythMenu(label, this, "info");
26092575

26102576
if (ItemDetailPopup::Exists())
2611-
m_menuPopup->AddButton(tr("View Details"), SLOT(DoItemDetailShow()));
2577+
menu->AddItem(tr("View Details"), SLOT(DoItemDetailShow()));
26122578

2613-
m_menuPopup->AddButton(tr("View Full Plot"), SLOT(ViewPlot()));
2579+
menu->AddItem(tr("View Full Plot"), SLOT(ViewPlot()));
26142580

26152581
VideoMetadata *metadata = GetMetadata(GetItemCurrent());
26162582
if (metadata)
26172583
{
26182584
if (metadata->GetCast().size())
2619-
m_menuPopup->AddButton(tr("View Cast"), SLOT(ShowCastDialog()));
2585+
menu->AddItem(tr("View Cast"), SLOT(ShowCastDialog()));
26202586
if (!metadata->GetHomepage().isEmpty())
2621-
m_menuPopup->AddButton(tr("View Homepage"), SLOT(ShowHomepage()));
2587+
menu->AddItem(tr("View Homepage"), SLOT(ShowHomepage()));
26222588
}
2589+
2590+
return menu;
26232591
}
26242592

2625-
/** \fn VideoDialog::ManageMenu()
2626-
* \brief Pop up a MythUI Menu for metadata management.
2627-
* \return void.
2593+
/** \fn VideoDialog::CreateManageMenu()
2594+
* \brief Create a MythMenu for metadata management.
2595+
* \return MythMenu*.
26282596
*/
2629-
void VideoDialog::ManageMenu()
2597+
MythMenu *VideoDialog::CreateManageMenu()
26302598
{
26312599
QString label = tr("Manage Video Details");
26322600

2633-
m_menuPopup = new MythDialogBox(label, m_popupStack, "videomenupopup");
2634-
2635-
if (m_menuPopup->Create())
2636-
m_popupStack->AddScreen(m_menuPopup);
2601+
MythMenu *menu = new MythMenu(label, this, "manage");
26372602

26382603
VideoMetadata *metadata = GetMetadata(GetItemCurrent());
26392604

2640-
m_menuPopup->SetReturnEvent(this, "manage");
2641-
2642-
m_menuPopup->AddButton(tr("Edit Details"), SLOT(EditMetadata()));
2643-
m_menuPopup->AddButton(tr("Retrieve Details"), SLOT(VideoSearch()));
2605+
menu->AddItem(tr("Edit Details"), SLOT(EditMetadata()));
2606+
menu->AddItem(tr("Retrieve Details"), SLOT(VideoSearch()));
26442607
if (metadata->GetProcessed())
2645-
m_menuPopup->AddButton(tr("Allow Updates"), SLOT(ToggleProcess()));
2608+
menu->AddItem(tr("Allow Updates"), SLOT(ToggleProcess()));
26462609
else
2647-
m_menuPopup->AddButton(tr("Disable Updates"), SLOT(ToggleProcess()));
2648-
m_menuPopup->AddButton(tr("Reset Details"), SLOT(ResetMetadata()));
2610+
menu->AddItem(tr("Disable Updates"), SLOT(ToggleProcess()));
2611+
menu->AddItem(tr("Reset Details"), SLOT(ResetMetadata()));
2612+
2613+
return menu;
26492614
}
26502615

26512616
void VideoDialog::ToggleProcess()

0 commit comments

Comments
 (0)