From e075f458675d6777c8db51375ca2114405fe2a67 Mon Sep 17 00:00:00 2001 From: "[CST] Focus" Date: Sat, 5 May 2012 16:58:49 +0400 Subject: [PATCH] gui/videosettings.cpp: fix memleaks when using CMenuForwarder; comment not needed anotify->changeNotify every menu show; indent showVideoSetup --- src/gui/videosettings.cpp | 42 +++++++++++++++++++-------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/src/gui/videosettings.cpp b/src/gui/videosettings.cpp index 2790b7fe3..8d796e186 100644 --- a/src/gui/videosettings.cpp +++ b/src/gui/videosettings.cpp @@ -183,7 +183,7 @@ int CVideoSettings::showVideoSetup() CMenuWidget * videosetup = new CMenuWidget(LOCALE_MAINSETTINGS_HEAD, NEUTRINO_ICON_SETTINGS, width); videosetup->setSelected(selected); videosetup->setWizardMode(is_wizard); - + //analog options unsigned int system_rev = cs_get_revision(); CMenuOptionChooser * vs_analg_ch = NULL; @@ -197,33 +197,33 @@ int CVideoSettings::showVideoSetup() { if(system_rev != 10) vs_scart_ch = new CMenuOptionChooser(LOCALE_VIDEOMENU_SCART, &g_settings.analog_mode1, VIDEOMENU_VIDEOSIGNAL_HD1PLUS_SCART_OPTIONS, VIDEOMENU_VIDEOSIGNAL_HD1PLUS_SCART_OPTION_COUNT, true, this); - + vs_chinch_ch = new CMenuOptionChooser(LOCALE_VIDEOMENU_CINCH, &g_settings.analog_mode2, VIDEOMENU_VIDEOSIGNAL_HD1PLUS_CINCH_OPTIONS, VIDEOMENU_VIDEOSIGNAL_HD1PLUS_CINCH_OPTION_COUNT, true, this); } - + //4:3 mode CMenuOptionChooser * vs_43mode_ch = new CMenuOptionChooser(LOCALE_VIDEOMENU_43MODE, &g_settings.video_43mode, VIDEOMENU_43MODE_OPTIONS, VIDEOMENU_43MODE_OPTION_COUNT, true, this); - + //display format - CMenuOptionChooser * vs_dispformat_ch = new CMenuOptionChooser(LOCALE_VIDEOMENU_VIDEOFORMAT, &g_settings.video_Format, VIDEOMENU_VIDEOFORMAT_OPTIONS, VIDEOMENU_VIDEOFORMAT_OPTION_COUNT, true, this); - + CMenuOptionChooser * vs_dispformat_ch = new CMenuOptionChooser(LOCALE_VIDEOMENU_VIDEOFORMAT, &g_settings.video_Format, VIDEOMENU_VIDEOFORMAT_OPTIONS, VIDEOMENU_VIDEOFORMAT_OPTION_COUNT, true, this); + //video system CMenuOptionChooser * vs_videomodes_ch = new CMenuOptionChooser(LOCALE_VIDEOMENU_VIDEOMODE, &g_settings.video_Mode, VIDEOMENU_VIDEOMODE_OPTIONS, VIDEOMENU_VIDEOMODE_OPTION_COUNT, true, this, CRCInput::RC_nokey, "", true); - + //dbdr options CMenuOptionChooser * vs_dbdropt_ch = new CMenuOptionChooser(LOCALE_VIDEOMENU_DBDR, &g_settings.video_dbdr, VIDEOMENU_DBDR_OPTIONS, VIDEOMENU_DBDR_OPTION_COUNT, true, this); - - //video system modes submenue - CMenuWidget* videomodes = new CMenuWidget(LOCALE_MAINSETTINGS_VIDEO, NEUTRINO_ICON_SETTINGS); - videomodes->addIntroItems(LOCALE_VIDEOMENU_ENABLED_MODES); - - CAutoModeNotifier * anotify = new CAutoModeNotifier(); - for (int i = 0; i < VIDEOMENU_VIDEOMODE_OPTION_COUNT; i++) - videomodes->addItem(new CMenuOptionChooser(VIDEOMENU_VIDEOMODE_OPTIONS[i].valname, &g_settings.enabled_video_modes[i], OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true, anotify)); - anotify->changeNotify(NONEXISTANT_LOCALE, 0); - CMenuForwarder * vs_videomodes_fw = new CMenuForwarder(LOCALE_VIDEOMENU_ENABLED_MODES, true, NULL, videomodes, NULL, CRCInput::RC_red, NEUTRINO_ICON_BUTTON_RED ); - + //video system modes submenue + CMenuWidget videomodes(LOCALE_MAINSETTINGS_VIDEO, NEUTRINO_ICON_SETTINGS); + videomodes.addIntroItems(LOCALE_VIDEOMENU_ENABLED_MODES); + + CAutoModeNotifier * anotify = new CAutoModeNotifier(); + for (int i = 0; i < VIDEOMENU_VIDEOMODE_OPTION_COUNT; i++) + videomodes.addItem(new CMenuOptionChooser(VIDEOMENU_VIDEOMODE_OPTIONS[i].valname, &g_settings.enabled_video_modes[i], OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true, anotify)); + //anotify->changeNotify(NONEXISTANT_LOCALE, 0); + + CMenuForwarder * vs_videomodes_fw = new CMenuForwarder(LOCALE_VIDEOMENU_ENABLED_MODES, true, NULL, &videomodes, NULL, CRCInput::RC_red, NEUTRINO_ICON_BUTTON_RED ); + //--------------------------------------- videosetup->addIntroItems(LOCALE_MAINSETTINGS_VIDEO, LOCALE_VIDEOMENU_TV_SCART); //--------------------------------------- @@ -242,10 +242,10 @@ int CVideoSettings::showVideoSetup() videosetup->addItem(vs_dbdropt_ch); //dbdr options videosetup->addItem(vs_videomodes_fw); //video modes submenue - int res = videosetup->exec(NULL, ""); - videosetup->hide(); + int res = videosetup->exec(NULL, ""); + videosetup->hide(); selected = videosetup->getSelected(); - delete videosetup; + delete videosetup; return res; }