# CutBox.app

## Coverage Report

#### Created: 2024-03-12 03:40

    .../Source/App/Preferences/PreferencesAdvancedView.swift

    Line

    Count

    Source

    1

    //

    2

    //  PreferencesAdvancedView.swift

    3

    //  CutBox

    4

    //

    5

    //  Created by Jason Milkins on 13/5/18.

    6

    //  Copyright © 2018-2023 ocodo. All rights reserved.

    7

    //

    8

    9

    import Cocoa

    10

    import RxSwift

    11

    12

    class PreferencesAdvancedView: CutBoxBaseView {

    13

    14

        var prefs: CutBoxPreferencesService!

    15

    51

        let disposeBag = DisposeBag()

    16

    17

        @IBOutlet weak var historyLimitTitle: CutBoxBaseTextField!

    18

        @IBOutlet weak var historyLimitTextField: CutBoxBaseTextField!

    19

        @IBOutlet weak var historyUnlimitedCheckbox: CutBoxBaseButton!

    20

        @IBOutlet weak var historySizeLabel: CutBoxBaseTextField!

    21

        @IBOutlet weak var clearHistoryDropDown: CutBoxBasePopUpButton!

    22

        @IBOutlet weak var clearHistoryActionButton: CutBoxBaseButton!

    23

    24

        @IBOutlet weak var joinAndWrapSectionTitle: CutBoxBaseTextField!

    25

        @IBOutlet weak var joinAndWrapNote: CutBoxBaseTextFieldCell!

    26

        @IBOutlet weak var joinClipsTitle: CutBoxBaseTextField!

    27

        @IBOutlet weak var joinStyleSelector: CutBoxBaseSegmentedControl!

    28

        @IBOutlet weak var joinStringTextField: CutBoxBaseTextField!

    29

    30

        @IBOutlet weak var shouldWrapMultipleSelection: CutBoxBaseButton!

    31

        @IBOutlet weak var wrapStartTextField: CutBoxBaseTextField!

    32

        @IBOutlet weak var wrapEndTextField: CutBoxBaseTextField!

    33

    34

    51

        var dialogFactory: DialogFactory = DialogFactory()

    35

    36

    51

        let clearHistoryOptions: [(title: String, offset: TimeInterval?)] = [

    37

    51

          (title: "preferences_history_select_option".l7n, offset: nil),

    38

    51

          (title: "preferences_history_clear_last_5_minutes".l7n, offset: 300),

    39

    51

          (title: "preferences_history_clear_last_hour".l7n, offset: 3600),

    40

    51

          (title: "preferences_history_clear_last_24_hours".l7n, offset: 86400),

    41

    51

          (title: "preferences_history_clear_older_than_7_days".l7n, offset: -604800),

    42

    51

          (title: "preferences_history_clear_older_than_30_days".l7n, offset: -2592000),

    43

    51

          (title: "preferences_history_clear_entire_history".l7n, offset: 0)

    44

    51

        ]

    45

    46

    50

        override func awakeFromNib() {

    47

    50

            prefs = CutBoxPreferencesService.shared

    48

    50

    49

    50

            setupWrappingStringTextFields()

    50

    50

            setupJoinStringTextField()

    51

    50

            setupHistoryLimitControls()

    52

    50

            setupHistorySizeLabel()

    53

    50

            setupClearHistoryControls()

    54

    50

        }

    55

    56

    1

        @IBAction func joinStyleSelectorAction(_ sender: Any) {

    57

    1

            if let selector: CutBoxBaseSegmentedControl = sender as? CutBoxBaseSegmentedControl {

    58

    1

                let bool = selector.selectedSegment == 1

    59

    1

                joinStringTextField.isHidden = !bool

    60

    1

                joinStringTextField.isEnabled = bool

    61

    1

                prefs.useJoinString = bool

    62

    1

            }

    63

    1

        }

    64

    }