Esempio n. 1
0
        private void BuildFormatComboBox()
        {
            SubtitleType         fixedSubtitleType = GetFixedSubtitleType();
            ConfigFileSaveFormat formatConfig      = Base.Config.FileSaveFormat;

            if (formatConfig == ConfigFileSaveFormat.Fixed)
            {
                fixedSubtitleType = Base.Config.FileSaveFormatFixed;
            }

            /* Check if fixed subtitle type has been correctly identified */
            if (fixedSubtitleType == SubtitleType.Unknown)
            {
                fixedSubtitleType = SubtitleType.SubRip;
            }

            formatComboBox = new SubtitleFormatComboBox(fixedSubtitleType, null);
            formatComboBox.SelectionChanged += OnFormatChanged;
        }
        private SubtitleFormatComboBox BuildFileSaveFormatComboBox()
        {
            string[]     additionalActions = { Catalog.GetString("Keep the format used on file open"), Catalog.GetString("Remember the last used format") };
            SubtitleType fixedFormat       = SubtitleType.Unknown;
            ConfigFileSaveFormatOption fileSaveFormatOption = Base.Config.FileSaveFormatOption;

            if (fileSaveFormatOption == ConfigFileSaveFormatOption.Specific)
            {
                fixedFormat = Base.Config.FileSaveFormatFixed;
            }

            SubtitleFormatComboBox comboBox = new SubtitleFormatComboBox(fixedFormat, additionalActions);

            if (fileSaveFormatOption != ConfigFileSaveFormatOption.Specific)
            {
                comboBox.ActiveSelection = (int)fileSaveFormatOption;
            }
            comboBox.SelectionChanged += OnDefaultsFileSaveFormatChanged;
            return(comboBox);
        }
        private Widget BuildFilesPage()
        {
            Box box = new Box(Orientation.Vertical, WidgetStyles.BoxSpacingLarge);

            box.BorderWidth = WidgetStyles.BorderWidthLarge;

            //Translation File Saving

            CheckButton translationFileSaving = new CheckButton(Catalog.GetString("When saving subtitle files, automatically save their _translation"));

            translationFileSaving.Active   = Base.Config.FileTranslationSaveAll;
            translationFileSaving.Toggled += OnTranslationSaveAllToggled;
            box.Add(Util.CreateFrameWithContent(Catalog.GetString("Translation File Saving"), translationFileSaving));


            //File Open Dialog

            Grid fileOpenDialogGrid = new Grid();

            fileOpenDialogGrid.RowSpacing    = WidgetStyles.RowSpacingMedium;
            fileOpenDialogGrid.ColumnSpacing = WidgetStyles.ColumnSpacingMedium;

            fileOpenDialogGrid.Attach(Util.CreateLabel(Catalog.GetString("Character c_oding to use:"), 0, 0.5f), 0, 0, 1, 1);
            fileOpenEncoding = BuildFileOpenEncodingComboBox();
            fileOpenDialogGrid.Attach(fileOpenEncoding.Widget, 1, 0, 1, 1);

            fileOpenDialogGrid.Attach(Util.CreateLabel(Catalog.GetString("If auto detection _fails, use:"), 0, 0.5f), 0, 1, 1, 1);
            fileOpenFallbackEncoding = BuildFileOpenFallbackEncodingComboBox();
            fileOpenDialogGrid.Attach(fileOpenFallbackEncoding.Widget, 1, 1, 1, 1);

            CheckButton videoAutoChoose = new CheckButton(Catalog.GetString("Automatically choose the _video file to open"));

            videoAutoChoose.Active   = Base.Config.VideoAutoChooseFile;
            videoAutoChoose.Toggled += OnVideoAutoChooseFileToggled;
            fileOpenDialogGrid.Attach(videoAutoChoose, 0, 2, 2, 1);

            box.Add(Util.CreateFrameWithContent(Catalog.GetString("File Open Dialog"), fileOpenDialogGrid));


            //File Save As Dialog

            Grid fileSaveAsDialogGrid = new Grid();

            fileSaveAsDialogGrid.RowSpacing    = WidgetStyles.RowSpacingMedium;
            fileSaveAsDialogGrid.ColumnSpacing = WidgetStyles.ColumnSpacingMedium;

            fileSaveAsDialogGrid.Attach(Util.CreateLabel(Catalog.GetString("_Subtitle format to use:"), 0, 0.5f), 0, 0, 1, 1);
            fileSaveFormat = BuildFileSaveFormatComboBox();
            fileSaveAsDialogGrid.Attach(fileSaveFormat.Widget, 1, 0, 1, 1);

            fileSaveAsDialogGrid.Attach(Util.CreateLabel(Catalog.GetString("Ch_aracter coding to use:"), 0, 0.5f), 0, 1, 1, 1);
            fileSaveEncoding = BuildFileSaveEncodingComboBox();
            fileSaveAsDialogGrid.Attach(fileSaveEncoding.Widget, 1, 1, 1, 1);

            fileSaveAsDialogGrid.Attach(Util.CreateLabel(Catalog.GetString("_Newline type to use:"), 0, 0.5f), 0, 2, 1, 1);
            fileSaveNewline = BuildFileSaveNewlineComboBox();
            fileSaveAsDialogGrid.Attach(fileSaveNewline.Widget, 1, 2, 1, 1);

            box.Add(Util.CreateFrameWithContent(Catalog.GetString("File Save As Dialog"), fileSaveAsDialogGrid));


            //Backup

            Box  backupBox         = new Box(Orientation.Horizontal, 3);
            bool autoBackupEnabled = Base.Config.BackupAuto;

            CheckButton backupCheckButton = new CheckButton(Catalog.GetString("Create a _backup copy of files every"));

            backupCheckButton.Active   = autoBackupEnabled;
            backupCheckButton.Toggled += OnAutoBackupToggled;
            backupBox.Add(backupCheckButton);

            autoBackupSpinButton            = new SpinButton(1, 90, 1);
            autoBackupSpinButton.Numeric    = true;
            autoBackupSpinButton.WidthChars = 2;
            autoBackupSpinButton.Sensitive  = autoBackupEnabled;
            autoBackupSpinButton.Value      = Base.Config.BackupTime / 60; //Minutes
            autoBackupSpinButton.Changed   += OnAutoBackupTimeSpinButtonValueChanged;
            backupBox.Add(autoBackupSpinButton);

            backupBox.Add(new Label(Catalog.GetString("minutes")));

            box.Add(Util.CreateFrameWithContent(Catalog.GetString("Backup"), backupBox));

            return(box);
        }