Esempio n. 1
0
        public FormatSettings(Format.ExportFormats format, MainWindow parent)
        {
            this.InitializeComponent();
            this.Owner = parent;

            //Дефолты
            this.format = format;
            this.def = Formats.GetDefaults(format);

            //Включаем\выключаем редактирование
            //Video
            textbox_vcodecs.IsEnabled = def.VCodecs_IsEditable;
            textbox_framerates.IsEnabled = def.Framerates_IsEditable;
            combo_MinResolutionW.IsEnabled = combo_MinResolutionH.IsEnabled =
                combo_MidResolutionW.IsEnabled = combo_MidResolutionH.IsEnabled =
                combo_MaxResolutionW.IsEnabled = combo_MaxResolutionH.IsEnabled =
                combo_ValidModW.IsEnabled = combo_ValidModH.IsEnabled = def.Resolution_IsEditable;
            textbox_aspects.IsEnabled = def.Aspects_IsEditable;
            combo_fix_ar_method.IsEnabled = (def.LockedAR_Methods.Length > 1);
            check_anamorphic.IsEnabled = def.Anamorphic_IsEditable;
            check_interlaced.IsEnabled = def.Interlaced_IsEditable;

            //Audio
            textbox_acodecs.IsEnabled = def.ACodecs_IsEditable;
            textbox_samplerates.IsEnabled = def.Samplerates_IsEditable;
            check_stereo.IsEnabled = def.LimitedToStereo_IsEditable;

            //Muxing
            combo_Muxer.IsEnabled = (def.Muxers.Length > 1);
            combo_Extension.IsEnabled = (def.Extensions.Length > 1);
            combo_split.IsEnabled = (def.Splitting != "None");
            check_dont_mux.IsEnabled = def.DontMuxStreams_IsEditable;
            check_direct_encoding.IsEnabled = def.DirectEncoding_IsEditable;
            check_direct_remux.IsEnabled = def.DirectRemuxing_IsEditable;
            check_4gb_only.IsEnabled = def.LimitedTo4Gb_IsEditable;

            //Переводим фокус
            int active_tab = 0;
            if (int.TryParse(Settings.GetFormatPreset(format, "ActiveTab"), out active_tab))
            {
                if (active_tab == 2) tab_audio.IsSelected = true;
                else if (active_tab == 3) tab_muxing.IsSelected = true;
            }

            LoadSettings();
            TranslateItems();
            SetTooltips();

            //Предупреждение (один раз для каждого формата)
            if (format != Format.ExportFormats.Custom && !Convert.ToBoolean(Settings.GetFormatPreset(format, "was_warned")))
            {
                Message mes = new Message(parent);
                mes.ShowMessage(Languages.Translate("Some options or their combinations may not work as you expect!") + "\r\n" +
                    Languages.Translate("After making any changes the format may become completely broken!"), Languages.Translate("Warning"), Message.MessageStyle.Ok);
                Settings.SetFormatPreset(format, "was_warned", bool.TrueString);
            }

            ShowDialog();
        }
Esempio n. 2
0
 private void StoreValue(Format.ExportFormats format, string key, string value)
 {
     try
     {
         Formats.SetSettings(format, key, value);
     }
     catch (Exception ex)
     {
         ErrorException("StoreValue: " + ex.Message, ex.StackTrace);
     }
 }